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

l_precomp.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  define_s
struct  indent_s
struct  source_s

Defines

#define BUILTIN_DATE   3
#define BUILTIN_FILE   2
#define BUILTIN_LINE   1
#define BUILTIN_STDC   5
#define BUILTIN_TIME   4
#define DEFINE_FIXED   0x0001
#define INDENT_ELIF   0x0004
#define INDENT_ELSE   0x0002
#define INDENT_IF   0x0001
#define INDENT_IFDEF   0x0008
#define INDENT_IFNDEF   0x0010
#define MAX_PATH   MAX_QPATH
#define PATHSEPERATOR_CHAR   '/'
#define PATHSEPERATOR_STR   "/"

Typedefs

typedef define_s define_t
typedef indent_s indent_t
typedef source_s source_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)
int PC_AddGlobalDefine (char *string)
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)
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)
int PC_FreeSourceHandle (int handle)
int PC_LoadSourceHandle (const char *filename)
int PC_ReadLine (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)
void PC_UnreadLastToken (source_t *source)
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,...)


Define Documentation

#define BUILTIN_DATE   3
 

Definition at line 60 of file l_precomp.h.

Referenced by PC_AddBuiltinDefines(), and PC_ExpandBuiltinDefine().

#define BUILTIN_FILE   2
 

Definition at line 59 of file l_precomp.h.

Referenced by PC_AddBuiltinDefines(), and PC_ExpandBuiltinDefine().

#define BUILTIN_LINE   1
 

Definition at line 58 of file l_precomp.h.

Referenced by PC_AddBuiltinDefines(), and PC_ExpandBuiltinDefine().

#define BUILTIN_STDC   5
 

Definition at line 62 of file l_precomp.h.

Referenced by PC_ExpandBuiltinDefine().

#define BUILTIN_TIME   4
 

Definition at line 61 of file l_precomp.h.

Referenced by PC_AddBuiltinDefines(), and PC_ExpandBuiltinDefine().

#define DEFINE_FIXED   0x0001
 

Definition at line 56 of file l_precomp.h.

#define INDENT_ELIF   0x0004
 

Definition at line 66 of file l_precomp.h.

Referenced by PC_Directive_elif().

#define INDENT_ELSE   0x0002
 

Definition at line 65 of file l_precomp.h.

Referenced by PC_Directive_else().

#define INDENT_IF   0x0001
 

Definition at line 64 of file l_precomp.h.

Referenced by PC_Directive_if().

#define INDENT_IFDEF   0x0008
 

Definition at line 67 of file l_precomp.h.

Referenced by PC_Directive_ifdef().

#define INDENT_IFNDEF   0x0010
 

Definition at line 68 of file l_precomp.h.

Referenced by PC_Directive_ifndef().

#define MAX_PATH   MAX_QPATH
 

Definition at line 33 of file l_precomp.h.

#define PATHSEPERATOR_CHAR   '/'
 

Definition at line 47 of file l_precomp.h.

#define PATHSEPERATOR_STR   "/"
 

Definition at line 40 of file l_precomp.h.

Referenced by PC_SetIncludePath().


Typedef Documentation

typedef struct define_s define_t
 

Referenced by FreeSource(), LoadSourceFile(), LoadSourceMemory(), PC_AddBuiltinDefines(), PC_AddDefine(), PC_AddDefineToHash(), PC_AddGlobalDefine(), PC_AddGlobalDefinesToSource(), PC_CopyDefine(), PC_DefineFromString(), PC_Directive_define(), PC_Directive_if_def(), PC_Directive_undef(), PC_DollarEvaluate(), PC_Evaluate(), PC_ExpandBuiltinDefine(), PC_ExpandDefine(), PC_ExpandDefineIntoSource(), PC_FindDefine(), PC_FindDefineParm(), PC_FindHashedDefine(), PC_FreeDefine(), PC_PrintDefineHashTable(), PC_ReadDefineParms(), PC_ReadToken(), PC_RemoveAllGlobalDefines(), and PC_RemoveGlobalDefine().

typedef struct indent_s indent_t
 

Referenced by FreeSource(), PC_PopIndent(), and PC_PushIndent().

typedef struct source_s source_t
 

