Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

l_precomp.c File Reference

Go to the source code of this file.

Data Structures

struct  directive_s
struct  operator_s
struct  value_s

Defines

#define AllocOperator(op)
#define AllocValue(val)
#define DEFINEHASHING   1
#define DEFINEHASHSIZE   1024
#define FreeOperator(op)
#define FreeValue(val)
#define MAX_DEFINEPARMS   128
#define MAX_OPERATORS   64
#define MAX_SOURCEFILES   64
#define MAX_VALUES   64
#define TOKEN_HEAP_SIZE   4096

Typedefs

typedef directive_s directive_t
typedef operator_s operator_t
typedef value_s value_t

Functions

void FreeSource (source_t *source)
source_tLoadSourceFile (const char *filename)
source_tLoadSourceMemory (char *ptr, int length, char *name)
void PC_AddBuiltinDefines (source_t *source)
int PC_AddDefine (source_t *source, char *string)
void PC_AddDefineToHash (define_t *define, define_t **definehash)
int PC_AddGlobalDefine (char *string)
void PC_AddGlobalDefinesToSource (source_t *source)
void PC_CheckOpenSourceHandles (void)
int PC_CheckTokenString (source_t *source, char *string)
int PC_CheckTokenType (source_t *source, int type, int subtype, token_t *token)
void PC_ClearTokenWhiteSpace (token_t *token)
void PC_ConvertPath (char *path)
define_tPC_CopyDefine (source_t *source, define_t *define)
token_tPC_CopyToken (token_t *token)
define_tPC_DefineFromString (char *string)
int PC_Directive_define (source_t *source)
int PC_Directive_elif (source_t *source)
int PC_Directive_else (source_t *source)
int PC_Directive_endif (source_t *source)
int PC_Directive_error (source_t *source)
int PC_Directive_eval (source_t *source)
int PC_Directive_evalfloat (source_t *source)
int PC_Directive_if (source_t *source)
int PC_Directive_if_def (source_t *source, int type)
int PC_Directive_ifdef (source_t *source)
int PC_Directive_ifndef (source_t *source)
int PC_Directive_include (source_t *source)
int PC_Directive_line (source_t *source)
int PC_Directive_pragma (source_t *source)
int PC_Directive_undef (source_t *source)
int PC_DollarDirective_evalfloat (source_t *source)
int PC_DollarDirective_evalint (source_t *source)
int PC_DollarEvaluate (source_t *source, signed long int *intvalue, double *floatvalue, int integer)
int PC_Evaluate (source_t *source, signed long int *intvalue, double *floatvalue, int integer)
int PC_EvaluateTokens (source_t *source, token_t *tokens, signed long int *intvalue, double *floatvalue, int integer)
int PC_ExpandBuiltinDefine (source_t *source, token_t *deftoken, define_t *define, token_t **firsttoken, token_t **lasttoken)
int PC_ExpandDefine (source_t *source, token_t *deftoken, define_t *define, token_t **firsttoken, token_t **lasttoken)
int PC_ExpandDefineIntoSource (source_t *source, token_t *deftoken, define_t *define)
int PC_ExpectAnyToken (source_t *source, token_t *token)
int PC_ExpectTokenString (source_t *source, char *string)
int PC_ExpectTokenType (source_t *source, int type, int subtype, token_t *token)
define_tPC_FindDefine (define_t *defines, char *name)
int PC_FindDefineParm (define_t *define, char *name)
define_tPC_FindHashedDefine (define_t **definehash, char *name)
void PC_FreeDefine (define_t *define)
int PC_FreeSourceHandle (int handle)
void PC_FreeToken (token_t *token)
void PC_InitTokenHeap (void)
int PC_LoadSourceHandle (const char *filename)
int PC_MergeTokens (token_t *t1, token_t *t2)
int PC_NameHash (char *name)
int PC_OperatorPriority (int op)
void PC_PopIndent (source_t *source, int *type, int *skip)
void PC_PrintDefineHashTable (define_t **definehash)
void PC_PushIndent (source_t *source, int type, int skip)
void PC_PushScript (source_t *source, script_t *script)
int PC_ReadDefineParms (source_t *source, define_t *define, token_t **parms, int maxparms)
int PC_ReadDirective (source_t *source)
int PC_ReadDollarDirective (source_t *source)
int PC_ReadLine (source_t *source, token_t *token)
int PC_ReadSourceToken (source_t *source, token_t *token)
int PC_ReadToken (source_t *source, token_t *token)
int PC_ReadTokenHandle (int handle, pc_token_t *pc_token)
void PC_RemoveAllGlobalDefines (void)
int PC_RemoveGlobalDefine (char *name)
void PC_SetBaseFolder (char *path)
void PC_SetIncludePath (source_t *source, char *path)
void PC_SetPunctuations (source_t *source, punctuation_t *p)
int PC_SkipUntilString (source_t *source, char *string)
int PC_SourceFileAndLine (int handle, char *filename, int *line)
int PC_StringizeTokens (token_t *tokens, token_t *token)
void PC_UnreadLastToken (source_t *source)
int PC_UnreadSourceToken (source_t *source, token_t *token)
void PC_UnreadToken (source_t *source, token_t *token)
int PC_WhiteSpaceBeforeToken (token_t *token)
void QDECL SourceError (source_t *source, char *str,...)
void QDECL SourceWarning (source_t *source, char *str,...)
void UnreadSignToken (source_t *source)

