text:
using System;
using PacketDotNet;
using System.Net.NetworkInformation;
using System.Net;

namespace DHCPScan
{
    class DhcpPacket
    {

        public EthernetPacket packet { get; set; }
        private IPv4Packet ipPacket;
        private UdpPacket udpPacket;
        private byte[] payload;
        public byte op { get; set; }
        public byte htype { get; set; }
        public byte hlen { get; set; }
        public byte hops { get; set; }
        public byte[] xid { get; set; }
        public byte[] secs { get; set; }
        public byte[] flags { get; set; }
        public IPAddress ciaddr { get; set; }
        public IPAddress yiaddr { get; set; }
        public IPAddress siaddr { get; set; }
        public IPAddress giaddr { get; set; }
        public PhysicalAddress chaddr { get; set; }
        public byte[] rawOptions { get; set; }
        public string HostName { get; set; }

        public DhcpPacket()
        {
            xid = new byte[4];
            secs = new byte[2];
            flags = new byte[2];
        }

        public void AssembleDiscover(byte[] deviceMAC)
        {
            try
            {
                if (deviceMAC.Length != 6)
                {
                    throw new ArgumentException("Device MAC must be 6 bytes");
                }

                PhysicalAddress dstMAC = PhysicalAddress.Parse("FFFFFFFFFFFF");
                PhysicalAddress srcMAC = PhysicalAddress.Parse(BitConverter.ToString(deviceMAC));
                packet = new EthernetPacket(srcMAC, dstMAC, EthernetPacketType.IpV4);

                IPAddress srcIP = IPAddress.Parse("0.0.0.0");
                IPAddress dstIP = IPAddress.Parse("255.255.255.255");
                ipPacket = new IPv4Packet(srcIP, dstIP);

                udpPacket = new UdpPacket(68, 67);

                payload = new byte[244];
                byte[] xid = new byte[4];
                Random rnd = new Random();
                // OP
                payload[0] = 0x01;
                // HTYPE
                payload[1] = 0x01;
                // HLEN
                payload[2] = 0x06;
                // HOPS [3]
                // XID [4]
                rnd.NextBytes(xid);
                xid.CopyTo(payload, 4);
                // SECS [8]
                // FLAGS [10]
                // CIADDR [12]
                // YIADDR [16]
                // SIADDR [20]
                // GIADDR [24]
                // CHADDR [28]
                deviceMAC.CopyTo(payload, 28);
                // BOOTP Legacy [44]
                // Magic Cookie
                payload[236] = 0x63;
                payload[237] = 0x82;
                payload[238] = 0x53;
                payload[239] = 0x63;
                // Options
                // Message Type DHCPDISCOVER
                payload[240] = 53;
                payload[241] = 0x01;
                payload[242] = 0x01;

                // Host Name
                //payload[243] = 12;
                //payload[244] = 0x03;
                //payload[245] = 0x53;
                //payload[246] = 0x54;
                //payload[247] = 0x55;

                //End Option
                payload[243] = 0xFF;

                udpPacket.PayloadData = payload;
                ipPacket.PayloadPacket = udpPacket;
                packet.PayloadPacket = ipPacket;

                udpPacket.UpdateUDPChecksum();
                ipPacket.UpdateIPChecksum();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

        /**
         * Generates new transaction ID for the DHCP packet
         **/
        public void GenerateNewXid()
        {
            byte[] xid = new byte[4];
            Random rnd = new Random();
            rnd.NextBytes(xid);
            xid.CopyTo(payload, 4);

            udpPacket.UpdateUDPChecksum();
            ipPacket.UpdateIPChecksum();
        }

        internal static DhcpPacket Parse(byte[] data)
        {
            try
            {
                DhcpPacket dhcpPacket = new DhcpPacket();
                byte[] IPBuffer = new byte[4];

                dhcpPacket.op = data[0];
                dhcpPacket.htype = data[1];
                dhcpPacket.hlen = data[2];
                dhcpPacket.hops = data[3];
                Buffer.BlockCopy(data, 4, dhcpPacket.xid, 0, 4);
                Buffer.BlockCopy(data, 8, dhcpPacket.secs, 0, 2);
                Buffer.BlockCopy(data, 10, dhcpPacket.flags, 0, 2);

                Buffer.BlockCopy(data, 12, IPBuffer, 0, 4);
                dhcpPacket.ciaddr = new IPAddress(IPBuffer);

                Buffer.BlockCopy(data, 16, IPBuffer, 0, 4);
                dhcpPacket.yiaddr = new IPAddress(IPBuffer);

                Buffer.BlockCopy(data, 20, IPBuffer, 0, 4);
                dhcpPacket.siaddr = new IPAddress(IPBuffer);

                Buffer.BlockCopy(data, 24, IPBuffer, 0, 4);
                dhcpPacket.giaddr = new IPAddress(IPBuffer);

                int hlen = Convert.ToInt16(dhcpPacket.hlen);
                byte[] MACBuffer = new byte[hlen];
                Buffer.BlockCopy(data, 28, MACBuffer, 0, hlen);
                dhcpPacket.chaddr = new PhysicalAddress(MACBuffer);

                int optionsLen = data.Length - 240;
                dhcpPacket.rawOptions = new byte[optionsLen];
                Buffer.BlockCopy(data, 240, dhcpPacket.rawOptions, 0, optionsLen);

                dhcpPacket.HostName = ParseOption(dhcpPacket.rawOptions, 12);

                return dhcpPacket;

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return null;
            }
        }

        private static string ParseOption(byte[] opts, int optionNo)
        {
            try
            {
                int optsLen = opts.Length;
                int i = 0;
                int code;
                int len;
                byte[] optionValue;

                do
                {
                    code = opts[i++];
                    len = opts[i++];

                    if (code == optionNo)
                    {
                        optionValue = new byte[len];
                        Buffer.BlockCopy(opts, i++, optionValue, 0, len);
                        return System.Text.ASCIIEncoding.ASCII.GetString(optionValue);
                    }
                    else
                    {
                        i += len;
                    }
                }
                while (i <= optsLen);

                return null;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return null;
            }
        }
    }
}


text:
package org.apache.jackrabbit.oak.plugins.version;

import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.spi.commit.DefaultEditor;
import org.apache.jackrabbit.oak.spi.commit.Editor;
import org.apache.jackrabbit.oak.spi.state.DefaultNodeStateDiff;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.jetbrains.annotations.NotNull;

import static com.google.common.base.Preconditions.checkNotNull;
import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
import static org.apache.jackrabbit.JcrConstants.JCR_VERSIONLABELS;
import static org.apache.jackrabbit.oak.commons.PathUtils.concat;
import static org.apache.jackrabbit.oak.commons.PathUtils.getDepth;
import static org.apache.jackrabbit.oak.commons.PathUtils.relativize;
import static org.apache.jackrabbit.oak.spi.state.AbstractNodeState.comparePropertiesAgainstBaseState;
import static org.apache.jackrabbit.oak.spi.version.VersionConstants.VERSION_NODE_TYPE_NAMES;
import static org.apache.jackrabbit.oak.spi.version.VersionConstants.VERSION_STORE_INIT;
import static org.apache.jackrabbit.oak.spi.version.VersionConstants.VERSION_STORE_NT_NAMES;
import static org.apache.jackrabbit.oak.spi.version.VersionConstants.VERSION_STORE_PATH;

/**
 * Validates changes on the version store.
 */
class VersionStorageEditor extends DefaultEditor {

    private static final int VERSION_HISTORY_DEPTH = 6;

    private final NodeBuilder versionStorageNode;
    private final NodeBuilder workspaceRoot;
    private final NodeBuilder builder;
    private final String path;
    private boolean initPhase;
    private ReadWriteVersionManager vMgr;

    VersionStorageEditor(@NotNull NodeBuilder versionStorageNode,
                         @NotNull NodeBuilder workspaceRoot) {
        this(versionStorageNode, workspaceRoot, versionStorageNode,
                VERSION_STORE_PATH);
    }

    private VersionStorageEditor(@NotNull NodeBuilder versionStorageNode,
                                 @NotNull NodeBuilder workspaceRoot,
                                 @NotNull NodeBuilder builder,
                                 @NotNull String path) {
        this.versionStorageNode = checkNotNull(versionStorageNode);
        this.workspaceRoot = checkNotNull(workspaceRoot);
        this.builder = checkNotNull(builder);
        this.path = checkNotNull(path);
    }

    @Override
    public void enter(NodeState before, NodeState after) {
        if (VERSION_STORE_PATH.equals(path)) {
            initPhase = isInitializationPhase(before, after);
        }
    }

    @Override
    public Editor childNodeChanged(String name,
                                   NodeState before,
                                   NodeState after)
            throws CommitFailedException {
        int d = getDepth(path);
        String p = concat(path, name);
        if (d == VERSION_HISTORY_DEPTH
                && name.equals(JCR_VERSIONLABELS)) {
            return new VersionLabelsEditor(p, getVersionManager());
        }
        if (d < VERSION_HISTORY_DEPTH && !isVersionStorageNode(after)) {
            return null;
        }
        return new VersionStorageEditor(versionStorageNode, workspaceRoot,
                builder.child(name), p);
    }

    @Override
    public Editor childNodeAdded(String name, NodeState after)
            throws CommitFailedException {
        int d = getDepth(path);
        // allow child nodes under version storage node, unless an attempt
        // is made to create rep:versionStorage nodes manually.
        if (d == getDepth(VERSION_STORE_PATH) &&
                !isVersionStorageNode(after)) {
            return null;
        }
        // allow node addition during initialization phase
        if (initPhase) {
            return null;
        }
        return throwProtected(name);
    }

    @Override
    public Editor childNodeDeleted(String name, NodeState before)
            throws CommitFailedException {
        int d = getDepth(path);
        if (d == VERSION_HISTORY_DEPTH) {
            // restore version on builder
            builder.setChildNode(name, before);
            String relPath = relativize(VERSION_STORE_PATH, concat(path, name));
            // let version manager remove it properly
            getVersionManager().removeVersion(relPath);
            return null;
        } else if (isVersionStorageNode(before) || d > VERSION_HISTORY_DEPTH) {
            throwProtected(name);
        }
        return null;
    }

    @Override
    public void propertyAdded(PropertyState after)
            throws CommitFailedException {
        if (getDepth(path) < VERSION_HISTORY_DEPTH) {
            return;
        }
        throwProtected(after.getName());
    }

    @Override
    public void propertyChanged(PropertyState before, PropertyState after)
            throws CommitFailedException {
        if (getDepth(path) < VERSION_HISTORY_DEPTH) {
            return;
        }
        throwProtected(before.getName());
    }

    @Override
    public void propertyDeleted(PropertyState before)
            throws CommitFailedException {
        if (getDepth(path) < VERSION_HISTORY_DEPTH) {
            return;
        }
        throwProtected(before.getName());
    }

    //-------------------------< internal >-------------------------------------

    private static boolean isVersionStorageNode(NodeState state) {
        String ntName = state.getName(JCR_PRIMARYTYPE);
        return VERSION_STORE_NT_NAMES.contains(ntName)
                || VERSION_NODE_TYPE_NAMES.contains(ntName);
    }

    private ReadWriteVersionManager getVersionManager() {
        if (vMgr == null) {
            vMgr = new ReadWriteVersionManager(versionStorageNode, workspaceRoot);
        }
        return vMgr;
    }

    private Editor throwProtected(String name) throws CommitFailedException {
        return Utils.throwProtected(concat(path, name));
    }