Referenced by BotCheckValidReplyChatKeySet(), BotLoadCharacterFromFile(), BotLoadChatMessage(), BotLoadInitialChat(), BotLoadMatchPieces(), BotLoadMatchTemplates(), BotLoadRandomStrings(), BotLoadReplyChat(), BotLoadSynonyms(), FreeSource(), LoadCfgFile(), LoadItemConfig(), LoadSourceFile(), LoadSourceMemory(), LoadWeaponConfig(), PC_AddBuiltinDefines(), PC_AddDefine(), PC_AddGlobalDefinesToSource(), PC_CheckTokenString(), PC_CheckTokenType(), PC_CopyDefine(), PC_DefineFromString(), PC_Directive_define(), PC_Directive_elif(), PC_Directive_else(), PC_Directive_endif(), PC_Directive_error(), PC_Directive_eval(), PC_Directive_evalfloat(), PC_Directive_if(), PC_Directive_if_def(), PC_Directive_ifdef(), PC_Directive_ifndef(), PC_Directive_include(), PC_Directive_line(), PC_Directive_pragma(), PC_Directive_undef(), PC_DollarDirective_evalfloat(), PC_DollarDirective_evalint(), PC_DollarEvaluate(), PC_Evaluate(), PC_EvaluateTokens(), PC_ExpandBuiltinDefine(), PC_ExpandDefine(), PC_ExpandDefineIntoSource(), PC_ExpectAnyToken(), PC_ExpectTokenString(), PC_ExpectTokenType(), PC_LoadSourceHandle(), PC_PopIndent(), PC_PushIndent(), PC_PushScript(), PC_ReadDefineParms(), PC_ReadDirective(), PC_ReadDollarDirective(), PC_ReadLine(), PC_ReadSourceToken(), PC_ReadToken(), PC_SetIncludePath(), PC_SetPunctuations(), PC_SkipUntilString(), PC_UnreadLastToken(), PC_UnreadSourceToken(), PC_UnreadToken(), ReadChar(), ReadFuzzySeperators_r(), ReadFuzzyWeight(), ReadNumber(), ReadString(), ReadStructure(), ReadValue(), ReadWeightConfig(), SourceError(), SourceWarning(), and UnreadSignToken().


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, indent_s::next, define_s::next, token_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 define_s::builtin, 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:

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_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(), string(), token_s::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, type, and token_s::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:

int PC_ExpectAnyToken source_t source,
token_t token
 

Definition at line 2863 of file l_precomp.c.

References PC_ReadToken(), source, source_t, SourceError(), token, and token_t.

Referenced by BotLoadCharacterFromFile(), BotLoadChatMessage(), BotLoadInitialChat(), ReadChar(), ReadFuzzySeperators_r(), ReadNumber(), ReadStructure(), ReadValue(), and ReadWeightConfig().

02864 {
02865     if (!PC_ReadToken(source, token))
02866     {
02867         SourceError(source, "couldn't read expected token");
02868         return qfalse;
02869     } //end if
02870     else
02871     {
02872         return qtrue;
02873     } //end else
02874 } //end of the function PC_ExpectAnyToken

Here is the call graph for this function:

int PC_ExpectTokenString source_t source,
char *  string
 

Definition at line 2787 of file l_precomp.c.

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

Referenced by BotLoadCharacterFromFile(), BotLoadChatMessage(), BotLoadInitialChat(), BotLoadMatchPieces(), BotLoadMatchTemplates(), BotLoadRandomStrings(), BotLoadReplyChat(), BotLoadSynonyms(), ReadFuzzySeperators_r(), ReadFuzzyWeight(), ReadStructure(), and ReadWeightConfig().

02788 {
02789     token_t token;
02790 
02791     if (!PC_ReadToken(source, &token))
02792     {
02793         SourceError(source, "couldn't find expected %s", string);
02794         return qfalse;
02795     } //end if
02796 
02797     if (strcmp(token.string, string))
02798     {
02799         SourceError(source, "expected %s, found %s", string, token.string);
02800         return qfalse;
02801     } //end if
02802     return qtrue;
02803 } //end of the function PC_ExpectTokenString

Here is the call graph for this function:

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

Definition at line 2810 of file l_precomp.c.

References PC_ReadToken(), source, source_t, SourceError(), strcat(), strcpy(), token_s::string, token_s::subtype, token, token_t, type, and token_s::type.

Referenced by BotLoadCharacterFromFile(), BotLoadInitialChat(), BotLoadMatchPieces(), BotLoadMatchTemplates(), BotLoadReplyChat(), BotLoadSynonyms(), LoadItemConfig(), ReadFuzzySeperators_r(), ReadString(), ReadValue(), and ReadWeightConfig().

