#endif␊ |
␊ |
string_ref *ref_strings = NULL;␊ |
string_ref *ref_integer = NULL;␊ |
␊ |
/// TODO: remove below␊ |
static char *buffer_start = NULL;␊ |
|
␉ref_strings = new_ref;␊ |
}␊ |
␊ |
void SaveRefInteger(int integer, int id)␊ |
{␊ |
␉//printf("Adding Ref Integer %d (%s)\n", id, integer);␊ |
␉string_ref *tmp = ref_integer;␊ |
␉while(tmp)␊ |
␉{␊ |
␉␉if(tmp->id == id)␊ |
␉␉{␊ |
␉␉␉tmp->string = (char*)integer;␊ |
␉␉␉return;␊ |
␉␉}␊ |
␉␉tmp = tmp->next;␊ |
␉}␊ |
␊ |
␉string_ref *new_ref = malloc(sizeof(string_ref));␊ |
␉new_ref->string = (char*)integer;␊ |
␉new_ref->id = id;␊ |
␉new_ref->next = ref_integer;␊ |
␉ref_integer = new_ref;␊ |
}␊ |
␊ |
char *GetRefString(int id)␊ |
{␊ |
␉string_ref *tmp = ref_strings;␊ |
|
␉return "Unknown";␊ |
}␊ |
␊ |
int GetRefInteger(int id)␊ |
{␊ |
␉string_ref *tmp = ref_integer;␊ |
␉while(tmp)␊ |
␉{␊ |
␉␉if(tmp->id == id) return (int)tmp->string;␊ |
␉␉tmp = tmp->next;␊ |
␉}␊ |
␉//verbose("Unable to locate Ref String %d\n", id);␊ |
␉return 0;␊ |
}␊ |
␊ |
struct Module {␊ |
␉struct Module *nextModule;␊ |
␉long␉␉willLoad;␊ |
|
static void FreeSymbol(char *string);␊ |
#endif␊ |
␊ |
␊ |
//==========================================================================␊ |
// XMLGetProperty␊ |
␊ |
TagPtr XMLGetProperty(TagPtr dict, const char *key)␊ |
{␊ |
␉TagPtr tagList, tag;␊ |
|
␊ |
//==========================================================================␊ |
// XMLGetProperty␊ |
␊ |
TagPtr XMLGetKey( TagPtr dict, int id )␊ |
{␊ |
␉TagPtr tagList, tag;␊ |
|
␉␉␉}␊ |
␉␉␉length = ParseTagInteger(buffer + pos, tag);␊ |
␊ |
␉␉␉SaveRefString((*tag)->string, id);␊ |
␉␉␉SaveRefInteger((int)(*tag)->string, id);␊ |
␉␉}␊ |
␉␉else if(!strncmp(tagName + strlen(kXMLTagInteger " "), kXMLStringIDRef, strlen(kXMLStringIDRef)))␊ |
␉␉{␊ |
|
␉␉␉␉␉return -1;␊ |
␉␉␉␉}␊ |
␉␉␉}␊ |
␉␉␉int integer = (int)GetRefString(id);␊ |
␉␉␉int integer = GetRefInteger(id);␊ |
␊ |
␉␉␉TagPtr tmpTag = NewTag();␊ |
␉␉␉if (tmpTag == 0)␊ |
|
␊ |
//==========================================================================␊ |
// ParseTagList␊ |
␊ |
static long ParseTagList( char *buffer, TagPtr *tag, long type, long empty )␊ |
{␊ |
␉long␉␉pos = 0;␊ |
|
␊ |
//==========================================================================␊ |
// ParseTagKey␊ |
␊ |
static long ParseTagKey( char *buffer, TagPtr *tag )␊ |
{␊ |
␉long␉␉length = 0;␊ |
|
␊ |
//==========================================================================␊ |
// ParseTagString␊ |
␊ |
static long ParseTagString( char *buffer, TagPtr *tag )␊ |
{␊ |
␉long␉␉length = 0;␊ |
|
␊ |
//==========================================================================␊ |
// ParseTagInteger␊ |
␊ |
static long ParseTagInteger( char *buffer, TagPtr *tag )␊ |
{␊ |
␉long length, integer;␊ |
|
␊ |
//==========================================================================␊ |
// ParseTagData␊ |
␊ |
static long ParseTagData( char *buffer, TagPtr *tag )␊ |
{␊ |
␉int␉␉actuallen = 0;␊ |
|
␊ |
//==========================================================================␊ |
// ParseTagDate␊ |
␊ |
static long ParseTagDate( char *buffer, TagPtr *tag )␊ |
{␊ |
␉long␉␉length = 0;␊ |
|
␊ |
//==========================================================================␊ |
// ParseTagBoolean␊ |
␊ |
long ParseTagBoolean( char *buffer, TagPtr *tag, long type )␊ |
{␊ |
␉TagPtr tmpTag;␊ |
|
␊ |
//==========================================================================␊ |
// GetNextTag␊ |
␊ |
static long GetNextTag( char *buffer, char **tag, long *start )␊ |
{␊ |
␉long␉cnt;␊ |
|
// Modifies 'buffer' to add a '\0' at the end of the tag matching 'tag'.␊ |
// Returns the length of the data found, counting the end tag,␊ |
// or -1 if the end tag was not found.␊ |
␊ |
static long FixDataMatchingTag( char *buffer, char *tag )␊ |
{␊ |
␉long␉length;␊ |
|
␊ |
//==========================================================================␊ |
// NewTag␊ |
␊ |
#define kTagsPerBlock (0x1000)␊ |
␊ |
static TagPtr gTagsFree␉= NULL;␊ |
|
␊ |
//==========================================================================␊ |
// XMLFreeTag␊ |
␊ |
void XMLFreeTag( TagPtr tag )␊ |
{␊ |
#if DOFREE␊ |
|
␊ |
//==========================================================================␊ |
// Symbol object.␊ |
␊ |
struct Symbol␊ |
{␊ |
␉long refCount;␊ |
|
␊ |
//==========================================================================␊ |
// NewSymbol␊ |
␊ |
static char *NewSymbol( char *string )␊ |
{␊ |
␉static SymbolPtr lastGuy = 0;␊ |
|
␊ |
//==========================================================================␊ |
// FreeSymbol␊ |
␊ |
#if DOFREE␊ |
static void FreeSymbol( char *string )␊ |
{␊ |
|
␊ |
//==========================================================================␊ |
// FindSymbol␊ |
␊ |
static SymbolPtr FindSymbol( char *string, SymbolPtr *prevSymbol )␊ |
{␊ |
␉SymbolPtr symbol, prev;␊ |