Variables

directive_t directives [20]
directive_t dollardirectives [20]
define_tglobaldefines
int numtokens
source_tsourceFiles [MAX_SOURCEFILES]


Define Documentation

#define AllocOperator op   ) 
 

Value:

if (numoperators >= MAX_OPERATORS) {                \
        SourceError(source, "out of operator space\n"); \
        error = 1;                                      \
        break;                                          \
    }                                                   \
    else                                                \
        op = &operator_heap[numoperators++];

Definition at line 1675 of file l_precomp.c.

Referenced by PC_EvaluateTokens().

#define AllocValue val   ) 
 

Value:

if (numvalues >= MAX_VALUES) {                      \
        SourceError(source, "out of value space\n");        \
        error = 1;                                      \
        break;                                          \
    }                                                   \
    else                                                \
        val = &value_heap[numvalues++];

Definition at line 1665 of file l_precomp.c.

Referenced by PC_EvaluateTokens().

#define DEFINEHASHING   1
 

Definition at line 99 of file l_precomp.c.

#define DEFINEHASHSIZE   1024
 

Definition at line 108 of file l_precomp.c.

Referenced by LoadSourceFile(), LoadSourceMemory(), PC_DefineFromString(), and PC_NameHash().

#define FreeOperator op   ) 
 

Definition at line 1683 of file l_precomp.c.

Referenced by PC_EvaluateTokens().

#define FreeValue val   ) 
 

Definition at line 1673 of file l_precomp.c.

Referenced by PC_EvaluateTokens().

#define MAX_DEFINEPARMS   128
 

Definition at line 97 of file l_precomp.c.

Referenced by PC_ExpandDefine().

#define MAX_OPERATORS   64
 

Definition at line 1664 of file l_precomp.c.

#define MAX_SOURCEFILES   64
 

Definition at line 3112 of file l_precomp.c.

#define MAX_VALUES   64
 

Definition at line 1663 of file l_precomp.c.

#define TOKEN_HEAP_SIZE   4096
 

Definition at line 110 of file l_precomp.c.


Typedef Documentation

typedef struct directive_s directive_t
 

typedef struct operator_s operator_t
 

Referenced by PC_EvaluateTokens().

typedef struct value_s value_t
 

Referenced by PC_EvaluateTokens().


Function Documentation

void FreeSource source_t source  ) 
 

Definition at line 3049 of file l_precomp.c.

References define_t, source_s::definehash, source_s::defines, FreeMemory(), FreeScript(), define_s::hashnext, i, indent_t, source_s::indentstack, token_s::next, define_s::next, indent_s::next, PC_FreeDefine(), PC_FreeToken(), script, source_s::scriptstack, source, source_t, token, token_t, and source_s::tokens.

Referenced by BotLoadCharacterFromFile(), BotLoadInitialChat(), BotLoadMatchPieces(), BotLoadMatchTemplates(), BotLoadRandomStrings(), BotLoadReplyChat(), BotLoadSynonyms(), LoadCfgFile(), LoadItemConfig(), LoadWeaponConfig(), PC_FreeSourceHandle(), and ReadWeightConfig().