02811 {
02812     char str[MAX_TOKEN];
02813 
02814     if (!PC_ReadToken(source, token))
02815     {
02816         SourceError(source, "couldn't read expected token");
02817         return qfalse;
02818     } //end if
02819 
02820     if (token->type != type)
02821     {
02822         strcpy(str, "");
02823         if (type == TT_STRING) strcpy(str, "string");
02824         if (type == TT_LITERAL) strcpy(str, "literal");
02825         if (type == TT_NUMBER) strcpy(str, "number");
02826         if (type == TT_NAME) strcpy(str, "name");
02827         if (type == TT_PUNCTUATION) strcpy(str, "punctuation");
02828         SourceError(source, "expected a %s, found %s", str, token->string);
02829         return qfalse;
02830     } //end if
02831     if (token->type == TT_NUMBER)
02832     {
02833         if ((token->subtype & subtype) != subtype)
02834         {
02835             if (subtype & TT_DECIMAL) strcpy(str, "decimal");
02836             if (subtype & TT_HEX) strcpy(str, "hex");
02837             if (subtype & TT_OCTAL) strcpy(str, "octal");
02838             if (subtype & TT_BINARY) strcpy(str, "binary");
02839             if (subtype & TT_LONG) strcat(str, " long");
02840             if (subtype & TT_UNSIGNED) strcat(str, " unsigned");
02841             if (subtype & TT_FLOAT) strcat(str, " float");
02842             if (subtype & TT_INTEGER) strcat(str, " integer");
02843             SourceError(source, "expected %s, found %s", str, token->string);
02844             return qfalse;
02845         } //end if
02846     } //end if
02847     else if (token->type == TT_PUNCTUATION)
02848     {
02849         if (token->subtype != subtype)
02850         {
02851             SourceError(source, "found %s", token->string);
02852             return qfalse;
02853         } //end if
02854     } //end else if
02855     return qtrue;
02856 } //end of the function PC_ExpectTokenType

Here is the call graph for this function:

int PC_FreeSourceHandle int  handle  ) 
 

Definition at line 3141 of file l_precomp.c.

References FreeSource(), and sourceFiles.

03142 {
03143     if (handle < 1 || handle >= MAX_SOURCEFILES)
03144         return qfalse;
03145     if (!sourceFiles[handle])
03146         return qfalse;
03147 
03148     FreeSource(sourceFiles[handle]);
03149     sourceFiles[handle] = NULL;
03150     return qtrue;
03151 } //end of the function PC_FreeSourceHandle

Here is the call graph for this function:

int PC_LoadSourceHandle const char *  filename  ) 
 

Definition at line 3116 of file l_precomp.c.

References i, LoadSourceFile(), PS_SetBaseFolder(), source, source_t, and sourceFiles.

03117 {
03118     source_t *source;
03119     int i;
03120 
03121     for (i = 1; i < MAX_SOURCEFILES; i++)
03122     {
03123         if (!sourceFiles[i])
03124             break;
03125     } //end for
03126     if (i >= MAX_SOURCEFILES)
03127         return 0;
03128     PS_SetBaseFolder("");
03129     source = LoadSourceFile(filename);
03130     if (!source)
03131         return 0;
03132     sourceFiles[i] = source;
03133     return i;
03134 } //end of the function PC_LoadSourceHandle

Here is the call graph for this function:

int PC_ReadLine source_t source,
token_t token
 

Definition at line 1061 of file l_precomp.c.

References token_s::linescrossed, PC_ReadSourceToken(), PC_UnreadSourceToken(), source, source_t, strcmp(), token_s::string, token, and token_t.

Referenced by PC_Directive_define(), PC_Directive_if_def(), PC_Directive_pragma(), PC_Directive_undef(), and PC_Evaluate().

01062 {
01063     int crossline;
01064 
01065     crossline = 0;
01066     do
01067     {
01068         if (!PC_ReadSourceToken(source, token)) return qfalse;
01069         
01070         if (token->linescrossed > crossline)
01071         {
01072             PC_UnreadSourceToken(source, token);
01073             return qfalse;
01074         } //end if
01075         crossline = 1;
01076     } while(!strcmp(token->string, "\\"));
01077     return qtrue;
01078 } //end of the function PC_ReadLine

Here is the call graph for this function:

int PC_ReadToken source_t source,
token_t token
 

Definition at line 2704 of file l_precomp.c.

