* GetLine * * inputs: * * return: * ************************************************************************************************/
| 342 | * |
| 343 | ************************************************************************************************/ |
| 344 | void GetLine(char *&Data, int &Size, int &token, char *&data) |
| 345 | { |
| 346 | static char save_data[8192]; |
| 347 | char temp_data[8192]; |
| 348 | char *test_token, *pos; |
| 349 | |
| 350 | save_data[0] = 0; |
| 351 | token = TK_INVALID; |
| 352 | data = save_data; |
| 353 | |
| 354 | if (!ReadData(Data, Size, temp_data, sizeof(temp_data))) |
| 355 | { |
| 356 | return; |
| 357 | } |
| 358 | |
| 359 | // strcpy(temp_data, " DATA \"test of the data\ntest test\ndfa dfd"); |
| 360 | // strcpy(temp_data, " DATA"); |
| 361 | |
| 362 | pos = temp_data; |
| 363 | while((*pos) && strchr(" \n\r", *pos)) |
| 364 | { // remove white space |
| 365 | pos++; |
| 366 | } |
| 367 | test_token = pos; |
| 368 | |
| 369 | while((*pos) && !strchr(" \n\r", *pos)) |
| 370 | { // scan until end of white space |
| 371 | pos++; |
| 372 | } |
| 373 | |
| 374 | if ((*pos)) |
| 375 | { |
| 376 | *pos = 0; |
| 377 | pos++; |
| 378 | } |
| 379 | token = FindToken(test_token, true); |
| 380 | |
| 381 | while((*pos) && strchr(" \n\r", *pos)) |
| 382 | { // remove white space |
| 383 | pos++; |
| 384 | } |
| 385 | |
| 386 | if ((*pos) == '\"') |
| 387 | { |
| 388 | pos++; |
| 389 | test_token = save_data; |
| 390 | memset(save_data, 0, sizeof(save_data)); |
| 391 | |
| 392 | while(((*pos) != '\"' || !strchr("\n\r", (*(pos+1)))) && (*pos)) |
| 393 | { |
| 394 | if ((*pos) == '\\' && (*(pos+1)) == 'n') |
| 395 | { |
| 396 | *test_token = '\n'; |
| 397 | test_token++; |
| 398 | pos+=2; |
| 399 | continue; |
| 400 | } |
| 401 |
no test coverage detected