    private static boolean isInitializationPhase(NodeState before, NodeState after) {
        return !comparePropertiesAgainstBaseState(after, before, new DefaultNodeStateDiff() {
            @Override
            public boolean propertyAdded(PropertyState after) {
                return !after.getName().equals(VERSION_STORE_INIT);
            }
        });
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace jnc {
namespace ct {

//..............................................................................

UnionType::UnionType() {
	m_typeKind = TypeKind_Union;
	m_flags = TypeFlag_Pod;
	m_structType = NULL;
}

Field*
UnionType::createFieldImpl(
	const sl::StringRef& name,
	Type* type,
	size_t bitCount,
	uint_t ptrTypeFlags,
	sl::BoxList<Token>* constructor,
	sl::BoxList<Token>* initializer
) {
	Field* field = m_module->m_typeMgr.createField(
		name,
		type,
		bitCount,
		ptrTypeFlags,
		constructor,
		initializer
	);

	field->m_parentNamespace = this;

	if (name.isEmpty()) {
		m_unnamedFieldArray.append(field);
	} else if (name[0] != '!') { // internal field
		bool result = addItem(field);
		if (!result)
			return NULL;
	}

	m_fieldArray.append(field);
	return field;
}

bool
UnionType::calcLayout() {
	bool result =
		ensureNamespaceReady() &&
		ensureAttributeValuesReady();

	if (!result)
		return false;

	Type* largestFieldType = NULL;
	size_t largestAlignment = 0;

	size_t count = m_fieldArray.getCount();
	for (size_t i = 0; i < count; i++) {
		Field* field = m_fieldArray[i];

		result = field->m_type->ensureLayout();
		if (!result)
			return false;

		uint_t fieldTypeFlags = field->m_type->getFlags();
		size_t fieldAlignment = field->m_type->getAlignment();

		if (!(fieldTypeFlags & TypeFlag_Pod)) {
			err::setFormatStringError("non-POD '%s' cannot be a union member", field->m_type->getTypeString().sz());
			field->pushSrcPosError();
			return false;
		} else if (fieldTypeFlags & TypeFlag_Dynamic) {
			err::setFormatStringError("dynamic '%s' cannot be a union member", field->m_type->getTypeString().sz());
			field->pushSrcPosError();
			return false;
		}

		if (field->m_bitCount) {
			field->m_type = m_module->m_typeMgr.getBitFieldType(field->m_bitFieldBaseType, 0, field->m_bitCount);
			if (!field->m_type)
				return false;
		}

		if (!largestFieldType || field->m_type->getSize() > largestFieldType->getSize())
			largestFieldType = field->m_type;

		if (largestAlignment < field->m_type->getAlignment())
			largestAlignment = field->m_type->getAlignment();

		field->m_llvmIndex = i; // llvmIndex is used in unions!

		if (field->m_parentNamespace == this && // skip property fields
			(!field->m_initializer.isEmpty() || isConstructibleType(field->m_type)))
			m_fieldInitializeArray.append(field);
	}

	ASSERT(largestFieldType);

	m_structType->createField(largestFieldType);
	m_structType->m_alignment = AXL_MIN(largestAlignment, m_structType->m_fieldAlignment);

	result = m_structType->ensureLayout();
	if (!result)
		return false;

	scanStaticVariables();
	scanPropertyCtorDtors();

	if (!m_propertyDestructArray.isEmpty()) {
		err::setError("invalid property destructor in 'union'");
		return false;
	}

	if (!m_staticConstructor &&
		(!m_staticVariableInitializeArray.isEmpty() ||
		!m_propertyStaticConstructArray.isEmpty())) {
		result = createDefaultMethod<DefaultStaticConstructor>() != NULL;
		if (!result)
			return false;
	}

	if (!m_constructor &&
		(m_staticConstructor ||
		!m_fieldInitializeArray.isEmpty() ||
		!m_propertyConstructArray.isEmpty())) {
		result = createDefaultMethod<DefaultConstructor>() != NULL;
		if (!result)
			return false;
	}

	m_size = m_structType->getSize();
	m_alignment = m_structType->getAlignment();

	if (m_size > TypeSizeLimit_StackAllocSize)
		m_flags |= TypeFlag_NoStack;

	return true;
}

void
UnionType::prepareLlvmDiType() {
	m_llvmDiType = m_module->m_llvmDiBuilder.createEmptyUnionType(this);
	m_module->m_llvmDiBuilder.setUnionTypeBody(this);
}

//..............................................................................

} // namespace ct
} // namespace jnc


text:
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):

        # Adding model 'CarouselItem'
        db.create_table('lfs_carousel_carouselitem', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='carousel_item', null=True, to=orm['contenttypes.ContentType'])),
            ('content_id', self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True)),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=100, blank=True)),
            ('image', self.gf('lfs.core.fields.thumbs.ImageWithThumbsField')(blank=True, max_length=100, null=True, sizes=((60, 60), (100, 100), (200, 200), (300, 300), (400, 400)))),
            ('link', self.gf('django.db.models.fields.URLField')(default='', max_length=200, null=True, blank=True)),
            ('position', self.gf('django.db.models.fields.PositiveSmallIntegerField')(default=999)),
        ))
        db.send_create_signal('lfs_carousel', ['CarouselItem'])

    def backwards(self, orm):

        # Deleting model 'CarouselItem'
        db.delete_table('lfs_carousel_carouselitem')

    models = {
        'contenttypes.contenttype': {
            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
        },
        'lfs_carousel.carouselitem': {
            'Meta': {'ordering': "('position',)", 'object_name': 'CarouselItem'},
            'content_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'carousel_item'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'image': ('lfs.core.fields.thumbs.ImageWithThumbsField', [], {'blank': 'True', 'max_length': '100', 'null': 'True', 'sizes': '((60, 60), (100, 100), (200, 200), (300, 300), (400, 400))'}),
            'link': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
            'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '999'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
        }
    }

    complete_apps = ['lfs_carousel']


text:
class CreateBoards < ActiveRecord::Migration
  def change
    create_table :boards do |t|
      t.string :name
      t.text :description
      t.string :color

      t.timestamps null: false
    end
  end
end


text:
/* Commentary:
 *
 */

/* Change log:
 *
 */

#include "dtkDistributedController.h"
#include "dtkDistributedResourceManager.h"

#include <dtkCore/dtkCore.h>

#include <dtkLog/dtkLog.h>

#include <QtNetwork>

#if !defined(Q_OS_MAC) && !defined(Q_OS_WIN)
#include <unistd.h>
#endif

#if defined(Q_OS_WIN) && !defined(__MINGW32__)
#include <windows.h>
#endif

// /////////////////////////////////////////////////////////////////
// dtkDistributedControllerPrivate declaration
// /////////////////////////////////////////////////////////////////

class dtkDistributedControllerPrivate
{
public:
    QHash<QString, QTcpSocket *> sockets;

    QHash<QString, QString > running_jobs; // all jobs started by the controller and running
    QHash<QString, QString > queued_jobs; // all jobs submitted by the controller (running or not)

    QHash<QString, QList<QProcess *> > servers;

public:
    bool refreshing;
};

// /////////////////////////////////////////////////////////////////
// dtkDistributedController implementation
// /////////////////////////////////////////////////////////////////

/*!
  \class dtkDistributedController
  \inmodule dtkDistributed

  \brief The controller is used to interact with a remote
  dtkDistributedServer and get/view resources from this server using
  a dtkDistributedResourceManager. Differents managers are
  implemented: OAR, Torque, and Local resources on the server.

  \sa dtkDistributedServer, dtkDistributedMessage, dtkDistributedResourceManager

 */

dtkDistributedController::dtkDistributedController(QObject *parent) : QObject(parent), d(new dtkDistributedControllerPrivate)
{
    d->refreshing = false;
}

dtkDistributedController::~dtkDistributedController(void)
{
    delete d;

    d = NULL;
}

dtkDistributedController *dtkDistributedController::instance(void)
{
    if(!s_instance)
        s_instance = new dtkDistributedController;

    return s_instance;
}

//! define a default port that should be uniq among users: compute a CRC-16 hash using the username
quint16 dtkDistributedController::defaultPort(void)
{
    QProcessEnvironment pe = QProcessEnvironment::systemEnvironment();
    QString username = pe.value("USERNAME");

    if (username.isEmpty())
        username = pe.value("USER");

    if (username.isEmpty()) {
        return 9999;
    }

    QByteArray bin = username.toUtf8();
    quint16 p =  qChecksum(bin.data(), bin.length());
    if (p < 1024) // listen port should be higher than 1024
        p += 1024;
    dtkInfo() << "default port is" << p;
    return p;
}

bool dtkDistributedController::isConnected(const QUrl& server)
{
    if(d->sockets.keys().contains(server.toString())) {

        QTcpSocket *socket = d->sockets.value(server.toString());

        return (socket->state() == QAbstractSocket::ConnectedState);
    }

    return false;
}

bool dtkDistributedController::isDisconnected(const QUrl& server)
{
    if(d->sockets.keys().contains(server.toString())) {

        QTcpSocket *socket = d->sockets.value(server.toString());

        return (socket->state() == QAbstractSocket::UnconnectedState);
    }

    return true;
}

bool dtkDistributedController::submit(const QUrl& server,  QByteArray& resources)
{
    dtkDebug() << "Want to submit jobs with resources:" << resources;
    QScopedPointer<dtkDistributedMessage> msg (new dtkDistributedMessage(dtkDistributedMessage::NEWJOB,"",dtkDistributedMessage::SERVER_RANK,resources.size(),"json",resources));
    if (d->sockets.contains(server.toString())) {
        msg->send(d->sockets[server.toString()]);
        return true;
    } else
        dtkDebug() << "Can't submit job: unknown server " << server.toString();

    return false;
}

void dtkDistributedController::killjob(const QUrl& server, QString jobid)
{
    dtkDebug() << "Want to kill job" << jobid;
    dtkDistributedMessage * msg  =new dtkDistributedMessage(dtkDistributedMessage::DELJOB,jobid,dtkDistributedMessage::SERVER_RANK);
    msg->send(d->sockets[server.toString()]);
    delete msg;
}

void dtkDistributedController::stop(const QUrl& server)
{
    dtkDebug() << "Want to stop server on " << server.toString();
    if (!d->sockets.contains(server.toString())) {
        dtkDebug() << "Needs to reconnect to server" << server.toString();
        this->connect(server);
    }

    if (!isConnected(server)) {
        dtkWarn() << "Can't stop server " << server.toString() << "not connected";
        d->servers.remove(server.toString());
        return;
    }

    dtkDebug() << "Send stop message to server" << server.toString();
    dtkDistributedMessage msg(dtkDistributedMessage::STOP,"",dtkDistributedMessage::SERVER_RANK);
    msg.send(d->sockets[server.toString()]);
    this->disconnect(server);
    d->servers.remove(server.toString());
}

void dtkDistributedController::refresh(const QUrl& server)
{
    dtkDebug() << server;

    if(!d->sockets.keys().contains(server.toString()))
        return;

    d->refreshing = true;

    QTcpSocket *socket = d->sockets.value(server.toString());
    dtkDistributedMessage *msg  = new dtkDistributedMessage(dtkDistributedMessage::STATUS);
    msg->send(socket);
    emit updated(server);
    delete msg;
}

// deploy a server instance on remote host (to be executed before connect)
bool dtkDistributedController::deploy(const QUrl& server, QString type, bool ssh_tunnel, QString path, QString loglevel)
{
    dtkDebug() << "deploy" << server << type << ssh_tunnel << path;

    // test if we can connect to server, if true, it means the server is deployed: do nothing and disconnect
    if (connect(server, false, false, false)) {
        // can connect, server already deployed by someone else
        dtkInfo() << "server" << server << "is already deployed, restart server";
        stop(server);
   }

    if(!d->servers.keys().contains(server.toString())) {
        int port = (server.port() == -1) ? dtkDistributedController::defaultPort(): server.port();
        QProcess *serverProc = new QProcess (this);

        QStringList args;
        args << "-t"; // that way, ssh will forward the SIGINT signal,
                      // and the server will stop when the ssh process
                      // is killed
        args << "-t"; // do it twice to force tty allocation
        args << "-x"; // disable X11 forwarding
        args << server.host();

        serverProc->setProcessChannelMode(QProcess::MergedChannels);

        if (ssh_tunnel) {
            dtkTrace() << "ssh port forwarding is set for server " << server.host();
            int port = (server.port() == -1) ? dtkDistributedController::defaultPort(): server.port();
            args << "-L" << QString::number(port)+":localhost:"+QString::number(port);
        }

        args << path;
        args << "-nw";
        if (loglevel != "info") {
            args << "--loglevel";
            args << loglevel;
        }
        args << "-p";
        args << QString::number(port);
        args << "-type ";
        args << type;

        serverProc->start("ssh", args);

        // need to wait a bit when ssh port forwarding is used
        if (ssh_tunnel)
            QThread::sleep(1);

        dtkDebug() << "ssh" << args;

        if (!serverProc->waitForStarted(5000)) {
            dtkError() << "server not started after 5 seconds, abort  " << args;
            serverProc->close();
            return false;
        }

        if (!serverProc->waitForReadyRead(5000)) {
            dtkError() << "no output from server after 5 seconds, abort  " << args;
            serverProc->close();
            return false;
        }

        QObject::connect(serverProc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(onProcessFinished(int,QProcess::ExitStatus)));

        QObject::connect (qApp, SIGNAL(aboutToQuit()), this, SLOT(cleanup()));

        d->servers[server.toString()] << serverProc;
        return true;

    } else {
        if (isConnected(server)) {
            dtkDebug() << "dtkDistributedServer already started on " << server.host();
            return true;
        } else {
            //server exists but is not connected, remove from list and retry
            dtkWarn() << "dtkDistributedServer " << server.host() << "exist  but is not connected";
            d->servers.remove(server.toString());
            return this->deploy(server,type,ssh_tunnel,path);
        }
    }

    return false;
}

