Read console input, process the raw args, turning them into tokens and types. ===========================================================================
| 235 | // Read console input, process the raw args, turning them into tokens and types. |
| 236 | //=========================================================================== |
| 237 | int ArgsGet ( char * pInput ) |
| 238 | { |
| 239 | LPCTSTR pSrc = pInput; |
| 240 | LPCTSTR pEnd = NULL; |
| 241 | int nBuf = 0; |
| 242 | |
| 243 | ArgToken_e iTokenSrc = NO_TOKEN; |
| 244 | ArgToken_e iTokenEnd = NO_TOKEN; |
| 245 | ArgType_e iType = TYPE_STRING; |
| 246 | int nLen; |
| 247 | |
| 248 | int iArg = 0; |
| 249 | int nArg = 0; |
| 250 | Arg_t *pArg = &g_aArgRaw[0]; // &g_aArgs[0]; |
| 251 | |
| 252 | g_pConsoleFirstArg = NULL; |
| 253 | |
| 254 | // BP FAC8:FACA // Range=3 |
| 255 | // BP FAC8,2 // Length=2 |
| 256 | // ^ ^^ ^^ |
| 257 | // | || |pSrc |
| 258 | // | || pSrc |
| 259 | // | |pSrc |
| 260 | // | pEnd |
| 261 | // pSrc |
| 262 | while ((*pSrc) && (iArg < MAX_ARGS)) |
| 263 | { |
| 264 | // Technically, there shouldn't be any leading spaces, |
| 265 | // since pressing the spacebar is an alias for TRACE. |
| 266 | // However, there are spaces between arguments |
| 267 | pSrc = const_cast<char*>( SkipWhiteSpace( pSrc )); |
| 268 | |
| 269 | if (pSrc) |
| 270 | { |
| 271 | pEnd = FindTokenOrAlphaNumeric( pSrc, g_aTokens, NUM_TOKENS, &iTokenSrc ); |
| 272 | if ((iTokenSrc == NO_TOKEN) || (iTokenSrc == TOKEN_ALPHANUMERIC)) |
| 273 | { |
| 274 | pEnd = SkipUntilToken( pSrc+1, g_aTokens, NUM_TOKENS, &iTokenEnd ); |
| 275 | } |
| 276 | |
| 277 | if ((iTokenSrc == TOKEN_COMMENT_EOL) || |
| 278 | (iArg == 0 && iTokenSrc == TOKEN_DIVIDE_FLOOR)) // Double FORWARD SLASH at start of line |
| 279 | break; |
| 280 | |
| 281 | if (iTokenSrc == NO_TOKEN) |
| 282 | { |
| 283 | iTokenSrc = TOKEN_ALPHANUMERIC; |
| 284 | } |
| 285 | |
| 286 | iType = g_aTokens[ iTokenSrc ].eType; |
| 287 | |
| 288 | if (iTokenSrc == TOKEN_QUOTE_DOUBLE) |
| 289 | { |
| 290 | pSrc++; // Don't store start of quote |
| 291 | pEnd = SkipUntilChar( pSrc, CHAR_QUOTE_DOUBLE ); |
| 292 | } |
| 293 | else |
| 294 | if (iTokenSrc == TOKEN_QUOTE_SINGLE) |
no test coverage detected