MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / compileExec

Method compileExec

engine/source/console/codeBlock.cc:572–654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

570}
571
572const char *CodeBlock::compileExec(StringTableEntry fileName, const char *string, bool noCalls, int setFrame)
573{
574 STEtoCode = evalSTEtoCode;
575 consoleAllocReset();
576
577 name = fileName;
578
579 if(fileName)
580 {
581 const StringTableEntry exePath = Platform::getMainDotCsDir();
582 const StringTableEntry cwd = Platform::getCurrentDirectory();
583
584 fullPath = NULL;
585
586 if(Platform::isFullPath(fileName))
587 fullPath = fileName;
588
589 if(dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0)
590 name = StringTable->insert(fileName + dStrlen(exePath) + 1, true);
591 else if(dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0)
592 name = StringTable->insert(fileName + dStrlen(cwd) + 1, true);
593
594 if(fullPath == NULL)
595 {
596 char buf[1024];
597 fullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true);
598 }
599
600 modPath = Con::getModNameFromPath(fileName);
601 }
602
603 if(name)
604 addToCodeList();
605
606 statementList = NULL;
607
608 // Set up the parser.
609 smCurrentParser = getParserForFile(fileName);
610 AssertISV(smCurrentParser, avar("CodeBlock::compile - no parser available for '%s'!", fileName));
611
612 // Now do some parsing.
613 smCurrentParser->setScanBuffer(string, fileName);
614 smCurrentParser->restart(NULL);
615 smCurrentParser->parse();
616
617 if(!statementList)
618 {
619 delete this;
620 return "";
621 }
622
623 resetTables();
624
625 smInFunction = false;
626 smBreakLineCount = 0;
627 setBreakCodeBlock(this);
628
629 codeSize = precompileBlock(statementList, 0) + 1;

Callers 4

evaluateFunction · 0.80
evaluatefFunction · 0.80
evaluateExpressionMethod · 0.80

Calls 14

consoleAllocResetFunction · 0.85
getModNameFromPathFunction · 0.85
getParserForFileFunction · 0.85
avarFunction · 0.85
resetTablesFunction · 0.85
setBreakCodeBlockFunction · 0.85
precompileBlockFunction · 0.85
compileBlockFunction · 0.85
warnfFunction · 0.85
buildMethod · 0.80
dStrnicmpFunction · 0.50
dStrlenFunction · 0.50

Tested by

no test coverage detected