void dtkDistributedController::send(dtkDistributedMessage *msg)
{
    if (d->queued_jobs.contains(msg->jobid())) {
        QString server = d->queued_jobs[msg->jobid()];
        QTcpSocket *socket = d->sockets[server];

        msg->send(socket);
    } else
        dtkWarn() << "unknown job, can't send message" << msg->jobid();

}

void dtkDistributedController::send(QVariant v, QString jobid, qint16 rank)
{
    if (d->queued_jobs.contains(jobid)) {
        QString server = d->queued_jobs[jobid];
        QTcpSocket *socket = d->sockets[server];

        QString type = "qvariant";

        //FIXME: what about the size ?
        dtkDistributedMessage* msg = new dtkDistributedMessage(dtkDistributedMessage::DATA,jobid,rank, -1, type);
        msg->send(socket);
        socket << v;
        delete msg;
    } else
        dtkWarn() << "unknown job, can't send message" << jobid;
}

QTcpSocket *dtkDistributedController::socket(const QString& jobid)
{
    if (d->queued_jobs.contains(jobid))
        if (d->sockets.contains(d->queued_jobs[jobid]))
            return d->sockets[d->queued_jobs[jobid]];

    return NULL;
}

bool dtkDistributedController::connect(const QUrl& server, bool ssh_tunnel, bool set_rank, bool emit_connected)
{

    if(!d->sockets.keys().contains(server.toString())) {

        QTcpSocket *socket = new QTcpSocket(this);

        QString key;

        key = server.host();

        if (server.port() == -1) {
            const_cast<QUrl&>(server).setPort(dtkDistributedController::defaultPort());
        }
        int port = server.port();

        if (ssh_tunnel)
            socket->connectToHost("localhost", port);
        else
            socket->connectToHost(server.host(), port);

        if(socket->waitForConnected()) {

            QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(read()));
            QObject::connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(error(QAbstractSocket::SocketError)));

            d->sockets.insert(server.toString(), socket);

            if (emit_connected)
                emit connected(server);

            if (set_rank) {
                dtkDistributedMessage msg(dtkDistributedMessage::SETRANK,"",dtkDistributedMessage::CONTROLLER_RANK);
                msg.send(socket);
            }

            return true;

        } else {

            dtkWarn() << "Unable to connect to" << server.toString();
            d->sockets.remove(server.toString());
            return false;
        }
    } else {
        dtkInfo() << "Already connected to server" << server.toString();
        return true;
    }
}

void dtkDistributedController::disconnect(const QUrl& server)
{
    if(!d->sockets.keys().contains(server.toString())) {
        dtkDebug() << "disconnect: unknown server" << server;
        return;
    }

    QTcpSocket *socket = d->sockets.value(server.toString());
    socket->disconnectFromHost();

    d->sockets.remove(server.toString());

    emit disconnected(server);
}

bool dtkDistributedController::is_running(const QString& jobid)
{
    return d->running_jobs.contains(jobid);
}

void dtkDistributedController::read(void)
{
    QTcpSocket *socket = (QTcpSocket *)sender();

    QString server = d->sockets.key(socket);
    QScopedPointer< dtkDistributedMessage> msg(new dtkDistributedMessage);
    QVariant result;

    msg->parse(socket);

    dtkDistributedMessage::Method method = msg->method();
    switch (method) {
    case dtkDistributedMessage::OKSTATUS:
        emit updated();
        break;
    case dtkDistributedMessage::OKJOB:
        dtkDebug() << "New job queued: " << msg->jobid();
        d->queued_jobs[msg->jobid()] = server;
        emit jobQueued(msg->jobid());
        break;
    case dtkDistributedMessage::SETRANK:
        dtkDebug() << "set rank received";
        if (msg->rank() ==  dtkDistributedMessage::SLAVE_RANK ||  msg->rank() ==  0 ) {
            dtkDebug() << "job started";
            d->running_jobs[msg->jobid()] = server;
            emit jobStarted(msg->jobid());
            this->refresh(QUrl(server));
        }
        break;
    case dtkDistributedMessage::ENDJOB:
        dtkDebug() << "job finished: " << msg->jobid();
        d->queued_jobs.remove(msg->jobid());
        d->running_jobs.remove(msg->jobid());
        emit jobEnded(msg->jobid());
        break;
    case dtkDistributedMessage::DATA:
        if (msg->header("content-type") == "qvariant") {
            result = msg->variant();
        } else {
            dtkWarn() << "Data received, but not a variant: " << msg->header("content-type");
            result = QVariant::fromValue(msg->content());
        }
        emit dataPosted(result);
        break;
    default:
        dtkWarn() << "unknown response from server ";
    };
    if (socket->bytesAvailable() > 0)
        this->read();
}

void dtkDistributedController::cleanup()
{
    foreach (const QString& key, d->servers.keys()) {
        foreach (QProcess* server, d->servers[key]) {
            dtkDebug() << "terminating servers started on" << key;
            server->terminate();
        }
    }
}

void dtkDistributedController::onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus )
{
    Q_UNUSED(exitCode);
    if (exitStatus != QProcess::NormalExit)
        dtkInfo() <<  "remote server deployment failure" << exitStatus ;
    else
        dtkInfo() <<  "remote server stopped";
}

void dtkDistributedController::error(QAbstractSocket::SocketError error)
{
    switch(error) {
    case QAbstractSocket::ConnectionRefusedError:
        dtkError() <<  "The connection was refused by the peer (or timed out).";
        break;
    case QAbstractSocket::RemoteHostClosedError:
        dtkError() <<  "The remote host closed the connection. Note that the slave socket (i.e., this socket) will be closed after the remote close notification has been sent.";
        break;
    case QAbstractSocket::HostNotFoundError:
        dtkError() <<  "The host address was not found.";
        break;
    case QAbstractSocket::SocketAccessError:
        dtkError() <<  "The socket operation failed because the application lacked the required privileges.";
        break;
    case QAbstractSocket::SocketResourceError:
        dtkError() <<  "The local system ran out of resources (e.g., too many sockets).";
        break;
    case QAbstractSocket::SocketTimeoutError:
	dtkError() <<  "The socket operation timed out.";
        break;
    case QAbstractSocket::DatagramTooLargeError:
        dtkError() <<  "The datagram was larger than the operating system's limit (which can be as low as 8192 bytes).";
        break;
    case QAbstractSocket::NetworkError:
        dtkError() <<  "An error occurred with the network (e.g., the network cable was accidentally plugged out).";
        break;
    case QAbstractSocket::AddressInUseError:
        dtkError() <<  "The address specified to QUdpSocket::bind() is already in use and was set to be exclusive.";
        break;
    case QAbstractSocket::SocketAddressNotAvailableError:
        dtkError() <<  "The address specified to QUdpSocket::bind() does not belong to the host.";
        break;
    case QAbstractSocket::UnsupportedSocketOperationError:
	dtkError() <<  "The requested socket operation is not supported by the local operating system (e.g., lack of IPv6 support).";
        break;
    case QAbstractSocket::ProxyAuthenticationRequiredError:
	dtkError() <<  "The socket is using a proxy, and the proxy requires authentication.";
        break;
    case QAbstractSocket::SslHandshakeFailedError:
	dtkError() <<  "The SSL/TLS handshake failed, so the connection was closed (only used in QSslSocket)";
        break;
    case QAbstractSocket::UnfinishedSocketOperationError:
	dtkError() <<  "Used by QAbstractSocketEngine only, The last operation attempted has not finished yet (still in progress in the background).";
        break;
    case QAbstractSocket::ProxyConnectionRefusedError:
        dtkError() <<  "Could not contact the proxy server because the connection to that server was denied";
        break;
    case QAbstractSocket::ProxyConnectionClosedError:
	dtkError() <<  "The connection to the proxy server was closed unexpectedly (before the connection to the final peer was established)";
        break;
    case QAbstractSocket::ProxyConnectionTimeoutError:
	dtkError() <<  "The connection to the proxy server timed out or the proxy server stopped responding in the authentication phase.";
        break;
    case QAbstractSocket::ProxyNotFoundError:
	dtkError() <<  "The proxy address set with setProxy() (or the application proxy) was not found.";
        break;
    case QAbstractSocket::ProxyProtocolError:
	dtkError() <<  "The connection negotiation with the proxy server because the response from the proxy server could not be understood.";
        break;
    case QAbstractSocket::UnknownSocketError:
	dtkError() <<  "An unidentified error occurred.";
        break;
    default:
        break;
    }
}

dtkDistributedController *dtkDistributedController::s_instance = NULL;


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="card_detection_description1">请将银行卡正面置于此区域</string>
    <string name="card_detection_description2">尝试对齐边缘</string>
    <string name="camera_decode_bitmap_failed">识别不成功,请重新识别</string>
    <string name="card_detection_carmera_failed">摄像头初始化失败</string>
    <string name="card_detection_compare_text1">请核对卡号后进行确认</string>
    <string name="card_detection_compare_text2">若卡号有误,请返回重拍</string>
    <string name="card_detection_compare_confirm">确认</string>
</resources>


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">

<meta name="generator" content="JDiff v1.1.1">

<meta name="description" content="JDiff is a Javadoc doclet which generates an HTML report of all the packages, classes, constructors, methods, and fields which have been removed, added or changed in any way, including their documentation, when two APIs are compared.">
<meta name="keywords" content="diff, jdiff, javadiff, java diff, java difference, API difference, difference between two APIs, API diff, Javadoc, doclet">
<TITLE>
org.apache.hadoop.mapred.JobStatus
</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="../stylesheet-jdiff.css" TITLE="Style">

       <tt>hadoop 0.19.2</tt>
       Overview
       Package
        Class
       Statistics
       Help

  Generated by
JDiff

 PREV CLASS
 NEXT CLASS

  FRAMES
   NO FRAMES
   DETAIL:
CONSTRUCTORS |
METHODS |
FIELDS

Class org.apache.hadoop.mapred.<tt>JobStatus</tt>

Added interface java.lang.Cloneable.

  Removed Constructors

  <nobr><tt>JobStatus</tt>(String,</nobr> float<nobr>,</nobr> float<nobr>,</nobr> int<nobr><nobr>)</nobr>

  Added Constructors

  <nobr><tt>JobStatus</tt>(JobID,</nobr> float<nobr>,</nobr> float<nobr>,</nobr> float<nobr>,</nobr> float<nobr>,</nobr> int<nobr>,</nobr> JobPriority<nobr><nobr>)</nobr>

  Create a job status object for a given jobid.

  <nobr><tt>JobStatus</tt>(JobID,</nobr> float<nobr>,</nobr> float<nobr>,</nobr> float<nobr>,</nobr> int<nobr><nobr>)</nobr>

  Create a job status object for a given jobid.

  <nobr><tt>JobStatus</tt>(JobID,</nobr> float<nobr>,</nobr> float<nobr>,</nobr> float<nobr>,</nobr> int<nobr>,</nobr> JobPriority<nobr><nobr>)</nobr>

  Create a job status object for a given jobid.

  Added Methods

  <nobr>float <tt>cleanupProgress</tt>()</nobr>

  @return Percentage of progress in cleanup

  <nobr>Object <tt>clone</tt>()</nobr>

  <nobr>JobPriority <tt>getJobPriority</tt>()</nobr>

  Return the priority of the job

  <nobr>String <tt>getSchedulingInfo</tt>()</nobr>

  Gets the Scheduling information associated to a particular Job.

  <nobr>boolean <tt>isJobComplete</tt>()</nobr>

  Returns true if the status is for a completed job.

  <nobr>void <tt>setJobPriority</tt>(JobPriority)</nobr>

  Set the priority of the job, defaulting to NORMAL.

  <nobr>void <tt>setSchedulingInfo</tt>(String)</nobr>

  Used to set the scheduling information associated to a particular Job.

  <nobr>float <tt>setupProgress</tt>()</nobr>

  @return Percentage of progress in setup

  Added Fields

  <nobr>int <tt>KILLED</tt></nobr>

       <tt>hadoop 0.19.2</tt>
       Overview
       Package
        Class
       Statistics
       Help

 PREV CLASS
 NEXT CLASS

  FRAMES
   NO FRAMES


text:
module ModuleSubclassIncludedSpec
  class Module1 < ::Module
    def included(_descendant)
      $ScratchPad << 'A included'
    end
  end

  class Module2 < Module1
    def included(_descendant)
      $ScratchPad << 'B included'
    end
  end
  M0 = Module.new
  M1 = Module1.new
  M2 = Module2.new
end

module ModuleCVarSpec
  module Mod0
    def cvar0; @@cvar; end
    def cvarx0; @@cvarx ||= 5; end
    def cvary0; @@cvary; 0; end
    def cvarz0; @@cvarz = @@cvarz || 5; end
  end

  module Mod1
    include Mod0
    @@cvar = 10
    def cvar1; @@cvar; end
    def cvar1=(new); @@cvar=new; end
  end

  module Mod2
    include Mod1
    def cvar2; @@cvar; end
    def cvar2=(new); @@cvar=new; end
  end