References Com_Memcpy(), define_t, source_s::definehash, source_s::defines, MAX_TOKEN, PC_ExpandDefineIntoSource(), PC_FindDefine(), PC_FindHashedDefine(), PC_ReadDirective(), PC_ReadDollarDirective(), PC_ReadSourceToken(), PC_UnreadToken(), source_s::skip, source, source_t, SourceError(), strcat(), token_s::string, strlen(), source_s::token, token, token_t, TT_PUNCTUATION, and token_s::type.

Referenced by BotLoadCharacterFromFile(), BotLoadInitialChat(), BotLoadMatchPieces(), BotLoadMatchTemplates(), BotLoadRandomStrings(), BotLoadReplyChat(), BotLoadSynonyms(), LoadCfgFile(), LoadItemConfig(), LoadWeaponConfig(), PC_CheckTokenString(), PC_CheckTokenType(), PC_ExpectAnyToken(), PC_ExpectTokenString(), PC_ExpectTokenType(), PC_ReadTokenHandle(), PC_SkipUntilString(), and ReadWeightConfig().

02705 {
02706     define_t *define;
02707 
02708     while(1)
02709     {
02710         if (!PC_ReadSourceToken(source, token)) return qfalse;
02711         //check for precompiler directives
02712         if (token->type == TT_PUNCTUATION && *token->string == '#')
02713         {
02714 #ifdef QUAKEC
02715             if (!BuiltinFunction(source))
02716 #endif //QUAKC
02717             {
02718                 //read the precompiler directive
02719                 if (!PC_ReadDirective(source)) return qfalse;
02720                 continue;
02721             } //end if
02722         } //end if
02723         if (token->type == TT_PUNCTUATION && *token->string == '$')
02724         {
02725 #ifdef QUAKEC
02726             if (!QuakeCMacro(source))
02727 #endif //QUAKEC
02728             {
02729                 //read the precompiler directive
02730                 if (!PC_ReadDollarDirective(source)) return qfalse;
02731                 continue;
02732             } //end if
02733         } //end if
02734         // recursively concatenate strings that are behind each other still resolving defines
02735         if (token->type == TT_STRING)
02736         {
02737             token_t newtoken;
02738             if (PC_ReadToken(source, &newtoken))
02739             {
02740                 if (newtoken.type == TT_STRING)
02741                 {
02742                     token->string[strlen(token->string)-1] = '\0';
02743                     if (strlen(token->string) + strlen(newtoken.string+1) + 1 >= MAX_TOKEN)
02744                     {
02745                         SourceError(source, "string longer than MAX_TOKEN %d\n", MAX_TOKEN);
02746                         return qfalse;
02747                     }
02748                     strcat(token->string, newtoken.string+1);
02749                 }
02750                 else
02751                 {
02752                     PC_UnreadToken(source, &newtoken);
02753                 }
02754             }
02755         } //end if
02756         //if skipping source because of conditional compilation
02757         if (source->skip) continue;
02758         //if the token is a name
02759         if (token->type == TT_NAME)
02760         {
02761             //check if the name is a define macro
02762 #if DEFINEHASHING
02763             define = PC_FindHashedDefine(source->definehash, token->string);
02764 #else
02765             define = PC_FindDefine(source->defines, token->string);
02766 #endif //DEFINEHASHING
02767             //if it is a define macro
02768             if (define)
02769             {
02770                 //expand the defined macro
02771                 if (!PC_ExpandDefineIntoSource(source, token, define)) return qfalse;
02772                 continue;
02773             } //end if
02774         } //end if
02775         //copy token for unreading
02776         Com_Memcpy(&source->token, token, sizeof(token_t));
02777         //found a token
02778         return qtrue;
02779     } //end while
02780 } //end of the function PC_ReadToken

Here is the call graph for this function:

int PC_ReadTokenHandle int  handle,
pc_token_t pc_token
 

Definition at line 3158 of file l_precomp.c.

References token_s::floatvalue, pc_token_s::floatvalue, token_s::intvalue, pc_token_s::intvalue, PC_ReadToken(), pc_token_t, sourceFiles, strcpy(), token_s::string, pc_token_s::string, StripDoubleQuotes(), token_s::subtype, pc_token_s::subtype, token, token_t, token_s::type, and pc_token_s::type.

