| 449 | } |
| 450 | |
| 451 | void cAnalyzeScreen::ProcessCommandLine() |
| 452 | { |
| 453 | // Get the analyze module... |
| 454 | cAnalyze& analyze = m_world->GetAnalyze(); |
| 455 | |
| 456 | // Save the original input and divide up the rest into command and args. |
| 457 | cString orig_input = cur_input; |
| 458 | cString command = cur_input.PopWord(); |
| 459 | cString command_args = cur_input; |
| 460 | |
| 461 | // Reset various tracking values. |
| 462 | cur_input = ""; |
| 463 | rollback_line = 0; |
| 464 | cursor_pos = 0; |
| 465 | |
| 466 | // Grab the command portion of this input and set to uppercase. |
| 467 | command.ToUpper(); |
| 468 | bool command_found = false; |
| 469 | |
| 470 | // Check some builtin commands. |
| 471 | if (command == "QUIT" || command == "EXIT") exit(0); |
| 472 | |
| 473 | // Check to see if we are ending a loop. |
| 474 | if (command == "END") { |
| 475 | if (nest_depth == 0) exit(0); |
| 476 | // Reduce the nest_depth. |
| 477 | nest_depth--; |
| 478 | |
| 479 | // If the loop we finished is at the outermost level, execute it! |
| 480 | if (nest_depth == 0) { |
| 481 | cAnalyzeCommand * cur_command = nest_command.Pop(); |
| 482 | command_args = cur_command->GetArgs(); |
| 483 | analyze.PreProcessArgs(command_args); |
| 484 | cAnalyzeCommandDefBase* command_fun = |
| 485 | analyze.FindAnalyzeCommandDef(cur_command->GetCommand()); |
| 486 | cUserFeedback feedback; |
| 487 | command_fun->Run(&analyze, command_args, *cur_command, feedback); |
| 488 | for (int i = 0; i < feedback.GetNumMessages(); i++) { |
| 489 | switch (feedback.GetMessageType(i)) { |
| 490 | case cUserFeedback::UF_ERROR: screen_hist.PushRear(cString("error: ") + feedback.GetMessage(i)); break; |
| 491 | case cUserFeedback::UF_WARNING: screen_hist.PushRear(cString("warning: ") + feedback.GetMessage(i)); break; |
| 492 | default: break; |
| 493 | }; |
| 494 | } |
| 495 | } |
| 496 | // Otherwise store it... |
| 497 | else { |
| 498 | cAnalyzeCommand * cur_command = nest_command.Pop(); |
| 499 | nest_command.GetFirst()->GetCommandList()->PushRear(cur_command); |
| 500 | } |
| 501 | |
| 502 | command_found = true; |
| 503 | } |
| 504 | |
| 505 | // Check some other built-in commands. |
| 506 | if (command == "CLEAR") { |
| 507 | screen_hist.Clear(); |
| 508 | command_found = true; |
nothing calls this directly
no test coverage detected