end

describe 'Module' do
  it '#included gets called in subclasses (regression for https://github.com/opal/opal/issues/1900)' do
    $ScratchPad = []
    klass = Class.new
    klass.include ::ModuleSubclassIncludedSpec::M0
    klass.include ::ModuleSubclassIncludedSpec::M1
    klass.include ::ModuleSubclassIncludedSpec::M2
    $ScratchPad.should == ['A included', 'B included']
  end

  it "can access ancestor's @@cvar" do
    klass = Class.new
    klass.include ::ModuleCVarSpec::Mod2
    klass.new.cvar1.should == 10
    klass.new.cvar2.should == 10
    klass.new.cvar2 = 50
    klass.new.cvar1.should == 50
    klass.new.cvar2.should == 50
    klass.new.cvarx0.should == 5
    klass.new.cvary0.should == 0
    ->{ klass.new.cvarz0 }.should raise_error NameError
    ->{ klass.new.cvar0 }.should raise_error NameError
  end

  it "can be set to a constant while being frozen" do
    OPAL_SPEC_MODULE = Module.new.freeze
    OPAL_SPEC_CLASS = Class.new.freeze

    OPAL_SPEC_MODULE.class.should == Module
    OPAL_SPEC_CLASS.class.should == Class
  end
end


text:
OLD="SdSW_PrWH"
NEW="NtSW_SdWH"
DPATH="./Experiment001/test_BVH_2Activity_20PCA_MissPairs*12states_dim_theta00*.m"
insertLine="subExperiment = 'Experiment001';"
OLD1="ExperimentName,'\/Results\/'"
NEW1="save_path = strcat(path0,'fullyParameterizedHMM/Project/recognition/activityRecognition/',ExperimentName,'/',subExperiment,'/Results/');"
for f in $DPATH
do
	sed -i -e "s/$OLD/$NEW/g" "$f"
    sed -i -e "64 c\
save_path = strcat(path0,'fullyParameterizedHMM/Project/recognition/activityRecognition/',ExperimentName,'/',subExperiment,'/Results/');" "$f"
done


text:
class Booth
{
    char type;
    char id;
public:
    Booth(char type, char id) :type(type), id(id) {}
    char getType() { return type; }
    char getID() { return id; }

    Packet getSkeletonPacket(char serviceType='-') {
        Packet packet;
        packet.receiverType() = getType();
        packet.receiverID() = getID()+'0';
        packet.commandType() = serviceType;
        strncpy(packet.data(), "-----", 6);
        packet.extraByte() = '-';
        return packet;
    }

    virtual Packet getPingPacket() = 0;

    virtual bool processPacket(Packet &packet) = 0; //return if you need next slot
    virtual void onTimout() {}
};

#endif // BOOTH_H


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Anal. Mus. nac. B. Aires, Ser. 3 8(1): 70 (1902)

#### Original name
Sphaerella triseti Speg.

### Remarks
null


text:
#include "config.h"
#include "plpictdec.h"
#ifdef PL_SUPPORT_JPEG
#include "pljpegdec.h"
#endif
#include "ploptable.h"
#include "plexcept.h"

#include <stdio.h>

PLPictDecoder::PLPictDecoder
    ( PLJPEGDecoder * pJPEGDecoder
    )
    : PLPicDecoder(),
      m_pJPEGDecoder (pJPEGDecoder)
    // Creates a decoder
{
}

PLPictDecoder::~PLPictDecoder
    ()
{
}

void PLPictDecoder::Open (PLDataSource * pDataSrc)
{
  Trace (2, "Decoding mac pict.\n");

  // Skip empty 512 byte header.
  pDataSrc->Skip (512);

  // Read PICT header
  int Version;
  readHeader (pDataSrc, Version);
  interpretOpcodes (pDataSrc, Version);

}

//! Fills the bitmap with the image.
void PLPictDecoder::GetImage (PLBmpBase & Bmp)
{
  switch (m_PictType)
  {
    case op9a:
      DecodeOp9a (&Bmp, m_pDataSrc);
      break;
    case jpeg:
      DecodeJPEG (&Bmp, m_pDataSrc);
      break;
    case pixmap:
      DecodePixmap (&Bmp, m_pDataSrc);
      break;
    case bitmap:
      DecodeBitmap (&Bmp, m_pDataSrc);
      break;
    default:
      PLASSERT (false);
  }
  m_PictType = none;
}

void PLPictDecoder::readHeader
    ( PLDataSource * pDataSrc,
      int& Version
    )
    // Decodes header and version information.
    // Performs checks to make sure the data is really a pict file.
{
  PLBYTE ch;
  PLWORD PicSize;  // Version 1 picture size. Ignored in version 2.
  char sz[256];
  MacRect Frame;

  PicSize = ReadMWord (pDataSrc);

  readRect (&Frame, pDataSrc);

  while ((ch = ReadByte(pDataSrc)) == 0);
  if (ch != 0x11)
                raiseError (PL_ERRWRONG_SIGNATURE,
                "Error decoding pict: Version number missing.");

  switch (ReadByte(pDataSrc))
  {
    case 1:
      Version = 1;
      break;
    case 2:
      if (ReadByte(pDataSrc) != 0xff)
        raiseError (PL_ERRWRONG_SIGNATURE,
                    "Illegal version number.");
      Version = 2;
      break;
    default:
      raiseError (PL_ERRWRONG_SIGNATURE,
                  "Illegal version number.");
  }

  sprintf (sz, "PICT version %d found.\n", Version);
  Trace (2, sz);
}

void PLPictDecoder::interpretOpcodes
    ( PLDataSource * pDataSrc,
      int& Version
    )
    // This is the main decoder loop. The functions reads opcodes,
    // skips some, and hands the rest to opcode-specific functions.
    // It stops decoding after the first opcode containing bitmapped
    // data.
{
  PLWORD   Opcode;
  char   sz[256];

  bool   bDone = false;

  while (!bDone)
  {
    Opcode = readOpcode(Version, pDataSrc);

    if (Opcode == 0xFF || Opcode == 0xFFFF)
    {
      bDone = true;
      Trace (2, "Opcode: End of pict.\n");
      raiseError (PL_ERRFORMAT_NOT_SUPPORTED,
                  "PICT contained only vector data!\n");
    }
    else if (Opcode < 0xa2)
    {
      if (!strcmp(optable[Opcode].name, "reserved"))
        sprintf (sz, "Opcode: reserved=0x%x\n", Opcode);
      else
        sprintf (sz, "Opcode: %s\n", optable[Opcode].name);
      Trace (2, sz);

      switch (Opcode)
      {
        case 0x01: // Clip
          clip (pDataSrc);
          break;
        case 0x12:
        case 0x13:
        case 0x14:
          pixPat (pDataSrc);
          break;
        case 0x70:
        case 0x71:
        case 0x72:
        case 0x73:
        case 0x74:
        case 0x75:
        case 0x76:
        case 0x77:
          skipPolyOrRegion (pDataSrc);
          break;
        case 0x90:
        case 0x98:
          bitsRect (pDataSrc);
          bDone = true;
          break;
        case 0x91:
        case 0x99:
          bitsRegion (pDataSrc);
          bDone = true;
          break;
        case 0x9a:
          opcode9a (pDataSrc);
          bDone = true;
          break;
        case 0xa1:
          longComment (pDataSrc);
          break;
        default:
          // No function => skip to next Opcode
          if (optable[Opcode].len == WORD_LEN)
            pDataSrc->Skip(ReadMWord(pDataSrc));
           else
            pDataSrc->Skip(optable[Opcode].len);
      }
    }
    else if (Opcode == 0xc00)
    {
      Trace (2, "Opcode: Header.\n");
      headerOp (pDataSrc);
    }
    else if (Opcode == 0x8200)
    {
      Trace (2, "Opcode: JPEG.\n");
      jpegOp (pDataSrc);
      bDone = true;
    }
    else if (Opcode >= 0xa2 && Opcode <= 0xaf)
    {
      sprintf (sz, "Opcode: reserved 0x%x.\n", Opcode);
      Trace (2, sz);
      pDataSrc->Skip(ReadMWord(pDataSrc));
    }
    else if ((Opcode >= 0xb0 && Opcode <= 0xcf) ||
             (Opcode >= 0x8000 && Opcode <= 0x80ff))
    {
      // just a reserved Opcode, no data
      sprintf (sz, "Opcode: reserved 0x%x.\n", Opcode);
      Trace (2, sz);
    }
    else if ((Opcode >= 0xd0 && Opcode <= 0xfe) ||
             Opcode >= 8100)
    {
      sprintf (sz, "Opcode: reserved 0x%x.\n", Opcode);
      Trace (2, sz);
      pDataSrc->Skip(ReadMLong(pDataSrc));
    }
    else if (Opcode >= 0x100 && Opcode <= 0x7fff)
    {
      sprintf (sz, "Opcode: reserved 0x%x.\n", Opcode);
      Trace (2, sz);
      pDataSrc->Skip((Opcode >> 7) & 255);
    }
    else
    {
      char sz[256];
      sprintf (sz, "Can't handle Opcode %x.\n", Opcode);
      raiseError (PL_ERRFORMAT_UNKNOWN, sz);
    }
  }
}

PLWORD PLPictDecoder::readOpcode
    ( int Version,
      PLDataSource * pDataSrc
    )
    // moves to an even byte position in the file and returns the
    // opcode found.
{
  if (Version == 2)
    pDataSrc->AlignToWord();

  if (Version == 1)
    return ReadByte (pDataSrc);
   else
    return ReadMWord (pDataSrc);
}

/////////////////////////////////////////////////////////////////////
// Opcode functions

void PLPictDecoder::clip
    ( PLDataSource * pDataSrc
    )
    // skips clipping rectangle or region.
{
  MacRect ClipRect;

  PLWORD len = ReadMWord(pDataSrc);

  if (len == 0x000a)
    { /* null rgn */
      readRect(&ClipRect, pDataSrc);
    }
   else
    pDataSrc->Skip(len - 2);
}

void PLPictDecoder::pixPat
    ( PLDataSource * pDataSrc
    )
    // skips pattern definition.
{
  PLWORD       PatType;
  PLWORD       rowBytes;
  MacpixMap  p;
  PLWORD       NumColors;

  PatType = ReadMWord(pDataSrc);

  switch (PatType)
    {
      case 2:
        pDataSrc->Skip(8);
        pDataSrc->Skip(5);
        break;
      case 1:
        {
          pDataSrc->Skip(8);
          rowBytes = ReadMWord(pDataSrc);
          readRect(&p.Bounds, pDataSrc);
          readPixmap(&p, pDataSrc);

          PLPixel32 CT[256];
          readColourTable(&NumColors, pDataSrc, CT);
          skipBits(&p.Bounds, rowBytes, p.pixelSize, pDataSrc);
        }
        break;
      default:
        raiseError (PL_ERRFORMAT_UNKNOWN,
                    "Unknown pattern type in pixPat.");
    }
}

void PLPictDecoder::skipPolyOrRegion
    ( PLDataSource * pDataSrc
    )
{
  Trace (3, "Skipping polygon or region.\n");
  pDataSrc->Skip (ReadMWord (pDataSrc) - 2);
}

void PLPictDecoder::bitsRect
    ( PLDataSource * pDataSrc
    )
    // Bitmap/pixmap data clipped by a rectangle.
{
  m_rowBytes = ReadMWord(pDataSrc);    // Bytes per row in source when
                                     // uncompressed.

  m_bIsRegion = false;
  if (m_rowBytes & 0x8000)
    doPixmap (pDataSrc);
   else
    doBitmap (pDataSrc);
}

void PLPictDecoder::bitsRegion
    ( PLDataSource * pDataSrc
    )
    // Bitmap/pixmap data clipped by a region.
{
  m_rowBytes = ReadMWord(pDataSrc);    // Bytes per row in source when
                                     // uncompressed.
  m_bIsRegion = true;
  if (m_rowBytes & 0x8000)
    doPixmap (pDataSrc);
   else
    doBitmap (pDataSrc);
}

void PLPictDecoder::opcode9a
    ( PLDataSource * pDataSrc
    )
    // DirectBitsRect.
{
  pDataSrc->Skip(4);           // Skip fake len and fake EOF.
  ReadMWord(pDataSrc);         // bogus row bytes.

  // Read in the PixMap fields.
  readRect(&m_PixMap.Bounds, pDataSrc);
  readPixmap (&m_PixMap, pDataSrc);

  // Ignore source & destination rectangle as well as transfer mode.
  MacRect TempRect;
  readRect (&TempRect, pDataSrc);
  readRect (&TempRect, pDataSrc);
  PLWORD mode = ReadMWord(pDataSrc);

  // Create empty DIB
  setBmpInfo (m_PixMap);
  m_PictType=op9a;
}

void PLPictDecoder::DecodeOp9a
    ( PLBmpBase * pBmp,
      PLDataSource * pDataSrc
    )
{
  // Do the actual unpacking.
  switch (m_PixMap.pixelSize)
  {
    case 32:
      unpack32bits (&m_PixMap.Bounds, 0, m_PixMap.cmpCount, pBmp, pDataSrc);
      break;
    case 8:
      unpack8bits (&m_PixMap.Bounds, 0, pBmp, pDataSrc);
      break;
    default:
      unpackbits (&m_PixMap.Bounds, 0, m_PixMap.pixelSize, pBmp, pDataSrc);
  }
}

void PLPictDecoder::longComment
    ( PLDataSource * pDataSrc
    )
{
  PLWORD type;
  PLWORD len;

  type = ReadMWord(pDataSrc);
  len = ReadMWord(pDataSrc);
  if (len > 0)
    pDataSrc->Skip (len);
}

void PLPictDecoder::headerOp
    ( PLDataSource * pDataSrc
    )
{
  int Version = ReadMWord (pDataSrc);
  m_Resolution.x = ReadMLong(pDataSrc);
  m_Resolution.y = ReadMLong(pDataSrc);
  MacRect Dummy;
  readRect (&Dummy, pDataSrc);
  ReadMWord (pDataSrc);
}

void PLPictDecoder::jpegOp
    ( PLDataSource * pDataSrc
    )
    // Invoke the JPEG decoder for this PICT.
{
  long OpLen = ReadMLong(pDataSrc);
  bool bFound = false;
  int i = 0;

  // skip to JPEG header.
  while (!bFound && i < OpLen)
  {
    PLBYTE * pData = pDataSrc->GetBufferPtr (3);
    if (pData[0] == 0xFF && pData[1] == 0xD8 && pData[2] == 0xFF)
      bFound = true;
    else
    {
      ReadByte(pDataSrc);
      i++;
    }
  }
  if (bFound)
    // Pass the data to the JPEG decoder.
    if (m_pJPEGDecoder)
#ifdef PL_SUPPORT_JPEG
    {
      m_pJPEGDecoder->Open (pDataSrc);
      SetBmpInfo (*m_pJPEGDecoder);
      m_PictType = jpeg;
    }
#else
      raiseError (PL_ERRFORMAT_NOT_SUPPORTED,
                  "Library not compiled for PICT/JPEG.");
#endif
     else
      raiseError (PL_ERRFORMAT_NOT_SUPPORTED,
                  "Library not compiled for PICT/JPEG.");
   else
    raiseError (PL_ERRFORMAT_NOT_SUPPORTED,
                "PICT file contains unrecognized quicktime data.\n");
}

void PLPictDecoder::DecodeJPEG
    ( PLBmpBase * pBmp,
      PLDataSource * pDataSrc
    )
{
#ifdef PL_SUPPORT_JPEG
  m_pJPEGDecoder->GetImage(*pBmp);
#else
      raiseError (PL_ERRFORMAT_NOT_SUPPORTED,
                  "Library not compiled for PICT/JPEG.");
#endif
}

/////////////////////////////////////////////////////////////////////
// Bitmap & Pixmap functions

void PLPictDecoder::setBmpInfo
    ( MacpixMap PixMap
    )
{

  PLPixelFormat pf;
  if (PixMap.pixelSize > 8)
    if (PixMap.cmpCount == 4)
        pf = PLPixelFormat::A8R8G8B8;
     else
       pf = PLPixelFormat::X8R8G8B8;
  else
    pf = PLPixelFormat::I8;

  SetBmpInfo (PLPoint (PixMap.Bounds.right - PixMap.Bounds.left,
                       PixMap.Bounds.bottom - PixMap.Bounds.top),
              PLPoint (PixMap.hRes, PixMap.vRes), pf);
}

void PLPictDecoder::doBitmap
    ( PLDataSource * pDataSrc
    )
    // Decode version 1 bitmap: 1 bpp.
{
  MacRect SrcRect;
  MacRect DstRect;
  PLWORD    width;        // Width in pixels
  PLWORD    height;       // Height in pixels

  Trace (2, "Reading version 1 bitmap.\n");

  readRect(&m_Bounds, pDataSrc);
  dumpRect ("  Bounds", &m_Bounds);
  readRect(&SrcRect, pDataSrc);
  readRect(&DstRect, pDataSrc);

  width = m_Bounds.right - m_Bounds.left;
  height = m_Bounds.bottom - m_Bounds.top;

  SetBmpInfo (PLPoint (width, height), PLPoint (0,0), PLPixelFormat::I8);
  m_PictType = bitmap;
}

void PLPictDecoder::DecodeBitmap
    ( PLBmpBase * pBmp,
      PLDataSource * pDataSrc
    )
{
  PLWORD mode = ReadMWord(pDataSrc);

  if (m_bIsRegion)
    skipPolyOrRegion (pDataSrc);

  pBmp->SetPaletteEntry (0, 0, 0, 0, 255);
  pBmp->SetPaletteEntry (1, 255, 255, 255, 255);
  unpackbits (&m_Bounds, m_rowBytes, 1, pBmp, pDataSrc);
}

void PLPictDecoder::doPixmap
    ( PLDataSource * pDataSrc
    )
    // Decode version 2 pixmap
{
  readRect(&m_PixMap.Bounds, pDataSrc);
  readPixmap(&m_PixMap, pDataSrc);

  setBmpInfo (m_PixMap);
  m_PictType = pixmap;
}

void PLPictDecoder::DecodePixmap
    ( PLBmpBase * pBmp,
      PLDataSource * pDataSrc
    )
{
  // Read mac colour table into windows palette.
  PLWORD    NumColors;    // Palette size.
  PLPixel32 Pal[256];

  readColourTable (&NumColors, pDataSrc, Pal);
  if (pBmp->GetBitsPerPixel() == 8)
    pBmp->SetPalette (Pal);

  // Ignore source & destination rectangle as well as transfer mode.
  MacRect TempRect;
  readRect (&TempRect, pDataSrc);
  readRect (&TempRect, pDataSrc);
  PLWORD mode = ReadMWord(pDataSrc);

  if (m_bIsRegion)
    skipPolyOrRegion (pDataSrc);

  switch (m_PixMap.pixelSize)
  {
    case 32:
      unpack32bits (&m_PixMap.Bounds, m_rowBytes, m_PixMap.cmpCount, pBmp, pDataSrc);
      break;
    case 8:
      unpack8bits (&m_PixMap.Bounds, m_rowBytes, pBmp, pDataSrc);
      break;
    default:
      unpackbits (&m_PixMap.Bounds, m_rowBytes, m_PixMap.pixelSize,
                  pBmp, pDataSrc);
  }
}

void PLPictDecoder::unpack32bits
    ( MacRect* pBounds,
      PLWORD rowBytes,
      int NumBitPlanes,    // 3 if RGB, 4 if RGBA
      PLBmpBase * pBmp,
      PLDataSource * pDataSrc
    )
    // This routine decompresses BitsRects with a packType of 4 (and
    // 32 bits per pixel). In this format, each line is separated
    // into 8-bit-bitplanes and then compressed via RLE. To decode,
    // the routine decompresses each line & then juggles the bytes
    // around to get pixel-oriented data.
{
  int    i,j;
  PLWORD   BytesPerRow;        // bytes per row when uncompressed.
  PLPixel32 * pDestLine;

  PLBYTE * pLinebuf;           // Temporary buffer for line data. In
                             // this buffer, pixels are uncompressed
                             // but still plane-oriented.
  PLPixel32 ** pLineArray = pBmp->GetLineArray32();

  int Height = pBounds->bottom - pBounds->top;
  int Width = pBounds->right - pBounds->left;

  BytesPerRow = Width*NumBitPlanes;

  if (rowBytes == 0)
    rowBytes = Width*4;

  // Allocate temporary line buffer.
  pLinebuf = new PLBYTE [BytesPerRow];

  try
  {
    for (i = 0; i < Height; i++)
    { // for each line do...
      int linelen;            // length of source line in bytes.
      if (rowBytes > 250)
        linelen = ReadMWord(pDataSrc);
       else
        linelen = ReadByte(pDataSrc);

      PLBYTE * pBuf = unpackPictRow (pLinebuf, pDataSrc, Width, rowBytes, linelen);

      // Convert plane-oriented data into pixel-oriented data &
      // copy into destination bitmap.
      pDestLine = pLineArray[i];

      if (NumBitPlanes == 3)
        for (j = 0; j < Width; j++)
        { // For each pixel in line...
          pDestLine->SetB (*(pBuf+Width*2));     // Blue
          pDestLine->SetG (*(pBuf+Width));       // Green
          pDestLine->SetR (*pBuf);             // Red
          pDestLine->SetA (0xFF);
          pDestLine++;
          pBuf++;
        }
      else
        for (j = 0; j < Width; j++)
        { // For each pixel in line...
          pDestLine->SetB (*(pBuf+Width*3));     // Blue
          pDestLine->SetG (*(pBuf+Width*2));     // Green
          pDestLine->SetR (*(pBuf+Width));       // Red
          pDestLine->SetA (*pBuf);
          pDestLine++;
          pBuf++;
        }
    }
  }
  catch (PLTextException)
  {
    delete [] pLinebuf;
    throw;
  }
  catch(...)
  {
    delete [] pLinebuf;
    throw;
  }
  delete [] pLinebuf;
}

void PLPictDecoder::unpack8bits
    ( MacRect* pBounds,
      PLWORD rowBytes,
      PLBmpBase * pBmp,
      PLDataSource * pDataSrc
    )
    // Decompression routine for 8 bpp. rowBytes is the number of
    // bytes each source row would take if it were uncompressed.
    // This _isn't_ equal to the number of pixels in the row - it
    // seems apple pads the data to a word boundary and then
    // compresses it. Of course, we have to decompress the excess
    // data and then throw it away.
{
  int     i;
  PLBYTE ** pLineArray = pBmp->GetLineArray();

  int Height = pBounds->bottom - pBounds->top;
  int Width = pBounds->right - pBounds->left;

  // High bit of rowBytes is flag.
  rowBytes &= 0x7fff;

  if (rowBytes == 0)
    rowBytes = Width;

  PLBYTE * pLineBuf = new PLBYTE [rowBytes];

  try
  {
    for (i = 0; i < Height; i++)
    {
      int linelen;            // length of source line in bytes.
      if (rowBytes > 250)
        linelen = ReadMWord(pDataSrc);
       else
        linelen = ReadByte(pDataSrc);
      PLBYTE * pRawLine = unpackPictRow (pLineBuf, pDataSrc, Width, rowBytes, linelen);
      memcpy (pLineArray[i], pRawLine, Width);
    }
  }
  catch (PLTextException)
  {
    delete [] pLineBuf;
    throw;
  }
  delete [] pLineBuf;
}