03050 {
03051     script_t *script;
03052     token_t *token;
03053     define_t *define;
03054     indent_t *indent;
03055     int i;
03056 
03057     //PC_PrintDefineHashTable(source->definehash);
03058     //free all the scripts
03059     while(source->scriptstack)
03060     {
03061         script = source->scriptstack;
03062         source->scriptstack = source->scriptstack->next;
03063         FreeScript(script);
03064     } //end for
03065     //free all the tokens
03066     while(source->tokens)
03067     {
03068         token = source->tokens;
03069         source->tokens = source->tokens->next;
03070         PC_FreeToken(token);
03071     } //end for
03072 #if DEFINEHASHING
03073     for (i = 0; i < DEFINEHASHSIZE; i++)
03074     {
03075         while(source->definehash[i])
03076         {
03077             define = source->definehash[i];
03078             source->definehash[i] = source->definehash[i]->hashnext;
03079             PC_FreeDefine(define);
03080         } //end while
03081     } //end for
03082 #else //DEFINEHASHING
03083     //free all defines
03084     while(source->defines)
03085     {
03086         define = source->defines;
03087         source->defines = source->defines->next;
03088         PC_FreeDefine(define);
03089     } //end for
03090 #endif //DEFINEHASHING
03091     //free all indents
03092     while(source->indentstack)
03093     {
03094         indent = source->indentstack;
03095         source->indentstack = source->indentstack->next;
03096         FreeMemory(indent);
03097     } //end for
03098 #if DEFINEHASHING
03099     //
03100     if (source->definehash) FreeMemory(source->definehash);
03101 #endif //DEFINEHASHING
03102     //free the source itself
03103     FreeMemory(source);
03104 } //end of the function FreeSource

Here is the call graph for this function:

source_t* LoadSourceFile const char *  filename  ) 
 

Definition at line 2982 of file l_precomp.c.

References Com_Memset(), define_t, source_s::definehash, DEFINEHASHSIZE, source_s::defines, source_s::filename, GetClearedMemory(), GetMemory(), source_s::indentstack, LoadScriptFile(), MAX_PATH, PC_AddGlobalDefinesToSource(), PC_InitTokenHeap(), script, source_s::scriptstack, source_s::skip, source, source_t, strncpy(), and source_s::tokens.

02983 {
02984     source_t *source;
02985     script_t *script;
02986 
02987     PC_InitTokenHeap();
02988 
02989     script = LoadScriptFile(filename);
02990     if (!script) return NULL;
02991 
02992     script->next = NULL;
02993 
02994     source = (source_t *) GetMemory(sizeof(source_t));
02995     Com_Memset(source, 0, sizeof(source_t));
02996 
02997     strncpy(source->filename, filename, MAX_PATH);
02998     source->scriptstack = script;
02999     source->tokens = NULL;
03000     source->defines = NULL;
03001     source->indentstack = NULL;
03002     source->skip = 0;
03003 
03004 #if DEFINEHASHING
03005     source->definehash = GetClearedMemory(DEFINEHASHSIZE * sizeof(define_t *));
03006 #endif //DEFINEHASHING
03007     PC_AddGlobalDefinesToSource(source);
03008     return source;
03009 } //end of the function LoadSourceFile

Here is the call graph for this function:

source_t* LoadSourceMemory char *  ptr,
int  length,
char *  name
 

Definition at line 3016 of file l_precomp.c.

References Com_Memset(), define_t, source_s::definehash, DEFINEHASHSIZE, source_s::defines, source_s::filename, GetClearedMemory(), GetMemory(), source_s::indentstack, length(), LoadScriptMemory(), MAX_PATH, name, PC_AddGlobalDefinesToSource(), PC_InitTokenHeap(), ptr(), script, source_s::scriptstack, source_s::skip, source, source_t, strncpy(), and source_s::tokens.

03017 {
03018     source_t *source;
03019     script_t *script;
03020 
03021     PC_InitTokenHeap();
03022 
03023     script = LoadScriptMemory(ptr, length, name);
03024     if (!script) return NULL;
03025     script->next = NULL;
03026 
03027     source = (source_t *) GetMemory(sizeof(source_t));
03028     Com_Memset(source, 0, sizeof(source_t));
03029 
03030     strncpy(source->filename, name, MAX_PATH);
03031     source->scriptstack = script;
03032     source->tokens = NULL;
03033     source->defines = NULL;
03034     source->indentstack = NULL;
03035     source->skip = 0;
03036 
03037 #if DEFINEHASHING
03038     source->definehash = GetClearedMemory(DEFINEHASHSIZE * sizeof(define_t *));
03039 #endif //DEFINEHASHING
03040     PC_AddGlobalDefinesToSource(source);
03041     return source;
03042 } //end of the function LoadSourceMemory