03159 {
03160     token_t token;
03161     int ret;
03162 
03163     if (handle < 1 || handle >= MAX_SOURCEFILES)
03164         return 0;
03165     if (!sourceFiles[handle])
03166         return 0;
03167 
03168     ret = PC_ReadToken(sourceFiles[handle], &token);
03169     strcpy(pc_token->string, token.string);
03170     pc_token->type = token.type;
03171     pc_token->subtype = token.subtype;
03172     pc_token->intvalue = token.intvalue;
03173     pc_token->floatvalue = token.floatvalue;
03174     if (pc_token->type == TT_STRING)
03175         StripDoubleQuotes(pc_token->string);
03176     return ret;
03177 } //end of the function PC_ReadTokenHandle

Here is the call graph for this function:

void PC_RemoveAllGlobalDefines void   ) 
 

Definition at line 1433 of file l_precomp.c.

References define_t, globaldefines, define_s::next, and PC_FreeDefine().

Referenced by Export_BotLibShutdown().

01434 {
01435     define_t *define;
01436 
01437     for (define = globaldefines; define; define = globaldefines)
01438     {
01439         globaldefines = globaldefines->next;
01440         PC_FreeDefine(define);
01441     } //end for
01442 } //end of the function PC_RemoveAllGlobalDefines

Here is the call graph for this function:

int PC_RemoveGlobalDefine char *  name  ) 
 

Definition at line 1414 of file l_precomp.c.

References define_t, globaldefines, name, PC_FindDefine(), and PC_FreeDefine().

01415 {
01416     define_t *define;
01417 
01418     define = PC_FindDefine(globaldefines, name);
01419     if (define)
01420     {
01421         PC_FreeDefine(define);
01422         return qtrue;
01423     } //end if
01424     return qfalse;
01425 } //end of the function PC_RemoveGlobalDefine

Here is the call graph for this function:

void PC_SetBaseFolder char *  path  ) 
 

Definition at line 3204 of file l_precomp.c.

References PS_SetBaseFolder().

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

03205 {
03206     PS_SetBaseFolder(path);
03207 } //end of the function PC_SetBaseFolder

Here is the call graph for this function:

void PC_SetIncludePath source_t source,
char *  path
 

Definition at line 2956 of file l_precomp.c.

References source_s::includepath, MAX_PATH, PATHSEPERATOR_STR, source, source_t, strcat(), strlen(), and strncpy().

02957 {
02958     strncpy(source->includepath, path, MAX_PATH);
02959     //add trailing path seperator
02960     if (source->includepath[strlen(source->includepath)-1] != '\\' &&
02961         source->includepath[strlen(source->includepath)-1] != '/')
02962     {
02963         strcat(source->includepath, PATHSEPERATOR_STR);
02964     } //end if
02965 } //end of the function PC_SetIncludePath

Here is the call graph for this function:

void PC_SetPunctuations source_t source,
punctuation_t p
 

Definition at line 2972 of file l_precomp.c.

References punctuation_t, source_s::punctuations, source, and source_t.

02973 {
02974     source->punctuations = p;
02975 } //end of the function PC_SetPunctuations

int PC_SkipUntilString source_t source,
char *  string
 

Definition at line 2920 of file l_precomp.c.

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

02921 {
02922     token_t token;
02923 
02924     while(PC_ReadToken(source, &token))
02925     {
02926         if (!strcmp(token.string, string)) return qtrue;
02927     } //end while
02928     return qfalse;
02929 } //end of the function PC_SkipUntilString

Here is the call graph for this function:

int PC_SourceFileAndLine int  handle,
char *  filename,
int *  line
 

Definition at line 3184 of file l_precomp.c.

References script_t::line, line, source_s::scriptstack, sourceFiles, and strcpy().

03185 {
03186     if (handle < 1 || handle >= MAX_SOURCEFILES)
03187         return qfalse;
03188     if (!sourceFiles[handle])
03189         return qfalse;
03190 
03191     strcpy(filename, sourceFiles[handle]->filename);
03192     if (sourceFiles[handle]->scriptstack)
03193         *line = sourceFiles[handle]->scriptstack->line;
03194     else
03195         *line = 0;
03196     return qtrue;
03197 } //end of the function PC_SourceFileAndLine

Here is the call graph for this function:

void PC_UnreadLastToken source_t source  ) 
 

Definition at line 2936 of file l_precomp.c.

References PC_UnreadSourceToken(), source, source_t, and source_s::token.

Referenced by BotLoadMatchTemplates(), and ReadChar().

02937 {
02938     PC_UnreadSourceToken(source, &source->token);
02939 } //end of the function PC_UnreadLastToken

Here is the call graph for this function:

void PC_UnreadToken source_t source,
token_t token
 

