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

Method compileExec

Engine/source/console/codeBlock.cpp:597–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

595}
596
597ConsoleValue CodeBlock::compileExec(StringTableEntry fileName, const char *inString, bool noCalls, S32 setFrame)
598{
599 AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread");
600
601 // Check for a UTF8 script file
602 char *string;
603 chompUTF8BOM(inString, &string);
604
605 STEtoCode = evalSTEtoCode;
606 consoleAllocReset();
607
608 name = fileName;
609
610 if (fileName)
611 {
612 const StringTableEntry exePath = Platform::getMainDotCsDir();
613 const StringTableEntry cwd = Platform::getCurrentDirectory();
614
615 fullPath = NULL;
616
617 if (Platform::isFullPath(fileName))
618 fullPath = fileName;
619
620 if (dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0)
621 name = StringTable->insert(fileName + dStrlen(exePath) + 1, true);
622 else if (dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0)
623 name = StringTable->insert(fileName + dStrlen(cwd) + 1, true);
624
625 if (fullPath == NULL)
626 {
627 char buf[1024];
628 fullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true);
629 }
630
631 modPath = Con::getModNameFromPath(fileName);
632 }
633
634 if (name)
635 addToCodeList();
636
637 gStatementList = NULL;
638
639 // we are an eval compile if we don't have a file name associated (no exec)
640 gIsEvalCompile = fileName == NULL;
641 gFuncVars = gIsEvalCompile ? &gEvalFuncVars : &gGlobalScopeFuncVars;
642
643 // Set up the parser.
644 smCurrentParser = getParserForFile(fileName);
645 AssertISV(smCurrentParser, avar("CodeBlock::compile - no parser available for '%s'!", fileName));
646
647 // Now do some parsing.
648 smCurrentParser->setScanBuffer(string, fileName);
649 smCurrentParser->restart(NULL);
650 smCurrentParser->parse();
651
652 if (!gStatementList)
653 {
654 delete this;

Callers 4

executeFileFunction · 0.80
evaluateFunction · 0.80
evaluatefFunction · 0.80
evaluateExpressionMethod · 0.80

Calls 15

isMainThreadFunction · 0.85
chompUTF8BOMFunction · 0.85
consoleAllocResetFunction · 0.85
dStrnicmpFunction · 0.85
getModNameFromPathFunction · 0.85
getParserForFileFunction · 0.85
avarFunction · 0.85
resetTablesFunction · 0.85
compileBlockFunction · 0.85
getBoolVariableFunction · 0.85
getNumLineBreaksMethod · 0.80
emitCodeStreamMethod · 0.80

Tested by

no test coverage detected