MCPcopy Create free account
hub / github.com/JACoders/OpenJK / FindToken

Function FindToken

code/qcommon/strip.cpp:270–301  ·  view source on GitHub ↗

* FindToken * * inputs: * token string * flag indicating if token string is partial or not * * return: * token enum * ************************************************************************************************/

Source from the content-addressed store, hash-verified

268 *
269 ************************************************************************************************/
270int FindToken(char *token, bool whole)
271{
272 int token_value;
273 int i;
274
275 for(token_value = 0; token_value != TK_END; token_value++)
276 {
277 if (whole)
278 {
279 if (Q_stricmp(token, Tokens[token_value]) == 0)
280 {
281 return token_value;
282 }
283 }
284 else
285 {
286 if (Q_stricmpn(token, Tokens[token_value], strlen(Tokens[token_value])) == 0)
287 {
288 i = strlen(Tokens[token_value]);
289 while(token[i] == ' ')
290 {
291 i++;
292 }
293 memmove(token, &token[i], strlen(token)-i+1);
294
295 return token_value;
296 }
297 }
298 }
299
300 return TK_INVALID;
301}
302
303/************************************************************************************************
304 * ReadData

Callers 2

GetLineFunction · 0.85
UnderstandTokenMethod · 0.85

Calls 2

Q_stricmpFunction · 0.85
Q_stricmpnFunction · 0.85

Tested by

no test coverage detected