Merge pull request #2121 from JeffProgrammer/TSImprovementsDevMerge

TorqueScript Improvements - Faster Interpreter.
This commit is contained in:
Areloch 2017-11-27 01:35:17 -06:00 committed by GitHub
commit 4f78143dc8
23 changed files with 10231 additions and 8513 deletions

View file

@ -45,6 +45,7 @@
#include "console/debugOutputConsumer.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "console/codeInterpreter.h"
#include "gfx/bitmap/gBitmap.h"
#include "gfx/gFont.h"
@ -227,6 +228,9 @@ void StandardMainLoop::init()
ManagedSingleton< ThreadManager >::createSingleton();
FrameAllocator::init(TORQUE_FRAME_SIZE); // See comments in torqueConfig.h
// Initialize the TorqueScript interpreter.
CodeInterpreter::init();
// Yell if we can't initialize the network.
if(!Net::init())
{

View file

@ -496,9 +496,9 @@ class_name_expr
assign_op_struct
: opPLUSPLUS
{ $$.lineNumber = $1.lineNumber; $$.token = '+'; $$.expr = FloatNode::alloc( $1.lineNumber, 1 ); }
{ $$.lineNumber = $1.lineNumber; $$.token = opPLUSPLUS; $$.expr = FloatNode::alloc( $1.lineNumber, 1 ); }
| opMINUSMINUS
{ $$.lineNumber = $1.lineNumber; $$.token = '-'; $$.expr = FloatNode::alloc( $1.lineNumber, 1 ); }
{ $$.lineNumber = $1.lineNumber; $$.token = opMINUSMINUS; $$.expr = FloatNode::alloc( $1.lineNumber, 1 ); }
| opPLASN expr
{ $$.lineNumber = $1.lineNumber; $$.token = '+'; $$.expr = $2; }
| opMIASN expr
@ -551,6 +551,8 @@ funcall_expr
{ $$ = FuncCallExprNode::alloc( $1.lineNumber, $3.value, $1.value, $5, false); }
| expr '.' IDENT '(' expr_list_decl ')'
{ $1->append($5); $$ = FuncCallExprNode::alloc( $1->dbgLineNumber, $3.value, NULL, $1, true); }
| expr '(' expr_list_decl ')'
{ $$ = FuncPointerCallExprNode::alloc( $1->dbgLineNumber, $1, $3); }
;
assert_expr

File diff suppressed because it is too large Load diff

View file

@ -99,7 +99,7 @@ struct StmtNode
struct BreakStmtNode : StmtNode
{
static BreakStmtNode *alloc( S32 lineNumber );
static BreakStmtNode *alloc(S32 lineNumber);
U32 compileStmt(CodeStream &codeStream, U32 ip);
@ -108,7 +108,7 @@ struct BreakStmtNode : StmtNode
struct ContinueStmtNode : StmtNode
{
static ContinueStmtNode *alloc( S32 lineNumber );
static ContinueStmtNode *alloc(S32 lineNumber);
U32 compileStmt(CodeStream &codeStream, U32 ip);
DBG_STMT_TYPE(ContinueStmtNode);
@ -128,7 +128,7 @@ struct ReturnStmtNode : StmtNode
{
ExprNode *expr;
static ReturnStmtNode *alloc( S32 lineNumber, ExprNode *expr );
static ReturnStmtNode *alloc(S32 lineNumber, ExprNode *expr);
U32 compileStmt(CodeStream &codeStream, U32 ip);
DBG_STMT_TYPE(ReturnStmtNode);
@ -143,7 +143,7 @@ struct IfStmtNode : StmtNode
bool integer;
bool propagate;
static IfStmtNode *alloc( S32 lineNumber, ExprNode *testExpr, StmtNode *ifBlock, StmtNode *elseBlock, bool propagateThrough );
static IfStmtNode *alloc(S32 lineNumber, ExprNode *testExpr, StmtNode *ifBlock, StmtNode *elseBlock, bool propagateThrough);
void propagateSwitchExpr(ExprNode *left, bool string);
ExprNode *getSwitchOR(ExprNode *left, ExprNode *list, bool string);
@ -163,7 +163,7 @@ struct LoopStmtNode : StmtNode
U32 loopBlockStartOffset;
bool integer;
static LoopStmtNode *alloc( S32 lineNumber, ExprNode *testExpr, ExprNode *initExpr, ExprNode *endLoopExpr, StmtNode *loopBlock, bool isDoLoop );
static LoopStmtNode *alloc(S32 lineNumber, ExprNode *testExpr, ExprNode *initExpr, ExprNode *endLoopExpr, StmtNode *loopBlock, bool isDoLoop);
U32 compileStmt(CodeStream &codeStream, U32 ip);
DBG_STMT_TYPE(LoopStmtNode);
@ -187,9 +187,9 @@ struct IterStmtNode : StmtNode
/// Bytecode size of body statement. Set by precompileStmt.
U32 bodySize;
static IterStmtNode* alloc( S32 lineNumber, StringTableEntry varName, ExprNode* containerExpr, StmtNode* body, bool isStringIter );
static IterStmtNode* alloc(S32 lineNumber, StringTableEntry varName, ExprNode* containerExpr, StmtNode* body, bool isStringIter);
U32 compileStmt( CodeStream &codeStream, U32 ip );
U32 compileStmt(CodeStream &codeStream, U32 ip);
};
/// A binary mathematical expression (ie, left op right).
@ -202,7 +202,7 @@ struct BinaryExprNode : ExprNode
struct FloatBinaryExprNode : BinaryExprNode
{
static FloatBinaryExprNode *alloc( S32 lineNumber, S32 op, ExprNode *left, ExprNode *right );
static FloatBinaryExprNode *alloc(S32 lineNumber, S32 op, ExprNode *left, ExprNode *right);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -215,7 +215,7 @@ struct ConditionalExprNode : ExprNode
ExprNode *trueExpr;
ExprNode *falseExpr;
bool integer;
static ConditionalExprNode *alloc( S32 lineNumber, ExprNode *testExpr, ExprNode *trueExpr, ExprNode *falseExpr );
static ConditionalExprNode *alloc(S32 lineNumber, ExprNode *testExpr, ExprNode *trueExpr, ExprNode *falseExpr);
virtual U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
virtual TypeReq getPreferredType();
@ -227,7 +227,7 @@ struct IntBinaryExprNode : BinaryExprNode
TypeReq subType;
U32 operand;
static IntBinaryExprNode *alloc( S32 lineNumber, S32 op, ExprNode *left, ExprNode *right );
static IntBinaryExprNode *alloc(S32 lineNumber, S32 op, ExprNode *left, ExprNode *right);
void getSubTypeOperand();
@ -239,7 +239,7 @@ struct IntBinaryExprNode : BinaryExprNode
struct StreqExprNode : BinaryExprNode
{
bool eq;
static StreqExprNode *alloc( S32 lineNumber, ExprNode *left, ExprNode *right, bool eq );
static StreqExprNode *alloc(S32 lineNumber, ExprNode *left, ExprNode *right, bool eq);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -249,7 +249,7 @@ struct StreqExprNode : BinaryExprNode
struct StrcatExprNode : BinaryExprNode
{
S32 appendChar;
static StrcatExprNode *alloc( S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar );
static StrcatExprNode *alloc(S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -258,7 +258,7 @@ struct StrcatExprNode : BinaryExprNode
struct CommaCatExprNode : BinaryExprNode
{
static CommaCatExprNode *alloc( S32 lineNumber, ExprNode *left, ExprNode *right );
static CommaCatExprNode *alloc(S32 lineNumber, ExprNode *left, ExprNode *right);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
@ -272,7 +272,7 @@ struct IntUnaryExprNode : ExprNode
ExprNode *expr;
bool integer;
static IntUnaryExprNode *alloc( S32 lineNumber, S32 op, ExprNode *expr );
static IntUnaryExprNode *alloc(S32 lineNumber, S32 op, ExprNode *expr);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -284,7 +284,7 @@ struct FloatUnaryExprNode : ExprNode
S32 op;
ExprNode *expr;
static FloatUnaryExprNode *alloc( S32 lineNumber, S32 op, ExprNode *expr );
static FloatUnaryExprNode *alloc(S32 lineNumber, S32 op, ExprNode *expr);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -296,7 +296,7 @@ struct VarNode : ExprNode
StringTableEntry varName;
ExprNode *arrayIndex;
static VarNode *alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex );
static VarNode *alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -308,7 +308,7 @@ struct IntNode : ExprNode
S32 value;
U32 index; // if it's converted to float/string
static IntNode *alloc( S32 lineNumber, S32 value );
static IntNode *alloc(S32 lineNumber, S32 value);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -320,7 +320,7 @@ struct FloatNode : ExprNode
F64 value;
U32 index;
static FloatNode *alloc( S32 lineNumber, F64 value );
static FloatNode *alloc(S32 lineNumber, F64 value);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -335,7 +335,7 @@ struct StrConstNode : ExprNode
bool tag;
bool doc; // Specifies that this string is a documentation block.
static StrConstNode *alloc( S32 lineNumber, char *str, bool tag, bool doc = false );
static StrConstNode *alloc(S32 lineNumber, char *str, bool tag, bool doc = false);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -348,7 +348,7 @@ struct ConstantNode : ExprNode
F64 fVal;
U32 index;
static ConstantNode *alloc( S32 lineNumber, StringTableEntry value );
static ConstantNode *alloc(S32 lineNumber, StringTableEntry value);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -362,7 +362,7 @@ struct AssignExprNode : ExprNode
ExprNode *arrayIndex;
TypeReq subType;
static AssignExprNode *alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr );
static AssignExprNode *alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -386,7 +386,7 @@ struct AssignOpExprNode : ExprNode
U32 operand;
TypeReq subType;
static AssignOpExprNode *alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr, S32 op );
static AssignOpExprNode *alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr, S32 op);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -399,7 +399,7 @@ struct TTagSetStmtNode : StmtNode
ExprNode *valueExpr;
ExprNode *stringExpr;
static TTagSetStmtNode *alloc( S32 lineNumber, StringTableEntry tag, ExprNode *valueExpr, ExprNode *stringExpr );
static TTagSetStmtNode *alloc(S32 lineNumber, StringTableEntry tag, ExprNode *valueExpr, ExprNode *stringExpr);
U32 compileStmt(CodeStream &codeStream, U32 ip);
DBG_STMT_TYPE(TTagSetStmtNode);
@ -409,7 +409,7 @@ struct TTagDerefNode : ExprNode
{
ExprNode *expr;
static TTagDerefNode *alloc( S32 lineNumber, ExprNode *expr );
static TTagDerefNode *alloc(S32 lineNumber, ExprNode *expr);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -420,7 +420,7 @@ struct TTagExprNode : ExprNode
{
StringTableEntry tag;
static TTagExprNode *alloc( S32 lineNumber, StringTableEntry tag );
static TTagExprNode *alloc(S32 lineNumber, StringTableEntry tag);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -439,20 +439,32 @@ struct FuncCallExprNode : ExprNode
ParentCall
};
static FuncCallExprNode *alloc( S32 lineNumber, StringTableEntry funcName, StringTableEntry nameSpace, ExprNode *args, bool dot );
static FuncCallExprNode *alloc(S32 lineNumber, StringTableEntry funcName, StringTableEntry nameSpace, ExprNode *args, bool dot);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
DBG_STMT_TYPE(FuncCallExprNode);
};
struct FuncPointerCallExprNode : ExprNode
{
ExprNode *funcPointer;
ExprNode *args;
static FuncPointerCallExprNode *alloc(S32 lineNumber, ExprNode *stmt, ExprNode *args);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
DBG_STMT_TYPE(FuncPointerCallExprNode);
};
struct AssertCallExprNode : ExprNode
{
ExprNode *testExpr;
const char *message;
U32 messageIndex;
static AssertCallExprNode *alloc( S32 lineNumber, ExprNode *testExpr, const char *message );
static AssertCallExprNode *alloc(S32 lineNumber, ExprNode *testExpr, const char *message);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -472,7 +484,7 @@ struct SlotAccessNode : ExprNode
ExprNode *objectExpr, *arrayExpr;
StringTableEntry slotName;
static SlotAccessNode *alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName );
static SlotAccessNode *alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -492,7 +504,7 @@ struct InternalSlotAccessNode : ExprNode
ExprNode *objectExpr, *slotExpr;
bool recurse;
static InternalSlotAccessNode *alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *slotExpr, bool recurse );
static InternalSlotAccessNode *alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *slotExpr, bool recurse);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -506,7 +518,7 @@ struct SlotAssignNode : ExprNode
ExprNode *valueExpr;
U32 typeID;
static SlotAssignNode *alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName, ExprNode *valueExpr, U32 typeID = -1 );
static SlotAssignNode *alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName, ExprNode *valueExpr, U32 typeID = -1);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -522,7 +534,7 @@ struct SlotAssignOpNode : ExprNode
U32 operand;
TypeReq subType;
static SlotAssignOpNode *alloc( S32 lineNumber, ExprNode *objectExpr, StringTableEntry slotName, ExprNode *arrayExpr, S32 op, ExprNode *valueExpr );
static SlotAssignOpNode *alloc(S32 lineNumber, ExprNode *objectExpr, StringTableEntry slotName, ExprNode *arrayExpr, S32 op, ExprNode *valueExpr);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType();
@ -542,7 +554,7 @@ struct ObjectDeclNode : ExprNode
bool isClassNameInternal;
bool isSingleton;
static ObjectDeclNode *alloc( S32 lineNumber, ExprNode *classNameExpr, ExprNode *objectNameExpr, ExprNode *argList, StringTableEntry parentObject, SlotAssignNode *slotDecls, ObjectDeclNode *subObjects, bool isDatablock, bool classNameInternal, bool isSingleton );
static ObjectDeclNode *alloc(S32 lineNumber, ExprNode *classNameExpr, ExprNode *objectNameExpr, ExprNode *argList, StringTableEntry parentObject, SlotAssignNode *slotDecls, ObjectDeclNode *subObjects, bool isDatablock, bool classNameInternal, bool isSingleton);
U32 precompileSubObject(bool);
U32 compile(CodeStream &codeStream, U32 ip, TypeReq type);
@ -567,7 +579,7 @@ struct FunctionDeclStmtNode : StmtNode
U32 endOffset;
U32 argc;
static FunctionDeclStmtNode *alloc( S32 lineNumber, StringTableEntry fnName, StringTableEntry nameSpace, VarNode *args, StmtNode *stmts );
static FunctionDeclStmtNode *alloc(S32 lineNumber, StringTableEntry fnName, StringTableEntry nameSpace, VarNode *args, StmtNode *stmts);
U32 compileStmt(CodeStream &codeStream, U32 ip);
void setPackage(StringTableEntry packageName);

