| 570 | } |
| 571 | |
| 572 | const 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; |
no test coverage detected