MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / exec

Method exec

Engine/source/console/compiledEval.cpp:611–2353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609
610U32 gExecCount = 0;
611ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNamespace, U32 argc, ConsoleValue* argv, bool noCalls, StringTableEntry packageName, S32 setFrame)
612{
613#ifdef TORQUE_DEBUG
614 U32 stackStart = _STK;
615 gExecCount++;
616#endif
617
618 const dsize_t TRACE_BUFFER_SIZE = 1024;
619 static char traceBuffer[TRACE_BUFFER_SIZE];
620 U32 i;
621
622 U32 iterDepth = 0;
623 ConsoleValue returnValue;
624
625 incRefCount();
626 F64* curFloatTable;
627 char* curStringTable;
628 S32 curStringTableLen = 0; //clint to ensure we dont overwrite it
629
630 StringTableEntry thisFunctionName = NULL;
631 bool popFrame = false;
632 if (argv)
633 {
634 // assume this points into a function decl:
635 U32 fnArgc = code[ip + 2 + 6];
636 U32 regCount = code[ip + 2 + 7];
637 thisFunctionName = CodeToSTE(code, ip);
638 S32 wantedArgc = getMin(argc - 1, fnArgc); // argv[0] is func name
639 if (gEvalState.traceOn)
640 {
641 traceBuffer[0] = 0;
642 dStrcat(traceBuffer, "Entering ", TRACE_BUFFER_SIZE);
643 if (packageName)
644 {
645 dStrcat(traceBuffer, "[", TRACE_BUFFER_SIZE);
646 dStrcat(traceBuffer, packageName, TRACE_BUFFER_SIZE);
647 dStrcat(traceBuffer, "]", TRACE_BUFFER_SIZE);
648 }
649 if (thisNamespace && thisNamespace->mName)
650 {
651 dSprintf(traceBuffer + dStrlen(traceBuffer), sizeof(traceBuffer) - dStrlen(traceBuffer),
652 "%s::%s(", thisNamespace->mName, thisFunctionName);
653 }
654 else
655 {
656 dSprintf(traceBuffer + dStrlen(traceBuffer), sizeof(traceBuffer) - dStrlen(traceBuffer),
657 "%s(", thisFunctionName);
658 }
659 for (i = 0; i < wantedArgc; i++)
660 {
661 dStrcat(traceBuffer, argv[i + 1].getString(), TRACE_BUFFER_SIZE);
662 if (i != wantedArgc - 1)
663 dStrcat(traceBuffer, ", ", TRACE_BUFFER_SIZE);
664 }
665 dStrcat(traceBuffer, ")", TRACE_BUFFER_SIZE);
666 Con::printf("%s", traceBuffer);
667 }
668 gEvalState.pushFrame(thisFunctionName, thisNamespace, regCount);

Callers 10

seFunction · 0.45
jquery.jsFile · 0.45
leFunction · 0.45
weFunction · 0.45
ZeFunction · 0.45
mainFunction · 0.45
executeFileFunction · 0.45
executeMethod · 0.45

Calls 15

CodeToSTEFunction · 0.85
dStrcatFunction · 0.85
dSprintfFunction · 0.85
printfFunction · 0.85
avarFunction · 0.85
getDataBlockGroupFunction · 0.85
dStricmpFunction · 0.85
getRootGroupFunction · 0.85
dStrcpyFunction · 0.85
dAtolFunction · 0.85
memsetFunction · 0.85
getFieldComponentFunction · 0.85

Tested by

no test coverage detected