mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-10 07:50:44 +00:00
Merge branch 'method_Unmangle' into PBR_PR
This commit is contained in:
commit
1eed979a9c
632 changed files with 3935 additions and 3450 deletions
|
|
@ -571,7 +571,7 @@ DefineEngineMethod( SimXMLDocument, attribute, const char*, ( const char* attrib
|
|||
}
|
||||
|
||||
// These two methods don't make a lot of sense the way TS works. Leaving them in for backwards-compatibility.
|
||||
DefineConsoleMethod( SimXMLDocument, attributeF32, F32, (const char * attributeName), , "(string attributeName)"
|
||||
DefineEngineMethod( SimXMLDocument, attributeF32, F32, (const char * attributeName), , "(string attributeName)"
|
||||
"@brief Get float attribute from the current Element on the stack.\n\n"
|
||||
"@param attributeName Name of attribute to retrieve.\n"
|
||||
"@return The value of the given attribute in the form of a float.\n"
|
||||
|
|
@ -580,7 +580,7 @@ DefineConsoleMethod( SimXMLDocument, attributeF32, F32, (const char * attributeN
|
|||
return dAtof( object->attribute( attributeName ) );
|
||||
}
|
||||
|
||||
DefineConsoleMethod(SimXMLDocument, attributeS32, S32, (const char * attributeName), , "(string attributeName)"
|
||||
DefineEngineMethod(SimXMLDocument, attributeS32, S32, (const char * attributeName), , "(string attributeName)"
|
||||
"@brief Get int attribute from the current Element on the stack.\n\n"
|
||||
"@param attributeName Name of attribute to retrieve.\n"
|
||||
"@return The value of the given attribute in the form of an integer.\n"
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#include "core/strings/stringUnit.h"
|
||||
#include "console/console.h"
|
||||
#include "console/consoleInternal.h"
|
||||
#include "cinterface/cinterface.h"
|
||||
|
||||
//#define TORQUE_VALIDATE_STACK
|
||||
|
||||
|
|
@ -2023,7 +2024,7 @@ OPCodeReturn CodeInterpreter::op_callfunc_resolve(U32 &ip)
|
|||
|
||||
// Try to look it up.
|
||||
mNSEntry = Namespace::find(fnNamespace)->lookup(fnName);
|
||||
if (!mNSEntry)
|
||||
if (!CInterface::GetCInterface().isMethod(fnNamespace, fnName) && !mNSEntry)
|
||||
{
|
||||
ip += 5;
|
||||
Con::warnf(ConsoleLogEntry::General,
|
||||
|
|
@ -2051,6 +2052,7 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip)
|
|||
|
||||
U32 *code = mCodeBlock->code;
|
||||
|
||||
StringTableEntry fnNamespace = CodeToSTE(mCodeBlock->code, ip + 2);
|
||||
StringTableEntry fnName = CodeToSTE(code, ip);
|
||||
|
||||
//if this is called from inside a function, append the ip and codeptr
|
||||
|
|
@ -2068,10 +2070,16 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip)
|
|||
const char *componentReturnValue = "";
|
||||
Namespace *ns = NULL;
|
||||
|
||||
bool cFunctionRes = false;
|
||||
const char* cRetRes = NULL;
|
||||
|
||||
if (callType == FuncCallExprNode::FunctionCall)
|
||||
{
|
||||
if (!mNSEntry)
|
||||
mNSEntry = Namespace::global()->lookup(fnName);
|
||||
|
||||
StringStackWrapper args(mCallArgc, mCallArgv);
|
||||
cRetRes = CInterface::GetCInterface().CallFunction(fnNamespace, fnName, args.argv, args.argc, &cFunctionRes);
|
||||
}
|
||||
else if (callType == FuncCallExprNode::MethodCall)
|
||||
{
|
||||
|
|
@ -2102,6 +2110,9 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip)
|
|||
mNSEntry = ns->lookup(fnName);
|
||||
else
|
||||
mNSEntry = NULL;
|
||||
|
||||
StringStackWrapper args(mCallArgc, mCallArgv);
|
||||
cRetRes = CInterface::GetCInterface().CallMethod(gEvalState.thisObject, fnName, args.argv, args.argc, &cFunctionRes);
|
||||
}
|
||||
else // it's a ParentCall
|
||||
{
|
||||
|
|
@ -2128,7 +2139,7 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip)
|
|||
nsUsage = mNSEntry->mUsage;
|
||||
routingId = 0;
|
||||
}
|
||||
if (!mNSEntry || mExec.noCalls)
|
||||
if (!cFunctionRes && (!mNSEntry || mExec.noCalls))
|
||||
{
|
||||
if (!mExec.noCalls && !(routingId == MethodOnComponent))
|
||||
{
|
||||
|
|
@ -2167,11 +2178,19 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip)
|
|||
|
||||
// ConsoleFunctionType is for any function defined by script.
|
||||
// Any 'callback' type is an engine function that is exposed to script.
|
||||
if (mNSEntry->mType == Namespace::Entry::ConsoleFunctionType)
|
||||
if (mNSEntry->mType == Namespace::Entry::ConsoleFunctionType
|
||||
|| cFunctionRes)
|
||||
{
|
||||
ConsoleValueRef ret;
|
||||
if (mNSEntry->mFunctionOffset)
|
||||
if (cFunctionRes)
|
||||
{
|
||||
StringStackConsoleWrapper retVal(1, &cRetRes);
|
||||
ret = retVal.argv[0];
|
||||
}
|
||||
else if (mNSEntry->mFunctionOffset)
|
||||
{
|
||||
ret = mNSEntry->mCode->exec(mNSEntry->mFunctionOffset, fnName, mNSEntry->mNamespace, mCallArgc, mCallArgv, false, mNSEntry->mPackage);
|
||||
}
|
||||
|
||||
STR.popFrame();
|
||||
// Functions are assumed to return strings, so look ahead to see if we can skip the conversion
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include <stdarg.h>
|
||||
#include "platform/threads/mutex.h"
|
||||
#include "core/util/journal/journal.h"
|
||||
#include "cinterface/cinterface.h"
|
||||
|
||||
extern StringStack STR;
|
||||
extern ConsoleValueStack CSTK;
|
||||
|
|
@ -277,7 +278,7 @@ bool useTimestamp = false;
|
|||
|
||||
ConsoleFunctionGroupBegin( Clipboard, "Miscellaneous functions to control the clipboard and clear the console.");
|
||||
|
||||
DefineConsoleFunction( cls, void, (), , "()"
|
||||
DefineEngineFunction( cls, void, (), , "()"
|
||||
"@brief Clears the console output.\n\n"
|
||||
"@ingroup Console")
|
||||
{
|
||||
|
|
@ -287,14 +288,14 @@ DefineConsoleFunction( cls, void, (), , "()"
|
|||
consoleLog.setSize(0);
|
||||
};
|
||||
|
||||
DefineConsoleFunction( getClipboard, const char*, (), , "()"
|
||||
DefineEngineFunction( getClipboard, const char*, (), , "()"
|
||||
"@brief Get text from the clipboard.\n\n"
|
||||
"@internal")
|
||||
{
|
||||
return Platform::getClipboard();
|
||||
};
|
||||
|
||||
DefineConsoleFunction( setClipboard, bool, (const char* text), , "(string text)"
|
||||
DefineEngineFunction( setClipboard, bool, (const char* text), , "(string text)"
|
||||
"@brief Set the system clipboard.\n\n"
|
||||
"@internal")
|
||||
{
|
||||
|
|
@ -1488,6 +1489,18 @@ ConsoleValueRef evaluatef(const char* string, ...)
|
|||
// Internal execute for global function which does not save the stack
|
||||
ConsoleValueRef _internalExecute(S32 argc, ConsoleValueRef argv[])
|
||||
{
|
||||
const char** argv_str = static_cast<const char**>(malloc((argc - 1) * sizeof(char *)));
|
||||
for (int i = 0; i < argc - 1; i++)
|
||||
{
|
||||
argv_str[i] = argv[i + 1];
|
||||
}
|
||||
bool result;
|
||||
const char* methodRes = CInterface::CallFunction(NULL, argv[0], argv_str, argc - 1, &result);
|
||||
if (result)
|
||||
{
|
||||
return ConsoleValueRef::fromValue(CSTK.pushString(methodRes));
|
||||
}
|
||||
|
||||
Namespace::Entry *ent;
|
||||
StringTableEntry funcName = StringTable->insert(argv[0]);
|
||||
ent = Namespace::global()->lookup(funcName);
|
||||
|
|
@ -1559,6 +1572,18 @@ ConsoleValueRef _internalExecute(SimObject *object, S32 argc, ConsoleValueRef ar
|
|||
}
|
||||
}
|
||||
|
||||
const char** argv_str = static_cast<const char**>(malloc((argc - 2) * sizeof(char *)));
|
||||
for (int i = 0; i < argc - 2; i++)
|
||||
{
|
||||
argv_str[i] = argv[i + 2];
|
||||
}
|
||||
bool result;
|
||||
const char* methodRes = CInterface::CallMethod(object, argv[0], argv_str, argc - 2, &result);
|
||||
if (result)
|
||||
{
|
||||
return ConsoleValueRef::fromValue(CSTK.pushString(methodRes));
|
||||
}
|
||||
|
||||
if(object->getNamespace())
|
||||
{
|
||||
U32 ident = object->getId();
|
||||
|
|
@ -1655,6 +1680,7 @@ inline ConsoleValueRef _executef(S32 checkArgc, S32 argc, ConsoleValueRef *argv)
|
|||
//------------------------------------------------------------------------------
|
||||
bool isFunction(const char *fn)
|
||||
{
|
||||
if (CInterface::isMethod(NULL, fn)) return true;
|
||||
const char *string = StringTable->lookup(fn);
|
||||
if(!string)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1191,11 +1191,6 @@ public:
|
|||
# define ConsoleFunctionGroupBegin(groupName, usage) \
|
||||
static ConsoleConstructor cfg_ConsoleFunctionGroup_##groupName##_GroupBegin(NULL,#groupName,usage)
|
||||
|
||||
# define ConsoleFunction(name,returnType,minArgs,maxArgs,usage1) \
|
||||
returnType cf_##name(SimObject *, S32, ConsoleValueRef *argv); \
|
||||
ConsoleConstructor cc_##name##_obj(NULL,#name,cf_##name,usage1,minArgs,maxArgs); \
|
||||
returnType cf_##name(SimObject *, S32 argc, ConsoleValueRef *argv)
|
||||
|
||||
# define ConsoleToolFunction(name,returnType,minArgs,maxArgs,usage1) \
|
||||
returnType ctf_##name(SimObject *, S32, ConsoleValueRef *argv); \
|
||||
ConsoleConstructor cc_##name##_obj(NULL,#name,ctf_##name,usage1,minArgs,maxArgs, true); \
|
||||
|
|
@ -1211,24 +1206,6 @@ public:
|
|||
# define ConsoleMethodGroupBegin(className, groupName, usage) \
|
||||
static ConsoleConstructor cc_##className##_##groupName##_GroupBegin(#className,#groupName,usage)
|
||||
|
||||
# define ConsoleMethod(className,name,returnType,minArgs,maxArgs,usage1) \
|
||||
inline returnType cm_##className##_##name(className *, S32, ConsoleValueRef *argv); \
|
||||
returnType cm_##className##_##name##_caster(SimObject *object, S32 argc, ConsoleValueRef *argv) { \
|
||||
AssertFatal( dynamic_cast<className*>( object ), "Object passed to " #name " is not a " #className "!" ); \
|
||||
conmethod_return_##returnType ) cm_##className##_##name(static_cast<className*>(object),argc,argv); \
|
||||
}; \
|
||||
ConsoleConstructor cc_##className##_##name##_obj(#className,#name,cm_##className##_##name##_caster,usage1,minArgs,maxArgs); \
|
||||
inline returnType cm_##className##_##name(className *object, S32 argc, ConsoleValueRef *argv)
|
||||
|
||||
# define ConsoleStaticMethod(className,name,returnType,minArgs,maxArgs,usage1) \
|
||||
inline returnType cm_##className##_##name(S32, ConsoleValueRef *); \
|
||||
returnType cm_##className##_##name##_caster(SimObject *object, S32 argc, ConsoleValueRef *argv) { \
|
||||
conmethod_return_##returnType ) cm_##className##_##name(argc,argv); \
|
||||
}; \
|
||||
ConsoleConstructor \
|
||||
cc_##className##_##name##_obj(#className,#name,cm_##className##_##name##_caster,usage1,minArgs,maxArgs); \
|
||||
inline returnType cm_##className##_##name(S32 argc, ConsoleValueRef *argv)
|
||||
|
||||
# define ConsoleMethodGroupEnd(className, groupName) \
|
||||
static ConsoleConstructor cc_##className##_##groupName##_GroupEnd(#className,#groupName,NULL)
|
||||
|
||||
|
|
@ -1268,15 +1245,6 @@ public:
|
|||
className##name##obj(#className,#name,c##className##name##caster,"",minArgs,maxArgs); \
|
||||
static inline returnType c##className##name(className *object, S32 argc, ConsoleValueRef *argv)
|
||||
|
||||
# define ConsoleStaticMethod(className,name,returnType,minArgs,maxArgs,usage1) \
|
||||
static inline returnType c##className##name(S32, ConsoleValueRef*); \
|
||||
static returnType c##className##name##caster(SimObject *object, S32 argc, ConsoleValueRef *argv) { \
|
||||
conmethod_return_##returnType ) c##className##name(argc,argv); \
|
||||
}; \
|
||||
static ConsoleConstructor \
|
||||
className##name##obj(#className,#name,c##className##name##caster,"",minArgs,maxArgs); \
|
||||
static inline returnType c##className##name(S32 argc, ConsoleValueRef *argv)
|
||||
|
||||
#define ConsoleDoc( text )
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
ConsoleFunctionGroupBegin(ConsoleDoc, "Console self-documentation functions. These output psuedo C++ suitable for feeeding through Doxygen or another auto documentation tool.");
|
||||
|
||||
DefineConsoleFunction( dumpConsoleClasses, void, (bool dumpScript, bool dumpEngine), ( true, true ),
|
||||
DefineEngineFunction( dumpConsoleClasses, void, (bool dumpScript, bool dumpEngine), ( true, true ),
|
||||
"@brief Dumps all declared console classes to the console.\n\n"
|
||||
"@param dumpScript Optional parameter specifying whether or not classes defined in script should be dumped.\n"
|
||||
"@param dumpEngine Optional parameter specifying whether or not classes defined in the engine should be dumped.\n"
|
||||
|
|
@ -50,7 +50,7 @@ DefineConsoleFunction( dumpConsoleClasses, void, (bool dumpScript, bool dumpEngi
|
|||
Namespace::dumpClasses( dumpScript, dumpEngine );
|
||||
}
|
||||
|
||||
DefineConsoleFunction(dumpConsoleFunctions, void, ( bool dumpScript, bool dumpEngine ), ( true, true ),
|
||||
DefineEngineFunction(dumpConsoleFunctions, void, ( bool dumpScript, bool dumpEngine ), ( true, true ),
|
||||
"@brief Dumps all declared console functions to the console.\n"
|
||||
"@param dumpScript Optional parameter specifying whether or not functions defined in script should be dumped.\n"
|
||||
"@param dumpEngine Optional parameter specitying whether or not functions defined in the engine should be dumped.\n"
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ bool isValidPort(U16 port)
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strasc, int, ( const char* chr ),,
|
||||
DefineEngineFunction( strasc, int, ( const char* chr ),,
|
||||
"Return the integer character code value corresponding to the first character in the given string.\n"
|
||||
"@param chr a (one-character) string.\n"
|
||||
"@return the UTF32 code value for the first character in the given string.\n"
|
||||
|
|
@ -195,7 +195,7 @@ DefineConsoleFunction( strasc, int, ( const char* chr ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strformat, const char*, ( const char* format, const char* value ),,
|
||||
DefineEngineFunction( strformat, const char*, ( const char* format, const char* value ),,
|
||||
"Format the given value as a string using printf-style formatting.\n"
|
||||
"@param format A printf-style format string.\n"
|
||||
"@param value The value argument matching the given format string.\n\n"
|
||||
|
|
@ -252,7 +252,7 @@ DefineConsoleFunction( strformat, const char*, ( const char* format, const char*
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strcmp, S32, ( const char* str1, const char* str2 ),,
|
||||
DefineEngineFunction( strcmp, S32, ( const char* str1, const char* str2 ),,
|
||||
"Compares two strings using case-<b>sensitive</b> comparison.\n"
|
||||
"@param str1 The first string.\n"
|
||||
"@param str2 The second string.\n"
|
||||
|
|
@ -271,7 +271,7 @@ DefineConsoleFunction( strcmp, S32, ( const char* str1, const char* str2 ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( stricmp, S32, ( const char* str1, const char* str2 ),,
|
||||
DefineEngineFunction( stricmp, S32, ( const char* str1, const char* str2 ),,
|
||||
"Compares two strings using case-<b>insensitive</b> comparison.\n"
|
||||
"@param str1 The first string.\n"
|
||||
"@param str2 The second string.\n"
|
||||
|
|
@ -290,7 +290,7 @@ DefineConsoleFunction( stricmp, S32, ( const char* str1, const char* str2 ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strnatcmp, S32, ( const char* str1, const char* str2 ),,
|
||||
DefineEngineFunction( strnatcmp, S32, ( const char* str1, const char* str2 ),,
|
||||
"Compares two strings using \"natural order\" case-<b>sensitive</b> comparison.\n"
|
||||
"Natural order means that rather than solely comparing single character code values, strings are ordered in a "
|
||||
"natural way. For example, the string \"hello10\" is considered greater than the string \"hello2\" even though "
|
||||
|
|
@ -325,7 +325,7 @@ DefineConsoleFunction( strnatcmp, S32, ( const char* str1, const char* str2 ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strinatcmp, S32, ( const char* str1, const char* str2 ),,
|
||||
DefineEngineFunction( strinatcmp, S32, ( const char* str1, const char* str2 ),,
|
||||
"Compares two strings using \"natural order\" case-<b>insensitive</b> comparison.\n"
|
||||
"Natural order means that rather than solely comparing single character code values, strings are ordered in a "
|
||||
"natural way. For example, the string \"hello10\" is considered greater than the string \"hello2\" even though "
|
||||
|
|
@ -360,7 +360,7 @@ DefineConsoleFunction( strinatcmp, S32, ( const char* str1, const char* str2 ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strlen, S32, ( const char* str ),,
|
||||
DefineEngineFunction( strlen, S32, ( const char* str ),,
|
||||
"Get the length of the given string in bytes.\n"
|
||||
"@note This does <b>not</b> return a true character count for strings with multi-byte characters!\n"
|
||||
"@param str A string.\n"
|
||||
|
|
@ -371,7 +371,7 @@ DefineConsoleFunction( strlen, S32, ( const char* str ),,
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
DefineConsoleFunction( strlenskip, S32, ( const char* str, const char* first, const char* last ),,
|
||||
DefineEngineFunction( strlenskip, S32, ( const char* str, const char* first, const char* last ),,
|
||||
"Calculate the length of a string in characters, skipping everything between and including first and last.\n"
|
||||
"@param str A string.\n"
|
||||
"@param first First character to look for to skip block of text.\n"
|
||||
|
|
@ -406,7 +406,7 @@ DefineConsoleFunction( strlenskip, S32, ( const char* str, const char* first, co
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strstr, S32, ( const char* string, const char* substring ),,
|
||||
DefineEngineFunction( strstr, S32, ( const char* string, const char* substring ),,
|
||||
"Find the start of @a substring in the given @a string searching from left to right.\n"
|
||||
"@param string The string to search.\n"
|
||||
"@param substring The string to search for.\n"
|
||||
|
|
@ -425,7 +425,7 @@ DefineConsoleFunction( strstr, S32, ( const char* string, const char* substring
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strpos, S32, ( const char* haystack, const char* needle, S32 offset ), ( 0 ),
|
||||
DefineEngineFunction( strpos, S32, ( const char* haystack, const char* needle, S32 offset ), ( 0 ),
|
||||
"Find the start of @a needle in @a haystack searching from left to right beginning at the given offset.\n"
|
||||
"@param haystack The string to search.\n"
|
||||
"@param needle The string to search for.\n"
|
||||
|
|
@ -450,7 +450,7 @@ DefineConsoleFunction( strpos, S32, ( const char* haystack, const char* needle,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strposr, S32, ( const char* haystack, const char* needle, S32 offset ), ( 0 ),
|
||||
DefineEngineFunction( strposr, S32, ( const char* haystack, const char* needle, S32 offset ), ( 0 ),
|
||||
"Find the start of @a needle in @a haystack searching from right to left beginning at the given offset.\n"
|
||||
"@param haystack The string to search.\n"
|
||||
"@param needle The string to search for.\n"
|
||||
|
|
@ -477,7 +477,7 @@ DefineConsoleFunction( strposr, S32, ( const char* haystack, const char* needle,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( ltrim, const char*, ( const char* str ),,
|
||||
DefineEngineFunction( ltrim, const char*, ( const char* str ),,
|
||||
"Remove leading whitespace from the string.\n"
|
||||
"@param str A string.\n"
|
||||
"@return A string that is the same as @a str but with any leading (i.e. leftmost) whitespace removed.\n\n"
|
||||
|
|
@ -496,7 +496,7 @@ DefineConsoleFunction( ltrim, const char*, ( const char* str ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( rtrim, const char*, ( const char* str ),,
|
||||
DefineEngineFunction( rtrim, const char*, ( const char* str ),,
|
||||
"Remove trailing whitespace from the string.\n"
|
||||
"@param str A string.\n"
|
||||
"@return A string that is the same as @a str but with any trailing (i.e. rightmost) whitespace removed.\n\n"
|
||||
|
|
@ -523,7 +523,7 @@ DefineConsoleFunction( rtrim, const char*, ( const char* str ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( trim, const char*, ( const char* str ),,
|
||||
DefineEngineFunction( trim, const char*, ( const char* str ),,
|
||||
"Remove leading and trailing whitespace from the string.\n"
|
||||
"@param str A string.\n"
|
||||
"@return A string that is the same as @a str but with any leading (i.e. leftmost) and trailing (i.e. rightmost) whitespace removed.\n\n"
|
||||
|
|
@ -551,7 +551,7 @@ DefineConsoleFunction( trim, const char*, ( const char* str ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( stripChars, const char*, ( const char* str, const char* chars ),,
|
||||
DefineEngineFunction( stripChars, const char*, ( const char* str, const char* chars ),,
|
||||
"Remove all occurrences of characters contained in @a chars from @a str.\n"
|
||||
"@param str The string to filter characters out from.\n"
|
||||
"@param chars A string of characters to filter out from @a str.\n"
|
||||
|
|
@ -575,7 +575,7 @@ DefineConsoleFunction( stripChars, const char*, ( const char* str, const char* c
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strlwr, const char*, ( const char* str ),,
|
||||
DefineEngineFunction( strlwr, const char*, ( const char* str ),,
|
||||
"Return an all lower-case version of the given string.\n"
|
||||
"@param str A string.\n"
|
||||
"@return A version of @a str with all characters converted to lower-case.\n\n"
|
||||
|
|
@ -593,7 +593,7 @@ DefineConsoleFunction( strlwr, const char*, ( const char* str ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strupr, const char*, ( const char* str ),,
|
||||
DefineEngineFunction( strupr, const char*, ( const char* str ),,
|
||||
"Return an all upper-case version of the given string.\n"
|
||||
"@param str A string.\n"
|
||||
"@return A version of @a str with all characters converted to upper-case.\n\n"
|
||||
|
|
@ -611,7 +611,7 @@ DefineConsoleFunction( strupr, const char*, ( const char* str ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strchr, const char*, ( const char* str, const char* chr ),,
|
||||
DefineEngineFunction( strchr, const char*, ( const char* str, const char* chr ),,
|
||||
"Find the first occurrence of the given character in @a str.\n"
|
||||
"@param str The string to search.\n"
|
||||
"@param chr The character to search for. Only the first character from the string is taken.\n"
|
||||
|
|
@ -625,7 +625,7 @@ DefineConsoleFunction( strchr, const char*, ( const char* str, const char* chr )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strrchr, const char*, ( const char* str, const char* chr ),,
|
||||
DefineEngineFunction( strrchr, const char*, ( const char* str, const char* chr ),,
|
||||
"Find the last occurrence of the given character in @a str."
|
||||
"@param str The string to search.\n"
|
||||
"@param chr The character to search for. Only the first character from the string is taken.\n"
|
||||
|
|
@ -639,7 +639,7 @@ DefineConsoleFunction( strrchr, const char*, ( const char* str, const char* chr
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strreplace, const char*, ( const char* source, const char* from, const char* to ),,
|
||||
DefineEngineFunction( strreplace, const char*, ( const char* source, const char* from, const char* to ),,
|
||||
"Replace all occurrences of @a from in @a source with @a to.\n"
|
||||
"@param source The string in which to replace the occurrences of @a from.\n"
|
||||
"@param from The string to replace in @a source.\n"
|
||||
|
|
@ -690,7 +690,7 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strrepeat, const char*, ( const char* str, S32 numTimes, const char* delimiter ), ( "" ),
|
||||
DefineEngineFunction( strrepeat, const char*, ( const char* str, S32 numTimes, const char* delimiter ), ( "" ),
|
||||
"Return a string that repeats @a str @a numTimes number of times delimiting each occurrence with @a delimiter.\n"
|
||||
"@param str The string to repeat multiple times.\n"
|
||||
"@param numTimes The number of times to repeat @a str in the result string.\n"
|
||||
|
|
@ -717,7 +717,7 @@ DefineConsoleFunction( strrepeat, const char*, ( const char* str, S32 numTimes,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getSubStr, const char*, ( const char* str, S32 start, S32 numChars ), ( -1 ),
|
||||
DefineEngineFunction( getSubStr, const char*, ( const char* str, S32 start, S32 numChars ), ( -1 ),
|
||||
"@brief Return a substring of @a str starting at @a start and continuing either through to the end of @a str "
|
||||
"(if @a numChars is -1) or for @a numChars characters (except if this would exceed the actual source "
|
||||
"string length).\n"
|
||||
|
|
@ -758,7 +758,7 @@ DefineConsoleFunction( getSubStr, const char*, ( const char* str, S32 start, S32
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strIsMatchExpr, bool, ( const char* pattern, const char* str, bool caseSensitive ), ( false ),
|
||||
DefineEngineFunction( strIsMatchExpr, bool, ( const char* pattern, const char* str, bool caseSensitive ), ( false ),
|
||||
"Match a pattern against a string.\n"
|
||||
"@param pattern The wildcard pattern to match against. The pattern can include characters, '*' to match "
|
||||
"any number of characters and '?' to match a single character.\n"
|
||||
|
|
@ -777,7 +777,7 @@ DefineConsoleFunction( strIsMatchExpr, bool, ( const char* pattern, const char*
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strIsMatchMultipleExpr, bool, ( const char* patterns, const char* str, bool caseSensitive ), ( false ),
|
||||
DefineEngineFunction( strIsMatchMultipleExpr, bool, ( const char* patterns, const char* str, bool caseSensitive ), ( false ),
|
||||
"Match a multiple patterns against a single string.\n"
|
||||
"@param patterns A tab-separated list of patterns. Each pattern can include charaters, '*' to match "
|
||||
"any number of characters and '?' to match a single character. Each of the patterns is tried in turn.\n"
|
||||
|
|
@ -796,7 +796,7 @@ DefineConsoleFunction( strIsMatchMultipleExpr, bool, ( const char* patterns, con
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getTrailingNumber, S32, ( const char* str ),,
|
||||
DefineEngineFunction( getTrailingNumber, S32, ( const char* str ),,
|
||||
"Get the numeric suffix of the given input string.\n"
|
||||
"@param str The string from which to read out the numeric suffix.\n"
|
||||
"@return The numeric value of the number suffix of @a str or -1 if @a str has no such suffix.\n\n"
|
||||
|
|
@ -813,7 +813,7 @@ DefineConsoleFunction( getTrailingNumber, S32, ( const char* str ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( stripTrailingNumber, String, ( const char* str ),,
|
||||
DefineEngineFunction( stripTrailingNumber, String, ( const char* str ),,
|
||||
"Strip a numeric suffix from the given string.\n"
|
||||
"@param str The string from which to strip its numeric suffix.\n"
|
||||
"@return The string @a str without its number suffix or the original string @a str if it has no such suffix.\n\n"
|
||||
|
|
@ -829,7 +829,7 @@ DefineConsoleFunction( stripTrailingNumber, String, ( const char* str ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getFirstNumber, String, ( const char* str ),,
|
||||
DefineEngineFunction( getFirstNumber, String, ( const char* str ),,
|
||||
"Get the first occuring number from @a str.\n"
|
||||
"@param str The string from which to read out the first number.\n"
|
||||
"@return String representation of the number or "" if no number.\n\n")
|
||||
|
|
@ -841,7 +841,7 @@ DefineConsoleFunction( getFirstNumber, String, ( const char* str ),,
|
|||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( isspace, bool, ( const char* str, S32 index ),,
|
||||
DefineEngineFunction( isspace, bool, ( const char* str, S32 index ),,
|
||||
"Test whether the character at the given position is a whitespace character.\n"
|
||||
"Characters such as tab, space, or newline are considered whitespace.\n"
|
||||
"@param str The string to test.\n"
|
||||
|
|
@ -858,7 +858,7 @@ DefineConsoleFunction( isspace, bool, ( const char* str, S32 index ),,
|
|||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( isalnum, bool, ( const char* str, S32 index ),,
|
||||
DefineEngineFunction( isalnum, bool, ( const char* str, S32 index ),,
|
||||
"Test whether the character at the given position is an alpha-numeric character.\n"
|
||||
"Alpha-numeric characters are characters that are either alphabetic (a-z, A-Z) or numbers (0-9).\n"
|
||||
"@param str The string to test.\n"
|
||||
|
|
@ -875,7 +875,7 @@ DefineConsoleFunction( isalnum, bool, ( const char* str, S32 index ),,
|
|||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( startsWith, bool, ( const char* str, const char* prefix, bool caseSensitive ), ( false ),
|
||||
DefineEngineFunction( startsWith, bool, ( const char* str, const char* prefix, bool caseSensitive ), ( false ),
|
||||
"Test whether the given string begins with the given prefix.\n"
|
||||
"@param str The string to test.\n"
|
||||
"@param prefix The potential prefix of @a str.\n"
|
||||
|
|
@ -924,7 +924,7 @@ DefineConsoleFunction( startsWith, bool, ( const char* str, const char* prefix,
|
|||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( endsWith, bool, ( const char* str, const char* suffix, bool caseSensitive ), ( false ),
|
||||
DefineEngineFunction( endsWith, bool, ( const char* str, const char* suffix, bool caseSensitive ), ( false ),
|
||||
"@brief Test whether the given string ends with the given suffix.\n\n"
|
||||
"@param str The string to test.\n"
|
||||
"@param suffix The potential suffix of @a str.\n"
|
||||
|
|
@ -978,7 +978,7 @@ DefineConsoleFunction( endsWith, bool, ( const char* str, const char* suffix, bo
|
|||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strchrpos, S32, ( const char* str, const char* chr, S32 start ), ( 0 ),
|
||||
DefineEngineFunction( strchrpos, S32, ( const char* str, const char* chr, S32 start ), ( 0 ),
|
||||
"Find the first occurrence of the given character in the given string.\n"
|
||||
"@param str The string to search.\n"
|
||||
"@param chr The character to look for. Only the first character of this string will be searched for.\n"
|
||||
|
|
@ -998,7 +998,7 @@ DefineConsoleFunction( strchrpos, S32, ( const char* str, const char* chr, S32 s
|
|||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strrchrpos, S32, ( const char* str, const char* chr, S32 start ), ( 0 ),
|
||||
DefineEngineFunction( strrchrpos, S32, ( const char* str, const char* chr, S32 start ), ( 0 ),
|
||||
"Find the last occurrence of the given character in the given string.\n"
|
||||
"@param str The string to search.\n"
|
||||
"@param chr The character to look for. Only the first character of this string will be searched for.\n"
|
||||
|
|
@ -1025,7 +1025,7 @@ DefineConsoleFunction( strrchrpos, S32, ( const char* str, const char* chr, S32
|
|||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction(ColorFloatToInt, ColorI, (LinearColorF color), ,
|
||||
DefineEngineFunction(ColorFloatToInt, ColorI, (LinearColorF color), ,
|
||||
"Convert from a float color to an integer color (0.0 - 1.0 to 0 to 255).\n"
|
||||
"@param color Float color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha.\n"
|
||||
"@return Converted color value (0 - 255)\n\n"
|
||||
|
|
@ -1037,7 +1037,7 @@ DefineConsoleFunction(ColorFloatToInt, ColorI, (LinearColorF color), ,
|
|||
return color.toColorI();
|
||||
}
|
||||
|
||||
DefineConsoleFunction(ColorIntToFloat, LinearColorF, (ColorI color), ,
|
||||
DefineEngineFunction(ColorIntToFloat, LinearColorF, (ColorI color), ,
|
||||
"Convert from a integer color to an float color (0 to 255 to 0.0 - 1.0).\n"
|
||||
"@param color Integer color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha.\n"
|
||||
"@return Converted color value (0.0 - 1.0)\n\n"
|
||||
|
|
@ -1049,7 +1049,7 @@ DefineConsoleFunction(ColorIntToFloat, LinearColorF, (ColorI color), ,
|
|||
return LinearColorF(color);
|
||||
}
|
||||
|
||||
DefineConsoleFunction(ColorRGBToHEX, const char*, (ColorI color), ,
|
||||
DefineEngineFunction(ColorRGBToHEX, const char*, (ColorI color), ,
|
||||
"Convert from a integer RGB (red, green, blue) color to hex color value (0 to 255 to 00 - FF).\n"
|
||||
"@param color Integer color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha. It excepts an alpha, but keep in mind this will not be converted.\n"
|
||||
"@return Hex color value (#000000 - #FFFFFF), alpha isn't handled/converted so it is only the RGB value\n\n"
|
||||
|
|
@ -1061,7 +1061,7 @@ DefineConsoleFunction(ColorRGBToHEX, const char*, (ColorI color), ,
|
|||
return Con::getReturnBuffer(color.getHex());
|
||||
}
|
||||
|
||||
DefineConsoleFunction(ColorRGBToHSB, const char*, (ColorI color), ,
|
||||
DefineEngineFunction(ColorRGBToHSB, const char*, (ColorI color), ,
|
||||
"Convert from a integer RGB (red, green, blue) color to HSB (hue, saturation, brightness). HSB is also know as HSL or HSV as well, with the last letter standing for lightness or value.\n"
|
||||
"@param color Integer color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha. It excepts an alpha, but keep in mind this will not be converted.\n"
|
||||
"@return HSB color value, alpha isn't handled/converted so it is only the RGB value\n\n"
|
||||
|
|
@ -1075,7 +1075,7 @@ DefineConsoleFunction(ColorRGBToHSB, const char*, (ColorI color), ,
|
|||
return Con::getReturnBuffer(s);
|
||||
}
|
||||
|
||||
DefineConsoleFunction(ColorHEXToRGB, ColorI, (const char* hex), ,
|
||||
DefineEngineFunction(ColorHEXToRGB, ColorI, (const char* hex), ,
|
||||
"Convert from a hex color value to an integer RGB (red, green, blue) color (00 - FF to 0 to 255).\n"
|
||||
"@param hex Hex color value (#000000 - #FFFFFF) to be converted to an RGB (red, green, blue) value.\n"
|
||||
"@return Integer color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha. Alpha isn't handled/converted so only pay attention to the RGB value\n\n"
|
||||
|
|
@ -1089,7 +1089,7 @@ DefineConsoleFunction(ColorHEXToRGB, ColorI, (const char* hex), ,
|
|||
return color;
|
||||
}
|
||||
|
||||
DefineConsoleFunction(ColorHSBToRGB, ColorI, (Point3I hsb), ,
|
||||
DefineEngineFunction(ColorHSBToRGB, ColorI, (Point3I hsb), ,
|
||||
"Convert from a HSB (hue, saturation, brightness) to an integer RGB (red, green, blue) color. HSB is also know as HSL or HSV as well, with the last letter standing for lightness or value.\n"
|
||||
"@param hsb HSB (hue, saturation, brightness) value to be converted.\n"
|
||||
"@return Integer color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha. Alpha isn't handled/converted so only pay attention to the RGB value\n\n"
|
||||
|
|
@ -1105,7 +1105,7 @@ DefineConsoleFunction(ColorHSBToRGB, ColorI, (Point3I hsb), ,
|
|||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( strToggleCaseToWords, const char*, ( const char* str ),,
|
||||
DefineEngineFunction( strToggleCaseToWords, const char*, ( const char* str ),,
|
||||
"Parse a Toggle Case word into separate words.\n"
|
||||
"@param str The string to parse.\n"
|
||||
"@return new string space separated.\n\n"
|
||||
|
|
@ -1130,7 +1130,7 @@ DefineConsoleFunction( strToggleCaseToWords, const char*, ( const char* str ),,
|
|||
//----------------------------------------------------------------
|
||||
|
||||
// Warning: isInt and isFloat are very 'strict' and might need to be adjusted to allow other values. //seanmc
|
||||
DefineConsoleFunction( isInt, bool, ( const char* str),,
|
||||
DefineEngineFunction( isInt, bool, ( const char* str),,
|
||||
"Returns true if the string is an integer.\n"
|
||||
"@param str The string to test.\n"
|
||||
"@return true if @a str is an integer and false if not\n\n"
|
||||
|
|
@ -1144,7 +1144,7 @@ DefineConsoleFunction( isInt, bool, ( const char* str),,
|
|||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( isFloat, bool, ( const char* str, bool sciOk), (false),
|
||||
DefineEngineFunction( isFloat, bool, ( const char* str, bool sciOk), (false),
|
||||
"Returns true if the string is a float.\n"
|
||||
"@param str The string to test.\n"
|
||||
"@param sciOk Test for correct scientific notation and accept it (ex. 1.2e+14)"
|
||||
|
|
@ -1159,7 +1159,7 @@ DefineConsoleFunction( isFloat, bool, ( const char* str, bool sciOk), (false),
|
|||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( isValidPort, bool, ( const char* str),,
|
||||
DefineEngineFunction( isValidPort, bool, ( const char* str),,
|
||||
"Returns true if the string is a valid port number.\n"
|
||||
"@param str The string to test.\n"
|
||||
"@return true if @a str is a port and false if not\n\n"
|
||||
|
|
@ -1179,7 +1179,7 @@ DefineConsoleFunction( isValidPort, bool, ( const char* str),,
|
|||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( isValidIP, bool, ( const char* str),,
|
||||
DefineEngineFunction( isValidIP, bool, ( const char* str),,
|
||||
"Returns true if the string is a valid ip address, excepts localhost.\n"
|
||||
"@param str The string to test.\n"
|
||||
"@return true if @a str is a valid ip address and false if not\n\n"
|
||||
|
|
@ -1200,7 +1200,7 @@ DefineConsoleFunction( isValidIP, bool, ( const char* str),,
|
|||
|
||||
// Torque won't normally add another string if it already exists with another casing,
|
||||
// so this forces the addition. It should be called once near the start, such as in main.cs.
|
||||
ConsoleFunction(addCaseSensitiveStrings,void,2,0,"[string1, string2, ...]"
|
||||
DefineEngineStringlyVariadicFunction(addCaseSensitiveStrings,void,2,0,"[string1, string2, ...]"
|
||||
"Adds case sensitive strings to the StringTable.")
|
||||
{
|
||||
for(int i = 1; i < argc; i++)
|
||||
|
|
@ -1214,7 +1214,7 @@ ConsoleFunction(addCaseSensitiveStrings,void,2,0,"[string1, string2, ...]"
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getWord, const char*, ( const char* text, S32 index ),,
|
||||
DefineEngineFunction( getWord, const char*, ( const char* text, S32 index ),,
|
||||
"Extract the word at the given @a index in the whitespace-separated list in @a text.\n"
|
||||
"Words in @a text must be separated by newlines, spaces, and/or tabs.\n"
|
||||
"@param text A whitespace-separated list of words.\n"
|
||||
|
|
@ -1235,7 +1235,7 @@ DefineConsoleFunction( getWord, const char*, ( const char* text, S32 index ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getWords, const char*, ( const char* text, S32 startIndex, S32 endIndex ), ( -1 ),
|
||||
DefineEngineFunction( getWords, const char*, ( const char* text, S32 startIndex, S32 endIndex ), ( -1 ),
|
||||
"Extract a range of words from the given @a startIndex onwards thru @a endIndex.\n"
|
||||
"Words in @a text must be separated by newlines, spaces, and/or tabs.\n"
|
||||
"@param text A whitespace-separated list of words.\n"
|
||||
|
|
@ -1262,7 +1262,7 @@ DefineConsoleFunction( getWords, const char*, ( const char* text, S32 startIndex
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( setWord, const char*, ( const char* text, S32 index, const char* replacement ),,
|
||||
DefineEngineFunction( setWord, const char*, ( const char* text, S32 index, const char* replacement ),,
|
||||
"Replace the word in @a text at the given @a index with @a replacement.\n"
|
||||
"Words in @a text must be separated by newlines, spaces, and/or tabs.\n"
|
||||
"@param text A whitespace-separated list of words.\n"
|
||||
|
|
@ -1284,7 +1284,7 @@ DefineConsoleFunction( setWord, const char*, ( const char* text, S32 index, cons
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( removeWord, const char*, ( const char* text, S32 index ),,
|
||||
DefineEngineFunction( removeWord, const char*, ( const char* text, S32 index ),,
|
||||
"Remove the word in @a text at the given @a index.\n"
|
||||
"Words in @a text must be separated by newlines, spaces, and/or tabs.\n"
|
||||
"@param text A whitespace-separated list of words.\n"
|
||||
|
|
@ -1304,7 +1304,7 @@ DefineConsoleFunction( removeWord, const char*, ( const char* text, S32 index ),
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getWordCount, S32, ( const char* text ),,
|
||||
DefineEngineFunction( getWordCount, S32, ( const char* text ),,
|
||||
"Return the number of whitespace-separated words in @a text.\n"
|
||||
"Words in @a text must be separated by newlines, spaces, and/or tabs.\n"
|
||||
"@param text A whitespace-separated list of words.\n"
|
||||
|
|
@ -1365,7 +1365,7 @@ DefineEngineFunction( weekdayNumToStr, String, ( S32 num, bool abbreviate ), (fa
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getField, const char*, ( const char* text, S32 index ),,
|
||||
DefineEngineFunction( getField, const char*, ( const char* text, S32 index ),,
|
||||
"Extract the field at the given @a index in the newline and/or tab separated list in @a text.\n"
|
||||
"Fields in @a text must be separated by newlines and/or tabs.\n"
|
||||
"@param text A list of fields separated by newlines and/or tabs.\n"
|
||||
|
|
@ -1385,7 +1385,7 @@ DefineConsoleFunction( getField, const char*, ( const char* text, S32 index ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getFields, const char*, ( const char* text, S32 startIndex, S32 endIndex ), ( -1 ),
|
||||
DefineEngineFunction( getFields, const char*, ( const char* text, S32 startIndex, S32 endIndex ), ( -1 ),
|
||||
"Extract a range of fields from the given @a startIndex onwards thru @a endIndex.\n"
|
||||
"Fields in @a text must be separated by newlines and/or tabs.\n"
|
||||
"@param text A list of fields separated by newlines and/or tabs.\n"
|
||||
|
|
@ -1411,7 +1411,7 @@ DefineConsoleFunction( getFields, const char*, ( const char* text, S32 startInde
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( setField, const char*, ( const char* text, S32 index, const char* replacement ),,
|
||||
DefineEngineFunction( setField, const char*, ( const char* text, S32 index, const char* replacement ),,
|
||||
"Replace the field in @a text at the given @a index with @a replacement.\n"
|
||||
"Fields in @a text must be separated by newlines and/or tabs.\n"
|
||||
"@param text A list of fields separated by newlines and/or tabs.\n"
|
||||
|
|
@ -1432,7 +1432,7 @@ DefineConsoleFunction( setField, const char*, ( const char* text, S32 index, con
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( removeField, const char*, ( const char* text, S32 index ),,
|
||||
DefineEngineFunction( removeField, const char*, ( const char* text, S32 index ),,
|
||||
"Remove the field in @a text at the given @a index.\n"
|
||||
"Fields in @a text must be separated by newlines and/or tabs.\n"
|
||||
"@param text A list of fields separated by newlines and/or tabs.\n"
|
||||
|
|
@ -1451,7 +1451,7 @@ DefineConsoleFunction( removeField, const char*, ( const char* text, S32 index )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getFieldCount, S32, ( const char* text ),,
|
||||
DefineEngineFunction( getFieldCount, S32, ( const char* text ),,
|
||||
"Return the number of newline and/or tab separated fields in @a text.\n"
|
||||
"@param text A list of fields separated by newlines and/or tabs.\n"
|
||||
"@return The number of newline and/or tab sepearated elements in @a text.\n\n"
|
||||
|
|
@ -1467,7 +1467,7 @@ DefineConsoleFunction( getFieldCount, S32, ( const char* text ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getRecord, const char*, ( const char* text, S32 index ),,
|
||||
DefineEngineFunction( getRecord, const char*, ( const char* text, S32 index ),,
|
||||
"Extract the record at the given @a index in the newline-separated list in @a text.\n"
|
||||
"Records in @a text must be separated by newlines.\n"
|
||||
"@param text A list of records separated by newlines.\n"
|
||||
|
|
@ -1487,7 +1487,7 @@ DefineConsoleFunction( getRecord, const char*, ( const char* text, S32 index ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getRecords, const char*, ( const char* text, S32 startIndex, S32 endIndex ), ( -1 ),
|
||||
DefineEngineFunction( getRecords, const char*, ( const char* text, S32 startIndex, S32 endIndex ), ( -1 ),
|
||||
"Extract a range of records from the given @a startIndex onwards thru @a endIndex.\n"
|
||||
"Records in @a text must be separated by newlines.\n"
|
||||
"@param text A list of records separated by newlines.\n"
|
||||
|
|
@ -1513,7 +1513,7 @@ DefineConsoleFunction( getRecords, const char*, ( const char* text, S32 startInd
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( setRecord, const char*, ( const char* text, S32 index, const char* replacement ),,
|
||||
DefineEngineFunction( setRecord, const char*, ( const char* text, S32 index, const char* replacement ),,
|
||||
"Replace the record in @a text at the given @a index with @a replacement.\n"
|
||||
"Records in @a text must be separated by newlines.\n"
|
||||
"@param text A list of records separated by newlines.\n"
|
||||
|
|
@ -1534,7 +1534,7 @@ DefineConsoleFunction( setRecord, const char*, ( const char* text, S32 index, co
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( removeRecord, const char*, ( const char* text, S32 index ),,
|
||||
DefineEngineFunction( removeRecord, const char*, ( const char* text, S32 index ),,
|
||||
"Remove the record in @a text at the given @a index.\n"
|
||||
"Records in @a text must be separated by newlines.\n"
|
||||
"@param text A list of records separated by newlines.\n"
|
||||
|
|
@ -1553,7 +1553,7 @@ DefineConsoleFunction( removeRecord, const char*, ( const char* text, S32 index
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getRecordCount, S32, ( const char* text ),,
|
||||
DefineEngineFunction( getRecordCount, S32, ( const char* text ),,
|
||||
"Return the number of newline-separated records in @a text.\n"
|
||||
"@param text A list of records separated by newlines.\n"
|
||||
"@return The number of newline-sepearated elements in @a text.\n\n"
|
||||
|
|
@ -1569,7 +1569,7 @@ DefineConsoleFunction( getRecordCount, S32, ( const char* text ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( firstWord, const char*, ( const char* text ),,
|
||||
DefineEngineFunction( firstWord, const char*, ( const char* text ),,
|
||||
"Return the first word in @a text.\n"
|
||||
"@param text A list of words separated by newlines, spaces, and/or tabs.\n"
|
||||
"@return The word at index 0 in @a text or \"\" if @a text is empty.\n\n"
|
||||
|
|
@ -1585,7 +1585,7 @@ DefineConsoleFunction( firstWord, const char*, ( const char* text ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( restWords, const char*, ( const char* text ),,
|
||||
DefineEngineFunction( restWords, const char*, ( const char* text ),,
|
||||
"Return all but the first word in @a text.\n"
|
||||
"@param text A list of words separated by newlines, spaces, and/or tabs.\n"
|
||||
"@return @a text with the first word removed.\n\n"
|
||||
|
|
@ -1619,7 +1619,7 @@ static bool isInSet(char c, const char *set)
|
|||
return false;
|
||||
}
|
||||
|
||||
DefineConsoleFunction( nextToken, const char*, ( const char* str1, const char* token, const char* delim), , "( string str, string token, string delimiters ) "
|
||||
DefineEngineFunction( nextToken, const char*, ( const char* str1, const char* token, const char* delim), , "( string str, string token, string delimiters ) "
|
||||
"Tokenize a string using a set of delimiting characters.\n"
|
||||
"This function first skips all leading charaters in @a str that are contained in @a delimiters. "
|
||||
"From that position, it then scans for the next character in @a str that is contained in @a delimiters and stores all characters "
|
||||
|
|
@ -1688,7 +1688,7 @@ DefineConsoleFunction( nextToken, const char*, ( const char* str1, const char* t
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getToken, const char*, ( const char* text, const char* delimiters, S32 index ),,
|
||||
DefineEngineFunction( getToken, const char*, ( const char* text, const char* delimiters, S32 index ),,
|
||||
"Extract the substring at the given @a index in the @a delimiters separated list in @a text.\n"
|
||||
"@param text A @a delimiters list of substrings.\n"
|
||||
"@param delimiters Character or characters that separate the list of substrings in @a text.\n"
|
||||
|
|
@ -1709,7 +1709,7 @@ DefineConsoleFunction( getToken, const char*, ( const char* text, const char* de
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getTokens, const char*, ( const char* text, const char* delimiters, S32 startIndex, S32 endIndex ), ( -1 ),
|
||||
DefineEngineFunction( getTokens, const char*, ( const char* text, const char* delimiters, S32 startIndex, S32 endIndex ), ( -1 ),
|
||||
"Extract a range of substrings separated by @a delimiters at the given @a startIndex onwards thru @a endIndex.\n"
|
||||
"@param text A @a delimiters list of substrings.\n"
|
||||
"@param delimiters Character or characters that separate the list of substrings in @a text.\n"
|
||||
|
|
@ -1736,7 +1736,7 @@ DefineConsoleFunction( getTokens, const char*, ( const char* text, const char* d
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( setToken, const char*, ( const char* text, const char* delimiters, S32 index, const char* replacement ),,
|
||||
DefineEngineFunction( setToken, const char*, ( const char* text, const char* delimiters, S32 index, const char* replacement ),,
|
||||
"Replace the substring in @a text separated by @a delimiters at the given @a index with @a replacement.\n"
|
||||
"@param text A @a delimiters list of substrings.\n"
|
||||
"@param delimiters Character or characters that separate the list of substrings in @a text.\n"
|
||||
|
|
@ -1758,7 +1758,7 @@ DefineConsoleFunction( setToken, const char*, ( const char* text, const char* de
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( removeToken, const char*, ( const char* text, const char* delimiters, S32 index ),,
|
||||
DefineEngineFunction( removeToken, const char*, ( const char* text, const char* delimiters, S32 index ),,
|
||||
"Remove the substring in @a text separated by @a delimiters at the given @a index.\n"
|
||||
"@param text A @a delimiters list of substrings.\n"
|
||||
"@param delimiters Character or characters that separate the list of substrings in @a text.\n"
|
||||
|
|
@ -1778,7 +1778,7 @@ DefineConsoleFunction( removeToken, const char*, ( const char* text, const char*
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getTokenCount, S32, ( const char* text, const char* delimiters),,
|
||||
DefineEngineFunction( getTokenCount, S32, ( const char* text, const char* delimiters),,
|
||||
"Return the number of @a delimiters substrings in @a text.\n"
|
||||
"@param text A @a delimiters list of substrings.\n"
|
||||
"@param delimiters Character or characters that separate the list of substrings in @a text.\n"
|
||||
|
|
@ -1837,7 +1837,7 @@ DefineEngineFunction( detag, const char*, ( const char* str ),,
|
|||
return str;
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getTag, const char*, ( const char* textTagString ), , "( string textTagString ) "
|
||||
DefineEngineFunction( getTag, const char*, ( const char* textTagString ), , "( string textTagString ) "
|
||||
"@brief Extracts the tag from a tagged string\n\n"
|
||||
|
||||
"Should only be used within the context of a function that receives a tagged "
|
||||
|
|
@ -1879,7 +1879,7 @@ DefineConsoleFunction( getTag, const char*, ( const char* textTagString ), , "(
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction( echo, void, 2, 0, "( string message... ) "
|
||||
DefineEngineStringlyVariadicFunction( echo, void, 2, 0, "( string message... ) "
|
||||
"@brief Logs a message to the console.\n\n"
|
||||
"Concatenates all given arguments to a single string and prints the string to the console. "
|
||||
"A newline is added automatically after the text.\n\n"
|
||||
|
|
@ -1902,7 +1902,7 @@ ConsoleFunction( echo, void, 2, 0, "( string message... ) "
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction( warn, void, 2, 0, "( string message... ) "
|
||||
DefineEngineStringlyVariadicFunction( warn, void, 2, 0, "( string message... ) "
|
||||
"@brief Logs a warning message to the console.\n\n"
|
||||
"Concatenates all given arguments to a single string and prints the string to the console as a warning "
|
||||
"message (in the in-game console, these will show up using a turquoise font by default). "
|
||||
|
|
@ -1926,7 +1926,7 @@ ConsoleFunction( warn, void, 2, 0, "( string message... ) "
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction( error, void, 2, 0, "( string message... ) "
|
||||
DefineEngineStringlyVariadicFunction( error, void, 2, 0, "( string message... ) "
|
||||
"@brief Logs an error message to the console.\n\n"
|
||||
"Concatenates all given arguments to a single string and prints the string to the console as an error "
|
||||
"message (in the in-game console, these will show up using a red font by default). "
|
||||
|
|
@ -1968,7 +1968,7 @@ DefineEngineFunction( debugv, void, ( const char* variableName ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( expandEscape, const char*, ( const char* text ),,
|
||||
DefineEngineFunction( expandEscape, const char*, ( const char* text ),,
|
||||
"@brief Replace all characters in @a text that need to be escaped for the string to be a valid string literal with their "
|
||||
"respective escape sequences.\n\n"
|
||||
"All characters in @a text that cannot appear in a string literal will be replaced by an escape sequence (\\\\n, \\\\t, etc).\n\n"
|
||||
|
|
@ -1990,7 +1990,7 @@ DefineConsoleFunction( expandEscape, const char*, ( const char* text ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( collapseEscape, const char*, ( const char* text ),,
|
||||
DefineEngineFunction( collapseEscape, const char*, ( const char* text ),,
|
||||
"Replace all escape sequences in @a text with their respective character codes.\n\n"
|
||||
"This function replaces all escape sequences (\\\\n, \\\\t, etc) in the given string "
|
||||
"with the respective characters they represent.\n\n"
|
||||
|
|
@ -2046,7 +2046,7 @@ DefineEngineFunction( setLogMode, void, ( S32 mode ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( quit, void, ( ),,
|
||||
DefineEngineFunction( quit, void, ( ),,
|
||||
"Shut down the engine and exit its process.\n"
|
||||
"This function cleanly uninitializes the engine and then exits back to the system with a process "
|
||||
"exit status indicating a clean exit.\n\n"
|
||||
|
|
@ -2059,7 +2059,7 @@ DefineConsoleFunction( quit, void, ( ),,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
DefineConsoleFunction( realQuit, void, (), , "")
|
||||
DefineEngineFunction( realQuit, void, (), , "")
|
||||
{
|
||||
Platform::postQuitMessage(0);
|
||||
}
|
||||
|
|
@ -2067,7 +2067,7 @@ DefineConsoleFunction( realQuit, void, (), , "")
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( quitWithErrorMessage, void, ( const char* message, S32 status ), (0),
|
||||
DefineEngineFunction( quitWithErrorMessage, void, ( const char* message, S32 status ), (0),
|
||||
"Display an error message box showing the given @a message and then shut down the engine and exit its process.\n"
|
||||
"This function cleanly uninitialized the engine and then exits back to the system with a process "
|
||||
"exit status indicating an error.\n\n"
|
||||
|
|
@ -2088,7 +2088,7 @@ DefineConsoleFunction( quitWithErrorMessage, void, ( const char* message, S32 st
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( quitWithStatus, void, ( S32 status ), (0),
|
||||
DefineEngineFunction( quitWithStatus, void, ( S32 status ), (0),
|
||||
"Shut down the engine and exit its process.\n"
|
||||
"This function cleanly uninitializes the engine and then exits back to the system with a given "
|
||||
"return status code.\n\n"
|
||||
|
|
@ -2236,7 +2236,7 @@ DefineEngineFunction( generateUUID, Torque::UUID, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction( call, const char *, 2, 0, "( string functionName, string args... ) "
|
||||
DefineEngineStringlyVariadicFunction( call, const char *, 2, 0, "( string functionName, string args... ) "
|
||||
"Apply the given arguments to the specified global function and return the result of the call.\n\n"
|
||||
"@param functionName The name of the function to call. This function must be in the global namespace, i.e. "
|
||||
"you cannot call a function in a namespace through #call. Use eval() for that.\n"
|
||||
|
|
@ -2259,7 +2259,7 @@ ConsoleFunction( call, const char *, 2, 0, "( string functionName, string args..
|
|||
static U32 execDepth = 0;
|
||||
static U32 journalDepth = 1;
|
||||
|
||||
DefineConsoleFunction( getDSOPath, const char*, ( const char* scriptFileName ),,
|
||||
DefineEngineFunction( getDSOPath, const char*, ( const char* scriptFileName ),,
|
||||
"Get the absolute path to the file in which the compiled code for the given script file will be stored.\n"
|
||||
"@param scriptFileName %Path to the .cs script file.\n"
|
||||
"@return The absolute path to the .dso file for the given script file.\n\n"
|
||||
|
|
@ -2373,12 +2373,12 @@ DefineEngineFunction( exec, bool, ( const char* fileName, bool noCalls, bool jou
|
|||
return Con::executeFile(fileName, noCalls, journalScript);
|
||||
}
|
||||
|
||||
DefineConsoleFunction( eval, const char*, ( const char* consoleString ), , "eval(consoleString)" )
|
||||
DefineEngineFunction( eval, const char*, ( const char* consoleString ), , "eval(consoleString)" )
|
||||
{
|
||||
return Con::evaluate(consoleString, false, NULL);
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getVariable, const char*, ( const char* varName ), , "(string varName)\n"
|
||||
DefineEngineFunction( getVariable, const char*, ( const char* varName ), , "(string varName)\n"
|
||||
"@brief Returns the value of the named variable or an empty string if not found.\n\n"
|
||||
"@varName Name of the variable to search for\n"
|
||||
"@return Value contained by varName, \"\" if the variable does not exist\n"
|
||||
|
|
@ -2387,7 +2387,7 @@ DefineConsoleFunction( getVariable, const char*, ( const char* varName ), , "(st
|
|||
return Con::getVariable(varName);
|
||||
}
|
||||
|
||||
DefineConsoleFunction( setVariable, void, ( const char* varName, const char* value ), , "(string varName, string value)\n"
|
||||
DefineEngineFunction( setVariable, void, ( const char* varName, const char* value ), , "(string varName, string value)\n"
|
||||
"@brief Sets the value of the named variable.\n\n"
|
||||
"@param varName Name of the variable to locate\n"
|
||||
"@param value New value of the variable\n"
|
||||
|
|
@ -2397,7 +2397,7 @@ DefineConsoleFunction( setVariable, void, ( const char* varName, const char* val
|
|||
return Con::setVariable(varName, value);
|
||||
}
|
||||
|
||||
DefineConsoleFunction( isFunction, bool, ( const char* funcName ), , "(string funcName)"
|
||||
DefineEngineFunction( isFunction, bool, ( const char* funcName ), , "(string funcName)"
|
||||
"@brief Determines if a function exists or not\n\n"
|
||||
"@param funcName String containing name of the function\n"
|
||||
"@return True if the function exists, false if not\n"
|
||||
|
|
@ -2406,7 +2406,7 @@ DefineConsoleFunction( isFunction, bool, ( const char* funcName ), , "(string fu
|
|||
return Con::isFunction(funcName);
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getFunctionPackage, const char*, ( const char* funcName ), , "(string funcName)"
|
||||
DefineEngineFunction( getFunctionPackage, const char*, ( const char* funcName ), , "(string funcName)"
|
||||
"@brief Provides the name of the package the function belongs to\n\n"
|
||||
"@param funcName String containing name of the function\n"
|
||||
"@return The name of the function's package\n"
|
||||
|
|
@ -2419,7 +2419,7 @@ DefineConsoleFunction( getFunctionPackage, const char*, ( const char* funcName )
|
|||
return nse->mPackage;
|
||||
}
|
||||
|
||||
DefineConsoleFunction( isMethod, bool, ( const char* nameSpace, const char* method ), , "(string namespace, string method)"
|
||||
DefineEngineFunction( isMethod, bool, ( const char* nameSpace, const char* method ), , "(string namespace, string method)"
|
||||
"@brief Determines if a class/namespace method exists\n\n"
|
||||
"@param namespace Class or namespace, such as Player\n"
|
||||
"@param method Name of the function to search for\n"
|
||||
|
|
@ -2434,7 +2434,7 @@ DefineConsoleFunction( isMethod, bool, ( const char* nameSpace, const char* meth
|
|||
return true;
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getMethodPackage, const char*, ( const char* nameSpace, const char* method ), , "(string namespace, string method)"
|
||||
DefineEngineFunction( getMethodPackage, const char*, ( const char* nameSpace, const char* method ), , "(string namespace, string method)"
|
||||
"@brief Provides the name of the package the method belongs to\n\n"
|
||||
"@param namespace Class or namespace, such as Player\n"
|
||||
"@param method Name of the funciton to search for\n"
|
||||
|
|
@ -2452,7 +2452,7 @@ DefineConsoleFunction( getMethodPackage, const char*, ( const char* nameSpace, c
|
|||
return nse->mPackage;
|
||||
}
|
||||
|
||||
DefineConsoleFunction( isDefined, bool, ( const char* varName, const char* varValue ), ("") , "(string varName)"
|
||||
DefineEngineFunction( isDefined, bool, ( const char* varName, const char* varValue ), ("") , "(string varName)"
|
||||
"@brief Determines if a variable exists and contains a value\n"
|
||||
"@param varName Name of the variable to search for\n"
|
||||
"@return True if the variable was defined in script, false if not\n"
|
||||
|
|
@ -2590,14 +2590,14 @@ DefineConsoleFunction( isDefined, bool, ( const char* varName, const char* varVa
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( isCurrentScriptToolScript, bool, (), , "()"
|
||||
DefineEngineFunction( isCurrentScriptToolScript, bool, (), , "()"
|
||||
"Returns true if the calling script is a tools script.\n"
|
||||
"@hide")
|
||||
{
|
||||
return Con::isCurrentScriptToolScript();
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getModNameFromPath, const char *, ( const char* path ), , "(string path)"
|
||||
DefineEngineFunction( getModNameFromPath, const char *, ( const char* path ), , "(string path)"
|
||||
"@brief Attempts to extract a mod directory from path. Returns empty string on failure.\n\n"
|
||||
"@param File path of mod folder\n"
|
||||
"@note This is no longer relevant in Torque 3D (which does not use mod folders), should be deprecated\n"
|
||||
|
|
@ -2609,7 +2609,7 @@ DefineConsoleFunction( getModNameFromPath, const char *, ( const char* path ), ,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( pushInstantGroup, void, ( String group ),("") , "([group])"
|
||||
DefineEngineFunction( pushInstantGroup, void, ( String group ),("") , "([group])"
|
||||
"@brief Pushes the current $instantGroup on a stack "
|
||||
"and sets it to the given value (or clears it).\n\n"
|
||||
"@note Currently only used for editors\n"
|
||||
|
|
@ -2622,7 +2622,7 @@ DefineConsoleFunction( pushInstantGroup, void, ( String group ),("") , "([group]
|
|||
Con::pushInstantGroup();
|
||||
}
|
||||
|
||||
DefineConsoleFunction( popInstantGroup, void, (), , "()"
|
||||
DefineEngineFunction( popInstantGroup, void, (), , "()"
|
||||
"@brief Pop and restore the last setting of $instantGroup off the stack.\n\n"
|
||||
"@note Currently only used for editors\n\n"
|
||||
"@ingroup Editors\n"
|
||||
|
|
@ -2633,7 +2633,7 @@ DefineConsoleFunction( popInstantGroup, void, (), , "()"
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getPrefsPath, const char *, ( const char* relativeFileName ), (""), "([relativeFileName])"
|
||||
DefineEngineFunction( getPrefsPath, const char *, ( const char* relativeFileName ), (""), "([relativeFileName])"
|
||||
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
||||
"@internal")
|
||||
{
|
||||
|
|
@ -2646,31 +2646,28 @@ DefineConsoleFunction( getPrefsPath, const char *, ( const char* relativeFileNam
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction( execPrefs, bool, 2, 4, "( string relativeFileName, bool noCalls=false, bool journalScript=false )"
|
||||
"@brief Manually execute a special script file that contains game or editor preferences\n\n"
|
||||
"@param relativeFileName Name and path to file from project folder\n"
|
||||
"@param noCalls Deprecated\n"
|
||||
"@param journalScript Deprecated\n"
|
||||
"@return True if script was successfully executed\n"
|
||||
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
||||
"@ingroup Scripting")
|
||||
DefineEngineFunction(execPrefs, bool, (const char* relativeFileName, bool noCalls, bool journalScript),(false, false),
|
||||
"@brief Manually execute a special script file that contains game or editor preferences\n\n"
|
||||
"@param relativeFileName Name and path to file from project folder\n"
|
||||
"@param noCalls Deprecated\n"
|
||||
"@param journalScript Deprecated\n"
|
||||
"@return True if script was successfully executed\n"
|
||||
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
||||
"@ingroup Scripting")
|
||||
{
|
||||
const char *filename = Platform::getPrefsPath(argv[1]);
|
||||
if(filename == NULL || *filename == 0)
|
||||
if (relativeFileName == NULL || *relativeFileName == 0)
|
||||
return false;
|
||||
|
||||
// Scripts do this a lot, so we may as well help them out
|
||||
if(! Platform::isFile(filename) && ! Torque::FS::IsFile(filename))
|
||||
if (!Platform::isFile(relativeFileName) && !Torque::FS::IsFile(relativeFileName))
|
||||
return true;
|
||||
|
||||
argv[0] = "exec";
|
||||
argv[1] = filename;
|
||||
return dAtob(Con::execute(argc, argv));
|
||||
return Con::executeFile(relativeFileName, noCalls, journalScript);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( export, void, ( const char* pattern, const char* filename, bool append ), ( "", false ),
|
||||
DefineEngineFunction( export, void, ( const char* pattern, const char* filename, bool append ), ( "", false ),
|
||||
"Write out the definitions of all global variables matching the given name @a pattern.\n"
|
||||
"If @a fileName is not \"\", the variable definitions are written to the specified file. Otherwise the "
|
||||
"definitions will be printed to the console.\n\n"
|
||||
|
|
@ -2723,7 +2720,7 @@ DefineEngineFunction( deleteVariables, void, ( const char* pattern ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( trace, void, ( bool enable ), ( true ),
|
||||
DefineEngineFunction( trace, void, ( bool enable ), ( true ),
|
||||
"Enable or disable tracing in the script code VM.\n\n"
|
||||
"When enabled, the script code runtime will trace the invocation and returns "
|
||||
"from all functions that are called and log them to the console. This is helpful in "
|
||||
|
|
@ -2739,7 +2736,7 @@ DefineConsoleFunction( trace, void, ( bool enable ), ( true ),
|
|||
|
||||
#if defined(TORQUE_DEBUG) || !defined(TORQUE_SHIPPING)
|
||||
|
||||
DefineConsoleFunction( debug, void, (),,
|
||||
DefineEngineFunction( debug, void, (),,
|
||||
"Drops the engine into the native C++ debugger.\n\n"
|
||||
"This function triggers a debug break and drops the process into the IDE's debugger. If the process is not "
|
||||
"running with a debugger attached it will generate a runtime error on most platforms.\n\n"
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ void ConsoleLogger::log( const char *consoleLine )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger to the console and begins writing to file"
|
||||
DefineEngineMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger to the console and begins writing to file"
|
||||
"@tsexample\n"
|
||||
"// Create the logger\n"
|
||||
"// Will automatically start writing to testLogging.txt with normal priority\n"
|
||||
|
|
@ -247,7 +247,7 @@ DefineConsoleMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( ConsoleLogger, detach, bool, (), , "() Detaches the logger from the console and stops writing to file"
|
||||
DefineEngineMethod( ConsoleLogger, detach, bool, (), , "() Detaches the logger from the console and stops writing to file"
|
||||
"@tsexample\n"
|
||||
"// Create the logger\n"
|
||||
"// Will automatically start writing to testLogging.txt with normal priority\n"
|
||||
|
|
|
|||
|
|
@ -662,6 +662,29 @@ public:
|
|||
// Finally, do any class specific initialization...
|
||||
T::initPersistFields();
|
||||
T::consoleInit();
|
||||
|
||||
EnginePropertyTable::Property* props = new EnginePropertyTable::Property[sg_tempFieldList.size()];
|
||||
|
||||
for (int i = 0; i < sg_tempFieldList.size(); ++i)
|
||||
{
|
||||
EnginePropertyTable::Property prop;
|
||||
prop.mDocString = sg_tempFieldList[i].pFieldDocs;
|
||||
prop.mName = sg_tempFieldList[i].pFieldname;
|
||||
prop.mNumElements = sg_tempFieldList[i].elementCount;
|
||||
prop.mFlags = 0;
|
||||
if (sg_tempFieldList[i].type == StartGroupFieldType)
|
||||
prop.mFlags |= EnginePropertyGroupBegin;
|
||||
if (sg_tempFieldList[i].type == EndGroupFieldType)
|
||||
prop.mFlags |= EnginePropertyGroupEnd;
|
||||
prop.mType = sg_tempFieldList[i].type;
|
||||
|
||||
props[i] = prop;
|
||||
}
|
||||
|
||||
_smPropertyTable = EnginePropertyTable(sg_tempFieldList.size(), props);
|
||||
smPropertyTable = _smPropertyTable;
|
||||
|
||||
const_cast<EngineTypeInfo*>(mTypeInfo)->mPropertyTable = &_smPropertyTable;
|
||||
|
||||
// Let the base finish up.
|
||||
AbstractClassRep::init();
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ namespace Con {
|
|||
}; // namespace Con
|
||||
|
||||
|
||||
DefineConsoleFunction( consoleExportXML, const char*, (), ,"Exports console definition XML representation" )
|
||||
DefineEngineFunction( consoleExportXML, const char*, (), ,"Exports console definition XML representation" )
|
||||
{
|
||||
Con::XMLExport xmlExport;
|
||||
String xml;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@
|
|||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
#ifndef _FIXEDTUPLE_H_
|
||||
#include "fixedTuple.h"
|
||||
#endif
|
||||
|
||||
#ifndef _CONSOLETYPES_H_
|
||||
#include "console/consoleTypes.h"
|
||||
#endif
|
||||
|
|
@ -347,6 +351,8 @@ struct _EngineTrampoline< R( ArgTs ... ) >
|
|||
{
|
||||
typedef std::tuple<ArgTs ...> Args;
|
||||
std::tuple<ArgTs ...> argT;
|
||||
typedef fixed_tuple<ArgTs ...> FixedArgs;
|
||||
fixed_tuple<ArgTs ...> fixedArgT;
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
|
|
@ -365,6 +371,7 @@ struct _EngineFunctionTrampoline< R(ArgTs...) > : public _EngineFunctionTrampoli
|
|||
private:
|
||||
using Super = _EngineFunctionTrampolineBase< R(ArgTs...) >;
|
||||
using ArgsType = typename Super::Args;
|
||||
using FixedArgsType = typename Super::FixedArgs;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
|
|
@ -374,6 +381,11 @@ private:
|
|||
static R dispatchHelper(typename Super::FunctionType fn, const ArgsType& args, Seq<I...>) {
|
||||
return R( fn(std::get<I>(args) ...) );
|
||||
}
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(typename Super::FunctionType fn, const FixedArgsType& args, Seq<I...>) {
|
||||
return R( fn(fixed_tuple_accessor<I>::get(args) ...) );
|
||||
}
|
||||
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
public:
|
||||
|
|
@ -381,6 +393,11 @@ public:
|
|||
{
|
||||
return dispatchHelper(fn, args, SeqType());
|
||||
}
|
||||
|
||||
static R jmp(typename Super::FunctionType fn, const FixedArgsType& args )
|
||||
{
|
||||
return dispatchHelper(fn, args, SeqType());
|
||||
}
|
||||
};
|
||||
|
||||
// Trampolines for engine methods
|
||||
|
|
@ -398,6 +415,7 @@ struct _EngineMethodTrampoline< Frame, R(ArgTs ...) > : public _EngineMethodTram
|
|||
private:
|
||||
using Super = _EngineMethodTrampolineBase< R(ArgTs ...) >;
|
||||
using ArgsType = typename _EngineFunctionTrampolineBase< R(ArgTs ...) >::Args;
|
||||
using FixedArgsType = typename Super::FixedArgs;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
|
|
@ -408,6 +426,11 @@ private:
|
|||
return R( f._exec(std::get<I>(args) ...) );
|
||||
}
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(Frame f, const FixedArgsType& args, Seq<I...>) {
|
||||
return R( f._exec(fixed_tuple_accessor<I>::get(args) ...) );
|
||||
}
|
||||
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
public:
|
||||
static R jmp( typename Frame::ObjectType* object, const ArgsType& args )
|
||||
|
|
@ -417,6 +440,14 @@ public:
|
|||
f.object = object;
|
||||
return dispatchHelper(f, args, SeqType());
|
||||
}
|
||||
|
||||
static R jmp( typename Frame::ObjectType* object, const FixedArgsType& args )
|
||||
{
|
||||
|
||||
Frame f;
|
||||
f.object = object;
|
||||
return dispatchHelper(f, args, SeqType());
|
||||
}
|
||||
};
|
||||
|
||||
/// @}
|
||||
|
|
@ -683,7 +714,7 @@ public:
|
|||
#define DefineEngineFunction( name, returnType, args, defaultArgs, usage ) \
|
||||
static inline returnType _fn ## name ## impl args; \
|
||||
TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## name \
|
||||
( _EngineFunctionTrampoline< returnType args >::Args a ) \
|
||||
( _EngineFunctionTrampoline< returnType args >::FixedArgs a ) \
|
||||
{ \
|
||||
_CHECK_ENGINE_INITIALIZED( name, returnType ); \
|
||||
return EngineTypeTraits< returnType >::ReturnValue( \
|
||||
|
|
@ -702,7 +733,7 @@ public:
|
|||
( void* ) &fn ## name, \
|
||||
0 \
|
||||
); \
|
||||
static _EngineConsoleThunkType< returnType >::ReturnType _ ## name ## caster( SimObject*, S32 argc, ConsoleValueRef *argv ) \
|
||||
static _EngineConsoleThunkType< returnType >::ReturnType _ ## name ## caster( SimObject*, S32 argc, ConsoleValueRef *argv ) \
|
||||
{ \
|
||||
return _EngineConsoleThunkType< returnType >::ReturnType( _EngineConsoleThunk< 1, returnType args >::thunk( \
|
||||
argc, argv, &_fn ## name ## impl, _fn ## name ## DefaultArgs \
|
||||
|
|
@ -737,7 +768,7 @@ public:
|
|||
|
||||
#define _DefineMethodTrampoline( className, name, returnType, args ) \
|
||||
TORQUE_API EngineTypeTraits< returnType >::ReturnValueType \
|
||||
fn ## className ## _ ## name ( className* object, _EngineMethodTrampoline< _ ## className ## name ## frame, returnType args >::Args a ) \
|
||||
fn ## className ## _ ## name ( className* object, _EngineMethodTrampoline< _ ## className ## name ## frame, returnType args >::FixedArgs a )\
|
||||
{ \
|
||||
_CHECK_ENGINE_INITIALIZED( className::name, returnType ); \
|
||||
return EngineTypeTraits< returnType >::ReturnValue( \
|
||||
|
|
@ -820,7 +851,7 @@ public:
|
|||
#define DefineEngineStaticMethod( className, name, returnType, args, defaultArgs, usage ) \
|
||||
static inline returnType _fn ## className ## name ## impl args; \
|
||||
TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## className ## _ ## name \
|
||||
( _EngineFunctionTrampoline< returnType args >::Args a ) \
|
||||
( _EngineFunctionTrampoline< returnType args >::FixedArgs a ) \
|
||||
{ \
|
||||
_CHECK_ENGINE_INITIALIZED( className::name, returnType ); \
|
||||
return EngineTypeTraits< returnType >::ReturnValue( \
|
||||
|
|
@ -855,76 +886,62 @@ public:
|
|||
); \
|
||||
static inline returnType _fn ## className ## name ## impl args
|
||||
|
||||
|
||||
// Convenience macros to allow defining functions that use the new marshalling features
|
||||
// while being only visible in the console interop. When we drop the console system,
|
||||
// these macros can be removed and all definitions that make use of them can be removed
|
||||
// as well.
|
||||
#define DefineConsoleFunction( name, returnType, args, defaultArgs, usage ) \
|
||||
static inline returnType _fn ## name ## impl args; \
|
||||
static _EngineFunctionDefaultArguments< void args > _fn ## name ## DefaultArgs defaultArgs; \
|
||||
static _EngineConsoleThunkType< returnType >::ReturnType _ ## name ## caster( SimObject*, S32 argc, ConsoleValueRef *argv ) \
|
||||
# define DefineEngineStringlyVariadicFunction(name,returnType,minArgs,maxArgs,usage) \
|
||||
static inline returnType _fn ## name ## impl (SimObject *, S32 argc, ConsoleValueRef *argv); \
|
||||
TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## name \
|
||||
(S32 argc, const char** argv) \
|
||||
{ \
|
||||
return _EngineConsoleThunkType< returnType >::ReturnType( _EngineConsoleThunk< 1, returnType args >::thunk( \
|
||||
argc, argv, &_fn ## name ## impl, _fn ## name ## DefaultArgs \
|
||||
) ); \
|
||||
} \
|
||||
static ConsoleFunctionHeader _ ## name ## header \
|
||||
( #returnType, #args, #defaultArgs ); \
|
||||
static ConsoleConstructor \
|
||||
_ ## name ## obj( NULL, #name, _EngineConsoleThunkType< returnType >::CallbackType( _ ## name ## caster ), usage, \
|
||||
_EngineConsoleThunk< 1, returnType args >::NUM_ARGS - _EngineConsoleThunkCountArgs() defaultArgs, \
|
||||
_EngineConsoleThunk< 1, returnType args >::NUM_ARGS, \
|
||||
false, &_ ## name ## header \
|
||||
_CHECK_ENGINE_INITIALIZED( name, returnType ); \
|
||||
StringStackConsoleWrapper args(argc, argv); \
|
||||
return EngineTypeTraits< returnType >::ReturnValue( \
|
||||
_fn ## name ## impl(NULL, args.count(), args) \
|
||||
); \
|
||||
static inline returnType _fn ## name ## impl args
|
||||
} \
|
||||
static _EngineFunctionDefaultArguments< void (S32 argc, const char** argv) > _fn ## name ## DefaultArgs; \
|
||||
static EngineFunctionInfo _fn ## name ## FunctionInfo( \
|
||||
#name, \
|
||||
&_SCOPE<>()(), \
|
||||
usage, \
|
||||
#returnType " " #name "(S32 argc, const char** argv)", \
|
||||
"fn" #name, \
|
||||
TYPE< returnType (S32 argc, const char** argv) >(), \
|
||||
&_fn ## name ## DefaultArgs, \
|
||||
( void* ) &fn ## name, \
|
||||
0 \
|
||||
); \
|
||||
ConsoleConstructor cc_##name##_obj(NULL,#name,_fn ## name ## impl,usage,minArgs,maxArgs); \
|
||||
returnType _fn ## name ## impl(SimObject *, S32 argc, ConsoleValueRef *argv)
|
||||
|
||||
#define DefineConsoleMethod( className, name, returnType, args, defaultArgs, usage ) \
|
||||
struct _ ## className ## name ## frame \
|
||||
{ \
|
||||
typedef className ObjectType; \
|
||||
className* object; \
|
||||
inline returnType _exec args const; \
|
||||
}; \
|
||||
static _EngineFunctionDefaultArguments< _EngineMethodTrampoline< _ ## className ## name ## frame, void args >::FunctionType > \
|
||||
_fn ## className ## name ## DefaultArgs defaultArgs; \
|
||||
static _EngineConsoleThunkType< returnType >::ReturnType _ ## className ## name ## caster( SimObject* object, S32 argc, ConsoleValueRef *argv ) \
|
||||
{ \
|
||||
_ ## className ## name ## frame frame; \
|
||||
frame.object = static_cast< className* >( object ); \
|
||||
return _EngineConsoleThunkType< returnType >::ReturnType( _EngineConsoleThunk< 2, returnType args >::thunk( \
|
||||
argc, argv, &_ ## className ## name ## frame::_exec, &frame, _fn ## className ## name ## DefaultArgs \
|
||||
) ); \
|
||||
} \
|
||||
static ConsoleFunctionHeader _ ## className ## name ## header \
|
||||
( #returnType, #args, #defaultArgs ); \
|
||||
static ConsoleConstructor \
|
||||
className ## name ## obj( #className, #name, \
|
||||
_EngineConsoleThunkType< returnType >::CallbackType( _ ## className ## name ## caster ), usage, \
|
||||
_EngineConsoleThunk< 2, returnType args >::NUM_ARGS - _EngineConsoleThunkCountArgs() defaultArgs, \
|
||||
_EngineConsoleThunk< 2, returnType args >::NUM_ARGS, \
|
||||
false, &_ ## className ## name ## header \
|
||||
); \
|
||||
returnType _ ## className ## name ## frame::_exec args const
|
||||
# define DefineEngineStringlyVariadicMethod(className, name,returnType,minArgs,maxArgs,usage) \
|
||||
static inline returnType _fn ## className ## _ ## name ## impl (className* object, S32 argc, ConsoleValueRef* argv); \
|
||||
TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## className ## _ ## name \
|
||||
(className* object, S32 argc, const char** argv) \
|
||||
{ \
|
||||
_CHECK_ENGINE_INITIALIZED( name, returnType ); \
|
||||
StringStackConsoleWrapper args(argc, argv); \
|
||||
return EngineTypeTraits< returnType >::ReturnValue( \
|
||||
_fn ## className ## _ ## name ## impl(object, args.count(), args) \
|
||||
); \
|
||||
} \
|
||||
static _EngineFunctionDefaultArguments< void (className* object, S32 argc, const char** argv) > _fn ## className ## _ ## name ## DefaultArgs; \
|
||||
static EngineFunctionInfo _fn ## className ## _ ## name ## FunctionInfo( \
|
||||
#name, \
|
||||
&_SCOPE<>()(), \
|
||||
usage, \
|
||||
#returnType " " #name "(SimObject* object, S32 argc, const char** argv)", \
|
||||
"fn" #className "_" #name, \
|
||||
TYPE< returnType (SimObject* object, S32 argc, const char** argv) >(), \
|
||||
&_fn ## className ## _ ## name ## DefaultArgs, \
|
||||
( void* ) &fn ## className ## _ ## name, \
|
||||
0 \
|
||||
); \
|
||||
returnType cm_##className##_##name##_caster(SimObject* object, S32 argc, ConsoleValueRef* argv) { \
|
||||
AssertFatal( dynamic_cast<className*>( object ), "Object passed to " #name " is not a " #className "!" ); \
|
||||
conmethod_return_##returnType ) _fn ## className ## _ ## name ## impl(static_cast<className*>(object),argc,argv); \
|
||||
}; \
|
||||
ConsoleConstructor cc_##className##_##name##_obj(#className,#name,cm_##className##_##name##_caster,usage,minArgs,maxArgs); \
|
||||
static inline returnType _fn ## className ## _ ## name ## impl(className *object, S32 argc, ConsoleValueRef *argv)
|
||||
|
||||
#define DefineConsoleStaticMethod( className, name, returnType, args, defaultArgs, usage ) \
|
||||
static inline returnType _fn ## className ## name ## impl args; \
|
||||
static _EngineFunctionDefaultArguments< void args > _fn ## className ## name ## DefaultArgs defaultArgs; \
|
||||
static _EngineConsoleThunkType< returnType >::ReturnType _ ## className ## name ## caster( SimObject*, S32 argc, ConsoleValueRef *argv )\
|
||||
{ \
|
||||
return _EngineConsoleThunkType< returnType >::ReturnType( _EngineConsoleThunk< 1, returnType args >::thunk( \
|
||||
argc, argv, &_fn ## className ## name ## impl, _fn ## className ## name ## DefaultArgs \
|
||||
) ); \
|
||||
} \
|
||||
static ConsoleFunctionHeader _ ## className ## name ## header \
|
||||
( #returnType, #args, #defaultArgs, true ); \
|
||||
static ConsoleConstructor \
|
||||
_ ## className ## name ## obj( #className, #name, _EngineConsoleThunkType< returnType >::CallbackType( _ ## className ## name ## caster ), usage, \
|
||||
_EngineConsoleThunk< 1, returnType args >::NUM_ARGS - _EngineConsoleThunkCountArgs() defaultArgs, \
|
||||
_EngineConsoleThunk< 1, returnType args >::NUM_ARGS, \
|
||||
false, &_ ## className ## name ## header \
|
||||
); \
|
||||
static inline returnType _fn ## className ## name ## impl args
|
||||
|
||||
|
||||
// The following three macros are only temporary. They allow to define engineAPI functions using the framework
|
||||
|
|
@ -934,7 +951,7 @@ public:
|
|||
#define DefineNewEngineFunction( name, returnType, args, defaultArgs, usage ) \
|
||||
static inline returnType _fn ## name ## impl args; \
|
||||
TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## name \
|
||||
( _EngineFunctionTrampoline< returnType args >::Args a ) \
|
||||
( _EngineFunctionTrampoline< returnType args >::FixedArgs a ) \
|
||||
{ \
|
||||
_CHECK_ENGINE_INITIALIZED( name, returnType ); \
|
||||
return EngineTypeTraits< returnType >::ReturnValue( \
|
||||
|
|
@ -981,7 +998,7 @@ public:
|
|||
#define DefineNewEngineStaticMethod( className, name, returnType, args, defaultArgs, usage ) \
|
||||
static inline returnType _fn ## className ## name ## impl args; \
|
||||
TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## className ## _ ## name \
|
||||
( _EngineFunctionTrampoline< returnType args >::Args a ) \
|
||||
( _EngineFunctionTrampoline< returnType args >::FixedArgs a ) \
|
||||
{ \
|
||||
_CHECK_ENGINE_INITIALIZED( className::name, returnType ); \
|
||||
return EngineTypeTraits< returnType >::ReturnValue( \
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@
|
|||
|
||||
#include <tuple>
|
||||
|
||||
#ifndef _FIXEDTUPLE_H_
|
||||
#include "fixedTuple.h"
|
||||
#endif
|
||||
|
||||
#ifndef _ENGINEEXPORTS_H_
|
||||
#include "console/engineExports.h"
|
||||
#endif
|
||||
|
|
@ -94,6 +98,7 @@ template<typename ...ArgTs>
|
|||
struct _EngineFunctionDefaultArguments< void(ArgTs...) > : public EngineFunctionDefaultArguments
|
||||
{
|
||||
template<typename T> using DefVST = typename EngineTypeTraits<T>::DefaultArgumentValueStoreType;
|
||||
fixed_tuple<DefVST<ArgTs> ...> mFixedArgs;
|
||||
std::tuple<DefVST<ArgTs> ...> mArgs;
|
||||
private:
|
||||
using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >;
|
||||
|
|
@ -130,7 +135,9 @@ private:
|
|||
public:
|
||||
template<typename ...TailTs> _EngineFunctionDefaultArguments(TailTs ...tail)
|
||||
: EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(SelfType::tailInit(tail...))
|
||||
{}
|
||||
{
|
||||
fixed_tuple_mutator<void(DefVST<ArgTs>...), void(DefVST<ArgTs>...)>::copy(mArgs, mFixedArgs);
|
||||
}
|
||||
};
|
||||
|
||||
#pragma pack( pop )
|
||||
|
|
|
|||
|
|
@ -231,6 +231,9 @@ class EnginePropertyTable
|
|||
|
||||
/// Combination of EnginePropertyFlags.
|
||||
U32 mFlags;
|
||||
|
||||
/// Type-id of the property
|
||||
U32 mType;
|
||||
|
||||
/// Return the name of the property.
|
||||
const char* getName() const { return mName; }
|
||||
|
|
@ -255,6 +258,9 @@ class EnginePropertyTable
|
|||
|
||||
///
|
||||
bool hideInInspectors() const { return ( mFlags & EnginePropertyHideInInspectors ); }
|
||||
|
||||
/// Return the type-id of the property.
|
||||
U32 getType() const { return mType; }
|
||||
};
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -236,16 +236,16 @@ template< typename T >
|
|||
struct _EngineStructTypeTraits
|
||||
{
|
||||
typedef T Type;
|
||||
typedef const T& ValueType;
|
||||
typedef const T ValueType;
|
||||
typedef void SuperType;
|
||||
|
||||
// Structs get passed in as pointers and passed out as full copies.
|
||||
typedef T* ArgumentValueType;
|
||||
typedef T ArgumentValueType;
|
||||
typedef T ReturnValueType;
|
||||
typedef T DefaultArgumentValueStoreType;
|
||||
|
||||
typedef ReturnValueType ReturnValue;
|
||||
static ValueType ArgumentToValue( ArgumentValueType val ) { return *val; }
|
||||
static ValueType ArgumentToValue( ArgumentValueType val ) { return val; }
|
||||
|
||||
static const EngineTypeInfo* const TYPEINFO;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -35,32 +35,32 @@
|
|||
/// actually having to access them directly in the DLL as native entities.
|
||||
|
||||
|
||||
static void exportScope( const EngineExportScope* scope, SimXMLDocument* xml, bool addNode = false );
|
||||
static void exportScope(const EngineExportScope* scope, SimXMLDocument* xml, bool addNode = false);
|
||||
|
||||
|
||||
static String getTypeName( const EngineTypeInfo* type )
|
||||
static String getTypeName(const EngineTypeInfo* type)
|
||||
{
|
||||
if( !type )
|
||||
if (!type)
|
||||
{
|
||||
static String sVoid( "void" );
|
||||
static String sVoid("void");
|
||||
return sVoid;
|
||||
}
|
||||
|
||||
|
||||
return type->getFullyQualifiedExportName();
|
||||
}
|
||||
|
||||
static const char* getDocString( const EngineExport* exportInfo )
|
||||
static const char* getDocString(const EngineExport* exportInfo)
|
||||
{
|
||||
if( !exportInfo->getDocString() )
|
||||
if (!exportInfo->getDocString())
|
||||
return "";
|
||||
|
||||
|
||||
return exportInfo->getDocString();
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline T getArgValue( const EngineFunctionDefaultArguments* defaultArgs, U32 offset )
|
||||
inline T getArgValue(const EngineFunctionDefaultArguments* defaultArgs, U32 offset)
|
||||
{
|
||||
return *reinterpret_cast< const T* >( defaultArgs->getArgs() + offset );
|
||||
return *reinterpret_cast< const T* >(defaultArgs->getArgs() + offset);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -71,14 +71,14 @@ static const char* sExportFilterList[] =
|
|||
"Console", // Console namespace
|
||||
};
|
||||
|
||||
static bool isExportFiltered( const EngineExport* exportInfo )
|
||||
static bool isExportFiltered(const EngineExport* exportInfo)
|
||||
{
|
||||
String qualifiedName = exportInfo->getFullyQualifiedExportName();
|
||||
|
||||
for( U32 i = 0; i < ( sizeof( sExportFilterList ) / sizeof( sExportFilterList[ 0 ] ) ); ++ i )
|
||||
if( qualifiedName.compare( sExportFilterList[ i ] ) == 0 )
|
||||
|
||||
for (U32 i = 0; i < (sizeof(sExportFilterList) / sizeof(sExportFilterList[0])); ++i)
|
||||
if (qualifiedName.compare(sExportFilterList[i]) == 0)
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -90,248 +90,248 @@ static bool isExportFiltered( const EngineExport* exportInfo )
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
/// Helper to parse argument names out of a prototype string.
|
||||
static Vector< String > parseFunctionArgumentNames( const EngineFunctionInfo* function )
|
||||
static Vector< String > parseFunctionArgumentNames(const EngineFunctionInfo* function)
|
||||
{
|
||||
Vector< String > argNames;
|
||||
|
||||
|
||||
const char* prototype = function->getPrototypeString();
|
||||
if( !prototype )
|
||||
if (!prototype)
|
||||
return argNames;
|
||||
|
||||
const U32 prototypeLength = dStrlen( prototype );
|
||||
const char* prototypeEnd = &prototype[ prototypeLength ];
|
||||
|
||||
const U32 prototypeLength = dStrlen(prototype);
|
||||
const char* prototypeEnd = &prototype[prototypeLength];
|
||||
const char* ptr = prototypeEnd - 1;
|
||||
|
||||
|
||||
// Search for right parenthesis.
|
||||
while( ptr >= prototype && *ptr != ')' )
|
||||
ptr --;
|
||||
|
||||
if( ptr < prototype )
|
||||
while (ptr >= prototype && *ptr != ')')
|
||||
ptr--;
|
||||
|
||||
if (ptr < prototype)
|
||||
return argNames;
|
||||
ptr --;
|
||||
|
||||
while( ptr >= prototype && *ptr != '(' )
|
||||
ptr--;
|
||||
|
||||
while (ptr >= prototype && *ptr != '(')
|
||||
{
|
||||
// Skip back over spaces.
|
||||
|
||||
while( ptr >= prototype && dIsspace( *ptr ) )
|
||||
ptr --;
|
||||
if( ptr < prototype )
|
||||
|
||||
while (ptr >= prototype && dIsspace(*ptr))
|
||||
ptr--;
|
||||
if (ptr < prototype)
|
||||
return argNames;
|
||||
|
||||
|
||||
// Parse out name.
|
||||
|
||||
|
||||
const char* end = ptr + 1;
|
||||
while( ptr > prototype && dIsalnum( *ptr ) )
|
||||
ptr --;
|
||||
while (ptr > prototype && dIsalnum(*ptr))
|
||||
ptr--;
|
||||
const char* start = ptr + 1;
|
||||
|
||||
|
||||
// Skip back over spaces.
|
||||
|
||||
while( ptr >= prototype && dIsspace( *ptr ) )
|
||||
ptr --;
|
||||
|
||||
while (ptr >= prototype && dIsspace(*ptr))
|
||||
ptr--;
|
||||
|
||||
// If we're sure we don't have just a type name without an
|
||||
// argument name, copy out the argument name name.
|
||||
|
||||
if( ptr >= prototype && *ptr != ',' && *ptr != '(' && end > start )
|
||||
argNames.push_front( String( start, end - start ) );
|
||||
if (ptr >= prototype && *ptr != ',' && *ptr != '(' && end > start)
|
||||
argNames.push_front(String(start, end - start));
|
||||
else
|
||||
argNames.push_front( "" );
|
||||
|
||||
argNames.push_front("");
|
||||
|
||||
// Skip back to comma or opening parenthesis.
|
||||
|
||||
|
||||
U32 parenNestingCount = 0;
|
||||
while( ptr >= prototype )
|
||||
while (ptr >= prototype)
|
||||
{
|
||||
if( *ptr == ')' )
|
||||
parenNestingCount ++;
|
||||
else if( *ptr == '(' )
|
||||
parenNestingCount --;
|
||||
else if( *ptr == ',' && parenNestingCount == 0 )
|
||||
if (*ptr == ')')
|
||||
parenNestingCount++;
|
||||
else if (*ptr == '(')
|
||||
parenNestingCount--;
|
||||
else if (*ptr == ',' && parenNestingCount == 0)
|
||||
{
|
||||
ptr --;
|
||||
ptr--;
|
||||
break;
|
||||
}
|
||||
else if( *ptr == '(' && parenNestingCount == 0 )
|
||||
else if (*ptr == '(' && parenNestingCount == 0)
|
||||
break;
|
||||
|
||||
ptr --;
|
||||
|
||||
ptr--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add 'this' parameter if this is a method.
|
||||
|
||||
if( dStrncmp( prototype, "virtual ", sizeof( "virtual " ) - 1 ) == 0 )
|
||||
argNames.push_front( "this" );
|
||||
|
||||
if (dStrncmp(prototype, "virtual ", sizeof("virtual ") - 1) == 0)
|
||||
argNames.push_front("this");
|
||||
|
||||
return argNames;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static String getDefaultArgumentValue( const EngineFunctionInfo* function, const EngineTypeInfo* type, U32 offset )
|
||||
static String getDefaultArgumentValue(const EngineFunctionInfo* function, const EngineTypeInfo* type, U32 offset)
|
||||
{
|
||||
String value;
|
||||
const EngineFunctionDefaultArguments* defaultArgs = function->getDefaultArguments();
|
||||
|
||||
switch( type->getTypeKind() )
|
||||
|
||||
switch (type->getTypeKind())
|
||||
{
|
||||
case EngineTypeKindPrimitive:
|
||||
{
|
||||
#define PRIMTYPE( tp ) \
|
||||
case EngineTypeKindPrimitive:
|
||||
{
|
||||
#define PRIMTYPE( tp ) \
|
||||
if( TYPE< tp >() == type ) \
|
||||
{ \
|
||||
tp val = getArgValue< tp >( defaultArgs, offset ); \
|
||||
value = String::ToString( val ); \
|
||||
}
|
||||
|
||||
PRIMTYPE( bool );
|
||||
PRIMTYPE( S8 );
|
||||
PRIMTYPE( U8 );
|
||||
PRIMTYPE( S32 );
|
||||
PRIMTYPE( U32 );
|
||||
PRIMTYPE( F32 );
|
||||
PRIMTYPE( F64 );
|
||||
|
||||
//TODO: for now we store string literals in ASCII; needs to be sorted out
|
||||
if( TYPE< const char* >() == type )
|
||||
{
|
||||
const char* val = getArgValue< const char* >( defaultArgs, offset );
|
||||
value = val;
|
||||
}
|
||||
|
||||
#undef PRIMTYPE
|
||||
break;
|
||||
}
|
||||
|
||||
case EngineTypeKindEnum:
|
||||
|
||||
PRIMTYPE(bool);
|
||||
PRIMTYPE(S8);
|
||||
PRIMTYPE(U8);
|
||||
PRIMTYPE(S32);
|
||||
PRIMTYPE(U32);
|
||||
PRIMTYPE(F32);
|
||||
PRIMTYPE(F64);
|
||||
|
||||
//TODO: for now we store string literals in ASCII; needs to be sorted out
|
||||
if (TYPE< const char* >() == type)
|
||||
{
|
||||
S32 val = getArgValue< S32 >( defaultArgs, offset );
|
||||
AssertFatal( type->getEnumTable(), "engineXMLExport - Enum type without table!" );
|
||||
|
||||
const EngineEnumTable& table = *( type->getEnumTable() );
|
||||
const U32 numValues = table.getNumValues();
|
||||
|
||||
for( U32 i = 0; i < numValues; ++ i )
|
||||
if( table[ i ].getInt() == val )
|
||||
{
|
||||
value = table[ i ].getName();
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
const char* val = reinterpret_cast<const char*>(defaultArgs->getArgs() + offset);
|
||||
value = val;
|
||||
}
|
||||
|
||||
case EngineTypeKindBitfield:
|
||||
{
|
||||
S32 val = getArgValue< S32 >( defaultArgs, offset );
|
||||
AssertFatal( type->getEnumTable(), "engineXMLExport - Bitfield type without table!" );
|
||||
|
||||
const EngineEnumTable& table = *( type->getEnumTable() );
|
||||
const U32 numValues = table.getNumValues();
|
||||
|
||||
bool isFirst = true;
|
||||
for( U32 i = 0; i < numValues; ++ i )
|
||||
if( table[ i ].getInt() & val )
|
||||
{
|
||||
if( !isFirst )
|
||||
value += '|';
|
||||
|
||||
value = table[ i ].getName();
|
||||
isFirst = false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case EngineTypeKindStruct:
|
||||
{
|
||||
//TODO: struct type default argument values
|
||||
break;
|
||||
}
|
||||
|
||||
case EngineTypeKindClass:
|
||||
case EngineTypeKindFunction:
|
||||
{
|
||||
// For these two kinds, we support "null" as the only valid
|
||||
// default value.
|
||||
|
||||
const void* ptr = getArgValue< const void* >( defaultArgs, offset );
|
||||
if( !ptr )
|
||||
value = "null";
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
#undef PRIMTYPE
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case EngineTypeKindEnum:
|
||||
{
|
||||
S32 val = getArgValue< S32 >(defaultArgs, offset);
|
||||
AssertFatal(type->getEnumTable(), "engineXMLExport - Enum type without table!");
|
||||
|
||||
const EngineEnumTable& table = *(type->getEnumTable());
|
||||
const U32 numValues = table.getNumValues();
|
||||
|
||||
for (U32 i = 0; i < numValues; ++i)
|
||||
if (table[i].getInt() == val)
|
||||
{
|
||||
value = table[i].getName();
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case EngineTypeKindBitfield:
|
||||
{
|
||||
S32 val = getArgValue< S32 >(defaultArgs, offset);
|
||||
AssertFatal(type->getEnumTable(), "engineXMLExport - Bitfield type without table!");
|
||||
|
||||
const EngineEnumTable& table = *(type->getEnumTable());
|
||||
const U32 numValues = table.getNumValues();
|
||||
|
||||
bool isFirst = true;
|
||||
for (U32 i = 0; i < numValues; ++i)
|
||||
if (table[i].getInt() & val)
|
||||
{
|
||||
if (!isFirst)
|
||||
value += '|';
|
||||
|
||||
value = table[i].getName();
|
||||
isFirst = false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case EngineTypeKindStruct:
|
||||
{
|
||||
//TODO: struct type default argument values
|
||||
break;
|
||||
}
|
||||
|
||||
case EngineTypeKindClass:
|
||||
case EngineTypeKindFunction:
|
||||
{
|
||||
// For these two kinds, we support "null" as the only valid
|
||||
// default value.
|
||||
|
||||
const void* ptr = getArgValue< const void* >(defaultArgs, offset);
|
||||
if (!ptr)
|
||||
value = "null";
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void exportFunction( const EngineFunctionInfo* function, SimXMLDocument* xml )
|
||||
static void exportFunction(const EngineFunctionInfo* function, SimXMLDocument* xml)
|
||||
{
|
||||
if( isExportFiltered( function ) )
|
||||
if (isExportFiltered(function))
|
||||
return;
|
||||
|
||||
xml->pushNewElement( "EngineFunction" );
|
||||
|
||||
xml->setAttribute( "name", function->getExportName() );
|
||||
xml->setAttribute( "returnType", getTypeName( function->getReturnType() ) );
|
||||
xml->setAttribute( "symbol", function->getBindingName() );
|
||||
xml->setAttribute( "isCallback", function->isCallout() ? "1" : "0" );
|
||||
xml->setAttribute( "isVariadic", function->getFunctionType()->isVariadic() ? "1" : "0" );
|
||||
xml->setAttribute( "docs", getDocString( function ) );
|
||||
|
||||
xml->pushNewElement( "arguments" );
|
||||
|
||||
const U32 numArguments = function->getNumArguments();
|
||||
const U32 numDefaultArguments = ( function->getDefaultArguments() ? function->getDefaultArguments()->mNumDefaultArgs : 0 );
|
||||
const U32 firstDefaultArg = numArguments - numDefaultArguments;
|
||||
|
||||
Vector< String > argumentNames = parseFunctionArgumentNames( function );
|
||||
const U32 numArgumentNames = argumentNames.size();
|
||||
|
||||
// Accumulated offset in function argument frame vector.
|
||||
U32 argFrameOffset = 0;
|
||||
|
||||
for( U32 i = 0; i < numArguments; ++ i )
|
||||
{
|
||||
xml->pushNewElement( "EngineFunctionArgument" );
|
||||
const EngineTypeInfo* type = function->getArgumentType( i );
|
||||
AssertFatal( type != NULL, "exportFunction - Argument cannot have type void!" );
|
||||
|
||||
String argName;
|
||||
if( i < numArgumentNames )
|
||||
argName = argumentNames[ i ];
|
||||
|
||||
xml->setAttribute( "name", argName );
|
||||
xml->setAttribute( "type", getTypeName( type ) );
|
||||
|
||||
if( i >= firstDefaultArg )
|
||||
{
|
||||
String defaultValue = getDefaultArgumentValue( function, type, argFrameOffset );
|
||||
xml->setAttribute( "defaultValue", defaultValue );
|
||||
}
|
||||
|
||||
xml->popElement();
|
||||
|
||||
if( type->getTypeKind() == EngineTypeKindStruct )
|
||||
argFrameOffset += type->getInstanceSize();
|
||||
else
|
||||
argFrameOffset += type->getValueSize();
|
||||
|
||||
#ifdef _PACK_BUG_WORKAROUNDS
|
||||
if( argFrameOffset % 4 > 0 )
|
||||
argFrameOffset += 4 - ( argFrameOffset % 4 );
|
||||
#endif
|
||||
}
|
||||
|
||||
xml->pushNewElement("EngineFunction");
|
||||
|
||||
xml->setAttribute("name", function->getExportName());
|
||||
xml->setAttribute("returnType", getTypeName(function->getReturnType()));
|
||||
xml->setAttribute("symbol", function->getBindingName());
|
||||
xml->setAttribute("isCallback", function->isCallout() ? "1" : "0");
|
||||
xml->setAttribute("isVariadic", function->getFunctionType()->isVariadic() ? "1" : "0");
|
||||
xml->setAttribute("docs", getDocString(function));
|
||||
|
||||
xml->pushNewElement("arguments");
|
||||
|
||||
const U32 numArguments = function->getNumArguments();
|
||||
const U32 numDefaultArguments = (function->getDefaultArguments() ? function->getDefaultArguments()->mNumDefaultArgs : 0);
|
||||
const U32 firstDefaultArg = numArguments - numDefaultArguments;
|
||||
|
||||
Vector< String > argumentNames = parseFunctionArgumentNames(function);
|
||||
const U32 numArgumentNames = argumentNames.size();
|
||||
|
||||
// Accumulated offset in function argument frame vector.
|
||||
U32 argFrameOffset = 0;
|
||||
|
||||
for (U32 i = 0; i < numArguments; ++i)
|
||||
{
|
||||
xml->pushNewElement("EngineFunctionArgument");
|
||||
const EngineTypeInfo* type = function->getArgumentType(i);
|
||||
AssertFatal(type != NULL, "exportFunction - Argument cannot have type void!");
|
||||
|
||||
String argName;
|
||||
if (i < numArgumentNames)
|
||||
argName = argumentNames[i];
|
||||
|
||||
xml->setAttribute("name", argName);
|
||||
xml->setAttribute("type", getTypeName(type));
|
||||
|
||||
if (i >= firstDefaultArg)
|
||||
{
|
||||
String defaultValue = getDefaultArgumentValue(function, type, argFrameOffset);
|
||||
xml->setAttribute("defaultValue", defaultValue);
|
||||
}
|
||||
|
||||
xml->popElement();
|
||||
|
||||
|
||||
if (type->getTypeKind() == EngineTypeKindStruct)
|
||||
argFrameOffset += type->getInstanceSize();
|
||||
else
|
||||
argFrameOffset += type->getValueSize();
|
||||
|
||||
#ifdef _PACK_BUG_WORKAROUNDS
|
||||
if (argFrameOffset % 4 > 0)
|
||||
argFrameOffset += 4 - (argFrameOffset % 4);
|
||||
#endif
|
||||
}
|
||||
|
||||
xml->popElement();
|
||||
|
||||
xml->popElement();
|
||||
}
|
||||
|
||||
|
|
@ -343,148 +343,172 @@ static void exportFunction( const EngineFunctionInfo* function, SimXMLDocument*
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void exportType( const EngineTypeInfo* type, SimXMLDocument* xml )
|
||||
static void exportType(const EngineTypeInfo* type, SimXMLDocument* xml)
|
||||
{
|
||||
// Don't export anonymous types.
|
||||
if( !type->getTypeName()[ 0 ] )
|
||||
if (!type->getTypeName()[0])
|
||||
return;
|
||||
|
||||
if( isExportFiltered( type ) )
|
||||
return;
|
||||
|
||||
const char* nodeName = NULL;
|
||||
switch( type->getTypeKind() )
|
||||
{
|
||||
case EngineTypeKindPrimitive:
|
||||
nodeName = "EnginePrimitiveType";
|
||||
break;
|
||||
|
||||
case EngineTypeKindEnum:
|
||||
nodeName = "EngineEnumType";
|
||||
break;
|
||||
|
||||
case EngineTypeKindBitfield:
|
||||
nodeName = "EngineBitfieldType";
|
||||
break;
|
||||
|
||||
case EngineTypeKindStruct:
|
||||
nodeName = "EngineStructType";
|
||||
break;
|
||||
|
||||
case EngineTypeKindClass:
|
||||
nodeName = "EngineClassType";
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
xml->pushNewElement( nodeName );
|
||||
|
||||
xml->setAttribute( "name", type->getTypeName() );
|
||||
xml->setAttribute( "size", String::ToString( type->getInstanceSize() ) );
|
||||
xml->setAttribute( "isAbstract", type->isAbstract() ? "1" : "0" );
|
||||
xml->setAttribute( "isInstantiable", type->isInstantiable() ? "1" : "0" );
|
||||
xml->setAttribute( "isDisposable", type->isDisposable() ? "1" : "0" );
|
||||
xml->setAttribute( "isSingleton", type->isSingleton() ? "1" : "0" );
|
||||
xml->setAttribute( "docs", getDocString( type ) );
|
||||
|
||||
if( type->getSuperType() )
|
||||
xml->setAttribute( "superType", getTypeName( type->getSuperType() ) );
|
||||
|
||||
if( type->getEnumTable() )
|
||||
if (isExportFiltered(type))
|
||||
return;
|
||||
|
||||
const char* nodeName = NULL;
|
||||
switch (type->getTypeKind())
|
||||
{
|
||||
case EngineTypeKindPrimitive:
|
||||
nodeName = "EnginePrimitiveType";
|
||||
break;
|
||||
|
||||
case EngineTypeKindEnum:
|
||||
nodeName = "EngineEnumType";
|
||||
break;
|
||||
|
||||
case EngineTypeKindBitfield:
|
||||
nodeName = "EngineBitfieldType";
|
||||
break;
|
||||
|
||||
case EngineTypeKindStruct:
|
||||
nodeName = "EngineStructType";
|
||||
break;
|
||||
|
||||
case EngineTypeKindClass:
|
||||
nodeName = "EngineClassType";
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
xml->pushNewElement(nodeName);
|
||||
|
||||
xml->setAttribute("name", type->getTypeName());
|
||||
xml->setAttribute("size", String::ToString(type->getInstanceSize()));
|
||||
xml->setAttribute("isAbstract", type->isAbstract() ? "1" : "0");
|
||||
xml->setAttribute("isInstantiable", type->isInstantiable() ? "1" : "0");
|
||||
xml->setAttribute("isDisposable", type->isDisposable() ? "1" : "0");
|
||||
xml->setAttribute("isSingleton", type->isSingleton() ? "1" : "0");
|
||||
xml->setAttribute("docs", getDocString(type));
|
||||
|
||||
if (type->getSuperType())
|
||||
xml->setAttribute("superType", getTypeName(type->getSuperType()));
|
||||
|
||||
if (type->getEnumTable())
|
||||
{
|
||||
xml->pushNewElement("enums");
|
||||
|
||||
const EngineEnumTable& table = *(type->getEnumTable());
|
||||
const U32 numValues = table.getNumValues();
|
||||
|
||||
for (U32 i = 0; i < numValues; ++i)
|
||||
{
|
||||
xml->pushNewElement( "enums" );
|
||||
|
||||
const EngineEnumTable& table = *( type->getEnumTable() );
|
||||
const U32 numValues = table.getNumValues();
|
||||
|
||||
for( U32 i = 0; i < numValues; ++ i )
|
||||
{
|
||||
xml->pushNewElement( "EngineEnum" );
|
||||
|
||||
xml->setAttribute( "name", table[ i ].getName() );
|
||||
xml->setAttribute( "value", String::ToString( table[ i ].getInt() ) );
|
||||
xml->setAttribute( "docs", table[ i ].getDocString() ? table[ i ].getDocString() : "" );
|
||||
|
||||
xml->popElement();
|
||||
}
|
||||
|
||||
xml->pushNewElement("EngineEnum");
|
||||
|
||||
xml->setAttribute("name", table[i].getName());
|
||||
xml->setAttribute("value", String::ToString(table[i].getInt()));
|
||||
xml->setAttribute("docs", table[i].getDocString() ? table[i].getDocString() : "");
|
||||
|
||||
xml->popElement();
|
||||
}
|
||||
else if( type->getFieldTable() )
|
||||
|
||||
xml->popElement();
|
||||
}
|
||||
else if (type->getFieldTable())
|
||||
{
|
||||
xml->pushNewElement("fields");
|
||||
|
||||
const EngineFieldTable& table = *(type->getFieldTable());
|
||||
const U32 numFields = table.getNumFields();
|
||||
|
||||
for (U32 i = 0; i < numFields; ++i)
|
||||
{
|
||||
xml->pushNewElement( "fields" );
|
||||
|
||||
const EngineFieldTable& table = *( type->getFieldTable() );
|
||||
const U32 numFields = table.getNumFields();
|
||||
|
||||
for( U32 i = 0; i < numFields; ++ i )
|
||||
{
|
||||
const EngineFieldTable::Field& field = table[ i ];
|
||||
|
||||
xml->pushNewElement( "EngineField" );
|
||||
|
||||
xml->setAttribute( "name", field.getName() );
|
||||
xml->setAttribute( "type", getTypeName( field.getType() ) );
|
||||
xml->setAttribute( "offset", String::ToString( field.getOffset() ) );
|
||||
xml->setAttribute( "indexedSize", String::ToString( field.getNumElements() ) );
|
||||
xml->setAttribute( "docs", field.getDocString() ? field.getDocString() : "" );
|
||||
|
||||
xml->popElement();
|
||||
}
|
||||
|
||||
const EngineFieldTable::Field& field = table[i];
|
||||
|
||||
xml->pushNewElement("EngineField");
|
||||
|
||||
xml->setAttribute("name", field.getName());
|
||||
xml->setAttribute("type", getTypeName(field.getType()));
|
||||
xml->setAttribute("offset", String::ToString(field.getOffset()));
|
||||
xml->setAttribute("indexedSize", String::ToString(field.getNumElements()));
|
||||
xml->setAttribute("docs", field.getDocString() ? field.getDocString() : "");
|
||||
|
||||
xml->popElement();
|
||||
}
|
||||
else if( type->getPropertyTable() )
|
||||
|
||||
xml->popElement();
|
||||
}
|
||||
else if (type->getPropertyTable())
|
||||
{
|
||||
xml->pushNewElement("properties");
|
||||
|
||||
const EnginePropertyTable& table = *(type->getPropertyTable());
|
||||
const U32 numProperties = table.getNumProperties();
|
||||
U32 groupNestingDepth = 0;
|
||||
|
||||
for (U32 i = 0; i < numProperties; ++i)
|
||||
{
|
||||
xml->pushNewElement( "properties" );
|
||||
|
||||
const EnginePropertyTable& table = *( type->getPropertyTable() );
|
||||
const U32 numProperties = table.getNumProperties();
|
||||
U32 groupNestingDepth = 0;
|
||||
|
||||
for( U32 i = 0; i < numProperties; ++ i )
|
||||
const EnginePropertyTable::Property& property = table[i];
|
||||
|
||||
if (property.isGroupBegin())
|
||||
{
|
||||
groupNestingDepth++;
|
||||
xml->pushNewElement("EnginePropertyGroup");
|
||||
|
||||
xml->setAttribute("name", property.getName());
|
||||
xml->setAttribute("indexedSize", String::ToString(property.getNumElements()));
|
||||
xml->setAttribute("docs", property.getDocString() ? property.getDocString() : "");
|
||||
|
||||
xml->pushNewElement("properties");
|
||||
}
|
||||
else if (property.isGroupEnd())
|
||||
{
|
||||
groupNestingDepth--;
|
||||
xml->popElement();
|
||||
xml->popElement();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (property.getType() == AbstractClassRep::StartArrayFieldType
|
||||
|| property.getType() == AbstractClassRep::EndArrayFieldType) {
|
||||
continue;
|
||||
}
|
||||
xml->pushNewElement("EngineProperty");
|
||||
|
||||
xml->setAttribute("name", property.getName());
|
||||
xml->setAttribute("indexedSize", String::ToString(property.getNumElements()));
|
||||
xml->setAttribute("isConstant", property.isConstant() ? "1" : "0");
|
||||
xml->setAttribute("isTransient", property.isTransient() ? "1" : "0");
|
||||
xml->setAttribute("isVisible", property.hideInInspectors() ? "0" : "1");
|
||||
xml->setAttribute("docs", property.getDocString() ? property.getDocString() : "");
|
||||
|
||||
|
||||
const bool isDeprecated = (property.getType() == AbstractClassRep::DeprecatedFieldType);
|
||||
|
||||
if (isDeprecated)
|
||||
{
|
||||
const EnginePropertyTable::Property& property = table[ i ];
|
||||
|
||||
if( property.isGroupBegin() )
|
||||
xml->setAttribute("type", "deprecated");
|
||||
}
|
||||
else
|
||||
{
|
||||
ConsoleBaseType *cbt = ConsoleBaseType::getType(property.getType());
|
||||
if (cbt != NULL)
|
||||
{
|
||||
groupNestingDepth ++;
|
||||
xml->pushNewElement( "EnginePropertyGroup" );
|
||||
|
||||
xml->setAttribute( "name", property.getName() );
|
||||
xml->setAttribute( "indexedSize", String::ToString( property.getNumElements() ) );
|
||||
xml->setAttribute( "docs", property.getDocString() ? property.getDocString() : "" );
|
||||
|
||||
xml->pushNewElement( "properties" );
|
||||
}
|
||||
else if( property.isGroupEnd() )
|
||||
{
|
||||
groupNestingDepth --;
|
||||
xml->popElement();
|
||||
xml->popElement();
|
||||
xml->setAttribute("type", cbt->getTypeClassName());
|
||||
}
|
||||
else
|
||||
{
|
||||
xml->pushNewElement( "EngineProperty" );
|
||||
|
||||
xml->setAttribute( "name", property.getName() );
|
||||
xml->setAttribute( "indexedSize", String::ToString( property.getNumElements() ) );
|
||||
xml->setAttribute( "isConstant", property.isConstant() ? "1" : "0" );
|
||||
xml->setAttribute( "isTransient", property.isTransient() ? "1" : "0" );
|
||||
xml->setAttribute( "isVisible", property.hideInInspectors() ? "0" : "1" );
|
||||
xml->setAttribute( "docs", property.getDocString() ? property.getDocString() : "" );
|
||||
|
||||
xml->popElement();
|
||||
xml->setAttribute("type", "unknown");
|
||||
}
|
||||
}
|
||||
|
||||
AssertFatal( !groupNestingDepth, "exportType - Property group nesting mismatch!" );
|
||||
xml->popElement();
|
||||
}
|
||||
exportScope( type, xml );
|
||||
|
||||
|
||||
xml->popElement();
|
||||
}
|
||||
}
|
||||
|
||||
AssertFatal(!groupNestingDepth, "exportType - Property group nesting mismatch!");
|
||||
xml->popElement();
|
||||
}
|
||||
exportScope(type, xml);
|
||||
|
||||
xml->popElement();
|
||||
}
|
||||
|
||||
|
|
@ -496,63 +520,63 @@ static void exportType( const EngineTypeInfo* type, SimXMLDocument* xml )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void exportScope( const EngineExportScope* scope, SimXMLDocument* xml, bool addNode )
|
||||
static void exportScope(const EngineExportScope* scope, SimXMLDocument* xml, bool addNode)
|
||||
{
|
||||
if( addNode )
|
||||
if (addNode)
|
||||
{
|
||||
if( isExportFiltered( scope ) )
|
||||
if (isExportFiltered(scope))
|
||||
return;
|
||||
|
||||
xml->pushNewElement( "EngineExportScope" );
|
||||
|
||||
xml->setAttribute( "name", scope->getExportName() );
|
||||
xml->setAttribute( "docs", getDocString( scope ) );
|
||||
|
||||
xml->pushNewElement("EngineExportScope");
|
||||
|
||||
xml->setAttribute("name", scope->getExportName());
|
||||
xml->setAttribute("docs", getDocString(scope));
|
||||
}
|
||||
|
||||
// Dump all contained exports.
|
||||
|
||||
xml->pushNewElement( "exports" );
|
||||
|
||||
for( const EngineExport* exportInfo = scope->getExports(); exportInfo != NULL; exportInfo = exportInfo->getNextExport() )
|
||||
|
||||
xml->pushNewElement("exports");
|
||||
|
||||
for (const EngineExport* exportInfo = scope->getExports(); exportInfo != NULL; exportInfo = exportInfo->getNextExport())
|
||||
{
|
||||
switch (exportInfo->getExportKind())
|
||||
{
|
||||
switch( exportInfo->getExportKind() )
|
||||
{
|
||||
case EngineExportKindScope:
|
||||
exportScope( static_cast< const EngineExportScope* >( exportInfo ), xml, true );
|
||||
break;
|
||||
|
||||
case EngineExportKindFunction:
|
||||
exportFunction( static_cast< const EngineFunctionInfo* >( exportInfo ), xml );
|
||||
break;
|
||||
|
||||
case EngineExportKindType:
|
||||
exportType( static_cast< const EngineTypeInfo* >( exportInfo ), xml );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
case EngineExportKindScope:
|
||||
exportScope(static_cast< const EngineExportScope* >(exportInfo), xml, true);
|
||||
break;
|
||||
|
||||
case EngineExportKindFunction:
|
||||
exportFunction(static_cast< const EngineFunctionInfo* >(exportInfo), xml);
|
||||
break;
|
||||
|
||||
case EngineExportKindType:
|
||||
exportType(static_cast< const EngineTypeInfo* >(exportInfo), xml);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
xml->popElement();
|
||||
|
||||
if( addNode )
|
||||
|
||||
if (addNode)
|
||||
xml->popElement();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction( exportEngineAPIToXML, SimXMLDocument*, (),,
|
||||
DefineEngineFunction(exportEngineAPIToXML, SimXMLDocument*, (), ,
|
||||
"Create a XML document containing a dump of the entire exported engine API.\n\n"
|
||||
"@return A SimXMLDocument containing a dump of the engine's export information or NULL if the operation failed.\n\n"
|
||||
"@ingroup Console" )
|
||||
"@ingroup Console")
|
||||
{
|
||||
SimXMLDocument* xml = new SimXMLDocument;
|
||||
xml->registerObject();
|
||||
Sim::getRootGroup()->addObject( xml );
|
||||
Sim::getRootGroup()->addObject(xml);
|
||||
xml->addHeader();
|
||||
|
||||
exportScope( EngineExportScope::getGlobalScope(), xml, true );
|
||||
|
||||
|
||||
exportScope(EngineExportScope::getGlobalScope(), xml, true);
|
||||
|
||||
return xml;
|
||||
}
|
||||
}
|
||||
|
|
@ -123,7 +123,7 @@ static char* suppressSpaces(const char* in_pname)
|
|||
//-----------------------------------------------------------------------------
|
||||
// Query Groups.
|
||||
//-----------------------------------------------------------------------------
|
||||
DefineConsoleMethod(FieldBrushObject, queryGroups, const char*, (const char* simObjName), , "(simObject) Query available static-field groups for selected object./\n"
|
||||
DefineEngineMethod(FieldBrushObject, queryGroups, const char*, (const char* simObjName), , "(simObject) Query available static-field groups for selected object./\n"
|
||||
"@param simObject Object to query static-field groups on.\n"
|
||||
"@return Space-seperated static-field group list.")
|
||||
{
|
||||
|
|
@ -191,7 +191,7 @@ DefineConsoleMethod(FieldBrushObject, queryGroups, const char*, (const char* sim
|
|||
//-----------------------------------------------------------------------------
|
||||
// Query Fields.
|
||||
//-----------------------------------------------------------------------------
|
||||
DefineConsoleMethod(FieldBrushObject, queryFields, const char*, (const char* simObjName, const char* groupList), (""), "(simObject, [groupList]) Query available static-fields for selected object./\n"
|
||||
DefineEngineMethod(FieldBrushObject, queryFields, const char*, (const char* simObjName, const char* groupList), (""), "(simObject, [groupList]) Query available static-fields for selected object./\n"
|
||||
"@param simObject Object to query static-fields on.\n"
|
||||
"@param groupList groups to filter static-fields against.\n"
|
||||
"@return Space-seperated static-field list.")
|
||||
|
|
@ -366,7 +366,7 @@ DefineConsoleMethod(FieldBrushObject, queryFields, const char*, (const char* sim
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copy Fields.
|
||||
//-----------------------------------------------------------------------------
|
||||
DefineConsoleMethod(FieldBrushObject, copyFields, void, (const char* simObjName, const char* pFieldList), (""), "(simObject, [fieldList]) Copy selected static-fields for selected object./\n"
|
||||
DefineEngineMethod(FieldBrushObject, copyFields, void, (const char* simObjName, const char* pFieldList), (""), "(simObject, [fieldList]) Copy selected static-fields for selected object./\n"
|
||||
"@param simObject Object to copy static-fields from.\n"
|
||||
"@param fieldList fields to filter static-fields against.\n"
|
||||
"@return No return value.")
|
||||
|
|
@ -500,7 +500,7 @@ void FieldBrushObject::copyFields( SimObject* pSimObject, const char* fieldList
|
|||
//-----------------------------------------------------------------------------
|
||||
// Paste Fields.
|
||||
//-----------------------------------------------------------------------------
|
||||
DefineConsoleMethod(FieldBrushObject, pasteFields, void, (const char* simObjName), , "(simObject) Paste copied static-fields to selected object./\n"
|
||||
DefineEngineMethod(FieldBrushObject, pasteFields, void, (const char* simObjName), , "(simObject) Paste copied static-fields to selected object./\n"
|
||||
"@param simObject Object to paste static-fields to.\n"
|
||||
"@return No return value.")
|
||||
{
|
||||
|
|
|
|||
153
Engine/source/console/fixedTuple.h
Normal file
153
Engine/source/console/fixedTuple.h
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 _FIXEDTUPLE_H_
|
||||
#define _FIXEDTUPLE_H_
|
||||
/// @name Fixed-layout tuple definition
|
||||
/// These structs and templates serve as a way to pass arguments from external
|
||||
/// applications and into the T3D console system.
|
||||
/// They work as std::tuple, but they ensure a standardized fixed memory
|
||||
/// layout. Allowing for unmanaged calls with these tuples as the parameter
|
||||
/// lists.
|
||||
///
|
||||
/// The implementation is from a SO solution:
|
||||
/// https://codereview.stackexchange.com/a/52279
|
||||
/// As out use-case is pretty simple, this code could probably be simplified by
|
||||
/// stripping out a lot of extra functionality. But eh.
|
||||
///
|
||||
/// @{
|
||||
|
||||
template <typename ...Ts>
|
||||
struct fixed_tuple;
|
||||
|
||||
template <typename T, typename ...Ts>
|
||||
struct fixed_tuple<T, Ts...>
|
||||
{
|
||||
T first;
|
||||
fixed_tuple<Ts...> rest;
|
||||
|
||||
fixed_tuple() = default;
|
||||
template <class U, class...Us, class = typename ::std::enable_if<!::std::is_base_of<fixed_tuple, typename ::std::decay<U>::type>::value>::type>
|
||||
fixed_tuple(U&& u, Us&&...tail) :
|
||||
first(::std::forward<U>(u)),
|
||||
rest(::std::forward<Us>(tail)...) {}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct fixed_tuple<T>
|
||||
{
|
||||
T first;
|
||||
|
||||
fixed_tuple() = default;
|
||||
template <class U, class = typename ::std::enable_if<!::std::is_base_of<fixed_tuple, typename ::std::decay<U>::type>::value>::type>
|
||||
fixed_tuple(U&& u) :
|
||||
first(::std::forward<U>(u)) {}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fixed_tuple<> {};
|
||||
|
||||
|
||||
template < ::std::size_t i, class T>
|
||||
struct fixed_tuple_element;
|
||||
|
||||
template < ::std::size_t i, class T, class... Ts>
|
||||
struct fixed_tuple_element<i, fixed_tuple<T, Ts...> >
|
||||
: fixed_tuple_element<i - 1, fixed_tuple<Ts...> >
|
||||
{};
|
||||
|
||||
template <class T, class... Ts>
|
||||
struct fixed_tuple_element<0, fixed_tuple<T, Ts...> >
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template < ::std::size_t i>
|
||||
struct fixed_tuple_accessor
|
||||
{
|
||||
template <class... Ts>
|
||||
static inline typename fixed_tuple_element<i, fixed_tuple<Ts...> >::type & get(fixed_tuple<Ts...> & t)
|
||||
{
|
||||
return fixed_tuple_accessor<i - 1>::get(t.rest);
|
||||
}
|
||||
|
||||
template <class... Ts>
|
||||
static inline const typename fixed_tuple_element<i, fixed_tuple<Ts...> >::type & get(const fixed_tuple<Ts...> & t)
|
||||
{
|
||||
return fixed_tuple_accessor<i - 1>::get(t.rest);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fixed_tuple_accessor<0>
|
||||
{
|
||||
template <class... Ts>
|
||||
static inline typename fixed_tuple_element<0, fixed_tuple<Ts...> >::type & get(fixed_tuple<Ts...> & t)
|
||||
{
|
||||
return t.first;
|
||||
}
|
||||
|
||||
template <class... Ts>
|
||||
static inline const typename fixed_tuple_element<0, fixed_tuple<Ts...> >::type & get(const fixed_tuple<Ts...> & t)
|
||||
{
|
||||
return t.first;
|
||||
}
|
||||
};
|
||||
|
||||
template< typename T1, typename T2 >
|
||||
struct fixed_tuple_mutator {};
|
||||
|
||||
template<typename... Tdest, typename... Tsrc>
|
||||
struct fixed_tuple_mutator<void(Tdest...), void(Tsrc...)>
|
||||
{
|
||||
template<std::size_t I = 0>
|
||||
static inline typename std::enable_if<I == sizeof...(Tsrc), void>::type
|
||||
copy_r_t_l(fixed_tuple<Tsrc...>& src, fixed_tuple<Tdest...>& dest)
|
||||
{ }
|
||||
|
||||
template<std::size_t I = 0>
|
||||
static inline typename std::enable_if<I < sizeof...(Tsrc), void>::type
|
||||
copy_r_t_l(fixed_tuple<Tsrc...>& src, fixed_tuple<Tdest...>& dest)
|
||||
{
|
||||
fixed_tuple_accessor<I + (sizeof...(Tdest)-sizeof...(Tsrc))>::get(dest) = fixed_tuple_accessor<I>::get(src);
|
||||
copy_r_t_l<I + 1>(src, dest);
|
||||
}
|
||||
|
||||
template<std::size_t I = 0>
|
||||
static inline typename std::enable_if<I == sizeof...(Tsrc), void>::type
|
||||
copy(std::tuple<Tsrc...>& src, fixed_tuple<Tdest...>& dest)
|
||||
{ }
|
||||
|
||||
template<std::size_t I = 0>
|
||||
static inline typename std::enable_if<I < sizeof...(Tsrc), void>::type
|
||||
copy(std::tuple<Tsrc...>& src, fixed_tuple<Tdest...>& dest)
|
||||
{
|
||||
fixed_tuple_accessor<I>::get(dest) = std::get<I>(src);
|
||||
copy<I + 1>(src, dest);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
#endif // !_FIXEDTUPLE_H_
|
||||
|
|
@ -2190,14 +2190,14 @@ void PersistenceManager::deleteObjectsFromFile(const char* fileName)
|
|||
clearAll();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( PersistenceManager, deleteObjectsFromFile, void, ( const char * fileName ), , "( fileName )"
|
||||
DefineEngineMethod( PersistenceManager, deleteObjectsFromFile, void, ( const char * fileName ), , "( fileName )"
|
||||
"Delete all of the objects that are created from the given file." )
|
||||
{
|
||||
// Delete Objects.
|
||||
object->deleteObjectsFromFile( fileName );
|
||||
}
|
||||
|
||||
DefineConsoleMethod( PersistenceManager, setDirty, void, ( const char * objName, const char * fileName ), (""), "(SimObject object, [filename])"
|
||||
DefineEngineMethod( PersistenceManager, setDirty, void, ( const char * objName, const char * fileName ), (""), "(SimObject object, [filename])"
|
||||
"Mark an existing SimObject as dirty (will be written out when saveDirty() is called).")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
|
|
@ -2226,7 +2226,7 @@ DefineConsoleMethod( PersistenceManager, setDirty, void, ( const char * objName
|
|||
}
|
||||
}
|
||||
|
||||
DefineConsoleMethod( PersistenceManager, removeDirty, void, ( const char * objName ), , "(SimObject object)"
|
||||
DefineEngineMethod( PersistenceManager, removeDirty, void, ( const char * objName ), , "(SimObject object)"
|
||||
"Remove a SimObject from the dirty list.")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
|
|
@ -2243,7 +2243,7 @@ DefineConsoleMethod( PersistenceManager, removeDirty, void, ( const char * objNa
|
|||
object->removeDirty(dirtyObject);
|
||||
}
|
||||
|
||||
DefineConsoleMethod( PersistenceManager, isDirty, bool, ( const char * objName ), , "(SimObject object)"
|
||||
DefineEngineMethod( PersistenceManager, isDirty, bool, ( const char * objName ), , "(SimObject object)"
|
||||
"Returns true if the SimObject is on the dirty list.")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
|
|
@ -2262,19 +2262,19 @@ DefineConsoleMethod( PersistenceManager, isDirty, bool, ( const char * objName )
|
|||
return false;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( PersistenceManager, hasDirty, bool, (), , "()"
|
||||
DefineEngineMethod( PersistenceManager, hasDirty, bool, (), , "()"
|
||||
"Returns true if the manager has dirty objects to save." )
|
||||
{
|
||||
return object->hasDirty();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( PersistenceManager, getDirtyObjectCount, S32, (), , "()"
|
||||
DefineEngineMethod( PersistenceManager, getDirtyObjectCount, S32, (), , "()"
|
||||
"Returns the number of dirty objects." )
|
||||
{
|
||||
return object->getDirtyList().size();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( PersistenceManager, getDirtyObject, S32, (S32 index), , "( index )"
|
||||
DefineEngineMethod( PersistenceManager, getDirtyObject, S32, (S32 index), , "( index )"
|
||||
"Returns the ith dirty object." )
|
||||
{
|
||||
if ( index < 0 || index >= object->getDirtyList().size() )
|
||||
|
|
@ -2290,7 +2290,7 @@ DefineConsoleMethod( PersistenceManager, getDirtyObject, S32, (S32 index), , "(
|
|||
return ( dirtyObject.getObject() ) ? dirtyObject.getObject()->getId() : 0;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( PersistenceManager, listDirty, void, (), , "()"
|
||||
DefineEngineMethod( PersistenceManager, listDirty, void, (), , "()"
|
||||
"Prints the dirty list to the console.")
|
||||
{
|
||||
const PersistenceManager::DirtyList dirtyList = object->getDirtyList();
|
||||
|
|
@ -2318,13 +2318,13 @@ DefineConsoleMethod( PersistenceManager, listDirty, void, (), , "()"
|
|||
}
|
||||
}
|
||||
|
||||
DefineConsoleMethod( PersistenceManager, saveDirty, bool, (), , "()"
|
||||
DefineEngineMethod( PersistenceManager, saveDirty, bool, (), , "()"
|
||||
"Saves all of the SimObject's on the dirty list to their respective files.")
|
||||
{
|
||||
return object->saveDirty();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( PersistenceManager, saveDirtyObject, bool, (const char * objName), , "(SimObject object)"
|
||||
DefineEngineMethod( PersistenceManager, saveDirtyObject, bool, (const char * objName), , "(SimObject object)"
|
||||
"Save a dirty SimObject to it's file.")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
|
|
@ -2342,13 +2342,13 @@ DefineConsoleMethod( PersistenceManager, saveDirtyObject, bool, (const char * ob
|
|||
return false;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( PersistenceManager, clearAll, void, (), , "()"
|
||||
DefineEngineMethod( PersistenceManager, clearAll, void, (), , "()"
|
||||
"Clears all the tracked objects without saving them." )
|
||||
{
|
||||
object->clearAll();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( PersistenceManager, removeObjectFromFile, void, (const char * objName, const char * filename),("") , "(SimObject object, [filename])"
|
||||
DefineEngineMethod( PersistenceManager, removeObjectFromFile, void, (const char * objName, const char * filename),("") , "(SimObject object, [filename])"
|
||||
"Remove an existing SimObject from a file (can optionally specify a different file than \
|
||||
the one it was created in.")
|
||||
{
|
||||
|
|
@ -2371,7 +2371,7 @@ DefineConsoleMethod( PersistenceManager, removeObjectFromFile, void, (const char
|
|||
}
|
||||
}
|
||||
|
||||
DefineConsoleMethod( PersistenceManager, removeField, void, (const char * objName, const char * fieldName), , "(SimObject object, string fieldName)"
|
||||
DefineEngineMethod( PersistenceManager, removeField, void, (const char * objName, const char * fieldName), , "(SimObject object, string fieldName)"
|
||||
"Remove a specific field from an object declaration.")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "core/tSimpleHashTable.h"
|
||||
#include "core/strings/stringFunctions.h"
|
||||
#include "core/stringTable.h"
|
||||
#include "console/console.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "console/compiler.h"
|
||||
|
||||
|
||||
|
|
@ -342,28 +342,26 @@ bool collapseScriptFilename(char *filename, U32 size, const char *src)
|
|||
// Console Functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction(expandFilename, const char*, 2, 2, "(string filename)"
|
||||
"@brief Grabs the full path of a specified file\n\n"
|
||||
"@param filename Name of the local file to locate\n"
|
||||
"@return String containing the full filepath on disk\n"
|
||||
"@ingroup FileSystem")
|
||||
DefineEngineFunction(expandFilename, const char*, (const char* filename),,
|
||||
"@brief Grabs the full path of a specified file\n\n"
|
||||
"@param filename Name of the local file to locate\n"
|
||||
"@return String containing the full filepath on disk\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
static const U32 bufSize = 1024;
|
||||
char* ret = Con::getReturnBuffer( bufSize );
|
||||
Con::expandScriptFilename(ret, bufSize, argv[1]);
|
||||
char* ret = Con::getReturnBuffer(bufSize);
|
||||
Con::expandScriptFilename(ret, bufSize, filename);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ConsoleFunction(expandOldFilename, const char*, 2, 2, "(string filename)"
|
||||
"@brief Retrofits a filepath that uses old Torque style\n\n"
|
||||
"@return String containing filepath with new formatting\n"
|
||||
"@ingroup FileSystem")
|
||||
DefineEngineFunction(expandOldFilename, const char*, (const char* filename),,
|
||||
"@brief Retrofits a filepath that uses old Torque style\n\n"
|
||||
"@return String containing filepath with new formatting\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
static const U32 bufSize = 1024;
|
||||
char* ret = Con::getReturnBuffer( bufSize );
|
||||
Con::expandOldScriptFilename(ret, bufSize, argv[1]);
|
||||
char* ret = Con::getReturnBuffer(bufSize);
|
||||
Con::expandOldScriptFilename(ret, bufSize, filename);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace Sim
|
|||
|
||||
ConsoleFunctionGroupBegin ( SimFunctions, "Functions relating to Sim.");
|
||||
|
||||
DefineConsoleFunction( nameToID, S32, (const char * objectName), ,"nameToID(object)")
|
||||
DefineEngineFunction( nameToID, S32, (const char * objectName), ,"nameToID(object)")
|
||||
{
|
||||
SimObject *obj = Sim::findObject(objectName);
|
||||
if(obj)
|
||||
|
|
@ -95,7 +95,7 @@ DefineConsoleFunction( nameToID, S32, (const char * objectName), ,"nameToID(obje
|
|||
return -1;
|
||||
}
|
||||
|
||||
DefineConsoleFunction( isObject, bool, (const char * objectName), ,"isObject(object)")
|
||||
DefineEngineFunction( isObject, bool, (const char * objectName), ,"isObject(object)")
|
||||
{
|
||||
if (!dStrcmp(objectName, "0") || !dStrcmp(objectName, ""))
|
||||
return false;
|
||||
|
|
@ -133,7 +133,7 @@ ConsoleDocFragment _spawnObject1(
|
|||
"bool spawnObject(class [, dataBlock, name, properties, script]);"
|
||||
);
|
||||
|
||||
DefineConsoleFunction( spawnObject, S32, ( const char * spawnClass
|
||||
DefineEngineFunction( spawnObject, S32, ( const char * spawnClass
|
||||
, const char * spawnDataBlock
|
||||
, const char * spawnName
|
||||
, const char * spawnProperties
|
||||
|
|
@ -149,39 +149,39 @@ DefineConsoleFunction( spawnObject, S32, ( const char * spawnClass
|
|||
return -1;
|
||||
}
|
||||
|
||||
DefineConsoleFunction( cancel, void, (S32 eventId), ,"cancel(eventId)")
|
||||
DefineEngineFunction( cancel, void, (S32 eventId), ,"cancel(eventId)")
|
||||
{
|
||||
Sim::cancelEvent(eventId);
|
||||
}
|
||||
|
||||
DefineConsoleFunction( cancelAll, void, (const char * objectId), ,"cancelAll(objectId): cancel pending events on the specified object. Events will be automatically cancelled if object is deleted.")
|
||||
DefineEngineFunction( cancelAll, void, (const char * objectId), ,"cancelAll(objectId): cancel pending events on the specified object. Events will be automatically cancelled if object is deleted.")
|
||||
{
|
||||
Sim::cancelPendingEvents(Sim::findObject(objectId));
|
||||
}
|
||||
|
||||
DefineConsoleFunction( isEventPending, bool, (S32 scheduleId), ,"isEventPending(%scheduleId);")
|
||||
DefineEngineFunction( isEventPending, bool, (S32 scheduleId), ,"isEventPending(%scheduleId);")
|
||||
{
|
||||
return Sim::isEventPending(scheduleId);
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getEventTimeLeft, S32, (S32 scheduleId), ,"getEventTimeLeft(scheduleId) Get the time left in ms until this event will trigger.")
|
||||
DefineEngineFunction( getEventTimeLeft, S32, (S32 scheduleId), ,"getEventTimeLeft(scheduleId) Get the time left in ms until this event will trigger.")
|
||||
{
|
||||
return Sim::getEventTimeLeft(scheduleId);
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getScheduleDuration, S32, (S32 scheduleId), ,"getScheduleDuration(%scheduleId);" )
|
||||
DefineEngineFunction( getScheduleDuration, S32, (S32 scheduleId), ,"getScheduleDuration(%scheduleId);" )
|
||||
{
|
||||
S32 ret = Sim::getScheduleDuration(scheduleId);
|
||||
return ret;
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getTimeSinceStart, S32, (S32 scheduleId), ,"getTimeSinceStart(%scheduleId);" )
|
||||
DefineEngineFunction( getTimeSinceStart, S32, (S32 scheduleId), ,"getTimeSinceStart(%scheduleId);" )
|
||||
{
|
||||
S32 ret = Sim::getTimeSinceStart(scheduleId);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ConsoleFunction(schedule, S32, 4, 0, "schedule(time, refobject|0, command, <arg1...argN>)")
|
||||
DefineEngineStringlyVariadicFunction(schedule, S32, 4, 0, "schedule(time, refobject|0, command, <arg1...argN>)")
|
||||
{
|
||||
U32 timeDelta = U32(dAtof(argv[1]));
|
||||
SimObject *refObject = Sim::findObject(argv[2]);
|
||||
|
|
@ -202,7 +202,7 @@ ConsoleFunction(schedule, S32, 4, 0, "schedule(time, refobject|0, command, <arg1
|
|||
return ret;
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getUniqueName, const char*, (const char * baseName), ,
|
||||
DefineEngineFunction( getUniqueName, const char*, (const char * baseName), ,
|
||||
"( String baseName )\n"
|
||||
"@brief Returns a unique unused SimObject name based on a given base name.\n\n"
|
||||
"@baseName Name to conver to a unique string if another instance exists\n"
|
||||
|
|
@ -221,7 +221,7 @@ DefineConsoleFunction( getUniqueName, const char*, (const char * baseName), ,
|
|||
return buffer;
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getUniqueInternalName, const char*, (const char * baseName, const char * setString, bool searchChildren), ,
|
||||
DefineEngineFunction( getUniqueInternalName, const char*, (const char * baseName, const char * setString, bool searchChildren), ,
|
||||
"( String baseName, SimSet set, bool searchChildren )\n"
|
||||
"@brief Returns a unique unused internal name within the SimSet/Group based on a given base name.\n\n"
|
||||
"@note Currently only used by editors\n"
|
||||
|
|
@ -246,7 +246,7 @@ DefineConsoleFunction( getUniqueInternalName, const char*, (const char * baseNam
|
|||
return buffer;
|
||||
}
|
||||
|
||||
DefineConsoleFunction( isValidObjectName, bool, (const char * name), , "( string name )"
|
||||
DefineEngineFunction( isValidObjectName, bool, (const char * name), , "( string name )"
|
||||
"@brief Return true if the given name makes for a valid object name.\n\n"
|
||||
"@param name Name of object\n"
|
||||
"@return True if name is allowed, false if denied (usually because it starts with a number, _, or invalid character"
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ void SimDataBlock::write(Stream &stream, U32 tabStop, U32 flags)
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimDataBlock, reloadOnLocalClient, void, (),,
|
||||
DefineEngineMethod( SimDataBlock, reloadOnLocalClient, void, (),,
|
||||
"Reload the datablock. This can only be used with a local client configuration." )
|
||||
{
|
||||
// Make sure we're running a local client.
|
||||
|
|
@ -464,7 +464,7 @@ DefineConsoleMethod( SimDataBlock, reloadOnLocalClient, void, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( preloadClientDataBlocks, void, (),,
|
||||
DefineEngineFunction( preloadClientDataBlocks, void, (),,
|
||||
"Preload all datablocks in client mode.\n\n"
|
||||
"(Server parameter is set to false). This will take some time to complete.")
|
||||
{
|
||||
|
|
@ -482,7 +482,7 @@ DefineConsoleFunction( preloadClientDataBlocks, void, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( deleteDataBlocks, void, (),,
|
||||
DefineEngineFunction( deleteDataBlocks, void, (),,
|
||||
"Delete all the datablocks we've downloaded.\n\n"
|
||||
"This is usually done in preparation of downloading a new set of datablocks, "
|
||||
"such as occurs on a mission change, but it's also good post-mission cleanup." )
|
||||
|
|
|
|||
|
|
@ -2271,7 +2271,7 @@ DefineEngineMethod( SimObject, dumpGroupHierarchy, void, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, isMethod, bool, ( const char* methodName ),,
|
||||
DefineEngineMethod( SimObject, isMethod, bool, ( const char* methodName ),,
|
||||
"Test whether the given method is defined on this object.\n"
|
||||
"@param The name of the method.\n"
|
||||
"@return True if the object implements the given method." )
|
||||
|
|
@ -2291,7 +2291,7 @@ DefineEngineMethod( SimObject, isChildOfGroup, bool, ( SimGroup* group ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, getClassNamespace, const char*, (),,
|
||||
DefineEngineMethod( SimObject, getClassNamespace, const char*, (),,
|
||||
"Get the name of the class namespace assigned to this object.\n"
|
||||
"@return The name of the 'class' namespace." )
|
||||
{
|
||||
|
|
@ -2300,7 +2300,7 @@ DefineConsoleMethod( SimObject, getClassNamespace, const char*, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, getSuperClassNamespace, const char*, (),,
|
||||
DefineEngineMethod( SimObject, getSuperClassNamespace, const char*, (),,
|
||||
"Get the name of the superclass namespace assigned to this object.\n"
|
||||
"@return The name of the 'superClass' namespace." )
|
||||
{
|
||||
|
|
@ -2309,7 +2309,7 @@ DefineConsoleMethod( SimObject, getSuperClassNamespace, const char*, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, setClassNamespace, void, ( const char* name ),,
|
||||
DefineEngineMethod( SimObject, setClassNamespace, void, ( const char* name ),,
|
||||
"Assign a class namespace to this object.\n"
|
||||
"@param name The name of the 'class' namespace for this object." )
|
||||
{
|
||||
|
|
@ -2318,7 +2318,7 @@ DefineConsoleMethod( SimObject, setClassNamespace, void, ( const char* name ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, setSuperClassNamespace, void, ( const char* name ),,
|
||||
DefineEngineMethod( SimObject, setSuperClassNamespace, void, ( const char* name ),,
|
||||
"Assign a superclass namespace to this object.\n"
|
||||
"@param name The name of the 'superClass' namespace for this object." )
|
||||
{
|
||||
|
|
@ -2345,7 +2345,7 @@ DefineEngineMethod( SimObject, setIsSelected, void, ( bool state ), ( true ),
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, isExpanded, bool, (),,
|
||||
DefineEngineMethod( SimObject, isExpanded, bool, (),,
|
||||
"Get whether the object has been marked as expanded. (in editor)\n"
|
||||
"@return True if the object is marked expanded." )
|
||||
{
|
||||
|
|
@ -2354,7 +2354,7 @@ DefineConsoleMethod( SimObject, isExpanded, bool, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, setIsExpanded, void, ( bool state ), ( true ),
|
||||
DefineEngineMethod( SimObject, setIsExpanded, void, ( bool state ), ( true ),
|
||||
"Set whether the object has been marked as expanded. (in editor)\n"
|
||||
"@param state True if the object is to be marked expanded; false if not." )
|
||||
{
|
||||
|
|
@ -2363,7 +2363,7 @@ DefineConsoleMethod( SimObject, setIsExpanded, void, ( bool state ), ( true ),
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, getFilename, const char*, (),,
|
||||
DefineEngineMethod( SimObject, getFilename, const char*, (),,
|
||||
"Returns the filename the object is attached to.\n"
|
||||
"@return The name of the file the object is associated with; usually the file the object was loaded from." )
|
||||
{
|
||||
|
|
@ -2372,7 +2372,7 @@ DefineConsoleMethod( SimObject, getFilename, const char*, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, setFilename, void, ( const char* fileName ),,
|
||||
DefineEngineMethod( SimObject, setFilename, void, ( const char* fileName ),,
|
||||
"Sets the object's file name and path\n"
|
||||
"@param fileName The name of the file to associate this object with." )
|
||||
{
|
||||
|
|
@ -2381,7 +2381,7 @@ DefineConsoleMethod( SimObject, setFilename, void, ( const char* fileName ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, getDeclarationLine, S32, (),,
|
||||
DefineEngineMethod( SimObject, getDeclarationLine, S32, (),,
|
||||
"Get the line number at which the object is defined in its file.\n\n"
|
||||
"@return The line number of the object's definition in script.\n"
|
||||
"@see getFilename()")
|
||||
|
|
@ -2418,7 +2418,7 @@ DefineEngineFunction( debugEnumInstances, void, ( const char* className, const c
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, assignFieldsFrom, void, ( SimObject* fromObject ),,
|
||||
DefineEngineMethod( SimObject, assignFieldsFrom, void, ( SimObject* fromObject ),,
|
||||
"Copy fields from another object onto this one. The objects must "
|
||||
"be of same type. Everything from the object will overwrite what's "
|
||||
"in this object; extra fields in this object will remain. This "
|
||||
|
|
@ -2439,7 +2439,7 @@ DefineEngineMethod( SimObject, assignPersistentId, void, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, getCanSave, bool, (),,
|
||||
DefineEngineMethod( SimObject, getCanSave, bool, (),,
|
||||
"Get whether the object will be included in saves.\n"
|
||||
"@return True if the object will be saved; false otherwise." )
|
||||
{
|
||||
|
|
@ -2448,7 +2448,7 @@ DefineConsoleMethod( SimObject, getCanSave, bool, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, setCanSave, void, ( bool value ), ( true ),
|
||||
DefineEngineMethod( SimObject, setCanSave, void, ( bool value ), ( true ),
|
||||
"Set whether the object will be included in saves.\n"
|
||||
"@param value If true, the object will be included in saves; if false, it will be excluded." )
|
||||
{
|
||||
|
|
@ -2529,7 +2529,7 @@ DefineEngineMethod( SimObject, setHidden, void, ( bool value ), ( true ),
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, dumpMethods, ArrayObject*, (),,
|
||||
DefineEngineMethod( SimObject, dumpMethods, ArrayObject*, (),,
|
||||
"List the methods defined on this object.\n\n"
|
||||
"Each description is a newline-separated vector with the following elements:\n"
|
||||
"- Minimum number of arguments.\n"
|
||||
|
|
@ -2776,7 +2776,7 @@ DefineEngineMethod( SimObject, dump, void, ( bool detailed ), ( false ),
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, save, bool, ( const char* fileName, bool selectedOnly, const char* preAppendString ), ( false, "" ),
|
||||
DefineEngineMethod( SimObject, save, bool, ( const char* fileName, bool selectedOnly, const char* preAppendString ), ( false, "" ),
|
||||
"Save out the object to the given file.\n"
|
||||
"@param fileName The name of the file to save to."
|
||||
"@param selectedOnly If true, only objects marked as selected will be saved out.\n"
|
||||
|
|
@ -2808,7 +2808,7 @@ DefineEngineMethod( SimObject, getName, const char*, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, getClassName, const char*, (),,
|
||||
DefineEngineMethod( SimObject, getClassName, const char*, (),,
|
||||
"Get the name of the C++ class which the object is an instance of.\n"
|
||||
"@return The name of the C++ class of the object." )
|
||||
{
|
||||
|
|
@ -2818,7 +2818,7 @@ DefineConsoleMethod( SimObject, getClassName, const char*, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, isField, bool, ( const char* fieldName ),,
|
||||
DefineEngineMethod( SimObject, isField, bool, ( const char* fieldName ),,
|
||||
"Test whether the given field is defined on this object.\n"
|
||||
"@param fieldName The name of the field.\n"
|
||||
"@return True if the object implements the given field." )
|
||||
|
|
@ -2828,7 +2828,7 @@ DefineConsoleMethod( SimObject, isField, bool, ( const char* fieldName ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, getFieldValue, const char*, ( const char* fieldName, S32 index ), ( -1 ),
|
||||
DefineEngineMethod( SimObject, getFieldValue, const char*, ( const char* fieldName, S32 index ), ( -1 ),
|
||||
"Return the value of the given field on this object.\n"
|
||||
"@param fieldName The name of the field. If it includes a field index, the index is parsed out.\n"
|
||||
"@param index Optional parameter to specify the index of an array field separately.\n"
|
||||
|
|
@ -2872,7 +2872,7 @@ DefineConsoleMethod( SimObject, getFieldValue, const char*, ( const char* fieldN
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, setFieldValue, bool, ( const char* fieldName, const char* value, S32 index ), ( -1 ),
|
||||
DefineEngineMethod( SimObject, setFieldValue, bool, ( const char* fieldName, const char* value, S32 index ), ( -1 ),
|
||||
"Set the value of the given field on this object.\n"
|
||||
"@param fieldName The name of the field to assign to. If it includes an array index, the index will be parsed out.\n"
|
||||
"@param value The new value to assign to the field.\n"
|
||||
|
|
@ -2919,7 +2919,7 @@ DefineConsoleMethod( SimObject, setFieldValue, bool, ( const char* fieldName, co
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, getFieldType, const char*, ( const char* fieldName ),,
|
||||
DefineEngineMethod( SimObject, getFieldType, const char*, ( const char* fieldName ),,
|
||||
"Get the console type code of the given field.\n"
|
||||
"@return The numeric type code for the underlying console type of the given field." )
|
||||
{
|
||||
|
|
@ -2934,7 +2934,7 @@ DefineConsoleMethod( SimObject, getFieldType, const char*, ( const char* fieldNa
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, setFieldType, void, ( const char* fieldName, const char* type ),,
|
||||
DefineEngineMethod( SimObject, setFieldType, void, ( const char* fieldName, const char* type ),,
|
||||
"Set the console type code for the given field.\n"
|
||||
"@param fieldName The name of the dynamic field to change to type for.\n"
|
||||
"@param type The name of the console type.\n"
|
||||
|
|
@ -2945,7 +2945,7 @@ DefineConsoleMethod( SimObject, setFieldType, void, ( const char* fieldName, con
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( SimObject, call, const char*, 3, 0, "( string method, string args... ) Dynamically call a method on an object.\n"
|
||||
DefineEngineStringlyVariadicMethod( SimObject, call, const char*, 3, 0, "( string method, string args... ) Dynamically call a method on an object.\n"
|
||||
"@param method Name of method to call.\n"
|
||||
"@param args Zero or more arguments for the method.\n"
|
||||
"@return The result of the method call." )
|
||||
|
|
@ -2974,7 +2974,7 @@ DefineEngineMethod( SimObject, getInternalName, const char*, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, dumpClassHierarchy, void, (),,
|
||||
DefineEngineMethod( SimObject, dumpClassHierarchy, void, (),,
|
||||
"Dump the native C++ class hierarchy of this object's C++ class to the console." )
|
||||
{
|
||||
object->dumpClassHierarchy();
|
||||
|
|
@ -2982,7 +2982,7 @@ DefineConsoleMethod( SimObject, dumpClassHierarchy, void, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, isMemberOfClass, bool, ( const char* className ),,
|
||||
DefineEngineMethod( SimObject, isMemberOfClass, bool, ( const char* className ),,
|
||||
"Test whether this object is a member of the specified class.\n"
|
||||
"@param className Name of a native C++ class.\n"
|
||||
"@return True if this object is an instance of the given C++ class or any of its super classes." )
|
||||
|
|
@ -3004,7 +3004,7 @@ DefineConsoleMethod( SimObject, isMemberOfClass, bool, ( const char* className )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, isInNamespaceHierarchy, bool, ( const char* name ),,
|
||||
DefineEngineMethod( SimObject, isInNamespaceHierarchy, bool, ( const char* name ),,
|
||||
"Test whether the namespace of this object is a direct or indirect child to the given namespace.\n"
|
||||
"@param name The name of a namespace.\n"
|
||||
"@return True if the given namespace name is within the namespace hierarchy of this object." )
|
||||
|
|
@ -3039,7 +3039,7 @@ DefineEngineMethod( SimObject, getGroup, SimGroup*, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, delete, void, (),,
|
||||
DefineEngineMethod( SimObject, delete, void, (),,
|
||||
"Delete and remove the object." )
|
||||
{
|
||||
object->deleteObject();
|
||||
|
|
@ -3047,7 +3047,7 @@ DefineConsoleMethod( SimObject, delete, void, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( SimObject,schedule, S32, 4, 0, "( float time, string method, string args... ) Delay an invocation of a method.\n"
|
||||
DefineEngineStringlyVariadicMethod( SimObject,schedule, S32, 4, 0, "( float time, string method, string args... ) Delay an invocation of a method.\n"
|
||||
"@param time The number of milliseconds after which to invoke the method. This is a soft limit.\n"
|
||||
"@param method The method to call.\n"
|
||||
"@param args The arguments with which to call the method.\n"
|
||||
|
|
@ -3067,7 +3067,7 @@ ConsoleMethod( SimObject,schedule, S32, 4, 0, "( float time, string method, stri
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, getDynamicFieldCount, S32, (),,
|
||||
DefineEngineMethod( SimObject, getDynamicFieldCount, S32, (),,
|
||||
"Get the number of dynamic fields defined on the object.\n"
|
||||
"@return The number of dynamic fields defined on the object." )
|
||||
{
|
||||
|
|
@ -3081,7 +3081,7 @@ DefineConsoleMethod( SimObject, getDynamicFieldCount, S32, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, getDynamicField, const char*, ( S32 index ),,
|
||||
DefineEngineMethod( SimObject, getDynamicField, const char*, ( S32 index ),,
|
||||
"Get a value of a dynamic field by index.\n"
|
||||
"@param index The index of the dynamic field.\n"
|
||||
"@return The value of the dynamic field at the given index or \"\"." )
|
||||
|
|
@ -3113,7 +3113,7 @@ DefineConsoleMethod( SimObject, getDynamicField, const char*, ( S32 index ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, getFieldCount, S32, (),,
|
||||
DefineEngineMethod( SimObject, getFieldCount, S32, (),,
|
||||
"Get the number of static fields on the object.\n"
|
||||
"@return The number of static fields defined on the object." )
|
||||
{
|
||||
|
|
@ -3135,7 +3135,7 @@ DefineConsoleMethod( SimObject, getFieldCount, S32, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimObject, getField, const char*, ( S32 index ),,
|
||||
DefineEngineMethod( SimObject, getField, const char*, ( S32 index ),,
|
||||
"Retrieve the value of a static field by index.\n"
|
||||
"@param index The index of the static field.\n"
|
||||
"@return The value of the static field with the given index or \"\"." )
|
||||
|
|
|
|||
|
|
@ -455,7 +455,6 @@ class SimObject: public ConsoleObject, public TamlCallbacks
|
|||
{
|
||||
T* object = new T;
|
||||
object->incRefCount();
|
||||
object->registerObject();
|
||||
return object;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ void SimPersistSet::addObject( SimObject* object )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimPersistSet, resolvePersistentIds, void, (), , "() - Try to bind unresolved persistent IDs in the set." )
|
||||
DefineEngineMethod( SimPersistSet, resolvePersistentIds, void, (), , "() - Try to bind unresolved persistent IDs in the set." )
|
||||
{
|
||||
object->resolvePIDs();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -895,15 +895,7 @@ DefineEngineMethod( SimSet, listObjects, void, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DEFINE_CALLIN( fnSimSet_add, add, SimSet, void, ( SimSet* set, SimObject* object ),,,
|
||||
"Add the given object to the set.\n"
|
||||
"@param object An object." )
|
||||
{
|
||||
if( object )
|
||||
set->addObject( object );
|
||||
}
|
||||
|
||||
ConsoleMethod( SimSet, add, void, 3, 0,
|
||||
DefineEngineStringlyVariadicMethod( SimSet, add, void, 3, 0,
|
||||
"( SimObject objects... ) Add the given objects to the set.\n"
|
||||
"@param objects The objects to add to the set." )
|
||||
{
|
||||
|
|
@ -919,15 +911,7 @@ ConsoleMethod( SimSet, add, void, 3, 0,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DEFINE_CALLIN( fnSimSet_remove, remove, SimSet, void, ( SimSet* set, SimObject* object ),,,
|
||||
"Remove the given object from the set.\n"
|
||||
"@param object An object." )
|
||||
{
|
||||
if( object )
|
||||
set->removeObject( object );
|
||||
}
|
||||
|
||||
ConsoleMethod( SimSet, remove, void, 3, 0,
|
||||
DefineEngineStringlyVariadicMethod( SimSet, remove, void, 3, 0,
|
||||
"( SimObject objects... ) Remove the given objects from the set.\n"
|
||||
"@param objects The objects to remove from the set." )
|
||||
{
|
||||
|
|
@ -954,7 +938,7 @@ DefineEngineMethod( SimSet, clear, void, (),,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
//UNSAFE; don't want this in the new API
|
||||
DefineConsoleMethod( SimSet, deleteAllObjects, void, (), , "() Delete all objects in the set." )
|
||||
DefineEngineMethod( SimSet, deleteAllObjects, void, (), , "() Delete all objects in the set." )
|
||||
{
|
||||
object->deleteAllObjects();
|
||||
}
|
||||
|
|
@ -970,7 +954,7 @@ DefineEngineMethod( SimSet, getRandom, SimObject*, (),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( SimSet, callOnChildren, void, 3, 0,
|
||||
DefineEngineStringlyVariadicMethod( SimSet, callOnChildren, void, 3, 0,
|
||||
"( string method, string args... ) Call a method on all objects contained in the set.\n\n"
|
||||
"@param method The name of the method to call.\n"
|
||||
"@param args The arguments to the method.\n\n"
|
||||
|
|
@ -982,7 +966,7 @@ ConsoleMethod( SimSet, callOnChildren, void, 3, 0,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( SimSet, callOnChildrenNoRecurse, void, 3, 0,
|
||||
DefineEngineStringlyVariadicMethod( SimSet, callOnChildrenNoRecurse, void, 3, 0,
|
||||
"( string method, string args... ) Call a method on all objects contained in the set.\n\n"
|
||||
"@param method The name of the method to call.\n"
|
||||
"@param args The arguments to the method.\n\n"
|
||||
|
|
@ -1026,7 +1010,7 @@ DEFINE_CALLIN( fnSimSet_getCountRecursive, getCountRecursive, SimSet, U32, ( Sim
|
|||
return set->sizeRecursive();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( SimSet, getFullCount, S32, (), , "() Get the number of direct and indirect child objects contained in the set.\n"
|
||||
DefineEngineMethod( SimSet, getFullCount, S32, (), , "() Get the number of direct and indirect child objects contained in the set.\n"
|
||||
"@return The number of objects contained in the set as well as in other sets contained directly or indirectly in the set." )
|
||||
{
|
||||
return object->sizeRecursive();
|
||||
|
|
@ -1122,7 +1106,7 @@ DefineEngineMethod( SimSet, pushToBack, void, ( SimObject* obj ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( SimSet, sort, void, ( const char * callbackFunction ), , "( string callbackFunction ) Sort the objects in the set using the given comparison function.\n"
|
||||
DefineEngineMethod( SimSet, sort, void, ( const char * callbackFunction ), , "( string callbackFunction ) Sort the objects in the set using the given comparison function.\n"
|
||||
"@param callbackFunction Name of a function that takes two object arguments A and B and returns -1 if A is less, 1 if B is less, and 0 if both are equal." )
|
||||
{
|
||||
object->scriptSort( callbackFunction );
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ void TelnetConsole::destroy()
|
|||
TelConsole = NULL;
|
||||
}
|
||||
|
||||
DefineConsoleFunction( telnetSetParameters, void, ( int port, const char* consolePass, const char* listenPass, bool remoteEcho ), ( false ),
|
||||
DefineEngineFunction( telnetSetParameters, void, ( int port, const char* consolePass, const char* listenPass, bool remoteEcho ), ( false ),
|
||||
"@brief Initializes and open the telnet console.\n\n"
|
||||
"@param port Port to listen on for console connections (0 will shut down listening).\n"
|
||||
"@param consolePass Password for read/write access to console.\n"
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ MODULE_END;
|
|||
// BRKCLR file line - sent when a breakpoint cannot be moved to a breakable line on the client.
|
||||
//
|
||||
|
||||
DefineConsoleFunction( dbgSetParameters, void, (S32 port, const char * password, bool waitForClient ), (false), "( int port, string password, bool waitForClient )"
|
||||
DefineEngineFunction( dbgSetParameters, void, (S32 port, const char * password, bool waitForClient ), (false), "( int port, string password, bool waitForClient )"
|
||||
"Open a debug server port on the specified port, requiring the specified password, "
|
||||
"and optionally waiting for the debug client to connect.\n"
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
|
|
@ -124,14 +124,14 @@ DefineConsoleFunction( dbgSetParameters, void, (S32 port, const char * password,
|
|||
}
|
||||
}
|
||||
|
||||
DefineConsoleFunction( dbgIsConnected, bool, (), , "()"
|
||||
DefineEngineFunction( dbgIsConnected, bool, (), , "()"
|
||||
"Returns true if a script debugging client is connected else return false.\n"
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
{
|
||||
return TelDebugger && TelDebugger->isConnected();
|
||||
}
|
||||
|
||||
DefineConsoleFunction( dbgDisconnect, void, (), , "()"
|
||||
DefineEngineFunction( dbgDisconnect, void, (), , "()"
|
||||
"Forcibly disconnects any attached script debugging client.\n"
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue