Пример #1
0
unsigned long TIniFile::ReadULong(const wxString &Section,
  const wxString &Ident, unsigned long Default)
{
	return StrToULong(ReadString(Section, Ident, ULongToStr(Default)));
}
Пример #2
0
//---------------------------------------------------------------------------
AnsiString TMYIniFile::ReadString(char * Section, char * Ident, char * def)
{
  return ReadString(String(Section), String(Ident), def);
}
Пример #3
0
//---------------------------------------------------------------------------
int TMYIniFile::ReadInteger(String Section, String Ident, int def)
{
  AnsiString s(def);
  AnsiString result = ReadString(Section, Ident, s.c_str());
  return atoi(result.c_str());
}
Пример #4
0
int CLircdClient::Send(string cmd, string device, string key)
{
	enum packet_state
	{
		P_BEGIN,
		P_MESSAGE,
		P_STATUS,
		P_DATA,
		P_N,
		P_DATA_N,
		P_END
	};
	int done,todo;
	const char *str,*data;
	char *endptr;
	enum packet_state state;
	int status,n;
	unsigned long data_n=0;
	char packet[PACKET_SIZE];

	sprintf(packet,"%s %s %s\n",cmd.c_str(),device.c_str(),key.c_str());
	dprintf("sending to lircd %s",packet);
	todo=strlen(packet);
	data=packet;
	while(todo>0)
	{
		done=write(fd,(void *) data,todo);
		if(done<0)
		{
			dprintf("lirc could not send packet\n");
			return(-1);
		}
		data+=done;
		todo-=done;
	}

	/* get response */
	status=0;
	state=P_BEGIN;
	n=0;
	while(1)
	{
		str=ReadString();
		if(str==NULL) return(-1);
		switch(state)
		{
		case P_BEGIN:
			if(strcasecmp(str,"BEGIN")!=0)
			{
				continue;
			}
			state=P_MESSAGE;
			break;
		case P_MESSAGE:
			if(strncasecmp(str,packet,strlen(str))!=0 ||
			   strlen(str)+1!=strlen(packet))
			{
				state=P_BEGIN;
				continue;
			}
			state=P_STATUS;
			break;
		case P_STATUS:
			if(strcasecmp(str,"SUCCESS")==0)
			{
				status=0;
			}
			else if(strcasecmp(str,"END")==0)
			{
				status=0;
				return(status);
			}
			else if(strcasecmp(str,"ERROR")==0)
			{
				dprintf("lirc command failed: %s",packet);
				status=-1;
			}
			else
			{
				goto bad_packet;
			}
			state=P_DATA;
			break;
		case P_DATA:
			if(strcasecmp(str,"END")==0)
			{
				return(status);
			}
			else if(strcasecmp(str,"DATA")==0)
			{
				state=P_N;
				break;
			}
			goto bad_packet;
		case P_N:
			errno=0;
			data_n=strtoul(str,&endptr,0);
			if(!*str || *endptr)
			{
				goto bad_packet;
			}
			if(data_n==0)
			{
				state=P_END;
			}
			else
			{
				state=P_DATA_N;
			}
			break;
		case P_DATA_N:
			dprintf("lirc: %s\n",str);
			n++;
			if(n==(int)data_n) state=P_END;
			break;
		case P_END:
			if(strcasecmp(str,"END")==0)
			{
				return(status);
			}
			goto bad_packet;
			break;
		}
	}
 bad_packet:
	dprintf("lirc bad return packet\n");
	return(-1);
}
Пример #5
0
//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
int ReadStructure(source_t *source, structdef_t *def, char *structure)
{
	token_t token;
	fielddef_t *fd;
	void *p;
	int num;

	if (!PC_ExpectTokenString(source, "{")) return 0;
	while(1)
	{
		if (!PC_ExpectAnyToken(source, &token)) return qfalse;
		//if end of structure
		if (!strcmp(token.string, "}")) break;
		//find the field with the name
		fd = FindField(def->fields, token.string);
		if (!fd)
		{
			SourceError(source, "unknown structure field %s", token.string);
			return qfalse;
		} //end if
		if (fd->type & FT_ARRAY)
		{
			num = fd->maxarray;
			if (!PC_ExpectTokenString(source, "{")) return qfalse;
		} //end if
		else
		{
			num = 1;
		} //end else
		p = (void *)(structure + fd->offset);
		while (num-- > 0)
		{
			if (fd->type & FT_ARRAY)
			{
				if (PC_CheckTokenString(source, "}")) break;
			} //end if
			switch(fd->type & FT_TYPE)
			{
				case FT_CHAR:
				{
					if (!ReadChar(source, fd, p)) return qfalse;
					p = (char *) p + sizeof(char);
					break;
				} //end case
				case FT_INT:
				{
					if (!ReadNumber(source, fd, p)) return qfalse;
					p = (char *) p + sizeof(int);
					break;
				} //end case
				case FT_FLOAT:
				{
					if (!ReadNumber(source, fd, p)) return qfalse;
					p = (char *) p + sizeof(float);
					break;
				} //end case
				case FT_STRING:
				{
					if (!ReadString(source, fd, p)) return qfalse;
					p = (char *) p + MAX_STRINGFIELD;
					break;
				} //end case
				case FT_STRUCT:
				{
					if (!fd->substruct)
					{
						SourceError(source, "BUG: no sub structure defined");
						return qfalse;
					} //end if
					ReadStructure(source, fd->substruct, (char *) p);
					p = (char *) p + fd->substruct->size;
					break;
				} //end case
			} //end switch
			if (fd->type & FT_ARRAY)
			{
				if (!PC_ExpectAnyToken(source, &token)) return qfalse;
				if (!strcmp(token.string, "}")) break;
				if (strcmp(token.string, ","))
				{
					SourceError(source, "expected a comma, found %s", token.string);
					return qfalse;
				} //end if
			} //end if
		} //end while
	} //end while
	return qtrue;
} //end of the function ReadStructure
Пример #6
0
  bool GetDefaultValue(TSTRING &tsVal) {

    return ReadString(_T(""), tsVal);
  }