Here is the call graph for this function:

void PC_AddBuiltinDefines source_t source  ) 
 

Definition at line 664 of file l_precomp.c.

References builtin(), define_s::builtin, BUILTIN_DATE, BUILTIN_FILE, BUILTIN_LINE, BUILTIN_TIME, Com_Memset(), define_t, source_s::definehash, source_s::defines, define_s::flags, GetMemory(), i, define_s::name, define_s::next, PC_AddDefineToHash(), source, source_t, strcpy(), and strlen().

00665 {
00666     int i;
00667     define_t *define;
00668     struct builtin
00669     {
00670         char *string;
00671         int builtin;
00672     } builtin[] = { // bk001204 - brackets
00673         { "__LINE__",   BUILTIN_LINE },
00674         { "__FILE__",   BUILTIN_FILE },
00675         { "__DATE__",   BUILTIN_DATE },
00676         { "__TIME__",   BUILTIN_TIME },
00677 //      { "__STDC__", BUILTIN_STDC },
00678         { NULL, 0 }
00679     };
00680 
00681     for (i = 0; builtin[i].string; i++)
00682     {
00683         define = (define_t *) GetMemory(sizeof(define_t) + strlen(builtin[i].string) + 1);
00684         Com_Memset(define, 0, sizeof(define_t));
00685         define->name = (char *) define + sizeof(define_t);
00686         strcpy(define->name, builtin[i].string);
00687         define->flags |= DEFINE_FIXED;
00688         define->builtin = builtin[i].builtin;
00689         //add the define to the source
00690 #if DEFINEHASHING
00691         PC_AddDefineToHash(define, source->definehash);
00692 #else
00693         define->next = source->defines;
00694         source->defines = define;
00695 #endif //DEFINEHASHING
00696     } //end for
00697 } //end of the function PC_AddBuiltinDefines

Here is the call graph for this function:

int PC_AddDefine source_t source,
char *  string
 

Definition at line 1376 of file l_precomp.c.

References define_t, source_s::definehash, source_s::defines, define_s::next, PC_AddDefineToHash(), PC_DefineFromString(), source, source_t, and string().

01377 {
01378     define_t *define;
01379 
01380     define = PC_DefineFromString(string);
01381     if (!define) return qfalse;
01382 #if DEFINEHASHING
01383     PC_AddDefineToHash(define, source->definehash);
01384 #else //DEFINEHASHING
01385     define->next = source->defines;
01386     source->defines = define;
01387 #endif //DEFINEHASHING
01388     return qtrue;
01389 } //end of the function PC_AddDefine

Here is the call graph for this function:

void PC_AddDefineToHash define_t define,
define_t **  definehash
 

Definition at line 570 of file l_precomp.c.

References define_t, define_s::hashnext, define_s::name, and PC_NameHash().

Referenced by PC_AddBuiltinDefines(), PC_AddDefine(), PC_AddGlobalDefinesToSource(), and PC_Directive_define().

00571 {
00572     int hash;
00573 
00574     hash = PC_NameHash(define->name);
00575     define->hashnext = definehash[hash];
00576     definehash[hash] = define;
00577 } //end of the function PC_AddDefineToHash

Here is the call graph for this function:

int PC_AddGlobalDefine char *  string  ) 
 

Definition at line 1397 of file l_precomp.c.

References define_t, globaldefines, define_s::next, PC_DefineFromString(), and string().

01398 {
01399     define_t *define;
01400 
01401     define = PC_DefineFromString(string);
01402     if (!define) return qfalse;
01403     define->next = globaldefines;
01404     globaldefines = define;
01405     return qtrue;
01406 } //end of the function PC_AddGlobalDefine

Here is the call graph for this function:

void PC_AddGlobalDefinesToSource source_t source  ) 
 

Definition at line 1492 of file l_precomp.c.

References define_t, source_s::definehash, source_s::defines, define_s::next, PC_AddDefineToHash(), PC_CopyDefine(), source, and source_t.

Referenced by LoadSourceFile(), and LoadSourceMemory().

