mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-20 07:03:46 +00:00
Rename all member variables to follow the style guidelines (prefixed with the 'm') - class CodeBlock
This commit is contained in:
parent
47dbce1499
commit
cf3eb26e6f
6 changed files with 302 additions and 302 deletions
|
|
@ -82,10 +82,10 @@ void StmtNode::addBreakLine(U32 ip)
|
|||
U32 line = CodeBlock::smBreakLineCount * 2;
|
||||
CodeBlock::smBreakLineCount++;
|
||||
|
||||
if(getBreakCodeBlock()->lineBreakPairs)
|
||||
if(getBreakCodeBlock()->mLineBreakPairs)
|
||||
{
|
||||
getBreakCodeBlock()->lineBreakPairs[line] = dbgLineNumber;
|
||||
getBreakCodeBlock()->lineBreakPairs[line+1] = ip;
|
||||
getBreakCodeBlock()->mLineBreakPairs[line] = dbgLineNumber;
|
||||
getBreakCodeBlock()->mLineBreakPairs[line+1] = ip;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,21 +42,21 @@ ConsoleParser *CodeBlock::smCurrentParser = NULL;
|
|||
|
||||
CodeBlock::CodeBlock()
|
||||
{
|
||||
globalStrings = NULL;
|
||||
functionStrings = NULL;
|
||||
functionStringsMaxLen = 0;
|
||||
globalStringsMaxLen = 0;
|
||||
globalFloats = NULL;
|
||||
functionFloats = NULL;
|
||||
lineBreakPairs = NULL;
|
||||
breakList = NULL;
|
||||
breakListSize = 0;
|
||||
mGlobalStrings = NULL;
|
||||
mFunctionStrings = NULL;
|
||||
mFunctionStringsMaxLen = 0;
|
||||
mGlobalStringsMaxLen = 0;
|
||||
mGlobalFloats = NULL;
|
||||
mFunctionFloats = NULL;
|
||||
mLineBreakPairs = NULL;
|
||||
mBreakList = NULL;
|
||||
mBreakListSize = 0;
|
||||
|
||||
refCount = 0;
|
||||
code = NULL;
|
||||
name = NULL;
|
||||
fullPath = NULL;
|
||||
modPath = NULL;
|
||||
mRefCount = 0;
|
||||
mCode = NULL;
|
||||
mName = NULL;
|
||||
mFullPath = NULL;
|
||||
mModPath = NULL;
|
||||
}
|
||||
|
||||
CodeBlock::~CodeBlock()
|
||||
|
|
@ -64,18 +64,18 @@ CodeBlock::~CodeBlock()
|
|||
// Make sure we aren't lingering in the current code block...
|
||||
AssertFatal(smCurrentCodeBlock != this, "CodeBlock::~CodeBlock - Caught lingering in smCurrentCodeBlock!")
|
||||
|
||||
if(name)
|
||||
if(mName)
|
||||
removeFromCodeList();
|
||||
delete[] const_cast<char*>(globalStrings);
|
||||
delete[] const_cast<char*>(functionStrings);
|
||||
delete[] const_cast<char*>(mGlobalStrings);
|
||||
delete[] const_cast<char*>(mFunctionStrings);
|
||||
|
||||
functionStringsMaxLen = 0;
|
||||
globalStringsMaxLen = 0;
|
||||
mFunctionStringsMaxLen = 0;
|
||||
mGlobalStringsMaxLen = 0;
|
||||
|
||||
delete[] globalFloats;
|
||||
delete[] functionFloats;
|
||||
delete[] code;
|
||||
delete[] breakList;
|
||||
delete[] mGlobalFloats;
|
||||
delete[] mFunctionFloats;
|
||||
delete[] mCode;
|
||||
delete[] mBreakList;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
@ -83,7 +83,7 @@ CodeBlock::~CodeBlock()
|
|||
StringTableEntry CodeBlock::getCurrentCodeBlockName()
|
||||
{
|
||||
if (CodeBlock::getCurrentBlock())
|
||||
return CodeBlock::getCurrentBlock()->name;
|
||||
return CodeBlock::getCurrentBlock()->mName;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ StringTableEntry CodeBlock::getCurrentCodeBlockName()
|
|||
StringTableEntry CodeBlock::getCurrentCodeBlockFullPath()
|
||||
{
|
||||
if (CodeBlock::getCurrentBlock())
|
||||
return CodeBlock::getCurrentBlock()->fullPath;
|
||||
return CodeBlock::getCurrentBlock()->mFullPath;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -99,15 +99,15 @@ StringTableEntry CodeBlock::getCurrentCodeBlockFullPath()
|
|||
StringTableEntry CodeBlock::getCurrentCodeBlockModName()
|
||||
{
|
||||
if (CodeBlock::getCurrentBlock())
|
||||
return CodeBlock::getCurrentBlock()->modPath;
|
||||
return CodeBlock::getCurrentBlock()->mModPath;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CodeBlock *CodeBlock::find(StringTableEntry name)
|
||||
{
|
||||
for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile)
|
||||
if(walk->name == name)
|
||||
for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->mNextFile)
|
||||
if(walk->mName == name)
|
||||
return walk;
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -117,39 +117,39 @@ CodeBlock *CodeBlock::find(StringTableEntry name)
|
|||
void CodeBlock::addToCodeList()
|
||||
{
|
||||
// remove any code blocks with my name
|
||||
for(CodeBlock **walk = &smCodeBlockList; *walk;walk = &((*walk)->nextFile))
|
||||
for(CodeBlock **walk = &smCodeBlockList; *walk;walk = &((*walk)->mNextFile))
|
||||
{
|
||||
if((*walk)->name == name)
|
||||
if((*walk)->mName == mName)
|
||||
{
|
||||
*walk = (*walk)->nextFile;
|
||||
*walk = (*walk)->mNextFile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
nextFile = smCodeBlockList;
|
||||
mNextFile = smCodeBlockList;
|
||||
smCodeBlockList = this;
|
||||
}
|
||||
|
||||
void CodeBlock::clearAllBreaks()
|
||||
{
|
||||
if(!lineBreakPairs)
|
||||
if(!mLineBreakPairs)
|
||||
return;
|
||||
for(U32 i = 0; i < lineBreakPairCount; i++)
|
||||
for(U32 i = 0; i < mLineBreakPairCount; i++)
|
||||
{
|
||||
U32 *p = lineBreakPairs + i * 2;
|
||||
code[p[1]] = p[0] & 0xFF;
|
||||
U32 *p = mLineBreakPairs + i * 2;
|
||||
mCode[p[1]] = p[0] & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
void CodeBlock::clearBreakpoint(U32 lineNumber)
|
||||
{
|
||||
if(!lineBreakPairs)
|
||||
if(!mLineBreakPairs)
|
||||
return;
|
||||
for(U32 i = 0; i < lineBreakPairCount; i++)
|
||||
for(U32 i = 0; i < mLineBreakPairCount; i++)
|
||||
{
|
||||
U32 *p = lineBreakPairs + i * 2;
|
||||
U32 *p = mLineBreakPairs + i * 2;
|
||||
if((p[0] >> 8) == lineNumber)
|
||||
{
|
||||
code[p[1]] = p[0] & 0xFF;
|
||||
mCode[p[1]] = p[0] & 0xFF;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -157,26 +157,26 @@ void CodeBlock::clearBreakpoint(U32 lineNumber)
|
|||
|
||||
void CodeBlock::setAllBreaks()
|
||||
{
|
||||
if(!lineBreakPairs)
|
||||
if(!mLineBreakPairs)
|
||||
return;
|
||||
for(U32 i = 0; i < lineBreakPairCount; i++)
|
||||
for(U32 i = 0; i < mLineBreakPairCount; i++)
|
||||
{
|
||||
U32 *p = lineBreakPairs + i * 2;
|
||||
code[p[1]] = OP_BREAK;
|
||||
U32 *p = mLineBreakPairs + i * 2;
|
||||
mCode[p[1]] = OP_BREAK;
|
||||
}
|
||||
}
|
||||
|
||||
bool CodeBlock::setBreakpoint(U32 lineNumber)
|
||||
{
|
||||
if(!lineBreakPairs)
|
||||
if(!mLineBreakPairs)
|
||||
return false;
|
||||
|
||||
for(U32 i = 0; i < lineBreakPairCount; i++)
|
||||
for(U32 i = 0; i < mLineBreakPairCount; i++)
|
||||
{
|
||||
U32 *p = lineBreakPairs + i * 2;
|
||||
U32 *p = mLineBreakPairs + i * 2;
|
||||
if((p[0] >> 8) == lineNumber)
|
||||
{
|
||||
code[p[1]] = OP_BREAK;
|
||||
mCode[p[1]] = OP_BREAK;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -186,12 +186,12 @@ bool CodeBlock::setBreakpoint(U32 lineNumber)
|
|||
|
||||
U32 CodeBlock::findFirstBreakLine(U32 lineNumber)
|
||||
{
|
||||
if(!lineBreakPairs)
|
||||
if(!mLineBreakPairs)
|
||||
return 0;
|
||||
|
||||
for(U32 i = 0; i < lineBreakPairCount; i++)
|
||||
for(U32 i = 0; i < mLineBreakPairCount; i++)
|
||||
{
|
||||
U32 *p = lineBreakPairs + i * 2;
|
||||
U32 *p = mLineBreakPairs + i * 2;
|
||||
U32 line = (p[0] >> 8);
|
||||
|
||||
if( lineNumber <= line )
|
||||
|
|
@ -210,11 +210,11 @@ struct LinePair
|
|||
void CodeBlock::findBreakLine(U32 ip, U32 &line, U32 &instruction)
|
||||
{
|
||||
U32 min = 0;
|
||||
U32 max = lineBreakPairCount - 1;
|
||||
LinePair *p = (LinePair *) lineBreakPairs;
|
||||
U32 max = mLineBreakPairCount - 1;
|
||||
LinePair *p = (LinePair *) mLineBreakPairs;
|
||||
|
||||
U32 found;
|
||||
if(!lineBreakPairCount || p[min].ip > ip || p[max].ip < ip)
|
||||
if(!mLineBreakPairCount || p[min].ip > ip || p[max].ip < ip)
|
||||
{
|
||||
line = 0;
|
||||
instruction = OP_INVALID;
|
||||
|
|
@ -255,17 +255,17 @@ const char *CodeBlock::getFileLine(U32 ip)
|
|||
U32 line, inst;
|
||||
findBreakLine(ip, line, inst);
|
||||
|
||||
dSprintf(nameBuffer, sizeof(nameBuffer), "%s (%d)", name ? name : "<input>", line);
|
||||
dSprintf(nameBuffer, sizeof(nameBuffer), "%s (%d)", mName ? mName : "<input>", line);
|
||||
return nameBuffer;
|
||||
}
|
||||
|
||||
void CodeBlock::removeFromCodeList()
|
||||
{
|
||||
for(CodeBlock **walk = &smCodeBlockList; *walk; walk = &((*walk)->nextFile))
|
||||
for(CodeBlock **walk = &smCodeBlockList; *walk; walk = &((*walk)->mNextFile))
|
||||
{
|
||||
if(*walk == this)
|
||||
{
|
||||
*walk = nextFile;
|
||||
*walk = mNextFile;
|
||||
|
||||
// clear out all breakpoints
|
||||
clearAllBreaks();
|
||||
|
|
@ -286,9 +286,9 @@ void CodeBlock::calcBreakList()
|
|||
S32 line = -1;
|
||||
U32 seqCount = 0;
|
||||
U32 i;
|
||||
for(i = 0; i < lineBreakPairCount; i++)
|
||||
for(i = 0; i < mLineBreakPairCount; i++)
|
||||
{
|
||||
U32 lineNumber = lineBreakPairs[i * 2];
|
||||
U32 lineNumber = mLineBreakPairs[i * 2];
|
||||
if(lineNumber == U32(line + 1))
|
||||
seqCount++;
|
||||
else
|
||||
|
|
@ -303,23 +303,23 @@ void CodeBlock::calcBreakList()
|
|||
if(seqCount)
|
||||
size++;
|
||||
|
||||
breakList = new U32[size];
|
||||
breakListSize = size;
|
||||
mBreakList = new U32[size];
|
||||
mBreakListSize = size;
|
||||
line = -1;
|
||||
seqCount = 0;
|
||||
size = 0;
|
||||
|
||||
for(i = 0; i < lineBreakPairCount; i++)
|
||||
for(i = 0; i < mLineBreakPairCount; i++)
|
||||
{
|
||||
U32 lineNumber = lineBreakPairs[i * 2];
|
||||
U32 lineNumber = mLineBreakPairs[i * 2];
|
||||
|
||||
if(lineNumber == U32(line + 1))
|
||||
seqCount++;
|
||||
else
|
||||
{
|
||||
if(seqCount)
|
||||
breakList[size++] = seqCount;
|
||||
breakList[size++] = lineNumber - getMax(0, line) - 1;
|
||||
mBreakList[size++] = seqCount;
|
||||
mBreakList[size++] = lineNumber - getMax(0, line) - 1;
|
||||
seqCount = 1;
|
||||
}
|
||||
|
||||
|
|
@ -327,12 +327,12 @@ void CodeBlock::calcBreakList()
|
|||
}
|
||||
|
||||
if(seqCount)
|
||||
breakList[size++] = seqCount;
|
||||
mBreakList[size++] = seqCount;
|
||||
|
||||
for(i = 0; i < lineBreakPairCount; i++)
|
||||
for(i = 0; i < mLineBreakPairCount; i++)
|
||||
{
|
||||
U32 *p = lineBreakPairs + i * 2;
|
||||
p[0] = (p[0] << 8) | code[p[1]];
|
||||
U32 *p = mLineBreakPairs + i * 2;
|
||||
p[0] = (p[0] << 8) | mCode[p[1]];
|
||||
}
|
||||
|
||||
// Let the telnet debugger know that this code
|
||||
|
|
@ -347,27 +347,27 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
|
|||
const StringTableEntry exePath = Platform::getMainDotCsDir();
|
||||
const StringTableEntry cwd = Platform::getCurrentDirectory();
|
||||
|
||||
name = fileName;
|
||||
mName = fileName;
|
||||
|
||||
if(fileName)
|
||||
{
|
||||
fullPath = NULL;
|
||||
mFullPath = NULL;
|
||||
|
||||
if(Platform::isFullPath(fileName))
|
||||
fullPath = fileName;
|
||||
mFullPath = fileName;
|
||||
|
||||
if(dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0)
|
||||
name = StringTable->insert(fileName + dStrlen(exePath) + 1, true);
|
||||
mName = StringTable->insert(fileName + dStrlen(exePath) + 1, true);
|
||||
else if(dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0)
|
||||
name = StringTable->insert(fileName + dStrlen(cwd) + 1, true);
|
||||
mName = StringTable->insert(fileName + dStrlen(cwd) + 1, true);
|
||||
|
||||
if(fullPath == NULL)
|
||||
if(mFullPath == NULL)
|
||||
{
|
||||
char buf[1024];
|
||||
fullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true);
|
||||
mFullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true);
|
||||
}
|
||||
|
||||
modPath = Con::getModNameFromPath(fileName);
|
||||
mModPath = Con::getModNameFromPath(fileName);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -377,53 +377,53 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
|
|||
st.read(&size);
|
||||
if(size)
|
||||
{
|
||||
globalStrings = new char[size];
|
||||
globalStringsMaxLen = size;
|
||||
st.read(size, globalStrings);
|
||||
mGlobalStrings = new char[size];
|
||||
mGlobalStringsMaxLen = size;
|
||||
st.read(size, mGlobalStrings);
|
||||
}
|
||||
globalSize = size;
|
||||
st.read(&size);
|
||||
if(size)
|
||||
{
|
||||
functionStrings = new char[size];
|
||||
functionStringsMaxLen = size;
|
||||
st.read(size, functionStrings);
|
||||
mFunctionStrings = new char[size];
|
||||
mFunctionStringsMaxLen = size;
|
||||
st.read(size, mFunctionStrings);
|
||||
}
|
||||
st.read(&size);
|
||||
if(size)
|
||||
{
|
||||
globalFloats = new F64[size];
|
||||
mGlobalFloats = new F64[size];
|
||||
for(U32 i = 0; i < size; i++)
|
||||
st.read(&globalFloats[i]);
|
||||
st.read(&mGlobalFloats[i]);
|
||||
}
|
||||
st.read(&size);
|
||||
if(size)
|
||||
{
|
||||
functionFloats = new F64[size];
|
||||
mFunctionFloats = new F64[size];
|
||||
for(U32 i = 0; i < size; i++)
|
||||
st.read(&functionFloats[i]);
|
||||
st.read(&mFunctionFloats[i]);
|
||||
}
|
||||
U32 codeSize;
|
||||
st.read(&codeSize);
|
||||
st.read(&lineBreakPairCount);
|
||||
st.read(&mLineBreakPairCount);
|
||||
|
||||
U32 totSize = codeSize + lineBreakPairCount * 2;
|
||||
code = new U32[totSize];
|
||||
U32 totSize = codeSize + mLineBreakPairCount * 2;
|
||||
mCode = new U32[totSize];
|
||||
|
||||
for(i = 0; i < codeSize; i++)
|
||||
{
|
||||
U8 b;
|
||||
st.read(&b);
|
||||
if(b == 0xFF)
|
||||
st.read(&code[i]);
|
||||
st.read(&mCode[i]);
|
||||
else
|
||||
code[i] = b;
|
||||
mCode[i] = b;
|
||||
}
|
||||
|
||||
for(i = codeSize; i < totSize; i++)
|
||||
st.read(&code[i]);
|
||||
st.read(&mCode[i]);
|
||||
|
||||
lineBreakPairs = code + codeSize;
|
||||
mLineBreakPairs = mCode + codeSize;
|
||||
|
||||
// StringTable-ize our identifiers.
|
||||
U32 identCount;
|
||||
|
|
@ -434,7 +434,7 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
|
|||
st.read(&offset);
|
||||
StringTableEntry ste;
|
||||
if(offset < globalSize)
|
||||
ste = StringTable->insert(globalStrings + offset);
|
||||
ste = StringTable->insert(mGlobalStrings + offset);
|
||||
else
|
||||
ste = StringTable->insert("");
|
||||
U32 count;
|
||||
|
|
@ -443,11 +443,11 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
|
|||
{
|
||||
U32 ip;
|
||||
st.read(&ip);
|
||||
code[ip] = *((U32 *) &ste);
|
||||
mCode[ip] = *((U32 *) &ste);
|
||||
}
|
||||
}
|
||||
|
||||
if(lineBreakPairCount)
|
||||
if(mLineBreakPairCount)
|
||||
calcBreakList();
|
||||
|
||||
return true;
|
||||
|
|
@ -501,13 +501,13 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con
|
|||
setBreakCodeBlock(this);
|
||||
|
||||
if(gStatementList)
|
||||
codeSize = precompileBlock(gStatementList, 0) + 1;
|
||||
mCodeSize = precompileBlock(gStatementList, 0) + 1;
|
||||
else
|
||||
codeSize = 1;
|
||||
mCodeSize = 1;
|
||||
|
||||
lineBreakPairCount = smBreakLineCount;
|
||||
code = new U32[codeSize + smBreakLineCount * 2];
|
||||
lineBreakPairs = code + codeSize;
|
||||
mLineBreakPairCount = smBreakLineCount;
|
||||
mCode = new U32[mCodeSize + smBreakLineCount * 2];
|
||||
mLineBreakPairs = mCode + mCodeSize;
|
||||
|
||||
// Write string table data...
|
||||
getGlobalStringTable().write(st);
|
||||
|
|
@ -520,34 +520,34 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con
|
|||
smBreakLineCount = 0;
|
||||
U32 lastIp;
|
||||
if(gStatementList)
|
||||
lastIp = compileBlock(gStatementList, code, 0, 0, 0);
|
||||
lastIp = compileBlock(gStatementList, mCode, 0, 0, 0);
|
||||
else
|
||||
lastIp = 0;
|
||||
|
||||
if(lastIp != codeSize - 1)
|
||||
if(lastIp != mCodeSize - 1)
|
||||
Con::errorf(ConsoleLogEntry::General, "CodeBlock::compile - precompile size mismatch, a precompile/compile function pair is probably mismatched.");
|
||||
|
||||
code[lastIp++] = OP_RETURN;
|
||||
U32 totSize = codeSize + smBreakLineCount * 2;
|
||||
st.write(codeSize);
|
||||
st.write(lineBreakPairCount);
|
||||
mCode[lastIp++] = OP_RETURN;
|
||||
U32 totSize = mCodeSize + smBreakLineCount * 2;
|
||||
st.write(mCodeSize);
|
||||
st.write(mLineBreakPairCount);
|
||||
|
||||
// Write out our bytecode, doing a bit of compression for low numbers.
|
||||
U32 i;
|
||||
for(i = 0; i < codeSize; i++)
|
||||
for(i = 0; i < mCodeSize; i++)
|
||||
{
|
||||
if(code[i] < 0xFF)
|
||||
st.write(U8(code[i]));
|
||||
if(mCode[i] < 0xFF)
|
||||
st.write(U8(mCode[i]));
|
||||
else
|
||||
{
|
||||
st.write(U8(0xFF));
|
||||
st.write(code[i]);
|
||||
st.write(mCode[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Write the break info...
|
||||
for(i = codeSize; i < totSize; i++)
|
||||
st.write(code[i]);
|
||||
for(i = mCodeSize; i < totSize; i++)
|
||||
st.write(mCode[i]);
|
||||
|
||||
getIdentTable().write(st);
|
||||
|
||||
|
|
@ -568,33 +568,33 @@ const char *CodeBlock::compileExec(StringTableEntry fileName, const char *inStri
|
|||
STEtoU32 = evalSTEtoU32;
|
||||
consoleAllocReset();
|
||||
|
||||
name = fileName;
|
||||
mName = fileName;
|
||||
|
||||
if(fileName)
|
||||
{
|
||||
const StringTableEntry exePath = Platform::getMainDotCsDir();
|
||||
const StringTableEntry cwd = Platform::getCurrentDirectory();
|
||||
|
||||
fullPath = NULL;
|
||||
mFullPath = NULL;
|
||||
|
||||
if(Platform::isFullPath(fileName))
|
||||
fullPath = fileName;
|
||||
mFullPath = fileName;
|
||||
|
||||
if(dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0)
|
||||
name = StringTable->insert(fileName + dStrlen(exePath) + 1, true);
|
||||
mName = StringTable->insert(fileName + dStrlen(exePath) + 1, true);
|
||||
else if(dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0)
|
||||
name = StringTable->insert(fileName + dStrlen(cwd) + 1, true);
|
||||
mName = StringTable->insert(fileName + dStrlen(cwd) + 1, true);
|
||||
|
||||
if(fullPath == NULL)
|
||||
if(mFullPath == NULL)
|
||||
{
|
||||
char buf[1024];
|
||||
fullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true);
|
||||
mFullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true);
|
||||
}
|
||||
|
||||
modPath = Con::getModNameFromPath(fileName);
|
||||
mModPath = Con::getModNameFromPath(fileName);
|
||||
}
|
||||
|
||||
if(name)
|
||||
if(mName)
|
||||
addToCodeList();
|
||||
|
||||
gStatementList = NULL;
|
||||
|
|
@ -620,33 +620,33 @@ const char *CodeBlock::compileExec(StringTableEntry fileName, const char *inStri
|
|||
smBreakLineCount = 0;
|
||||
setBreakCodeBlock(this);
|
||||
|
||||
codeSize = precompileBlock(gStatementList, 0) + 1;
|
||||
mCodeSize = precompileBlock(gStatementList, 0) + 1;
|
||||
|
||||
lineBreakPairCount = smBreakLineCount;
|
||||
mLineBreakPairCount = smBreakLineCount;
|
||||
|
||||
globalStrings = getGlobalStringTable().build();
|
||||
globalStringsMaxLen = getGlobalStringTable().totalLen;
|
||||
mGlobalStrings = getGlobalStringTable().build();
|
||||
mGlobalStringsMaxLen = getGlobalStringTable().totalLen;
|
||||
|
||||
functionStrings = getFunctionStringTable().build();
|
||||
functionStringsMaxLen = getFunctionStringTable().totalLen;
|
||||
mFunctionStrings = getFunctionStringTable().build();
|
||||
mFunctionStringsMaxLen = getFunctionStringTable().totalLen;
|
||||
|
||||
globalFloats = getGlobalFloatTable().build();
|
||||
functionFloats = getFunctionFloatTable().build();
|
||||
mGlobalFloats = getGlobalFloatTable().build();
|
||||
mFunctionFloats = getFunctionFloatTable().build();
|
||||
|
||||
code = new U32[codeSize + lineBreakPairCount * 2];
|
||||
lineBreakPairs = code + codeSize;
|
||||
mCode = new U32[mCodeSize + mLineBreakPairCount * 2];
|
||||
mLineBreakPairs = mCode + mCodeSize;
|
||||
|
||||
smBreakLineCount = 0;
|
||||
U32 lastIp = compileBlock(gStatementList, code, 0, 0, 0);
|
||||
code[lastIp++] = OP_RETURN;
|
||||
U32 lastIp = compileBlock(gStatementList, mCode, 0, 0, 0);
|
||||
mCode[lastIp++] = OP_RETURN;
|
||||
|
||||
consoleAllocReset();
|
||||
|
||||
if(lineBreakPairCount && fileName)
|
||||
if(mLineBreakPairCount && fileName)
|
||||
calcBreakList();
|
||||
|
||||
if(lastIp != codeSize)
|
||||
Con::warnf(ConsoleLogEntry::General, "precompile size mismatch, precompile: %d compile: %d", codeSize, lastIp);
|
||||
if(lastIp != mCodeSize)
|
||||
Con::warnf(ConsoleLogEntry::General, "precompile size mismatch, precompile: %d compile: %d", mCodeSize, lastIp);
|
||||
|
||||
return exec(0, fileName, NULL, 0, 0, noCalls, NULL, setFrame);
|
||||
}
|
||||
|
|
@ -655,13 +655,13 @@ const char *CodeBlock::compileExec(StringTableEntry fileName, const char *inStri
|
|||
|
||||
void CodeBlock::incRefCount()
|
||||
{
|
||||
refCount++;
|
||||
mRefCount++;
|
||||
}
|
||||
|
||||
void CodeBlock::decRefCount()
|
||||
{
|
||||
refCount--;
|
||||
if(!refCount)
|
||||
mRefCount--;
|
||||
if(!mRefCount)
|
||||
delete this;
|
||||
}
|
||||
|
||||
|
|
@ -671,10 +671,10 @@ String CodeBlock::getFunctionArgs( U32 ip )
|
|||
{
|
||||
StringBuilder str;
|
||||
|
||||
U32 fnArgc = code[ ip + 5 ];
|
||||
U32 fnArgc = mCode[ ip + 5 ];
|
||||
for( U32 i = 0; i < fnArgc; ++ i )
|
||||
{
|
||||
StringTableEntry var = U32toSTE( code[ ip + i + 6 ] );
|
||||
StringTableEntry var = U32toSTE( mCode[ ip + i + 6 ] );
|
||||
|
||||
if( i != 0 )
|
||||
str.append( ", " );
|
||||
|
|
@ -696,18 +696,18 @@ String CodeBlock::getFunctionArgs( U32 ip )
|
|||
void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
||||
{
|
||||
U32 ip = startIp;
|
||||
while( ip < codeSize )
|
||||
while( ip < mCodeSize )
|
||||
{
|
||||
switch( code[ ip ++ ] )
|
||||
switch( mCode[ ip ++ ] )
|
||||
{
|
||||
case OP_FUNC_DECL:
|
||||
{
|
||||
StringTableEntry fnName = U32toSTE(code[ip]);
|
||||
StringTableEntry fnNamespace = U32toSTE(code[ip+1]);
|
||||
StringTableEntry fnPackage = U32toSTE(code[ip+2]);
|
||||
bool hasBody = bool(code[ip+3]);
|
||||
U32 newIp = code[ ip + 4 ];
|
||||
U32 argc = code[ ip + 5 ];
|
||||
StringTableEntry fnName = U32toSTE(mCode[ip]);
|
||||
StringTableEntry fnNamespace = U32toSTE(mCode[ip+1]);
|
||||
StringTableEntry fnPackage = U32toSTE(mCode[ip+2]);
|
||||
bool hasBody = bool(mCode[ip+3]);
|
||||
U32 newIp = mCode[ ip + 4 ];
|
||||
U32 argc = mCode[ ip + 5 ];
|
||||
|
||||
Con::printf( "%i: OP_FUNC_DECL name=%s nspace=%s package=%s hasbody=%i newip=%i argc=%i",
|
||||
ip - 1, fnName, fnNamespace, fnPackage, hasBody, newIp, argc );
|
||||
|
|
@ -720,12 +720,12 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_CREATE_OBJECT:
|
||||
{
|
||||
StringTableEntry objParent = U32toSTE(code[ip ]);
|
||||
bool isDataBlock = code[ip + 1];
|
||||
bool isInternal = code[ip + 2];
|
||||
bool isSingleton = code[ip + 3];
|
||||
U32 lineNumber = code[ip + 4];
|
||||
U32 failJump = code[ip + 5];
|
||||
StringTableEntry objParent = U32toSTE(mCode[ip ]);
|
||||
bool isDataBlock = mCode[ip + 1];
|
||||
bool isInternal = mCode[ip + 2];
|
||||
bool isSingleton = mCode[ip + 3];
|
||||
U32 lineNumber = mCode[ip + 4];
|
||||
U32 failJump = mCode[ip + 5];
|
||||
|
||||
Con::printf( "%i: OP_CREATE_OBJECT objParent=%s isDataBlock=%i isInternal=%i isSingleton=%i lineNumber=%i failJump=%i",
|
||||
ip - 1, objParent, isDataBlock, isInternal, isSingleton, lineNumber, failJump );
|
||||
|
|
@ -736,14 +736,14 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_ADD_OBJECT:
|
||||
{
|
||||
bool placeAtRoot = code[ip++];
|
||||
bool placeAtRoot = mCode[ip++];
|
||||
Con::printf( "%i: OP_ADD_OBJECT placeAtRoot=%i", ip - 1, placeAtRoot );
|
||||
break;
|
||||
}
|
||||
|
||||
case OP_END_OBJECT:
|
||||
{
|
||||
bool placeAtRoot = code[ip++];
|
||||
bool placeAtRoot = mCode[ip++];
|
||||
Con::printf( "%i: OP_END_OBJECT placeAtRoot=%i", ip - 1, placeAtRoot );
|
||||
break;
|
||||
}
|
||||
|
|
@ -756,49 +756,49 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_JMPIFFNOT:
|
||||
{
|
||||
Con::printf( "%i: OP_JMPIFFNOT ip=%i", ip - 1, code[ ip ] );
|
||||
Con::printf( "%i: OP_JMPIFFNOT ip=%i", ip - 1, mCode[ ip ] );
|
||||
++ ip;
|
||||
break;
|
||||
}
|
||||
|
||||
case OP_JMPIFNOT:
|
||||
{
|
||||
Con::printf( "%i: OP_JMPIFNOT ip=%i", ip - 1, code[ ip ] );
|
||||
Con::printf( "%i: OP_JMPIFNOT ip=%i", ip - 1, mCode[ ip ] );
|
||||
++ ip;
|
||||
break;
|
||||
}
|
||||
|
||||
case OP_JMPIFF:
|
||||
{
|
||||
Con::printf( "%i: OP_JMPIFF ip=%i", ip - 1, code[ ip ] );
|
||||
Con::printf( "%i: OP_JMPIFF ip=%i", ip - 1, mCode[ ip ] );
|
||||
++ ip;
|
||||
break;
|
||||
}
|
||||
|
||||
case OP_JMPIF:
|
||||
{
|
||||
Con::printf( "%i: OP_JMPIF ip=%i", ip - 1, code[ ip ] );
|
||||
Con::printf( "%i: OP_JMPIF ip=%i", ip - 1, mCode[ ip ] );
|
||||
++ ip;
|
||||
break;
|
||||
}
|
||||
|
||||
case OP_JMPIFNOT_NP:
|
||||
{
|
||||
Con::printf( "%i: OP_JMPIFNOT_NP ip=%i", ip - 1, code[ ip ] );
|
||||
Con::printf( "%i: OP_JMPIFNOT_NP ip=%i", ip - 1, mCode[ ip ] );
|
||||
++ ip;
|
||||
break;
|
||||
}
|
||||
|
||||
case OP_JMPIF_NP:
|
||||
{
|
||||
Con::printf( "%i: OP_JMPIF_NP ip=%i", ip - 1, code[ ip ] );
|
||||
Con::printf( "%i: OP_JMPIF_NP ip=%i", ip - 1, mCode[ ip ] );
|
||||
++ ip;
|
||||
break;
|
||||
}
|
||||
|
||||
case OP_JMP:
|
||||
{
|
||||
Con::printf( "%i: OP_JMP ip=%i", ip - 1, code[ ip ] );
|
||||
Con::printf( "%i: OP_JMP ip=%i", ip - 1, mCode[ ip ] );
|
||||
++ ip;
|
||||
break;
|
||||
}
|
||||
|
|
@ -957,7 +957,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_SETCURVAR:
|
||||
{
|
||||
StringTableEntry var = U32toSTE(code[ip]);
|
||||
StringTableEntry var = U32toSTE(mCode[ip]);
|
||||
|
||||
Con::printf( "%i: OP_SETCURVAR var=%s", ip - 1, var );
|
||||
ip++;
|
||||
|
|
@ -966,7 +966,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_SETCURVAR_CREATE:
|
||||
{
|
||||
StringTableEntry var = U32toSTE(code[ip]);
|
||||
StringTableEntry var = U32toSTE(mCode[ip]);
|
||||
|
||||
Con::printf( "%i: OP_SETCURVAR_CREATE var=%s", ip - 1, var );
|
||||
ip++;
|
||||
|
|
@ -1042,7 +1042,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_SETCURFIELD:
|
||||
{
|
||||
StringTableEntry curField = U32toSTE(code[ip]);
|
||||
StringTableEntry curField = U32toSTE(mCode[ip]);
|
||||
Con::printf( "%i: OP_SETCURFIELD field=%s", ip - 1, curField );
|
||||
++ ip;
|
||||
}
|
||||
|
|
@ -1055,7 +1055,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_SETCURFIELD_TYPE:
|
||||
{
|
||||
U32 type = code[ ip ];
|
||||
U32 type = mCode[ ip ];
|
||||
Con::printf( "%i: OP_SETCURFIELD_TYPE type=%i", ip - 1, type );
|
||||
++ ip;
|
||||
break;
|
||||
|
|
@ -1153,7 +1153,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_LOADIMMED_UINT:
|
||||
{
|
||||
U32 val = code[ ip ];
|
||||
U32 val = mCode[ ip ];
|
||||
Con::printf( "%i: OP_LOADIMMED_UINT val=%i", ip - 1, val );
|
||||
++ ip;
|
||||
break;
|
||||
|
|
@ -1161,7 +1161,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_LOADIMMED_FLT:
|
||||
{
|
||||
F64 val = functionFloats[ code[ ip ] ];
|
||||
F64 val = mFunctionFloats[ mCode[ ip ] ];
|
||||
Con::printf( "%i: OP_LOADIMMED_FLT val=%f", ip - 1, val );
|
||||
++ ip;
|
||||
break;
|
||||
|
|
@ -1169,7 +1169,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_TAG_TO_STR:
|
||||
{
|
||||
const char* str = functionStrings + code[ ip ];
|
||||
const char* str = mFunctionStrings + mCode[ ip ];
|
||||
Con::printf( "%i: OP_TAG_TO_STR str=%s", ip - 1, str );
|
||||
++ ip;
|
||||
break;
|
||||
|
|
@ -1177,7 +1177,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_LOADIMMED_STR:
|
||||
{
|
||||
const char* str = functionStrings + code[ ip ];
|
||||
const char* str = mFunctionStrings + mCode[ ip ];
|
||||
Con::printf( "%i: OP_LOADIMMED_STR str=%s", ip - 1, str );
|
||||
++ ip;
|
||||
break;
|
||||
|
|
@ -1185,7 +1185,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_DOCBLOCK_STR:
|
||||
{
|
||||
const char* str = functionStrings + code[ ip ];
|
||||
const char* str = mFunctionStrings + mCode[ ip ];
|
||||
Con::printf( "%i: OP_DOCBLOCK_STR str=%s", ip - 1, str );
|
||||
++ ip;
|
||||
break;
|
||||
|
|
@ -1193,7 +1193,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_LOADIMMED_IDENT:
|
||||
{
|
||||
StringTableEntry str = U32toSTE( code[ ip ] );
|
||||
StringTableEntry str = U32toSTE( mCode[ ip ] );
|
||||
Con::printf( "%i: OP_LOADIMMED_IDENT str=%s", ip - 1, str );
|
||||
++ ip;
|
||||
break;
|
||||
|
|
@ -1201,9 +1201,9 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_CALLFUNC_RESOLVE:
|
||||
{
|
||||
StringTableEntry fnNamespace = U32toSTE(code[ip+1]);
|
||||
StringTableEntry fnName = U32toSTE(code[ip]);
|
||||
U32 callType = code[ip+2];
|
||||
StringTableEntry fnNamespace = U32toSTE(mCode[ip+1]);
|
||||
StringTableEntry fnName = U32toSTE(mCode[ip]);
|
||||
U32 callType = mCode[ip+2];
|
||||
|
||||
Con::printf( "%i: OP_CALLFUNC_RESOLVE name=%s nspace=%s callType=%s", ip - 1, fnName, fnNamespace,
|
||||
callType == FuncCallExprNode::FunctionCall ? "FunctionCall"
|
||||
|
|
@ -1215,9 +1215,9 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_CALLFUNC:
|
||||
{
|
||||
StringTableEntry fnNamespace = U32toSTE(code[ip+1]);
|
||||
StringTableEntry fnName = U32toSTE(code[ip]);
|
||||
U32 callType = code[ip+2];
|
||||
StringTableEntry fnNamespace = U32toSTE(mCode[ip+1]);
|
||||
StringTableEntry fnName = U32toSTE(mCode[ip]);
|
||||
U32 callType = mCode[ip+2];
|
||||
|
||||
Con::printf( "%i: OP_CALLFUNC name=%s nspace=%s callType=%s", ip - 1, fnName, fnNamespace,
|
||||
callType == FuncCallExprNode::FunctionCall ? "FunctionCall"
|
||||
|
|
@ -1235,7 +1235,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_ADVANCE_STR_APPENDCHAR:
|
||||
{
|
||||
char ch = code[ ip ];
|
||||
char ch = mCode[ ip ];
|
||||
Con::printf( "%i: OP_ADVANCE_STR_APPENDCHAR char=%c", ip - 1, ch );
|
||||
++ ip;
|
||||
break;
|
||||
|
|
@ -1285,7 +1285,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_ASSERT:
|
||||
{
|
||||
const char* message = functionStrings + code[ ip ];
|
||||
const char* message = mFunctionStrings + mCode[ ip ];
|
||||
Con::printf( "%i: OP_ASSERT message=%s", ip - 1, message );
|
||||
++ ip;
|
||||
break;
|
||||
|
|
@ -1299,8 +1299,8 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_ITER_BEGIN:
|
||||
{
|
||||
StringTableEntry varName = U32toSTE( code[ ip ] );
|
||||
U32 failIp = code[ ip + 1 ];
|
||||
StringTableEntry varName = U32toSTE( mCode[ ip ] );
|
||||
U32 failIp = mCode[ ip + 1 ];
|
||||
|
||||
Con::printf( "%i: OP_ITER_BEGIN varName=%s failIp=%i", varName, failIp );
|
||||
|
||||
|
|
@ -1309,8 +1309,8 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_ITER_BEGIN_STR:
|
||||
{
|
||||
StringTableEntry varName = U32toSTE( code[ ip ] );
|
||||
U32 failIp = code[ ip + 1 ];
|
||||
StringTableEntry varName = U32toSTE( mCode[ ip ] );
|
||||
U32 failIp = mCode[ ip + 1 ];
|
||||
|
||||
Con::printf( "%i: OP_ITER_BEGIN varName=%s failIp=%i", varName, failIp );
|
||||
|
||||
|
|
@ -1319,7 +1319,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn )
|
|||
|
||||
case OP_ITER:
|
||||
{
|
||||
U32 breakIp = code[ ip ];
|
||||
U32 breakIp = mCode[ ip ];
|
||||
|
||||
Con::printf( "%i: OP_ITER breakIp=%i", breakIp );
|
||||
|
||||
|
|
|
|||
|
|
@ -60,28 +60,28 @@ public:
|
|||
CodeBlock();
|
||||
~CodeBlock();
|
||||
|
||||
StringTableEntry name;
|
||||
StringTableEntry fullPath;
|
||||
StringTableEntry modPath;
|
||||
StringTableEntry mName;
|
||||
StringTableEntry mFullPath;
|
||||
StringTableEntry mModPath;
|
||||
|
||||
char *globalStrings;
|
||||
char *functionStrings;
|
||||
char *mGlobalStrings;
|
||||
char *mFunctionStrings;
|
||||
|
||||
U32 functionStringsMaxLen;
|
||||
U32 globalStringsMaxLen;
|
||||
U32 mFunctionStringsMaxLen;
|
||||
U32 mGlobalStringsMaxLen;
|
||||
|
||||
F64 *globalFloats;
|
||||
F64 *functionFloats;
|
||||
F64 *mGlobalFloats;
|
||||
F64 *mFunctionFloats;
|
||||
|
||||
U32 codeSize;
|
||||
U32 *code;
|
||||
U32 mCodeSize;
|
||||
U32 *mCode;
|
||||
|
||||
U32 refCount;
|
||||
U32 lineBreakPairCount;
|
||||
U32 *lineBreakPairs;
|
||||
U32 breakListSize;
|
||||
U32 *breakList;
|
||||
CodeBlock *nextFile;
|
||||
U32 mRefCount;
|
||||
U32 mLineBreakPairCount;
|
||||
U32 *mLineBreakPairs;
|
||||
U32 mBreakListSize;
|
||||
U32 *mBreakList;
|
||||
CodeBlock *mNextFile;
|
||||
|
||||
void addToCodeList();
|
||||
void removeFromCodeList();
|
||||
|
|
|
|||
|
|
@ -422,8 +422,8 @@ const char *CodeBlock::exec(U32 ip, const char *functionName, Namespace *thisNam
|
|||
if(argv)
|
||||
{
|
||||
// assume this points into a function decl:
|
||||
U32 fnArgc = code[ip + 5];
|
||||
thisFunctionName = U32toSTE(code[ip]);
|
||||
U32 fnArgc = mCode[ip + 5];
|
||||
thisFunctionName = U32toSTE(mCode[ip]);
|
||||
argc = getMin(argc-1, fnArgc); // argv[0] is func name
|
||||
if(gEvalState.traceOn)
|
||||
{
|
||||
|
|
@ -458,20 +458,20 @@ const char *CodeBlock::exec(U32 ip, const char *functionName, Namespace *thisNam
|
|||
popFrame = true;
|
||||
for(i = 0; i < argc; i++)
|
||||
{
|
||||
StringTableEntry var = U32toSTE(code[ip + i + 6]);
|
||||
StringTableEntry var = U32toSTE(mCode[ip + i + 6]);
|
||||
gEvalState.setCurVarNameCreate(var);
|
||||
gEvalState.setStringVariable(argv[i+1]);
|
||||
}
|
||||
ip = ip + fnArgc + 6;
|
||||
curFloatTable = functionFloats;
|
||||
curStringTable = functionStrings;
|
||||
curStringTableLen = functionStringsMaxLen;
|
||||
curFloatTable = mFunctionFloats;
|
||||
curStringTable = mFunctionStrings;
|
||||
curStringTableLen = mFunctionStringsMaxLen;
|
||||
}
|
||||
else
|
||||
{
|
||||
curFloatTable = globalFloats;
|
||||
curStringTable = globalStrings;
|
||||
curStringTableLen = globalStringsMaxLen;
|
||||
curFloatTable = mGlobalFloats;
|
||||
curStringTable = mGlobalStrings;
|
||||
curStringTableLen = mGlobalStringsMaxLen;
|
||||
|
||||
// If requested stack frame isn't available, request a new one
|
||||
// (this prevents assert failures when creating local
|
||||
|
|
@ -537,10 +537,10 @@ const char *CodeBlock::exec(U32 ip, const char *functionName, Namespace *thisNam
|
|||
|
||||
CodeBlock *saveCodeBlock = smCurrentCodeBlock;
|
||||
smCurrentCodeBlock = this;
|
||||
if(this->name)
|
||||
if(this->mName)
|
||||
{
|
||||
Con::gCurrentFile = this->name;
|
||||
Con::gCurrentRoot = this->modPath;
|
||||
Con::gCurrentFile = this->mName;
|
||||
Con::gCurrentRoot = this->mModPath;
|
||||
}
|
||||
const char * val;
|
||||
|
||||
|
|
@ -551,7 +551,7 @@ const char *CodeBlock::exec(U32 ip, const char *functionName, Namespace *thisNam
|
|||
|
||||
for(;;)
|
||||
{
|
||||
U32 instruction = code[ip++];
|
||||
U32 instruction = mCode[ip++];
|
||||
nsEntry = NULL;
|
||||
breakContinue:
|
||||
switch(instruction)
|
||||
|
|
@ -559,11 +559,11 @@ breakContinue:
|
|||
case OP_FUNC_DECL:
|
||||
if(!noCalls)
|
||||
{
|
||||
fnName = U32toSTE(code[ip]);
|
||||
fnNamespace = U32toSTE(code[ip+1]);
|
||||
fnPackage = U32toSTE(code[ip+2]);
|
||||
bool hasBody = ( code[ ip + 3 ] & 0x01 ) != 0;
|
||||
U32 lineNumber = code[ ip + 3 ] >> 1;
|
||||
fnName = U32toSTE(mCode[ip]);
|
||||
fnNamespace = U32toSTE(mCode[ip+1]);
|
||||
fnPackage = U32toSTE(mCode[ip+2]);
|
||||
bool hasBody = ( mCode[ ip + 3 ] & 0x01 ) != 0;
|
||||
U32 lineNumber = mCode[ ip + 3 ] >> 1;
|
||||
|
||||
Namespace::unlinkPackages();
|
||||
ns = Namespace::find(fnNamespace, fnPackage);
|
||||
|
|
@ -586,18 +586,18 @@ breakContinue:
|
|||
|
||||
//Con::printf("Adding function %s::%s (%d)", fnNamespace, fnName, ip);
|
||||
}
|
||||
ip = code[ip + 4];
|
||||
ip = mCode[ip + 4];
|
||||
break;
|
||||
|
||||
case OP_CREATE_OBJECT:
|
||||
{
|
||||
// Read some useful info.
|
||||
objParent = U32toSTE(code[ip ]);
|
||||
bool isDataBlock = code[ip + 1];
|
||||
bool isInternal = code[ip + 2];
|
||||
bool isSingleton = code[ip + 3];
|
||||
U32 lineNumber = code[ip + 4];
|
||||
failJump = code[ip + 5];
|
||||
objParent = U32toSTE(mCode[ip ]);
|
||||
bool isDataBlock = mCode[ip + 1];
|
||||
bool isInternal = mCode[ip + 2];
|
||||
bool isSingleton = mCode[ip + 3];
|
||||
U32 lineNumber = mCode[ip + 4];
|
||||
failJump = mCode[ip + 5];
|
||||
|
||||
// If we don't allow calls, we certainly don't allow creating objects!
|
||||
// Moved this to after failJump is set. Engine was crashing when
|
||||
|
|
@ -790,7 +790,7 @@ breakContinue:
|
|||
currentNewObject->setDeclarationLine(lineNumber);
|
||||
|
||||
// Set the file that this object was created in
|
||||
currentNewObject->setFilename(name);
|
||||
currentNewObject->setFilename(mName);
|
||||
|
||||
// Does it have a parent object? (ie, the copy constructor : syntax, not inheriance)
|
||||
if(*objParent)
|
||||
|
|
@ -859,7 +859,7 @@ breakContinue:
|
|||
curNSDocBlock = NULL;
|
||||
|
||||
// Do we place this object at the root?
|
||||
bool placeAtRoot = code[ip++];
|
||||
bool placeAtRoot = mCode[ip++];
|
||||
|
||||
// Con::printf("Adding object %s", currentNewObject->getName());
|
||||
|
||||
|
|
@ -962,7 +962,7 @@ breakContinue:
|
|||
{
|
||||
// If we're not to be placed at the root, make sure we clean up
|
||||
// our group reference.
|
||||
bool placeAtRoot = code[ip++];
|
||||
bool placeAtRoot = mCode[ip++];
|
||||
if(!placeAtRoot)
|
||||
_UINT--;
|
||||
break;
|
||||
|
|
@ -983,7 +983,7 @@ breakContinue:
|
|||
ip++;
|
||||
break;
|
||||
}
|
||||
ip = code[ip];
|
||||
ip = mCode[ip];
|
||||
break;
|
||||
case OP_JMPIFNOT:
|
||||
if(intStack[_UINT--])
|
||||
|
|
@ -991,7 +991,7 @@ breakContinue:
|
|||
ip++;
|
||||
break;
|
||||
}
|
||||
ip = code[ip];
|
||||
ip = mCode[ip];
|
||||
break;
|
||||
case OP_JMPIFF:
|
||||
if(!floatStack[_FLT--])
|
||||
|
|
@ -999,7 +999,7 @@ breakContinue:
|
|||
ip++;
|
||||
break;
|
||||
}
|
||||
ip = code[ip];
|
||||
ip = mCode[ip];
|
||||
break;
|
||||
case OP_JMPIF:
|
||||
if(!intStack[_UINT--])
|
||||
|
|
@ -1007,7 +1007,7 @@ breakContinue:
|
|||
ip ++;
|
||||
break;
|
||||
}
|
||||
ip = code[ip];
|
||||
ip = mCode[ip];
|
||||
break;
|
||||
case OP_JMPIFNOT_NP:
|
||||
if(intStack[_UINT])
|
||||
|
|
@ -1016,7 +1016,7 @@ breakContinue:
|
|||
ip++;
|
||||
break;
|
||||
}
|
||||
ip = code[ip];
|
||||
ip = mCode[ip];
|
||||
break;
|
||||
case OP_JMPIF_NP:
|
||||
if(!intStack[_UINT])
|
||||
|
|
@ -1025,10 +1025,10 @@ breakContinue:
|
|||
ip++;
|
||||
break;
|
||||
}
|
||||
ip = code[ip];
|
||||
ip = mCode[ip];
|
||||
break;
|
||||
case OP_JMP:
|
||||
ip = code[ip];
|
||||
ip = mCode[ip];
|
||||
break;
|
||||
|
||||
// This fixes a bug when not explicitly returning a value.
|
||||
|
|
@ -1170,7 +1170,7 @@ breakContinue:
|
|||
break;
|
||||
|
||||
case OP_SETCURVAR:
|
||||
var = U32toSTE(code[ip]);
|
||||
var = U32toSTE(mCode[ip]);
|
||||
ip++;
|
||||
|
||||
// If a variable is set, then these must be NULL. It is necessary
|
||||
|
|
@ -1190,7 +1190,7 @@ breakContinue:
|
|||
break;
|
||||
|
||||
case OP_SETCURVAR_CREATE:
|
||||
var = U32toSTE(code[ip]);
|
||||
var = U32toSTE(mCode[ip]);
|
||||
ip++;
|
||||
|
||||
// See OP_SETCURVAR
|
||||
|
|
@ -1289,7 +1289,7 @@ breakContinue:
|
|||
if(set)
|
||||
{
|
||||
StringTableEntry intName = StringTable->insert(STR.getStringValue());
|
||||
bool recurse = code[ip-1];
|
||||
bool recurse = mCode[ip-1];
|
||||
SimObject *obj = set->findObjectByInternalName(intName, recurse);
|
||||
intStack[_UINT+1] = obj ? obj->getId() : 0;
|
||||
_UINT++;
|
||||
|
|
@ -1310,7 +1310,7 @@ breakContinue:
|
|||
// Save the previous field for parsing vector fields.
|
||||
prevField = curField;
|
||||
dStrcpy( prevFieldArray, curFieldArray );
|
||||
curField = U32toSTE(code[ip]);
|
||||
curField = U32toSTE(mCode[ip]);
|
||||
curFieldArray[0] = 0;
|
||||
ip++;
|
||||
break;
|
||||
|
|
@ -1321,7 +1321,7 @@ breakContinue:
|
|||
|
||||
case OP_SETCURFIELD_TYPE:
|
||||
if(curObject)
|
||||
curObject->setDataFieldType(code[ip], curField, curFieldArray);
|
||||
curObject->setDataFieldType(mCode[ip], curField, curFieldArray);
|
||||
ip++;
|
||||
break;
|
||||
|
||||
|
|
@ -1449,34 +1449,34 @@ breakContinue:
|
|||
break;
|
||||
|
||||
case OP_LOADIMMED_UINT:
|
||||
intStack[_UINT+1] = code[ip++];
|
||||
intStack[_UINT+1] = mCode[ip++];
|
||||
_UINT++;
|
||||
break;
|
||||
|
||||
case OP_LOADIMMED_FLT:
|
||||
floatStack[_FLT+1] = curFloatTable[code[ip]];
|
||||
floatStack[_FLT+1] = curFloatTable[mCode[ip]];
|
||||
ip++;
|
||||
_FLT++;
|
||||
break;
|
||||
|
||||
case OP_TAG_TO_STR:
|
||||
code[ip-1] = OP_LOADIMMED_STR;
|
||||
mCode[ip-1] = OP_LOADIMMED_STR;
|
||||
// it's possible the string has already been converted
|
||||
if(U8(curStringTable[code[ip]]) != StringTagPrefixByte)
|
||||
if(U8(curStringTable[mCode[ip]]) != StringTagPrefixByte)
|
||||
{
|
||||
U32 id = GameAddTaggedString(curStringTable + code[ip]);
|
||||
dSprintf(curStringTable + code[ip] + 1, 7, "%d", id);
|
||||
*(curStringTable + code[ip]) = StringTagPrefixByte;
|
||||
U32 id = GameAddTaggedString(curStringTable + mCode[ip]);
|
||||
dSprintf(curStringTable + mCode[ip] + 1, 7, "%d", id);
|
||||
*(curStringTable + mCode[ip]) = StringTagPrefixByte;
|
||||
}
|
||||
case OP_LOADIMMED_STR:
|
||||
STR.setStringValue(curStringTable + code[ip++]);
|
||||
STR.setStringValue(curStringTable + mCode[ip++]);
|
||||
break;
|
||||
|
||||
case OP_DOCBLOCK_STR:
|
||||
{
|
||||
// If the first word of the doc is '\class' or '@class', then this
|
||||
// is a namespace doc block, otherwise it is a function doc block.
|
||||
const char* docblock = curStringTable + code[ip++];
|
||||
const char* docblock = curStringTable + mCode[ip++];
|
||||
|
||||
const char* sansClass = dStrstr( docblock, "@class" );
|
||||
if( !sansClass )
|
||||
|
|
@ -1504,13 +1504,13 @@ breakContinue:
|
|||
break;
|
||||
|
||||
case OP_LOADIMMED_IDENT:
|
||||
STR.setStringValue(U32toSTE(code[ip++]));
|
||||
STR.setStringValue(U32toSTE(mCode[ip++]));
|
||||
break;
|
||||
|
||||
case OP_CALLFUNC_RESOLVE:
|
||||
// This deals with a function that is potentially living in a namespace.
|
||||
fnNamespace = U32toSTE(code[ip+1]);
|
||||
fnName = U32toSTE(code[ip]);
|
||||
fnNamespace = U32toSTE(mCode[ip+1]);
|
||||
fnName = U32toSTE(mCode[ip]);
|
||||
|
||||
// Try to look it up.
|
||||
ns = Namespace::find(fnNamespace);
|
||||
|
|
@ -1535,7 +1535,7 @@ breakContinue:
|
|||
// or just on the object.
|
||||
S32 routingId = 0;
|
||||
|
||||
fnName = U32toSTE(code[ip]);
|
||||
fnName = U32toSTE(mCode[ip]);
|
||||
|
||||
//if this is called from inside a function, append the ip and codeptr
|
||||
if( gEvalState.getStackDepth() > 0 )
|
||||
|
|
@ -1544,7 +1544,7 @@ breakContinue:
|
|||
gEvalState.getCurrentFrame().ip = ip - 1;
|
||||
}
|
||||
|
||||
U32 callType = code[ip+2];
|
||||
U32 callType = mCode[ip+2];
|
||||
|
||||
ip += 3;
|
||||
STR.getArgcArgv(fnName, &callArgc, &callArgv);
|
||||
|
|
@ -1682,19 +1682,19 @@ breakContinue:
|
|||
{
|
||||
S32 result = nsEntry->cb.mIntCallbackFunc(gEvalState.thisObject, callArgc, callArgv);
|
||||
STR.popFrame();
|
||||
if(code[ip] == OP_STR_TO_UINT)
|
||||
if(mCode[ip] == OP_STR_TO_UINT)
|
||||
{
|
||||
ip++;
|
||||
intStack[++_UINT] = result;
|
||||
break;
|
||||
}
|
||||
else if(code[ip] == OP_STR_TO_FLT)
|
||||
else if(mCode[ip] == OP_STR_TO_FLT)
|
||||
{
|
||||
ip++;
|
||||
floatStack[++_FLT] = result;
|
||||
break;
|
||||
}
|
||||
else if(code[ip] == OP_STR_TO_NONE)
|
||||
else if(mCode[ip] == OP_STR_TO_NONE)
|
||||
ip++;
|
||||
else
|
||||
STR.setIntValue(result);
|
||||
|
|
@ -1704,19 +1704,19 @@ breakContinue:
|
|||
{
|
||||
F64 result = nsEntry->cb.mFloatCallbackFunc(gEvalState.thisObject, callArgc, callArgv);
|
||||
STR.popFrame();
|
||||
if(code[ip] == OP_STR_TO_UINT)
|
||||
if(mCode[ip] == OP_STR_TO_UINT)
|
||||
{
|
||||
ip++;
|
||||
intStack[++_UINT] = (S64)result;
|
||||
break;
|
||||
}
|
||||
else if(code[ip] == OP_STR_TO_FLT)
|
||||
else if(mCode[ip] == OP_STR_TO_FLT)
|
||||
{
|
||||
ip++;
|
||||
floatStack[++_FLT] = result;
|
||||
break;
|
||||
}
|
||||
else if(code[ip] == OP_STR_TO_NONE)
|
||||
else if(mCode[ip] == OP_STR_TO_NONE)
|
||||
ip++;
|
||||
else
|
||||
STR.setFloatValue(result);
|
||||
|
|
@ -1724,7 +1724,7 @@ breakContinue:
|
|||
}
|
||||
case Namespace::Entry::VoidCallbackType:
|
||||
nsEntry->cb.mVoidCallbackFunc(gEvalState.thisObject, callArgc, callArgv);
|
||||
if( code[ ip ] != OP_STR_TO_NONE && Con::getBoolVariable( "$Con::warnVoidAssignment", true ) )
|
||||
if( mCode[ ip ] != OP_STR_TO_NONE && Con::getBoolVariable( "$Con::warnVoidAssignment", true ) )
|
||||
Con::warnf(ConsoleLogEntry::General, "%s: Call to %s in %s uses result of void function call.", getFileLine(ip-4), fnName, functionName);
|
||||
|
||||
STR.popFrame();
|
||||
|
|
@ -1734,19 +1734,19 @@ breakContinue:
|
|||
{
|
||||
bool result = nsEntry->cb.mBoolCallbackFunc(gEvalState.thisObject, callArgc, callArgv);
|
||||
STR.popFrame();
|
||||
if(code[ip] == OP_STR_TO_UINT)
|
||||
if(mCode[ip] == OP_STR_TO_UINT)
|
||||
{
|
||||
ip++;
|
||||
intStack[++_UINT] = result;
|
||||
break;
|
||||
}
|
||||
else if(code[ip] == OP_STR_TO_FLT)
|
||||
else if(mCode[ip] == OP_STR_TO_FLT)
|
||||
{
|
||||
ip++;
|
||||
floatStack[++_FLT] = result;
|
||||
break;
|
||||
}
|
||||
else if(code[ip] == OP_STR_TO_NONE)
|
||||
else if(mCode[ip] == OP_STR_TO_NONE)
|
||||
ip++;
|
||||
else
|
||||
STR.setIntValue(result);
|
||||
|
|
@ -1764,7 +1764,7 @@ breakContinue:
|
|||
STR.advance();
|
||||
break;
|
||||
case OP_ADVANCE_STR_APPENDCHAR:
|
||||
STR.advanceChar(code[ip++]);
|
||||
STR.advanceChar(mCode[ip++]);
|
||||
break;
|
||||
|
||||
case OP_ADVANCE_STR_COMMA:
|
||||
|
|
@ -1798,13 +1798,13 @@ breakContinue:
|
|||
{
|
||||
if( !intStack[_UINT--] )
|
||||
{
|
||||
const char *message = curStringTable + code[ip];
|
||||
const char *message = curStringTable + mCode[ip];
|
||||
|
||||
U32 breakLine, inst;
|
||||
findBreakLine( ip - 1, breakLine, inst );
|
||||
|
||||
if ( PlatformAssert::processAssert( PlatformAssert::Fatal,
|
||||
name ? name : "eval",
|
||||
mName ? mName : "eval",
|
||||
breakLine,
|
||||
message ) )
|
||||
{
|
||||
|
|
@ -1844,8 +1844,8 @@ breakContinue:
|
|||
|
||||
case OP_ITER_BEGIN:
|
||||
{
|
||||
StringTableEntry varName = U32toSTE( code[ ip ] );
|
||||
U32 failIp = code[ ip + 1 ];
|
||||
StringTableEntry varName = U32toSTE( mCode[ ip ] );
|
||||
U32 failIp = mCode[ ip + 1 ];
|
||||
|
||||
IterStackRecord& iter = iterStack[ _ITER ];
|
||||
|
||||
|
|
@ -1886,7 +1886,7 @@ breakContinue:
|
|||
|
||||
case OP_ITER:
|
||||
{
|
||||
U32 breakIp = code[ ip ];
|
||||
U32 breakIp = mCode[ ip ];
|
||||
IterStackRecord& iter = iterStack[ _ITER - 1 ];
|
||||
|
||||
if( iter.mIsStringIter )
|
||||
|
|
@ -2001,18 +2001,18 @@ execFinished:
|
|||
}
|
||||
else
|
||||
{
|
||||
delete[] globalStrings;
|
||||
globalStringsMaxLen = 0;
|
||||
delete[] mGlobalStrings;
|
||||
mGlobalStringsMaxLen = 0;
|
||||
|
||||
delete[] globalFloats;
|
||||
globalStrings = NULL;
|
||||
globalFloats = NULL;
|
||||
delete[] mGlobalFloats;
|
||||
mGlobalStrings = NULL;
|
||||
mGlobalFloats = NULL;
|
||||
}
|
||||
smCurrentCodeBlock = saveCodeBlock;
|
||||
if(saveCodeBlock && saveCodeBlock->name)
|
||||
if(saveCodeBlock && saveCodeBlock->mName)
|
||||
{
|
||||
Con::gCurrentFile = saveCodeBlock->name;
|
||||
Con::gCurrentRoot = saveCodeBlock->modPath;
|
||||
Con::gCurrentFile = saveCodeBlock->mName;
|
||||
Con::gCurrentRoot = saveCodeBlock->mModPath;
|
||||
}
|
||||
|
||||
decRefCount();
|
||||
|
|
|
|||
|
|
@ -2158,8 +2158,8 @@ DefineConsoleMethod( SimObject, dumpMethods, ArrayObject*, (),,
|
|||
str.append( e->getPrototypeString() );
|
||||
|
||||
str.append( '\n' );
|
||||
if( e->mCode && e->mCode->fullPath )
|
||||
str.append( e->mCode->fullPath );
|
||||
if( e->mCode && e->mCode->mFullPath )
|
||||
str.append( e->mCode->mFullPath );
|
||||
str.append( '\n' );
|
||||
if( e->mCode )
|
||||
str.append( String::ToString( e->mFunctionLineNumber ) );
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ void TelnetDebugger::executionStopped(CodeBlock *code, U32 lineNumber)
|
|||
return;
|
||||
}
|
||||
|
||||
Breakpoint **bp = findBreakpoint(code->name, lineNumber);
|
||||
Breakpoint **bp = findBreakpoint(code->mName, lineNumber);
|
||||
if(!bp)
|
||||
return;
|
||||
|
||||
|
|
@ -396,7 +396,7 @@ void TelnetDebugger::executionStopped(CodeBlock *code, U32 lineNumber)
|
|||
{
|
||||
brk->curCount = 0;
|
||||
if(brk->clearOnHit)
|
||||
removeBreakpoint(code->name, lineNumber);
|
||||
removeBreakpoint(code->mName, lineNumber);
|
||||
breakProcess();
|
||||
}
|
||||
}
|
||||
|
|
@ -455,8 +455,8 @@ void TelnetDebugger::sendBreak()
|
|||
{
|
||||
CodeBlock *code = gEvalState.stack[i]->code;
|
||||
const char *file = "<none>";
|
||||
if (code && code->name && code->name[0])
|
||||
file = code->name;
|
||||
if (code && code->mName && code->mName[0])
|
||||
file = code->mName;
|
||||
|
||||
Namespace *ns = gEvalState.stack[i]->scopeNamespace;
|
||||
scope[0] = 0;
|
||||
|
|
@ -580,7 +580,7 @@ void TelnetDebugger::addAllBreakpoints(CodeBlock *code)
|
|||
{
|
||||
// TODO: This assumes that the OS file names are case
|
||||
// insensitive... Torque needs a dFilenameCmp() function.
|
||||
if( dStricmp( cur->fileName, code->name ) == 0 )
|
||||
if( dStricmp( cur->fileName, code->mName ) == 0 )
|
||||
{
|
||||
cur->code = code;
|
||||
|
||||
|
|
@ -774,7 +774,7 @@ void TelnetDebugger::setBreakOnNextStatement( bool enabled )
|
|||
if ( enabled )
|
||||
{
|
||||
// Apply breaks on all the code blocks.
|
||||
for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile)
|
||||
for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->mNextFile)
|
||||
walk->setAllBreaks();
|
||||
mBreakOnNextStatement = true;
|
||||
}
|
||||
|
|
@ -782,7 +782,7 @@ void TelnetDebugger::setBreakOnNextStatement( bool enabled )
|
|||
{
|
||||
// Clear all the breaks on the codeblocks
|
||||
// then go reapply the breakpoints.
|
||||
for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile)
|
||||
for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->mNextFile)
|
||||
walk->clearAllBreaks();
|
||||
for(Breakpoint *w = mBreakpoints; w; w = w->next)
|
||||
{
|
||||
|
|
@ -878,10 +878,10 @@ void TelnetDebugger::evaluateExpression(const char *tag, S32 frame, const char *
|
|||
void TelnetDebugger::dumpFileList()
|
||||
{
|
||||
send("FILELISTOUT ");
|
||||
for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile)
|
||||
for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->mNextFile)
|
||||
{
|
||||
send(walk->name);
|
||||
if(walk->nextFile)
|
||||
send(walk->mName);
|
||||
if(walk->mNextFile)
|
||||
send(" ");
|
||||
}
|
||||
send("\r\n");
|
||||
|
|
@ -894,11 +894,11 @@ void TelnetDebugger::dumpBreakableList(const char *fileName)
|
|||
char buffer[MaxCommandSize];
|
||||
if(file)
|
||||
{
|
||||
dSprintf(buffer, MaxCommandSize, "BREAKLISTOUT %s %d", fileName, file->breakListSize >> 1);
|
||||
dSprintf(buffer, MaxCommandSize, "BREAKLISTOUT %s %d", fileName, file->mBreakListSize >> 1);
|
||||
send(buffer);
|
||||
for(U32 i = 0; i < file->breakListSize; i += 2)
|
||||
for(U32 i = 0; i < file->mBreakListSize; i += 2)
|
||||
{
|
||||
dSprintf(buffer, MaxCommandSize, " %d %d", file->breakList[i], file->breakList[i+1]);
|
||||
dSprintf(buffer, MaxCommandSize, " %d %d", file->mBreakList[i], file->mBreakList[i+1]);
|
||||
send(buffer);
|
||||
}
|
||||
send("\r\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue