console membervar cleanup

This commit is contained in:
Azaezel 2018-03-16 20:05:47 -05:00
parent 189595670a
commit 9b8c950701
4 changed files with 71 additions and 71 deletions

View file

@ -392,14 +392,14 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
if (size)
{
globalFloats = new F64[size];
for (U32 i = 0; i < size; i++)
for (i = 0; i < size; i++)
st.read(&globalFloats[i]);
}
st.read(&size);
if (size)
{
functionFloats = new F64[size];
for (U32 i = 0; i < size; i++)
for (i = 0; i < size; i++)
st.read(&functionFloats[i]);
}
U32 codeLength;

View file

@ -49,7 +49,7 @@ ExprEvalState gEvalState;
StmtNode *gStatementList;
StmtNode *gAnonFunctionList;
U32 gAnonFunctionID = 0;
ConsoleConstructor *ConsoleConstructor::first = NULL;
ConsoleConstructor *ConsoleConstructor::mFirst = NULL;
bool gWarnUndefinedScriptVariables;
static char scratchBuffer[4096];
@ -85,47 +85,47 @@ static const char * prependPercent ( const char * name )
//--------------------------------------
void ConsoleConstructor::init( const char *cName, const char *fName, const char *usg, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header )
{
mina = minArgs;
maxa = maxArgs;
funcName = fName;
usage = usg;
className = cName;
sc = 0; fc = 0; vc = 0; bc = 0; ic = 0;
callback = group = false;
next = first;
ns = false;
first = this;
toolOnly = isToolOnly;
this->header = header;
mMina = minArgs;
mMaxa = maxArgs;
mFuncName = fName;
mUsage = usg;
mClassName = cName;
mSC = 0; mFC = 0; mVC = 0; mBC = 0; mIC = 0;
mCallback = mGroup = false;
mNext = mFirst;
mNS = false;
mFirst = this;
mToolOnly = isToolOnly;
mHeader = header;
}
void ConsoleConstructor::setup()
{
for(ConsoleConstructor *walk = first; walk; walk = walk->next)
for(ConsoleConstructor *walk = mFirst; walk; walk = walk->mNext)
{
#ifdef TORQUE_DEBUG
walk->validate();
#endif
if( walk->sc )
Con::addCommand( walk->className, walk->funcName, walk->sc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header );
else if( walk->ic )
Con::addCommand( walk->className, walk->funcName, walk->ic, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header );
else if( walk->fc )
Con::addCommand( walk->className, walk->funcName, walk->fc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header );
else if( walk->vc )
Con::addCommand( walk->className, walk->funcName, walk->vc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header );
else if( walk->bc )
Con::addCommand( walk->className, walk->funcName, walk->bc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header );
else if( walk->group )
Con::markCommandGroup( walk->className, walk->funcName, walk->usage );
else if( walk->callback )
Con::noteScriptCallback( walk->className, walk->funcName, walk->usage, walk->header );
else if( walk->ns )
if( walk->mSC )
Con::addCommand( walk->mClassName, walk->mFuncName, walk->mSC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader);
else if( walk->mIC )
Con::addCommand( walk->mClassName, walk->mFuncName, walk->mIC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader);
else if( walk->mFC )
Con::addCommand( walk->mClassName, walk->mFuncName, walk->mFC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader);
else if( walk->mVC )
Con::addCommand( walk->mClassName, walk->mFuncName, walk->mVC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader);
else if( walk->mBC )
Con::addCommand( walk->mClassName, walk->mFuncName, walk->mBC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader);
else if( walk->mGroup )
Con::markCommandGroup( walk->mClassName, walk->mFuncName, walk->mUsage);
else if( walk->mClassName)
Con::noteScriptCallback( walk->mClassName, walk->mFuncName, walk->mUsage, walk->mHeader);
else if( walk->mNS )
{
Namespace* ns = Namespace::find( StringTable->insert( walk->className ) );
Namespace* ns = Namespace::find( StringTable->insert( walk->mClassName) );
if( ns )
ns->mUsage = walk->usage;
ns->mUsage = walk->mUsage;
}
else
{
@ -137,38 +137,38 @@ void ConsoleConstructor::setup()
ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, StringCallback sfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header )
{
init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header );
sc = sfunc;
mSC = sfunc;
}
ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, IntCallback ifunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header )
{
init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header );
ic = ifunc;
mIC = ifunc;
}
ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, FloatCallback ffunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header )
{
init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header );
fc = ffunc;
mFC = ffunc;
}
ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, VoidCallback vfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header )
{
init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header );
vc = vfunc;
mVC = vfunc;
}
ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, BoolCallback bfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header )
{
init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header );
bc = bfunc;
mBC = bfunc;
}
ConsoleConstructor::ConsoleConstructor(const char* className, const char* groupName, const char* aUsage)
{
init(className, groupName, usage, -1, -2);
init(className, groupName, mUsage, -1, -2);
group = true;
mGroup = true;
// Somewhere, the entry list is getting flipped, partially.
// so we have to do tricks to deal with making sure usage
@ -179,36 +179,36 @@ ConsoleConstructor::ConsoleConstructor(const char* className, const char* groupN
if(aUsage)
lastUsage = (char *)aUsage;
usage = lastUsage;
mUsage = lastUsage;
}
ConsoleConstructor::ConsoleConstructor(const char *className, const char *callbackName, const char *usage, ConsoleFunctionHeader* header )
{
init( className, callbackName, usage, -2, -3, false, header );
callback = true;
ns = true;
mCallback = true;
mNS = true;
}
void ConsoleConstructor::validate()
{
#ifdef TORQUE_DEBUG
// Don't do the following check if we're not a method/func.
if(this->group)
if(mGroup)
return;
// In debug, walk the list and make sure this isn't a duplicate.
for(ConsoleConstructor *walk = first; walk; walk = walk->next)
for(ConsoleConstructor *walk = mFirst; walk; walk = walk->mNext)
{
// Skip mismatching func/method names.
if(dStricmp(walk->funcName, this->funcName))
if(dStricmp(walk->mFuncName, mFuncName))
continue;
// Don't compare functions with methods or vice versa.
if(bool(this->className) != bool(walk->className))
if(bool(mClassName) != bool(walk->mClassName))
continue;
// Skip mismatching classnames, if they're present.
if(this->className && walk->className && dStricmp(walk->className, this->className))
if(mClassName && walk->mClassName && dStricmp(walk->mClassName, mClassName))
continue;
// If we encounter ourselves, stop searching; this prevents duplicate
@ -218,13 +218,13 @@ void ConsoleConstructor::validate()
break;
// Match!
if(this->className)
if(mClassName)
{
AssertISV(false, avar("ConsoleConstructor::setup - ConsoleMethod '%s::%s' collides with another of the same name.", this->className, this->funcName));
AssertISV(false, avar("ConsoleConstructor::setup - ConsoleMethod '%s::%s' collides with another of the same name.", mClassName, mFuncName));
}
else
{
AssertISV(false, avar("ConsoleConstructor::setup - ConsoleFunction '%s' collides with another of the same name.", this->funcName));
AssertISV(false, avar("ConsoleConstructor::setup - ConsoleFunction '%s' collides with another of the same name.", mFuncName));
}
}
#endif

View file

@ -972,38 +972,38 @@ public:
/// @ref console_autodoc
/// @{
StringCallback sc; ///< A function/method that returns a string.
IntCallback ic; ///< A function/method that returns an int.
FloatCallback fc; ///< A function/method that returns a float.
VoidCallback vc; ///< A function/method that returns nothing.
BoolCallback bc; ///< A function/method that returns a bool.
bool group; ///< Indicates that this is a group marker.
bool ns; ///< Indicates that this is a namespace marker.
StringCallback mSC; ///< A function/method that returns a string.
IntCallback mIC; ///< A function/method that returns an int.
FloatCallback mFC; ///< A function/method that returns a float.
VoidCallback mVC; ///< A function/method that returns nothing.
BoolCallback mBC; ///< A function/method that returns a bool.
bool mGroup; ///< Indicates that this is a group marker.
bool mNS; ///< Indicates that this is a namespace marker.
/// @deprecated Unused.
bool callback; ///< Is this a callback into script?
bool mCallback; ///< Is this a callback into script?
/// @}
/// Minimum number of arguments expected by the function.
S32 mina;
S32 mMina;
/// Maximum number of arguments accepted by the funtion. Zero for varargs.
S32 maxa;
S32 mMaxa;
/// Name of the function/method.
const char* funcName;
const char* mFuncName;
/// Name of the class namespace to which to add the method.
const char* className;
const char* mClassName;
/// Usage string for documentation.
const char* usage;
const char* mUsage;
/// Whether this is a TORQUE_TOOLS only function.
bool toolOnly;
bool mToolOnly;
/// The extended function header.
ConsoleFunctionHeader* header;
ConsoleFunctionHeader* mHeader;
/// @name ConsoleConstructor Innards
///
@ -1066,8 +1066,8 @@ public:
/// @{
///
ConsoleConstructor *next;
static ConsoleConstructor *first;
ConsoleConstructor *mNext;
static ConsoleConstructor *mFirst;
void init(const char* cName, const char* fName, const char *usg, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);

View file

@ -668,13 +668,13 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char
U32 dstp = 0;
for(;;)
{
const char *scan = dStrstr(source + scanp, from);
if(!scan)
const char *subScan = dStrstr(source + scanp, from);
if(!subScan)
{
dStrcpy(ret + dstp, source + scanp);
return ret;
}
U32 len = scan - (source + scanp);
U32 len = subScan - (source + scanp);
dStrncpy(ret + dstp, source + scanp, len);
dstp += len;
dStrcpy(ret + dstp, to);