01493 {
01494     define_t *define, *newdefine;
01495 
01496     for (define = globaldefines; define; define = define->next)
01497     {
01498         newdefine = PC_CopyDefine(source, define);
01499 #if DEFINEHASHING
01500         PC_AddDefineToHash(newdefine, source->definehash);
01501 #else //DEFINEHASHING
01502         newdefine->next = source->defines;
01503         source->defines = newdefine;
01504 #endif //DEFINEHASHING
01505     } //end for
01506 } //end of the function PC_AddGlobalDefinesToSource

Here is the call graph for this function:

void PC_CheckOpenSourceHandles void   ) 
 

Definition at line 3214 of file l_precomp.c.

References botimport, script_t::filename, i, PRT_ERROR, scriptstack, and sourceFiles.

Referenced by Export_BotLibShutdown().

03215 {
03216     int i;
03217 
03218     for (i = 1; i < MAX_SOURCEFILES; i++)
03219     {
03220         if (sourceFiles[i])
03221         {
03222 #ifdef BOTLIB
03223             botimport.Print(PRT_ERROR, "file %s still open in precompiler\n", sourceFiles[i]->scriptstack->filename);
03224 #endif  //BOTLIB
03225         } //end if
03226     } //end for
03227 } //end of the function PC_CheckOpenSourceHandles

int PC_CheckTokenString source_t source,
char *  string
 

Definition at line 2881 of file l_precomp.c.

References PC_ReadToken(), PC_UnreadSourceToken(), source, source_t, strcmp(), token_s::string, string(), and token_t.

Referenced by BotLoadChatMessage(), BotLoadInitialChat(), BotLoadMatchPieces(), BotLoadRandomStrings(), BotLoadReplyChat(), BotLoadSynonyms(), PC_Directive_define(), ReadFuzzyWeight(), and ReadStructure().

02882 {
02883     token_t tok;
02884 
02885     if (!PC_ReadToken(source, &tok)) return qfalse;
02886     //if the token is available
02887     if (!strcmp(tok.string, string)) return qtrue;
02888     //
02889     PC_UnreadSourceToken(source, &tok);
02890     return qfalse;
02891 } //end of the function PC_CheckTokenString

Here is the call graph for this function:

int PC_CheckTokenType source_t source,
int  type,
int  subtype,
token_t token
 

Definition at line 2898 of file l_precomp.c.

References Com_Memcpy(), PC_ReadToken(), PC_UnreadSourceToken(), source, source_t, token_s::subtype, token, token_t, token_s::type, and type.

02899 {
02900     token_t tok;
02901 
02902     if (!PC_ReadToken(source, &tok)) return qfalse;
02903     //if the type matches
02904     if (tok.type == type &&
02905             (tok.subtype & subtype) == subtype)
02906     {
02907         Com_Memcpy(token, &tok, sizeof(token_t));
02908         return qtrue;
02909     } //end if
02910     //
02911     PC_UnreadSourceToken(source, &tok);
02912     return qfalse;
02913 } //end of the function PC_CheckTokenType

Here is the call graph for this function:

void PC_ClearTokenWhiteSpace token_t token  ) 
 

Definition at line 1095 of file l_precomp.c.

References token_s::endwhitespace_p, token_s::linescrossed, token, token_t, and token_s::whitespace_p.

Referenced by PC_Directive_define().

01096 {
01097     token->whitespace_p = NULL;
01098     token->endwhitespace_p = NULL;
01099     token->linescrossed = 0;
01100 } //end of the function PC_ClearTokenWhiteSpace

void PC_ConvertPath char *  path  ) 
 

Definition at line 939 of file l_precomp.c.

References ptr(), and strcpy().

Referenced by PC_Directive_include().

00940 {
00941     char *ptr;
00942 
00943     //remove double path seperators
00944     for (ptr = path; *ptr;)
00945     {
00946         if ((*ptr == '\\' || *ptr == '/') &&
00947                 (*(ptr+1) == '\\' || *(ptr+1) == '/'))
00948         {
00949             strcpy(ptr, ptr+1);
00950         } //end if
00951         else
00952         {
00953             ptr++;
00954         } //end else
00955     } //end while
00956     //set OS dependent path seperators
00957     for (ptr = path; *ptr;)
00958     {
00959         if (*ptr == '/' || *ptr == '\\') *ptr = PATHSEPERATOR_CHAR;
00960         ptr++;
00961     } //end while
00962 } //end of the function PC_ConvertPath

Here is the call graph for this function:

define_t* PC_CopyDefine source_t source,
define_t define
 