void PLPictDecoder::unpackbits
    ( MacRect* pBounds,
      PLWORD rowBytes,
      int pixelSize,         // Source bits per pixel.
      PLBmpBase * pBmp,
      PLDataSource * pDataSrc
    )
    // Decompression routine for everything but 8 & 32 bpp. This
    // routine is slower than the two routines above since it has to
    // deal with a lot of special cases :-(.
    // It's also a bit chaotic because of these special cases...
    // unpack8bits is basically a dumber version of unpackbits.
{
  PLBYTE * pSrcLine;           // Pointer to source line in file.
  int    i,j,k;
  PLWORD   pixwidth;           // bytes per row when uncompressed.
  int    linelen;            // length of source line in bytes.
  int    pkpixsize;
  PLBYTE * pDestLine;
  PLBYTE   FlagCounter;
  int    len;
  int    PixelPerRLEUnit;
  PLBYTE * pLineBuf;
  PLBYTE * pBuf;
  PLBYTE ** pLineArray = pBmp->GetLineArray();

  int Height = pBounds->bottom - pBounds->top;
  int Width = pBounds->right - pBounds->left;

  // High bit of rowBytes is flag.
  if (pixelSize <= 8)
    rowBytes &= 0x7fff;

  pixwidth = Width;
  pkpixsize = 1;          // RLE unit: one byte for everything...
  if (pixelSize == 16)    // ...except 16 bpp.
  {
    pkpixsize = 2;
    pixwidth *= 2;
  }

  if (rowBytes == 0)
    rowBytes = pixwidth;

  try
  {
    // I allocate the temporary line buffer here. I allocate too
    // much memory to compensate for sloppy (& hence fast)
    // decompression.
    switch (pixelSize)
    {
      case 1:
        PixelPerRLEUnit = 8;
        pLineBuf = new PLBYTE [(rowBytes+1) * 32];
        break;
      case 2:
        PixelPerRLEUnit = 4;
        pLineBuf = new PLBYTE [(rowBytes+1) * 16];
        break;
      case 4:
        PixelPerRLEUnit = 2;
        pLineBuf = new PLBYTE [(rowBytes+1) * 8];
        break;
      case 8:
        PixelPerRLEUnit = 1;
        pLineBuf = new PLBYTE [rowBytes * 4];
        break;
      case 16:
        PixelPerRLEUnit = 1;
        pLineBuf = new PLBYTE [rowBytes * 2 + 4];
        break;
      default:
        char sz[256];
        sprintf (sz,
                 "Illegal bpp value in unpackbits: %d\n",
                 pixelSize);
        raiseError (PL_ERRFORMAT_UNKNOWN, sz);
    }

    if (rowBytes < 8)
    { // ah-ha!  The bits aren't actually packed.  This will be easy.
      for (i = 0; i < Height; i++)
      {
        pDestLine = pLineArray[i];
        pSrcLine = pDataSrc->ReadNBytes (rowBytes);
        if (pixelSize == 16)
          expandBuf(pDestLine, pSrcLine, Width, pixelSize);
        else
          expandBuf8(pDestLine, pSrcLine, Width, pixelSize);
      }
    }
    else
    {
      for (i = 0; i < Height; i++)
      { // For each line do...
        if (rowBytes > 250)
          linelen = ReadMWord(pDataSrc);
         else
          linelen = ReadByte(pDataSrc);

        pSrcLine = pDataSrc->ReadNBytes(linelen);
        pBuf = pLineBuf;

        // Unpack RLE. The data is packed bytewise - except for
        // 16 bpp data, which is packed per pixel :-(.
        for (j = 0; j < linelen; )
        {
          FlagCounter = pSrcLine[j];
          if (FlagCounter & 0x80)
          {
            if (FlagCounter == 0x80)
              // Special case: repeat value of 0.
              // Apple sais ignore.
              j++;
            else
            { // Packed data.
              len = ((FlagCounter ^ 255) & 255) + 2;

              // This is slow for some formats...
              if (pixelSize == 16)
              {
                expandBuf (pBuf, pSrcLine+j+1, 1, pixelSize);
                for (k = 1; k < len; k++)
                { // Repeat the pixel len times.
                  memcpy (pBuf+(k*4*PixelPerRLEUnit), pBuf,
                          4*PixelPerRLEUnit);
                }
                pBuf += len*4*PixelPerRLEUnit;
              }
              else
              {
                expandBuf8 (pBuf, pSrcLine+j+1, 1, pixelSize);
                for (k = 1; k < len; k++)
                { // Repeat the expanded byte len times.
                  memcpy (pBuf+(k*PixelPerRLEUnit), pBuf,
                          PixelPerRLEUnit);
                }
                pBuf += len*PixelPerRLEUnit;
              }
              j += 1 + pkpixsize;
            }
          }
          else
          { // Unpacked data
            len = (FlagCounter & 255) + 1;
            if (pixelSize == 16)
            {
              expandBuf (pBuf, pSrcLine+j+1, len, pixelSize);
              pBuf += len*4*PixelPerRLEUnit;
            }
            else
            {
              expandBuf8 (pBuf, pSrcLine+j+1, len, pixelSize);
              pBuf += len*PixelPerRLEUnit;
            }
            j += len * pkpixsize + 1;
          }
        }
        pDestLine = pLineArray[i];
        if (pixelSize == 16)
          memcpy (pDestLine, pLineBuf, 4*Width);
        else
          memcpy (pDestLine, pLineBuf, Width);
      }
    }
  }
  catch (PLTextException)
  {
    delete [] pLineBuf;
    throw;
  }

  delete [] pLineBuf;
}

void PLPictDecoder::skipBits
    ( MacRect* pBounds,
      PLWORD rowBytes,
      int pixelSize,         // Source bits per pixel.
      PLDataSource * pDataSrc
    )
    // skips unneeded packbits.
{
  int    i;
  PLWORD   pixwidth;           // bytes per row when uncompressed.
  int    linelen;            // length of source line in bytes.

  int Height = pBounds->bottom - pBounds->top;
  int Width = pBounds->right - pBounds->left;

  // High bit of rowBytes is flag.
  if (pixelSize <= 8)
    rowBytes &= 0x7fff;

  pixwidth = Width;

  if (pixelSize == 16)
    pixwidth *= 2;

  if (rowBytes == 0)
    rowBytes = pixwidth;

  if (rowBytes < 8)
  {
    pDataSrc->Skip (rowBytes*Height);
  }
  else
  {
    for (i = 0; i < Height; i++)
    {
      if (rowBytes > 250)
        linelen = ReadMWord(pDataSrc);
       else
        linelen = ReadByte(pDataSrc);
      pDataSrc->Skip (linelen);
    }
  }
}

void PLPictDecoder::expandBuf
    ( PLBYTE * pDestBuf,
      PLBYTE * pSrcBuf,
      int Width,       // Width in bytes for 8 bpp or less.
                       // Width in pixels for 16 bpp.
      int bpp          // bits per pixel
    )
    // Expands Width units to 32-bit pixel data.
{
  PLBYTE * pSrc;
  PLBYTE * pDest;
  int i;

  pSrc = pSrcBuf;
  pDest = pDestBuf;

  switch (bpp)
  {
    case 16:
      for (i=0; i<Width; i++)
      {
        PLWORD Src = pSrcBuf[1]+(pSrcBuf[0]<<8);
        *(pDestBuf+PL_RGBA_BLUE) = ((Src) & 31)*8;          // Blue
        *(pDestBuf+PL_RGBA_GREEN) = ((Src >> 5) & 31)*8;    // Green
        *(pDestBuf+PL_RGBA_RED) = ((Src  >> 10) & 31)*8;    // Red
        *(pDestBuf+PL_RGBA_ALPHA) = 0xFF;                   // Alpha
        pSrcBuf += 2;
        pDestBuf += 4;
      }
      break;
    default:
      raiseError (PL_ERRFORMAT_UNKNOWN,
                  "Bad bits per pixel in expandBuf.");
  }
  return;
}

void PLPictDecoder::expandBuf8
    ( PLBYTE * pDestBuf,
      PLBYTE * pSrcBuf,
      int Width,       // Width in bytes.
      int bpp          // bits per pixel.
    )
    // Expands Width units to 8-bit pixel data.
    // Max. 8 bpp source format.
{
  PLBYTE * pSrc;
  PLBYTE * pDest;
  int i;

  pSrc = pSrcBuf;
  pDest = pDestBuf;

  switch (bpp)
  {
    case 8:
      memcpy (pDestBuf, pSrcBuf, Width);
      break;
    case 4:
      for (i=0; i<Width; i++)
      {
        *pDest = (*pSrc >> 4) & 15;
        *(pDest+1) = (*pSrc & 15);
        pSrc++;
        pDest += 2;
      }
      if (Width & 1) // Odd Width?
      {
        *pDest = (*pSrc >> 4) & 15;
        pDest++;
      }
      break;
    case 2:
      for (i=0; i<Width; i++)
      {
        *pDest = (*pSrc >> 6) & 3;
        *(pDest+1) = (*pSrc >> 4) & 3;
        *(pDest+2) = (*pSrc >> 2) & 3;
        *(pDest+3) = (*pSrc & 3);
        pSrc++;
        pDest += 4;
      }
      if (Width & 3)  // Check for leftover pixels
        for (i=6; i>8-(Width & 3)*2; i-=2)
        {
          *pDest = (*pSrc >> i) & 3;
          pDest++;
        }
      break;
    case 1:
      for (i=0; i<Width; i++)
      {
        *pDest = (*pSrc >> 7) & 1;
        *(pDest+1) = (*pSrc >> 6) & 1;
        *(pDest+2) = (*pSrc >> 5) & 1;
        *(pDest+3) = (*pSrc >> 4) & 1;
        *(pDest+4) = (*pSrc >> 3) & 1;
        *(pDest+5) = (*pSrc >> 2) & 1;
        *(pDest+6) = (*pSrc >> 1) & 1;
        *(pDest+7) = (*pSrc  & 1);
        pSrc++;
        pDest += 8;
      }
      if (Width & 7)  // Check for leftover pixels
        for (i=7; i>(8-Width & 7); i--)
        {
          *pDest = (*pSrc >> i) & 1;
          pDest++;
        }
      break;
    default:
      raiseError (PL_ERRFORMAT_UNKNOWN,
                  "Bad bits per pixel in expandBuf8.");
  }
  return;
}

/////////////////////////////////////////////////////////////////////
// Auxillary functions

void PLPictDecoder::readPixmap
    ( MacpixMap * pPixMap,
      PLDataSource * pDataSrc
    )
{
  pPixMap->version = ReadMWord(pDataSrc);
  pPixMap->packType = ReadMWord(pDataSrc);
  pPixMap->packSize = ReadMLong(pDataSrc);
  pPixMap->hRes = ReadMWord(pDataSrc);
  ReadMWord(pDataSrc);
  pPixMap->vRes = ReadMWord(pDataSrc);
  ReadMWord(pDataSrc);
  pPixMap->pixelType = ReadMWord(pDataSrc);
  pPixMap->pixelSize = ReadMWord(pDataSrc);
  pPixMap->cmpCount = ReadMWord(pDataSrc);
  pPixMap->cmpSize = ReadMWord(pDataSrc);
  pPixMap->planeBytes = ReadMLong(pDataSrc);
  pPixMap->pmTable = ReadMLong(pDataSrc);
  pPixMap->pmReserved = ReadMLong(pDataSrc);

  tracePixMapHeader (2, pPixMap);
}

void PLPictDecoder::readColourTable
    ( PLWORD * pNumColors,
      PLDataSource * pDataSrc,
      PLPixel32 * pPal
    )
    // Reads a mac colour table into a bitmap palette.
{
  PLLONG        ctSeed;
  PLWORD        ctFlags;
  PLWORD        val;
  int         i;

  Trace (3, "Getting color table info.\n");

  ctSeed = ReadMLong(pDataSrc);
  ctFlags = ReadMWord(pDataSrc);
  *pNumColors = ReadMWord(pDataSrc)+1;

  char sz[256];
  sprintf (sz, "Palette Size:  %d\n", *pNumColors);
  Trace (2, sz);
  Trace (3, "Reading Palette.\n");

  for (i = 0; i < *pNumColors; i++)
  {
    val = ReadMWord(pDataSrc);
    if (ctFlags & 0x8000)
      // The indicies in a device colour table are bogus and
      // usually == 0, so I assume we allocate up the list of
      // colours in order.
      val = i;
    if (val >= *pNumColors)
    {
      raiseError (PL_ERRFORMAT_UNKNOWN,
                  "pixel value greater than colour table size.");
    }
    // Mac colour tables contain 16-bit values for R, G, and B...
    pPal[val].SetR ((PLBYTE) (((PLWORD) (ReadMWord(pDataSrc)) >> 8) & 0xFF));
    pPal[val].SetG ((PLBYTE) (((PLWORD) (ReadMWord(pDataSrc)) >> 8) & 0xFF));
    pPal[val].SetB ((PLBYTE) (((PLWORD) (ReadMWord(pDataSrc)) >> 8) & 0xFF));
  }

}

void PLPictDecoder::readRect
    ( MacRect * pr,
      PLDataSource * pDataSrc
    )
{
  pr->top = ReadMWord(pDataSrc);
  pr->left = ReadMWord(pDataSrc);
  pr->bottom = ReadMWord(pDataSrc);
  pr->right = ReadMWord(pDataSrc);
}

void PLPictDecoder::dumpRect
    ( char * psz,
      MacRect * pr
    )
{
  char sz[256];
  sprintf (sz, "%s (%d,%d) (%d,%d).\n",
           psz, pr->left, pr->top, pr->right, pr->bottom);
  Trace (2, sz);
}

void PLPictDecoder::tracePixMapHeader
    ( int Level,
      MacpixMap * pPixMap
    )
{
  char sz[256];
  Trace (Level, "PixMap header info:\n");
  dumpRect ("  Bounds:", &(pPixMap->Bounds));

  sprintf (sz, "  version: 0x%x\n", pPixMap->version);
  Trace (Level, sz);
  sprintf (sz, "  packType: %d\n", pPixMap->packType);
  Trace (Level, sz);
  sprintf (sz, "  packSize: %ld\n", pPixMap->packSize);
  Trace (Level, sz);
  sprintf (sz, "  hRes: %ld\n", pPixMap->hRes);
  Trace (Level, sz);
  sprintf (sz, "  vRes: %ld\n", pPixMap->vRes);
  Trace (Level, sz);
  sprintf (sz, "  pixelSize: %d\n", pPixMap->pixelSize);
  Trace (Level, sz);
  sprintf (sz, "  cmpCount: %d\n", pPixMap->cmpCount);
  Trace (Level, sz);
  sprintf (sz, "  cmpSize: %d.\n", pPixMap->cmpSize);
  Trace (Level, sz);
  sprintf (sz, "  planeBytes: %ld.\n", pPixMap->planeBytes);
  Trace (Level, sz);
}