Definition at line 2946 of file l_precomp.c.

References PC_UnreadSourceToken(), source, source_t, token, and token_t.

Referenced by PC_ReadToken().

02947 {
02948     PC_UnreadSourceToken(source, token);
02949 } //end of the function PC_UnreadToken

Here is the call graph for this function:

int PC_WhiteSpaceBeforeToken token_t token  ) 
 

Definition at line 1085 of file l_precomp.c.

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

Referenced by PC_Directive_define().

01086 {
01087     return token->endwhitespace_p - token->whitespace_p > 0;
01088 } //end of the function PC_WhiteSpaceBeforeToken

void QDECL SourceError source_t source,
char *  str,
  ...
 

Definition at line 128 of file l_precomp.c.

References botimport, script_t::filename, script_t::line, Log_Print(), printf(), PRT_ERROR, QDECL, source_s::scriptstack, source, source_t, va_end, va_list, va_start, and vsprintf().

Referenced by BotLoadCharacterFromFile(), BotLoadChatMessage(), BotLoadInitialChat(), BotLoadMatchPieces(), BotLoadMatchTemplates(), BotLoadRandomStrings(), BotLoadReplyChat(), BotLoadSynonyms(), LoadCfgFile(), LoadItemConfig(), PC_Directive_define(), PC_Directive_elif(), PC_Directive_else(), PC_Directive_endif(), PC_Directive_error(), PC_Directive_if_def(), PC_Directive_include(), PC_Directive_line(), PC_Directive_undef(), PC_DollarEvaluate(), PC_Evaluate(), PC_EvaluateTokens(), PC_ExpandDefine(), PC_ExpectAnyToken(), PC_ExpectTokenString(), PC_ExpectTokenType(), PC_PushScript(), PC_ReadDefineParms(), PC_ReadDirective(), PC_ReadDollarDirective(), PC_ReadToken(), ReadFuzzySeperators_r(), ReadNumber(), ReadStructure(), ReadValue(), and ReadWeightConfig().

00129 {
00130     char text[1024];
00131     va_list ap;
00132 
00133     va_start(ap, str);
00134     vsprintf(text, str, ap);
00135     va_end(ap);
00136 #ifdef BOTLIB
00137     botimport.Print(PRT_ERROR, "file %s, line %d: %s\n", source->scriptstack->filename, source->scriptstack->line, text);
00138 #endif  //BOTLIB
00139 #ifdef MEQCC
00140     printf("error: file %s, line %d: %s\n", source->scriptstack->filename, source->scriptstack->line, text);
00141 #endif //MEQCC
00142 #ifdef BSPC
00143     Log_Print("error: file %s, line %d: %s\n", source->scriptstack->filename, source->scriptstack->line, text);
00144 #endif //BSPC
00145 } //end of the function SourceError

Here is the call graph for this function:

void QDECL SourceWarning source_t source,
char *  str,
  ...
 

Definition at line 152 of file l_precomp.c.

References botimport, script_t::filename, script_t::line, Log_Print(), printf(), PRT_WARNING, QDECL, source_s::scriptstack, source, source_t, va_end, va_list, va_start, and vsprintf().

Referenced by BotCheckValidReplyChatKeySet(), LoadCfgFile(), PC_Directive_define(), PC_Directive_include(), PC_Directive_pragma(), PC_Directive_undef(), PC_ExpandDefine(), PC_ReadDefineParms(), PC_ReadSourceToken(), ReadFuzzySeperators_r(), ReadValue(), and ReadWeightConfig().

00153 {
00154     char text[1024];
00155     va_list ap;
00156 
00157     va_start(ap, str);
00158     vsprintf(text, str, ap);
00159     va_end(ap);
00160 #ifdef BOTLIB
00161     botimport.Print(PRT_WARNING, "file %s, line %d: %s\n", source->scriptstack->filename, source->scriptstack->line, text);
00162 #endif //BOTLIB
00163 #ifdef MEQCC
00164     printf("warning: file %s, line %d: %s\n", source->scriptstack->filename, source->scriptstack->line, text);
00165 #endif //MEQCC
00166 #ifdef BSPC
00167     Log_Print("warning: file %s, line %d: %s\n", source->scriptstack->filename, source->scriptstack->line, text);
00168 #endif //BSPC
00169 } //end of the function ScriptWarning

Here is the call graph for this function:


Generated on Thu Aug 25 12:44:09 2005 for Quake III Arena by  doxygen 1.3.9.1