Definition at line 1449 of file l_precomp.c.

References define_s::builtin, define_t, define_s::flags, GetMemory(), define_s::hashnext, define_s::name, token_s::next, define_s::next, define_s::numparms, define_s::parms, PC_CopyToken(), source_t, strcpy(), strlen(), token, token_t, and define_s::tokens.

Referenced by PC_AddGlobalDefinesToSource().

01450 {
01451     define_t *newdefine;
01452     token_t *token, *newtoken, *lasttoken;
01453 
01454     newdefine = (define_t *) GetMemory(sizeof(define_t) + strlen(define->name) + 1);
01455     //copy the define name
01456     newdefine->name = (char *) newdefine + sizeof(define_t);
01457     strcpy(newdefine->name, define->name);
01458     newdefine->flags = define->flags;
01459     newdefine->builtin = define->builtin;
01460     newdefine->numparms = define->numparms;
01461     //the define is not linked
01462     newdefine->next = NULL;
01463     newdefine->hashnext = NULL;
01464     //copy the define tokens
01465     newdefine->tokens = NULL;
01466     for (lasttoken = NULL, token = define->tokens; token; token = token->next)
01467     {
01468         newtoken = PC_CopyToken(token);
01469         newtoken->next = NULL;
01470         if (lasttoken) lasttoken->next = newtoken;
01471         else newdefine->tokens = newtoken;
01472         lasttoken = newtoken;
01473     } //end for
01474     //copy the define parameters
01475     newdefine->parms = NULL;
01476     for (lasttoken = NULL, token = define->parms; token; token = token->next)
01477     {
01478         newtoken = PC_CopyToken(token);
01479         newtoken->next = NULL;
01480         if (lasttoken) lasttoken->next = newtoken;
01481         else newdefine->parms = newtoken;
01482         lasttoken = newtoken;
01483     } //end for
01484     return newdefine;
01485 } //end of the function PC_CopyDefine

Here is the call graph for this function:

token_t* PC_CopyToken token_t token  ) 
 

Definition at line 262 of file l_precomp.c.

References Com_Error(), Com_Memcpy(), ERR_FATAL, Error(), GetMemory(), token_s::next, numtokens, t, token, and token_t.

Referenced by PC_CopyDefine(), PC_Directive_define(), PC_DollarEvaluate(), PC_Evaluate(), PC_ExpandBuiltinDefine(), PC_ExpandDefine(), PC_ReadDefineParms(), and PC_UnreadSourceToken().

00263 {
00264     token_t *t;
00265 
00266 //  t = (token_t *) malloc(sizeof(token_t));
00267     t = (token_t *) GetMemory(sizeof(token_t));
00268 //  t = freetokens;
00269     if (!t)
00270     {
00271 #ifdef BSPC
00272         Error("out of token space\n");
00273 #else
00274         Com_Error(ERR_FATAL, "out of token space\n");
00275 #endif
00276         return NULL;
00277     } //end if
00278 //  freetokens = freetokens->next;
00279     Com_Memcpy(t, token, sizeof(token_t));
00280     t->next = NULL;
00281     numtokens++;
00282     return t;
00283 } //end of the function PC_CopyToken

Here is the call graph for this function:

define_t* PC_DefineFromString char *  string  ) 
 

Definition at line 1318 of file l_precomp.c.

References Com_Memset(), define_t, DEFINEHASHSIZE, FreeMemory(), FreeScript(), GetClearedMemory(), i, LoadScriptMemory(), MAX_PATH, PC_Directive_define(), PC_FreeDefine(), PC_FreeToken(), PC_InitTokenHeap(), script, source_t, src, string(), strlen(), strncpy(), t, and token_t.

Referenced by PC_AddDefine(), and PC_AddGlobalDefine().

01319 {
01320     script_t *script;
01321     source_t src;
01322     token_t *t;
01323     int res, i;
01324     define_t *def;
01325 
01326     PC_InitTokenHeap();
01327 
01328     script = LoadScriptMemory(string, strlen(string), "*extern");
01329     //create a new source
01330     Com_Memset(&src, 0, sizeof(source_t));
01331     strncpy(src.filename, "*extern", MAX_PATH);
01332     src.scriptstack = script;
01333 #if DEFINEHASHING
01334     src.definehash = GetClearedMemory(DEFINEHASHSIZE * sizeof(define_t *));
01335 #endif //DEFINEHASHING
01336