Go to the source code of this file.
Defines | |
| #define | MAXTOKEN 1024 |
Functions | |
| qboolean WINAPI | GetToken (qboolean crossline) |
| void | StartTokenParsing (char *data) |
| qboolean | TokenAvailable (void) |
| void WINAPI | UngetToken (void) |
Variables | |
| int | scriptline |
| char | token [MAXTOKEN] |
|
|
|
|
|
Definition at line 160 of file scriplib.c. References AddScriptToStack(), script_t::end_p, EndOfScript(), Error(), script_t::line, qboolean, qfalse, script, script_p, script_t::script_p, scriptline, strcmp(), Sys_Printf(), token, tokenready, and unget. Referenced by Brush_Parse(), BrushPrimit_Parse(), EndOfScript(), Entity_Parse(), LoadShader(), LoadShaderInfo(), LoadShaders(), MatchToken(), Parse1DMatrix(), Parse2DMatrix(), Parse3DMatrix(), ParseEntity(), ParseEpair(), ParseMapEntity(), ParsePatch(), ParseRawBrush(), ParseShaderFile(), ParseTerrain(), Patch_Parse(), Terrain_Parse(), Terrain_ParseFace(), and TokenAvailable(). 00161 {
00162 char *token_p;
00163
00164 if (tokenready) // is a token allready waiting?
00165 {
00166 tokenready = qfalse;
00167 return qtrue;
00168 }
00169
00170 if (script->script_p >= script->end_p)
00171 return EndOfScript (crossline);
00172
00173 //
00174 // skip space
00175 //
00176 skipspace:
00177 while (*script->script_p <= 32)
00178 {
00179 if (script->script_p >= script->end_p)
00180 return EndOfScript (crossline);
00181 if (*script->script_p++ == '\n')
00182 {
00183 if (!crossline)
00184 Error ("Line %i is incomplete\n",scriptline);
00185 scriptline = script->line++;
00186 }
00187 }
00188
00189 if (script->script_p >= script->end_p)
00190 return EndOfScript (crossline);
00191
00192 // ; # // comments
00193 if (*script->script_p == ';' || *script->script_p == '#'
00194 || ( script->script_p[0] == '/' && script->script_p[1] == '/') )
00195 {
00196 if (!crossline)
00197 Error ("Line %i is incomplete\n",scriptline);
00198 while (*script->script_p++ != '\n')
00199 if (script->script_p >= script->end_p)
00200 return EndOfScript (crossline);
00201 scriptline = script->line++;
00202 goto skipspace;
00203 }
00204
00205 // /* */ comments
00206 if (script->script_p[0] == '/' && script->script_p[1] == '*')
00207 {
00208 if (!crossline)
00209 Error ("Line %i is incomplete\n",scriptline);
00210 script->script_p+=2;
00211 while (script->script_p[0] != '*' && script->script_p[1] != '/')
00212 {
00213 if ( *script->script_p == '\n' ) {
00214 scriptline = script->line++;
00215 }
00216 script->script_p++;
00217 if (script->script_p >= script->end_p)
00218 return EndOfScript (crossline);
00219 }
00220 script->script_p += 2;
00221 goto skipspace;
00222 }
00223
00224 //
00225 // copy token
00226 //
00227 token_p = token;
00228
00229 if (*script->script_p == '"')
00230 {
00231 // quoted token
00232 script->script_p++;
00233 while (*script->script_p != '"')
00234 {
00235 *token_p++ = *script->script_p++;
00236 if (script->script_p == script->end_p)
00237 break;
00238 if (token_p == &token[MAXTOKEN])
00239 Error ("Token too large on line %i\n",scriptline);
00240 }
00241 script->script_p++;
00242 }
00243 else // regular token
00244 while ( *script->script_p > 32 && *script->script_p != ';')
00245 {
00246 *token_p++ = *script->script_p++;
00247 if (script->script_p == script->end_p)
00248 break;
00249 if (token_p == &token[MAXTOKEN])
00250 Error ("Token too large on line %i\n",scriptline);
00251 }
00252
00253 *token_p = 0;
00254
00255 if (!strcmp (token, "$include"))
00256 {
00257 GetToken (qfalse);
00258 AddScriptToStack (token);
00259 return GetToken (crossline);
00260 }
00261
00262 return qtrue;
00263 }
|
Here is the call graph for this function:

|
|
Definition at line 30 of file PARSE.CPP. References script_p, scriptline, and unget. Referenced by LoadShader(), LoadShaders(), Map_ImportBuffer(), Map_LoadFile(), and QE_LoadProject(). 00031 {
00032 scriptline = 1;
00033 script_p = data;
00034 unget = false;
00035 }
|
|
|
Definition at line 273 of file scriplib.c. References GetToken(), script_t::line, qboolean, qtrue, r, script, and UnGetToken(). 00273 {
00274 int oldLine;
00275 qboolean r;
00276
00277 oldLine = script->line;
00278 r = GetToken( qtrue );
00279 if ( !r ) {
00280 return qfalse;
00281 }
00282 UnGetToken();
00283 if ( oldLine == script->line ) {
00284 return qtrue;
00285 }
00286 return qfalse;
00287 }
|
Here is the call graph for this function:

|
|
Definition at line 115 of file PARSE.CPP. References unget. 00116 {
00117 unget = true;
00118 }
|
|
|
Definition at line 45 of file scriplib.c. |
|
|
Definition at line 47 of file scriplib.c. |
1.3.9.1