View file

@ -38,25 +38,25 @@ using namespace Compiler;
//------------------------------------------------------------
BreakStmtNode *BreakStmtNode::alloc( S32 lineNumber )
BreakStmtNode *BreakStmtNode::alloc(S32 lineNumber)
{
BreakStmtNode *ret = (BreakStmtNode *) consoleAlloc(sizeof(BreakStmtNode));
BreakStmtNode *ret = (BreakStmtNode *)consoleAlloc(sizeof(BreakStmtNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
return ret;
}
ContinueStmtNode *ContinueStmtNode::alloc( S32 lineNumber )
ContinueStmtNode *ContinueStmtNode::alloc(S32 lineNumber)
{
ContinueStmtNode *ret = (ContinueStmtNode *) consoleAlloc(sizeof(ContinueStmtNode));
ContinueStmtNode *ret = (ContinueStmtNode *)consoleAlloc(sizeof(ContinueStmtNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
return ret;
}
ReturnStmtNode *ReturnStmtNode::alloc( S32 lineNumber, ExprNode *expr)
ReturnStmtNode *ReturnStmtNode::alloc(S32 lineNumber, ExprNode *expr)
{
ReturnStmtNode *ret = (ReturnStmtNode *) consoleAlloc(sizeof(ReturnStmtNode));
ReturnStmtNode *ret = (ReturnStmtNode *)consoleAlloc(sizeof(ReturnStmtNode));
constructInPlace(ret);
ret->expr = expr;
ret->dbgLineNumber = lineNumber;
@ -64,9 +64,9 @@ ReturnStmtNode *ReturnStmtNode::alloc( S32 lineNumber, ExprNode *expr)
return ret;
}
IfStmtNode *IfStmtNode::alloc( S32 lineNumber, ExprNode *testExpr, StmtNode *ifBlock, StmtNode *elseBlock, bool propagate )
IfStmtNode *IfStmtNode::alloc(S32 lineNumber, ExprNode *testExpr, StmtNode *ifBlock, StmtNode *elseBlock, bool propagate)
{
IfStmtNode *ret = (IfStmtNode *) consoleAlloc(sizeof(IfStmtNode));
IfStmtNode *ret = (IfStmtNode *)consoleAlloc(sizeof(IfStmtNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
@ -78,9 +78,9 @@ IfStmtNode *IfStmtNode::alloc( S32 lineNumber, ExprNode *testExpr, StmtNode *ifB
return ret;
}
LoopStmtNode *LoopStmtNode::alloc( S32 lineNumber, ExprNode *initExpr, ExprNode *testExpr, ExprNode *endLoopExpr, StmtNode *loopBlock, bool isDoLoop )
LoopStmtNode *LoopStmtNode::alloc(S32 lineNumber, ExprNode *initExpr, ExprNode *testExpr, ExprNode *endLoopExpr, StmtNode *loopBlock, bool isDoLoop)
{
LoopStmtNode *ret = (LoopStmtNode *) consoleAlloc(sizeof(LoopStmtNode));
LoopStmtNode *ret = (LoopStmtNode *)consoleAlloc(sizeof(LoopStmtNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->testExpr = testExpr;
@ -92,15 +92,15 @@ LoopStmtNode *LoopStmtNode::alloc( S32 lineNumber, ExprNode *initExpr, ExprNode
// Deal with setting some dummy constant nodes if we weren't provided with
// info... This allows us to play nice with missing parts of for(;;) for
// instance.
if(!ret->testExpr) ret->testExpr = IntNode::alloc( lineNumber, 1 );
if (!ret->testExpr) ret->testExpr = IntNode::alloc(lineNumber, 1);
return ret;
}
IterStmtNode* IterStmtNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode* containerExpr, StmtNode* body, bool isStringIter )
IterStmtNode* IterStmtNode::alloc(S32 lineNumber, StringTableEntry varName, ExprNode* containerExpr, StmtNode* body, bool isStringIter)
{
IterStmtNode* ret = ( IterStmtNode* ) consoleAlloc( sizeof( IterStmtNode ) );
constructInPlace( ret );
IterStmtNode* ret = (IterStmtNode*)consoleAlloc(sizeof(IterStmtNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->varName = varName;
@ -111,9 +111,9 @@ IterStmtNode* IterStmtNode::alloc( S32 lineNumber, StringTableEntry varName, Exp
return ret;
}
FloatBinaryExprNode *FloatBinaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *left, ExprNode *right )
FloatBinaryExprNode *FloatBinaryExprNode::alloc(S32 lineNumber, S32 op, ExprNode *left, ExprNode *right)
{
FloatBinaryExprNode *ret = (FloatBinaryExprNode *) consoleAlloc(sizeof(FloatBinaryExprNode));
FloatBinaryExprNode *ret = (FloatBinaryExprNode *)consoleAlloc(sizeof(FloatBinaryExprNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
@ -124,9 +124,9 @@ FloatBinaryExprNode *FloatBinaryExprNode::alloc( S32 lineNumber, S32 op, ExprNod
return ret;
}
IntBinaryExprNode *IntBinaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *left, ExprNode *right )
IntBinaryExprNode *IntBinaryExprNode::alloc(S32 lineNumber, S32 op, ExprNode *left, ExprNode *right)
{
IntBinaryExprNode *ret = (IntBinaryExprNode *) consoleAlloc(sizeof(IntBinaryExprNode));
IntBinaryExprNode *ret = (IntBinaryExprNode *)consoleAlloc(sizeof(IntBinaryExprNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
@ -137,9 +137,9 @@ IntBinaryExprNode *IntBinaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *l
return ret;
}
StreqExprNode *StreqExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *right, bool eq )
StreqExprNode *StreqExprNode::alloc(S32 lineNumber, ExprNode *left, ExprNode *right, bool eq)
{
StreqExprNode *ret = (StreqExprNode *) consoleAlloc(sizeof(StreqExprNode));
StreqExprNode *ret = (StreqExprNode *)consoleAlloc(sizeof(StreqExprNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->left = left;
@ -149,9 +149,9 @@ StreqExprNode *StreqExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *r
return ret;
}
StrcatExprNode *StrcatExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar )
StrcatExprNode *StrcatExprNode::alloc(S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar)
{
StrcatExprNode *ret = (StrcatExprNode *) consoleAlloc(sizeof(StrcatExprNode));
StrcatExprNode *ret = (StrcatExprNode *)consoleAlloc(sizeof(StrcatExprNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->left = left;
@ -161,9 +161,9 @@ StrcatExprNode *StrcatExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode
return ret;
}
CommaCatExprNode *CommaCatExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *right )
CommaCatExprNode *CommaCatExprNode::alloc(S32 lineNumber, ExprNode *left, ExprNode *right)
{
CommaCatExprNode *ret = (CommaCatExprNode *) consoleAlloc(sizeof(CommaCatExprNode));
CommaCatExprNode *ret = (CommaCatExprNode *)consoleAlloc(sizeof(CommaCatExprNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->left = left;
@ -172,9 +172,9 @@ CommaCatExprNode *CommaCatExprNode::alloc( S32 lineNumber, ExprNode *left, ExprN
return ret;
}
IntUnaryExprNode *IntUnaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *expr )
IntUnaryExprNode *IntUnaryExprNode::alloc(S32 lineNumber, S32 op, ExprNode *expr)
{
IntUnaryExprNode *ret = (IntUnaryExprNode *) consoleAlloc(sizeof(IntUnaryExprNode));
IntUnaryExprNode *ret = (IntUnaryExprNode *)consoleAlloc(sizeof(IntUnaryExprNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->op = op;
@ -182,9 +182,9 @@ IntUnaryExprNode *IntUnaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *exp
return ret;
}
FloatUnaryExprNode *FloatUnaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *expr )
FloatUnaryExprNode *FloatUnaryExprNode::alloc(S32 lineNumber, S32 op, ExprNode *expr)
{
FloatUnaryExprNode *ret = (FloatUnaryExprNode *) consoleAlloc(sizeof(FloatUnaryExprNode));
FloatUnaryExprNode *ret = (FloatUnaryExprNode *)consoleAlloc(sizeof(FloatUnaryExprNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->op = op;
@ -192,9 +192,9 @@ FloatUnaryExprNode *FloatUnaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode
return ret;
}
VarNode *VarNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex )
VarNode *VarNode::alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex)
{
VarNode *ret = (VarNode *) consoleAlloc(sizeof(VarNode));
VarNode *ret = (VarNode *)consoleAlloc(sizeof(VarNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->varName = varName;
@ -202,18 +202,18 @@ VarNode *VarNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arr
return ret;
}
IntNode *IntNode::alloc( S32 lineNumber, S32 value )
IntNode *IntNode::alloc(S32 lineNumber, S32 value)
{
IntNode *ret = (IntNode *) consoleAlloc(sizeof(IntNode));
IntNode *ret = (IntNode *)consoleAlloc(sizeof(IntNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->value = value;
return ret;
}
ConditionalExprNode *ConditionalExprNode::alloc( S32 lineNumber, ExprNode *testExpr, ExprNode *trueExpr, ExprNode *falseExpr )
ConditionalExprNode *ConditionalExprNode::alloc(S32 lineNumber, ExprNode *testExpr, ExprNode *trueExpr, ExprNode *falseExpr)
{
ConditionalExprNode *ret = (ConditionalExprNode *) consoleAlloc(sizeof(ConditionalExprNode));
ConditionalExprNode *ret = (ConditionalExprNode *)consoleAlloc(sizeof(ConditionalExprNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->testExpr = testExpr;
@ -223,9 +223,9 @@ ConditionalExprNode *ConditionalExprNode::alloc( S32 lineNumber, ExprNode *testE
return ret;
}
FloatNode *FloatNode::alloc( S32 lineNumber, F64 value )
FloatNode *FloatNode::alloc(S32 lineNumber, F64 value)
{
FloatNode *ret = (FloatNode *) consoleAlloc(sizeof(FloatNode));
FloatNode *ret = (FloatNode *)consoleAlloc(sizeof(FloatNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
@ -233,12 +233,12 @@ FloatNode *FloatNode::alloc( S32 lineNumber, F64 value )
return ret;
}
StrConstNode *StrConstNode::alloc( S32 lineNumber, char *str, bool tag, bool doc )
StrConstNode *StrConstNode::alloc(S32 lineNumber, char *str, bool tag, bool doc)
{
StrConstNode *ret = (StrConstNode *) consoleAlloc(sizeof(StrConstNode));
StrConstNode *ret = (StrConstNode *)consoleAlloc(sizeof(StrConstNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->str = (char *) consoleAlloc(dStrlen(str) + 1);
ret->str = (char *)consoleAlloc(dStrlen(str) + 1);
ret->tag = tag;
ret->doc = doc;
dStrcpy(ret->str, str);
@ -246,18 +246,18 @@ StrConstNode *StrConstNode::alloc( S32 lineNumber, char *str, bool tag, bool doc
return ret;
}
ConstantNode *ConstantNode::alloc( S32 lineNumber, StringTableEntry value )
ConstantNode *ConstantNode::alloc(S32 lineNumber, StringTableEntry value)
{
ConstantNode *ret = (ConstantNode *) consoleAlloc(sizeof(ConstantNode));
ConstantNode *ret = (ConstantNode *)consoleAlloc(sizeof(ConstantNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->value = value;
return ret;
}
AssignExprNode *AssignExprNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr )
AssignExprNode *AssignExprNode::alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr)
{
AssignExprNode *ret = (AssignExprNode *) consoleAlloc(sizeof(AssignExprNode));
AssignExprNode *ret = (AssignExprNode *)consoleAlloc(sizeof(AssignExprNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->varName = varName;
@ -267,9 +267,9 @@ AssignExprNode *AssignExprNode::alloc( S32 lineNumber, StringTableEntry varName,
return ret;
}
AssignOpExprNode *AssignOpExprNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr, S32 op )
AssignOpExprNode *AssignOpExprNode::alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr, S32 op)
{
AssignOpExprNode *ret = (AssignOpExprNode *) consoleAlloc(sizeof(AssignOpExprNode));
AssignOpExprNode *ret = (AssignOpExprNode *)consoleAlloc(sizeof(AssignOpExprNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->varName = varName;
@ -279,9 +279,9 @@ AssignOpExprNode *AssignOpExprNode::alloc( S32 lineNumber, StringTableEntry varN
return ret;
}
TTagSetStmtNode *TTagSetStmtNode::alloc( S32 lineNumber, StringTableEntry tag, ExprNode *valueExpr, ExprNode *stringExpr )
TTagSetStmtNode *TTagSetStmtNode::alloc(S32 lineNumber, StringTableEntry tag, ExprNode *valueExpr, ExprNode *stringExpr)
{
TTagSetStmtNode *ret = (TTagSetStmtNode *) consoleAlloc(sizeof(TTagSetStmtNode));
TTagSetStmtNode *ret = (TTagSetStmtNode *)consoleAlloc(sizeof(TTagSetStmtNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->tag = tag;
@ -290,37 +290,37 @@ TTagSetStmtNode *TTagSetStmtNode::alloc( S32 lineNumber, StringTableEntry tag, E
return ret;
}
TTagDerefNode *TTagDerefNode::alloc( S32 lineNumber, ExprNode *expr )
TTagDerefNode *TTagDerefNode::alloc(S32 lineNumber, ExprNode *expr)
{
TTagDerefNode *ret = (TTagDerefNode *) consoleAlloc(sizeof(TTagDerefNode));
TTagDerefNode *ret = (TTagDerefNode *)consoleAlloc(sizeof(TTagDerefNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->expr = expr;
return ret;
}
TTagExprNode *TTagExprNode::alloc( S32 lineNumber, StringTableEntry tag )
TTagExprNode *TTagExprNode::alloc(S32 lineNumber, StringTableEntry tag)
{
TTagExprNode *ret = (TTagExprNode *) consoleAlloc(sizeof(TTagExprNode));
TTagExprNode *ret = (TTagExprNode *)consoleAlloc(sizeof(TTagExprNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->tag = tag;
return ret;
}
FuncCallExprNode *FuncCallExprNode::alloc( S32 lineNumber, StringTableEntry funcName, StringTableEntry nameSpace, ExprNode *args, bool dot )
FuncCallExprNode *FuncCallExprNode::alloc(S32 lineNumber, StringTableEntry funcName, StringTableEntry nameSpace, ExprNode *args, bool dot)
{
FuncCallExprNode *ret = (FuncCallExprNode *) consoleAlloc(sizeof(FuncCallExprNode));
FuncCallExprNode *ret = (FuncCallExprNode *)consoleAlloc(sizeof(FuncCallExprNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->funcName = funcName;
ret->nameSpace = nameSpace;
ret->args = args;
if(dot)
if (dot)
ret->callType = MethodCall;
else
{
if(nameSpace && !dStricmp(nameSpace, "Parent"))
if (nameSpace && !dStricmp(nameSpace, "Parent"))
ret->callType = ParentCall;
else
ret->callType = FunctionCall;
@ -328,27 +328,37 @@ FuncCallExprNode *FuncCallExprNode::alloc( S32 lineNumber, StringTableEntry func
return ret;
}
AssertCallExprNode *AssertCallExprNode::alloc( S32 lineNumber, ExprNode *testExpr, const char *message )
FuncPointerCallExprNode *FuncPointerCallExprNode::alloc(S32 lineNumber, ExprNode *funcPointer, ExprNode *args)
{
#ifdef TORQUE_ENABLE_SCRIPTASSERTS
FuncPointerCallExprNode *ret = (FuncPointerCallExprNode *)consoleAlloc(sizeof(FuncPointerCallExprNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->funcPointer = funcPointer;
ret->args = args;
return ret;
}
AssertCallExprNode *ret = (AssertCallExprNode *) consoleAlloc(sizeof(FuncCallExprNode));
AssertCallExprNode *AssertCallExprNode::alloc(S32 lineNumber, ExprNode *testExpr, const char *message)
{
#ifdef TORQUE_ENABLE_SCRIPTASSERTS
AssertCallExprNode *ret = (AssertCallExprNode *)consoleAlloc(sizeof(FuncCallExprNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->testExpr = testExpr;
ret->message = message ? message : "TorqueScript assert!";
return ret;
#else
#else
return NULL;
#endif
#endif
}
SlotAccessNode *SlotAccessNode::alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName )
SlotAccessNode *SlotAccessNode::alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName)
{
SlotAccessNode *ret = (SlotAccessNode *) consoleAlloc(sizeof(SlotAccessNode));
SlotAccessNode *ret = (SlotAccessNode *)consoleAlloc(sizeof(SlotAccessNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->objectExpr = objectExpr;
@ -357,9 +367,9 @@ SlotAccessNode *SlotAccessNode::alloc( S32 lineNumber, ExprNode *objectExpr, Exp
return ret;
}
InternalSlotAccessNode *InternalSlotAccessNode::alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *slotExpr, bool recurse )
InternalSlotAccessNode *InternalSlotAccessNode::alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *slotExpr, bool recurse)
{
InternalSlotAccessNode *ret = (InternalSlotAccessNode *) consoleAlloc(sizeof(InternalSlotAccessNode));
InternalSlotAccessNode *ret = (InternalSlotAccessNode *)consoleAlloc(sizeof(InternalSlotAccessNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->objectExpr = objectExpr;
@ -368,9 +378,9 @@ InternalSlotAccessNode *InternalSlotAccessNode::alloc( S32 lineNumber, ExprNode
return ret;
}
SlotAssignNode *SlotAssignNode::alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName, ExprNode *valueExpr, U32 typeID /* = -1 */ )
SlotAssignNode *SlotAssignNode::alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName, ExprNode *valueExpr, U32 typeID /* = -1 */)
{
SlotAssignNode *ret = (SlotAssignNode *) consoleAlloc(sizeof(SlotAssignNode));
SlotAssignNode *ret = (SlotAssignNode *)consoleAlloc(sizeof(SlotAssignNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->objectExpr = objectExpr;
@ -381,9 +391,9 @@ SlotAssignNode *SlotAssignNode::alloc( S32 lineNumber, ExprNode *objectExpr, Exp
return ret;
}
SlotAssignOpNode *SlotAssignOpNode::alloc( S32 lineNumber, ExprNode *objectExpr, StringTableEntry slotName, ExprNode *arrayExpr, S32 op, ExprNode *valueExpr )
SlotAssignOpNode *SlotAssignOpNode::alloc(S32 lineNumber, ExprNode *objectExpr, StringTableEntry slotName, ExprNode *arrayExpr, S32 op, ExprNode *valueExpr)
{
SlotAssignOpNode *ret = (SlotAssignOpNode *) consoleAlloc(sizeof(SlotAssignOpNode));
SlotAssignOpNode *ret = (SlotAssignOpNode *)consoleAlloc(sizeof(SlotAssignOpNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->objectExpr = objectExpr;
@ -394,9 +404,9 @@ SlotAssignOpNode *SlotAssignOpNode::alloc( S32 lineNumber, ExprNode *objectExpr,
return ret;
}
ObjectDeclNode *ObjectDeclNode::alloc( S32 lineNumber, ExprNode *classNameExpr, ExprNode *objectNameExpr, ExprNode *argList, StringTableEntry parentObject, SlotAssignNode *slotDecls, ObjectDeclNode *subObjects, bool isDatablock, bool classNameInternal, bool isSingleton )
ObjectDeclNode *ObjectDeclNode::alloc(S32 lineNumber, ExprNode *classNameExpr, ExprNode *objectNameExpr, ExprNode *argList, StringTableEntry parentObject, SlotAssignNode *slotDecls, ObjectDeclNode *subObjects, bool isDatablock, bool classNameInternal, bool isSingleton)
{
ObjectDeclNode *ret = (ObjectDeclNode *) consoleAlloc(sizeof(ObjectDeclNode));
ObjectDeclNode *ret = (ObjectDeclNode *)consoleAlloc(sizeof(ObjectDeclNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->classNameExpr = classNameExpr;
@ -408,16 +418,16 @@ ObjectDeclNode *ObjectDeclNode::alloc( S32 lineNumber, ExprNode *classNameExpr,
ret->isClassNameInternal = classNameInternal;
ret->isSingleton = isSingleton;
ret->failOffset = 0;
if(parentObject)
if (parentObject)
ret->parentObject = parentObject;
else
ret->parentObject = StringTable->EmptyString();
return ret;
}
FunctionDeclStmtNode *FunctionDeclStmtNode::alloc( S32 lineNumber, StringTableEntry fnName, StringTableEntry nameSpace, VarNode *args, StmtNode *stmts )
FunctionDeclStmtNode *FunctionDeclStmtNode::alloc(S32 lineNumber, StringTableEntry fnName, StringTableEntry nameSpace, VarNode *args, StmtNode *stmts)
{
FunctionDeclStmtNode *ret = (FunctionDeclStmtNode *) consoleAlloc(sizeof(FunctionDeclStmtNode));
FunctionDeclStmtNode *ret = (FunctionDeclStmtNode *)consoleAlloc(sizeof(FunctionDeclStmtNode));
constructInPlace(ret);
ret->dbgLineNumber = lineNumber;
ret->fnName = fnName;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -35,6 +35,7 @@ class ConsoleValueRef;
/// This class represents a block of code, usually mapped directly to a file.
class CodeBlock
{
friend class CodeInterpreter;
private:
static CodeBlock* smCodeBlockList;
static CodeBlock* smCurrentCodeBlock;
@ -89,7 +90,7 @@ public:
void calcBreakList();
void clearAllBreaks();
void setAllBreaks();
void dumpInstructions( U32 startIp = 0, bool upToReturn = false );
void dumpInstructions(U32 startIp = 0, bool upToReturn = false);
/// Returns the first breakable line or 0 if none was found.
/// @param lineNumber The one based line number.
@ -106,7 +107,7 @@ public:
const char *getFileLine(U32 ip);
///
String getFunctionArgs( U32 offset );
String getFunctionArgs(U32 offset);
bool read(StringTableEntry fileName, Stream &st);
bool compile(const char *dsoName, StringTableEntry fileName, const char *script, bool overrideNoDso = false);
@ -130,7 +131,7 @@ public:
/// -1 a new frame is created. If the index is out of range the
/// top stack frame is used.
ConsoleValueRef compileExec(StringTableEntry fileName, const char *script,
bool noCalls, S32 setFrame = -1 );
bool noCalls, S32 setFrame = -1);
/// Executes the existing code in the CodeBlock. The return string is any
/// result of the code executed, if any, or an empty string.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,262 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#ifndef _CODEINTERPRETER_H_
#define _CODEINTERPRETER_H_
#include "console/codeBlock.h"
#include "console/console.h"
#include "console/consoleInternal.h"
/// Frame data for a foreach/foreach$ loop.
struct IterStackRecord
{
/// If true, this is a foreach$ loop; if not, it's a foreach loop.
bool mIsStringIter;
/// The iterator variable.
Dictionary::Entry* mVariable;
/// Information for an object iterator loop.
struct ObjectPos
{
/// The set being iterated over.
SimSet* mSet;
/// Current index in the set.
U32 mIndex;
};
/// Information for a string iterator loop.
struct StringPos
{
/// The raw string data on the string stack.
StringStackPtr mString;
/// Current parsing position.
U32 mIndex;
};
union
{
ObjectPos mObj;
StringPos mStr;
} mData;
};
enum OPCodeReturn
{
exitCode = -1,
success = 0,
breakContinue = 1
};
class CodeInterpreter
{
public:
CodeInterpreter(CodeBlock *cb);
~CodeInterpreter();
ConsoleValueRef exec(U32 ip,
StringTableEntry functionName,
Namespace *thisNamespace,
U32 argc,
ConsoleValueRef *argv,
bool noCalls,
StringTableEntry packageName,
S32 setFrame);
static void init();
// Methods
private:
void parseArgs(U32 &ip);
/// Group op codes
/// @{
OPCodeReturn op_func_decl(U32 &ip);
OPCodeReturn op_create_object(U32 &ip);
OPCodeReturn op_add_object(U32 &ip);
OPCodeReturn op_end_object(U32 &ip);
OPCodeReturn op_finish_object(U32 &ip);
OPCodeReturn op_jmpiffnot(U32 &ip);
OPCodeReturn op_jmpifnot(U32 &ip);
OPCodeReturn op_jmpiff(U32 &ip);
OPCodeReturn op_jmpif(U32 &ip);
OPCodeReturn op_jmpifnot_np(U32 &ip);
OPCodeReturn op_jmpif_np(U32 &ip);
OPCodeReturn op_jmp(U32 &ip);
OPCodeReturn op_return_void(U32 &ip);
OPCodeReturn op_return(U32 &ip);
OPCodeReturn op_return_flt(U32 &ip);
OPCodeReturn op_return_uint(U32 &ip);
OPCodeReturn op_cmpeq(U32 &ip);
OPCodeReturn op_cmpgr(U32 &ip);
OPCodeReturn op_cmpge(U32 &ip);
OPCodeReturn op_cmplt(U32 &ip);
OPCodeReturn op_cmple(U32 &ip);
OPCodeReturn op_cmpne(U32 &ip);
OPCodeReturn op_xor(U32 &ip);
OPCodeReturn op_mod(U32 &ip);
OPCodeReturn op_bitand(U32 &ip);
OPCodeReturn op_bitor(U32 &ip);
OPCodeReturn op_not(U32 &ip);
OPCodeReturn op_notf(U32 &ip);
OPCodeReturn op_onescomplement(U32 &ip);
OPCodeReturn op_shr(U32 &ip);
OPCodeReturn op_shl(U32 &ip);
OPCodeReturn op_and(U32 &ip);
OPCodeReturn op_or(U32 &ip);
OPCodeReturn op_add(U32 &ip);
OPCodeReturn op_sub(U32 &ip);
OPCodeReturn op_mul(U32 &ip);
OPCodeReturn op_div(U32 &ip);
OPCodeReturn op_neg(U32 &ip);
OPCodeReturn op_inc(U32 &ip);
OPCodeReturn op_dec(U32 &ip);
OPCodeReturn op_setcurvar(U32 &ip);
OPCodeReturn op_setcurvar_create(U32 &ip);
OPCodeReturn op_setcurvar_array(U32 &ip);
OPCodeReturn op_setcurvar_array_varlookup(U32 &ip);
OPCodeReturn op_setcurvar_array_create(U32 &ip);
OPCodeReturn op_setcurvar_array_create_varlookup(U32 &ip);
OPCodeReturn op_loadvar_uint(U32 &ip);
OPCodeReturn op_loadvar_flt(U32 &ip);
OPCodeReturn op_loadvar_str(U32 &ip);
OPCodeReturn op_loadvar_var(U32 &ip);
OPCodeReturn op_savevar_uint(U32 &ip);
OPCodeReturn op_savevar_flt(U32 &ip);
OPCodeReturn op_savevar_str(U32 &ip);
OPCodeReturn op_savevar_var(U32 &ip);
OPCodeReturn op_setcurobject(U32 &ip);
OPCodeReturn op_setcurobject_internal(U32 &ip);
OPCodeReturn op_setcurobject_new(U32 &ip);
OPCodeReturn op_setcurfield(U32 &ip);
OPCodeReturn op_setcurfield_array(U32 &ip);
OPCodeReturn op_setcurfield_type(U32 &ip);
OPCodeReturn op_setcurfield_this(U32 &ip);
OPCodeReturn op_setcurfield_array_var(U32 &ip);
OPCodeReturn op_loadfield_uint(U32 &ip);
OPCodeReturn op_loadfield_flt(U32 &ip);
OPCodeReturn op_loadfield_str(U32 &ip);
OPCodeReturn op_savefield_uint(U32 &ip);
OPCodeReturn op_savefield_flt(U32 &ip);
OPCodeReturn op_savefield_str(U32 &ip);
OPCodeReturn op_str_to_uint(U32 &ip);
OPCodeReturn op_str_to_flt(U32 &ip);
OPCodeReturn op_str_to_none(U32 &ip);
OPCodeReturn op_flt_to_uint(U32 &ip);
OPCodeReturn op_flt_to_str(U32 &ip);
OPCodeReturn op_flt_to_none(U32 &ip);
OPCodeReturn op_uint_to_flt(U32 &ip);
OPCodeReturn op_uint_to_str(U32 &ip);
OPCodeReturn op_uint_to_none(U32 &ip);
OPCodeReturn op_copyvar_to_none(U32 &ip);
OPCodeReturn op_loadimmed_uint(U32 &ip);
OPCodeReturn op_loadimmed_flt(U32 &ip);
OPCodeReturn op_tag_to_str(U32 &ip);
OPCodeReturn op_loadimmed_str(U32 &ip);
OPCodeReturn op_docblock_str(U32 &ip);
OPCodeReturn op_loadimmed_ident(U32 &ip);
OPCodeReturn op_callfunc_resolve(U32 &ip);
OPCodeReturn op_callfunc(U32 &ip);
OPCodeReturn op_callfunc_pointer(U32 &ip);
OPCodeReturn op_callfunc_this(U32 &ip);
OPCodeReturn op_advance_str(U32 &ip);
OPCodeReturn op_advance_str_appendchar(U32 &ip);
OPCodeReturn op_advance_str_comma(U32 &ip);
OPCodeReturn op_advance_str_nul(U32 &ip);
OPCodeReturn op_rewind_str(U32 &ip);
OPCodeReturn op_terminate_rewind_str(U32 &ip);
OPCodeReturn op_compare_str(U32 &ip);
OPCodeReturn op_push(U32 &ip);
OPCodeReturn op_push_uint(U32 &ip);
OPCodeReturn op_push_flt(U32 &ip);
OPCodeReturn op_push_var(U32 &ip);
OPCodeReturn op_push_this(U32 &ip);
OPCodeReturn op_push_frame(U32 &ip);
OPCodeReturn op_assert(U32 &ip);
OPCodeReturn op_break(U32 &ip);
OPCodeReturn op_iter_begin_str(U32 &ip);
OPCodeReturn op_iter_begin(U32 &ip);
OPCodeReturn op_iter(U32 &ip);
OPCodeReturn op_iter_end(U32 &ip);
OPCodeReturn op_invalid(U32 &ip);
/// @}
private:
CodeBlock *mCodeBlock;
/// Group exec arguments.
struct
{
StringTableEntry functionName;
Namespace *thisNamespace;
U32 argc;
ConsoleValueRef *argv;
bool noCalls;
StringTableEntry packageName;
S32 setFrame;
} mExec;
U32 mIterDepth;
F64 *mCurFloatTable;
char *mCurStringTable;
StringTableEntry mThisFunctionName;
bool mPopFrame;
// Add local object creation stack [7/9/2007 Black]
static const U32 objectCreationStackSize = 32;
U32 mObjectCreationStackIndex;
struct
{
SimObject *newObject;
U32 failJump;
} mObjectCreationStack[objectCreationStackSize];
SimObject *mCurrentNewObject;
U32 mFailJump;
StringTableEntry mPrevField;
StringTableEntry mCurField;
SimObject *mPrevObject;
SimObject *mCurObject;
SimObject *mSaveObject;
SimObject *mThisObject;
Namespace::Entry *mNSEntry;
StringTableEntry mCurFNDocBlock;
StringTableEntry mCurNSDocBlock;
U32 mCallArgc;
ConsoleValueRef *mCallArgv;
CodeBlock *mSaveCodeBlock;
// note: anything returned is pushed to CSTK and will be invalidated on the next exec()
ConsoleValueRef mReturnValue;
U32 mCurrentInstruction;
static const S32 nsDocLength = 128;
char mNSDocBlockClass[nsDocLength];
};
#endif

File diff suppressed because it is too large Load diff

View file

@ -40,13 +40,13 @@ namespace Compiler
F64 consoleStringToNumber(const char *str, StringTableEntry file, U32 line)
{
F64 val = dAtof(str);
if(val != 0)
if (val != 0)
return val;
else if(!dStricmp(str, "true"))
else if (!dStricmp(str, "true"))
return 1;
else if(!dStricmp(str, "false"))
else if (!dStricmp(str, "false"))
return 0;
else if(file)
else if (file)
{
Con::warnf(ConsoleLogEntry::General, "%s (%d): string always evaluates to 0.", file, line);
return 0;
@ -74,13 +74,13 @@ namespace Compiler
void compileSTEtoCode(StringTableEntry ste, U32 ip, U32 *ptr)
{
if(ste)
if (ste)
getIdentTable().add(ste, ip);
*ptr = 0;
*(ptr+1) = 0;
*(ptr + 1) = 0;
}
void (*STEtoCode)(StringTableEntry ste, U32 ip, U32 *ptr) = evalSTEtoCode;
void(*STEtoCode)(StringTableEntry ste, U32 ip, U32 *ptr) = evalSTEtoCode;
//------------------------------------------------------------
@ -92,19 +92,19 @@ namespace Compiler
CompilerStringTable &getGlobalStringTable() { return gGlobalStringTable; }
CompilerStringTable &getFunctionStringTable() { return gFunctionStringTable; }
void setCurrentStringTable (CompilerStringTable* cst) { gCurrentStringTable = cst; }
void setCurrentStringTable(CompilerStringTable* cst) { gCurrentStringTable = cst; }
CompilerFloatTable *getCurrentFloatTable() { return gCurrentFloatTable; }
CompilerFloatTable &getGlobalFloatTable() { return gGlobalFloatTable; }
CompilerFloatTable &getFunctionFloatTable() { return gFunctionFloatTable; }
void setCurrentFloatTable (CompilerFloatTable* cst) { gCurrentFloatTable = cst; }
void setCurrentFloatTable(CompilerFloatTable* cst) { gCurrentFloatTable = cst; }
CompilerIdentTable &getIdentTable() { return gIdentTable; }
void precompileIdent(StringTableEntry ident)
{
if(ident)
if (ident)
gGlobalStringTable.add(ident);
}
@ -135,36 +135,40 @@ U32 CompilerStringTable::add(const char *str, bool caseSens, bool tag)
{
// Is it already in?
Entry **walk;
for(walk = &list; *walk; walk = &((*walk)->next))
for (walk = &list; *walk; walk = &((*walk)->next))
{
if((*walk)->tag != tag)
if ((*walk)->tag != tag)
continue;
if(caseSens)
if (caseSens)
{
if(!dStrcmp((*walk)->string, str))
if (!dStrcmp((*walk)->string, str))
return (*walk)->start;
}
else
{
if(!dStricmp((*walk)->string, str))
if (!dStricmp((*walk)->string, str))
return (*walk)->start;
}
}
// Write it out.
Entry *newStr = (Entry *) consoleAlloc(sizeof(Entry));
Entry *newStr = (Entry *)consoleAlloc(sizeof(Entry));
*walk = newStr;
newStr->next = NULL;
newStr->start = totalLen;
U32 len = dStrlen(str) + 1;
if(tag && len < 7) // alloc space for the numeric tag 1 for tag, 5 for # and 1 for nul
if (tag && len < 7) // alloc space for the numeric tag 1 for tag, 5 for # and 1 for nul
len = 7;
totalLen += len;
newStr->string = (char *) consoleAlloc(len);
newStr->string = (char *)consoleAlloc(len);
newStr->len = len;
newStr->tag = tag;
dStrcpy(newStr->string, str);
// Put into the hash table.
hashTable[str] = newStr;
return newStr->start;
}
@ -189,7 +193,8 @@ void CompilerStringTable::reset()
char *CompilerStringTable::build()
{
char *ret = new char[totalLen];
for(Entry *walk = list; walk; walk = walk->next)
dMemset(ret, 0, totalLen);
for (Entry *walk = list; walk; walk = walk->next)
dStrcpy(ret + walk->start, walk->string);
return ret;
}
@ -197,7 +202,7 @@ char *CompilerStringTable::build()
void CompilerStringTable::write(Stream &st)
{
st.write(totalLen);
for(Entry *walk = list; walk; walk = walk->next)
for (Entry *walk = list; walk; walk = walk->next)
st.write(walk->len, walk->string);
}
@ -207,15 +212,15 @@ U32 CompilerFloatTable::add(F64 value)
{
Entry **walk;
U32 i = 0;
for(walk = &list; *walk; walk = &((*walk)->next), i++)
if(value == (*walk)->val)
for (walk = &list; *walk; walk = &((*walk)->next), i++)
if (value == (*walk)->val)
return i;
Entry *newFloat = (Entry *) consoleAlloc(sizeof(Entry));
Entry *newFloat = (Entry *)consoleAlloc(sizeof(Entry));
newFloat->val = value;
newFloat->next = NULL;
count++;
*walk = newFloat;
return count-1;
return count - 1;
}
void CompilerFloatTable::reset()
{
@ -226,7 +231,7 @@ F64 *CompilerFloatTable::build()
{
F64 *ret = new F64[count];
U32 i = 0;
for(Entry *walk = list; walk; walk = walk->next, i++)
for (Entry *walk = list; walk; walk = walk->next, i++)
ret[i] = walk->val;
return ret;
}
@ -234,7 +239,7 @@ F64 *CompilerFloatTable::build()
void CompilerFloatTable::write(Stream &st)
{
st.write(count);
for(Entry *walk = list; walk; walk = walk->next)
for (Entry *walk = list; walk; walk = walk->next)
st.write(walk->val);
}
@ -248,12 +253,12 @@ void CompilerIdentTable::reset()
void CompilerIdentTable::add(StringTableEntry ste, U32 ip)
{
U32 index = gGlobalStringTable.add(ste, false);
Entry *newEntry = (Entry *) consoleAlloc(sizeof(Entry));
Entry *newEntry = (Entry *)consoleAlloc(sizeof(Entry));
newEntry->offset = index;
newEntry->ip = ip;
for(Entry *walk = list; walk; walk = walk->next)
for (Entry *walk = list; walk; walk = walk->next)
{
if(walk->offset == index)
if (walk->offset == index)
{
newEntry->nextIdent = walk->nextIdent;
walk->nextIdent = newEntry;
@ -269,18 +274,18 @@ void CompilerIdentTable::write(Stream &st)
{
U32 count = 0;
Entry * walk;
for(walk = list; walk; walk = walk->next)
for (walk = list; walk; walk = walk->next)
count++;
st.write(count);
for(walk = list; walk; walk = walk->next)
for (walk = list; walk; walk = walk->next)
{
U32 ec = 0;
Entry * el;
for(el = walk; el; el = el->nextIdent)
for (el = walk; el; el = el->nextIdent)
ec++;
st.write(walk->offset);
st.write(ec);
for(el = walk; el; el = el->nextIdent)
for (el = walk; el; el = el->nextIdent)
st.write(el->ip);
}
}
@ -320,10 +325,10 @@ void CodeStream::fixLoop(U32 loopBlockStart, U32 breakPoint, U32 continuePoint)
{
AssertFatal(mFixStack.size() > 0, "Fix stack mismatch");
U32 fixStart = mFixStack[mFixStack.size()-1];
for (U32 i=fixStart; i<mFixList.size(); i += 2)
U32 fixStart = mFixStack[mFixStack.size() - 1];
for (U32 i = fixStart; i<mFixList.size(); i += 2)
{
FixType type = (FixType)mFixList[i+1];
FixType type = (FixType)mFixList[i + 1];
U32 fixedIp = 0;
bool valid = true;
@ -377,7 +382,7 @@ void CodeStream::emitCodeStream(U32 *size, U32 **stream, U32 **lineBreaks)
dMemcpy(*lineBreaks, mBreakLines.address(), sizeof(U32) * mBreakLines.size());
// Apply patches on top
for (U32 i=0; i<mPatchList.size(); i++)
for (U32 i = 0; i<mPatchList.size(); i++)
{
PatchEntry &e = mPatchList[i];
(*stream)[e.addr] = e.value;

View file

@ -30,6 +30,9 @@
#include <stdio.h>
#endif
#include <string>
#include <unordered_map>
class Stream;
class DataChunker;
@ -91,10 +94,15 @@ namespace Compiler
OP_DIV,
OP_NEG,
OP_INC,
OP_DEC,
OP_SETCURVAR,
OP_SETCURVAR_CREATE,
OP_SETCURVAR_ARRAY,
OP_SETCURVAR_ARRAY_VARLOOKUP,
OP_SETCURVAR_ARRAY_CREATE,
OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP,
OP_LOADVAR_UINT,// 40
OP_LOADVAR_FLT,
@ -113,6 +121,8 @@ namespace Compiler
OP_SETCURFIELD,
OP_SETCURFIELD_ARRAY, // 50
OP_SETCURFIELD_TYPE,
OP_SETCURFIELD_ARRAY_VAR,
OP_SETCURFIELD_THIS,
OP_LOADFIELD_UINT,
OP_LOADFIELD_FLT,
@ -142,6 +152,8 @@ namespace Compiler
OP_CALLFUNC_RESOLVE,
OP_CALLFUNC,
OP_CALLFUNC_POINTER,
OP_CALLFUNC_THIS,
OP_ADVANCE_STR,
OP_ADVANCE_STR_APPENDCHAR,
@ -155,6 +167,7 @@ namespace Compiler
OP_PUSH_UINT, // Integer
OP_PUSH_FLT, // Float
OP_PUSH_VAR, // Variable
OP_PUSH_THIS, // This pointer
OP_PUSH_FRAME, // Frame
OP_ASSERT,
@ -165,7 +178,9 @@ namespace Compiler
OP_ITER, ///< Enter foreach loop.
OP_ITER_END, ///< End foreach loop.
OP_INVALID // 90
OP_INVALID, // 90
MAX_OP_CODELEN ///< The amount of op codes.
};
//------------------------------------------------------------
@ -207,6 +222,7 @@ namespace Compiler
Entry *list;
char buf[256];
std::unordered_map<std::string, Entry*> hashTable;
U32 add(const char *str, bool caseSens = true, bool tag = false);
U32 addIntString(U32 value);
@ -239,13 +255,13 @@ namespace Compiler
inline StringTableEntry CodeToSTE(U32 *code, U32 ip)
{
#ifdef TORQUE_CPU_X64
return (StringTableEntry)(*((U64*)(code+ip)));
return (StringTableEntry)(*((U64*)(code + ip)));
#else
return (StringTableEntry)(*(code+ip));
return (StringTableEntry)(*(code + ip));
#endif
}
extern void (*STEtoCode)(StringTableEntry ste, U32 ip, U32 *ptr);
extern void(*STEtoCode)(StringTableEntry ste, U32 ip, U32 *ptr);
void evalSTEtoCode(StringTableEntry ste, U32 ip, U32 *ptr);
void compileSTEtoCode(StringTableEntry ste, U32 ip, U32 *ptr);
@ -254,13 +270,13 @@ namespace Compiler
CompilerStringTable &getGlobalStringTable();
CompilerStringTable &getFunctionStringTable();
void setCurrentStringTable (CompilerStringTable* cst);
void setCurrentStringTable(CompilerStringTable* cst);
CompilerFloatTable *getCurrentFloatTable();
CompilerFloatTable &getGlobalFloatTable();
CompilerFloatTable &getFunctionFloatTable();
void setCurrentFloatTable (CompilerFloatTable* cst);
void setCurrentFloatTable(CompilerFloatTable* cst);
CompilerIdentTable &getIdentTable();
@ -301,8 +317,8 @@ protected:
U32 addr; ///< Address to patch
U32 value; ///< Value to place at addr
PatchEntry() {;}
PatchEntry(U32 a, U32 v) : addr(a), value(v) {;}
PatchEntry() { ; }
PatchEntry(U32 a, U32 v) : addr(a), value(v) { ; }
} PatchEntry;
typedef struct CodeData
@ -375,7 +391,7 @@ public:
printf("code[%u] = %s\n", mCodePos, code);
#endif
mCodePos += 2;
return mCodePos-2;
return mCodePos - 2;
}
inline U32 tell()
@ -385,7 +401,7 @@ public:
inline bool inLoop()
{
for (U32 i=0; i<mFixLoopStack.size(); i++)
for (U32 i = 0; i<mFixLoopStack.size(); i++)
{
if (mFixLoopStack[i])
return true;
@ -417,7 +433,7 @@ public:
{
AssertFatal(mFixStack.size() > 0, "Fix stack mismatch");
U32 newSize = mFixStack[mFixStack.size()-1];
U32 newSize = mFixStack[mFixStack.size() - 1];
while (mFixList.size() > newSize)
mFixList.pop_back();
mFixStack.pop_back();

View file

@ -24,13 +24,13 @@
#define _CONSOLE_H_
#ifndef _PLATFORM_H_
#include "platform/platform.h"
#include "platform/platform.h"
#endif
#ifndef _BITSET_H_
#include "core/bitSet.h"
#include "core/bitSet.h"
#endif
#ifndef _REFBASE_H_
#include "core/util/refBase.h"
#include "core/util/refBase.h"
#endif
#include <stdarg.h>
@ -201,8 +201,8 @@ public:
ival = 0;
fval = 0;
}
ConsoleValue(){ init(); };
~ConsoleValue(){ cleanup(); };
ConsoleValue() { init(); };
~ConsoleValue() { cleanup(); };
};
// Proxy class for console variables
@ -320,12 +320,12 @@ public:
///
typedef const char * (*StringCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]);
typedef S32 (*IntCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]);
typedef F32 (*FloatCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]);
typedef void (*VoidCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); // We have it return a value so things don't break..
typedef bool (*BoolCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]);
typedef S32(*IntCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]);
typedef F32(*FloatCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]);
typedef void(*VoidCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); // We have it return a value so things don't break..
typedef bool(*BoolCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]);
typedef void (*ConsumerCallback)(U32 level, const char *consoleLine);
typedef void(*ConsumerCallback)(U32 level, const char *consoleLine);
/// @}
/// @defgroup console_types Scripting Engine Type Functions
@ -333,7 +333,7 @@ typedef void (*ConsumerCallback)(U32 level, const char *consoleLine);
/// @see Con::registerType
/// @{
typedef const char* (*GetDataFunction)(void *dptr, EnumTable *tbl, BitSet32 flag);
typedef void (*SetDataFunction)(void *dptr, S32 argc, const char **argv, EnumTable *tbl, BitSet32 flag);
typedef void(*SetDataFunction)(void *dptr, S32 argc, const char **argv, EnumTable *tbl, BitSet32 flag);
/// @}
/// This namespace contains the core of the console functionality.
@ -361,20 +361,22 @@ namespace Con
/// 12/29/04 - BJG - 33->34 Removed some opcodes, part of namespace upgrade.
/// 12/30/04 - BJG - 34->35 Reordered some things, further general shuffling.
/// 11/03/05 - BJG - 35->36 Integrated new debugger code.
// 09/08/06 - THB - 36->37 New opcode for internal names
// 09/15/06 - THB - 37->38 Added unit conversions
// 11/23/06 - THB - 38->39 Added recursive internal name operator
// 02/15/07 - THB - 39->40 Bumping to 40 for TGB since the console has been
// majorly hacked without the version number being bumped
// 02/16/07 - THB - 40->41 newmsg operator
// 06/15/07 - THB - 41->42 script types
/// 09/08/06 - THB - 36->37 New opcode for internal names
/// 09/15/06 - THB - 37->38 Added unit conversions
/// 11/23/06 - THB - 38->39 Added recursive internal name operator
/// 02/15/07 - THB - 39->40 Bumping to 40 for TGB since the console has been
/// majorly hacked without the version number being bumped
/// 02/16/07 - THB - 40->41 newmsg operator
/// 06/15/07 - THB - 41->42 script types
/// 07/31/07 - THB - 42->43 Patch from Andreas Kirsch: Added opcode to support nested new declarations.
/// 09/12/07 - CAF - 43->44 remove newmsg operator
/// 09/27/07 - RDB - 44->45 Patch from Andreas Kirsch: Added opcode to support correct void return
/// 01/13/09 - TMS - 45->46 Added script assert
/// 09/07/14 - jamesu - 46->47 64bit support
/// 10/14/14 - jamesu - 47->48 Added opcodes to reduce reliance on strings in function calls
DSOVersion = 48,
/// 10/07/17 - JTH - 48->49 Added opcode for function pointers and revamp of interpreter
/// from switch to function calls.
DSOVersion = 49,
MaxLineLength = 512, ///< Maximum length of a line of console input.
MaxDataTypes = 256 ///< Maximum number of registered data types.
@ -552,10 +554,10 @@ namespace Con
/// @param usage Documentation string.
///
/// @see ConsoleDynamicTypes
void addVariable( const char *name,
void addVariable(const char *name,
S32 type,
void *pointer,
const char* usage = NULL );
const char* usage = NULL);
/// Add a console constant that references the value of a constant in C++ code.
///
@ -565,10 +567,10 @@ namespace Con
/// @param usage Documentation string.
///
/// @see ConsoleDynamicTypes
void addConstant( const char *name,
void addConstant(const char *name,
S32 type,
const void *pointer,
const char* usage = NULL );
const char* usage = NULL);
/// Remove a console variable.
///
@ -582,14 +584,14 @@ namespace Con
/// @param name An existing global console variable name.
/// @param callback The notification delegate function.
///
void addVariableNotify( const char *name, const NotifyDelegate &callback );
void addVariableNotify(const char *name, const NotifyDelegate &callback);
/// Remove an existing variable assignment notification callback.
///
/// @param name An existing global console variable name.
/// @param callback The notification delegate function.
///
void removeVariableNotify( const char *name, const NotifyDelegate &callback );
void removeVariableNotify(const char *name, const NotifyDelegate &callback);
/// Assign a string value to a locally scoped console variable
///
@ -628,31 +630,31 @@ namespace Con
const char* getObjectField(const char* name);
/// Same as setVariable(), but for bools.
void setBoolVariable (const char* name,bool var);
void setBoolVariable(const char* name, bool var);
/// Same as getVariable(), but for bools.
///
/// @param name Name of the variable.
/// @param def Default value to supply if no matching variable is found.
bool getBoolVariable (const char* name,bool def = false);
bool getBoolVariable(const char* name, bool def = false);
/// Same as setVariable(), but for ints.
void setIntVariable (const char* name,S32 var);
void setIntVariable(const char* name, S32 var);
/// Same as getVariable(), but for ints.
///
/// @param name Name of the variable.
/// @param def Default value to supply if no matching variable is found.
S32 getIntVariable (const char* name,S32 def = 0);
S32 getIntVariable(const char* name, S32 def = 0);
/// Same as setVariable(), but for floats.
void setFloatVariable(const char* name,F32 var);
void setFloatVariable(const char* name, F32 var);
/// Same as getVariable(), but for floats.
///
/// @param name Name of the variable.
/// @param def Default value to supply if no matching variable is found.
F32 getFloatVariable(const char* name,F32 def = .0f);
F32 getFloatVariable(const char* name, F32 def = .0f);
/// @}
@ -668,12 +670,12 @@ namespace Con
/// @param maxArgs Maximum number of arguments this function accepts
/// @param toolOnly Wether this is a TORQUE_TOOLS only function.
/// @param header The extended function header.
void addCommand( const char* name, StringCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL );
void addCommand(const char* name, StringCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);
void addCommand( const char* name, IntCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
void addCommand( const char* name, FloatCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
void addCommand( const char* name, VoidCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
void addCommand( const char* name, BoolCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
void addCommand(const char* name, IntCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
void addCommand(const char* name, FloatCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
void addCommand(const char* name, VoidCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
void addCommand(const char* name, BoolCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
/// @}
@ -691,12 +693,12 @@ namespace Con
/// @param maxArgs Maximum number of arguments this function accepts
/// @param toolOnly Wether this is a TORQUE_TOOLS only function.
/// @param header The extended function header.
void addCommand(const char *nameSpace, const char *name,StringCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL );
void addCommand(const char *nameSpace, const char *name, StringCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);
void addCommand(const char *nameSpace, const char *name,IntCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
void addCommand(const char *nameSpace, const char *name,FloatCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
void addCommand(const char *nameSpace, const char *name,VoidCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
void addCommand(const char *nameSpace, const char *name,BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
void addCommand(const char *nameSpace, const char *name, IntCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
void addCommand(const char *nameSpace, const char *name, FloatCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
void addCommand(const char *nameSpace, const char *name, VoidCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
void addCommand(const char *nameSpace, const char *name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* )
/// @}
@ -709,11 +711,11 @@ namespace Con
///
/// @{
void markCommandGroup (const char * nsName, const char *name, const char* usage=NULL);
void markCommandGroup(const char * nsName, const char *name, const char* usage = NULL);
void beginCommandGroup(const char * nsName, const char *name, const char* usage);
void endCommandGroup (const char * nsName, const char *name);
void endCommandGroup(const char * nsName, const char *name);
void noteScriptCallback( const char *className, const char *funcName, const char *usage, ConsoleFunctionHeader* header = NULL );
void noteScriptCallback(const char *className, const char *funcName, const char *usage, ConsoleFunctionHeader* header = NULL);
/// @}
@ -841,15 +843,15 @@ namespace Con
///
char* getReturnBuffer(U32 bufferSize);
char* getReturnBuffer(const char *stringToCopy);
char* getReturnBuffer( const String& str );
char* getReturnBuffer( const StringBuilder& str );
char* getReturnBuffer(const String& str);
char* getReturnBuffer(const StringBuilder& str);
char* getArgBuffer(U32 bufferSize);
char* getFloatArg(F64 arg);
char* getIntArg (S32 arg);
char* getIntArg(S32 arg);
char* getBoolArg(bool arg);
char* getStringArg( const char* arg );
char* getStringArg( const String& arg );
char* getStringArg(const char* arg);
char* getStringArg(const String& arg);
/// @}
/// @name Namespaces
@ -877,7 +879,7 @@ namespace Con
/// @name Instant Group
/// @{
void pushInstantGroup( String name = String() );
void pushInstantGroup(String name = String());
void popInstantGroup();
/// @}
@ -915,7 +917,7 @@ namespace Con
template<typename R, typename ...ArgTs>
ConsoleValueRef executef(R r, ArgTs ...argTs)
{
_EngineConsoleExecCallbackHelper<R> callback( r );
_EngineConsoleExecCallbackHelper<R> callback(r);
return callback.template call<ConsoleValueRef>(argTs...);
}
/// }
@ -945,11 +947,11 @@ struct ConsoleFunctionHeader
const char* returnString,
const char* argString,
const char* defaultArgString,
bool isStatic = false )
: mReturnString( returnString ),
mArgString( argString ),
mDefaultArgString( defaultArgString ),
mIsStatic( isStatic ) {}
bool isStatic = false)
: mReturnString(returnString),
mArgString(argString),
mDefaultArgString(defaultArgString),
mIsStatic(isStatic) {}
};
@ -1067,7 +1069,7 @@ public:
ConsoleConstructor *next;
static ConsoleConstructor *first;
void init( const char* cName, const char* fName, const char *usg, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL );
void init(const char* cName, const char* fName, const char *usg, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);
static void setup();
@ -1079,11 +1081,11 @@ public:
/// @name Basic Console Constructors
/// @{
ConsoleConstructor( const char* className, const char* funcName, StringCallback sfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL );
ConsoleConstructor( const char* className, const char* funcName, IntCallback ifunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL );
ConsoleConstructor( const char* className, const char* funcName, FloatCallback ffunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL );
ConsoleConstructor( const char* className, const char* funcName, VoidCallback vfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL );
ConsoleConstructor( const char* className, const char* funcName, BoolCallback bfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL );
ConsoleConstructor(const char* className, const char* funcName, StringCallback sfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);
ConsoleConstructor(const char* className, const char* funcName, IntCallback ifunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);
ConsoleConstructor(const char* className, const char* funcName, FloatCallback ffunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);
ConsoleConstructor(const char* className, const char* funcName, VoidCallback vfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);
ConsoleConstructor(const char* className, const char* funcName, BoolCallback bfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);
/// @}
@ -1097,10 +1099,10 @@ public:
///
/// @see Con::markCommandGroup
/// @ref console_autodoc
ConsoleConstructor( const char *className, const char *groupName, const char* usage );
ConsoleConstructor(const char *className, const char *groupName, const char* usage);
/// Indicates a callback declared with the DECLARE_SCRIPT_CALLBACK macro and friends.
ConsoleConstructor( const char *className, const char *callbackName, const char *usage, ConsoleFunctionHeader* header );
ConsoleConstructor(const char *className, const char *callbackName, const char *usage, ConsoleFunctionHeader* header);
/// @}
};
@ -1126,11 +1128,11 @@ struct ConsoleDocFragment
/// First fragment in the global link chain.
static ConsoleDocFragment* smFirst;
ConsoleDocFragment( const char* text, const char* inClass = NULL, const char* definition = NULL )
: mClass( inClass ),
mDefinition( definition ),
mText( text ),
mNext( smFirst )
ConsoleDocFragment(const char* text, const char* inClass = NULL, const char* definition = NULL)
: mClass(inClass),
mDefinition(definition),
mText(text),
mNext(smFirst)
{
smFirst = this;
}

File diff suppressed because it is too large Load diff

View file

@ -24,22 +24,21 @@
#define _CONSOLEINTERNAL_H_
#ifndef _STRINGFUNCTIONS_H_
#include "core/strings/stringFunctions.h"
#include "core/strings/stringFunctions.h"
#endif
#ifndef _STRINGTABLE_H_
#include "core/stringTable.h"
#include "core/stringTable.h"
#endif
#ifndef _CONSOLETYPES_H
#include "console/consoleTypes.h"
#include "console/consoleTypes.h"
#endif
#ifndef _CONSOLEOBJECT_H_
#include "console/simObject.h"
#include "console/simObject.h"
#endif
#ifndef _DATACHUNKER_H_
#include "core/dataChunker.h"
#include "core/dataChunker.h"
#endif
/// @ingroup console_system Console System
/// @{
@ -63,7 +62,7 @@ class Namespace
static U32 mOldNumActivePackages;
static StringTableEntry mActivePackages[MaxActivePackages];
public:
public:
StringTableEntry mName;
StringTableEntry mPackage;
@ -151,10 +150,10 @@ class Namespace
void clear();
///
ConsoleValueRef execute( S32 argc, ConsoleValueRef* argv, ExprEvalState* state );
ConsoleValueRef execute(S32 argc, ConsoleValueRef* argv, ExprEvalState* state);
/// Return a one-line documentation text string for the function.
String getBriefDescription( String* outRemainingDocText = NULL ) const;
String getBriefDescription(String* outRemainingDocText = NULL) const;
/// Get the auto-doc string for this function. This string does not included prototype information.
String getDocString() const;
@ -178,14 +177,14 @@ class Namespace
Namespace();
~Namespace();
void addFunction( StringTableEntry name, CodeBlock* cb, U32 functionOffset, const char* usage = NULL, U32 lineNumber = 0 );
void addCommand( StringTableEntry name, StringCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL );
void addCommand( StringTableEntry name, IntCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL );
void addCommand( StringTableEntry name, FloatCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL );
void addCommand( StringTableEntry name, VoidCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL );
void addCommand( StringTableEntry name, BoolCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL );
void addFunction(StringTableEntry name, CodeBlock* cb, U32 functionOffset, const char* usage = NULL, U32 lineNumber = 0);
void addCommand(StringTableEntry name, StringCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);
void addCommand(StringTableEntry name, IntCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);
void addCommand(StringTableEntry name, FloatCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);
void addCommand(StringTableEntry name, VoidCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);
void addCommand(StringTableEntry name, BoolCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);
void addScriptCallback( const char *funcName, const char *usage, ConsoleFunctionHeader* header = NULL );
void addScriptCallback(const char *funcName, const char *usage, ConsoleFunctionHeader* header = NULL);
void markGroup(const char* name, const char* usage);
char * lastUsage;
@ -210,7 +209,7 @@ class Namespace
Namespace* getPackageRoot()
{
Namespace* walk = this;
while( walk->mParent && walk->mParent->mName == mName )
while (walk->mParent && walk->mParent->mName == mName)
walk = walk->mParent;
return walk;
@ -224,8 +223,8 @@ class Namespace
/// @note Must not be called on namespaces coming from packages.
void incRefCountToParent()
{
AssertFatal( mPackage == NULL, "Namespace::incRefCountToParent - Must not be called on a namespace coming from a package!" );
mRefCountToParent ++;
AssertFatal(mPackage == NULL, "Namespace::incRefCountToParent - Must not be called on a namespace coming from a package!");
mRefCountToParent++;
}
/// Decrease the count on the reference that this namespace
@ -233,7 +232,7 @@ class Namespace
/// @note Must not be called on namespaces coming from packages.
void decRefCountToParent()
{
unlinkClass( NULL );
unlinkClass(NULL);
}
Entry *lookup(StringTableEntry name);
@ -243,7 +242,7 @@ class Namespace
void clearEntries();
bool classLinkTo(Namespace *parent);
bool unlinkClass(Namespace *parent);
void getUniqueEntryLists( Namespace *other, VectorPtr<Entry *> *outThisList, VectorPtr<Entry *> *outOtherList );
void getUniqueEntryLists(Namespace *other, VectorPtr<Entry *> *outThisList, VectorPtr<Entry *> *outOtherList);
const char *tabComplete(const char *prevText, S32 baseLen, bool fForward);
@ -258,13 +257,13 @@ class Namespace
static void shutdown();
static Namespace *global();
static Namespace *find(StringTableEntry name, StringTableEntry package=NULL);
static Namespace *find(StringTableEntry name, StringTableEntry package = NULL);
static void activatePackage(StringTableEntry name);
static void deactivatePackage(StringTableEntry name);
static void deactivatePackageStack(StringTableEntry name);
static void dumpClasses( bool dumpScript = true, bool dumpEngine = true );
static void dumpFunctions( bool dumpScript = true, bool dumpEngine = true );
static void dumpClasses(bool dumpScript = true, bool dumpEngine = true);
static void dumpFunctions(bool dumpScript = true, bool dumpEngine = true);
static void printNamespaceEntries(Namespace * g, bool dumpScript = true, bool dumpEngine = true);
static void unlinkPackages();
static void relinkPackages();
@ -318,7 +317,7 @@ public:
void reset() {
name = NULL;
value.cleanup();
if ( notify )
if (notify)
delete notify;
}
@ -339,39 +338,39 @@ public:
void setIntValue(U32 val)
{
if( mIsConstant )
if (mIsConstant)
{
Con::errorf( "Cannot assign value to constant '%s'.", name );
Con::errorf("Cannot assign value to constant '%s'.", name);
return;
}
value.setIntValue(val);
// Fire off the notification if we have one.
if ( notify )
if (notify)
notify->trigger();
}
void setFloatValue(F32 val)
{
if( mIsConstant )
if (mIsConstant)
{
Con::errorf( "Cannot assign value to constant '%s'.", name );
Con::errorf("Cannot assign value to constant '%s'.", name);
return;
}
value.setFloatValue(val);
// Fire off the notification if we have one.
if ( notify )
if (notify)
notify->trigger();
}
void setStringStackPtrValue(StringStackPtr newValue)
{
if( mIsConstant )
if (mIsConstant)
{
Con::errorf( "Cannot assign value to constant '%s'.", name );
Con::errorf("Cannot assign value to constant '%s'.", name);
return;
}
@ -379,15 +378,15 @@ public:
// Fire off the notification if we have one.
if ( notify )
if (notify)
notify->trigger();
}
void setStringValue(const char *newValue)
{
if( mIsConstant )
if (mIsConstant)
{
Con::errorf( "Cannot assign value to constant '%s'.", name );
Con::errorf("Cannot assign value to constant '%s'.", name);
return;
}
@ -395,7 +394,7 @@ public:
// Fire off the notification if we have one.
if ( notify )
if (notify)
notify->trigger();
}
};
@ -408,8 +407,8 @@ public:
Entry **data;
FreeListChunker< Entry > mChunker;
HashTableData( Dictionary* owner )
: owner( owner ), size( 0 ), count( 0 ), data( NULL ) {}
HashTableData(Dictionary* owner)
: owner(owner), size(0), count(0), data(NULL) {}
};
HashTableData* hashTable;
@ -426,13 +425,13 @@ public:
Entry *lookup(StringTableEntry name);
Entry *add(StringTableEntry name);
void setState(ExprEvalState *state, Dictionary* ref=NULL);
void setState(ExprEvalState *state, Dictionary* ref = NULL);
void remove(Entry *);
void reset();
void exportVariables( const char *varString, const char *fileName, bool append );
void exportVariables( const char *varString, Vector<String> *names, Vector<String> *values );
void deleteVariables( const char *varString );
void exportVariables(const char *varString, const char *fileName, bool append);
void exportVariables(const char *varString, Vector<String> *names, Vector<String> *values);
void deleteVariables(const char *varString);
void setVariable(StringTableEntry name, const char *value);
const char *getVariable(StringTableEntry name, bool *valid = NULL);
@ -449,19 +448,19 @@ public:
}
/// @see Con::addVariable
Entry* addVariable( const char *name,
Entry* addVariable(const char *name,
S32 type,
void *dataPtr,
const char* usage );
const char* usage);
/// @see Con::removeVariable
bool removeVariable(StringTableEntry name);
/// @see Con::addVariableNotify
void addVariableNotify( const char *name, const Con::NotifyDelegate &callback );
void addVariableNotify(const char *name, const Con::NotifyDelegate &callback);
/// @see Con::removeVariableNotify
void removeVariableNotify( const char *name, const Con::NotifyDelegate &callback );
void removeVariableNotify(const char *name, const Con::NotifyDelegate &callback);
/// Return the best tab completion for prevText, with the length
/// of the pre-tab string in baseLen.
@ -528,7 +527,7 @@ public:
Dictionary& getCurrentFrame()
{
return *( stack[ mStackDepth - 1 ] );
return *(stack[mStackDepth - 1]);
}
/// @}

View file

@ -45,7 +45,7 @@ SimNameDictionary::~SimNameDictionary()
void SimNameDictionary::insert(SimObject* obj)
{
if(!obj || !obj->objectName)
if (!obj || !obj->objectName)
return;
SimObject* checkForDup = find(obj->objectName);
@ -55,13 +55,13 @@ void SimNameDictionary::insert(SimObject* obj)
Mutex::lockMutex(mutex);
#ifndef USE_NEW_SIMDICTIONARY
if(!hashTable)
if (!hashTable)
{
hashTable = new SimObject *[DefaultTableSize];
hashTableSize = DefaultTableSize;
hashEntryCount = 0;
dMemset( hashTable, 0, sizeof( *hashTable ) * DefaultTableSize );
dMemset(hashTable, 0, sizeof(*hashTable) * DefaultTableSize);
}
S32 idx = HashPointer(obj->objectName) % hashTableSize;
@ -71,31 +71,31 @@ void SimNameDictionary::insert(SimObject* obj)
// Rehash if necessary.
if( hashEntryCount > hashTableSize )
if (hashEntryCount > hashTableSize)
{
// Allocate new table.
U32 newHashTableSize = hashTableSize * 2 + 1;
SimObject** newHashTable = new SimObject *[ newHashTableSize ];
dMemset( newHashTable, 0, sizeof( newHashTable[ 0 ] ) * newHashTableSize );
SimObject** newHashTable = new SimObject *[newHashTableSize];
dMemset(newHashTable, 0, sizeof(newHashTable[0]) * newHashTableSize);
// Move entries over.
for( U32 i = 0; i < hashTableSize; ++ i )
for( SimObject* object = hashTable[ i ]; object != NULL; )
for (U32 i = 0; i < hashTableSize; ++i)
for (SimObject* object = hashTable[i]; object != NULL; )
{
SimObject* next = object->nextNameObject;
idx = HashPointer( object->objectName ) % newHashTableSize;
object->nextNameObject = newHashTable[ idx ];
newHashTable[ idx ] = object;
idx = HashPointer(object->objectName) % newHashTableSize;
object->nextNameObject = newHashTable[idx];
newHashTable[idx] = object;
object = next;
}
// Switch tables.
delete [] hashTable;
delete[] hashTable;
hashTable = newHashTable;
hashTableSize = newHashTableSize;
}
@ -109,16 +109,16 @@ SimObject* SimNameDictionary::find(StringTableEntry name)
{
#ifndef USE_NEW_SIMDICTIONARY
// NULL is a valid lookup - it will always return NULL
if(!hashTable)
if (!hashTable)
return NULL;
Mutex::lockMutex(mutex);
S32 idx = HashPointer(name) % hashTableSize;
SimObject *walk = hashTable[idx];
while(walk)
while (walk)
{
if(walk->objectName == name)
if (walk->objectName == name)
{
Mutex::unlockMutex(mutex);
return walk;
@ -139,18 +139,18 @@ SimObject* SimNameDictionary::find(StringTableEntry name)
void SimNameDictionary::remove(SimObject* obj)
{
if(!obj || !obj->objectName)
if (!obj || !obj->objectName)
return;
Mutex::lockMutex(mutex);
#ifndef USE_NEW_SIMDICTIONARY
SimObject **walk = &hashTable[HashPointer(obj->objectName) % hashTableSize];
while(*walk)
while (*walk)
{
if(*walk == obj)
if (*walk == obj)
{
*walk = obj->nextNameObject;
obj->nextNameObject = (SimObject*)-1;
obj->nextNameObject = nullptr;
hashEntryCount--;
Mutex::unlockMutex(mutex);
@ -175,7 +175,7 @@ SimManagerNameDictionary::SimManagerNameDictionary()
hashTableSize = DefaultTableSize;
hashEntryCount = 0;
dMemset( hashTable, 0, sizeof( hashTable[ 0 ] ) * hashTableSize );
dMemset(hashTable, 0, sizeof(hashTable[0]) * hashTableSize);
#endif
mutex = Mutex::createMutex();
}
@ -190,7 +190,7 @@ SimManagerNameDictionary::~SimManagerNameDictionary()
void SimManagerNameDictionary::insert(SimObject* obj)
{
if(!obj || !obj->objectName)
if (!obj || !obj->objectName)
return;
Mutex::lockMutex(mutex);
@ -202,31 +202,31 @@ void SimManagerNameDictionary::insert(SimObject* obj)
// Rehash if necessary.
if( hashEntryCount > hashTableSize )
if (hashEntryCount > hashTableSize)
{
// Allocate new table.
U32 newHashTableSize = hashTableSize * 2 + 1;
SimObject** newHashTable = new SimObject *[ newHashTableSize ];
dMemset( newHashTable, 0, sizeof( newHashTable[ 0 ] ) * newHashTableSize );
SimObject** newHashTable = new SimObject *[newHashTableSize];
dMemset(newHashTable, 0, sizeof(newHashTable[0]) * newHashTableSize);
// Move entries over.
for( U32 i = 0; i < hashTableSize; ++ i )
for( SimObject* object = hashTable[ i ]; object != NULL; )
for (U32 i = 0; i < hashTableSize; ++i)
for (SimObject* object = hashTable[i]; object != NULL; )
{
SimObject* next = object->nextManagerNameObject;
idx = HashPointer( object->objectName ) % newHashTableSize;
object->nextManagerNameObject = newHashTable[ idx ];
newHashTable[ idx ] = object;
idx = HashPointer(object->objectName) % newHashTableSize;
object->nextManagerNameObject = newHashTable[idx];
newHashTable[idx] = object;
object = next;
}
// Switch tables.
delete [] hashTable;
delete[] hashTable;
hashTable = newHashTable;
hashTableSize = newHashTableSize;
}
@ -245,9 +245,9 @@ SimObject* SimManagerNameDictionary::find(StringTableEntry name)
#ifndef USE_NEW_SIMDICTIONARY
S32 idx = HashPointer(name) % hashTableSize;
SimObject *walk = hashTable[idx];
while(walk)
while (walk)
{
if(walk->objectName == name)
if (walk->objectName == name)
{
Mutex::unlockMutex(mutex);
return walk;
@ -267,19 +267,19 @@ SimObject* SimManagerNameDictionary::find(StringTableEntry name)
void SimManagerNameDictionary::remove(SimObject* obj)
{
if(!obj || !obj->objectName)
if (!obj || !obj->objectName)
return;
#ifndef USE_NEW_SIMDICTIONARY
Mutex::lockMutex(mutex);
SimObject **walk = &hashTable[HashPointer(obj->objectName) % hashTableSize];
while(*walk)
while (*walk)
{
if(*walk == obj)
if (*walk == obj)
{
*walk = obj->nextManagerNameObject;
obj->nextManagerNameObject = (SimObject*)-1;
obj->nextManagerNameObject = nullptr;
hashEntryCount--;
Mutex::unlockMutex(mutex);
@ -301,7 +301,7 @@ void SimManagerNameDictionary::remove(SimObject* obj)
SimIdDictionary::SimIdDictionary()
{
#ifndef USE_NEW_SIMDICTIONARY
dMemset( table, 0, sizeof( table[ 0 ] ) * DefaultTableSize );
dMemset(table, 0, sizeof(table[0]) * DefaultTableSize);
#endif
mutex = Mutex::createMutex();
}
@ -322,7 +322,7 @@ void SimIdDictionary::insert(SimObject* obj)
#ifndef USE_NEW_SIMDICTIONARY
S32 idx = obj->getId() & TableBitMask;
obj->nextIdObject = table[idx];
AssertFatal( obj->nextIdObject != obj, "SimIdDictionary::insert - Creating Infinite Loop linking to self!" );
AssertFatal(obj->nextIdObject != obj, "SimIdDictionary::insert - Creating Infinite Loop linking to self!");
table[idx] = obj;
#else
root[obj->getId()] = obj;
@ -336,9 +336,9 @@ SimObject* SimIdDictionary::find(S32 id)
#ifndef USE_NEW_SIMDICTIONARY
S32 idx = id & TableBitMask;
SimObject *walk = table[idx];
while(walk)
while (walk)
{
if(walk->getId() == U32(id))
if (walk->getId() == U32(id))
{
Mutex::unlockMutex(mutex);
return walk;
@ -364,9 +364,9 @@ void SimIdDictionary::remove(SimObject* obj)
Mutex::lockMutex(mutex);
#ifndef USE_NEW_SIMDICTIONARY
SimObject **walk = &table[obj->getId() & TableBitMask];
while(*walk && *walk != obj)
while (*walk && *walk != obj)
walk = &((*walk)->nextIdObject);
if(*walk)
if (*walk)
*walk = obj->nextIdObject;
#else
root.erase(obj->getId());

View file

@ -36,20 +36,20 @@ SimFieldDictionary::Entry *SimFieldDictionary::smFreeList = NULL;
static Chunker<SimFieldDictionary::Entry> fieldChunker;
U32 SimFieldDictionary::getHashValue( StringTableEntry slotName )
U32 SimFieldDictionary::getHashValue(StringTableEntry slotName)
{
return HashPointer( slotName ) % HashTableSize;
return HashPointer(slotName) % HashTableSize;
}
U32 SimFieldDictionary::getHashValue( const String& fieldName )
U32 SimFieldDictionary::getHashValue(const String& fieldName)
{
return getHashValue( StringTable->insert( fieldName ) );
return getHashValue(StringTable->insert(fieldName));
}
SimFieldDictionary::Entry *SimFieldDictionary::addEntry( U32 bucket, StringTableEntry slotName, ConsoleBaseType* type, char* value )
SimFieldDictionary::Entry *SimFieldDictionary::addEntry(U32 bucket, StringTableEntry slotName, ConsoleBaseType* type, char* value)
{
Entry* ret;
if(smFreeList)
if (smFreeList)
{
ret = smFreeList;
smFreeList = ret->next;
@ -57,14 +57,14 @@ SimFieldDictionary::Entry *SimFieldDictionary::addEntry( U32 bucket, StringTable
else
ret = fieldChunker.alloc();
ret->next = mHashTable[ bucket ];
ret->next = mHashTable[bucket];
ret->slotName = slotName;
ret->type = type;
ret->value = value;
mHashTable[ bucket ] = ret;
mNumFields ++;
mVersion ++;
mHashTable[bucket] = ret;
mNumFields++;
mVersion++;
return ret;
}
@ -74,37 +74,37 @@ void SimFieldDictionary::freeEntry(SimFieldDictionary::Entry *ent)
ent->next = smFreeList;
smFreeList = ent;
mNumFields --;
mNumFields--;
}
SimFieldDictionary::SimFieldDictionary()
: mNumFields( 0 ),
mVersion( 0 )
: mNumFields(0),
mVersion(0)
{
dMemset( mHashTable, 0, sizeof( mHashTable ) );
dMemset(mHashTable, 0, sizeof(mHashTable));
}
SimFieldDictionary::~SimFieldDictionary()
{
for(U32 i = 0; i < HashTableSize; i++)
for (U32 i = 0; i < HashTableSize; i++)
{
for(Entry *walk = mHashTable[i]; walk;)
for (Entry *walk = mHashTable[i]; walk;)
{
Entry *temp = walk;
walk = temp->next;
if( temp->value )
if (temp->value)
dFree(temp->value);
freeEntry(temp);
}
}
AssertFatal( mNumFields == 0, "Incorrect count on field dictionary" );
AssertFatal(mNumFields == 0, "Incorrect count on field dictionary");
}
void SimFieldDictionary::setFieldType(StringTableEntry slotName, const char *typeString)
{
ConsoleBaseType *cbt = ConsoleBaseType::getTypeByName( typeString );
ConsoleBaseType *cbt = ConsoleBaseType::getTypeByName(typeString);
setFieldType(slotName, cbt);
}
@ -117,11 +117,11 @@ void SimFieldDictionary::setFieldType(StringTableEntry slotName, const U32 typeI
void SimFieldDictionary::setFieldType(StringTableEntry slotName, ConsoleBaseType *type)
{
// If the field exists on the object, set the type
U32 bucket = getHashValue( slotName );
U32 bucket = getHashValue(slotName);
for( Entry *walk = mHashTable[bucket]; walk; walk = walk->next )
for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next)
{
if( walk->slotName == slotName )
if (walk->slotName == slotName)
{
// Found and type assigned, let's bail
walk->type = type;
@ -130,15 +130,15 @@ void SimFieldDictionary::setFieldType(StringTableEntry slotName, ConsoleBaseType
}
// Otherwise create the field, and set the type. Assign a null value.
addEntry( bucket, slotName, type );
addEntry(bucket, slotName, type);
}
U32 SimFieldDictionary::getFieldType(StringTableEntry slotName) const
{
U32 bucket = getHashValue( slotName );
U32 bucket = getHashValue(slotName);
for( Entry *walk = mHashTable[bucket]; walk; walk = walk->next )
if( walk->slotName == slotName )
for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next)
if (walk->slotName == slotName)
return walk->type ? walk->type->getTypeID() : TypeString;
return TypeString;
@ -146,24 +146,24 @@ U32 SimFieldDictionary::getFieldType(StringTableEntry slotName) const
SimFieldDictionary::Entry *SimFieldDictionary::findDynamicField(const String &fieldName) const
{
U32 bucket = getHashValue( fieldName );
U32 bucket = getHashValue(fieldName);
for( Entry *walk = mHashTable[bucket]; walk; walk = walk->next )
for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next)
{
if( fieldName.equal(walk->slotName, String::NoCase) )
if (fieldName.equal(walk->slotName, String::NoCase))
return walk;
}
return NULL;
}
SimFieldDictionary::Entry *SimFieldDictionary::findDynamicField( StringTableEntry fieldName) const
SimFieldDictionary::Entry *SimFieldDictionary::findDynamicField(StringTableEntry fieldName) const
{
U32 bucket = getHashValue( fieldName );
U32 bucket = getHashValue(fieldName);
for( Entry *walk = mHashTable[bucket]; walk; walk = walk->next )
for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next)
{
if( walk->slotName == fieldName )
if (walk->slotName == fieldName)
{
return walk;
}
@ -177,17 +177,17 @@ void SimFieldDictionary::setFieldValue(StringTableEntry slotName, const char *va
{
U32 bucket = getHashValue(slotName);
Entry **walk = &mHashTable[bucket];
while(*walk && (*walk)->slotName != slotName)
while (*walk && (*walk)->slotName != slotName)
walk = &((*walk)->next);
Entry *field = *walk;
if( !value || !*value )
if (!value || !*value)
{
if(field)
if (field)
{
mVersion++;
if( field->value )
if (field->value)
dFree(field->value);
*walk = field->next;
@ -196,15 +196,15 @@ void SimFieldDictionary::setFieldValue(StringTableEntry slotName, const char *va
}
else
{
if(field)
if (field)
{
if( field->value )
if (field->value)
dFree(field->value);
field->value = dStrdup(value);
}
else
addEntry( bucket, slotName, 0, dStrdup( value ) );
addEntry(bucket, slotName, 0, dStrdup(value));
}
}
@ -212,8 +212,8 @@ const char *SimFieldDictionary::getFieldValue(StringTableEntry slotName)
{
U32 bucket = getHashValue(slotName);
for(Entry *walk = mHashTable[bucket];walk;walk = walk->next)
if(walk->slotName == slotName)
for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next)
if (walk->slotName == slotName)
return walk->value;
return NULL;
@ -223,9 +223,9 @@ void SimFieldDictionary::assignFrom(SimFieldDictionary *dict)
{
mVersion++;
for(U32 i = 0; i < HashTableSize; i++)
for (U32 i = 0; i < HashTableSize; i++)
{
for(Entry *walk = dict->mHashTable[i];walk; walk = walk->next)
for (Entry *walk = dict->mHashTable[i]; walk; walk = walk->next)
{
setFieldValue(walk->slotName, walk->value);
setFieldType(walk->slotName, walk->type);
@ -233,7 +233,7 @@ void SimFieldDictionary::assignFrom(SimFieldDictionary *dict)
}
}
static S32 QSORT_CALLBACK compareEntries(const void* a,const void* b)
static S32 QSORT_CALLBACK compareEntries(const void* a, const void* b)
{
SimFieldDictionary::Entry *fa = *((SimFieldDictionary::Entry **)a);
SimFieldDictionary::Entry *fb = *((SimFieldDictionary::Entry **)b);
@ -245,17 +245,17 @@ void SimFieldDictionary::writeFields(SimObject *obj, Stream &stream, U32 tabStop
const AbstractClassRep::FieldList &list = obj->getFieldList();
Vector<Entry *> flist(__FILE__, __LINE__);
for(U32 i = 0; i < HashTableSize; i++)
for (U32 i = 0; i < HashTableSize; i++)
{
for(Entry *walk = mHashTable[i];walk; walk = walk->next)
for (Entry *walk = mHashTable[i]; walk; walk = walk->next)
{
// make sure we haven't written this out yet:
U32 i;
for(i = 0; i < list.size(); i++)
if(list[i].pFieldname == walk->slotName)
for (i = 0; i < list.size(); i++)
if (list[i].pFieldname == walk->slotName)
break;
if(i != list.size())
if (i != list.size())
continue;
@ -267,23 +267,23 @@ void SimFieldDictionary::writeFields(SimObject *obj, Stream &stream, U32 tabStop
}
// Sort Entries to prevent version control conflicts
dQsort(flist.address(),flist.size(),sizeof(Entry *),compareEntries);
dQsort(flist.address(), flist.size(), sizeof(Entry *), compareEntries);
// Save them out
for(Vector<Entry *>::iterator itr = flist.begin(); itr != flist.end(); itr++)
for (Vector<Entry *>::iterator itr = flist.begin(); itr != flist.end(); itr++)
{
U32 nBufferSize = (dStrlen( (*itr)->value ) * 2) + dStrlen( (*itr)->slotName ) + 16;
FrameTemp<char> expandedBuffer( nBufferSize );
U32 nBufferSize = (dStrlen((*itr)->value) * 2) + dStrlen((*itr)->slotName) + 16;
FrameTemp<char> expandedBuffer(nBufferSize);
stream.writeTabs(tabStop+1);
stream.writeTabs(tabStop + 1);
const char *typeName = (*itr)->type && (*itr)->type->getTypeID() != TypeString ? (*itr)->type->getTypeName() : "";
dSprintf(expandedBuffer, nBufferSize, "%s%s%s = \"", typeName, *typeName ? " " : "", (*itr)->slotName);
if ( (*itr)->value )
if ((*itr)->value)
expandEscape((char*)expandedBuffer + dStrlen(expandedBuffer), (*itr)->value);
dStrcat(expandedBuffer, "\";\r\n");
stream.write(dStrlen(expandedBuffer),expandedBuffer);
stream.write(dStrlen(expandedBuffer), expandedBuffer);
}
}
@ -293,32 +293,32 @@ void SimFieldDictionary::printFields(SimObject *obj)
char expandedBuffer[4096];
Vector<Entry *> flist(__FILE__, __LINE__);
for(U32 i = 0; i < HashTableSize; i++)
for (U32 i = 0; i < HashTableSize; i++)
{
for(Entry *walk = mHashTable[i];walk; walk = walk->next)
for (Entry *walk = mHashTable[i]; walk; walk = walk->next)
{
// make sure we haven't written this out yet:
U32 i;
for(i = 0; i < list.size(); i++)
if(list[i].pFieldname == walk->slotName)
for (i = 0; i < list.size(); i++)
if (list[i].pFieldname == walk->slotName)
break;
if(i != list.size())
if (i != list.size())
continue;
flist.push_back(walk);
}
}
dQsort(flist.address(),flist.size(),sizeof(Entry *),compareEntries);
dQsort(flist.address(), flist.size(), sizeof(Entry *), compareEntries);
for(Vector<Entry *>::iterator itr = flist.begin(); itr != flist.end(); itr++)
for (Vector<Entry *>::iterator itr = flist.begin(); itr != flist.end(); itr++)
{
const char* type = "string";
if( ( *itr )->type )
type = ( *itr )->type->getTypeClassName();
if ((*itr)->type)
type = (*itr)->type->getTypeClassName();
dSprintf( expandedBuffer, sizeof( expandedBuffer ), " %s %s = \"", type, ( *itr )->slotName );
if ( (*itr)->value )
dSprintf(expandedBuffer, sizeof(expandedBuffer), " %s %s = \"", type, (*itr)->slotName);
if ((*itr)->value)
expandEscape(expandedBuffer + dStrlen(expandedBuffer), (*itr)->value);
Con::printf("%s\"", expandedBuffer);
}
@ -326,9 +326,9 @@ void SimFieldDictionary::printFields(SimObject *obj)
SimFieldDictionary::Entry *SimFieldDictionary::operator[](U32 index)
{
AssertFatal ( index < mNumFields, "out of range" );
AssertFatal(index < mNumFields, "out of range");
if ( index > mNumFields )
if (index > mNumFields)
return NULL;
SimFieldDictionaryIterator itr(this);
@ -350,13 +350,13 @@ SimFieldDictionaryIterator::SimFieldDictionaryIterator(SimFieldDictionary * dict
SimFieldDictionary::Entry* SimFieldDictionaryIterator::operator++()
{
if(!mDictionary)
if (!mDictionary)
return(mEntry);
if(mEntry)
if (mEntry)
mEntry = mEntry->next;
while(!mEntry && (mHashIndex < (SimFieldDictionary::HashTableSize-1)))
while (!mEntry && (mHashIndex < (SimFieldDictionary::HashTableSize - 1)))
mEntry = mDictionary->mHashTable[++mHashIndex];
return(mEntry);
@ -386,14 +386,14 @@ void SimFieldDictionary::setFieldValue(StringTableEntry slotName, const char *va
U32 bucket = getHashValue(slotName);
Entry **walk = &mHashTable[bucket];
while(*walk && (*walk)->slotName != slotName)
while (*walk && (*walk)->slotName != slotName)
walk = &((*walk)->next);
Entry *field = *walk;
if (field)
return;
addEntry( bucket, slotName, type, dStrdup( value ) );
addEntry(bucket, slotName, type, dStrdup(value));
}
// A variation of the stock SimFieldDictionary::assignFrom(), this method adds <no_replace>
// and <filter> arguments. When true, <no_replace> prohibits the replacement of fields that already
@ -412,14 +412,14 @@ void SimFieldDictionary::assignFrom(SimFieldDictionary *dict, const char* filter
if (filter_len == 0)
{
for(U32 i = 0; i < HashTableSize; i++)
for(Entry *walk = dict->mHashTable[i];walk; walk = walk->next)
for (U32 i = 0; i < HashTableSize; i++)
for (Entry *walk = dict->mHashTable[i]; walk; walk = walk->next)
setFieldValue(walk->slotName, walk->value, walk->type, no_replace);
}
else
{
for(U32 i = 0; i < HashTableSize; i++)
for(Entry *walk = dict->mHashTable[i];walk; walk = walk->next)
for (U32 i = 0; i < HashTableSize; i++)
for (Entry *walk = dict->mHashTable[i]; walk; walk = walk->next)
if (dStrncmp(walk->slotName, filter, filter_len) == 0)
setFieldValue(walk->slotName, walk->value, walk->type, no_replace);
}

View file

@ -47,7 +47,7 @@ class SimFieldDictionary
public:
struct Entry
{
Entry() : type( NULL ) {};
Entry() : type(NULL) {};
StringTableEntry slotName;
char *value;
@ -64,10 +64,10 @@ private:
static Entry *smFreeList;
void freeEntry(Entry *entry);
Entry* addEntry( U32 bucket, StringTableEntry slotName, ConsoleBaseType* type, char* value = 0 );
Entry* addEntry(U32 bucket, StringTableEntry slotName, ConsoleBaseType* type, char* value = 0);
static U32 getHashValue( StringTableEntry slotName );
static U32 getHashValue( const String& fieldName );
static U32 getHashValue(StringTableEntry slotName);
static U32 getHashValue(const String& fieldName);
U32 mNumFields;
@ -88,7 +88,7 @@ public:
const char *getFieldValue(StringTableEntry slotName);
U32 getFieldType(StringTableEntry slotName) const;
Entry *findDynamicField(const String &fieldName) const;
Entry *findDynamicField( StringTableEntry fieldName) const;
Entry *findDynamicField(StringTableEntry fieldName) const;
void writeFields(SimObject *obj, Stream &strem, U32 tabStop);
void printFields(SimObject *obj);
void assignFrom(SimFieldDictionary *dict);

View file

@ -72,8 +72,8 @@ SimObject::SimObject()
objectName = NULL;
mOriginalName = NULL;
mInternalName = NULL;
nextNameObject = (SimObject*)-1;
nextManagerNameObject = (SimObject*)-1;
nextNameObject = nullptr;
nextManagerNameObject = nullptr;
nextIdObject = NULL;
mFilename = NULL;
@ -86,6 +86,8 @@ SimObject::SimObject()
mNotifyList = NULL;
mFlags.set( ModStaticFields | ModDynamicFields );
mProgenitorFile = StringTable->EmptyString();
mFieldDictionary = NULL;
mCanSaveFieldDictionary = true;
@ -122,10 +124,10 @@ SimObject::~SimObject()
if( mCopySource )
mCopySource->unregisterReference( &mCopySource );
AssertFatal(nextNameObject == (SimObject*)-1,avar(
AssertFatal(nextNameObject == nullptr,avar(
"SimObject::~SimObject: Not removed from dictionary: name %s, id %i",
objectName, mId));
AssertFatal(nextManagerNameObject == (SimObject*)-1,avar(
AssertFatal(nextManagerNameObject == nullptr,avar(
"SimObject::~SimObject: Not removed from manager dictionary: name %s, id %i",
objectName,mId));
AssertFatal(mFlags.test(Added) == 0, "SimObject::object "

File diff suppressed because it is too large Load diff