Пример #7
0
HRESULT CInArchive::GetNextItem(bool &filled, CItemEx &item)
{
  filled = false;

  UInt32 processedSize;
  Byte startHeader[2];
  RINOK(ReadBytes(startHeader, 2, processedSize))
  if (processedSize == 0)
    return S_OK;
  if (processedSize == 1)
    return (startHeader[0] == 0) ? S_OK: S_FALSE;
  if (startHeader[0] == 0 && startHeader[1] == 0)
    return S_OK;

  Byte header[256];
  const UInt32 kBasicPartSize = 22;
  RINOK(ReadBytes(header, kBasicPartSize, processedSize));
  if (processedSize != kBasicPartSize)
    return (startHeader[0] == 0) ? S_OK: S_FALSE;

  const Byte *p = header;
  memmove(item.Method, p, kMethodIdSize);
  if (!item.IsValidMethod())
    return S_OK;
  p += kMethodIdSize;
  p = ReadUInt32(p, item.PackSize);
  p = ReadUInt32(p, item.Size);
  p = ReadUInt32(p, item.ModifiedTime);
  item.Attributes = *p++;
  item.Level = *p++;
  if (item.Level > 2)
    return S_FALSE;
  UInt32 headerSize;
  if (item.Level < 2)
  {
    headerSize = startHeader[0];
    if (headerSize < kBasicPartSize)
      return S_FALSE;
    UInt32 remain = headerSize - kBasicPartSize;
    RINOK(CheckReadBytes(header + kBasicPartSize, remain));
    if (startHeader[1] != CalcSum(header, headerSize))
      return S_FALSE;
    size_t nameLength = *p++;
    if ((p - header) + nameLength + 2 > headerSize)
      return S_FALSE;
    p = ReadString(p, nameLength, item.Name);
  }
  else
   headerSize = startHeader[0] | ((UInt32)startHeader[1] << 8);
  p = ReadUInt16(p, item.CRC);
  if (item.Level != 0)
  {
    if (item.Level == 2)
    {
      RINOK(CheckReadBytes(header + kBasicPartSize, 2));
    }
    if ((size_t)(p - header) + 3 > headerSize)
      return S_FALSE;
    item.OsId = *p++;
    UInt16 nextSize;
    p = ReadUInt16(p, nextSize);
    while (nextSize != 0)
    {
      if (nextSize < 3)
        return S_FALSE;
      if (item.Level == 1)
      {
        if (item.PackSize < nextSize)
          return S_FALSE;
        item.PackSize -= nextSize;
      }
      CExtension ext;
      RINOK(CheckReadBytes(&ext.Type, 1))
      nextSize -= 3;
      ext.Data.SetCapacity(nextSize);
      RINOK(CheckReadBytes((Byte *)ext.Data, nextSize))
      item.Extensions.Add(ext);
      Byte hdr2[2];
      RINOK(CheckReadBytes(hdr2, 2));
      ReadUInt16(hdr2, nextSize);
    }
  }
  item.DataPosition = m_Position;
  filled = true;
  return S_OK;
}
Пример #8
0
wxSize TIniFile::ReadSize(const wxString & Section, const wxString & Ident,
  wxSize Default)
{
	return StrToSize(ReadString(Section, Ident, SizeToStr(Default)));
}
Пример #9
0
//--------------------------------------------------------------------
std::wstring CIniFile::ReadString(const std::wstring& szSection,
                                  const std::wstring& szKey, const std::wstring& szDefault)
{
    SetSection( szSection );
    return ReadString( szKey, szDefault );
}
Пример #10
0
wxPoint TIniFile::ReadPoint(const wxString & Section, const wxString & Ident,
  wxPoint Default)
{
	return StrToPoint(ReadString(Section, Ident, PointToStr(Default)));
}
Пример #11
0
wxRect TIniFile::ReadRect(const wxString & Section, const wxString & Ident,
  wxRect Default)
{
	return StrToRect(ReadString(Section, Ident, RectToStr(Default)));
}
Пример #12
0
wxColour TIniFile::ReadColor(const wxString & Section, const wxString & Ident,
  wxColour Default)
{
	return StrToColor(ReadString(Section, Ident, ColorToStr(Default)));
}
Пример #13
0
wxDateTime TIniFile::ReadDateTime(const wxString &Section,
  const wxString &Ident, wxDateTime Default)
{
	return StrToDateTime(ReadString(Section, Ident, DateTimeToStr(Default)));
}
Пример #14
0
long TIniFile::ReadLong(const wxString &Section, const wxString &Ident,
	long Default)
{
	return StrToLong(ReadString(Section, Ident, LongToStr(Default)));
}
Пример #15
0
CFSVar CJSONReader::ReadVal(const CFSAString &szKeyPath)
{
	OnValReadStart(szKeyPath);
	CFSVar Data;

	if (m_cCh=='[') {
		Data.Cast(CFSVar::VAR_ARRAY);
		GetChar(true);
		INTPTR ipPos=0;
		for (;;) {
			if (m_cCh==0) {
				throw CJSONException(FSTSTR("Unexpetcted EOF"));
			} else if (m_cCh==']') {
				GetChar(true);
				break;
			} else if (ipPos>0) {
				if (m_cCh==',') {
					GetChar(true);
				} else {
					throw CJSONException(FSTSTR("Missing ',' in array"));
				}
			}

			CFSAString szKey;
			szKey.Format("%zd", ipPos);
			CFSVar Data1=ReadVal(szKeyPath+"/"+szKey);
			if (m_iCollectData>0) {
				Data[ipPos]=Data1;
			}
			ipPos++;
		}
	} else if (m_cCh=='{') {
		Data.Cast(CFSVar::VAR_MAP);
		GetChar(true);
		INTPTR ipPos=0;
		for (;;) {
			if (m_cCh==0) {
				throw CJSONException(FSTSTR("Unexpetcted EOF"));
			} else if (m_cCh=='}') {
				GetChar(true);
				break;
			} else if (ipPos>0) {
				if (m_cCh==',') {
					GetChar(true);
				} else {
					throw CJSONException(FSTSTR("Missing ',' in map"));
				}
			}

			CFSAString szKey;
			if (m_cCh=='\"' || m_cCh=='\'') {
				szKey=ReadString();
			} else if (FSIsLetter(m_cCh)) {
				szKey=ReadText();
			} else {
				throw CJSONException(FSTSTR("Expected key"));
			}
			if (m_cCh==':') {
				GetChar(true);
			} else {
				throw CJSONException(FSTSTR("Expected ':'"));
			}
			CFSVar Data1=ReadVal(szKeyPath+"/"+szKey);
			if (m_iCollectData>0) {
				Data[szKey]=Data1;
			}
			ipPos++;
		}
	} else if (m_cCh=='\"' || m_cCh=='\'') {
		Data=ReadString();
	} else if ((m_cCh>='0' && m_cCh<='9') || FSStrChr("-+.", m_cCh)) {
		Data=ReadNumber();
	} else if (FSIsLetter(m_cCh)) {
		Data=ReadConst();
	} else if (!m_cCh) {
	} else {
		throw CJSONException(FSTSTR("Unknown value type"));
	}

	OnValReadEnd(szKeyPath, Data);
	return Data;
}
Пример #16
0
Variant Deserializer::ReadVariant(VariantType type)
{
    switch (type)
    {
    case VAR_INT:
        return Variant(ReadInt());

    case VAR_BOOL:
        return Variant(ReadBool());

    case VAR_FLOAT:
        return Variant(ReadFloat());

    case VAR_VECTOR2:
        return Variant(ReadVector2());

    case VAR_VECTOR3:
        return Variant(ReadVector3());

    case VAR_VECTOR4:
        return Variant(ReadVector4());

    case VAR_QUATERNION:
        return Variant(ReadQuaternion());

    case VAR_COLOR:
        return Variant(ReadColor());

    case VAR_STRING:
        return Variant(ReadString());

    case VAR_BUFFER:
        return Variant(ReadBuffer());

        // Deserializing pointers is not supported. Return null
    case VAR_VOIDPTR:
    case VAR_PTR:
        ReadUInt();
        return Variant((void*)0);

    case VAR_RESOURCEREF:
        return Variant(ReadResourceRef());

    case VAR_RESOURCEREFLIST:
        return Variant(ReadResourceRefList());

    case VAR_VARIANTVECTOR:
        return Variant(ReadVariantVector());

    case VAR_STRINGVECTOR:
        return Variant(ReadStringVector());

    case VAR_VARIANTMAP:
        return Variant(ReadVariantMap());

    case VAR_INTRECT:
        return Variant(ReadIntRect());

    case VAR_INTVECTOR2:
        return Variant(ReadIntVector2());

    case VAR_MATRIX3:
        return Variant(ReadMatrix3());

    case VAR_MATRIX3X4:
        return Variant(ReadMatrix3x4());

    case VAR_MATRIX4:
        return Variant(ReadMatrix4());

    case VAR_DOUBLE:
        return Variant(ReadDouble());

    default:
        return Variant();
    }
}
Пример #17
0
static MdlObject *S3O_LoadObject (FILE *f, ulong offset)
{
	size_t read_result;
	int oldofs = ftell(f);
	MdlObject *obj = new MdlObject;
	PolyMesh* pm;
	obj->geometry = pm = new PolyMesh;

	// Read piece header
	S3OPiece piece;
	fseek (f, offset, SEEK_SET);
	read_result = fread (&piece, sizeof(S3OPiece), 1, f);
	if (read_result != 1) throw std::runtime_error ("Couldn't read piece header.");

	// Read name
	obj->name = ReadString (piece.name, f);
	obj->position.set(piece.xoffset,piece.yoffset,piece.zoffset);

	// Read child objects
	fseek (f, piece.childs, SEEK_SET);
	for (unsigned int a=0;a<piece.numChilds;a++) {
		ulong chOffset;
		read_result = fread (&chOffset, sizeof(ulong), 1, f);
		if (read_result != 1) throw std::runtime_error ("Couldn't read child object.");
		MdlObject *child = S3O_LoadObject (f, chOffset);
		if (child) {
			child->parent = obj;
			obj->childs.push_back (child);
		}
	}

	// Read vertices
	pm->verts.resize (piece.numVertices);
	fseek (f, piece.vertices, SEEK_SET);
	for (unsigned int a=0;a<piece.numVertices;a++) {
		S3OVertex sv;
		read_result = fread (&sv, sizeof(S3OVertex), 1, f);
		if (read_result != 1) throw std::runtime_error ("Couldn't read vertex.");
		pm->verts [a].normal.set (sv.xnormal, sv.ynormal, sv.znormal);
		pm->verts [a].pos.set (sv.xpos, sv.ypos, sv.zpos);
		pm->verts [a].tc[0] = Vector2(sv.texu, sv.texv);
	}

	// Read primitives - 0=triangles,1 triangle strips,2=quads
	fseek (f, piece.vertexTable, SEEK_SET);
	switch (piece.primitiveType) { 
		case 0: { // triangles
			for (unsigned int i=0;i<piece.vertexTableSize;i+=3) {
				ulong index;
                Poly *pl = new Poly;
				pl->verts.resize(3);
				for (int a=0;a<3;a++) {
					read_result = fread (&index,4,1,f);
					if (read_result != 1) throw std::runtime_error ("Couldn't read primitive.");
					pl->verts [a] = index;
				}
				pm->poly.push_back (pl);
			}
			break;}
		case 1: { // tristrips
			ulong *data=new ulong[piece.vertexTableSize];
			read_result = fread (data,4,piece.vertexTableSize, f);
			if (read_result != piece.vertexTableSize) throw std::runtime_error ("Couldn't read tristrip.");
			for (unsigned int i=0;i<piece.vertexTableSize;) {
				// find out how long this strip is
				unsigned int first=i;
				while (i<piece.vertexTableSize && data[i]!=-1) 
					i++;
				// create triangles from it
				for (unsigned int a=2;a<i-first;a++) {
					Poly *pl = new Poly;
					pl->verts.resize(3);
					for (int x=0;x<3;x++)
						pl->verts[(a&1)?x:2-x]=data[first+a+x-2];
					pm->poly.push_back(pl);
				}
			}
			delete[] data;
			break;}
		case 2: { // quads
			for (unsigned int i=0;i<piece.vertexTableSize;i+=4) {
				ulong index;
                Poly *pl = new Poly;
				pl->verts.resize(4);
				for (int a=0;a<4;a++) {
					read_result = fread (&index,4,1,f);
					if (read_result != 1) throw std::runtime_error ("Couldn't read quad.");
					pl->verts [a] = index;
				}
				pm->poly.push_back (pl);
			}
			break;}
	}

//	fltk::message("object %s has %d polygon and %d vertices", obj->name.c_str(), obj->poly.size(),pm->verts.size());

	fseek (f, oldofs, SEEK_SET);
	return obj;
}
Пример #18
0
/*----------------------------------------------------------------------*/
BOOL LoadProject(CINEMATIQUE * c, char * dir, char * name)
{
	int		nb, version;
	C_TRACK	t;
	C_KEY		k, *kk;
	C_KEY_1_59	k159;
	C_KEY_1_65	k165;
	C_KEY_1_70	k170;
	C_KEY_1_71	k171;
	C_KEY_1_72	k172;
	C_KEY_1_74	k174;
	C_KEY_1_75	k175;
	char	txt[4];

	InitMapLoad(c);
	InitSound(c);

	strcpy(AllTxt, dir);
	strcat(AllTxt, name);
	FCurr = PAK_fopen(AllTxt, "rb");

	if (!FCurr) return FALSE;

	ReadString(txt);

	if (strcmp(txt, "KFA"))
	{
		PAK_fclose(FCurr);
		FCurr = NULL;
		c->New();
		return FALSE;
	}

	PAK_fread(&version, 4, 1, FCurr);

	if (version > VERSION)
	{
		PAK_fclose(FCurr);
		FCurr = NULL;
		c->New();
		return FALSE;
	}

	if (version >= ((1 << 16) | 61))
	{
		char txt[256];
		ReadString(txt);
	}

	//chargement image
	PAK_fread(&nb, 1, 4, FCurr);

	while (nb)
	{
		int echelle = 0;

		if (version >= ((1 << 16) | 71))
		{
			PAK_fread((void *)&echelle, 4, 1, FCurr);
		}

		ReadString(AllTxt);
		strcpy(Dir, AllTxt);
		GetPathDirectory(Dir);
		strcpy(Name, AllTxt);
		ClearDirectory(Name);
		strcpy(Name, FileNameChoose);

		int id = CreateAllMapsForBitmap(Dir, Name, c, -1, 0);

		if (TabBitmap[id].load)
		{
			if (echelle > 1)
			{
				TabBitmap[id].grille.echelle = echelle;
				c->ReInitMapp(id);
			}
			else
			{
				TabBitmap[id].grille.echelle = 1;
			}
		}
		else
		{
			TabBitmap[id].grille.echelle = 1;
		}

		nb--;
	}

	//chargement son
	LSoundChoose = C_LANGUAGE_FRENCH;

	if (version >= ((1 << 16) | 60))
	{
		PAK_fread(&nb, 1, 4, FCurr);

		while (nb)
		{
			if (version >= ((1 << 16) | 76))
			{
				short il;
				PAK_fread((void *)&il, 1, 2, FCurr);
				LSoundChoose = il;
			}

			ReadString(AllTxt);
			strcpy(Dir, AllTxt);
			GetPathDirectory(Dir);
			strcpy(Name, AllTxt);
			ClearDirectory(Name);
			strcpy(Name, FileNameChoose);

			AddSoundToList(Dir, Name, -1, 0);
			nb--;
		}
	}

	//chargement track + key
	PAK_fread(&t, 1, sizeof(C_TRACK) - 4, FCurr);
	AllocTrack(t.startframe, t.endframe, t.fps);

	nb = t.nbkey;

	while (nb)
	{
		if (version <= ((1 << 16) | 59))
		{
			PAK_fread(&k159, 1, sizeof(C_KEY_1_59), FCurr);
			k.angz = k159.angz;
			k.color = k159.color;
			k.colord = k159.colord;
			k.colorf = k159.colorf;
			k.frame = k159.frame;
			k.fx = k159.fx;
			k.numbitmap = k159.numbitmap;
			k.pos = k159.pos;
			k.speed = k159.speed;

			ARX_CHECK_SHORT(k159.typeinterp);
			k.typeinterp = ARX_CLEAN_WARN_CAST_SHORT(k159.typeinterp);
			k.force = 1;
			k.idsound[C_LANGUAGE_FRENCH] = -1;
			k.light.intensite = -1.f;
			k.posgrille.x = k.posgrille.y = k.posgrille.z = 0.f;
			k.angzgrille = 0.f;
			k.speedtrack = 1.f;
		}
		else
		{
			if (version <= ((1 << 16) | 65))
			{
				PAK_fread(&k165, 1, sizeof(C_KEY_1_65), FCurr);
				k.angz = k165.angz;
				k.color = k165.color;
				k.colord = k165.colord;
				k.colorf = k165.colorf;
				k.frame = k165.frame;
				k.fx = k165.fx;
				k.numbitmap = k165.numbitmap;
				k.pos = k165.pos;
				k.speed = k165.speed;

				ARX_CHECK_SHORT(k165.typeinterp);
				k.typeinterp = ARX_CLEAN_WARN_CAST_SHORT(k165.typeinterp);
				k.force = 1;
				k.idsound[C_LANGUAGE_FRENCH] = k165.idsound;
				k.light.intensite = -1.f;
				k.posgrille.x = k.posgrille.y = k.posgrille.z = 0.f;
				k.angzgrille = 0.f;
				k.speedtrack = 1.f;
			}
			else
			{
				if (version <= ((1 << 16) | 70))
				{
					PAK_fread(&k170, 1, sizeof(C_KEY_1_70), FCurr);
					k.angz = k170.angz;
					k.color = k170.color;
					k.colord = k170.colord;
					k.colorf = k170.colorf;
					k.frame = k170.frame;
					k.fx = k170.fx;
					k.numbitmap = k170.numbitmap;
					k.pos = k170.pos;
					k.speed = k170.speed;
					k.typeinterp = k170.typeinterp;
					k.force = k170.force;
					k.idsound[C_LANGUAGE_FRENCH] = k170.idsound;
					k.light.intensite = -1.f;
					k.posgrille.x = k.posgrille.y = k.posgrille.z = 0.f;
					k.angzgrille = 0.f;
					k.speedtrack = 1.f;
				}
				else
				{
					if (version <= ((1 << 16) | 71))
					{
						PAK_fread(&k171, 1, sizeof(C_KEY_1_71), FCurr);
						k.angz = k171.angz;
						k.color = k171.color;
						k.colord = k171.colord;
						k.colorf = k171.colorf;
						k.frame = k171.frame;
						k.fx = k171.fx;
						k.numbitmap = k171.numbitmap;
						k.pos = k171.pos;
						k.speed = k171.speed;
						k.typeinterp = k171.typeinterp;
						k.force = k171.force;
						k.idsound[C_LANGUAGE_FRENCH] = k171.idsound;
						k.light = k171.light;

						if ((k.fx & 0xFF000000) != FX_LIGHT)
						{
							k.light.intensite = -1.f;
						}

						k.posgrille.x = k.posgrille.y = k.posgrille.z = 0.f;
						k.angzgrille = 0.f;
						k.speedtrack = 1.f;
					}
					else
					{
						if (version <= ((1 << 16) | 72))
						{
							PAK_fread(&k172, 1, sizeof(C_KEY_1_72), FCurr);
							k.angz = k172.angz;
							k.color = k172.color;
							k.colord = k172.colord;
							k.colorf = k172.colorf;
							k.frame = k172.frame;
							k.fx = k172.fx;
							k.numbitmap = k172.numbitmap;
							k.pos = k172.pos;
							k.speed = k172.speed;
							k.typeinterp = k172.typeinterp;
							k.force = k172.force;
							k.idsound[C_LANGUAGE_FRENCH] = k172.idsound;
							k.light.pos = k172.light.pos;
							k.light.fallin = k172.light.fallin;
							k.light.fallout = k172.light.fallout;
							k.light.r = k172.light.r;
							k.light.g = k172.light.g;
							k.light.b = k172.light.b;
							k.light.intensite = k172.light.intensite;
							k.light.intensiternd = k172.light.intensiternd;
							k.posgrille.x = k172.posgrille.x;
							k.posgrille.y = k172.posgrille.y;
							k.posgrille.z = k172.posgrille.z;
							k.angzgrille = k172.angzgrille;
							k.speedtrack = 1.f;

							if ((k.fx & 0xFF000000) != FX_LIGHT)
							{
								k.light.intensite = -1.f;
							}
						}
						else
						{
							if (version <= ((1 << 16) | 74))
							{
								PAK_fread(&k174, 1, sizeof(C_KEY_1_74), FCurr);
								k.angz = k174.angz;
								k.color = k174.color;
								k.colord = k174.colord;
								k.colorf = k174.colorf;
								k.frame = k174.frame;
								k.fx = k174.fx;
								k.numbitmap = k174.numbitmap;
								k.pos = k174.pos;
								k.speed = k174.speed;
								k.typeinterp = k174.typeinterp;
								k.force = k174.force;
								k.idsound[C_LANGUAGE_FRENCH] = k174.idsound;
								k.light.pos = k174.light.pos;
								k.light.fallin = k174.light.fallin;
								k.light.fallout = k174.light.fallout;
								k.light.r = k174.light.r;
								k.light.g = k174.light.g;
								k.light.b = k174.light.b;
								k.light.intensite = k174.light.intensite;
								k.light.intensiternd = k174.light.intensiternd;
								k.posgrille.x = k174.posgrille.x;
								k.posgrille.y = k174.posgrille.y;
								k.posgrille.z = k174.posgrille.z;
								k.angzgrille = k174.angzgrille;
								k.speedtrack = 1.f;
							}
							else
							{
								if (version <= ((1 << 16) | 75))
								{
									PAK_fread(&k175, 1, sizeof(C_KEY_1_75), FCurr);
									k.angz = k175.angz;
									k.color = k175.color;
									k.colord = k175.colord;
									k.colorf = k175.colorf;
									k.frame = k175.frame;
									k.fx = k175.fx;
									k.numbitmap = k175.numbitmap;
									k.pos = k175.pos;
									k.speed = k175.speed;
									k.typeinterp = k175.typeinterp;
									k.force = k175.force;
									k.idsound[C_LANGUAGE_FRENCH] = k175.idsound;
									k.light.pos = k175.light.pos;
									k.light.fallin = k175.light.fallin;
									k.light.fallout = k175.light.fallout;
									k.light.r = k175.light.r;
									k.light.g = k175.light.g;
									k.light.b = k175.light.b;
									k.light.intensite = k175.light.intensite;
									k.light.intensiternd = k175.light.intensiternd;
									k.posgrille.x = k175.posgrille.x;
									k.posgrille.y = k175.posgrille.y;
									k.posgrille.z = k175.posgrille.z;
									k.angzgrille = k175.angzgrille;
									k.speedtrack = k175.speedtrack;
								}
								else
								{
									PAK_fread(&k, 1, sizeof(C_KEY), FCurr);
								}
							}
						}
					}
				}
			}
		}

		if (version <= ((1 << 16) | 67))
		{
			if (k.typeinterp == INTERP_NO_FADE)
			{
				k.typeinterp = INTERP_NO;
				k.force = 1;
			}
		}

		if (version <= ((1 << 16) | 73))
		{
			k.light.pos.x = k.light.pos.y = k.light.pos.z = 0.f;
		}

		if (version <= ((1 << 16) | 75))
		{
			for (int i = 1; i < 16; i++) k.idsound[i] = -1;
		}

		if (k.force < 0) k.force = 1;

		FillKeyTemp(&k.pos, k.angz, k.frame, k.numbitmap, k.fx, k.typeinterp, k.color, k.colord, k.colorf, k.speed, -1, k.force, &k.light, &k.posgrille, k.angzgrille, k.speedtrack);
		memcpy(&KeyTemp.idsound, &k.idsound, 16 * 4);
		AddKeyLoad(&KeyTemp);

		if (!(t.nbkey - nb))
		{
			c->pos = k.pos;
			c->angz = k.angz;
			c->numbitmap = k.numbitmap;
			c->fx = k.fx;
			c->ti = c->tichoose = k.typeinterp;
			c->color = c->colorchoose = k.color;
			c->colord = c->colorchoosed = k.colord;
			c->colorflash = c->colorflashchoose = k.colorf;
			c->speed = c->speedchoose = k.speed;
			c->idsound = k.idsound[C_LANGUAGE_FRENCH];
			c->force = k.force;
			c->light = c->lightchoose = k.light;
			c->posgrille = k.posgrille;
			c->angzgrille = k.angzgrille;
			c->speedtrack = k.speedtrack;
		}

		nb--;
	}

	UpDateAllKeyLight();

	PAK_fclose(FCurr);
	FCurr = NULL;

	ActiveAllTexture(c);

	SetCurrFrame(0);

	GereTrackNoPlay(c);
	c->projectload = TRUE;

	InitUndo();

	//precalc
	if (version < ((1 << 16) | 71))
	{
		kk = CKTrack->key;
		nb = CKTrack->nbkey;

		while (nb)
		{
			switch (kk->fx & 0x0000FF00)
			{
				case FX_DREAM:
					TabBitmap[kk->numbitmap].grille.echelle = 4;
					c->ReInitMapp(kk->numbitmap);
					break;
			}

			nb--;
			kk++;
		}
	}

	LSoundChoose = C_LANGUAGE_ENGLISH << 8;

	return TRUE;
}
Пример #19
0
//
//	259	still active, very bad
//	0	is the only OK that we want!
//	other values, very bad
//
int RunSignature() {

  DWORD retval=99;

  TCHAR homedir[MAX_PATH];
  TCHAR path[MAX_PATH];

  LocalPath(path,_T(LKD_LOGS));
  #if (WINDOWSPC>0)
  _tcscat(path,_T("\\LKRECORD_PC.LK8"));
  #endif

  // CAREFUL!!! PNA is ALSO PPC2003!!
  // 
  // ATTENTION: on PNA we are executing LKRECORD_PNA.LK8.EXE really
  #ifdef PNA
  _tcscat(path,_T("\\LKRECORD_PNA.LK8"));
  #else
    #ifdef PPC2002
    _tcscat(path,_T("\\LKRECORD_2002.LK8"));
    #endif
    #ifdef PPC2003
    _tcscat(path,_T("\\LKRECORD_2003.LK8"));
    #endif
  #endif 

  LocalPath(homedir,TEXT(LKD_LOGS));

  #if TESTBENCH
  StartupStore(_T(".... RunSignature: homedir <%s>%s"),homedir,NEWLINE);
  #endif


  PROCESS_INFORMATION pi;

  #if (WINDOWSPC>0)
  // Sadly, some parameters cannot be passed in the CE version
  STARTUPINFO si;
  ZeroMemory(&si,sizeof(STARTUPINFO));
  si.cb=sizeof(STARTUPINFO);
  si.wShowWindow= SW_SHOWNORMAL;
  si.dwFlags = STARTF_USESHOWWINDOW;

  if (!::CreateProcess(path,homedir, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi)) {
  #else
  if (!::CreateProcess(path,homedir, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, NULL, &pi)) {
  #endif
	DWORD lasterr=GetLastError();

	if (lasterr!=2) {
		// External executable failure, bad !
		StartupStore(_T(".... RunSignature exec <%s> FAILED, error code=%d"),path,lasterr,NEWLINE);
		#if TESTBENCH
		StartupStore(_T(".... Trying with DoSignature\n"));
		#endif
	}

	#if TESTBENCH
	else 
		StartupStore(_T(".... no executable <%s> found, proceeding with DoSignature\n"),path);
	#endif

	extern int DoSignature(TCHAR *hpath);
	retval=DoSignature(homedir);

	return retval;
  }
  ::WaitForSingleObject(pi.hProcess, 30000); // 30s
  GetExitCodeProcess(pi.hProcess,&retval);
  // STILL_ACTIVE = 259, this retval should be checked for

  #if TESTBENCH
  StartupStore(_T(".... RunSignature exec <%s> terminated, retval=%d%s"),path,retval,NEWLINE);
  #endif


  return retval;

}


//
// Paolo+Durval: feed external headers to LK for PNAdump software
//
#define EXTHFILE	"COMPE.CNF"
//#define DEBUGHFILE	1

void AdditionalHeaders(void) {

  TCHAR pathfilename[MAX_PATH+1];
  wsprintf(pathfilename, TEXT("%s\\%s\\%S"), LKGetLocalPath(), TEXT(LKD_LOGS), EXTHFILE);

  if (GetFileAttributes(pathfilename) == 0xffffffff) {
	#if DEBUGHFILE
	StartupStore(_T("... No additional headers file <%s>\n"),pathfilename);
	#endif
	return;
  }

  #if DEBUGHFILE
  StartupStore(_T("... HFILE <%s> FOUND\n"),pathfilename);
  #endif

  HANDLE hfile = CreateFile(pathfilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

  if( hfile == INVALID_HANDLE_VALUE) {
	StartupStore(_T("... ERROR, extHFILE <%s> not found!%s"),pathfilename,NEWLINE);
	return;
  }

  #define MAXHLINE 100
  TCHAR tmpString[MAXHLINE+1];
  char tmps[MAXHLINE+1];
  //char line[MAXHLINE+12];
  tmpString[0]=0;


  while (ReadString(hfile, MAXHLINE, tmpString)) {
	size_t len = _tcslen(tmpString);

	if (len < 2) continue;
	if (tmpString[0]!='$' ) {
		#if DEBUGHFILE
		StartupStore(_T("Line skipped: <%s>\n"),tmpString);
		#endif
		continue;
	}

	// Remove trailing cr lf, three times to be sure
	if ( (tmpString[len - 1] == '\r') || (tmpString[len-1]== '\n')) {
		tmpString[len - 1]= 0;
		len--;
	}
	if (len > 0) {
		if ( (tmpString[len - 1] == '\r') || (tmpString[len-1]== '\n')) {
			tmpString[len - 1]= 0;
			len--;
		}
	}
	if (len > 0) {
		if ( (tmpString[len - 1] == '\r') || (tmpString[len-1]== '\n')) {
			tmpString[len - 1]= 0;
		}
	}

	#if DEBUGHFILE
	StartupStore(_T("ADDING HEADER <%s>\n"),tmpString);
	#endif

	/*
	unicode2ascii(&tmpString[1],tmps,MAXHLINE);
	strcpy(line,"HFREMARK:");
	strcat(line,tmps);
	strcat(line,"\r\n");
	*/
	sprintf(tmps,"HFREMARK:%S\r\n",&tmpString[1]);
	
	IGCWriteRecord(tmps);
  }

  CloseHandle(hfile);

}
Пример #20
0
	return((*this).Compare(myStringObj)<0);
}

bool ANT_String::operator<=(const ANT_String& myStringObj)
{
	return((*this).Compare(myStringObj)<=0);
}

inline ostream & operator<<(ostream & out, const ANT_String & S)  
{
	return S.Display(out);
	
}

inline istream & operator>>(istream& in, ANT_String& S)  
{
	S.myStrPtr = ReadString();
	return in;
}


char ANT_String::operator [] (long i)
		{
		return myStrPtr[i];
		}

char ANT_String::operator [] (long i) const
		{
		return myStrPtr[i];
		}
Пример #21
0
//ヘッダー部読みだし(JWW形式とバージョンチェック)
BOOL JWWDocument::ReadHeader()
{
    int i;
    DWORD dw;
    DOUBLE db;
    string s;
//    WORD wd;
//    BYTE bt;
//    BOOL	Result = false;

    if(ifs)
    {
        //JWWのデータファイルの宣言
        s = ReadData(8);
        Header.head = s;
        if(Header.head =="JwwData.")
        {
            //バージョンNo.
            *ifs >> dw;
            Header.JW_DATA_VERSION = dw;
            if(Header.JW_DATA_VERSION == 230 || Header.JW_DATA_VERSION >= 300)
            {
                //ファイルメモ
                Header.m_strMemo = ReadString();
                //図面サイズ
                //0縲・ :A0縲廣4
                //8    :2 A
                //9    :3 A
                //10   :4 A
                //11   :5 A
                //12   :10m
                //13   :50m
                //14   :100m
                *ifs >> dw;
                Header.m_nZumen = dw;
                //レイヤグループ・レイヤ状態
                *ifs >> dw;
                Header.m_nWriteGLay = dw;
                for( i = 0; i < 16; i++ ){
                    *ifs >> dw;
                    Header.GLay[i].m_anGLay = dw;
                    *ifs >> dw;
                    Header.GLay[i].m_anWriteLay = dw;
                    *ifs >> db;
                    Header.GLay[i].m_adScale = db;
                    *ifs >> dw;
                    Header.GLay[i].m_anGLayProtect = dw;
                    for(int nLay=0;nLay<16;nLay++){
                        *ifs >> dw;
                        Header.GLay[i].m_nLay[nLay].m_aanLay = dw;
                        *ifs >> dw;
                        Header.GLay[i].m_nLay[nLay].m_aanLayProtect = dw;
                    }
                }
                //ダミー
                for( i = 0; i < 14; i++ )
                {
                    *ifs >> dw;
                    Header.Dummy[i]=dw;
                }
                //寸法関係の設定
                *ifs >> dw;
                Header.m_lnSunpou1 = dw;
                *ifs >> dw;
                Header.m_lnSunpou2 = dw;
                *ifs >> dw;
                Header.m_lnSunpou3 = dw;
                *ifs >> dw;
                Header.m_lnSunpou4 = dw;
                *ifs >> dw;
                Header.m_lnSunpou5 = dw;
                //ダミー
                *ifs >> dw;
                Header.Dummy1 = dw;
                //線描画の最大幅
                //「線幅を1/100mm単位とする」が設定されているときは「-101」
                *ifs >> dw;
                Header.m_nMaxDrawWid = dw;
                //プリンタ出力範囲の原点(X,Y)
                *ifs >> db;
                Header.m_DPPrtGenten.x = db;
                //
                *ifs >> db;
                Header.m_DPPrtGenten.y = db;
                //プリンタ出力倍率
                *ifs >> db;
                Header.m_dPrtBairitsu = db;
                //プリンタ90°回転出力、プリンタ出力基準点位置
                *ifs >> dw;
                Header.m_nPrt90Kaiten = dw;
                //目盛設定モード
                *ifs >> dw;
                Header.m_nMemoriMode = dw;
                //目盛表示最小間隔ドット
                *ifs >> db;
                Header.m_dMemoriHyoujiMin = db;
                //目盛表示間隔(X,Y)
                *ifs >> db;
                Header.m_dMemoriX = db;
                //
                *ifs >> db;
                Header.m_dMemoriY = db;
                //目盛基準点(X,Y)
                *ifs >> db;
                Header.m_DpMemoriKijunTen.x = db;
                //
                *ifs >> db;
                Header.m_DpMemoriKijunTen.y = db;
                //レイヤ名
                for( i=0; i < 16; i++)
                    for( int j = 0; j < 16; j++ )
                        Header.m_aStrLayName[i][j] = ReadString();
                //レイヤグループ名
                for( i=0; i < 16; i++ )
                    Header.m_aStrGLayName[i] = ReadString();
                //日影計算の条件 測定面高さ
                *ifs >> db;
                Header.m_dKageLevel = db;
                //緯度
                *ifs >> db;
                Header.m_dKageIdo = db;
                //9縲・5の測定の指定
                *ifs >> dw;
                Header.m_nKage9_15Flg = dw;
                //壁面日影測定面高さ
                *ifs >> db;
                Header.m_dKabeKageLevel = db;
                //天空図の条件(Ver.3.00以降)
                if(Header.JW_DATA_VERSION >= 300)
                {
                    //測定面高さ
                    *ifs >> db;
                    Header.m_dTenkuuZuLevel = db;
                    //天空図の半径*2
                    *ifs >> db;
                    Header.m_dTenkuuZuEnkoR = db;
                }
                //2.5Dの計算単位(0以外はmm単位で計算)
                *ifs >> dw;
                Header.m_nMMTani3D = dw;

                //保存時の画面倍率(読込むと前画面倍率になる)
                *ifs >> db;
                Header.m_dBairitsu = db;
                //
                *ifs >> db;
                Header.m_DPGenten.x = db;
                //
                *ifs >> db;
                Header.m_DPGenten.y = db;

                //範囲記憶倍率と基準点(X,Y)
                *ifs >> db;
                Header.m_dHanniBairitsu = db;
                //
                *ifs >> db;
                Header.m_DPHanniGenten.x = db;
                //
                *ifs >> db;
                Header.m_DPHanniGenten.y = db;

                //マークジャンプ倍率、基準点(X,Y)およびレイヤグループ
                if(Header.JW_DATA_VERSION >= 300)
                {
                    //ズーム拡張(v300)
                    for(int n=1; n<=8; n++){
                        *ifs >> db;
                        Header.m_dZoom[n].m_dZoomJumpBairitsu = db;
                        *ifs >> db;
                        Header.m_dZoom[n].m_DPZoomJumpGenten.x = db;
                        *ifs >> db;
                        Header.m_dZoom[n].m_DPZoomJumpGenten.y = db;
                        *ifs >> dw;
                        Header.m_dZoom[n].m_nZoomJumpGLay = dw;
                    }
                } else
                {
                    for( i=1; i <= 4; i++ )
Пример #22
0
// returns -1 if error, or the WpFileType 
int ReadWayPointFile(ZZIP_FILE *fp, TCHAR *CurrentWpFileName)
{
  WAYPOINT *new_waypoint;
  TCHAR szTemp[100];
  DWORD fSize, fPos=0;
  int nLineNumber=0;
  short fileformat=LKW_DAT;

  HWND hProgress;

  hProgress = CreateProgressDialog(gettext(TEXT("[email protected]_"))); // Loading Waypoints File...

  fSize = zzip_file_size(fp);

  fileformat=GetWaypointFileFormatType(CurrentWpFileName);

  if (fileformat<0) {
	StartupStore(_T("... Unknown file format in waypoint file <%s\n"),CurrentWpFileName);
	// We do NOT return, because first we analyze the content.
  }

  if (fSize <10) {
	StartupStore(_T("... ReadWayPointFile: waypoint file %s type=%d is empty%s"), CurrentWpFileName,fileformat,NEWLINE);
	return -1;
  }

  if (!AllocateWaypointList()) {
	StartupStore(_T("!!!!!! ReadWayPointFile: AllocateWaypointList FAILED%s"),NEWLINE);
	return -1;
  }

  new_waypoint = WayPointList+NumberOfWayPoints;


  memset(nTemp2String, 0, sizeof(nTemp2String)); // clear Temp Buffer

  // check file format
  bool fempty=true;
  int  slen=0; // 100204 WIP
  while ( ReadString(fp,READLINE_LENGTH,nTemp2String) ) {
	slen=_tcslen(nTemp2String);
	if (slen<1) continue;
	if ( _tcsncmp(_T("G  WGS 84"),nTemp2String,9) == 0 ||
	   _tcsncmp(_T("G WGS 84"),nTemp2String,8) == 0 ||
	   // consider UCS header, 3 bytes in fact. This is a workaround.
	   _tcsncmp(_T("G  WGS 84"),&nTemp2String[3],9) == 0) {
		if ( !ReadString(fp,READLINE_LENGTH,nTemp2String) ) {
			StartupStore(_T(". Waypoint file %d format: CompeGPS truncated, rejected%s"),globalFileNum+1,NEWLINE);
			return -1;
		}
		slen=_tcslen(nTemp2String);
		if (slen<1) {
			StartupStore(_T(". Waypoint file %d format: CompeGPS MISSING second U line, rejected%s"),globalFileNum+1,NEWLINE);
			return -1;
		}
		if ( (_tcsncmp(_T("U  0"),nTemp2String,4) == 0) ||
		     (_tcsncmp(_T("U 0"),nTemp2String,3) == 0)) {
			StartupStore(_T(". Waypoint file %d format: CompeGPS with UTM coordinates UNSUPPORTED%s"),globalFileNum+1,NEWLINE);
			return -1;
		}
		if ( _tcsncmp(_T("U  1"),nTemp2String,4) != 0 && 
		     _tcsncmp(_T("U 1"),nTemp2String,3) != 0 ) {
			StartupStore(_T(". Waypoint file %d format: CompeGPS unknown U field, rejected%s"),globalFileNum+1,NEWLINE);
			return -1;
		}
		
		StartupStore(_T(". Waypoint file %d format: CompeGPS, LatLon coordinates%s"),globalFileNum+1,NEWLINE);
		fempty=false;
		fileformat=LKW_COMPE;
		break;
	}
	if ( (_tcsncmp(_T("name,code,country"),nTemp2String,17) == 0) || 
		(_tcsncmp(_T("Title,Code,Country"),nTemp2String,18) == 0)  // 100314
	) {
		StartupStore(_T(". Waypoint file %d format: SeeYou%s"),globalFileNum+1,NEWLINE);
		fempty=false;
		fileformat=LKW_CUP;
		break;
	}

	if ( ( _tcsstr(nTemp2String, _T("OziExplorer Waypoint File")) == nTemp2String )||
			   // consider UCS header, 3 bytes in fact. This is a workaround.
			(_tcsstr(&nTemp2String[3], _T("OziExplorer Waypoint File")) == &nTemp2String[3]) ) {
		StartupStore(_T(". Waypoint file %d format: OziExplorer%s"),globalFileNum+1,NEWLINE);
		fempty=false;
		fileformat=LKW_OZI;
		break;
	}

	// consider also the case of empty file, when a waypoint if saved starting with numbering after
	// the virtual wps (including the 0);
	// Warning, using virtualdatheader 3 tcsncmp because virtuals are now more than 9.
	TCHAR virtualdatheader[5];
	_stprintf(virtualdatheader,_T("%d,"),RESWP_END+2);
	if ( _tcsncmp(_T("1,"),nTemp2String,2) == 0 ||
	  _tcsncmp(virtualdatheader,nTemp2String,3) == 0) {
		StartupStore(_T(". Waypoint file %d format: WinPilot%s"),globalFileNum+1,NEWLINE);
		fempty=false;
		fileformat=LKW_DAT;
		break;
	}
	// Otherwise we use the fileformat .xxx suffix. 
	// Why we did not do it since the beginning? Simply because we should not rely on .xxx suffix
	// because some formats like CompeGPS and OZI, for example, share the same .WPT suffix.
	// 
	if (fileformat<0) {
		StartupStore(_T(".. Unknown WP header, unknown format in <%s>%s"),nTemp2String,NEWLINE);
		// leaving fempty true, so no good file available
		break;
	} else {
		fempty=false;
		StartupStore(_T(".. Unknown WP header, using format %d.  Header: <%s>%s"),fileformat,nTemp2String,NEWLINE);
		break;
	}
  }
  if (fempty) {
	return -1;
  }

  // SetFilePointer(hFile,0,NULL,FILE_BEGIN);
  fPos = 0;

  // a real shame, too lazy to change into do while loop
  // Skip already read lines containing header, unless we are using DAT, which has no header
  if ( fileformat==LKW_DAT) goto goto_inloop; 

  memset(nTemp2String, 0, sizeof(nTemp2String)); // clear Temp Buffer

  while(ReadString(fp, READLINE_LENGTH, nTemp2String)){
goto_inloop:    
	nLineNumber++;
	nTemp2String[READLINE_LENGTH]=_T('\0');
	nTemp2String[READLINE_LENGTH-1]=_T('\n');
	nTemp2String[READLINE_LENGTH-2]=_T('\r');
	fPos += _tcslen(nTemp2String);
   
	if (_tcsstr(nTemp2String, TEXT("**")) == nTemp2String) // Look For Comment
		continue;

	if (_tcsstr(nTemp2String, TEXT("*")) == nTemp2String)  // Look For SeeYou Comment
		continue;

	if (nTemp2String[0] == '\0')
		continue;

	new_waypoint->Details = NULL; 
	new_waypoint->Comment = NULL; 

	if ( fileformat == LKW_DAT || fileformat== LKW_XCW ) {
		if (ParseDAT(nTemp2String, new_waypoint)) {

			if ( (_tcscmp(new_waypoint->Name, gettext(TEXT(RESWP_TAKEOFF_NAME)))==0) && (new_waypoint->Number==RESWP_ID)) {
				StartupStore(_T("... FOUND TAKEOFF (%s) INSIDE WAYPOINTS FILE%s"), gettext(TEXT(RESWP_TAKEOFF_NAME)), NEWLINE);
				memcpy(WayPointList,new_waypoint,sizeof(WAYPOINT));
				continue;
			}

			if (WaypointInTerrainRange(new_waypoint)) { 
				new_waypoint = GrowWaypointList();
				if (!new_waypoint) {
					return -1; // failed to allocate
				}
				new_waypoint++; // we want the next blank one
			}	
	  	}
	}
	if ( fileformat == LKW_CUP ) {
		if ( _tcsncmp(_T("-----Related Tasks"),nTemp2String,18)==0) {
			break;
		}
		if (ParseCUPWayPointString(nTemp2String, new_waypoint)) {
			if ( (_tcscmp(new_waypoint->Name, gettext(TEXT(RESWP_TAKEOFF_NAME)))==0) && (new_waypoint->Number==RESWP_ID)) {
				StartupStore(_T("... FOUND TAKEOFF (%s) INSIDE WAYPOINTS FILE%s"), gettext(TEXT(RESWP_TAKEOFF_NAME)), NEWLINE);
				memcpy(WayPointList,new_waypoint,sizeof(WAYPOINT));
				continue;
			}

			if (WaypointInTerrainRange(new_waypoint)) { 
				new_waypoint = GrowWaypointList();
				if (!new_waypoint) {
					return -1; // failed to allocate
				}
				new_waypoint++; // we want the next blank one
			}
		}
	}
	if ( fileformat == LKW_COMPE ) {
		if (ParseCOMPEWayPointString(nTemp2String, new_waypoint)) {
			if ( (_tcscmp(new_waypoint->Name, gettext(TEXT(RESWP_TAKEOFF_NAME)))==0) && (new_waypoint->Number==RESWP_ID)) {
				StartupStore(_T("... FOUND TAKEOFF (%s) INSIDE WAYPOINTS FILE%s"), gettext(TEXT(RESWP_TAKEOFF_NAME)), NEWLINE);
				memcpy(WayPointList,new_waypoint,sizeof(WAYPOINT));
				continue;
			}

			if (WaypointInTerrainRange(new_waypoint)) { 
				new_waypoint = GrowWaypointList();
				if (!new_waypoint) {
					return -1; // failed to allocate
				}
				new_waypoint++; // we want the next blank one
			}
		}
	}

	if(fileformat == LKW_OZI){
		// Ignore first four header lines
		if(nLineNumber <= 3)
			continue;

		if(ParseOZIWayPointString(nTemp2String, new_waypoint)){
			if ( (_tcscmp(new_waypoint->Name, gettext(TEXT(RESWP_TAKEOFF_NAME)))==0) && (new_waypoint->Number==RESWP_ID)) {
				StartupStore(_T("... FOUND TAKEOFF (%s) INSIDE WAYPOINTS FILE%s"), gettext(TEXT(RESWP_TAKEOFF_NAME)), NEWLINE);
				memcpy(WayPointList,new_waypoint,sizeof(WAYPOINT));
				continue;
			}

			if (WaypointInTerrainRange(new_waypoint)) {
				new_waypoint = GrowWaypointList();
				if (!new_waypoint) {
					return -1; // failed to allocate
				}
				new_waypoint++; // we want the next blank one
			}
		}
	}

	memset(nTemp2String, 0, sizeof(nTemp2String)); // clear Temp Buffer

	continue;

  }

  if (hProgress) {
	_stprintf(szTemp,TEXT("100%%"));       
	SetDlgItemText(hProgress,IDC_PROGRESS,szTemp);
  }
  return fileformat;

}
Пример #23
0
	BOOL ReadStruct (

/*  SYNOPSIS */
	struct Hook * hook,
	APTR	    * dataptr,
	void	    * stream,
	const IPTR  * sd)

/*  FUNCTION
	Reads one big endian structure from a streamhook.

    INPUTS
	hook - Streamhook
	dataptr - Put the data here
	stream - Read from this stream
	sd - Description of the structure to be read. The first element
		is the size of the structure.

    RESULT
	The function returns TRUE on success. On success, the value
	read is written into dataptr. On failure, FALSE is returned and the
	contents of dataptr are not changed.

    NOTES
	This function reads big endian values from a streamhook even on
	little endian machines.

    EXAMPLE
	See below.

    BUGS

    SEE ALSO
	ReadByte(), ReadWord(), ReadLong(), ReadFloat(), ReadDouble(),
	ReadString(), ReadStruct(), WriteByte(), WriteWord(), WriteLong(),
	WriteFloat(), WriteDouble(), WriteString(), WriteStruct()

    HISTORY

******************************************************************************/
{
    struct MinList     _list;
    struct ReadLevel * curr;

#   define list     ((struct List *)&_list)

    NEWLIST(list);

    if (!(curr = AllocMem (sizeof (struct ReadLevel), MEMF_ANY)) )
	return FALSE;

    AddTail (list, (struct Node *)curr);

    curr->sd  = sd;
    curr->pos = 0;
    curr->s   = NULL;

#   define DESC     curr->sd[curr->pos]
#   define IDESC    curr->sd[curr->pos ++]

    for (;;)
    {
	if (!curr->pos)
	{
	    if (!(curr->s = AllocMem (IDESC, MEMF_CLEAR)) )
		goto error;
	}

	if (DESC == SDT_END)
	    break;

	switch (IDESC)
	{
	case SDT_UBYTE:      /* Read one  8bit byte */
	    if (!ReadByte (hook, (UBYTE *)(curr->s + IDESC), stream))
		goto error;

	    break;

	case SDT_UWORD:      /* Read one 16bit word */
	    if (!ReadWord (hook, (UWORD *)(curr->s + IDESC), stream))
		goto error;

	    break;

	case SDT_ULONG:      /* Read one 32bit long */
	    if (!ReadLong (hook, (ULONG *)(curr->s + IDESC), stream))
		goto error;

	    break;

	case SDT_FLOAT:      /* Read one 32bit IEEE */
	    if (!ReadFloat (hook, (FLOAT *)(curr->s + IDESC), stream))
		goto error;

	    break;

	case SDT_DOUBLE:     /* Read one 64bit IEEE */
	    if (!ReadDouble (hook, (DOUBLE *)(curr->s + IDESC), stream))
		goto error;

	    break;

	case SDT_STRING: {   /* Read a string */
	    UBYTE    valid_ptr;
	    STRPTR * sptr;

	    sptr = (STRPTR *)(curr->s + IDESC);

	    if (!ReadByte (hook, &valid_ptr, stream))
		goto error;

	    if (valid_ptr)
	    {
		if (!ReadString (hook, sptr, stream))
		    goto error;
	    }
	    else
	    {
		*sptr = NULL;
	    }

	    break; }

	case SDT_STRUCT: {    /* Read a structure */
	    struct ReadLevel * next;
	    IPTR * desc;
	    APTR   aptr;

	    aptr = (APTR)(curr->s + IDESC);
	    desc = (IPTR *)IDESC;

	    curr->pos -= 3; /* Go back to type */

	    if (!(next = AllocMem (sizeof (struct ReadLevel), MEMF_ANY)) )
		goto error;

	    AddTail (list, (struct Node *)next);
	    next->sd  = desc;
	    next->pos = 1;
	    next->s   = aptr;

	    curr = next;

	    break; }

	case SDT_PTR: {    /* Follow a pointer */
	    struct ReadLevel * next;

	    UBYTE  valid_ptr;
	    IPTR * desc;
	    APTR * aptr;

	    aptr = ((APTR *)(curr->s + IDESC));
	    desc = (IPTR *)IDESC;

	    if (!ReadByte (hook, &valid_ptr, stream))
		goto error;

	    if (valid_ptr)
	    {
		curr->pos -= 3;

		if (!(next = AllocMem (sizeof (struct ReadLevel), MEMF_ANY)) )
		    goto error;

		AddTail (list, (struct Node *)next);
		next->sd  = desc;
		next->pos = 0;

		curr = next;
	    }
	    else
	    {
		*aptr = NULL;
	    }

	    break; }

	case SDT_IGNORE: {   /* Ignore x bytes */
        struct BEIOM_Ignore ig = {BEIO_IGNORE, IDESC};
	    if (CallHookA (hook, stream, &ig) == EOF)
		goto error;

	    break; }

	case SDT_FILL_BYTE: { /* Fill x bytes */
	    IPTR  offset;
	    UBYTE value;
	    IPTR  count;

	    offset = IDESC;
	    value  = IDESC;
	    count  = IDESC;

	    memset (curr->s + offset, value, count);

	    break; }

	case SDT_FILL_LONG: { /* Fill x longs */
	    ULONG * ulptr;
	    ULONG   value;
	    IPTR    count;

	    ulptr = (ULONG *)(curr->s + IDESC);
	    value = IDESC;
	    count = IDESC;

	    while (count --)
		*ulptr ++ = value;

	    break; }

	case SDT_IFILL_BYTE: { /* Fill x bytes */
	    IPTR  offset;
	    UBYTE value;
	    IPTR  count;

	    offset = IDESC;
	    value  = IDESC;
	    count  = IDESC;

        struct BEIOM_Ignore ig = {BEIO_IGNORE, count};

	    if (CallHookA (hook, stream, &ig) == EOF)
		goto error;

	    memset (curr->s + offset, value, count);

	    break; }

	case SDT_IFILL_LONG: { /* Fill x longs */
	    ULONG * ulptr;
	    ULONG   value;
	    IPTR    count;

	    ulptr = (ULONG *)(curr->s + IDESC);
	    value = IDESC;
	    count = IDESC;

        struct BEIOM_Ignore ig = {BEIO_IGNORE, count << 2};

	    if (CallHookA (hook, stream, &ig) == EOF)
		goto error;

	    while (count --)
		*ulptr ++ = value;

	    break; }

	case SDT_SPECIAL: {   /* Call user hook */
	    struct Hook * uhook;
	    struct SDData data;

	    data.sdd_Dest   = ((APTR)(curr->s + IDESC));
	    data.sdd_Mode   = SDV_SPECIALMODE_READ;
	    data.sdd_Stream = stream;

	    uhook = (struct Hook *)IDESC;

	    if (!CallHookA (uhook, hook, &data))
	    	goto error;

	    break; }

	default:
	    goto error;

	} /* switch */

	/* End of the description list ? */
	if (DESC == SDT_END)
	{
	    struct ReadLevel * last;

	    /* Remove the current level */
	    last = curr;
	    Remove ((struct Node *)last);

	    /* Get the last level */
	    if ((curr = (struct ReadLevel *)GetTail (list)))
	    {
		switch (IDESC)
		{
		case SDT_STRUCT:
		    curr->pos += 2; /* Skip 2 parameters */
		    break;

		case SDT_PTR: {
		    APTR * aptr;

		    aptr  = ((APTR *)(curr->s + IDESC));
		    curr->pos ++; /* Skip description parameter */

		    /*
			Now put the result of the current level in the
			struct of the previous level.
		    */
		    *aptr = last->s;

		    break; }

		}

		FreeMem (last, sizeof (struct ReadLevel));
	    }
	    else
	    {
		curr = last;
	    }
	}
    } /* while */

    *dataptr = curr->s;

    FreeMem (curr, sizeof (struct ReadLevel));

    return TRUE;

error:
    curr = (struct ReadLevel *)GetHead (list);

    if (curr && curr->s)
	FreeStruct (curr->s, curr->sd);

    while ((curr = (struct ReadLevel *)RemTail (list)))
	FreeMem (curr, sizeof (struct ReadLevel));

    return FALSE;
} /* ReadStruct */
Пример #24
0
SQInteger SQLexer::Lex()
{
	_lasttokenline = _currentline;
	while(CUR_CHAR != SQUIRREL_EOB) {
		switch(CUR_CHAR){
		case _SC('\t'): case _SC('\r'): case _SC(' '): NEXT(); continue;
		case _SC('\n'):
			_currentline++;
			_prevtoken=_curtoken;
			_curtoken=_SC('\n');
			NEXT();
			_currentcolumn=1;
			continue;
		case _SC('#'): LexLineComment(); continue;
		case _SC('/'):
			NEXT();
			switch(CUR_CHAR){
			case _SC('*'):
				NEXT();
				LexBlockComment();
				continue;	
			case _SC('/'):
				LexLineComment();
				continue;
			case _SC('='):
				NEXT();
				RETURN_TOKEN(TK_DIVEQ);
				continue;
			case _SC('>'):
				NEXT();
				RETURN_TOKEN(TK_ATTR_CLOSE);
				continue;
			default:
				RETURN_TOKEN('/');
			}
		case _SC('='):
			NEXT();
			if (CUR_CHAR != _SC('=')){ RETURN_TOKEN('=') }
			else { NEXT(); RETURN_TOKEN(TK_EQ); }
		case _SC('<'):
			NEXT();
			switch(CUR_CHAR) {
			case _SC('='):
				NEXT(); 
				if(CUR_CHAR == _SC('>')) {
					NEXT();
					RETURN_TOKEN(TK_3WAYSCMP); 
				}
				RETURN_TOKEN(TK_LE) 
				break;
			case _SC('-'): NEXT(); RETURN_TOKEN(TK_NEWSLOT); break;
			case _SC('<'): NEXT(); RETURN_TOKEN(TK_SHIFTL); break;
			case _SC('/'): NEXT(); RETURN_TOKEN(TK_ATTR_OPEN); break;
			}
			RETURN_TOKEN('<');
		case _SC('>'):
			NEXT();
			if (CUR_CHAR == _SC('=')){ NEXT(); RETURN_TOKEN(TK_GE);}
			else if(CUR_CHAR == _SC('>')){ 
				NEXT(); 
				if(CUR_CHAR == _SC('>')){
					NEXT();
					RETURN_TOKEN(TK_USHIFTR);
				}
				RETURN_TOKEN(TK_SHIFTR);
			}
			else { RETURN_TOKEN('>') }
		case _SC('!'):
			NEXT();
			if (CUR_CHAR != _SC('=')){ RETURN_TOKEN('!')}
			else { NEXT(); RETURN_TOKEN(TK_NE); }
		case _SC('@'): {
			SQInteger stype;
			NEXT();
			if(CUR_CHAR != _SC('"')) {
				RETURN_TOKEN('@');
			}
			if((stype=ReadString('"',true))!=-1) {
				RETURN_TOKEN(stype);
			}
			Error(_SC("error parsing the string"));
					   }
		case _SC('"'):
		case _SC('\''): {
			SQInteger stype;
			if((stype=ReadString(CUR_CHAR,false))!=-1){
				RETURN_TOKEN(stype);
			}
			Error(_SC("error parsing the string"));
			}
		case _SC('{'): case _SC('}'): case _SC('('): case _SC(')'): case _SC('['): case _SC(']'):
		case _SC(';'): case _SC(','): case _SC('?'): case _SC('^'): case _SC('~'):
			{SQInteger ret = CUR_CHAR;
			NEXT(); RETURN_TOKEN(ret); }
		case _SC('.'):
			NEXT();
			if (CUR_CHAR != _SC('.')){ RETURN_TOKEN('.') }
			NEXT();
			if (CUR_CHAR != _SC('.')){ Error(_SC("invalid token '..'")); }
			NEXT();
			RETURN_TOKEN(TK_VARPARAMS);
		case _SC('&'):
			NEXT();
			if (CUR_CHAR != _SC('&')){ RETURN_TOKEN('&') }
			else { NEXT(); RETURN_TOKEN(TK_AND); }
		case _SC('|'):
			NEXT();
			if (CUR_CHAR != _SC('|')){ RETURN_TOKEN('|') }
			else { NEXT(); RETURN_TOKEN(TK_OR); }
		case _SC(':'):
			NEXT();
			if (CUR_CHAR != _SC(':')){ RETURN_TOKEN(':') }
			else { NEXT(); RETURN_TOKEN(TK_DOUBLE_COLON); }
		case _SC('*'):
			NEXT();
			if (CUR_CHAR == _SC('=')){ NEXT(); RETURN_TOKEN(TK_MULEQ);}
			else RETURN_TOKEN('*');
		case _SC('%'):
			NEXT();
			if (CUR_CHAR == _SC('=')){ NEXT(); RETURN_TOKEN(TK_MODEQ);}
			else RETURN_TOKEN('%');
		case _SC('-'):
			NEXT();
			if (CUR_CHAR == _SC('=')){ NEXT(); RETURN_TOKEN(TK_MINUSEQ);}
			else if  (CUR_CHAR == _SC('-')){ NEXT(); RETURN_TOKEN(TK_MINUSMINUS);}
			else RETURN_TOKEN('-');
		case _SC('+'):
			NEXT();
			if (CUR_CHAR == _SC('=')){ NEXT(); RETURN_TOKEN(TK_PLUSEQ);}
			else if (CUR_CHAR == _SC('+')){ NEXT(); RETURN_TOKEN(TK_PLUSPLUS);}
			else RETURN_TOKEN('+');
		case SQUIRREL_EOB:
			return 0;
		default:{
				if (scisdigit(CUR_CHAR)) {
					SQInteger ret = ReadNumber();
					RETURN_TOKEN(ret);
				}
				else if (scisalpha(CUR_CHAR) || CUR_CHAR == _SC('_')) {
					SQInteger t = ReadID();
					RETURN_TOKEN(t);
				}
				else {
					SQInteger c = CUR_CHAR;
					if (sciscntrl((int)c)) Error(_SC("unexpected character(control)"));
					NEXT();
					RETURN_TOKEN(c);  
				}
				RETURN_TOKEN(0);
			}
		}
	}
	return 0;    
}
Пример #25
0
static FIBITMAP * DLL_CALLCONV
Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
	char msg[256];
    FIBITMAP *dib = NULL;

    if (!handle) return NULL;

    try {
		char *str;
		
		BOOL header_only = (flags & FIF_LOAD_NOPIXELS) == FIF_LOAD_NOPIXELS;
		
		//find the starting brace
		if( !FindChar(io, handle,'{') )
			throw "Could not find starting brace";

		//read info string
		str = ReadString(io, handle);
		if(!str)
			throw "Error reading info string";

		int width, height, colors, cpp;
		if( sscanf(str, "%d %d %d %d", &width, &height, &colors, &cpp) != 4 ) {
			free(str);
			throw "Improperly formed info string";
		}
		free(str);

        if (colors > 256) {
			dib = FreeImage_AllocateHeader(header_only, width, height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
		} else {
			dib = FreeImage_AllocateHeader(header_only, width, height, 8);
		}

		//build a map of color chars to rgb values
		std::map<std::string,FILE_RGBA> rawpal; //will store index in Alpha if 8bpp
		for(int i = 0; i < colors; i++ ) {
			FILE_RGBA rgba;

			str = ReadString(io, handle);
			if(!str)
				throw "Error reading color strings";

			std::string chrs(str,cpp); //create a string for the color chars using the first cpp chars
			char *keys = str + cpp; //the color keys for these chars start after the first cpp chars

			//translate all the tabs to spaces
			char *tmp = keys;
			while( strchr(tmp,'\t') ) {
				tmp = strchr(tmp,'\t');
				*tmp++ = ' ';
			}

			//prefer the color visual
			if( strstr(keys," c ") ) {
				char *clr = strstr(keys," c ") + 3;
				while( *clr == ' ' ) clr++; //find the start of the hex rgb value
				if( *clr == '#' ) {
					int red = 0, green = 0, blue = 0, n;
					clr++;
					//end string at first space, if any found
					if( strchr(clr,' ') )
						*(strchr(clr,' ')) = '\0';
					//parse hex color, it can be #rgb #rrggbb #rrrgggbbb or #rrrrggggbbbb
					switch( strlen(clr) ) {
						case 3:	n = sscanf(clr,"%01x%01x%01x",&red,&green,&blue);
							red |= (red << 4);
							green |= (green << 4);
							blue |= (blue << 4);
							break;
						case 6:	n = sscanf(clr,"%02x%02x%02x",&red,&green,&blue);
							break;
						case 9:	n = sscanf(clr,"%03x%03x%03x",&red,&green,&blue);
							red >>= 4;
							green >>= 4;
							blue >>= 4;
							break;
						case 12: n = sscanf(clr,"%04x%04x%04x",&red,&green,&blue);
							red >>= 8;
							green >>= 8;
							blue >>= 8;
							break;
						default:
							n = 0;
							break;
					}
					if( n != 3 ) {
						free(str);
						throw "Improperly formed hex color value";
					}
					rgba.r = (BYTE)red;
					rgba.g = (BYTE)green;
					rgba.b = (BYTE)blue;
				} else if( !strncmp(clr,"None",4) || !strncmp(clr,"none",4) ) {
					rgba.r = rgba.g = rgba.b = 0xFF;
				} else {
					char *tmp = clr;

					//scan forward for each space, if its " x " or " xx " end the string there
					//this means its probably some other visual data beyond that point and not
					//part of the color name.  How many named color end with a 1 or 2 character
					//word? Probably none in our list at least.
					while( (tmp = strchr(tmp,' ')) != NULL ) {
						if( tmp[1] != ' ' ) {
							if( (tmp[2] == ' ') || (tmp[2] != ' ' && tmp[3] == ' ') ) {
								tmp[0] = '\0';
								break;
							}
						}
						tmp++;
					}

					//remove any trailing spaces
					tmp = clr+strlen(clr)-1;
					while( *tmp == ' ' ) {
						*tmp = '\0';
						tmp--;
					}

					if (!FreeImage_LookupX11Color(clr,  &rgba.r, &rgba.g, &rgba.b)) {
						sprintf(msg, "Unknown color name '%s'", str);
						free(str);
						throw msg;
					}
				}
			} else {
Пример #26
0
CString CFileDataIO::ReadString(bool bOptUTF8)
{
	UINT uLen = ReadUInt16();
	return ReadString(bOptUTF8, uLen);
}
Пример #27
0
//---------------------------------------------------------------------------
AnsiString TMYIniFile::ReadStringNOCR(char * Section, char * Ident, char * def)
{
  return SpecialReplace(ReadString(Section, Ident, def));
}
void FKismetBytecodeDisassembler::ProcessCommon(int32& ScriptIndex, EExprToken Opcode)
{
	switch (Opcode)
	{
	case EX_PrimitiveCast:
		{
			// A type conversion.
			uint8 ConversionType = ReadBYTE(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: PrimitiveCast of type %d"), *Indents, (int32)Opcode, ConversionType);
			AddIndent();

			Ar.Logf(TEXT("%s Argument:"), *Indents);
			ProcessCastByte(ConversionType, ScriptIndex);

			//@TODO:
			//Ar.Logf(TEXT("%s Expression:"), *Indents);
			//SerializeExpr( ScriptIndex );
			break;
		}
	case EX_ObjToInterfaceCast:
		{
			// A conversion from an object variable to a native interface variable.
			// We use a different bytecode to avoid the branching each time we process a cast token

			// the interface class to convert to
			UClass* InterfaceClass = ReadPointer<UClass>(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: ObjToInterfaceCast to %s"), *Indents, (int32)Opcode, *InterfaceClass->GetName());

			SerializeExpr( ScriptIndex );
			break;
		}
	case EX_CrossInterfaceCast:
		{
			// A conversion from one interface variable to a different interface variable.
			// We use a different bytecode to avoid the branching each time we process a cast token

			// the interface class to convert to
			UClass* InterfaceClass = ReadPointer<UClass>(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: InterfaceToInterfaceCast to %s"), *Indents, (int32)Opcode, *InterfaceClass->GetName());

			SerializeExpr( ScriptIndex );
			break;
		}
	case EX_InterfaceToObjCast:
		{
			// A conversion from an interface variable to a object variable.
			// We use a different bytecode to avoid the branching each time we process a cast token

			// the interface class to convert to
			UClass* ObjectClass = ReadPointer<UClass>(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: InterfaceToObjCast to %s"), *Indents, (int32)Opcode, *ObjectClass->GetName());

			SerializeExpr( ScriptIndex );
			break;
		}
	case EX_Let:
		{
			Ar.Logf(TEXT("%s $%X: Let (Variable = Expression)"), *Indents, (int32)Opcode);
			AddIndent();

			ReadPointer<UProperty>(ScriptIndex);

			// Variable expr.
			Ar.Logf(TEXT("%s Variable:"), *Indents);
			SerializeExpr( ScriptIndex );

			// Assignment expr.
			Ar.Logf(TEXT("%s Expression:"), *Indents);
			SerializeExpr( ScriptIndex );

			DropIndent();
			break;
		}
	case EX_LetObj:
	case EX_LetWeakObjPtr:
		{
			if( Opcode == EX_LetObj )
			{
				Ar.Logf(TEXT("%s $%X: Let Obj (Variable = Expression)"), *Indents, (int32)Opcode);
			}
			else
			{
				Ar.Logf(TEXT("%s $%X: Let WeakObjPtr (Variable = Expression)"), *Indents, (int32)Opcode);
			}
			AddIndent();

			// Variable expr.
			Ar.Logf(TEXT("%s Variable:"), *Indents);
			SerializeExpr( ScriptIndex );

			// Assignment expr.
			Ar.Logf(TEXT("%s Expression:"), *Indents);
			SerializeExpr( ScriptIndex );

			DropIndent();
			break;
		}
	case EX_LetBool:
		{
			Ar.Logf(TEXT("%s $%X: LetBool (Variable = Expression)"), *Indents, (int32)Opcode);
			AddIndent();

			// Variable expr.
			Ar.Logf(TEXT("%s Variable:"), *Indents);
			SerializeExpr( ScriptIndex );

			// Assignment expr.
			Ar.Logf(TEXT("%s Expression:"), *Indents);
			SerializeExpr( ScriptIndex );

			DropIndent();
			break;
		}
	case EX_LetValueOnPersistentFrame:
		{
			Ar.Logf(TEXT("%s $%X: LetValueOnPersistentFrame"), *Indents, (int32)Opcode);
			AddIndent();

			auto Prop = ReadPointer<UProperty>(ScriptIndex);
			Ar.Logf(TEXT("%s Destination variable: %s, offset: %d"), *Indents, *GetNameSafe(Prop), 
				Prop ? Prop->GetOffset_ForDebug() : 0);
			
			Ar.Logf(TEXT("%s Expression:"), *Indents);
			SerializeExpr(ScriptIndex);

			DropIndent();

			break;
		}
	case EX_StructMemberContext:
		{
			Ar.Logf(TEXT("%s $%X: Struct member context "), *Indents, (int32)Opcode);
			AddIndent();

			UProperty* Prop = ReadPointer<UProperty>(ScriptIndex);

			Ar.Logf(TEXT("%s Expression within struct %s, offset %d"), *Indents, *(Prop->GetName()), 
				Prop->GetOffset_ForDebug()); // although that isn't a UFunction, we are not going to indirect the props of a struct, so this should be fine

			Ar.Logf(TEXT("%s Expression to struct:"), *Indents);
			SerializeExpr( ScriptIndex );

			DropIndent();

			break;
		}
	case EX_LetDelegate:
		{
			Ar.Logf(TEXT("%s $%X: LetDelegate (Variable = Expression)"), *Indents, (int32)Opcode);
			AddIndent();

			// Variable expr.
			Ar.Logf(TEXT("%s Variable:"), *Indents);
			SerializeExpr( ScriptIndex );
				
			// Assignment expr.
			Ar.Logf(TEXT("%s Expression:"), *Indents);
			SerializeExpr( ScriptIndex );

			DropIndent();
			break;
		}
	case EX_LetMulticastDelegate:
		{
			Ar.Logf(TEXT("%s $%X: LetMulticastDelegate (Variable = Expression)"), *Indents, (int32)Opcode);
			AddIndent();

			// Variable expr.
			Ar.Logf(TEXT("%s Variable:"), *Indents);
			SerializeExpr( ScriptIndex );
				
			// Assignment expr.
			Ar.Logf(TEXT("%s Expression:"), *Indents);
			SerializeExpr( ScriptIndex );

			DropIndent();
			break;
		}

	case EX_ComputedJump:
		{
			Ar.Logf(TEXT("%s $%X: Computed Jump, offset specified by expression:"), *Indents, (int32)Opcode);

			AddIndent();
			SerializeExpr( ScriptIndex );
			DropIndent();

			break;
		}

	case EX_Jump:
		{
			CodeSkipSizeType SkipCount = ReadSkipCount(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: Jump to offset 0x%X"), *Indents, (int32)Opcode, SkipCount);
			break;
		}
	case EX_LocalVariable:
		{
			UProperty* PropertyPtr = ReadPointer<UProperty>(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: Local variable named %s"), *Indents, (int32)Opcode, PropertyPtr ? *PropertyPtr->GetName() : TEXT("(null)"));
			break;
		}
	case EX_DefaultVariable:
		{
			UProperty* PropertyPtr = ReadPointer<UProperty>(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: Default variable named %s"), *Indents, (int32)Opcode, PropertyPtr ? *PropertyPtr->GetName() : TEXT("(null)"));
			break;
		}
	case EX_InstanceVariable:
		{
			UProperty* PropertyPtr = ReadPointer<UProperty>(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: Instance variable named %s"), *Indents, (int32)Opcode, PropertyPtr ? *PropertyPtr->GetName() : TEXT("(null)"));
			break;
		}
	case EX_LocalOutVariable:
		{
			UProperty* PropertyPtr = ReadPointer<UProperty>(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: Local out variable named %s"), *Indents, (int32)Opcode, PropertyPtr ? *PropertyPtr->GetName() : TEXT("(null)"));
			break;
		}
	case EX_InterfaceContext:
		{
			Ar.Logf(TEXT("%s $%X: EX_InterfaceContext:"), *Indents, (int32)Opcode);
			SerializeExpr(ScriptIndex);
			break;
		}
	case EX_DeprecatedOp4A:
		{
			Ar.Logf(TEXT("%s $%X: This opcode has been removed and does nothing."), *Indents, (int32)Opcode);
			break;
		}
	case EX_Nothing:
		{
			Ar.Logf(TEXT("%s $%X: EX_Nothing"), *Indents, (int32)Opcode);
			break;
		}
	case EX_EndOfScript:
		{
			Ar.Logf(TEXT("%s $%X: EX_EndOfScript"), *Indents, (int32)Opcode);
			break;
		}
	case EX_EndFunctionParms:
		{
			Ar.Logf(TEXT("%s $%X: EX_EndFunctionParms"), *Indents, (int32)Opcode);
			break;
		}
	case EX_EndStructConst:
		{
			Ar.Logf(TEXT("%s $%X: EX_EndStructConst"), *Indents, (int32)Opcode);
			break;
		}
	case EX_EndArray:
		{
			Ar.Logf(TEXT("%s $%X: EX_EndArray"), *Indents, (int32)Opcode);
			break;
		}
	case EX_EndArrayConst:
		{
			Ar.Logf(TEXT("%s $%X: EX_EndArrayConst"), *Indents, (int32)Opcode);
			break;
		}
	case EX_IntZero:
		{
			Ar.Logf(TEXT("%s $%X: EX_IntZero"), *Indents, (int32)Opcode);
			break;
		}
	case EX_IntOne:
		{
			Ar.Logf(TEXT("%s $%X: EX_IntOne"), *Indents, (int32)Opcode);
			break;
		}
	case EX_True:
		{
			Ar.Logf(TEXT("%s $%X: EX_True"), *Indents, (int32)Opcode);
			break;
		}
	case EX_False:
		{
			Ar.Logf(TEXT("%s $%X: EX_False"), *Indents, (int32)Opcode);
			break;
		}
	case EX_NoObject:
		{
			Ar.Logf(TEXT("%s $%X: EX_NoObject"), *Indents, (int32)Opcode);
			break;
		}
	case EX_NoInterface:
		{
			Ar.Logf(TEXT("%s $%X: EX_NoObject"), *Indents, (int32)Opcode);
			break;
		}
	case EX_Self:
		{
			Ar.Logf(TEXT("%s $%X: EX_Self"), *Indents, (int32)Opcode);
			break;
		}
	case EX_EndParmValue:
		{
			Ar.Logf(TEXT("%s $%X: EX_EndParmValue"), *Indents, (int32)Opcode);
			break;
		}
	case EX_Return:
		{
			Ar.Logf(TEXT("%s $%X: Return expression"), *Indents, (int32)Opcode);

			SerializeExpr( ScriptIndex ); // Return expression.
			break;
		}
	case EX_CallMath:
		{
			UStruct* StackNode = ReadPointer<UStruct>(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: Call Math (stack node %s::%s)"), *Indents, (int32)Opcode, *GetNameSafe(StackNode ? StackNode->GetOuter() : nullptr), *GetNameSafe(StackNode));

			while (SerializeExpr(ScriptIndex) != EX_EndFunctionParms)
			{
				// Params
			}
			break;
		}
	case EX_FinalFunction:
		{
			UStruct* StackNode = ReadPointer<UStruct>(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: Final Function (stack node %s::%s)"), *Indents, (int32)Opcode, StackNode ? *StackNode->GetOuter()->GetName() : TEXT("(null)"), StackNode ? *StackNode->GetName() : TEXT("(null)"));

			while (SerializeExpr( ScriptIndex ) != EX_EndFunctionParms)
			{
				// Params
			}
			break;
		}
	case EX_CallMulticastDelegate:
		{
			UStruct* StackNode = ReadPointer<UStruct>(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: CallMulticastDelegate (signature %s::%s) delegate:"), *Indents, (int32)Opcode, StackNode ? *StackNode->GetOuter()->GetName() : TEXT("(null)"), StackNode ? *StackNode->GetName() : TEXT("(null)"));
			SerializeExpr( ScriptIndex );
			Ar.Logf(TEXT("Params:"));
			while (SerializeExpr( ScriptIndex ) != EX_EndFunctionParms)
			{
				// Params
			}
			break;
		}
	case EX_VirtualFunction:
		{
			FString FunctionName = ReadName(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: Virtual Function named %s"), *Indents, (int32)Opcode, *FunctionName);

			while (SerializeExpr(ScriptIndex) != EX_EndFunctionParms)
			{
			}
			break;
		}
	case EX_ClassContext:
	case EX_Context:
	case EX_Context_FailSilent:
		{
			Ar.Logf(TEXT("%s $%X: %s"), *Indents, (int32)Opcode, Opcode == EX_ClassContext ? TEXT("Class Context") : TEXT("Context"));
			AddIndent();

			// Object expression.
			Ar.Logf(TEXT("%s ObjectExpression:"), *Indents);
			SerializeExpr( ScriptIndex );

			if (Opcode == EX_Context_FailSilent)
			{
				Ar.Logf(TEXT(" Can fail silently on access none "));
			}

			// Code offset for NULL expressions.
			CodeSkipSizeType SkipCount = ReadSkipCount(ScriptIndex);
			Ar.Logf(TEXT("%s Skip Bytes: 0x%X"), *Indents, SkipCount);

			// Property corresponding to the r-value data, in case the l-value needs to be mem-zero'd
			UField* Field = ReadPointer<UField>(ScriptIndex);
			Ar.Logf(TEXT("%s R-Value Property: %s"), *Indents, Field ? *Field->GetName() : TEXT("(null)"));

			// Context expression.
			Ar.Logf(TEXT("%s ContextExpression:"), *Indents);
			SerializeExpr( ScriptIndex );

			DropIndent();
			break;
		}
	case EX_IntConst:
		{
			int32 ConstValue = ReadINT(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: literal int32 %d"), *Indents, (int32)Opcode, ConstValue);
			break;
		}
	case EX_SkipOffsetConst:
		{
			CodeSkipSizeType ConstValue = ReadSkipCount(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: literal CodeSkipSizeType 0x%X"), *Indents, (int32)Opcode, ConstValue);
			break;
		}
	case EX_FloatConst:
		{
			float ConstValue = ReadFLOAT(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: literal float %f"), *Indents, (int32)Opcode, ConstValue);
			break;
		}
	case EX_StringConst:
		{
			FString ConstValue = ReadString8(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: literal ansi string \"%s\""), *Indents, (int32)Opcode, *ConstValue);
			break;
		}
	case EX_UnicodeStringConst:
		{
			FString ConstValue = ReadString16(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: literal unicode string \"%s\""), *Indents, (int32)Opcode, *ConstValue);
			break;
		}
	case EX_TextConst:
		{
			// What kind of text are we dealing with?
			const EBlueprintTextLiteralType TextLiteralType = (EBlueprintTextLiteralType)Script[ScriptIndex++];

			switch (TextLiteralType)
			{
			case EBlueprintTextLiteralType::Empty:
				{
					Ar.Logf(TEXT("%s $%X: literal text - empty"), *Indents, (int32)Opcode);
				}
				break;

			case EBlueprintTextLiteralType::LocalizedText:
				{
					const FString SourceString = ReadString(ScriptIndex);
					const FString KeyString = ReadString(ScriptIndex);
					const FString Namespace = ReadString(ScriptIndex);
					Ar.Logf(TEXT("%s $%X: literal text - localized text { namespace: \"%s\", key: \"%s\", source: \"%s\" }"), *Indents, (int32)Opcode, *Namespace, *KeyString, *SourceString);
				}
				break;

			case EBlueprintTextLiteralType::InvariantText:
				{
					const FString SourceString = ReadString(ScriptIndex);
					Ar.Logf(TEXT("%s $%X: literal text - invariant text: \"%s\""), *Indents, (int32)Opcode, *SourceString);
				}
				break;

			case EBlueprintTextLiteralType::LiteralString:
				{
					const FString SourceString = ReadString(ScriptIndex);
					Ar.Logf(TEXT("%s $%X: literal text - literal string: \"%s\""), *Indents, (int32)Opcode, *SourceString);
				}
				break;

			default:
				checkf(false, TEXT("Unknown EBlueprintTextLiteralType! Please update FKismetBytecodeDisassembler::ProcessCommon to handle this type of text."));
				break;
			}
			break;
		}
	case EX_ObjectConst:
		{
			UObject* Pointer = ReadPointer<UObject>(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: EX_ObjectConst (%p:%s)"), *Indents, (int32)Opcode, Pointer, *Pointer->GetFullName());
			break;
		}
	case EX_AssetConst:
		{
			Ar.Logf(TEXT("%s $%X: EX_AssetConst"), *Indents, (int32)Opcode);
			SerializeExpr(ScriptIndex);
			break;
		}
	case EX_NameConst:
		{
			FString ConstValue = ReadName(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: literal name %s"), *Indents, (int32)Opcode, *ConstValue);
			break;
		}
	case EX_RotationConst:
		{
			float Pitch = ReadFLOAT(ScriptIndex);
			float Yaw = ReadFLOAT(ScriptIndex);
			float Roll = ReadFLOAT(ScriptIndex);

			Ar.Logf(TEXT("%s $%X: literal rotation (%f,%f,%f)"), *Indents, (int32)Opcode, Pitch, Yaw, Roll);
			break;
		}
	case EX_VectorConst:
		{
			float X = ReadFLOAT(ScriptIndex);
			float Y = ReadFLOAT(ScriptIndex);
			float Z = ReadFLOAT(ScriptIndex);

			Ar.Logf(TEXT("%s $%X: literal vector (%f,%f,%f)"), *Indents, (int32)Opcode, X, Y, Z);
			break;
		}
	case EX_TransformConst:
		{

			float RotX = ReadFLOAT(ScriptIndex);
			float RotY = ReadFLOAT(ScriptIndex);
			float RotZ = ReadFLOAT(ScriptIndex);
			float RotW = ReadFLOAT(ScriptIndex);

			float TransX = ReadFLOAT(ScriptIndex);
			float TransY = ReadFLOAT(ScriptIndex);
			float TransZ = ReadFLOAT(ScriptIndex);

			float ScaleX = ReadFLOAT(ScriptIndex);
			float ScaleY = ReadFLOAT(ScriptIndex);
			float ScaleZ = ReadFLOAT(ScriptIndex);

			Ar.Logf(TEXT("%s $%X: literal transform R(%f,%f,%f,%f) T(%f,%f,%f) S(%f,%f,%f)"), *Indents, (int32)Opcode, TransX, TransY, TransZ, RotX, RotY, RotZ, RotW, ScaleX, ScaleY, ScaleZ);
			break;
		}
	case EX_StructConst:
		{
			UScriptStruct* Struct = ReadPointer<UScriptStruct>(ScriptIndex);
			int32 SerializedSize = ReadINT(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: literal struct %s (serialized size: %d)"), *Indents, (int32)Opcode, *Struct->GetName(), SerializedSize);
			while( SerializeExpr(ScriptIndex) != EX_EndStructConst )
			{
				// struct contents
			}
			break;
		}
	case EX_SetArray:
		{
 			Ar.Logf(TEXT("%s $%X: set array"), *Indents, (int32)Opcode);
			SerializeExpr(ScriptIndex);
 			while( SerializeExpr(ScriptIndex) != EX_EndArray)
 			{
 				// Array contents
 			}
 			break;
		}
	case EX_ArrayConst:
		{
			UProperty* InnerProp = ReadPointer<UProperty>(ScriptIndex);
			int32 Num = ReadINT(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: set array const - elements number: %d, inner property: %s"), *Indents, (int32)Opcode, Num, *GetNameSafe(InnerProp));
			while (SerializeExpr(ScriptIndex) != EX_EndArrayConst)
			{
				// Array contents
			}
			break;
		}
	case EX_ByteConst:
		{
			uint8 ConstValue = ReadBYTE(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: literal byte %d"), *Indents, (int32)Opcode, ConstValue);
			break;
		}
	case EX_IntConstByte:
		{
			int32 ConstValue = ReadBYTE(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: literal int %d"), *Indents, (int32)Opcode, ConstValue);
			break;
		}
	case EX_MetaCast:
		{
			UClass* Class = ReadPointer<UClass>(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: MetaCast to %s of expr:"), *Indents, (int32)Opcode, *Class->GetName());
			SerializeExpr( ScriptIndex );
			break;
		}
	case EX_DynamicCast:
		{
			UClass* Class = ReadPointer<UClass>(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: DynamicCast to %s of expr:"), *Indents, (int32)Opcode, *Class->GetName());
			SerializeExpr( ScriptIndex );
			break;
		}
	case EX_JumpIfNot:
		{
			// Code offset.
			CodeSkipSizeType SkipCount = ReadSkipCount(ScriptIndex);
				
			Ar.Logf(TEXT("%s $%X: Jump to offset 0x%X if not expr:"), *Indents, (int32)Opcode, SkipCount);

			// Boolean expr.
			SerializeExpr( ScriptIndex );
			break;
		}
	case EX_Assert:
		{
			uint16 LineNumber = ReadWORD(ScriptIndex);
			uint8 InDebugMode = ReadBYTE(ScriptIndex);

			Ar.Logf(TEXT("%s $%X: assert at line %d, in debug mode = %d with expr:"), *Indents, (int32)Opcode, LineNumber, InDebugMode);
			SerializeExpr( ScriptIndex ); // Assert expr.
			break;
		}
	case EX_Skip:
		{
			CodeSkipSizeType W = ReadSkipCount(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: possibly skip 0x%X bytes of expr:"), *Indents, (int32)Opcode, W);

			// Expression to possibly skip.
			SerializeExpr( ScriptIndex );

			break;
		}
	case EX_InstanceDelegate:
		{
			// the name of the function assigned to the delegate.
			FString FuncName = ReadName(ScriptIndex);

			Ar.Logf(TEXT("%s $%X: instance delegate function named %s"), *Indents, (int32)Opcode, *FuncName);
			break;
		}
	case EX_AddMulticastDelegate:
		{
			Ar.Logf(TEXT("%s $%X: Add MC delegate"), *Indents, (int32)Opcode);
			SerializeExpr( ScriptIndex );
			SerializeExpr( ScriptIndex );
			break;
		}
	case EX_RemoveMulticastDelegate:
		{
			Ar.Logf(TEXT("%s $%X: Remove MC delegate"), *Indents, (int32)Opcode);
			SerializeExpr( ScriptIndex );
			SerializeExpr( ScriptIndex );
			break;
		}
	case EX_ClearMulticastDelegate:
		{
			Ar.Logf(TEXT("%s $%X: Clear MC delegate"), *Indents, (int32)Opcode);
			SerializeExpr( ScriptIndex );
			break;
		}
	case EX_BindDelegate:
		{
			// the name of the function assigned to the delegate.
			FString FuncName = ReadName(ScriptIndex);

			Ar.Logf(TEXT("%s $%X: BindDelegate '%s' "), *Indents, (int32)Opcode, *FuncName);

			Ar.Logf(TEXT("%s Delegate:"), *Indents);
			SerializeExpr( ScriptIndex );

			Ar.Logf(TEXT("%s Object:"), *Indents);
			SerializeExpr( ScriptIndex );

			break;
		}
	case EX_PushExecutionFlow:
		{
			CodeSkipSizeType SkipCount = ReadSkipCount(ScriptIndex);
			Ar.Logf(TEXT("%s $%X: FlowStack.Push(0x%X);"), *Indents, (int32)Opcode, SkipCount);
			break;
		}
	case EX_PopExecutionFlow:
		{
			Ar.Logf(TEXT("%s $%X: if (FlowStack.Num()) { jump to statement at FlowStack.Pop(); } else { ERROR!!! }"), *Indents, (int32)Opcode);
			break;
		}
	case EX_PopExecutionFlowIfNot:
		{
			Ar.Logf(TEXT("%s $%X: if (!condition) { if (FlowStack.Num()) { jump to statement at FlowStack.Pop(); } else { ERROR!!! } }"), *Indents, (int32)Opcode);
			// Boolean expr.
			SerializeExpr( ScriptIndex );
			break;
		}
	case EX_Breakpoint:
		{
			Ar.Logf(TEXT("%s $%X: <<< BREAKPOINT >>>"), *Indents, (int32)Opcode);
			break;
		}
	case EX_WireTracepoint:
		{
			Ar.Logf(TEXT("%s $%X: .. wire debug site .."), *Indents, (int32)Opcode);
			break;
		}
	case EX_InstrumentationEvent:
		{
			const uint8 EventType = ReadBYTE(ScriptIndex);
			switch (EventType)
			{
				case EScriptInstrumentation::InlineEvent:
					Ar.Logf(TEXT("%s $%X: .. instrumented inline event .."), *Indents, (int32)Opcode);
					break;
				case EScriptInstrumentation::Stop:
					Ar.Logf(TEXT("%s $%X: .. instrumented event stop .."), *Indents, (int32)Opcode);
					break;
				case EScriptInstrumentation::PureNodeEntry:
					Ar.Logf(TEXT("%s $%X: .. instrumented pure node entry site .."), *Indents, (int32)Opcode);
					break;
				case EScriptInstrumentation::NodeDebugSite:
					Ar.Logf(TEXT("%s $%X: .. instrumented debug site .."), *Indents, (int32)Opcode);
					break;
				case EScriptInstrumentation::NodeEntry:
					Ar.Logf(TEXT("%s $%X: .. instrumented wire entry site .."), *Indents, (int32)Opcode);
					break;
				case EScriptInstrumentation::NodeExit:
					Ar.Logf(TEXT("%s $%X: .. instrumented wire exit site .."), *Indents, (int32)Opcode);
					break;
				case EScriptInstrumentation::PushState:
					Ar.Logf(TEXT("%s $%X: .. push execution state .."), *Indents, (int32)Opcode);
					break;
				case EScriptInstrumentation::RestoreState:
					Ar.Logf(TEXT("%s $%X: .. restore execution state .."), *Indents, (int32)Opcode);
					break;
				case EScriptInstrumentation::ResetState:
					Ar.Logf(TEXT("%s $%X: .. reset execution state .."), *Indents, (int32)Opcode);
					break;
				case EScriptInstrumentation::SuspendState:
					Ar.Logf(TEXT("%s $%X: .. suspend execution state .."), *Indents, (int32)Opcode);
					break;
				case EScriptInstrumentation::PopState:
					Ar.Logf(TEXT("%s $%X: .. pop execution state .."), *Indents, (int32)Opcode);
					break;
				case EScriptInstrumentation::TunnelEndOfThread:
					Ar.Logf(TEXT("%s $%X: .. tunnel end of thread .."), *Indents, (int32)Opcode);
					break;
			}
			break;
		}
	case EX_Tracepoint:
		{
			Ar.Logf(TEXT("%s $%X: .. debug site .."), *Indents, (int32)Opcode);
			break;
		}
	case EX_SwitchValue:
		{
			const auto NumCases = ReadWORD(ScriptIndex);
			const auto AfterSkip = ReadSkipCount(ScriptIndex);

			Ar.Logf(TEXT("%s $%X: Switch Value %d cases, end in 0x%X"), *Indents, (int32)Opcode, NumCases, AfterSkip);
			AddIndent();
			Ar.Logf(TEXT("%s Index:"), *Indents);
			SerializeExpr(ScriptIndex);

			for (uint16 CaseIndex = 0; CaseIndex < NumCases; ++CaseIndex)
			{
				Ar.Logf(TEXT("%s [%d] Case Index (label: 0x%X):"), *Indents, CaseIndex, ScriptIndex);
				SerializeExpr(ScriptIndex);	// case index value term
				const auto OffsetToNextCase = ReadSkipCount(ScriptIndex);
				Ar.Logf(TEXT("%s [%d] Offset to the next case: 0x%X"), *Indents, CaseIndex, OffsetToNextCase);
				Ar.Logf(TEXT("%s [%d] Case Result:"), *Indents, CaseIndex);
				SerializeExpr(ScriptIndex);	// case term
			}

			Ar.Logf(TEXT("%s Default result (label: 0x%X):"), *Indents, ScriptIndex);
			SerializeExpr(ScriptIndex);
			Ar.Logf(TEXT("%s (label: 0x%X)"), *Indents, ScriptIndex);
			DropIndent();
			break;
		}
	case EX_ArrayGetByRef:
		{
			Ar.Logf(TEXT("%s $%X: Array Get-by-Ref Index"), *Indents, (int32)Opcode);
			AddIndent();
			SerializeExpr(ScriptIndex);
			SerializeExpr(ScriptIndex);
			DropIndent();
			break;
		}
	default:
		{
			// This should never occur.
			UE_LOG(LogScriptDisassembler, Warning, TEXT("Unknown bytecode 0x%02X; ignoring it"), (uint8)Opcode );
			break;
		}
	}
}
Пример #29
0
//---------------------------------------------------------------------------
bool TMYIniFile::ReadBool(String Section, String Ident, bool def)
{
  AnsiString s(def?"1":"0");
  AnsiString result = ReadString(Section, Ident, s.c_str());
  return (bool)atoi(result.c_str());
}
Пример #30
0
double TIniFile::ReadDouble(const wxString &Section, const wxString &Ident,
  double Default)
{
	return StrToDouble(ReadString(Section, Ident, DoubleToStr(Default)));
}