| 10731 | } |
| 10732 | |
| 10733 | bool cAnalyze::FunctionRun(const cString & fun_name, cString args) |
| 10734 | { |
| 10735 | if (m_world->GetVerbosity() >= VERBOSE_ON) { |
| 10736 | cout << "Running function: " << fun_name << endl; |
| 10737 | // << " with args: " << args << endl; |
| 10738 | } |
| 10739 | |
| 10740 | // Find the function we're about to run... |
| 10741 | cAnalyzeFunction * found_function = NULL; |
| 10742 | tListIterator<cAnalyzeFunction> function_it(function_list); |
| 10743 | while (function_it.Next() != NULL) { |
| 10744 | if (function_it.Get()->GetName() == fun_name) { |
| 10745 | found_function = function_it.Get(); |
| 10746 | break; |
| 10747 | } |
| 10748 | } |
| 10749 | |
| 10750 | // If we were unable to find the command we're looking for, return false. |
| 10751 | if (found_function == NULL) return false; |
| 10752 | |
| 10753 | // Back up the local variables |
| 10754 | cString backup_arg_vars[10]; |
| 10755 | cString backup_local_vars[26]; |
| 10756 | for (int i = 0; i < 10; i++) backup_arg_vars[i] = arg_variables[i]; |
| 10757 | for (int i = 0; i < 26; i++) backup_local_vars[i] = local_variables[i]; |
| 10758 | |
| 10759 | // Set the arg variables to the passed-in args... |
| 10760 | arg_variables[0] = fun_name; |
| 10761 | for (int i = 1; i < 10; i++) arg_variables[i] = args.PopWord(); |
| 10762 | for (int i = 0; i < 26; i++) local_variables[i] = ""; |
| 10763 | |
| 10764 | ProcessCommands(*(found_function->GetCommandList())); |
| 10765 | |
| 10766 | // Restore the local variables |
| 10767 | for (int i = 0; i < 10; i++) arg_variables[i] = backup_arg_vars[i]; |
| 10768 | for (int i = 0; i < 26; i++) local_variables[i] = backup_local_vars[i]; |
| 10769 | |
| 10770 | return true; |
| 10771 | } |
| 10772 | |
| 10773 | |
| 10774 | int cAnalyze::BatchUtil_GetMaxLength(int batch_id) |
no test coverage detected