/*
/--------------------------------------------------------------------
|
|      $Log: plpictdec.cpp,v $
|      Revision 1.14  2004/10/02 22:23:12  uzadow
|      - configure and Makefile cleanups\n- Pixelformat enhancements for several filters\n- Added PLBmpBase:Dump\n- Added PLBmpBase::GetPixelNn()-methods\n- Changed default unix byte order to BGR
|
|      Revision 1.13  2004/09/11 12:41:35  uzadow
|      removed plstdpch.h
|
|      Revision 1.12  2004/09/09 16:52:49  artcom
|      refactored PixelFormat
|
|      Revision 1.11  2004/06/19 16:49:07  uzadow
|      Changed GetImage so it works with PLBmpBase
|
|      Revision 1.10  2002/11/04 21:03:12  uzadow
|      Fixed error when PL_SUPPORT_JPEG was turned off.
|
|      Revision 1.9  2002/08/04 21:20:41  uzadow
|      no message
|
|      Revision 1.8  2002/08/04 20:08:01  uzadow
|      Added PLBmpInfo class, ability to extract metainformation from images without loading the whole image and proper greyscale support.
|
|      Revision 1.7  2002/03/31 13:36:42  uzadow
|      Updated copyright.
|
|      Revision 1.6  2001/10/21 17:12:40  uzadow
|      Added PSD decoder beta, removed BPPWanted from all decoders, added PLFilterPixel.
|
|      Revision 1.5  2001/10/16 17:12:26  uzadow
|      Added support for resolution information (Luca Piergentili)
|
|      Revision 1.4  2001/10/06 22:03:26  uzadow
|      Added PL prefix to basic data types.
|
|      Revision 1.3  2001/10/06 15:32:22  uzadow
|      Removed types LPBYTE, DWORD, UCHAR, VOID and INT from the code.
|
|      Revision 1.2  2001/09/16 20:57:17  uzadow
|      Linux version name prefix changes
|
|      Revision 1.1  2001/09/16 19:03:22  uzadow
|      Added global name prefix PL, changed most filenames.
|
|      Revision 1.12  2001/02/04 14:31:52  uzadow
|      Member initialization list cleanup (Erik Hoffmann).
|
|      Revision 1.11  2001/01/21 14:28:21  uzadow
|      Changed array cleanup from delete to delete[].
|
|      Revision 1.10  2000/12/18 22:42:52  uzadow
|      Replaced RGBAPIXEL with PLPixel32.
|
|      Revision 1.9  2000/10/24 23:01:42  uzadow
|      Fixed bug in ver.1 bitmap decoder
|
|      Revision 1.8  2000/08/13 12:11:43  Administrator
|      Added experimental DirectDraw-Support
|
|      Revision 1.7  2000/05/27 16:28:28  Ulrich von Zadow
|      Really fixed bug decoding pixmaps with < 8 bpp.
|
|      Revision 1.6  2000/03/15 17:23:20  Ulrich von Zadow
|      Fixed bug decoding pixmaps with < 8 bpp.
|
|      Revision 1.5  2000/01/16 20:43:14  anonymous
|      Removed MFC dependencies
|
|      Revision 1.4  1999/11/22 15:00:27  Ulrich von Zadow
|      Fixed bug decoding small 24 bpp pict files.
|
|      Revision 1.3  1999/10/03 18:50:51  Ulrich von Zadow
|      Added automatic logging of changes.
|
|
\--------------------------------------------------------------------
*/


text:
package retrofit.converter;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;

import retrofit.mime.TypedByteArray;
import retrofit.mime.TypedInput;
import retrofit.mime.TypedOutput;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.TypeFactory;

/**
 * A {@link Converter} which uses Jackson for reading and writing entities.
 *
 * @author Kai Waldron (kaiwaldron@gmail.com)
 */
public class JacksonConverter implements Converter {
  private static final String MIME_TYPE = "application/json; charset=UTF-8";

  private final ObjectMapper objectMapper;

  public JacksonConverter(ObjectMapper objectMapper) {
    this.objectMapper = objectMapper;
  }

  @Override public Object fromBody(TypedInput body, final Type type) throws ConversionException {
    try {
      final JavaType javaType = TypeFactory.defaultInstance().constructType(type);
      return objectMapper.readValue(body.in(), javaType);
    } catch (final JsonParseException e) {
      throw new ConversionException(e);
    } catch (final JsonMappingException e) {
      throw new ConversionException(e);
    } catch (final IOException e) {
      throw new ConversionException(e);
    }
  }

  @Override public TypedOutput toBody(Object object) {
    try {
      final String json = objectMapper.writeValueAsString(object);
      return new TypedByteArray(MIME_TYPE, json.getBytes("UTF-8"));
    } catch (final JsonProcessingException e) {
      throw new AssertionError(e);
    } catch (final UnsupportedEncodingException e) {
      throw new AssertionError(e);
    }
  }
}


text:
<!DOCTYPE html>
<html>
<!--
    How granular should this head stuff be? I could just include it all in this
    template, but it's likely to carry across many pages.
-->
<head>
    <title>
        {% if page.title %} {{ page.title }}
        {% else %}          {{ site.title }}
        {% endif %}
    </title>
    {% include head.html %}
    {% include meta.html %}
    {% include style.html %}
    {% include scripts.html %}
</head>
<!--

-->
<body>
    {{ content }}
</body>
</html>


text:
module GmanClient
  module Api
    # HealthCheck API
    module HealthCheck
      # Retrieve a health check
      def health_check
        response = request.api.v1.health_check.get

        response.to_h[:health_check] == 'Passed'
      end
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="Apache Solr Essentials - Chapter 3: Search your data" version="1.5">
	<types>
		<fieldType name="code" class="solr.StrField" sortMissingLast="true" />
		<fieldType name="int" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>
		<fieldType name="text" class="solr.TextField" omitNorms="true">
			<analyzer>
				<tokenizer class="solr.WhitespaceTokenizerFactory"/>
				<filter class="solr.LowerCaseFilterFactory" />
				<filter class="solr.WordDelimiterFilterFactory"
						generateWordParts="1"
						generateNumberParts="1"
						catenateWords="0"
						catenateNumbers="0"
						catenateAll="0"
						splitOnCaseChange="0" />
			</analyzer>
		</fieldType>
	</types>
	<fields>
		<field name="id" type="code" indexed="true" stored="true" required="true" />
		<field name="title" type="text" indexed="true" stored="true" required="true" />
	</fields>
	<uniqueKey>id</uniqueKey>
</schema>


text:
/*
 * REVISION HISTORY:
 *
 * Date          Author(s)
 * CR            Headline
 * ============  ==============================================================
 * Jun 29, 2005  Luiz Felipe Guimaraes
 * 1             Implement MEG TCK
 * ============  ==============================================================
 */
package org.osgi.test.cases.dmt.tc2.tb1.DmtSession;

import org.osgi.service.dmt.DmtData;
import org.osgi.service.dmt.DmtSession;
import org.osgi.service.dmt.security.DmtPermission;
import org.osgi.service.permissionadmin.PermissionInfo;
import org.osgi.test.cases.dmt.tc2.tbc.DmtConstants;
import org.osgi.test.cases.dmt.tc2.tbc.DmtTestControl;
import org.osgi.test.cases.dmt.tc2.tbc.TestInterface;
import org.osgi.test.cases.dmt.tc2.tbc.Activators.EventHandlerImpl;
import org.osgi.test.cases.dmt.tc2.tbc.Plugin.ExecPlugin.TestExecPluginActivator;
import org.osgi.test.support.compatibility.DefaultTestBundleControl;

import junit.framework.TestCase;

/**
 * This test case validates the events of Dmt, according to MEG specification
 *
 * @author Luiz Felipe Guimaraes
 */

public class Events implements TestInterface  {
	private DmtTestControl tbc;

	public Events(DmtTestControl tbc) {
		this.tbc = tbc;
	}
	@Override
	public void run() {
        prepare();
	    testEvents001();
	    testEvents002();
	}
    private void prepare() {
        tbc.setPermissions(new PermissionInfo(DmtPermission.class.getName(), DmtConstants.ALL_NODES,DmtConstants.ALL_ACTIONS));
    }
	/**
	 * It asserts that when the commit method is called, the correct Dmt
	 * Events are sent, that the nodes are the expected and that the
	 * order is the expected and if the session is atomic, no events are
	 * sent before commit. The thread waits until all events
	 * expected are sent or for the timeout.
	 *
	 * @spec 117.10 Events
	 */
	private void testEvents001() {
		DmtSession session = null;
		try {
			DefaultTestBundleControl.log("#testEvents001");
			// waits events sent by previous test methods before doing this test
			synchronized (tbc) {
				tbc.wait(DmtConstants.WAITING_TIME);
			}

			//Reset previous events
			EventHandlerImpl.reset();

			session = tbc.getDmtAdmin().getSession(".",DmtSession.LOCK_TYPE_ATOMIC);
			session.createInteriorNode(TestExecPluginActivator.INEXISTENT_NODE);
			session.setNodeValue(TestExecPluginActivator.LEAF_NODE,new DmtData("B"));
			session.copy(TestExecPluginActivator.INTERIOR_NODE,TestExecPluginActivator.INEXISTENT_NODE,true);
			session.renameNode(TestExecPluginActivator.INTERIOR_NODE,TestExecPluginActivator.RENAMED_NODE_NAME);
			session.deleteNode(TestExecPluginActivator.INTERIOR_NODE);
			TestCase.assertEquals("Asserts that if the session is atomic, no event is sent before commit.",0,EventHandlerImpl.getEventCount());
			session.commit();
			synchronized (tbc) {
				tbc.wait(DmtConstants.WAITING_TIME);
			}
			TestCase.assertTrue("Asserts that the property session.id contains the same value as DmtSession.getSessionId()",EventHandlerImpl.getSessionId() == session.getSessionId());
			TestCase.assertTrue("Asserts if the events have the correct properties.", EventHandlerImpl.isAllProperties());
			// RFC-141: There is no pre-defined order of events anymore (see https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1794)
//			tbc.assertEquals("Asserts that the number of events are correct",5,EventHandlerImpl.getEventCount());
			TestCase.assertTrue("Asserts that all of the node names are in the correct event.",EventHandlerImpl.passed());
//			tbc.assertTrue("Asserts that the order of the sent events is the expected.",EventHandlerImpl.isOrderedAtomic());

		} catch (Exception e) {
			tbc.failUnexpectedException(e);
		} finally {
			tbc.closeSession(session);
		}

	}

	/**
	 * It asserts that if the session is exclusive, the events are sent immediatly, instead of waiting for commit.
	 *
	 * @spec 117.10 Events
	 */
	private void testEvents002() {
		DmtSession session = null;
		try {
			DefaultTestBundleControl.log("#testEvents002");
			//Reset previous events
			EventHandlerImpl.reset();

			session = tbc.getDmtAdmin().getSession(".",DmtSession.LOCK_TYPE_EXCLUSIVE);
			session.setNodeValue(TestExecPluginActivator.LEAF_NODE,new DmtData("B"));
			session.copy(TestExecPluginActivator.INTERIOR_NODE,TestExecPluginActivator.INEXISTENT_NODE,true);
			session.renameNode(TestExecPluginActivator.INTERIOR_NODE,TestExecPluginActivator.RENAMED_NODE_NAME);
            session.createInteriorNode(TestExecPluginActivator.INEXISTENT_NODE);
			session.deleteNode(TestExecPluginActivator.INTERIOR_NODE);

			synchronized (tbc) {
				tbc.wait(DmtConstants.WAITING_TIME);
			}
			TestCase.assertTrue("Asserts if the events have the correct properties.", EventHandlerImpl.isAllProperties());
			TestCase.assertEquals("Asserts that the number of events are correct",5,EventHandlerImpl.getEventCount());
			TestCase.assertTrue("Asserts that all of the node names are in the correct event.",EventHandlerImpl.passed());
            TestCase.assertTrue("Asserts that the events are sent immediately in an exclusive session, following no order (as an atomic session).",
                EventHandlerImpl.isOrderedExclusive());
			TestCase.assertTrue("Asserts that the property session.id contains the same value as DmtSession.getSessionId()",EventHandlerImpl.getSessionId() == session.getSessionId());
		} catch (Exception e) {
			tbc.failUnexpectedException(e);
		} finally {
			tbc.closeSession(session);
		}

	}

}


