Internal execute for global function which does not save the stack
| 1545 | |
| 1546 | // Internal execute for global function which does not save the stack |
| 1547 | ConsoleValue _internalExecute(S32 argc, ConsoleValue argv[]) |
| 1548 | { |
| 1549 | StringTableEntry funcName = StringTable->insert(argv[0].getString()); |
| 1550 | |
| 1551 | const char** argv_str = static_cast<const char**>(malloc((argc - 1) * sizeof(char *))); |
| 1552 | for (int i = 0; i < argc - 1; i++) |
| 1553 | { |
| 1554 | argv_str[i] = argv[i + 1].getString(); |
| 1555 | } |
| 1556 | bool result; |
| 1557 | const char* methodRes = CInterface::CallFunction(NULL, funcName, argv_str, argc - 1, &result); |
| 1558 | free(argv_str); |
| 1559 | if (result) |
| 1560 | { |
| 1561 | ConsoleValue ret; |
| 1562 | ret.setString(methodRes); |
| 1563 | return std::move(ret); |
| 1564 | } |
| 1565 | |
| 1566 | Namespace::Entry *ent; |
| 1567 | |
| 1568 | ent = Namespace::global()->lookup(funcName); |
| 1569 | |
| 1570 | if(!ent) |
| 1571 | { |
| 1572 | warnf(ConsoleLogEntry::Script, "%s: Unknown command.", funcName); |
| 1573 | |
| 1574 | STR.clearFunctionOffset(); |
| 1575 | return std::move(ConsoleValue()); |
| 1576 | } |
| 1577 | |
| 1578 | return std::move(ent->execute(argc, argv, &gEvalState)); |
| 1579 | } |
| 1580 | |
| 1581 | ConsoleValue execute(S32 argc, ConsoleValue argv[]) |
| 1582 | { |
no test coverage detected