| 56 | } |
| 57 | |
| 58 | void SimConsoleEvent::process(SimObject* object) |
| 59 | { |
| 60 | // #ifdef DEBUG |
| 61 | // Con::printf("Executing schedule: %d", sequenceCount); |
| 62 | // #endif |
| 63 | if(mOnObject) |
| 64 | Con::execute(object, mArgc, mArgv ); |
| 65 | else |
| 66 | { |
| 67 | // Grab the function name. If '::' doesn't exist, then the schedule is |
| 68 | // on a global function. |
| 69 | char funcName[256]; |
| 70 | dStrncpy(funcName, (const char*)mArgv[0], 256); |
| 71 | char* func = dStrstr( funcName, (char*)"::" ); |
| 72 | if( func ) |
| 73 | { |
| 74 | // Set the first colon to NULL, so we can reference the namespace. |
| 75 | // This is okay because events are deleted immediately after |
| 76 | // processing. Maybe a bad idea anyway? |
| 77 | func[0] = '\0'; |
| 78 | |
| 79 | // Move the pointer forward to the function name. |
| 80 | func += 2; |
| 81 | |
| 82 | // Lookup the namespace and function entry. |
| 83 | Namespace* ns = Namespace::find( StringTable->insert( funcName ) ); |
| 84 | if( ns ) |
| 85 | { |
| 86 | Namespace::Entry* nse = ns->lookup( StringTable->insert( func ) ); |
| 87 | if( nse ) |
| 88 | // Execute. |
| 89 | nse->execute( mArgc, mArgv, &gEvalState ); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | else |
| 94 | Con::execute(mArgc, mArgv ); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | void SimConsoleEvent::populateArgs(ConsoleValueRef *argv) |
| 99 | { |
no test coverage detected