text:
/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */

package com.example.homework;

public final class R {
    public static final class attr {
    }
    public static final class dimen {
        /**  Default screen margins, per the Android Design guidelines.

         Example customization of dimensions originally defined in res/values/dimens.xml
         (such as screen margins) for screens with more than 820dp of available width. This
         would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).

         */
        public static final int activity_horizontal_margin=0x7f040000;
        public static final int activity_vertical_margin=0x7f040001;
        public static final int listmargin=0x7f040002;
        public static final int rlmargin=0x7f040003;
    }
    public static final class drawable {
        public static final int ic_empty=0x7f020000;
        public static final int ic_error=0x7f020001;
        public static final int ic_launcher=0x7f020002;
        public static final int ic_stub=0x7f020003;
        public static final int item_shape_bg=0x7f020004;
    }
    public static final class id {
        public static final int action_settings=0x7f080005;
        public static final int ivPic=0x7f080004;
        public static final int listview=0x7f080000;
        public static final int rlItemLayout=0x7f080001;
        public static final int tvDescription=0x7f080003;
        public static final int tvTitle=0x7f080002;
    }
    public static final class layout {
        public static final int activity_main=0x7f030000;
        public static final int item_manlist=0x7f030001;
    }
    public static final class menu {
        public static final int main=0x7f070000;
    }
    public static final class string {
        public static final int action_settings=0x7f050001;
        public static final int app_name=0x7f050000;
        public static final int dialog_message=0x7f050003;
        public static final int dialog_title=0x7f050002;
    }
    public static final class style {
        /**
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.

            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.

        Base application theme for API 11+. This theme completely replaces
        AppBaseTheme from res/values/styles.xml on API 11+ devices.

 API 11 theme customizations can go here.

        Base application theme for API 14+. This theme completely replaces
        AppBaseTheme from BOTH res/values/styles.xml and
        res/values-v11/styles.xml on API 14+ devices.

 API 14 theme customizations can go here.
         */
        public static final int AppBaseTheme=0x7f060000;
        /**  Application theme.
 All customizations that are NOT specific to a particular API-level can go here.
         */
        public static final int AppTheme=0x7f060001;
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Decisions</title>
    <link rel="stylesheet" type="text/css" href="../stylesheet.css" />

Decision Algorithm for Morphem Determination

The grammatical type of a word is determined by a tree (lattice) of tests.
Each test tries to match the word in question or some derivation
thereof against the tables in the database.

The following tests are implemented:

Table Lookup Tests

These tests try to find the word or parts thereof in a database table.
For the root and ending tests, an ordered, limited number of entries which
is less or equal than the word in question is examined.

Exact Match

The word is looked up in table words exactly as it was written.
        This table currently contains:

8360 conjugated forms of strong verbs

470 most common pronouns, prepositions an other short words

37 number word particles

100 adverbs

96 words related to time

1049 most common first names

1162 most common last names

227 names of big German cities

Word Root

Search for a left substring of the word in table roots .
        This table contains:

11000 roots of weak verbs ending on -en, -eln and -ern,
                with various prefixes

1927 (foreign) roots of weak verbs ending on -ieren with prefixes

27 adjectives forcolors

145 adjectives with irregular comparision forms

169 adjectives related to quantities

300 "primary" adjectives
                which are not derived from substantives, verbs or other adjectives

4900 "primary" substantives and names (1 syllable + optional ending
                -e, -en, -el, -en, -er)

Word Ending

Search for a right substring of the word in table xiffus
        (suffix spelled backwards).
        The table contains:

122 common endings of substantives

8360 conjugated forms of strong verbs

684 common endings of adjectives,
                declinated through all genders, cases and numbers

12 common adverb endings

        In order to find a word in the entries of this table,
        the character order of the word and of the entries is reversed.

Algorithmic Tests

Number word

Test whether the word starts with a German number word
        (eventually followed by an adjective suffix like -fach, -spurig),
        algorithmically with the aid of Java package numword.

Digits

Test whether the word consists of a sequence of digits ("0" ... "9") only.

Variant Tests

    The word in question is modified, and then the table lookup tests are retried.

Lower Case

Words starting with upper case are retried with lower case
        (case error, new writing rules, unrecognized sentence start,
        substantivated verb or adjective).

Upper Case

Words starting with lower case are retried with upper case
        (case error, new writing rules).

-ge-

Retry the word after removing an embedded syllable ge
        (e.g. aufgespalten).

-zu-

Retry the word after removing an embedded syllable zu
        (e.g. aufzugeben).

    The system allows that umlauts and the s-zet character
    to be expanded in the text (ä > ae, ß > ss etc.).
    All words with such characters are stored in the tables a second time,
    in expanded form, with an "explicit replacement" morphem
    which points to the "correct" writing
    (with regard to the new German writing rules since 1996).

    Back to the gramword start page


text:
describe('User Service Test', function() {

  beforeEach(function() {
    module('test');
  });

  var Users, $httpBackend, $http;

  beforeEach(inject(function($injector) {
    $httpBackend = $injector.get('$httpBackend');
    $httpBackend.when('GET', 'http://jsonplaceholder.typicode.com/users').respond(200, {
      res: 'res'
    });
    $http = $injector.get('$http');
    Users = $injector.get('Users');
  }));

  describe('Users unit tests', function() {
    it('query should be a function', function() {
      $http.get = sinon.stub().returns($http);
      $http.success = sinon.stub().returns($http);
      $http.error = sinon.stub();
      var cb = sinon.spy();
      Users.query(cb);
      expect(Users.query).toBeDefined();
      expect($http.get.called).toBe(true);
      expect($http.success.called).toBe(true);
      expect($http.error.called).toBe(true);
      $http.success.args[0][0]({
        res: 'res'
      });
      expect(cb.called).toBe(true);
      expect(typeof cb.args[0][1]).toBe('object');
      expect(cb.args[0][1].res).toBe('res');

    });

    it('should test for failure of Users.query', function() {
      $http.get = sinon.stub().returns($http);
      $http.success = sinon.stub().returns($http);
      $http.error = sinon.stub();
      var cb = sinon.spy();
      $httpBackend.when('GET', 'http://jsonplaceholder.typicode.com/users').respond(500, {
        err: 'err'
      });
      Users.query(cb);
      expect(Users.query).toBeDefined();
      expect($http.get.called).toBe(true);
      expect($http.error.called).toBe(true);
      $http.error.args[0][0]({
        err: 'err'
      });
      expect(cb.called).toBe(true);
      expect(typeof cb.args[0][0]).toBe('object');
      expect(cb.args[0][0].err).toBe('err');

    });

  });
});


text:
static char *EVPath_version = "EVPath Version 4.2.4 -- Mon Dec  4 16:21:33 EST 2017\n";

#if defined (__INTEL_COMPILER)
//  Allow extern declarations with no prior decl
#  pragma warning (disable: 1418)
#endif
void EVprint_version()
{
    printf("%s",EVPath_version);
}
void EVfprint_version(FILE*out)
{
    fprintf(out, "%s",EVPath_version);
}


text:
package CG

import (
	"bufio"
	"image"
	"image/color"
	"image/draw"
	"os"
	"testing"

	_ "image/png"
)

func TestImageCreate(t *testing.T) {
	for _, test := range gopherImages {
		img := ImageCreate(test)
		img.Retain()
		img.Release()
		img.Release()
	}
}

func TestImageCreateNoCopy(t *testing.T) {
	for _, test := range gopherImages {
		img := ImageCreateNoCopy(test)
		img.Retain()
		img.Release()
		img.Release()
	}
}

func TestImageCreatePanic(t *testing.T) {
	defer func() { recover() }()
	ImageCreate(image.NewUniform(color.Black))
	t.Error("calling ImageCreate with an unsupported image type did not panic!")
}

func TestImageString(t *testing.T) {
	img := ImageCreate(gopherNRGBA)
	s := img.String()

	if len(s) == 0 {
		t.Error("invalid empty string representation of a CG.ImageRef")
	}

	img.Release()
}

func loadImage() image.Image {
	f, _ := os.Open("fixtures/gopher.png")
	i, _, _ := image.Decode(bufio.NewReader(f))
	f.Close()
	return i
}

func copyImage(dst draw.Image, src image.Image) image.Image {
	draw.Draw(dst, dst.Bounds(), src, image.Point{}, draw.Over)
	return dst
}

func imageToAlpha(img image.Image) image.Image {
	return copyImage(image.NewAlpha(img.Bounds()), img)
}

func imageToAlpha16(img image.Image) image.Image {
	return copyImage(image.NewAlpha16(img.Bounds()), img)
}

func imageToGray(img image.Image) image.Image {
	return copyImage(image.NewGray(img.Bounds()), img)
}

func imageToGray16(img image.Image) image.Image {
	return copyImage(image.NewGray16(img.Bounds()), img)
}

func imageToRGBA(img image.Image) image.Image {
	return copyImage(image.NewRGBA(img.Bounds()), img)
}

func imageToRGBA64(img image.Image) image.Image {
	return copyImage(image.NewRGBA64(img.Bounds()), img)
}

func imageToNRGBA64(img image.Image) image.Image {
	return copyImage(image.NewNRGBA64(img.Bounds()), img)
}

func imageToCMYK(img image.Image) image.Image {
	return copyImage(image.NewCMYK(img.Bounds()), img)
}

var (
	gopherNRGBA   = loadImage()
	gopherAlpha   = imageToAlpha(gopherNRGBA)
	gopherAlpha16 = imageToAlpha16(gopherNRGBA)
	gopherGray    = imageToGray(gopherNRGBA)
	gopherGray16  = imageToGray16(gopherNRGBA)
	gopherRGBA    = imageToRGBA(gopherNRGBA)
	gopherRGBA64  = imageToRGBA64(gopherNRGBA)
	gopherNRGBA64 = imageToNRGBA64(gopherNRGBA)
	gopherCMYK    = imageToCMYK(gopherNRGBA)

	gopherImages = [...]image.Image{
		gopherNRGBA,
		gopherAlpha,
		gopherAlpha16,
		gopherGray,
		gopherGray16,
		gopherRGBA,
		gopherRGBA64,
		gopherNRGBA64,
		gopherCMYK,
	}
)


text:
id: 5e8f2f13c4cdbe86b5c72da0
title: 'Natural Language Processing With RNNs: Create a Play Generator'
challengeType: 11
isHidden: false
videoId: j5xsxjq_Xk8
---

## Description

## Tests

```yml
question:
  text: |
    Fill in the blanks below to create the training examples for the RNN:

    ```py
    char_dataset = tf.data.__A__.__B__(text_as_int)
    ```

  answers:
    - |
      A: `DataSet`

      B: `from_tensor_slices`
    - |
      A: `data`

      B: `from_tensors`
    - |
      A: `DataSet`

      B: `from_generator`
  solution: 1
```


text:
<?php

namespace OpenOrchestra\FunctionalTests\ApiBundle\Controller;

use OpenOrchestra\FunctionalTests\Utils\AbstractAuthenticatedTest;
use OpenOrchestra\ModelInterface\Repository\ContentRepositoryInterface;
use OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface;

/**
 * Class ContentControllerTest
 */
class ContentControllerTest extends AbstractAuthenticatedTest
{
    /**
     * @var StatusRepositoryInterface
     */
    protected $statusRepository;

    /**
     * @var ContentRepositoryInterface
     */
    protected $contentRepository;

    /**
     * Set up the test
     */
    public function setUp()
    {
        parent::setUp();
        $this->contentRepository = static::$kernel->getContainer()->get('open_orchestra_model.repository.content');
        $this->statusRepository = static::$kernel->getContainer()->get('open_orchestra_model.repository.status');
    }

    /**
     * @param string $name
     *
     * @dataProvider provideStatusName
     */
    public function testChangeContentStatus($name)
    {
        $content = $this->contentRepository->findOneByLanguageAndVersion('206_3_portes', 'fr', '2');
        $newStatus = $this->statusRepository->findOneByName($name);

        $content->setStatus($newStatus);
        $this->client->request(
            'PUT',
            '/api/content/update-status',
            array(),
            array(),
            array(),
            static::$kernel->getContainer()->get('jms_serializer')->serialize($content, 'json')
        );

        $this->assertSame(200, $this->client->getResponse()->getStatusCode());

        $newContent = $this->contentRepository->findOneByLanguageAndVersion('206_3_portes', 'fr', '2');
        $this->assertSame($name, $newContent->getStatus()->getName());
    }

    /**
     * @return array
     */
    public function provideStatusName()
    {
        return array(
            array('draft'),
            array('pending'),
            array('published'),
        );
    }
}


text:
@interface DemoTwitterPaggingViewer : XHTwitterPaggingViewer

@end