mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +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
|
|
@ -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 );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue