mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
fixed lots of tabs and space
This commit is contained in:
parent
d30a3f9271
commit
bb38a40bcb
53 changed files with 2695 additions and 2695 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -49,40 +49,40 @@ ConsoleDocClass( SimXMLDocument,
|
|||
"// Thanks to Rex Hiebert for this example\n"
|
||||
"// Given the following XML\n"
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n"
|
||||
"<DataTables>\n"
|
||||
" <table tableName=\"2DShapes\">\n"
|
||||
" <rec id=\"1\">Triangle</rec>\n"
|
||||
" <rec id=\"2\">Square</rec>\n"
|
||||
" <rec id=\"3\">Circle</rec>\n"
|
||||
" </table>\n"
|
||||
" <table tableName=\"3DShapes\">\n"
|
||||
" <rec id=\"1\">Pyramid</rec>\n"
|
||||
" <rec id=\"2\">Cube</rec>\n"
|
||||
" <rec id=\"3\">Sphere</rec>\n"
|
||||
" </table>\n"
|
||||
"</DataTables>\n\n"
|
||||
"<DataTables>\n"
|
||||
" <table tableName=\"2DShapes\">\n"
|
||||
" <rec id=\"1\">Triangle</rec>\n"
|
||||
" <rec id=\"2\">Square</rec>\n"
|
||||
" <rec id=\"3\">Circle</rec>\n"
|
||||
" </table>\n"
|
||||
" <table tableName=\"3DShapes\">\n"
|
||||
" <rec id=\"1\">Pyramid</rec>\n"
|
||||
" <rec id=\"2\">Cube</rec>\n"
|
||||
" <rec id=\"3\">Sphere</rec>\n"
|
||||
" </table>\n"
|
||||
"</DataTables>\n\n"
|
||||
"// Using SimXMLDocument by itself\n"
|
||||
"function readXmlExample(%filename)\n"
|
||||
"{\n"
|
||||
" %xml = new SimXMLDocument() {};\n"
|
||||
" %xml.loadFile(%filename);\n\n"
|
||||
" %xml.pushChildElement(\"DataTables\");\n"
|
||||
" %xml.pushFirstChildElement(\"table\");\n"
|
||||
" while(true)\n"
|
||||
" {\n"
|
||||
" echo(\"TABLE:\" SPC %xml.attribute(\"tableName\"));\n"
|
||||
" %xml.pushFirstChildElement(\"rec\");\n"
|
||||
" while (true)\n"
|
||||
" {\n"
|
||||
" %id = %xml.attribute(\"id\");\n"
|
||||
" %desc = %xml.getData();\n"
|
||||
" echo(\" Shape\" SPC %id SPC %desc);\n"
|
||||
" if (!%xml.nextSiblingElement(\"rec\")) break;\n"
|
||||
" }\n"
|
||||
" %xml.popElement();\n"
|
||||
" if (!%xml.nextSiblingElement(\"table\")) break;\n"
|
||||
" }\n"
|
||||
"}\n\n"
|
||||
"{\n"
|
||||
" %xml = new SimXMLDocument() {};\n"
|
||||
" %xml.loadFile(%filename);\n\n"
|
||||
" %xml.pushChildElement(\"DataTables\");\n"
|
||||
" %xml.pushFirstChildElement(\"table\");\n"
|
||||
" while(true)\n"
|
||||
" {\n"
|
||||
" echo(\"TABLE:\" SPC %xml.attribute(\"tableName\"));\n"
|
||||
" %xml.pushFirstChildElement(\"rec\");\n"
|
||||
" while (true)\n"
|
||||
" {\n"
|
||||
" %id = %xml.attribute(\"id\");\n"
|
||||
" %desc = %xml.getData();\n"
|
||||
" echo(\" Shape\" SPC %id SPC %desc);\n"
|
||||
" if (!%xml.nextSiblingElement(\"rec\")) break;\n"
|
||||
" }\n"
|
||||
" %xml.popElement();\n"
|
||||
" if (!%xml.nextSiblingElement(\"table\")) break;\n"
|
||||
" }\n"
|
||||
"}\n\n"
|
||||
|
||||
"// Thanks to Scott Peal for this example\n"
|
||||
"// Using FileObject in conjunction with SimXMLDocument\n"
|
||||
|
|
@ -90,45 +90,45 @@ ConsoleDocClass( SimXMLDocument,
|
|||
"// <Models>\n"
|
||||
"// <Model category=\"\" name=\"\" path=\"\" />\n"
|
||||
"// </Models>\n"
|
||||
"function getModelsInCatagory()\n"
|
||||
"{\n"
|
||||
" %file = \"./Catalog.xml\";\n"
|
||||
" %fo = new FileObject();\n"
|
||||
" %text = \"\";\n\n"
|
||||
" if(%fo.openForRead(%file))\n"
|
||||
" {\n"
|
||||
" while(!%fo.isEOF())\n"
|
||||
" {\n"
|
||||
" %text = %text @ %fo.readLine();\n"
|
||||
" if (!%fo.isEOF()) %text = %text @ \"\\n\";\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" echo(\"Unable to locate the file: \" @ %file);\n"
|
||||
" }\n\n"
|
||||
" %fo.delete();\n\n"
|
||||
" %xml = new SimXMLDocument() {};\n"
|
||||
" %xml.parse(%text);\n"
|
||||
" // \"Get\" inside of the root element, \"Models\".\n"
|
||||
" %xml.pushChildElement(0);\n\n"
|
||||
" // \"Get\" into the first child element\n"
|
||||
" if (%xml.pushFirstChildElement(\"Model\"))\n"
|
||||
" {\n"
|
||||
" while (true)\n"
|
||||
" {\n"
|
||||
" // \n"
|
||||
" // Here, i read the element's attributes.\n"
|
||||
" // You might want to save these values in an array or call the %xml.getElementValue()\n"
|
||||
" // if you have a different XML structure.\n\n"
|
||||
" %catagory = %xml.attribute(\"catagory\");\n"
|
||||
" %name = %xml.attribute(\"name\");\n"
|
||||
" %path = %xml.attribute(\"path\");\n\n"
|
||||
" // now, read the next \"Model\"\n"
|
||||
" if (!%xml.nextSiblingElement(\"Model\")) break;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"function getModelsInCatagory()\n"
|
||||
"{\n"
|
||||
" %file = \"./Catalog.xml\";\n"
|
||||
" %fo = new FileObject();\n"
|
||||
" %text = \"\";\n\n"
|
||||
" if(%fo.openForRead(%file))\n"
|
||||
" {\n"
|
||||
" while(!%fo.isEOF())\n"
|
||||
" {\n"
|
||||
" %text = %text @ %fo.readLine();\n"
|
||||
" if (!%fo.isEOF()) %text = %text @ \"\\n\";\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" echo(\"Unable to locate the file: \" @ %file);\n"
|
||||
" }\n\n"
|
||||
" %fo.delete();\n\n"
|
||||
" %xml = new SimXMLDocument() {};\n"
|
||||
" %xml.parse(%text);\n"
|
||||
" // \"Get\" inside of the root element, \"Models\".\n"
|
||||
" %xml.pushChildElement(0);\n\n"
|
||||
" // \"Get\" into the first child element\n"
|
||||
" if (%xml.pushFirstChildElement(\"Model\"))\n"
|
||||
" {\n"
|
||||
" while (true)\n"
|
||||
" {\n"
|
||||
" // \n"
|
||||
" // Here, i read the element's attributes.\n"
|
||||
" // You might want to save these values in an array or call the %xml.getElementValue()\n"
|
||||
" // if you have a different XML structure.\n\n"
|
||||
" %catagory = %xml.attribute(\"catagory\");\n"
|
||||
" %name = %xml.attribute(\"name\");\n"
|
||||
" %path = %xml.attribute(\"path\");\n\n"
|
||||
" // now, read the next \"Model\"\n"
|
||||
" if (!%xml.nextSiblingElement(\"Model\")) break;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@note SimXMLDocument is a wrapper around TinyXml, a standard XML library. If you're familiar "
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class SimXMLDocument: public SimObject
|
|||
{
|
||||
// This typedef is required for tie ins with the script language.
|
||||
// --------------------------------------------------------------------------
|
||||
protected:
|
||||
protected:
|
||||
typedef SimObject Parent;
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -85,8 +85,8 @@ class SimXMLDocument: public SimObject
|
|||
bool nextSiblingElement(const char* rName);
|
||||
// push child element at index onto stack.
|
||||
bool pushChildElement(S32 index);
|
||||
// Get element value
|
||||
const char* elementValue();
|
||||
// Get element value
|
||||
const char* elementValue();
|
||||
|
||||
// Pop last element off of stack.
|
||||
void popElement(void);
|
||||
|
|
@ -94,16 +94,16 @@ class SimXMLDocument: public SimObject
|
|||
// Get attribute from top element on element stack.
|
||||
const char* attribute(const char* rAttribute);
|
||||
|
||||
// Does the attribute exist in the current element
|
||||
// Does the attribute exist in the current element
|
||||
bool attributeExists(const char* rAttribute);
|
||||
|
||||
// Obtain the name of the current element's first or last attribute
|
||||
const char* firstAttribute();
|
||||
const char* lastAttribute();
|
||||
// Obtain the name of the current element's first or last attribute
|
||||
const char* firstAttribute();
|
||||
const char* lastAttribute();
|
||||
|
||||
// Move through the current element's attributes to obtain their names
|
||||
const char* nextAttribute();
|
||||
const char* prevAttribute();
|
||||
// Move through the current element's attributes to obtain their names
|
||||
const char* nextAttribute();
|
||||
const char* prevAttribute();
|
||||
|
||||
// Set attribute of top element on element stack.
|
||||
void setAttribute(const char* rAttribute, const char* rVal);
|
||||
|
|
@ -139,8 +139,8 @@ class SimXMLDocument: public SimObject
|
|||
TiXmlDocument* m_qDocument;
|
||||
// Stack of nodes.
|
||||
Vector<TiXmlElement*> m_paNode;
|
||||
// The current attribute
|
||||
TiXmlAttribute* m_CurrentAttribute;
|
||||
// The current attribute
|
||||
TiXmlAttribute* m_CurrentAttribute;
|
||||
|
||||
public:
|
||||
DECLARE_CONOBJECT(SimXMLDocument);
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public:
|
|||
|
||||
/// Returns the value for a given index.
|
||||
/// Will return a null value for an invalid index
|
||||
const String& getValueFromIndex( S32 index ) const;
|
||||
const String& getValueFromIndex( S32 index ) const;
|
||||
|
||||
///
|
||||
S32 getIndexFromKeyValue( const String &key, const String &value ) const;
|
||||
|
|
|
|||
|
|
@ -11,78 +11,78 @@
|
|||
#define yychar CMDchar
|
||||
#define yydebug CMDdebug
|
||||
#define yynerrs CMDnerrs
|
||||
#define rwDEFINE 258
|
||||
#define rwENDDEF 259
|
||||
#define rwDECLARE 260
|
||||
#define rwDECLARESINGLETON 261
|
||||
#define rwBREAK 262
|
||||
#define rwELSE 263
|
||||
#define rwCONTINUE 264
|
||||
#define rwGLOBAL 265
|
||||
#define rwIF 266
|
||||
#define rwNIL 267
|
||||
#define rwRETURN 268
|
||||
#define rwWHILE 269
|
||||
#define rwDO 270
|
||||
#define rwENDIF 271
|
||||
#define rwENDWHILE 272
|
||||
#define rwENDFOR 273
|
||||
#define rwDEFAULT 274
|
||||
#define rwFOR 275
|
||||
#define rwFOREACH 276
|
||||
#define rwFOREACHSTR 277
|
||||
#define rwIN 278
|
||||
#define rwDATABLOCK 279
|
||||
#define rwSWITCH 280
|
||||
#define rwCASE 281
|
||||
#define rwSWITCHSTR 282
|
||||
#define rwCASEOR 283
|
||||
#define rwPACKAGE 284
|
||||
#define rwNAMESPACE 285
|
||||
#define rwCLASS 286
|
||||
#define rwASSERT 287
|
||||
#define ILLEGAL_TOKEN 288
|
||||
#define CHRCONST 289
|
||||
#define INTCONST 290
|
||||
#define TTAG 291
|
||||
#define VAR 292
|
||||
#define IDENT 293
|
||||
#define TYPEIDENT 294
|
||||
#define DOCBLOCK 295
|
||||
#define STRATOM 296
|
||||
#define TAGATOM 297
|
||||
#define FLTCONST 298
|
||||
#define opINTNAME 299
|
||||
#define opINTNAMER 300
|
||||
#define opMINUSMINUS 301
|
||||
#define opPLUSPLUS 302
|
||||
#define STMT_SEP 303
|
||||
#define opSHL 304
|
||||
#define opSHR 305
|
||||
#define opPLASN 306
|
||||
#define opMIASN 307
|
||||
#define opMLASN 308
|
||||
#define opDVASN 309
|
||||
#define opMODASN 310
|
||||
#define opANDASN 311
|
||||
#define opXORASN 312
|
||||
#define opORASN 313
|
||||
#define opSLASN 314
|
||||
#define opSRASN 315
|
||||
#define opCAT 316
|
||||
#define opEQ 317
|
||||
#define opNE 318
|
||||
#define opGE 319
|
||||
#define opLE 320
|
||||
#define opAND 321
|
||||
#define opOR 322
|
||||
#define opSTREQ 323
|
||||
#define opCOLONCOLON 324
|
||||
#define opMDASN 325
|
||||
#define opNDASN 326
|
||||
#define opNTASN 327
|
||||
#define opSTRNE 328
|
||||
#define UNARY 329
|
||||
#define rwDEFINE 258
|
||||
#define rwENDDEF 259
|
||||
#define rwDECLARE 260
|
||||
#define rwDECLARESINGLETON 261
|
||||
#define rwBREAK 262
|
||||
#define rwELSE 263
|
||||
#define rwCONTINUE 264
|
||||
#define rwGLOBAL 265
|
||||
#define rwIF 266
|
||||
#define rwNIL 267
|
||||
#define rwRETURN 268
|
||||
#define rwWHILE 269
|
||||
#define rwDO 270
|
||||
#define rwENDIF 271
|
||||
#define rwENDWHILE 272
|
||||
#define rwENDFOR 273
|
||||
#define rwDEFAULT 274
|
||||
#define rwFOR 275
|
||||
#define rwFOREACH 276
|
||||
#define rwFOREACHSTR 277
|
||||
#define rwIN 278
|
||||
#define rwDATABLOCK 279
|
||||
#define rwSWITCH 280
|
||||
#define rwCASE 281
|
||||
#define rwSWITCHSTR 282
|
||||
#define rwCASEOR 283
|
||||
#define rwPACKAGE 284
|
||||
#define rwNAMESPACE 285
|
||||
#define rwCLASS 286
|
||||
#define rwASSERT 287
|
||||
#define ILLEGAL_TOKEN 288
|
||||
#define CHRCONST 289
|
||||
#define INTCONST 290
|
||||
#define TTAG 291
|
||||
#define VAR 292
|
||||
#define IDENT 293
|
||||
#define TYPEIDENT 294
|
||||
#define DOCBLOCK 295
|
||||
#define STRATOM 296
|
||||
#define TAGATOM 297
|
||||
#define FLTCONST 298
|
||||
#define opINTNAME 299
|
||||
#define opINTNAMER 300
|
||||
#define opMINUSMINUS 301
|
||||
#define opPLUSPLUS 302
|
||||
#define STMT_SEP 303
|
||||
#define opSHL 304
|
||||
#define opSHR 305
|
||||
#define opPLASN 306
|
||||
#define opMIASN 307
|
||||
#define opMLASN 308
|
||||
#define opDVASN 309
|
||||
#define opMODASN 310
|
||||
#define opANDASN 311
|
||||
#define opXORASN 312
|
||||
#define opORASN 313
|
||||
#define opSLASN 314
|
||||
#define opSRASN 315
|
||||
#define opCAT 316
|
||||
#define opEQ 317
|
||||
#define opNE 318
|
||||
#define opGE 319
|
||||
#define opLE 320
|
||||
#define opAND 321
|
||||
#define opOR 322
|
||||
#define opSTREQ 323
|
||||
#define opCOLONCOLON 324
|
||||
#define opMDASN 325
|
||||
#define opNDASN 326
|
||||
#define opNTASN 327
|
||||
#define opSTRNE 328
|
||||
#define UNARY 329
|
||||
|
||||
#line 1 "cmdgram.y"
|
||||
|
||||
|
|
@ -182,9 +182,9 @@ typedef
|
|||
|
||||
|
||||
|
||||
#define YYFINAL 388
|
||||
#define YYFLAG -32768
|
||||
#define YYNTBASE 100
|
||||
#define YYFINAL 388
|
||||
#define YYFLAG -32768
|
||||
#define YYNTBASE 100
|
||||
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 329 ? yytranslate[x] : 140)
|
||||
|
||||
|
|
@ -502,7 +502,7 @@ static const short yypgoto[] = {-32768,
|
|||
};
|
||||
|
||||
|
||||
#define YYLAST 3042
|
||||
#define YYLAST 3042
|
||||
|
||||
|
||||
static const short yytable[] = { 47,
|
||||
|
|
@ -1183,50 +1183,50 @@ void *alloca ();
|
|||
It is replaced by the list of actions, each action
|
||||
as one case of the switch. */
|
||||
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
#define yyclearin (yychar = YYEMPTY)
|
||||
#define YYEMPTY -2
|
||||
#define YYEOF 0
|
||||
#define YYACCEPT return(0)
|
||||
#define YYABORT return(1)
|
||||
#define YYERROR goto yyerrlab1
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
#define yyclearin (yychar = YYEMPTY)
|
||||
#define YYEMPTY -2
|
||||
#define YYEOF 0
|
||||
#define YYACCEPT return(0)
|
||||
#define YYABORT return(1)
|
||||
#define YYERROR goto yyerrlab1
|
||||
/* Like YYERROR except do call yyerror.
|
||||
This remains here temporarily to ease the
|
||||
transition to the new meaning of YYERROR, for GCC.
|
||||
Once GCC version 2 has supplanted version 1, this can go. */
|
||||
#define YYFAIL goto yyerrlab
|
||||
#define YYFAIL goto yyerrlab
|
||||
#define YYRECOVERING() (!!yyerrstatus)
|
||||
#define YYBACKUP(token, value) \
|
||||
do \
|
||||
if (yychar == YYEMPTY && yylen == 1) \
|
||||
{ yychar = (token), yylval = (value); \
|
||||
yychar1 = YYTRANSLATE (yychar); \
|
||||
YYPOPSTACK; \
|
||||
goto yybackup; \
|
||||
} \
|
||||
else \
|
||||
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
|
||||
do \
|
||||
if (yychar == YYEMPTY && yylen == 1) \
|
||||
{ yychar = (token), yylval = (value); \
|
||||
yychar1 = YYTRANSLATE (yychar); \
|
||||
YYPOPSTACK; \
|
||||
goto yybackup; \
|
||||
} \
|
||||
else \
|
||||
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
|
||||
while (0)
|
||||
|
||||
#define YYTERROR 1
|
||||
#define YYERRCODE 256
|
||||
#define YYTERROR 1
|
||||
#define YYERRCODE 256
|
||||
|
||||
#ifndef YYPURE
|
||||
#define YYLEX yylex()
|
||||
#define YYLEX yylex()
|
||||
#endif
|
||||
|
||||
#ifdef YYPURE
|
||||
#ifdef YYLSP_NEEDED
|
||||
#ifdef YYLEX_PARAM
|
||||
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
|
||||
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
|
||||
#else
|
||||
#define YYLEX yylex(&yylval, &yylloc)
|
||||
#define YYLEX yylex(&yylval, &yylloc)
|
||||
#endif
|
||||
#else /* not YYLSP_NEEDED */
|
||||
#ifdef YYLEX_PARAM
|
||||
#define YYLEX yylex(&yylval, YYLEX_PARAM)
|
||||
#define YYLEX yylex(&yylval, YYLEX_PARAM)
|
||||
#else
|
||||
#define YYLEX yylex(&yylval)
|
||||
#define YYLEX yylex(&yylval)
|
||||
#endif
|
||||
#endif /* not YYLSP_NEEDED */
|
||||
#endif
|
||||
|
|
@ -1235,27 +1235,27 @@ while (0)
|
|||
|
||||
#ifndef YYPURE
|
||||
|
||||
int yychar; /* the lookahead symbol */
|
||||
YYSTYPE yylval; /* the semantic value of the */
|
||||
/* lookahead symbol */
|
||||
int yychar; /* the lookahead symbol */
|
||||
YYSTYPE yylval; /* the semantic value of the */
|
||||
/* lookahead symbol */
|
||||
|
||||
#ifdef YYLSP_NEEDED
|
||||
YYLTYPE yylloc; /* location data for the lookahead */
|
||||
/* symbol */
|
||||
YYLTYPE yylloc; /* location data for the lookahead */
|
||||
/* symbol */
|
||||
#endif
|
||||
|
||||
int yynerrs; /* number of parse errors so far */
|
||||
int yynerrs; /* number of parse errors so far */
|
||||
#endif /* not YYPURE */
|
||||
|
||||
#if YYDEBUG != 0
|
||||
int yydebug; /* nonzero means print parse trace */
|
||||
int yydebug; /* nonzero means print parse trace */
|
||||
/* Since this is uninitialized, it does not stop multiple parsers
|
||||
from coexisting. */
|
||||
#endif
|
||||
|
||||
/* YYINITDEPTH indicates the initial size of the parser's stacks */
|
||||
/* YYINITDEPTH indicates the initial size of the parser's stacks */
|
||||
|
||||
#ifndef YYINITDEPTH
|
||||
#ifndef YYINITDEPTH
|
||||
#define YYINITDEPTH 200
|
||||
#endif
|
||||
|
||||
|
|
@ -1275,9 +1275,9 @@ int yydebug; /* nonzero means print parse trace */
|
|||
int yyparse (void);
|
||||
#endif
|
||||
|
||||
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
||||
#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
||||
#else /* not GNU C or C++ */
|
||||
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
||||
#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
||||
#else /* not GNU C or C++ */
|
||||
#ifndef __cplusplus
|
||||
|
||||
/* This is the most reliable way to avoid incompatibilities
|
||||
|
|
@ -1337,17 +1337,17 @@ yyparse(YYPARSE_PARAM)
|
|||
int yyn;
|
||||
short *yyssp;
|
||||
YYSTYPE *yyvsp;
|
||||
int yyerrstatus; /* number of tokens to shift before error messages enabled */
|
||||
int yychar1 = 0; /* lookahead token as an internal (translated) token number */
|
||||
int yyerrstatus; /* number of tokens to shift before error messages enabled */
|
||||
int yychar1 = 0; /* lookahead token as an internal (translated) token number */
|
||||
|
||||
short yyssa[YYINITDEPTH]; /* the state stack */
|
||||
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
|
||||
short yyssa[YYINITDEPTH]; /* the state stack */
|
||||
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
|
||||
|
||||
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
|
||||
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
|
||||
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
|
||||
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
|
||||
|
||||
#ifdef YYLSP_NEEDED
|
||||
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
|
||||
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
|
||||
YYLTYPE *yyls = yylsa;
|
||||
YYLTYPE *yylsp;
|
||||
|
||||
|
|
@ -1367,9 +1367,9 @@ yyparse(YYPARSE_PARAM)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
YYSTYPE yyval; /* the variable used to return */
|
||||
/* semantic values from the action */
|
||||
/* routines */
|
||||
YYSTYPE yyval; /* the variable used to return */
|
||||
/* semantic values from the action */
|
||||
/* routines */
|
||||
|
||||
int yylen;
|
||||
|
||||
|
|
@ -1381,7 +1381,7 @@ yyparse(YYPARSE_PARAM)
|
|||
yystate = 0;
|
||||
yyerrstatus = 0;
|
||||
yynerrs = 0;
|
||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||
|
||||
/* Initialize stack pointers.
|
||||
Waste one element of value and location stack
|
||||
|
|
@ -1416,20 +1416,20 @@ yynewstate:
|
|||
|
||||
#ifdef yyoverflow
|
||||
/* Each stack pointer address is followed by the size of
|
||||
the data in use in that stack, in bytes. */
|
||||
the data in use in that stack, in bytes. */
|
||||
#ifdef YYLSP_NEEDED
|
||||
/* This used to be a conditional around just the two extra args,
|
||||
but that might be undefined if yyoverflow is a macro. */
|
||||
but that might be undefined if yyoverflow is a macro. */
|
||||
yyoverflow("parser stack overflow",
|
||||
&yyss1, size * sizeof (*yyssp),
|
||||
&yyvs1, size * sizeof (*yyvsp),
|
||||
&yyls1, size * sizeof (*yylsp),
|
||||
&yystacksize);
|
||||
&yyss1, size * sizeof (*yyssp),
|
||||
&yyvs1, size * sizeof (*yyvsp),
|
||||
&yyls1, size * sizeof (*yylsp),
|
||||
&yystacksize);
|
||||
#else
|
||||
yyoverflow("parser stack overflow",
|
||||
&yyss1, size * sizeof (*yyssp),
|
||||
&yyvs1, size * sizeof (*yyvsp),
|
||||
&yystacksize);
|
||||
&yyss1, size * sizeof (*yyssp),
|
||||
&yyvs1, size * sizeof (*yyvsp),
|
||||
&yystacksize);
|
||||
#endif
|
||||
|
||||
yyss = yyss1; yyvs = yyvs1;
|
||||
|
|
@ -1439,13 +1439,13 @@ yynewstate:
|
|||
#else /* no yyoverflow */
|
||||
/* Extend the stack our own way. */
|
||||
if (yystacksize >= YYMAXDEPTH)
|
||||
{
|
||||
yyerror("parser stack overflow");
|
||||
return 2;
|
||||
}
|
||||
{
|
||||
yyerror("parser stack overflow");
|
||||
return 2;
|
||||
}
|
||||
yystacksize *= 2;
|
||||
if (yystacksize > YYMAXDEPTH)
|
||||
yystacksize = YYMAXDEPTH;
|
||||
yystacksize = YYMAXDEPTH;
|
||||
yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
|
||||
__yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
|
||||
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
|
||||
|
|
@ -1464,11 +1464,11 @@ yynewstate:
|
|||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
|
||||
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
|
||||
#endif
|
||||
|
||||
if (yyssp >= yyss + yystacksize - 1)
|
||||
YYABORT;
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
#if YYDEBUG != 0
|
||||
|
|
@ -1498,21 +1498,21 @@ yynewstate:
|
|||
{
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Reading a token: ");
|
||||
fprintf(stderr, "Reading a token: ");
|
||||
#endif
|
||||
yychar = YYLEX;
|
||||
}
|
||||
|
||||
/* Convert token to internal form (in yychar1) for indexing tables with */
|
||||
|
||||
if (yychar <= 0) /* This means end of input. */
|
||||
if (yychar <= 0) /* This means end of input. */
|
||||
{
|
||||
yychar1 = 0;
|
||||
yychar = YYEOF; /* Don't call YYLEX any more */
|
||||
yychar = YYEOF; /* Don't call YYLEX any more */
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Now at end of input.\n");
|
||||
fprintf(stderr, "Now at end of input.\n");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
|
@ -1521,15 +1521,15 @@ yynewstate:
|
|||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
{
|
||||
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
|
||||
/* Give the individual parser a way to print the precise meaning
|
||||
of a token, for further debugging info. */
|
||||
{
|
||||
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
|
||||
/* Give the individual parser a way to print the precise meaning
|
||||
of a token, for further debugging info. */
|
||||
#ifdef YYPRINT
|
||||
YYPRINT (stderr, yychar, yylval);
|
||||
YYPRINT (stderr, yychar, yylval);
|
||||
#endif
|
||||
fprintf (stderr, ")\n");
|
||||
}
|
||||
fprintf (stderr, ")\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1549,7 +1549,7 @@ yynewstate:
|
|||
if (yyn < 0)
|
||||
{
|
||||
if (yyn == YYFLAG)
|
||||
goto yyerrlab;
|
||||
goto yyerrlab;
|
||||
yyn = -yyn;
|
||||
goto yyreduce;
|
||||
}
|
||||
|
|
@ -1600,11 +1600,11 @@ yyreduce:
|
|||
int i;
|
||||
|
||||
fprintf (stderr, "Reducing via rule %d (line %d), ",
|
||||
yyn, yyrline[yyn]);
|
||||
yyn, yyrline[yyn]);
|
||||
|
||||
/* Print the symbols being reduced, and their result. */
|
||||
for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
|
||||
fprintf (stderr, "%s ", yytname[yyrhs[i]]);
|
||||
fprintf (stderr, "%s ", yytname[yyrhs[i]]);
|
||||
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -2265,7 +2265,7 @@ case 162:
|
|||
short *ssp1 = yyss - 1;
|
||||
fprintf (stderr, "state stack now");
|
||||
while (ssp1 != yyssp)
|
||||
fprintf (stderr, " %d", *++ssp1);
|
||||
fprintf (stderr, " %d", *++ssp1);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
|
|
@ -2315,44 +2315,44 @@ yyerrlab: /* here on detecting error */
|
|||
yyn = yypact[yystate];
|
||||
|
||||
if (yyn > YYFLAG && yyn < YYLAST)
|
||||
{
|
||||
int size = 0;
|
||||
char *msg;
|
||||
int x, count;
|
||||
{
|
||||
int size = 0;
|
||||
char *msg;
|
||||
int x, count;
|
||||
|
||||
count = 0;
|
||||
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */
|
||||
for (x = (yyn < 0 ? -yyn : 0);
|
||||
x < (sizeof(yytname) / sizeof(char *)); x++)
|
||||
if (yycheck[x + yyn] == x)
|
||||
size += strlen(yytname[x]) + 15, count++;
|
||||
msg = (char *) malloc(size + 15);
|
||||
if (msg != 0)
|
||||
{
|
||||
strcpy(msg, "parse error");
|
||||
count = 0;
|
||||
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */
|
||||
for (x = (yyn < 0 ? -yyn : 0);
|
||||
x < (sizeof(yytname) / sizeof(char *)); x++)
|
||||
if (yycheck[x + yyn] == x)
|
||||
size += strlen(yytname[x]) + 15, count++;
|
||||
msg = (char *) malloc(size + 15);
|
||||
if (msg != 0)
|
||||
{
|
||||
strcpy(msg, "parse error");
|
||||
|
||||
if (count < 5)
|
||||
{
|
||||
count = 0;
|
||||
for (x = (yyn < 0 ? -yyn : 0);
|
||||
x < (sizeof(yytname) / sizeof(char *)); x++)
|
||||
if (yycheck[x + yyn] == x)
|
||||
{
|
||||
strcat(msg, count == 0 ? ", expecting `" : " or `");
|
||||
strcat(msg, yytname[x]);
|
||||
strcat(msg, "'");
|
||||
count++;
|
||||
}
|
||||
}
|
||||
yyerror(msg);
|
||||
free(msg);
|
||||
}
|
||||
else
|
||||
yyerror ("parse error; also virtual memory exceeded");
|
||||
}
|
||||
if (count < 5)
|
||||
{
|
||||
count = 0;
|
||||
for (x = (yyn < 0 ? -yyn : 0);
|
||||
x < (sizeof(yytname) / sizeof(char *)); x++)
|
||||
if (yycheck[x + yyn] == x)
|
||||
{
|
||||
strcat(msg, count == 0 ? ", expecting `" : " or `");
|
||||
strcat(msg, yytname[x]);
|
||||
strcat(msg, "'");
|
||||
count++;
|
||||
}
|
||||
}
|
||||
yyerror(msg);
|
||||
free(msg);
|
||||
}
|
||||
else
|
||||
yyerror ("parse error; also virtual memory exceeded");
|
||||
}
|
||||
else
|
||||
#endif /* YYERROR_VERBOSE */
|
||||
yyerror("parse error");
|
||||
yyerror("parse error");
|
||||
}
|
||||
|
||||
goto yyerrlab1;
|
||||
|
|
@ -2364,11 +2364,11 @@ yyerrlab1: /* here on error raised explicitly by an action */
|
|||
|
||||
/* return failure if at end of input */
|
||||
if (yychar == YYEOF)
|
||||
YYABORT;
|
||||
YYABORT;
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
|
||||
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
|
||||
#endif
|
||||
|
||||
yychar = YYEMPTY;
|
||||
|
|
@ -2377,7 +2377,7 @@ yyerrlab1: /* here on error raised explicitly by an action */
|
|||
/* Else will try to reuse lookahead token
|
||||
after shifting the error token. */
|
||||
|
||||
yyerrstatus = 3; /* Each real token shifted decrements this */
|
||||
yyerrstatus = 3; /* Each real token shifted decrements this */
|
||||
|
||||
goto yyerrhandle;
|
||||
|
||||
|
|
@ -2405,7 +2405,7 @@ yyerrpop: /* pop the current state because it cannot handle the error token */
|
|||
short *ssp1 = yyss - 1;
|
||||
fprintf (stderr, "Error: state stack now");
|
||||
while (ssp1 != yyssp)
|
||||
fprintf (stderr, " %d", *++ssp1);
|
||||
fprintf (stderr, " %d", *++ssp1);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
|
|
@ -2424,7 +2424,7 @@ yyerrhandle:
|
|||
if (yyn < 0)
|
||||
{
|
||||
if (yyn == YYFLAG)
|
||||
goto yyerrpop;
|
||||
goto yyerrpop;
|
||||
yyn = -yyn;
|
||||
goto yyreduce;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,78 +15,78 @@ typedef union {
|
|||
AssignDecl asn;
|
||||
IfStmtNode* ifnode;
|
||||
} YYSTYPE;
|
||||
#define rwDEFINE 258
|
||||
#define rwENDDEF 259
|
||||
#define rwDECLARE 260
|
||||
#define rwDECLARESINGLETON 261
|
||||
#define rwBREAK 262
|
||||
#define rwELSE 263
|
||||
#define rwCONTINUE 264
|
||||
#define rwGLOBAL 265
|
||||
#define rwIF 266
|
||||
#define rwNIL 267
|
||||
#define rwRETURN 268
|
||||
#define rwWHILE 269
|
||||
#define rwDO 270
|
||||
#define rwENDIF 271
|
||||
#define rwENDWHILE 272
|
||||
#define rwENDFOR 273
|
||||
#define rwDEFAULT 274
|
||||
#define rwFOR 275
|
||||
#define rwFOREACH 276
|
||||
#define rwFOREACHSTR 277
|
||||
#define rwIN 278
|
||||
#define rwDATABLOCK 279
|
||||
#define rwSWITCH 280
|
||||
#define rwCASE 281
|
||||
#define rwSWITCHSTR 282
|
||||
#define rwCASEOR 283
|
||||
#define rwPACKAGE 284
|
||||
#define rwNAMESPACE 285
|
||||
#define rwCLASS 286
|
||||
#define rwASSERT 287
|
||||
#define ILLEGAL_TOKEN 288
|
||||
#define CHRCONST 289
|
||||
#define INTCONST 290
|
||||
#define TTAG 291
|
||||
#define VAR 292
|
||||
#define IDENT 293
|
||||
#define TYPEIDENT 294
|
||||
#define DOCBLOCK 295
|
||||
#define STRATOM 296
|
||||
#define TAGATOM 297
|
||||
#define FLTCONST 298
|
||||
#define opINTNAME 299
|
||||
#define opINTNAMER 300
|
||||
#define opMINUSMINUS 301
|
||||
#define opPLUSPLUS 302
|
||||
#define STMT_SEP 303
|
||||
#define opSHL 304
|
||||
#define opSHR 305
|
||||
#define opPLASN 306
|
||||
#define opMIASN 307
|
||||
#define opMLASN 308
|
||||
#define opDVASN 309
|
||||
#define opMODASN 310
|
||||
#define opANDASN 311
|
||||
#define opXORASN 312
|
||||
#define opORASN 313
|
||||
#define opSLASN 314
|
||||
#define opSRASN 315
|
||||
#define opCAT 316
|
||||
#define opEQ 317
|
||||
#define opNE 318
|
||||
#define opGE 319
|
||||
#define opLE 320
|
||||
#define opAND 321
|
||||
#define opOR 322
|
||||
#define opSTREQ 323
|
||||
#define opCOLONCOLON 324
|
||||
#define opMDASN 325
|
||||
#define opNDASN 326
|
||||
#define opNTASN 327
|
||||
#define opSTRNE 328
|
||||
#define UNARY 329
|
||||
#define rwDEFINE 258
|
||||
#define rwENDDEF 259
|
||||
#define rwDECLARE 260
|
||||
#define rwDECLARESINGLETON 261
|
||||
#define rwBREAK 262
|
||||
#define rwELSE 263
|
||||
#define rwCONTINUE 264
|
||||
#define rwGLOBAL 265
|
||||
#define rwIF 266
|
||||
#define rwNIL 267
|
||||
#define rwRETURN 268
|
||||
#define rwWHILE 269
|
||||
#define rwDO 270
|
||||
#define rwENDIF 271
|
||||
#define rwENDWHILE 272
|
||||
#define rwENDFOR 273
|
||||
#define rwDEFAULT 274
|
||||
#define rwFOR 275
|
||||
#define rwFOREACH 276
|
||||
#define rwFOREACHSTR 277
|
||||
#define rwIN 278
|
||||
#define rwDATABLOCK 279
|
||||
#define rwSWITCH 280
|
||||
#define rwCASE 281
|
||||
#define rwSWITCHSTR 282
|
||||
#define rwCASEOR 283
|
||||
#define rwPACKAGE 284
|
||||
#define rwNAMESPACE 285
|
||||
#define rwCLASS 286
|
||||
#define rwASSERT 287
|
||||
#define ILLEGAL_TOKEN 288
|
||||
#define CHRCONST 289
|
||||
#define INTCONST 290
|
||||
#define TTAG 291
|
||||
#define VAR 292
|
||||
#define IDENT 293
|
||||
#define TYPEIDENT 294
|
||||
#define DOCBLOCK 295
|
||||
#define STRATOM 296
|
||||
#define TAGATOM 297
|
||||
#define FLTCONST 298
|
||||
#define opINTNAME 299
|
||||
#define opINTNAMER 300
|
||||
#define opMINUSMINUS 301
|
||||
#define opPLUSPLUS 302
|
||||
#define STMT_SEP 303
|
||||
#define opSHL 304
|
||||
#define opSHR 305
|
||||
#define opPLASN 306
|
||||
#define opMIASN 307
|
||||
#define opMLASN 308
|
||||
#define opDVASN 309
|
||||
#define opMODASN 310
|
||||
#define opANDASN 311
|
||||
#define opXORASN 312
|
||||
#define opORASN 313
|
||||
#define opSLASN 314
|
||||
#define opSRASN 315
|
||||
#define opCAT 316
|
||||
#define opEQ 317
|
||||
#define opNE 318
|
||||
#define opGE 319
|
||||
#define opLE 320
|
||||
#define opAND 321
|
||||
#define opOR 322
|
||||
#define opSTREQ 323
|
||||
#define opCOLONCOLON 324
|
||||
#define opMDASN 325
|
||||
#define opNDASN 326
|
||||
#define opNTASN 327
|
||||
#define opSTRNE 328
|
||||
#define UNARY 329
|
||||
|
||||
|
||||
extern YYSTYPE CMDlval;
|
||||
|
|
|
|||
|
|
@ -455,8 +455,8 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
|
|||
|
||||
bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, const char *inScript, bool overrideNoDso)
|
||||
{
|
||||
AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread");
|
||||
|
||||
AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread");
|
||||
|
||||
// This will return true, but return value is ignored
|
||||
char *script;
|
||||
chompUTF8BOM( inScript, &script );
|
||||
|
|
@ -572,8 +572,8 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con
|
|||
|
||||
ConsoleValueRef CodeBlock::compileExec(StringTableEntry fileName, const char *inString, bool noCalls, S32 setFrame)
|
||||
{
|
||||
AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread");
|
||||
|
||||
AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread");
|
||||
|
||||
// Check for a UTF8 script file
|
||||
char *string;
|
||||
chompUTF8BOM( inString, &string );
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ inline void ExprEvalState::setCurVarName(StringTableEntry name)
|
|||
else if( getStackDepth() > 0 )
|
||||
currentVariable = getCurrentFrame().lookup(name);
|
||||
if(!currentVariable && gWarnUndefinedScriptVariables)
|
||||
Con::warnf(ConsoleLogEntry::Script, "Variable referenced before assignment: %s", name);
|
||||
Con::warnf(ConsoleLogEntry::Script, "Variable referenced before assignment: %s", name);
|
||||
}
|
||||
|
||||
inline void ExprEvalState::setCurVarNameCreate(StringTableEntry name)
|
||||
|
|
@ -316,7 +316,7 @@ inline void ExprEvalState::setCopyVariable()
|
|||
default:
|
||||
currentVariable->setStringValue(copyVariable->getStringValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -398,7 +398,7 @@ static void setFieldComponent( SimObject* object, StringTableEntry field, const
|
|||
|
||||
// Ensure that the variable has a value
|
||||
if (!prevVal)
|
||||
return;
|
||||
return;
|
||||
|
||||
static const StringTableEntry xyzw[] =
|
||||
{
|
||||
|
|
@ -419,7 +419,7 @@ static void setFieldComponent( SimObject* object, StringTableEntry field, const
|
|||
// Insert the value into the specified
|
||||
// component of the string.
|
||||
if ( subField == xyzw[0] || subField == rgba[0] )
|
||||
dStrcpy( val, StringUnit::setUnit( prevVal, 0, strValue, " \t\n") );
|
||||
dStrcpy( val, StringUnit::setUnit( prevVal, 0, strValue, " \t\n") );
|
||||
|
||||
else if ( subField == xyzw[1] || subField == rgba[1] )
|
||||
dStrcpy( val, StringUnit::setUnit( prevVal, 1, strValue, " \t\n") );
|
||||
|
|
@ -1020,7 +1020,7 @@ breakContinue:
|
|||
dataBlock->deleteObject();
|
||||
currentNewObject = NULL;
|
||||
ip = failJump;
|
||||
|
||||
|
||||
// Prevent stack value corruption
|
||||
CSTK.popFrame();
|
||||
STR.popFrame();
|
||||
|
|
@ -1164,8 +1164,8 @@ breakContinue:
|
|||
|
||||
// This fixes a bug when not explicitly returning a value.
|
||||
case OP_RETURN_VOID:
|
||||
STR.setStringValue("");
|
||||
// We're falling thru here on purpose.
|
||||
STR.setStringValue("");
|
||||
// We're falling thru here on purpose.
|
||||
|
||||
case OP_RETURN:
|
||||
retValue = STR.getStringValuePtr();
|
||||
|
|
@ -1437,7 +1437,7 @@ breakContinue:
|
|||
case OP_SAVEVAR_STR:
|
||||
gEvalState.setStringVariable(STR.getStringValue());
|
||||
break;
|
||||
|
||||
|
||||
case OP_SAVEVAR_VAR:
|
||||
// this basically handles %var1 = %var2
|
||||
gEvalState.setCopyVariable();
|
||||
|
|
|
|||
|
|
@ -278,8 +278,8 @@ bool useTimestamp = false;
|
|||
ConsoleFunctionGroupBegin( Clipboard, "Miscellaneous functions to control the clipboard and clear the console.");
|
||||
|
||||
DefineConsoleFunction( cls, void, (), , "()"
|
||||
"@brief Clears the console output.\n\n"
|
||||
"@ingroup Console")
|
||||
"@brief Clears the console output.\n\n"
|
||||
"@ingroup Console")
|
||||
{
|
||||
if(consoleLogLocked)
|
||||
return;
|
||||
|
|
@ -288,17 +288,17 @@ DefineConsoleFunction( cls, void, (), , "()"
|
|||
};
|
||||
|
||||
DefineConsoleFunction( getClipboard, const char*, (), , "()"
|
||||
"@brief Get text from the clipboard.\n\n"
|
||||
"@internal")
|
||||
"@brief Get text from the clipboard.\n\n"
|
||||
"@internal")
|
||||
{
|
||||
return Platform::getClipboard();
|
||||
return Platform::getClipboard();
|
||||
};
|
||||
|
||||
DefineConsoleFunction( setClipboard, bool, (const char* text), , "(string text)"
|
||||
"@brief Set the system clipboard.\n\n"
|
||||
"@internal")
|
||||
"@internal")
|
||||
{
|
||||
return Platform::setClipboard(text);
|
||||
return Platform::setClipboard(text);
|
||||
};
|
||||
|
||||
ConsoleFunctionGroupEnd( Clipboard );
|
||||
|
|
@ -332,25 +332,25 @@ void init()
|
|||
// Variables
|
||||
setVariable("Con::prompt", "% ");
|
||||
addVariable("Con::logBufferEnabled", TypeBool, &logBufferEnabled, "If true, the log buffer will be enabled.\n"
|
||||
"@ingroup Console\n");
|
||||
"@ingroup Console\n");
|
||||
addVariable("Con::printLevel", TypeS32, &printLevel,
|
||||
"@brief This is deprecated.\n\n"
|
||||
"It is no longer in use and does nothing.\n"
|
||||
"@ingroup Console\n");
|
||||
"@ingroup Console\n");
|
||||
addVariable("Con::warnUndefinedVariables", TypeBool, &gWarnUndefinedScriptVariables, "If true, a warning will be displayed in the console whenever a undefined variable is used in script.\n"
|
||||
"@ingroup Console\n");
|
||||
"@ingroup Console\n");
|
||||
addVariable( "instantGroup", TypeRealString, &gInstantGroup, "The group that objects will be added to when they are created.\n"
|
||||
"@ingroup Console\n");
|
||||
"@ingroup Console\n");
|
||||
|
||||
addVariable("Con::objectCopyFailures", TypeS32, &gObjectCopyFailures, "If greater than zero then it counts the number of object creation "
|
||||
"failures based on a missing copy object and does not report an error..\n"
|
||||
"@ingroup Console\n");
|
||||
"@ingroup Console\n");
|
||||
|
||||
// Current script file name and root
|
||||
addVariable( "Con::File", TypeString, &gCurrentFile, "The currently executing script file.\n"
|
||||
"@ingroup FileSystem\n");
|
||||
"@ingroup FileSystem\n");
|
||||
addVariable( "Con::Root", TypeString, &gCurrentRoot, "The mod folder for the currently executing script file.\n"
|
||||
"@ingroup FileSystem\n" );
|
||||
"@ingroup FileSystem\n" );
|
||||
|
||||
// alwaysUseDebugOutput determines whether to send output to the platform's
|
||||
// "debug" system. see winConsole for an example.
|
||||
|
|
@ -364,14 +364,14 @@ void init()
|
|||
addVariable("Con::alwaysUseDebugOutput", TypeBool, &alwaysUseDebugOutput,
|
||||
"@brief Determines whether to send output to the platform's \"debug\" system.\n\n"
|
||||
"@note This is disabled in shipping builds.\n"
|
||||
"@ingroup Console");
|
||||
"@ingroup Console");
|
||||
#else
|
||||
alwaysUseDebugOutput = false;
|
||||
#endif
|
||||
|
||||
// controls whether a timestamp is prepended to every console message
|
||||
addVariable("Con::useTimestamp", TypeBool, &useTimestamp, "If true a timestamp is prepended to every console message.\n"
|
||||
"@ingroup Console\n");
|
||||
"@ingroup Console\n");
|
||||
|
||||
// Plug us into the journaled console input signal.
|
||||
smConsoleInput.notify(postConsoleInput);
|
||||
|
|
@ -599,7 +599,7 @@ static void log(const char *string)
|
|||
static void _printf(ConsoleLogEntry::Level level, ConsoleLogEntry::Type type, const char* fmt, va_list argptr)
|
||||
{
|
||||
if (!active)
|
||||
return;
|
||||
return;
|
||||
Con::active = false;
|
||||
|
||||
char buffer[8192];
|
||||
|
|
@ -781,7 +781,7 @@ Dictionary::Entry *getAddVariableEntry(const char *name)
|
|||
StringTableEntry stName = StringTable->insert(name);
|
||||
Dictionary::Entry *entry = gEvalState.globalVars.lookup(stName);
|
||||
if (!entry)
|
||||
entry = gEvalState.globalVars.add(stName);
|
||||
entry = gEvalState.globalVars.add(stName);
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
|
@ -791,7 +791,7 @@ Dictionary::Entry *getAddLocalVariableEntry(const char *name)
|
|||
StringTableEntry stName = StringTable->insert(name);
|
||||
Dictionary::Entry *entry = gEvalState.getCurrentFrame().lookup(stName);
|
||||
if (!entry)
|
||||
entry = gEvalState.getCurrentFrame().add(stName);
|
||||
entry = gEvalState.getCurrentFrame().add(stName);
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
|
@ -802,7 +802,7 @@ void setVariable(const char *name, const char *value)
|
|||
|
||||
if (getVariableObjectField(name, &obj, &objField))
|
||||
{
|
||||
obj->setDataField(StringTable->insert(objField), 0, value);
|
||||
obj->setDataField(StringTable->insert(objField), 0, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -824,13 +824,13 @@ void setBoolVariable(const char *varName, bool value)
|
|||
|
||||
if (getVariableObjectField(varName, &obj, &objField))
|
||||
{
|
||||
obj->setDataField(StringTable->insert(objField), 0, value ? "1" : "0");
|
||||
obj->setDataField(StringTable->insert(objField), 0, value ? "1" : "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
varName = prependDollar(varName);
|
||||
Dictionary::Entry *entry = getAddVariableEntry(varName);
|
||||
entry->setStringValue(value ? "1" : "0");
|
||||
entry->setStringValue(value ? "1" : "0");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -841,9 +841,9 @@ void setIntVariable(const char *varName, S32 value)
|
|||
|
||||
if (getVariableObjectField(varName, &obj, &objField))
|
||||
{
|
||||
char scratchBuffer[32];
|
||||
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%d", value);
|
||||
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
|
||||
char scratchBuffer[32];
|
||||
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%d", value);
|
||||
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -860,15 +860,15 @@ void setFloatVariable(const char *varName, F32 value)
|
|||
|
||||
if (getVariableObjectField(varName, &obj, &objField))
|
||||
{
|
||||
char scratchBuffer[32];
|
||||
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%g", value);
|
||||
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
|
||||
char scratchBuffer[32];
|
||||
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%g", value);
|
||||
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
varName = prependDollar(varName);
|
||||
Dictionary::Entry *entry = getAddVariableEntry(varName);
|
||||
entry->setFloatValue(value);
|
||||
entry->setFloatValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1020,7 +1020,7 @@ F32 getFloatVariable(const char *varName, F32 def)
|
|||
else
|
||||
{
|
||||
Dictionary::Entry *entry = getVariableEntry(varName);
|
||||
return entry ? entry->getFloatValue() : def;
|
||||
return entry ? entry->getFloatValue() : def;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1308,8 +1308,8 @@ bool executeFile(const char* fileName, bool noCalls, bool journalScript)
|
|||
|
||||
// Let's do a sanity check to complain about DSOs in the future.
|
||||
//
|
||||
// MM: This doesn't seem to be working correctly for now so let's just not issue
|
||||
// the warning until someone knows how to resolve it.
|
||||
// MM: This doesn't seem to be working correctly for now so let's just not issue
|
||||
// the warning until someone knows how to resolve it.
|
||||
//
|
||||
//if(compiled && rCom && rScr && Platform::compareFileTimes(comModifyTime, scrModifyTime) < 0)
|
||||
//{
|
||||
|
|
@ -1515,7 +1515,7 @@ ConsoleValueRef execute(S32 argc, ConsoleValueRef argv[])
|
|||
#endif
|
||||
ConsoleStackFrameSaver stackSaver;
|
||||
stackSaver.save();
|
||||
return _internalExecute(argc, argv);
|
||||
return _internalExecute(argc, argv);
|
||||
#ifdef TORQUE_MULTITHREAD
|
||||
}
|
||||
else
|
||||
|
|
@ -2616,7 +2616,7 @@ const char *ConsoleValue::getStringValue()
|
|||
|
||||
U32 stringLen = dStrlen(internalValue);
|
||||
U32 newLen = ((stringLen + 1) + 15) & ~15; // pad upto next cache line
|
||||
|
||||
|
||||
if (bufferLen == 0)
|
||||
sval = (char *) dMalloc(newLen);
|
||||
else if(newLen > bufferLen)
|
||||
|
|
|
|||
|
|
@ -95,8 +95,8 @@ struct ConsoleLogEntry
|
|||
Script,
|
||||
GUI,
|
||||
Network,
|
||||
GGConnect,
|
||||
NUM_TYPE
|
||||
GGConnect,
|
||||
NUM_TYPE
|
||||
} mType;
|
||||
|
||||
/// Indicates the actual log entry.
|
||||
|
|
@ -897,28 +897,28 @@ template<typename P1> struct _EngineConsoleExecCallbackHelper;
|
|||
|
||||
namespace Con
|
||||
{
|
||||
/// @name Console Execution - executef
|
||||
/// {
|
||||
///
|
||||
/// Implements a script function thunk which automatically converts parameters to relevant console types.
|
||||
/// Can be used as follows:
|
||||
/// - Con::executef("functionName", ...);
|
||||
/// - Con::executef(mySimObject, "functionName", ...);
|
||||
///
|
||||
/// NOTE: if you get a rather cryptic template error coming through here, most likely you are trying to
|
||||
/// convert a parameter which EngineMarshallType does not have a specialization for.
|
||||
/// Another problem can occur if you do not include "console/simBase.h" and "console/engineAPI.h"
|
||||
/// since _EngineConsoleExecCallbackHelper and SimConsoleThreadExecCallback are required.
|
||||
///
|
||||
/// @see _EngineConsoleExecCallbackHelper
|
||||
///
|
||||
template<typename R, typename ...ArgTs>
|
||||
ConsoleValueRef executef(R r, ArgTs ...argTs)
|
||||
{
|
||||
_EngineConsoleExecCallbackHelper<R> callback( r );
|
||||
return callback.template call<ConsoleValueRef>(argTs...);
|
||||
}
|
||||
/// }
|
||||
/// @name Console Execution - executef
|
||||
/// {
|
||||
///
|
||||
/// Implements a script function thunk which automatically converts parameters to relevant console types.
|
||||
/// Can be used as follows:
|
||||
/// - Con::executef("functionName", ...);
|
||||
/// - Con::executef(mySimObject, "functionName", ...);
|
||||
///
|
||||
/// NOTE: if you get a rather cryptic template error coming through here, most likely you are trying to
|
||||
/// convert a parameter which EngineMarshallType does not have a specialization for.
|
||||
/// Another problem can occur if you do not include "console/simBase.h" and "console/engineAPI.h"
|
||||
/// since _EngineConsoleExecCallbackHelper and SimConsoleThreadExecCallback are required.
|
||||
///
|
||||
/// @see _EngineConsoleExecCallbackHelper
|
||||
///
|
||||
template<typename R, typename ...ArgTs>
|
||||
ConsoleValueRef executef(R r, ArgTs ...argTs)
|
||||
{
|
||||
_EngineConsoleExecCallbackHelper<R> callback( r );
|
||||
return callback.template call<ConsoleValueRef>(argTs...);
|
||||
}
|
||||
/// }
|
||||
};
|
||||
|
||||
extern void expandEscape(char *dest, const char *src);
|
||||
|
|
@ -1143,19 +1143,19 @@ class ConsoleStackFrameSaver
|
|||
{
|
||||
public:
|
||||
|
||||
bool mSaved;
|
||||
bool mSaved;
|
||||
|
||||
ConsoleStackFrameSaver() : mSaved(false)
|
||||
{
|
||||
}
|
||||
ConsoleStackFrameSaver() : mSaved(false)
|
||||
{
|
||||
}
|
||||
|
||||
~ConsoleStackFrameSaver()
|
||||
{
|
||||
restore();
|
||||
}
|
||||
~ConsoleStackFrameSaver()
|
||||
{
|
||||
restore();
|
||||
}
|
||||
|
||||
void save();
|
||||
void restore();
|
||||
void save();
|
||||
void restore();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ DefineConsoleFunction( dumpConsoleClasses, void, (bool dumpScript, bool dumpEngi
|
|||
"@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"
|
||||
"@ingroup Logging")
|
||||
"@ingroup Logging")
|
||||
{
|
||||
Namespace::dumpClasses( dumpScript, dumpEngine );
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ DefineConsoleFunction(dumpConsoleFunctions, void, ( bool dumpScript, bool dumpEn
|
|||
"@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"
|
||||
"@ingroup Logging")
|
||||
"@ingroup Logging")
|
||||
{
|
||||
Namespace::dumpFunctions( dumpScript, dumpEngine );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -463,12 +463,12 @@ DefineConsoleFunction( strposr, S32, ( const char* haystack, const char* needle,
|
|||
U32 sublen = dStrlen( needle );
|
||||
U32 strlen = dStrlen( haystack );
|
||||
S32 start = strlen - offset;
|
||||
|
||||
|
||||
if(start < 0 || start > strlen)
|
||||
return -1;
|
||||
|
||||
if (start + sublen > strlen)
|
||||
start = strlen - sublen;
|
||||
start = strlen - sublen;
|
||||
for(; start >= 0; start--)
|
||||
if(!dStrncmp(haystack + start, needle, sublen))
|
||||
return start;
|
||||
|
|
@ -1022,15 +1022,15 @@ DefineConsoleFunction( strrchrpos, S32, ( const char* str, const char* chr, S32
|
|||
//----------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction(ColorFloatToInt, ColorI, (ColorF 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"
|
||||
"@tsexample\n"
|
||||
"ColorFloatToInt( \"0 0 1 0.5\" ) // Returns \"0 0 255 128\".\n"
|
||||
"@endtsexample\n"
|
||||
"@ingroup Strings")
|
||||
"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"
|
||||
"@tsexample\n"
|
||||
"ColorFloatToInt( \"0 0 1 0.5\" ) // Returns \"0 0 255 128\".\n"
|
||||
"@endtsexample\n"
|
||||
"@ingroup Strings")
|
||||
{
|
||||
return (ColorI)color;
|
||||
return (ColorI)color;
|
||||
}
|
||||
|
||||
DefineConsoleFunction(ColorIntToFloat, ColorF, (ColorI color), ,
|
||||
|
|
@ -1201,8 +1201,8 @@ DefineConsoleFunction( isValidIP, bool, ( const char* str),,
|
|||
ConsoleFunction(addCaseSensitiveStrings,void,2,0,"[string1, string2, ...]"
|
||||
"Adds case sensitive strings to the StringTable.")
|
||||
{
|
||||
for(int i = 1; i < argc; i++)
|
||||
StringTable->insert(argv[i], true);
|
||||
for(int i = 1; i < argc; i++)
|
||||
StringTable->insert(argv[i], true);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
|
@ -1645,7 +1645,7 @@ DefineConsoleFunction( nextToken, const char*, ( const char* str1, const char* t
|
|||
"@endtsexample\n\n"
|
||||
"@ingroup Strings" )
|
||||
{
|
||||
char buffer[4096];
|
||||
char buffer[4096];
|
||||
dStrncpy(buffer, str1, 4096);
|
||||
char *str = buffer;
|
||||
|
||||
|
|
@ -1812,7 +1812,7 @@ DefineEngineFunction( detag, const char*, ( const char* str ),,
|
|||
"{\n"
|
||||
" onChatMessage(detag(%msgString), %voice, %pitch);\n"
|
||||
"}\n"
|
||||
"@endtsexample\n\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@see \\ref syntaxDataTypes under Tagged %Strings\n"
|
||||
"@see getTag()\n"
|
||||
|
|
@ -2017,8 +2017,8 @@ DefineConsoleFunction( collapseEscape, const char*, ( const char* text ),,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction( setLogMode, void, ( S32 mode ),,
|
||||
"@brief Determines how log files are written.\n\n"
|
||||
"Sets the operational mode of the console logging system.\n\n"
|
||||
"@brief Determines how log files are written.\n\n"
|
||||
"Sets the operational mode of the console logging system.\n\n"
|
||||
"@param mode Parameter specifying the logging mode. This can be:\n"
|
||||
"- 1: Open and close the console log file for each seperate string of output. This will ensure that all "
|
||||
"parts get written out to disk and that no parts remain in intermediate buffers even if the process crashes.\n"
|
||||
|
|
@ -2030,8 +2030,8 @@ DefineEngineFunction( setLogMode, void, ( S32 mode ),,
|
|||
"combined by binary OR with 0x4 to cause the logging system to flush all console log messages that had already been "
|
||||
"issued to the console system into the newly created log file.\n\n"
|
||||
|
||||
"@note Xbox 360 does not support logging to a file. Use Platform::OutputDebugStr in C++ instead."
|
||||
"@ingroup Logging" )
|
||||
"@note Xbox 360 does not support logging to a file. Use Platform::OutputDebugStr in C++ instead."
|
||||
"@ingroup Logging" )
|
||||
{
|
||||
Con::setLogMode( mode );
|
||||
}
|
||||
|
|
@ -2144,7 +2144,7 @@ DefineEngineFunction( gotoWebPage, void, ( const char* address ),,
|
|||
DefineEngineFunction( displaySplashWindow, bool, (const char* path), ("art/gui/splash.bmp"),
|
||||
"Display a startup splash window suitable for showing while the engine still starts up.\n\n"
|
||||
"@note This is currently only implemented on Windows.\n\n"
|
||||
"@param path relative path to splash screen image to display.\n"
|
||||
"@param path relative path to splash screen image to display.\n"
|
||||
"@return True if the splash window could be successfully initialized.\n\n"
|
||||
"@ingroup Platform" )
|
||||
{
|
||||
|
|
@ -2390,19 +2390,19 @@ DefineConsoleFunction( setVariable, void, ( const char* varName, const char* val
|
|||
}
|
||||
|
||||
DefineConsoleFunction( 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"
|
||||
"@ingroup Scripting")
|
||||
"@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"
|
||||
"@ingroup Scripting")
|
||||
{
|
||||
return Con::isFunction(funcName);
|
||||
}
|
||||
|
||||
DefineConsoleFunction( 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"
|
||||
"@ingroup Packages")
|
||||
"@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"
|
||||
"@ingroup Packages")
|
||||
{
|
||||
Namespace::Entry* nse = Namespace::global()->lookup( StringTable->insert( funcName ) );
|
||||
if( !nse )
|
||||
|
|
@ -2412,11 +2412,11 @@ DefineConsoleFunction( getFunctionPackage, const char*, ( const char* funcName )
|
|||
}
|
||||
|
||||
DefineConsoleFunction( 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"
|
||||
"@return True if the method exists, false if not\n"
|
||||
"@ingroup Scripting\n")
|
||||
"@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"
|
||||
"@return True if the method exists, false if not\n"
|
||||
"@ingroup Scripting\n")
|
||||
{
|
||||
Namespace* ns = Namespace::find( StringTable->insert( nameSpace ) );
|
||||
Namespace::Entry* nse = ns->lookup( StringTable->insert( method ) );
|
||||
|
|
@ -2427,11 +2427,11 @@ DefineConsoleFunction( isMethod, bool, ( const char* nameSpace, const char* meth
|
|||
}
|
||||
|
||||
DefineConsoleFunction( 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"
|
||||
"@return The name of the method's package\n"
|
||||
"@ingroup Packages")
|
||||
"@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"
|
||||
"@return The name of the method's package\n"
|
||||
"@ingroup Packages")
|
||||
{
|
||||
Namespace* ns = Namespace::find( StringTable->insert( nameSpace ) );
|
||||
if( !ns )
|
||||
|
|
@ -2445,13 +2445,13 @@ DefineConsoleFunction( getMethodPackage, const char*, ( const char* nameSpace, c
|
|||
}
|
||||
|
||||
DefineConsoleFunction( 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"
|
||||
"@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"
|
||||
"@tsexample\n"
|
||||
"isDefined( \"$myVar\" );\n"
|
||||
"@endtsexample\n\n"
|
||||
"@ingroup Scripting")
|
||||
"@ingroup Scripting")
|
||||
{
|
||||
if(String::isEmpty(varName))
|
||||
{
|
||||
|
|
@ -2590,10 +2590,10 @@ DefineConsoleFunction( isCurrentScriptToolScript, bool, (), , "()"
|
|||
}
|
||||
|
||||
DefineConsoleFunction( 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"
|
||||
"@internal")
|
||||
"@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"
|
||||
"@internal")
|
||||
{
|
||||
StringTableEntry modPath = Con::getModNameFromPath(path);
|
||||
return modPath ? modPath : "";
|
||||
|
|
@ -2602,11 +2602,11 @@ DefineConsoleFunction( getModNameFromPath, const char *, ( const char* path ), ,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( 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"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
"@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"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
{
|
||||
if( group.size() > 0 )
|
||||
Con::pushInstantGroup( group );
|
||||
|
|
@ -2615,10 +2615,10 @@ DefineConsoleFunction( pushInstantGroup, void, ( String group ),("") , "([group]
|
|||
}
|
||||
|
||||
DefineConsoleFunction( 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"
|
||||
"@internal")
|
||||
"@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"
|
||||
"@internal")
|
||||
{
|
||||
Con::popInstantGroup();
|
||||
}
|
||||
|
|
@ -2626,8 +2626,8 @@ DefineConsoleFunction( popInstantGroup, void, (), , "()"
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getPrefsPath, const char *, ( const char* relativeFileName ), (""), "([relativeFileName])"
|
||||
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
||||
"@internal")
|
||||
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
||||
"@internal")
|
||||
{
|
||||
const char *filename = Platform::getPrefsPath(relativeFileName);
|
||||
if(filename == NULL || *filename == 0)
|
||||
|
|
@ -2639,13 +2639,13 @@ 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")
|
||||
"@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)
|
||||
|
|
@ -2786,8 +2786,8 @@ DefineEngineFunction( isToolBuild, bool, (),,
|
|||
}
|
||||
|
||||
DefineEngineFunction( getMaxDynamicVerts, S32, (),,
|
||||
"Get max number of allowable dynamic vertices in a single vertex buffer.\n\n"
|
||||
"@return the max number of allowable dynamic vertices in a single vertex buffer" )
|
||||
"Get max number of allowable dynamic vertices in a single vertex buffer.\n\n"
|
||||
"@return the max number of allowable dynamic vertices in a single vertex buffer" )
|
||||
{
|
||||
return MAX_DYNAMIC_VERTS / 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -510,7 +510,7 @@ void ConsoleValue::setStringValue(const char * value)
|
|||
return;
|
||||
}
|
||||
*/
|
||||
if (value == typeValueEmpty)
|
||||
if (value == typeValueEmpty)
|
||||
{
|
||||
if (bufferLen > 0)
|
||||
{
|
||||
|
|
@ -544,7 +544,7 @@ void ConsoleValue::setStringValue(const char * value)
|
|||
|
||||
// may as well pad to the next cache line
|
||||
U32 newLen = ((stringLen + 1) + 15) & ~15;
|
||||
|
||||
|
||||
if(bufferLen == 0)
|
||||
sval = (char *) dMalloc(newLen);
|
||||
else if(newLen > bufferLen)
|
||||
|
|
@ -573,7 +573,7 @@ void ConsoleValue::setStackStringValue(const char *value)
|
|||
bufferLen = 0;
|
||||
}
|
||||
|
||||
if (value == typeValueEmpty)
|
||||
if (value == typeValueEmpty)
|
||||
{
|
||||
sval = typeValueEmpty;
|
||||
fval = 0.f;
|
||||
|
|
@ -607,7 +607,7 @@ void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue)
|
|||
if(type <= ConsoleValue::TypeInternalString)
|
||||
{
|
||||
const char *value = StringStackPtrRef(ptrValue).getPtr(&STR);
|
||||
if (bufferLen > 0)
|
||||
if (bufferLen > 0)
|
||||
{
|
||||
dFree(sval);
|
||||
bufferLen = 0;
|
||||
|
|
@ -1418,14 +1418,14 @@ ConsoleValueRef Namespace::Entry::execute(S32 argc, ConsoleValueRef *argv, ExprE
|
|||
case StringCallbackType:
|
||||
return ConsoleValueRef::fromValue(CSTK.pushStackString(cb.mStringCallbackFunc(state->thisObject, argc, argv)));
|
||||
case IntCallbackType:
|
||||
return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
|
||||
return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
|
||||
case FloatCallbackType:
|
||||
return ConsoleValueRef::fromValue(CSTK.pushFLT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
|
||||
return ConsoleValueRef::fromValue(CSTK.pushFLT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
|
||||
case VoidCallbackType:
|
||||
cb.mVoidCallbackFunc(state->thisObject, argc, argv);
|
||||
return ConsoleValueRef();
|
||||
case BoolCallbackType:
|
||||
return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
|
||||
return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
|
||||
}
|
||||
|
||||
return ConsoleValueRef();
|
||||
|
|
|
|||
|
|
@ -226,20 +226,20 @@ void ConsoleLogger::log( const char *consoleLine )
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( 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"
|
||||
"new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n"
|
||||
"// Send something to the console, with the logger consumes and writes to file\n"
|
||||
"echo(\"This is logged to the file\");\n\n"
|
||||
"// Stop logging, but do not delete the logger\n"
|
||||
"logger.detach();\n\n"
|
||||
"echo(\"This is not logged to the file\");\n\n"
|
||||
"// Attach the logger to the console again\n"
|
||||
"logger.attach();\n\n"
|
||||
"// Logging has resumed\n"
|
||||
"echo(\"Logging has resumed\");"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"// Create the logger\n"
|
||||
"// Will automatically start writing to testLogging.txt with normal priority\n"
|
||||
"new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n"
|
||||
"// Send something to the console, with the logger consumes and writes to file\n"
|
||||
"echo(\"This is logged to the file\");\n\n"
|
||||
"// Stop logging, but do not delete the logger\n"
|
||||
"logger.detach();\n\n"
|
||||
"echo(\"This is not logged to the file\");\n\n"
|
||||
"// Attach the logger to the console again\n"
|
||||
"logger.attach();\n\n"
|
||||
"// Logging has resumed\n"
|
||||
"echo(\"Logging has resumed\");"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
ConsoleLogger *logger = static_cast<ConsoleLogger *>( object );
|
||||
return logger->attach();
|
||||
|
|
@ -248,20 +248,20 @@ DefineConsoleMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( 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"
|
||||
"new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n"
|
||||
"// Send something to the console, with the logger consumes and writes to file\n"
|
||||
"echo(\"This is logged to the file\");\n\n"
|
||||
"// Stop logging, but do not delete the logger\n"
|
||||
"logger.detach();\n\n"
|
||||
"echo(\"This is not logged to the file\");\n\n"
|
||||
"// Attach the logger to the console again\n"
|
||||
"logger.attach();\n\n"
|
||||
"// Logging has resumed\n"
|
||||
"echo(\"Logging has resumed\");"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"// Create the logger\n"
|
||||
"// Will automatically start writing to testLogging.txt with normal priority\n"
|
||||
"new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n"
|
||||
"// Send something to the console, with the logger consumes and writes to file\n"
|
||||
"echo(\"This is logged to the file\");\n\n"
|
||||
"// Stop logging, but do not delete the logger\n"
|
||||
"logger.detach();\n\n"
|
||||
"echo(\"This is not logged to the file\");\n\n"
|
||||
"// Attach the logger to the console again\n"
|
||||
"logger.attach();\n\n"
|
||||
"// Logging has resumed\n"
|
||||
"echo(\"Logging has resumed\");"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
ConsoleLogger *logger = static_cast<ConsoleLogger *>( object );
|
||||
return logger->detach();
|
||||
|
|
|
|||
|
|
@ -334,15 +334,15 @@ AbstractClassRep *AbstractClassRep::getCommonParent( const AbstractClassRep *oth
|
|||
static char replacebuf[1024];
|
||||
static char* suppressSpaces(const char* in_pname)
|
||||
{
|
||||
U32 i = 0;
|
||||
char chr;
|
||||
do
|
||||
{
|
||||
chr = in_pname[i];
|
||||
replacebuf[i++] = (chr != 32) ? chr : '_';
|
||||
} while(chr);
|
||||
U32 i = 0;
|
||||
char chr;
|
||||
do
|
||||
{
|
||||
chr = in_pname[i];
|
||||
replacebuf[i++] = (chr != 32) ? chr : '_';
|
||||
} while(chr);
|
||||
|
||||
return replacebuf;
|
||||
return replacebuf;
|
||||
}
|
||||
|
||||
void ConsoleObject::addGroup(const char* in_pGroupname, const char* in_pGroupDocs)
|
||||
|
|
@ -740,8 +740,8 @@ static const char* returnClassList( Vector< AbstractClassRep* >& classes, U32 bu
|
|||
//------------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction( isClass, bool, ( const char* identifier ),,
|
||||
"@brief Returns true if the passed identifier is the name of a declared class.\n\n"
|
||||
"@ingroup Console")
|
||||
"@brief Returns true if the passed identifier is the name of a declared class.\n\n"
|
||||
"@ingroup Console")
|
||||
{
|
||||
AbstractClassRep* rep = AbstractClassRep::findClassRep( identifier );
|
||||
return rep != NULL;
|
||||
|
|
@ -765,10 +765,10 @@ DefineEngineFunction( isMemberOfClass, bool, ( const char* className, const char
|
|||
}
|
||||
|
||||
DefineEngineFunction( getDescriptionOfClass, const char*, ( const char* className ),,
|
||||
"@brief Returns the description string for the named class.\n\n"
|
||||
"@param className The name of the class.\n"
|
||||
"@return The class description in string format.\n"
|
||||
"@ingroup Console")
|
||||
"@brief Returns the description string for the named class.\n\n"
|
||||
"@param className The name of the class.\n"
|
||||
"@return The class description in string format.\n"
|
||||
"@ingroup Console")
|
||||
{
|
||||
AbstractClassRep* rep = AbstractClassRep::findClassRep( className );
|
||||
if( rep )
|
||||
|
|
@ -779,9 +779,9 @@ DefineEngineFunction( getDescriptionOfClass, const char*, ( const char* classNam
|
|||
}
|
||||
|
||||
DefineEngineFunction( getCategoryOfClass, const char*, ( const char* className ),,
|
||||
"@brief Returns the category of the given class.\n\n"
|
||||
"@param className The name of the class.\n"
|
||||
"@ingroup Console")
|
||||
"@brief Returns the category of the given class.\n\n"
|
||||
"@param className The name of the class.\n"
|
||||
"@ingroup Console")
|
||||
{
|
||||
AbstractClassRep* rep = AbstractClassRep::findClassRep( className );
|
||||
if( rep )
|
||||
|
|
@ -792,12 +792,12 @@ DefineEngineFunction( getCategoryOfClass, const char*, ( const char* className
|
|||
}
|
||||
|
||||
DefineEngineFunction( enumerateConsoleClasses, const char*, ( const char* className ), ( "" ),
|
||||
"@brief Returns a list of classes that derive from the named class.\n\n"
|
||||
"@brief Returns a list of classes that derive from the named class.\n\n"
|
||||
"If the named class is omitted this dumps all the classes.\n"
|
||||
"@param className The optional base class name.\n"
|
||||
"@return A tab delimited list of classes.\n"
|
||||
"@return A tab delimited list of classes.\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
"@internal")
|
||||
{
|
||||
AbstractClassRep *base = NULL;
|
||||
if(className && *className)
|
||||
|
|
@ -822,11 +822,11 @@ DefineEngineFunction( enumerateConsoleClasses, const char*, ( const char* classN
|
|||
}
|
||||
|
||||
DefineEngineFunction( enumerateConsoleClassesByCategory, const char*, ( String category ),,
|
||||
"@brief Provide a list of classes that belong to the given category.\n\n"
|
||||
"@param category The category name.\n"
|
||||
"@return A tab delimited list of classes.\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
"@brief Provide a list of classes that belong to the given category.\n\n"
|
||||
"@param category The category name.\n"
|
||||
"@return A tab delimited list of classes.\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
{
|
||||
U32 categoryLength = category.length();
|
||||
|
||||
|
|
@ -914,10 +914,10 @@ DefineEngineFunction( dumpNetStats, void, (),,
|
|||
}
|
||||
|
||||
DefineEngineFunction( sizeof, S32, ( const char *objectOrClass ),,
|
||||
"@brief Determines the memory consumption of a class or object.\n\n"
|
||||
"@param objectOrClass The object or class being measured.\n"
|
||||
"@return Returns the total size of an object in bytes.\n"
|
||||
"@ingroup Debugging\n")
|
||||
"@brief Determines the memory consumption of a class or object.\n\n"
|
||||
"@param objectOrClass The object or class being measured.\n"
|
||||
"@return Returns the total size of an object in bytes.\n"
|
||||
"@ingroup Debugging\n")
|
||||
{
|
||||
AbstractClassRep *acr = NULL;
|
||||
SimObject *obj = Sim::findObject(objectOrClass);
|
||||
|
|
|
|||
|
|
@ -35,21 +35,21 @@ static ConsoleParser *gDefaultParser = NULL;
|
|||
|
||||
void freeConsoleParserList(void)
|
||||
{
|
||||
while(gParserList)
|
||||
{
|
||||
while(gParserList)
|
||||
{
|
||||
ConsoleParser * pParser = gParserList;
|
||||
gParserList = pParser->next;
|
||||
delete pParser;
|
||||
}
|
||||
gParserList = pParser->next;
|
||||
delete pParser;
|
||||
}
|
||||
|
||||
gDefaultParser = NULL;
|
||||
gDefaultParser = NULL;
|
||||
}
|
||||
|
||||
bool addConsoleParser(char *ext, fnGetCurrentFile gcf, fnGetCurrentLine gcl, fnParse p, fnRestart r, fnSetScanBuffer ssb, bool def)
|
||||
{
|
||||
AssertFatal(ext && gcf && gcl && p && r, "AddConsoleParser called with one or more NULL arguments");
|
||||
AssertFatal(ext && gcf && gcl && p && r, "AddConsoleParser called with one or more NULL arguments");
|
||||
|
||||
ConsoleParser * pParser = new ConsoleParser;
|
||||
ConsoleParser * pParser = new ConsoleParser;
|
||||
|
||||
pParser->ext = ext;
|
||||
pParser->getCurrentFile = gcf;
|
||||
|
|
@ -69,23 +69,23 @@ bool addConsoleParser(char *ext, fnGetCurrentFile gcf, fnGetCurrentLine gcl, fnP
|
|||
|
||||
ConsoleParser * getParserForFile(const char *filename)
|
||||
{
|
||||
if(filename == NULL)
|
||||
return gDefaultParser;
|
||||
if(filename == NULL)
|
||||
return gDefaultParser;
|
||||
|
||||
char *ptr = dStrrchr((char *)filename, '.');
|
||||
if(ptr != NULL)
|
||||
{
|
||||
ptr++;
|
||||
char *ptr = dStrrchr((char *)filename, '.');
|
||||
if(ptr != NULL)
|
||||
{
|
||||
ptr++;
|
||||
|
||||
ConsoleParser *p;
|
||||
for(p = gParserList; p; p = p->next)
|
||||
{
|
||||
if(dStricmp(ptr, p->ext) == 0)
|
||||
return p;
|
||||
}
|
||||
}
|
||||
ConsoleParser *p;
|
||||
for(p = gParserList; p; p = p->next)
|
||||
{
|
||||
if(dStricmp(ptr, p->ext) == 0)
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
return gDefaultParser;
|
||||
return gDefaultParser;
|
||||
}
|
||||
|
||||
} // end namespace Con
|
||||
|
|
|
|||
|
|
@ -57,15 +57,15 @@ typedef void (*fnSetScanBuffer)(const char *sb, const char *fn);
|
|||
//-----------------------------------------------------------------------------
|
||||
struct ConsoleParser
|
||||
{
|
||||
struct ConsoleParser *next; //!< Next object in list or NULL
|
||||
struct ConsoleParser *next; //!< Next object in list or NULL
|
||||
|
||||
char *ext; //!< Filename extension handled by this parser
|
||||
|
||||
fnGetCurrentFile getCurrentFile; //!< GetCurrentFile lexer function
|
||||
fnGetCurrentLine getCurrentLine; //!< GetCurrentLine lexer function
|
||||
fnParse parse; //!< Parse lexer function
|
||||
fnRestart restart; //!< Restart lexer function
|
||||
fnSetScanBuffer setScanBuffer; //!< SetScanBuffer lexer function
|
||||
char *ext; //!< Filename extension handled by this parser
|
||||
|
||||
fnGetCurrentFile getCurrentFile; //!< GetCurrentFile lexer function
|
||||
fnGetCurrentLine getCurrentLine; //!< GetCurrentLine lexer function
|
||||
fnParse parse; //!< Parse lexer function
|
||||
fnRestart restart; //!< Restart lexer function
|
||||
fnSetScanBuffer setScanBuffer; //!< SetScanBuffer lexer function
|
||||
};
|
||||
|
||||
// Macros
|
||||
|
|
@ -74,18 +74,18 @@ struct ConsoleParser
|
|||
/// \brief Declare a parser's function prototypes
|
||||
//-----------------------------------------------------------------------------
|
||||
#define CON_DECLARE_PARSER(prefix) \
|
||||
const char * prefix##GetCurrentFile(); \
|
||||
S32 prefix##GetCurrentLine(); \
|
||||
void prefix##SetScanBuffer(const char *sb, const char *fn); \
|
||||
S32 prefix##parse(); \
|
||||
void prefix##restart(FILE *input_file)
|
||||
const char * prefix##GetCurrentFile(); \
|
||||
S32 prefix##GetCurrentLine(); \
|
||||
void prefix##SetScanBuffer(const char *sb, const char *fn); \
|
||||
S32 prefix##parse(); \
|
||||
void prefix##restart(FILE *input_file)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \brief Helper macro to add console parsers
|
||||
//-----------------------------------------------------------------------------
|
||||
#define CON_ADD_PARSER(prefix, ext, def) \
|
||||
Compiler::addConsoleParser(ext, prefix##GetCurrentFile, prefix##GetCurrentLine, prefix##parse, \
|
||||
prefix##restart, prefix##SetScanBuffer, def)
|
||||
Compiler::addConsoleParser(ext, prefix##GetCurrentFile, prefix##GetCurrentLine, prefix##parse, \
|
||||
prefix##restart, prefix##SetScanBuffer, def)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \brief Free the console parser list
|
||||
|
|
|
|||
|
|
@ -339,14 +339,14 @@ struct EngineUnmarshallData< ConsoleValueRef >
|
|||
|
||||
|
||||
template<typename T> struct _EngineTrampoline {
|
||||
struct Args {};
|
||||
struct Args {};
|
||||
};
|
||||
|
||||
template< typename R, typename ...ArgTs >
|
||||
struct _EngineTrampoline< R( ArgTs ... ) >
|
||||
{
|
||||
typedef std::tuple<ArgTs ...> Args;
|
||||
std::tuple<ArgTs ...> argT;
|
||||
typedef std::tuple<ArgTs ...> Args;
|
||||
std::tuple<ArgTs ...> argT;
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
|
|
@ -363,21 +363,21 @@ template< typename R, typename ...ArgTs >
|
|||
struct _EngineFunctionTrampoline< R(ArgTs...) > : public _EngineFunctionTrampolineBase< R(ArgTs...) >
|
||||
{
|
||||
private:
|
||||
using Super = _EngineFunctionTrampolineBase< R(ArgTs...) >;
|
||||
using ArgsType = typename Super::Args;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(typename Super::FunctionType fn, const ArgsType& args, Seq<I...>) {
|
||||
return R( fn(std::get<I>(args) ...) );
|
||||
}
|
||||
using Super = _EngineFunctionTrampolineBase< R(ArgTs...) >;
|
||||
using ArgsType = typename Super::Args;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(typename Super::FunctionType fn, const ArgsType& args, Seq<I...>) {
|
||||
return R( fn(std::get<I>(args) ...) );
|
||||
}
|
||||
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
public:
|
||||
static R jmp(typename Super::FunctionType fn, const ArgsType& args )
|
||||
static R jmp(typename Super::FunctionType fn, const ArgsType& args )
|
||||
{
|
||||
return dispatchHelper(fn, args, SeqType());
|
||||
}
|
||||
|
|
@ -394,25 +394,25 @@ struct _EngineMethodTrampoline {};
|
|||
template< typename Frame, typename R, typename ...ArgTs >
|
||||
struct _EngineMethodTrampoline< Frame, R(ArgTs ...) > : public _EngineMethodTrampolineBase< R(ArgTs ...) >
|
||||
{
|
||||
using FunctionType = R( typename Frame::ObjectType*, ArgTs ...);
|
||||
using FunctionType = R( typename Frame::ObjectType*, ArgTs ...);
|
||||
private:
|
||||
using Super = _EngineMethodTrampolineBase< R(ArgTs ...) >;
|
||||
using ArgsType = typename _EngineFunctionTrampolineBase< R(ArgTs ...) >::Args;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(Frame f, const ArgsType& args, Seq<I...>) {
|
||||
return R( f._exec(std::get<I>(args) ...) );
|
||||
}
|
||||
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
using Super = _EngineMethodTrampolineBase< R(ArgTs ...) >;
|
||||
using ArgsType = typename _EngineFunctionTrampolineBase< R(ArgTs ...) >::Args;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(Frame f, const ArgsType& args, Seq<I...>) {
|
||||
return R( f._exec(std::get<I>(args) ...) );
|
||||
}
|
||||
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
public:
|
||||
static R jmp( typename Frame::ObjectType* object, const ArgsType& args )
|
||||
{
|
||||
|
||||
|
||||
Frame f;
|
||||
f.object = object;
|
||||
return dispatchHelper(f, args, SeqType());
|
||||
|
|
@ -515,13 +515,13 @@ struct _EngineConsoleThunkType< void >
|
|||
struct _EngineConsoleThunkCountArgs
|
||||
{
|
||||
|
||||
template<typename ...ArgTs> U32 operator()(ArgTs... args){
|
||||
return sizeof...(ArgTs);
|
||||
}
|
||||
|
||||
operator U32() const{ // FIXME: WHAT IS THIS?? I'm pretty sure it's incorrect, and it's the version that is invoked by all the macros
|
||||
return 0;
|
||||
}
|
||||
template<typename ...ArgTs> U32 operator()(ArgTs... args){
|
||||
return sizeof...(ArgTs);
|
||||
}
|
||||
|
||||
operator U32() const{ // FIXME: WHAT IS THIS?? I'm pretty sure it's incorrect, and it's the version that is invoked by all the macros
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -529,61 +529,61 @@ struct _EngineConsoleThunkCountArgs
|
|||
|
||||
// Encapsulation of a legacy console function invocation.
|
||||
namespace engineAPI{
|
||||
namespace detail{
|
||||
template<S32 startArgc, typename R, typename ...ArgTs>
|
||||
struct ThunkHelpers {
|
||||
using SelfType = ThunkHelpers<startArgc, R, ArgTs...>;
|
||||
using FunctionType = R(*)(ArgTs...);
|
||||
template<typename Frame> using MethodType = R(Frame::*)(ArgTs ...) const;
|
||||
template<size_t I> using IthArgType = typename std::tuple_element<I, std::tuple<ArgTs ...> >::type;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
|
||||
static constexpr S32 NUM_ARGS = sizeof...(ArgTs) + startArgc;
|
||||
|
||||
template<size_t index, size_t method_offset = 0, typename ...RealArgTs>
|
||||
static IthArgType<index> getRealArgValue(S32 argc, ConsoleValueRef *argv, const _EngineFunctionDefaultArguments< void(RealArgTs...) >& defaultArgs)
|
||||
{
|
||||
if((startArgc + index) < argc)
|
||||
{
|
||||
return EngineUnmarshallData< IthArgType<index> >()( argv[ startArgc + index ] );
|
||||
} else {
|
||||
return std::get<index + method_offset>(defaultArgs.mArgs);
|
||||
}
|
||||
}
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs, Seq<I...>){
|
||||
return fn(SelfType::getRealArgValue<I>(argc, argv, defaultArgs) ...);
|
||||
}
|
||||
|
||||
template<typename Frame, size_t ...I>
|
||||
static R dispatchHelper(S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs, Seq<I...>){
|
||||
return (frame->*fn)(SelfType::getRealArgValue<I,1>(argc, argv, defaultArgs) ...);
|
||||
}
|
||||
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
};
|
||||
|
||||
template<typename ArgVT> struct MarshallHelpers {
|
||||
template<typename ...ArgTs> static void marshallEach(S32 &argc, ArgVT *argv, const ArgTs& ...args){}
|
||||
template<typename H, typename ...Tail> static void marshallEach(S32 &argc, ArgVT *argv, const H& head, const Tail& ...tail){
|
||||
argv[argc++] = EngineMarshallData(head);
|
||||
marshallEach(argc, argv, tail...);
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct MarshallHelpers<ConsoleValueRef> {
|
||||
template<typename ...ArgTs> static void marshallEach(S32 &argc, ConsoleValueRef *argv, const ArgTs& ...args){}
|
||||
template<typename H, typename ...Tail> static void marshallEach(S32 &argc, ConsoleValueRef *argv, const H& head, const Tail& ...tail){
|
||||
EngineMarshallData(head, argc, argv);
|
||||
marshallEach(argc, argv, tail...);
|
||||
}
|
||||
};
|
||||
}
|
||||
namespace detail{
|
||||
template<S32 startArgc, typename R, typename ...ArgTs>
|
||||
struct ThunkHelpers {
|
||||
using SelfType = ThunkHelpers<startArgc, R, ArgTs...>;
|
||||
using FunctionType = R(*)(ArgTs...);
|
||||
template<typename Frame> using MethodType = R(Frame::*)(ArgTs ...) const;
|
||||
template<size_t I> using IthArgType = typename std::tuple_element<I, std::tuple<ArgTs ...> >::type;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
|
||||
static constexpr S32 NUM_ARGS = sizeof...(ArgTs) + startArgc;
|
||||
|
||||
template<size_t index, size_t method_offset = 0, typename ...RealArgTs>
|
||||
static IthArgType<index> getRealArgValue(S32 argc, ConsoleValueRef *argv, const _EngineFunctionDefaultArguments< void(RealArgTs...) >& defaultArgs)
|
||||
{
|
||||
if((startArgc + index) < argc)
|
||||
{
|
||||
return EngineUnmarshallData< IthArgType<index> >()( argv[ startArgc + index ] );
|
||||
} else {
|
||||
return std::get<index + method_offset>(defaultArgs.mArgs);
|
||||
}
|
||||
}
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs, Seq<I...>){
|
||||
return fn(SelfType::getRealArgValue<I>(argc, argv, defaultArgs) ...);
|
||||
}
|
||||
|
||||
template<typename Frame, size_t ...I>
|
||||
static R dispatchHelper(S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs, Seq<I...>){
|
||||
return (frame->*fn)(SelfType::getRealArgValue<I,1>(argc, argv, defaultArgs) ...);
|
||||
}
|
||||
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
};
|
||||
|
||||
template<typename ArgVT> struct MarshallHelpers {
|
||||
template<typename ...ArgTs> static void marshallEach(S32 &argc, ArgVT *argv, const ArgTs& ...args){}
|
||||
template<typename H, typename ...Tail> static void marshallEach(S32 &argc, ArgVT *argv, const H& head, const Tail& ...tail){
|
||||
argv[argc++] = EngineMarshallData(head);
|
||||
marshallEach(argc, argv, tail...);
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct MarshallHelpers<ConsoleValueRef> {
|
||||
template<typename ...ArgTs> static void marshallEach(S32 &argc, ConsoleValueRef *argv, const ArgTs& ...args){}
|
||||
template<typename H, typename ...Tail> static void marshallEach(S32 &argc, ConsoleValueRef *argv, const H& head, const Tail& ...tail){
|
||||
EngineMarshallData(head, argc, argv);
|
||||
marshallEach(argc, argv, tail...);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
template< S32 startArgc, typename T >
|
||||
|
|
@ -593,22 +593,22 @@ template< S32 startArgc, typename R, typename ...ArgTs >
|
|||
struct _EngineConsoleThunk< startArgc, R(ArgTs...) >
|
||||
{
|
||||
private:
|
||||
using Helper = engineAPI::detail::ThunkHelpers<startArgc, R, ArgTs...>;
|
||||
using SeqType = typename Helper::SeqType;
|
||||
using Helper = engineAPI::detail::ThunkHelpers<startArgc, R, ArgTs...>;
|
||||
using SeqType = typename Helper::SeqType;
|
||||
public:
|
||||
typedef typename Helper::FunctionType FunctionType;
|
||||
typedef typename Helper::ReturnType ReturnType;
|
||||
template<typename Frame> using MethodType = typename Helper::template MethodType<Frame>;
|
||||
static constexpr S32 NUM_ARGS = Helper::NUM_ARGS;
|
||||
|
||||
typedef typename Helper::FunctionType FunctionType;
|
||||
typedef typename Helper::ReturnType ReturnType;
|
||||
template<typename Frame> using MethodType = typename Helper::template MethodType<Frame>;
|
||||
static constexpr S32 NUM_ARGS = Helper::NUM_ARGS;
|
||||
|
||||
static ReturnType thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs)
|
||||
{
|
||||
return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType()));
|
||||
return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType()));
|
||||
}
|
||||
template< typename Frame >
|
||||
static ReturnType thunk( S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs)
|
||||
static ReturnType thunk( S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs)
|
||||
{
|
||||
return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType()));
|
||||
return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType()));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -616,23 +616,23 @@ public:
|
|||
template<S32 startArgc, typename ...ArgTs>
|
||||
struct _EngineConsoleThunk<startArgc, void(ArgTs...)> {
|
||||
private:
|
||||
using Helper = engineAPI::detail::ThunkHelpers<startArgc, void, ArgTs...>;
|
||||
using SeqType = typename Helper::SeqType;
|
||||
using Helper = engineAPI::detail::ThunkHelpers<startArgc, void, ArgTs...>;
|
||||
using SeqType = typename Helper::SeqType;
|
||||
public:
|
||||
typedef typename Helper::FunctionType FunctionType;
|
||||
typedef typename Helper::ReturnType ReturnType;
|
||||
template<typename Frame> using MethodType = typename Helper::template MethodType<Frame>;
|
||||
static constexpr S32 NUM_ARGS = Helper::NUM_ARGS;
|
||||
|
||||
static void thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs)
|
||||
{
|
||||
Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType());
|
||||
}
|
||||
template< typename Frame >
|
||||
static void thunk( S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs)
|
||||
{
|
||||
Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType());
|
||||
}
|
||||
typedef typename Helper::FunctionType FunctionType;
|
||||
typedef typename Helper::ReturnType ReturnType;
|
||||
template<typename Frame> using MethodType = typename Helper::template MethodType<Frame>;
|
||||
static constexpr S32 NUM_ARGS = Helper::NUM_ARGS;
|
||||
|
||||
static void thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs)
|
||||
{
|
||||
Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType());
|
||||
}
|
||||
template< typename Frame >
|
||||
static void thunk( S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs)
|
||||
{
|
||||
Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1182,7 +1182,7 @@ public:
|
|||
struct _EngineConsoleCallbackHelper : public _BaseEngineConsoleCallbackHelper
|
||||
{
|
||||
private:
|
||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||
public:
|
||||
|
||||
_EngineConsoleCallbackHelper( StringTableEntry callbackName, SimObject* pThis )
|
||||
|
|
@ -1191,7 +1191,7 @@ public:
|
|||
mArgc = mInitialArgc = pThis ? 2 : 1 ;
|
||||
mCallbackName = callbackName;
|
||||
}
|
||||
|
||||
|
||||
template< typename R, typename ...ArgTs >
|
||||
R call(ArgTs ...args)
|
||||
{
|
||||
|
|
@ -1200,9 +1200,9 @@ public:
|
|||
ConsoleStackFrameSaver sav; sav.save();
|
||||
CSTK.reserveValues(mArgc + sizeof...(ArgTs), mArgv);
|
||||
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
return R( EngineUnmarshallData< R >()( _exec() ) );
|
||||
}
|
||||
else
|
||||
|
|
@ -1211,9 +1211,9 @@ public:
|
|||
SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc + sizeof...(ArgTs), NULL, false, &cb);
|
||||
evt->populateArgs(mArgv);
|
||||
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime());
|
||||
|
||||
return R( EngineUnmarshallData< R >()( cb.waitForResult() ) );
|
||||
|
|
@ -1227,7 +1227,7 @@ public:
|
|||
template<typename P1> struct _EngineConsoleExecCallbackHelper : public _BaseEngineConsoleCallbackHelper
|
||||
{
|
||||
private:
|
||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||
public:
|
||||
|
||||
_EngineConsoleExecCallbackHelper( SimObject* pThis )
|
||||
|
|
@ -1247,7 +1247,7 @@ public:
|
|||
CSTK.reserveValues(mArgc+sizeof...(ArgTs), mArgv);
|
||||
mArgv[ 0 ].value->setStackStringValue(simCB);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
return R( EngineUnmarshallData< R >()( _exec() ) );
|
||||
}
|
||||
|
|
@ -1257,8 +1257,8 @@ public:
|
|||
SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+sizeof...(ArgTs), NULL, true, &cb);
|
||||
evt->populateArgs(mArgv);
|
||||
mArgv[ 0 ].value->setStackStringValue(simCB);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
Sim::postEvent(mThis, evt, Sim::getCurrentTime());
|
||||
|
||||
|
|
@ -1271,7 +1271,7 @@ public:
|
|||
template<> struct _EngineConsoleExecCallbackHelper<const char*> : public _BaseEngineConsoleCallbackHelper
|
||||
{
|
||||
private:
|
||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||
public:
|
||||
_EngineConsoleExecCallbackHelper( const char *callbackName )
|
||||
{
|
||||
|
|
@ -1288,9 +1288,9 @@ public:
|
|||
ConsoleStackFrameSaver sav; sav.save();
|
||||
CSTK.reserveValues(mArgc+sizeof...(ArgTs), mArgv);
|
||||
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
return R( EngineUnmarshallData< R >()( _exec() ) );
|
||||
}
|
||||
else
|
||||
|
|
@ -1299,8 +1299,8 @@ public:
|
|||
SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+sizeof...(ArgTs), NULL, false, &cb);
|
||||
evt->populateArgs(mArgv);
|
||||
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime());
|
||||
return R( EngineUnmarshallData< R >()( cb.waitForResult() ) );
|
||||
|
|
|
|||
|
|
@ -93,35 +93,35 @@ struct _EngineFunctionDefaultArguments {};
|
|||
template<typename ...ArgTs>
|
||||
struct _EngineFunctionDefaultArguments< void(ArgTs...) > : public EngineFunctionDefaultArguments
|
||||
{
|
||||
template<typename T> using DefVST = typename EngineTypeTraits<T>::DefaultArgumentValueStoreType;
|
||||
std::tuple<DefVST<ArgTs> ...> mArgs;
|
||||
template<typename T> using DefVST = typename EngineTypeTraits<T>::DefaultArgumentValueStoreType;
|
||||
std::tuple<DefVST<ArgTs> ...> mArgs;
|
||||
private:
|
||||
using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
template<typename ...TailTs, size_t ...I>
|
||||
static void copyHelper(std::tuple<DefVST<ArgTs> ...> &args, std::tuple<DefVST<TailTs> ...> &defaultArgs, Seq<I...>) {
|
||||
constexpr size_t offset = (sizeof...(ArgTs) - sizeof...(TailTs));
|
||||
std::tie(std::get<I + offset>(args)...) = defaultArgs;
|
||||
}
|
||||
|
||||
template<typename ...TailTs> using MaybeSelfEnabled = typename std::enable_if<sizeof...(TailTs) <= sizeof...(ArgTs), decltype(mArgs)>::type;
|
||||
|
||||
template<typename ...TailTs> static MaybeSelfEnabled<TailTs...> tailInit(TailTs ...tail) {
|
||||
std::tuple<DefVST<ArgTs>...> argsT;
|
||||
std::tuple<DefVST<TailTs>...> tailT = std::make_tuple(tail...);
|
||||
SelfType::copyHelper<TailTs...>(argsT, tailT, typename Gens<sizeof...(TailTs)>::type());
|
||||
return argsT;
|
||||
};
|
||||
|
||||
using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
template<typename ...TailTs, size_t ...I>
|
||||
static void copyHelper(std::tuple<DefVST<ArgTs> ...> &args, std::tuple<DefVST<TailTs> ...> &defaultArgs, Seq<I...>) {
|
||||
constexpr size_t offset = (sizeof...(ArgTs) - sizeof...(TailTs));
|
||||
std::tie(std::get<I + offset>(args)...) = defaultArgs;
|
||||
}
|
||||
|
||||
template<typename ...TailTs> using MaybeSelfEnabled = typename std::enable_if<sizeof...(TailTs) <= sizeof...(ArgTs), decltype(mArgs)>::type;
|
||||
|
||||
template<typename ...TailTs> static MaybeSelfEnabled<TailTs...> tailInit(TailTs ...tail) {
|
||||
std::tuple<DefVST<ArgTs>...> argsT;
|
||||
std::tuple<DefVST<TailTs>...> tailT = std::make_tuple(tail...);
|
||||
SelfType::copyHelper<TailTs...>(argsT, tailT, typename Gens<sizeof...(TailTs)>::type());
|
||||
return argsT;
|
||||
};
|
||||
|
||||
public:
|
||||
template<typename ...TailTs> _EngineFunctionDefaultArguments(TailTs ...tail)
|
||||
: EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(SelfType::tailInit(tail...))
|
||||
{}
|
||||
template<typename ...TailTs> _EngineFunctionDefaultArguments(TailTs ...tail)
|
||||
: EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(SelfType::tailInit(tail...))
|
||||
{}
|
||||
};
|
||||
|
||||
#pragma pack( pop )
|
||||
|
|
|
|||
|
|
@ -109,15 +109,15 @@ void FieldBrushObject::destroyFields()
|
|||
static char replacebuf[1024];
|
||||
static char* suppressSpaces(const char* in_pname)
|
||||
{
|
||||
U32 i = 0;
|
||||
char chr;
|
||||
do
|
||||
{
|
||||
chr = in_pname[i];
|
||||
replacebuf[i++] = (chr != 32) ? chr : '_';
|
||||
} while(chr);
|
||||
U32 i = 0;
|
||||
char chr;
|
||||
do
|
||||
{
|
||||
chr = in_pname[i];
|
||||
replacebuf[i++] = (chr != 32) ? chr : '_';
|
||||
} while(chr);
|
||||
|
||||
return replacebuf;
|
||||
return replacebuf;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -125,7 +125,7 @@ static char* suppressSpaces(const char* in_pname)
|
|||
//-----------------------------------------------------------------------------
|
||||
DefineConsoleMethod(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.")
|
||||
"@return Space-seperated static-field group list.")
|
||||
{
|
||||
// Fetch selected object.
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( simObjName ) );
|
||||
|
|
@ -194,7 +194,7 @@ DefineConsoleMethod(FieldBrushObject, queryGroups, const char*, (const char* sim
|
|||
DefineConsoleMethod(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.")
|
||||
"@return Space-seperated static-field list.")
|
||||
{
|
||||
// Fetch selected object.
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( simObjName ) );
|
||||
|
|
@ -369,7 +369,7 @@ DefineConsoleMethod(FieldBrushObject, queryFields, const char*, (const char* sim
|
|||
DefineConsoleMethod(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.")
|
||||
"@return No return value.")
|
||||
{
|
||||
// Fetch selected object.
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( simObjName ) );
|
||||
|
|
@ -502,7 +502,7 @@ void FieldBrushObject::copyFields( SimObject* pSimObject, const char* fieldList
|
|||
//-----------------------------------------------------------------------------
|
||||
DefineConsoleMethod(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.")
|
||||
"@return No return value.")
|
||||
{
|
||||
// Fetch selected object.
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( simObjName ) );
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ DefineEngineFunction( findNextFile, String, ( const char* pattern ), ( "" ),
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction( getFileCount, S32, ( const char* pattern, bool recurse ), ( "", true ),
|
||||
"@brief Returns the number of files in the directory tree that match the given patterns\n\n"
|
||||
"@brief Returns the number of files in the directory tree that match the given patterns\n\n"
|
||||
|
||||
"This function differs from getFileCountMultiExpr() in that it supports a single search "
|
||||
"pattern being passed in.\n\n"
|
||||
|
|
@ -246,7 +246,7 @@ DefineEngineFunction( getFileCount, S32, ( const char* pattern, bool recurse ),
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction(findFirstFileMultiExpr, String, ( const char* pattern, bool recurse ), ( "", true),
|
||||
"@brief Returns the first file in the directory system matching the given patterns.\n\n"
|
||||
"@brief Returns the first file in the directory system matching the given patterns.\n\n"
|
||||
|
||||
"Use the corresponding findNextFileMultiExpr() to step through "
|
||||
"the results. If you're only interested in the number of files returned by the "
|
||||
|
|
@ -259,10 +259,10 @@ DefineEngineFunction(findFirstFileMultiExpr, String, ( const char* pattern, bool
|
|||
"call to findFirstFile() and findFirstFileMultiExpr() initiates a new search and renders "
|
||||
"a previous search invalid.\n\n"
|
||||
|
||||
"@param pattern The path and file name pattern to match against, such as *.cs. Separate "
|
||||
"@param pattern The path and file name pattern to match against, such as *.cs. Separate "
|
||||
"multiple patterns with TABs. For example: \"*.cs\" TAB \"*.dso\"\n"
|
||||
"@param recurse If true, the search will exhaustively recurse into subdirectories "
|
||||
"of the given path and match the given filename patterns.\n"
|
||||
"@param recurse If true, the search will exhaustively recurse into subdirectories "
|
||||
"of the given path and match the given filename patterns.\n"
|
||||
"@return String of the first matching file path, or an empty string if no matching "
|
||||
"files were found.\n\n"
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ DefineEngineFunction(findFirstFileMultiExpr, String, ( const char* pattern, bool
|
|||
"@see findNextFileMultiExpr()"
|
||||
"@see getFileCountMultiExpr()"
|
||||
"@see findFirstFile()"
|
||||
"@ingroup FileSearches")
|
||||
"@ingroup FileSearches")
|
||||
{
|
||||
S32 numResults = buildFileList(pattern, recurse, true);
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ DefineEngineFunction(findFirstFileMultiExpr, String, ( const char* pattern, bool
|
|||
DefineEngineFunction(findNextFileMultiExpr, String, ( const char* pattern ), (""),
|
||||
"@brief Returns the next file matching a search begun in findFirstFileMultiExpr().\n\n"
|
||||
|
||||
"@param pattern The path and file name pattern to match against. This is optional "
|
||||
"@param pattern The path and file name pattern to match against. This is optional "
|
||||
"and may be left out as it is not used by the code. It is here for legacy reasons.\n"
|
||||
"@return String of the next matching file path, or an empty string if no matching "
|
||||
"files were found.\n\n"
|
||||
|
|
@ -319,7 +319,7 @@ DefineEngineFunction(findNextFileMultiExpr, String, ( const char* pattern ), (""
|
|||
"@endtsexample\n\n"
|
||||
|
||||
"@see findFirstFileMultiExpr()"
|
||||
"@ingroup FileSearches")
|
||||
"@ingroup FileSearches")
|
||||
{
|
||||
if ( sgFindFilesPos + 1 > sgFindFilesResults.size() )
|
||||
return String();
|
||||
|
|
@ -328,16 +328,16 @@ DefineEngineFunction(findNextFileMultiExpr, String, ( const char* pattern ), (""
|
|||
}
|
||||
|
||||
DefineEngineFunction(getFileCountMultiExpr, S32, ( const char* pattern, bool recurse ), ( "", true),
|
||||
"@brief Returns the number of files in the directory tree that match the given patterns\n\n"
|
||||
"@brief Returns the number of files in the directory tree that match the given patterns\n\n"
|
||||
|
||||
"If you're interested in a list of files that match the given patterns and not just "
|
||||
"the number of files, use findFirstFileMultiExpr() and findNextFileMultiExpr().\n\n"
|
||||
|
||||
"@param pattern The path and file name pattern to match against, such as *.cs. Separate "
|
||||
"@param pattern The path and file name pattern to match against, such as *.cs. Separate "
|
||||
"multiple patterns with TABs. For example: \"*.cs\" TAB \"*.dso\"\n"
|
||||
"@param recurse If true, the search will exhaustively recurse into subdirectories "
|
||||
"of the given path and match the given filename pattern.\n"
|
||||
"@return Number of files located using the patterns\n\n"
|
||||
"@param recurse If true, the search will exhaustively recurse into subdirectories "
|
||||
"of the given path and match the given filename pattern.\n"
|
||||
"@return Number of files located using the patterns\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// Count all DTS or Collada models\n"
|
||||
|
|
@ -347,7 +347,7 @@ DefineEngineFunction(getFileCountMultiExpr, S32, ( const char* pattern, bool rec
|
|||
|
||||
"@see findFirstFileMultiExpr()"
|
||||
"@see findNextFileMultiExpr()"
|
||||
"@ingroup FileSearches")
|
||||
"@ingroup FileSearches")
|
||||
{
|
||||
S32 numResults = buildFileList(pattern, recurse, true);
|
||||
|
||||
|
|
@ -399,14 +399,14 @@ DefineEngineFunction(isFile, bool, ( const char* fileName ),,
|
|||
}
|
||||
|
||||
DefineEngineFunction( IsDirectory, bool, ( const char* directory ),,
|
||||
"@brief Determines if a specified directory exists or not\n\n"
|
||||
"@brief Determines if a specified directory exists or not\n\n"
|
||||
|
||||
"@param directory String containing path in the form of \"foo/bar\"\n"
|
||||
"@param directory String containing path in the form of \"foo/bar\"\n"
|
||||
"@return Returns true if the directory was found.\n"
|
||||
|
||||
"@note Do not include a trailing slash '/'.\n"
|
||||
"@note Do not include a trailing slash '/'.\n"
|
||||
|
||||
"@ingroup FileSystem")
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
String dir(Torque::Path::CleanSeparators(directory));
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), dir.c_str());
|
||||
|
|
@ -416,12 +416,12 @@ DefineEngineFunction( IsDirectory, bool, ( const char* directory ),,
|
|||
}
|
||||
|
||||
DefineEngineFunction(isWriteableFileName, bool, ( const char* fileName ),,
|
||||
"@brief Determines if a file name can be written to using File I/O\n\n"
|
||||
"@brief Determines if a file name can be written to using File I/O\n\n"
|
||||
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return Returns true if the file can be written to.\n"
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return Returns true if the file can be written to.\n"
|
||||
|
||||
"@ingroup FileSystem")
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
String filename(Torque::Path::CleanSeparators(fileName));
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), filename.c_str());
|
||||
|
|
@ -434,32 +434,32 @@ DefineEngineFunction(isWriteableFileName, bool, ( const char* fileName ),,
|
|||
}
|
||||
|
||||
DefineEngineFunction(startFileChangeNotifications, void, (),,
|
||||
"@brief Start watching resources for file changes\n\n"
|
||||
"@brief Start watching resources for file changes\n\n"
|
||||
"Typically this is called during initializeCore().\n\n"
|
||||
"@see stopFileChangeNotifications()\n"
|
||||
"@ingroup FileSystem")
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
Torque::FS::StartFileChangeNotifications();
|
||||
}
|
||||
|
||||
DefineEngineFunction(stopFileChangeNotifications, void, (),,
|
||||
"@brief Stop watching resources for file changes\n\n"
|
||||
"@brief Stop watching resources for file changes\n\n"
|
||||
"Typically this is called during shutdownCore().\n\n"
|
||||
"@see startFileChangeNotifications()\n"
|
||||
"@ingroup FileSystem")
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
Torque::FS::StopFileChangeNotifications();
|
||||
}
|
||||
|
||||
|
||||
DefineEngineFunction(getDirectoryList, String, ( const char* path, S32 depth ), ( "", 0 ),
|
||||
"@brief Gathers a list of directories starting at the given path.\n\n"
|
||||
"@brief Gathers a list of directories starting at the given path.\n\n"
|
||||
|
||||
"@param path String containing the path of the directory\n"
|
||||
"@param depth Depth of search, as in how many subdirectories to parse through\n"
|
||||
"@return Tab delimited string containing list of directories found during search, \"\" if no files were found\n"
|
||||
"@param path String containing the path of the directory\n"
|
||||
"@param depth Depth of search, as in how many subdirectories to parse through\n"
|
||||
"@return Tab delimited string containing list of directories found during search, \"\" if no files were found\n"
|
||||
|
||||
"@ingroup FileSystem")
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
// Grab the full path.
|
||||
char fullpath[1024];
|
||||
|
|
@ -508,23 +508,23 @@ DefineEngineFunction(getDirectoryList, String, ( const char* path, S32 depth ),
|
|||
}
|
||||
|
||||
DefineEngineFunction(fileSize, S32, ( const char* fileName ),,
|
||||
"@brief Determines the size of a file on disk\n\n"
|
||||
"@brief Determines the size of a file on disk\n\n"
|
||||
|
||||
"@param fileName Name and path of the file to check\n"
|
||||
"@return Returns filesize in bytes, or -1 if no file\n"
|
||||
"@param fileName Name and path of the file to check\n"
|
||||
"@return Returns filesize in bytes, or -1 if no file\n"
|
||||
|
||||
"@ingroup FileSystem")
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileName);
|
||||
return Platform::getFileSize( sgScriptFilenameBuffer );
|
||||
}
|
||||
|
||||
DefineEngineFunction( fileModifiedTime, String, ( const char* fileName ),,
|
||||
"@brief Returns a platform specific formatted string with the last modified time for the file.\n\n"
|
||||
"@brief Returns a platform specific formatted string with the last modified time for the file.\n\n"
|
||||
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return Formatted string (OS specific) containing modified time, \"9/3/2010 12:33:47 PM\" for example\n"
|
||||
"@ingroup FileSystem")
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return Formatted string (OS specific) containing modified time, \"9/3/2010 12:33:47 PM\" for example\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileName);
|
||||
|
||||
|
|
@ -566,12 +566,12 @@ DefineEngineFunction( fileCreatedTime, String, ( const char* fileName ),,
|
|||
}
|
||||
|
||||
DefineEngineFunction(fileDelete, bool, ( const char* path ),,
|
||||
"@brief Delete a file from the hard drive\n\n"
|
||||
"@brief Delete a file from the hard drive\n\n"
|
||||
|
||||
"@param path Name and path of the file to delete\n"
|
||||
"@note THERE IS NO RECOVERY FROM THIS. Deleted file is gone for good.\n"
|
||||
"@return True if file was successfully deleted\n"
|
||||
"@ingroup FileSystem")
|
||||
"@param path Name and path of the file to delete\n"
|
||||
"@note THERE IS NO RECOVERY FROM THIS. Deleted file is gone for good.\n"
|
||||
"@return True if file was successfully deleted\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
static char fileName[1024];
|
||||
static char sandboxFileName[1024];
|
||||
|
|
@ -586,11 +586,11 @@ DefineEngineFunction(fileDelete, bool, ( const char* path ),,
|
|||
//----------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction(fileExt, String, ( const char* fileName ),,
|
||||
"@brief Get the extension of a file\n\n"
|
||||
"@brief Get the extension of a file\n\n"
|
||||
|
||||
"@param fileName Name and path of file\n"
|
||||
"@return String containing the extension, such as \".exe\" or \".cs\"\n"
|
||||
"@ingroup FileSystem")
|
||||
"@param fileName Name and path of file\n"
|
||||
"@return String containing the extension, such as \".exe\" or \".cs\"\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
const char *ret = dStrrchr(fileName, '.');
|
||||
if(ret)
|
||||
|
|
@ -626,11 +626,11 @@ DefineEngineFunction(fileBase, String, ( const char* fileName ),,
|
|||
}
|
||||
|
||||
DefineEngineFunction(fileName, String, ( const char* fileName ),,
|
||||
"@brief Get only the file name of a path and file name string (removes path)\n\n"
|
||||
"@brief Get only the file name of a path and file name string (removes path)\n\n"
|
||||
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return String containing the file name, minus the path\n"
|
||||
"@ingroup FileSystem")
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return String containing the file name, minus the path\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
S32 pathLen = dStrlen( fileName );
|
||||
FrameTemp<char> szPathCopy( pathLen + 1);
|
||||
|
|
@ -649,11 +649,11 @@ DefineEngineFunction(fileName, String, ( const char* fileName ),,
|
|||
}
|
||||
|
||||
DefineEngineFunction(filePath, String, ( const char* fileName ),,
|
||||
"@brief Get the path of a file (removes name and extension)\n\n"
|
||||
"@brief Get the path of a file (removes name and extension)\n\n"
|
||||
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return String containing the path, minus name and extension\n"
|
||||
"@ingroup FileSystem")
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return String containing the path, minus name and extension\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
S32 pathLen = dStrlen( fileName );
|
||||
FrameTemp<char> szPathCopy( pathLen + 1);
|
||||
|
|
@ -672,10 +672,10 @@ DefineEngineFunction(filePath, String, ( const char* fileName ),,
|
|||
}
|
||||
|
||||
DefineEngineFunction(getWorkingDirectory, String, (),,
|
||||
"@brief Reports the current directory\n\n"
|
||||
"@brief Reports the current directory\n\n"
|
||||
|
||||
"@return String containing full file path of working directory\n"
|
||||
"@ingroup FileSystem")
|
||||
"@return String containing full file path of working directory\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
return Platform::getCurrentDirectory();
|
||||
}
|
||||
|
|
@ -687,13 +687,13 @@ DefineEngineFunction(getWorkingDirectory, String, (),,
|
|||
// are not currently built with TORQUE_TOOLS defined.
|
||||
|
||||
DefineEngineFunction(makeFullPath, String, ( const char* path, const char* cwd ), ( "", ""),
|
||||
"@brief Converts a relative file path to a full path\n\n"
|
||||
"@brief Converts a relative file path to a full path\n\n"
|
||||
|
||||
"For example, \"./console.log\" becomes \"C:/Torque/t3d/examples/FPS Example/game/console.log\"\n"
|
||||
"@param path Name of file or path to check\n"
|
||||
"For example, \"./console.log\" becomes \"C:/Torque/t3d/examples/FPS Example/game/console.log\"\n"
|
||||
"@param path Name of file or path to check\n"
|
||||
"@param cwd Optional current working directory from which to build the full path.\n"
|
||||
"@return String containing non-relative directory of path\n"
|
||||
"@ingroup FileSystem")
|
||||
"@return String containing non-relative directory of path\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
static const U32 bufSize = 512;
|
||||
char *buf = Con::getReturnBuffer(bufSize);
|
||||
|
|
@ -702,25 +702,25 @@ DefineEngineFunction(makeFullPath, String, ( const char* path, const char* cwd )
|
|||
}
|
||||
|
||||
DefineEngineFunction(makeRelativePath, String, ( const char* path, const char* to ), ( "", ""),
|
||||
"@brief Turns a full or local path to a relative one\n\n"
|
||||
"@brief Turns a full or local path to a relative one\n\n"
|
||||
|
||||
"For example, \"./game/art\" becomes \"game/art\"\n"
|
||||
"@param path Full path (may include a file) to convert\n"
|
||||
"@param to Optional base path used for the conversion. If not supplied the current "
|
||||
"working directory is used.\n"
|
||||
"@returns String containing relative path\n"
|
||||
"@ingroup FileSystem")
|
||||
"@returns String containing relative path\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
return Platform::makeRelativePathName( path, dStrlen(to) > 1 ? to : NULL );
|
||||
}
|
||||
|
||||
DefineEngineFunction(pathConcat, String, ( const char* path, const char* file), ( "", ""),
|
||||
"@brief Combines two separate strings containing a file path and file name together into a single string\n\n"
|
||||
"@brief Combines two separate strings containing a file path and file name together into a single string\n\n"
|
||||
|
||||
"@param path String containing file path\n"
|
||||
"@param file String containing file name\n"
|
||||
"@return String containing concatenated file name and path\n"
|
||||
"@ingroup FileSystem")
|
||||
"@param path String containing file path\n"
|
||||
"@param file String containing file name\n"
|
||||
"@return String containing concatenated file name and path\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
static const U32 bufSize = 1024;
|
||||
char *buf = Con::getReturnBuffer(bufSize);
|
||||
|
|
@ -731,10 +731,10 @@ DefineEngineFunction(pathConcat, String, ( const char* path, const char* file),
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction(getExecutableName, String, (),,
|
||||
"@brief Gets the name of the game's executable\n\n"
|
||||
"@brief Gets the name of the game's executable\n\n"
|
||||
|
||||
"@return String containing this game's executable name\n"
|
||||
"@ingroup FileSystem")
|
||||
"@return String containing this game's executable name\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
return Platform::getExecutableName();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,22 +34,22 @@
|
|||
IMPLEMENT_CONOBJECT(PersistenceManager);
|
||||
|
||||
ConsoleDocClass( PersistenceManager,
|
||||
"@brief this class manages updating SimObjects in the file they were "
|
||||
"created in non-destructively (mostly aimed at datablocks and materials).\n\n"
|
||||
"@brief this class manages updating SimObjects in the file they were "
|
||||
"created in non-destructively (mostly aimed at datablocks and materials).\n\n"
|
||||
|
||||
"Basic scripting interface:\n\n"
|
||||
" - Creation: new PersistenceManager(FooManager);\n"
|
||||
" - Flag objects as dirty: FooManager.setDirty(<object name or id>);\n"
|
||||
" - Remove objects from dirty list: FooManager.removeDirty(<object name or id>);\n"
|
||||
" - List all currently dirty objects: FooManager.listDirty();\n"
|
||||
" - Check to see if an object is dirty: FooManager.isDirty(<object name or id>);\n"
|
||||
" - Save dirty objects to their files: FooManager.saveDirty();\n\n"
|
||||
"@note Dirty objects don't update their files until saveDirty() is "
|
||||
"called so you can change their properties after you flag them as dirty\n\n"
|
||||
"@note Currently only used by editors, not intended for actual game development\n\n"
|
||||
"@ingroup Console\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal");
|
||||
"Basic scripting interface:\n\n"
|
||||
" - Creation: new PersistenceManager(FooManager);\n"
|
||||
" - Flag objects as dirty: FooManager.setDirty(<object name or id>);\n"
|
||||
" - Remove objects from dirty list: FooManager.removeDirty(<object name or id>);\n"
|
||||
" - List all currently dirty objects: FooManager.listDirty();\n"
|
||||
" - Check to see if an object is dirty: FooManager.isDirty(<object name or id>);\n"
|
||||
" - Save dirty objects to their files: FooManager.saveDirty();\n\n"
|
||||
"@note Dirty objects don't update their files until saveDirty() is "
|
||||
"called so you can change their properties after you flag them as dirty\n\n"
|
||||
"@note Currently only used by editors, not intended for actual game development\n\n"
|
||||
"@ingroup Console\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal");
|
||||
|
||||
PersistenceManager::PersistenceManager()
|
||||
{
|
||||
|
|
@ -890,7 +890,7 @@ PersistenceManager::ParsedObject* PersistenceManager::findParsedObject(SimObject
|
|||
{
|
||||
const ParsedProperty &prop = testObj->properties[j];
|
||||
|
||||
if ( dStrcmp( prop.name, "internalName" ) == 0 &&
|
||||
if ( dStrcmp( prop.name, "internalName" ) == 0 &&
|
||||
dStrcmp( prop.value, object->getInternalName() ) == 0 )
|
||||
return testObj;
|
||||
else if ( dStrcmp(prop.name, "internalName") == 0)
|
||||
|
|
@ -2037,24 +2037,24 @@ bool PersistenceManager::saveDirtyObject(SimObject* object)
|
|||
const char *name = object->getName();
|
||||
if (name)
|
||||
{
|
||||
Con::errorf("PersistenceManager::saveDirtyObject(): Unable to open %s to save %s %s (%d)",
|
||||
dirtyObject.fileName, object->getClassName(), name, object->getId());
|
||||
}
|
||||
else
|
||||
{
|
||||
Con::errorf("PersistenceManager::saveDirtyObject(): Unable to open %s to save %s (%d)",
|
||||
dirtyObject.fileName, object->getClassName(), object->getId());
|
||||
}
|
||||
Con::errorf("PersistenceManager::saveDirtyObject(): Unable to open %s to save %s %s (%d)",
|
||||
dirtyObject.fileName, object->getClassName(), name, object->getId());
|
||||
}
|
||||
else
|
||||
{
|
||||
Con::errorf("PersistenceManager::saveDirtyObject(): Unable to open %s to save %s (%d)",
|
||||
dirtyObject.fileName, object->getClassName(), object->getId());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// if the file exists then lets update and save
|
||||
if(mCurrentFile)
|
||||
{
|
||||
updateObject(object);
|
||||
if(mCurrentFile)
|
||||
{
|
||||
updateObject(object);
|
||||
saveDirtyFile();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -2230,7 +2230,7 @@ DefineConsoleMethod( PersistenceManager, removeDirty, void, ( const char * objNa
|
|||
"Remove a SimObject from the dirty list.")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
if (dStrcmp( objName,"")!=0)
|
||||
if (dStrcmp( objName,"")!=0)
|
||||
{
|
||||
if (!Sim::findObject(objName, dirtyObject))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -343,10 +343,10 @@ bool collapseScriptFilename(char *filename, U32 size, const char *src)
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
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")
|
||||
"@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;
|
||||
|
|
@ -356,9 +356,9 @@ ConsoleFunction(expandFilename, const char*, 2, 2, "(string filename)"
|
|||
}
|
||||
|
||||
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")
|
||||
"@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;
|
||||
|
|
@ -372,7 +372,7 @@ ConsoleFunction(expandOldFilename, const char*, 2, 2, "(string filename)"
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleToolFunction(collapseFilename, const char*, 2, 2, "(string filename)"
|
||||
"@internal Editor use only")
|
||||
"@internal Editor use only")
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
static const U32 bufSize = 1024;
|
||||
|
|
@ -382,7 +382,7 @@ ConsoleToolFunction(collapseFilename, const char*, 2, 2, "(string filename)"
|
|||
}
|
||||
|
||||
ConsoleToolFunction(setScriptPathExpando, void, 3, 4, "(string expando, string path[, bool toolsOnly])"
|
||||
"@internal Editor use only")
|
||||
"@internal Editor use only")
|
||||
{
|
||||
if(argc == 4)
|
||||
Con::setScriptPathExpando(argv[1], argv[2], dAtob(argv[3]));
|
||||
|
|
@ -391,13 +391,13 @@ ConsoleToolFunction(setScriptPathExpando, void, 3, 4, "(string expando, string p
|
|||
}
|
||||
|
||||
ConsoleToolFunction(removeScriptPathExpando, void, 2, 2, "(string expando)"
|
||||
"@internal Editor use only")
|
||||
"@internal Editor use only")
|
||||
{
|
||||
Con::removeScriptPathExpando(argv[1]);
|
||||
}
|
||||
|
||||
ConsoleToolFunction(isScriptPathExpando, bool, 2, 2, "(string expando)"
|
||||
"@internal Editor use only")
|
||||
"@internal Editor use only")
|
||||
{
|
||||
return Con::isScriptPathExpando(argv[1]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,13 +53,13 @@ ConsoleDocClass( ScriptObject,
|
|||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( ScriptObject, onAdd, void, ( SimObjectId ID ), ( ID ),
|
||||
"Called when this ScriptObject is added to the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
"Called when this ScriptObject is added to the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( ScriptObject, onRemove, void, ( SimObjectId ID ), ( ID ),
|
||||
"Called when this ScriptObject is removed from the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
"Called when this ScriptObject is removed from the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
);
|
||||
|
||||
ScriptObject::ScriptObject()
|
||||
|
|
@ -105,18 +105,18 @@ ConsoleDocClass( ScriptTickObject,
|
|||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( ScriptTickObject, onInterpolateTick, void, ( F32 delta ), ( delta ),
|
||||
"This is called every frame, but only if the object is set to process ticks.\n"
|
||||
"@param delta The time delta for this frame.\n"
|
||||
"This is called every frame, but only if the object is set to process ticks.\n"
|
||||
"@param delta The time delta for this frame.\n"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( ScriptTickObject, onProcessTick, void, (), (),
|
||||
"Called once every 32ms if this object is set to process ticks.\n"
|
||||
"Called once every 32ms if this object is set to process ticks.\n"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( ScriptTickObject, onAdvanceTime, void, ( F32 timeDelta ), ( timeDelta ),
|
||||
"This is called every frame regardless if the object is set to process ticks, but only "
|
||||
"This is called every frame regardless if the object is set to process ticks, but only "
|
||||
"if the callOnAdvanceTime property is set to true.\n"
|
||||
"@param timeDelta The time delta for this frame.\n"
|
||||
"@param timeDelta The time delta for this frame.\n"
|
||||
"@see callOnAdvanceTime\n"
|
||||
);
|
||||
|
||||
|
|
@ -188,37 +188,37 @@ DefineEngineMethod( ScriptTickObject, isProcessingTicks, bool, ( ),,
|
|||
IMPLEMENT_CONOBJECT(ScriptGroup);
|
||||
|
||||
ConsoleDocClass( ScriptGroup,
|
||||
"@brief Essentially a SimGroup, but with onAdd and onRemove script callbacks.\n\n"
|
||||
"@brief Essentially a SimGroup, but with onAdd and onRemove script callbacks.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// First container, SimGroup containing a ScriptGroup\n"
|
||||
"new SimGroup(Scenes)\n"
|
||||
"{\n"
|
||||
" // Subcontainer, ScriptGroup containing variables\n"
|
||||
" // related to a cut scene and a starting WayPoint\n"
|
||||
" new ScriptGroup(WelcomeScene)\n"
|
||||
" {\n"
|
||||
" class = \"Scene\";\n"
|
||||
" pathName = \"Pathx\";\n"
|
||||
" description = \"A small orc village set in the Hardesty mountains. This town and its surroundings will be used to illustrate some the Torque Game Engine\'s features.\";\n"
|
||||
" pathTime = \"0\";\n"
|
||||
" title = \"Welcome to Orc Town\";\n\n"
|
||||
" new WayPoint(start)\n"
|
||||
" {\n"
|
||||
" position = \"163.873 -103.82 208.354\";\n"
|
||||
" rotation = \"0.136165 -0.0544916 0.989186 44.0527\";\n"
|
||||
" scale = \"1 1 1\";\n"
|
||||
" dataBlock = \"WayPointMarker\";\n"
|
||||
" team = \"0\";\n"
|
||||
" };\n"
|
||||
" };\n"
|
||||
"};\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"// First container, SimGroup containing a ScriptGroup\n"
|
||||
"new SimGroup(Scenes)\n"
|
||||
"{\n"
|
||||
" // Subcontainer, ScriptGroup containing variables\n"
|
||||
" // related to a cut scene and a starting WayPoint\n"
|
||||
" new ScriptGroup(WelcomeScene)\n"
|
||||
" {\n"
|
||||
" class = \"Scene\";\n"
|
||||
" pathName = \"Pathx\";\n"
|
||||
" description = \"A small orc village set in the Hardesty mountains. This town and its surroundings will be used to illustrate some the Torque Game Engine\'s features.\";\n"
|
||||
" pathTime = \"0\";\n"
|
||||
" title = \"Welcome to Orc Town\";\n\n"
|
||||
" new WayPoint(start)\n"
|
||||
" {\n"
|
||||
" position = \"163.873 -103.82 208.354\";\n"
|
||||
" rotation = \"0.136165 -0.0544916 0.989186 44.0527\";\n"
|
||||
" scale = \"1 1 1\";\n"
|
||||
" dataBlock = \"WayPointMarker\";\n"
|
||||
" team = \"0\";\n"
|
||||
" };\n"
|
||||
" };\n"
|
||||
"};\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@see SimGroup\n"
|
||||
"@see SimGroup\n"
|
||||
|
||||
"@ingroup Console\n"
|
||||
"@ingroup Scripting"
|
||||
"@ingroup Console\n"
|
||||
"@ingroup Scripting"
|
||||
);
|
||||
|
||||
ScriptGroup::ScriptGroup()
|
||||
|
|
@ -226,13 +226,13 @@ ScriptGroup::ScriptGroup()
|
|||
}
|
||||
|
||||
IMPLEMENT_CALLBACK( ScriptGroup, onAdd, void, ( SimObjectId ID ), ( ID ),
|
||||
"Called when this ScriptGroup is added to the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
"Called when this ScriptGroup is added to the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( ScriptGroup, onRemove, void, ( SimObjectId ID ), ( ID ),
|
||||
"Called when this ScriptObject is removed from the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
"Called when this ScriptObject is removed from the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
);
|
||||
|
||||
bool ScriptGroup::onAdd()
|
||||
|
|
@ -248,7 +248,7 @@ bool ScriptGroup::onAdd()
|
|||
void ScriptGroup::onRemove()
|
||||
{
|
||||
// Call onRemove in script!
|
||||
onRemove_callback(getId());
|
||||
onRemove_callback(getId());
|
||||
|
||||
Parent::onRemove();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ DefineConsoleFunction( spawnObject, S32, ( const char * spawnClass
|
|||
, const char * spawnProperties
|
||||
, const char * spawnScript
|
||||
),("","","","") ,"spawnObject(class [, dataBlock, name, properties, script])"
|
||||
"@hide")
|
||||
"@hide")
|
||||
{
|
||||
SimObject* spawnObject = Sim::spawnObject(spawnClass, spawnDataBlock, spawnName, spawnProperties, spawnScript);
|
||||
|
||||
|
|
@ -203,12 +203,12 @@ ConsoleFunction(schedule, S32, 4, 0, "schedule(time, refobject|0, command, <arg1
|
|||
}
|
||||
|
||||
DefineConsoleFunction( 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"
|
||||
"@note Currently only used by editors\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
"( 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"
|
||||
"@note Currently only used by editors\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
{
|
||||
String outName = Sim::getUniqueName( baseName );
|
||||
|
||||
|
|
@ -247,10 +247,10 @@ DefineConsoleFunction( getUniqueInternalName, const char*, (const char * baseNam
|
|||
}
|
||||
|
||||
DefineConsoleFunction( 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"
|
||||
"@ingroup Console")
|
||||
"@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"
|
||||
"@ingroup Console")
|
||||
{
|
||||
return Sim::isValidObjectName( name );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ void SimNameDictionary::remove(SimObject* obj)
|
|||
if(*walk == obj)
|
||||
{
|
||||
*walk = obj->nextNameObject;
|
||||
obj->nextNameObject = (SimObject*)-1;
|
||||
obj->nextNameObject = (SimObject*)-1;
|
||||
hashEntryCount--;
|
||||
|
||||
Mutex::unlockMutex(mutex);
|
||||
|
|
@ -164,7 +164,7 @@ void SimNameDictionary::remove(SimObject* obj)
|
|||
root.erase(name);
|
||||
#endif
|
||||
Mutex::unlockMutex(mutex);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -279,7 +279,7 @@ void SimManagerNameDictionary::remove(SimObject* obj)
|
|||
if(*walk == obj)
|
||||
{
|
||||
*walk = obj->nextManagerNameObject;
|
||||
obj->nextManagerNameObject = (SimObject*)-1;
|
||||
obj->nextManagerNameObject = (SimObject*)-1;
|
||||
hashEntryCount--;
|
||||
|
||||
Mutex::unlockMutex(mutex);
|
||||
|
|
@ -293,7 +293,7 @@ void SimManagerNameDictionary::remove(SimObject* obj)
|
|||
root.erase(name);
|
||||
#endif
|
||||
Mutex::unlockMutex(mutex);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ struct StringTableEntryEq
|
|||
}
|
||||
};
|
||||
|
||||
typedef std::unordered_map<StringTableEntry, SimObject*, StringTableEntryHash, StringTableEntryEq> StringDictDef;
|
||||
typedef std::unordered_map<StringTableEntry, SimObject*, StringTableEntryHash, StringTableEntryEq> StringDictDef;
|
||||
typedef std::unordered_map<SimObjectId, SimObject*> SimObjectIdDictDef;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ SimConsoleEvent::SimConsoleEvent(S32 argc, ConsoleValueRef *argv, bool onObject)
|
|||
mArgv[i].value = new ConsoleValue();
|
||||
mArgv[i].value->type = ConsoleValue::TypeInternalString;
|
||||
mArgv[i].value->init();
|
||||
if (argv)
|
||||
{
|
||||
mArgv[i].value->setStringValue((const char*)argv[i]);
|
||||
}
|
||||
if (argv)
|
||||
{
|
||||
mArgv[i].value->setStringValue((const char*)argv[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,13 +93,13 @@ static void shutdownEventQueue()
|
|||
|
||||
U32 postEvent(SimObject *destObject, SimEvent* event,U32 time)
|
||||
{
|
||||
AssertFatal(time == -1 || time >= getCurrentTime(),
|
||||
AssertFatal(time == -1 || time >= getCurrentTime(),
|
||||
"Sim::postEvent() - Event time must be greater than or equal to the current time." );
|
||||
AssertFatal(destObject, "Sim::postEvent() - Destination object for event doesn't exist.");
|
||||
|
||||
Mutex::lockMutex(gEventQueueMutex);
|
||||
|
||||
if( time == -1 ) // FIXME: a smart compiler will remove this check. - see http://garagegames.com/community/resources/view/19785 for a fix
|
||||
if( time == -1 ) // FIXME: a smart compiler will remove this check. - see http://garagegames.com/community/resources/view/19785 for a fix
|
||||
time = gCurrentTime;
|
||||
|
||||
event->time = time;
|
||||
|
|
@ -256,7 +256,7 @@ void advanceToTime(SimTime targetTime)
|
|||
event->process(obj);
|
||||
delete event;
|
||||
}
|
||||
gCurrentTime = targetTime;
|
||||
gCurrentTime = targetTime;
|
||||
|
||||
Mutex::unlockMutex(gEventQueueMutex);
|
||||
}
|
||||
|
|
@ -393,7 +393,7 @@ SimObject* findObject(const char* name)
|
|||
|
||||
SimObject* findObject(SimObjectId id)
|
||||
{
|
||||
return gIdDictionary->find(id);
|
||||
return gIdDictionary->find(id);
|
||||
}
|
||||
|
||||
SimObject *spawnObject(String spawnClass, String spawnDataBlock, String spawnName,
|
||||
|
|
@ -600,7 +600,7 @@ SimDataBlockGroup::SimDataBlockGroup()
|
|||
|
||||
S32 QSORT_CALLBACK SimDataBlockGroup::compareModifiedKey(const void* a,const void* b)
|
||||
{
|
||||
const SimDataBlock* dba = *((const SimDataBlock**)a);
|
||||
const SimDataBlock* dba = *((const SimDataBlock**)a);
|
||||
const SimDataBlock* dbb = *((const SimDataBlock**)b);
|
||||
|
||||
return dba->getModifiedKey() - dbb->getModifiedKey();
|
||||
|
|
@ -612,6 +612,6 @@ void SimDataBlockGroup::sort()
|
|||
if(mLastModifiedKey != SimDataBlock::getNextModifiedKey())
|
||||
{
|
||||
mLastModifiedKey = SimDataBlock::getNextModifiedKey();
|
||||
dQsort(objectList.address(),objectList.size(),sizeof(SimObject *),compareModifiedKey);
|
||||
dQsort(objectList.address(),objectList.size(),sizeof(SimObject *),compareModifiedKey);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ SimObject::SimObject()
|
|||
mFlags.set( ModStaticFields | ModDynamicFields );
|
||||
|
||||
mFieldDictionary = NULL;
|
||||
mCanSaveFieldDictionary = true;
|
||||
mCanSaveFieldDictionary = true;
|
||||
|
||||
mClassName = NULL;
|
||||
mSuperClassName = NULL;
|
||||
|
|
@ -592,7 +592,7 @@ void SimObject::setDeclarationLine(U32 lineNumber)
|
|||
bool SimObject::registerObject()
|
||||
{
|
||||
AssertFatal( !mFlags.test( Added ), "reigsterObject - Object already registered!");
|
||||
mFlags.clear(Deleted | Removed);
|
||||
mFlags.clear(Deleted | Removed);
|
||||
|
||||
if(smForceId)
|
||||
{
|
||||
|
|
@ -609,11 +609,11 @@ bool SimObject::registerObject()
|
|||
AssertFatal(Sim::gIdDictionary && Sim::gNameDictionary,
|
||||
"SimObject::registerObject - tried to register an object before Sim::init()!");
|
||||
|
||||
Sim::gIdDictionary->insert(this);
|
||||
Sim::gIdDictionary->insert(this);
|
||||
|
||||
Sim::gNameDictionary->insert(this);
|
||||
|
||||
// Notify object
|
||||
// Notify object
|
||||
bool ret = onAdd();
|
||||
|
||||
if(!ret)
|
||||
|
|
@ -661,10 +661,10 @@ void SimObject::deleteObject()
|
|||
|
||||
void SimObject::_destroySelf()
|
||||
{
|
||||
AssertFatal( !isDeleted(), "SimObject::destroySelf - Object has already been deleted" );
|
||||
AssertFatal( !isRemoved(), "SimObject::destroySelf - Object in the process of being removed" );
|
||||
AssertFatal( !isDeleted(), "SimObject::destroySelf - Object has already been deleted" );
|
||||
AssertFatal( !isRemoved(), "SimObject::destroySelf - Object in the process of being removed" );
|
||||
|
||||
mFlags.set( Deleted );
|
||||
mFlags.set( Deleted );
|
||||
|
||||
if( mFlags.test( Added ) )
|
||||
unregisterObject();
|
||||
|
|
@ -1308,7 +1308,7 @@ void SimObject::dumpClassHierarchy()
|
|||
while(pRep)
|
||||
{
|
||||
Con::warnf("%s ->", pRep->getClassName());
|
||||
pRep = pRep->getParentClass();
|
||||
pRep = pRep->getParentClass();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1376,7 +1376,7 @@ bool SimObject::isChildOfGroup(SimGroup* pGroup)
|
|||
if(pGroup == dynamic_cast<SimGroup*>(this))
|
||||
return true;
|
||||
|
||||
SimGroup* temp = mGroup;
|
||||
SimGroup* temp = mGroup;
|
||||
while(temp)
|
||||
{
|
||||
if(temp == pGroup)
|
||||
|
|
@ -2884,7 +2884,7 @@ DefineConsoleMethod( SimObject, isMemberOfClass, bool, ( const char* className )
|
|||
return true;
|
||||
}
|
||||
|
||||
pRep = pRep->getParentClass();
|
||||
pRep = pRep->getParentClass();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -826,7 +826,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks
|
|||
virtual bool readObject(Stream *stream);
|
||||
|
||||
/// Set whether fields created at runtime should be saved. Default is true.
|
||||
void setCanSaveDynamicFields( bool bCanSave ) { mCanSaveFieldDictionary = bCanSave; }
|
||||
void setCanSaveDynamicFields( bool bCanSave ) { mCanSaveFieldDictionary = bCanSave; }
|
||||
|
||||
/// Get whether fields created at runtime should be saved. Default is true.
|
||||
bool getCanSaveDynamicFields( ) { return mCanSaveFieldDictionary;}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
SimObjectMemento::SimObjectMemento()
|
||||
: mState( NULL ),
|
||||
mIsDatablock( false )
|
||||
mIsDatablock( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -45,16 +45,16 @@ void SimObjectMemento::save( SimObject *object )
|
|||
dFree( mState );
|
||||
mObjectName = String::EmptyString;
|
||||
|
||||
// Use a stream to save the state.
|
||||
// Use a stream to save the state.
|
||||
MemStream stream( 256 );
|
||||
|
||||
U32 writeFlags = 0;
|
||||
SimDataBlock* db = dynamic_cast<SimDataBlock*>(object);
|
||||
if( !db )
|
||||
stream.write( sizeof( "return " ) - 1, "return " );
|
||||
else
|
||||
SimDataBlock* db = dynamic_cast<SimDataBlock*>(object);
|
||||
if( !db )
|
||||
stream.write( sizeof( "return " ) - 1, "return " );
|
||||
else
|
||||
{
|
||||
mIsDatablock = true;
|
||||
mIsDatablock = true;
|
||||
|
||||
// Cull the datablock name from the output so that
|
||||
// we can easily replace it in case the datablock's name
|
||||
|
|
@ -64,7 +64,7 @@ void SimObjectMemento::save( SimObject *object )
|
|||
|
||||
writeFlags |= SimObject::NoName;
|
||||
}
|
||||
|
||||
|
||||
object->write( stream, 0, writeFlags );
|
||||
stream.write( (UTF8)0 );
|
||||
|
||||
|
|
@ -82,9 +82,9 @@ SimObject *SimObjectMemento::restore() const
|
|||
// TODO: We could potentially make this faster by
|
||||
// caching the CodeBlock generated from the string
|
||||
|
||||
SimObject* object;
|
||||
if( !mIsDatablock )
|
||||
{
|
||||
SimObject* object;
|
||||
if( !mIsDatablock )
|
||||
{
|
||||
// Set the redefine behavior to automatically giving
|
||||
// the new objects unique names. This will restore the
|
||||
// old names if they are still available or give reasonable
|
||||
|
|
@ -95,22 +95,22 @@ SimObject *SimObjectMemento::restore() const
|
|||
|
||||
// Read the object.
|
||||
|
||||
const UTF8* result = Con::evaluate( mState );
|
||||
const UTF8* result = Con::evaluate( mState );
|
||||
|
||||
// Restore the redefine behavior.
|
||||
|
||||
Con::setVariable( "$Con::redefineBehavior", oldRedefineBehavior );
|
||||
|
||||
if ( !result || !result[ 0 ] )
|
||||
return NULL;
|
||||
if ( !result || !result[ 0 ] )
|
||||
return NULL;
|
||||
|
||||
// Look up the object.
|
||||
|
||||
U32 objectId = dAtoi( result );
|
||||
object = Sim::findObject( objectId );
|
||||
}
|
||||
else
|
||||
{
|
||||
U32 objectId = dAtoi( result );
|
||||
object = Sim::findObject( objectId );
|
||||
}
|
||||
else
|
||||
{
|
||||
String objectName = mObjectName;
|
||||
|
||||
// For datablocks, it's getting a little complicated. Datablock definitions cannot be used
|
||||
|
|
@ -140,16 +140,16 @@ SimObject *SimObjectMemento::restore() const
|
|||
dStrcpy( &tempBuffer[ numCharsToLeftParen + uniqueNameLen ], &mState[ numCharsToLeftParen ] );
|
||||
}
|
||||
|
||||
Con::evaluate( tempBuffer );
|
||||
Con::evaluate( tempBuffer );
|
||||
|
||||
if( tempBuffer != mState )
|
||||
dFree( tempBuffer );
|
||||
|
||||
if( objectName == String::EmptyString )
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
object = Sim::findObject( objectName );
|
||||
}
|
||||
object = Sim::findObject( objectName );
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ protected:
|
|||
|
||||
/// The captured object's name.
|
||||
String mObjectName;
|
||||
bool mIsDatablock;
|
||||
bool mIsDatablock;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@
|
|||
IMPLEMENT_CONOBJECT( SimPersistSet );
|
||||
|
||||
ConsoleDocClass( SimPersistSet,
|
||||
"@brief A SimSet that can be safely persisted.\n\n"
|
||||
"Uses SimPersistIDs to reference objects in the set "
|
||||
"while persisted on disk. This allows the set to resolve "
|
||||
"its references no matter whether they are loaded before or "
|
||||
"after the set is created.\n\n"
|
||||
"Not intended for game development, for editors or internal use only.\n\n "
|
||||
"@internal");
|
||||
"@brief A SimSet that can be safely persisted.\n\n"
|
||||
"Uses SimPersistIDs to reference objects in the set "
|
||||
"while persisted on disk. This allows the set to resolve "
|
||||
"its references no matter whether they are loaded before or "
|
||||
"after the set is created.\n\n"
|
||||
"Not intended for game development, for editors or internal use only.\n\n "
|
||||
"@internal");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -213,18 +213,18 @@ SimObject *loadObjectStream(Stream *stream)
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction(saveObject, bool, ( SimObject *object, const char *filename ),,
|
||||
"@brief Serialize the object to a file.\n\n"
|
||||
"@param object The object to serialize.\n"
|
||||
"@param filename The file name and path.\n"
|
||||
"@ingroup Console\n")
|
||||
"@brief Serialize the object to a file.\n\n"
|
||||
"@param object The object to serialize.\n"
|
||||
"@param filename The file name and path.\n"
|
||||
"@ingroup Console\n")
|
||||
{
|
||||
return object && Sim::saveObject(object, filename);
|
||||
}
|
||||
|
||||
DefineEngineFunction(loadObject, SimObject*, ( const char *filename ),,
|
||||
"@brief Loads a serialized object from a file.\n\n"
|
||||
"@param Name and path to text file containing the object\n"
|
||||
"@ingroup Console\n")
|
||||
"@brief Loads a serialized object from a file.\n\n"
|
||||
"@param Name and path to text file containing the object\n"
|
||||
"@ingroup Console\n")
|
||||
{
|
||||
return Sim::loadObjectStream(filename);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ bool ConsoleValueStack::reserveValues(U32 count, ConsoleValueRef *outValues)
|
|||
//Con::printf("[%i]CSTK reserveValues %i", mStackPos, count);
|
||||
for (U32 i=0; i<count; i++)
|
||||
{
|
||||
outValues[i].value = &mStack[mStackPos+i];
|
||||
outValues[i].value = &mStack[mStackPos+i];
|
||||
}
|
||||
mStackPos += count;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -67,17 +67,17 @@ DefineConsoleFunction( telnetSetParameters, void, ( int port, const char* consol
|
|||
"@param consolePass Password for read/write access to console.\n"
|
||||
"@param listenPass Password for read access to console.\n"
|
||||
"@param remoteEcho [optional] Enable echoing back to the client, off by default.\n\n"
|
||||
"@ingroup Debugging")
|
||||
"@ingroup Debugging")
|
||||
{
|
||||
if (TelConsole)
|
||||
TelConsole->setTelnetParameters(port, consolePass, listenPass, remoteEcho);
|
||||
TelConsole->setTelnetParameters(port, consolePass, listenPass, remoteEcho);
|
||||
}
|
||||
|
||||
static void telnetCallback(U32 level, const char *consoleLine)
|
||||
{
|
||||
TORQUE_UNUSED(level);
|
||||
if (TelConsole)
|
||||
TelConsole->processConsoleLine(consoleLine);
|
||||
TelConsole->processConsoleLine(consoleLine);
|
||||
}
|
||||
|
||||
TelnetConsole::TelnetConsole()
|
||||
|
|
@ -121,9 +121,9 @@ void TelnetConsole::setTelnetParameters(S32 port, const char *telnetPassword, co
|
|||
mAcceptPort = port;
|
||||
if(mAcceptPort != -1 && mAcceptPort != 0)
|
||||
{
|
||||
NetAddress address;
|
||||
Net::getIdealListenAddress(&address);
|
||||
address.port = mAcceptPort;
|
||||
NetAddress address;
|
||||
Net::getIdealListenAddress(&address);
|
||||
address.port = mAcceptPort;
|
||||
|
||||
mAcceptSocket = Net::openSocket();
|
||||
Net::bindAddress(address, mAcceptSocket);
|
||||
|
|
|
|||
|
|
@ -115,8 +115,8 @@ MODULE_END;
|
|||
|
||||
DefineConsoleFunction( 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")
|
||||
"and optionally waiting for the debug client to connect.\n"
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
{
|
||||
if (TelDebugger)
|
||||
{
|
||||
|
|
@ -126,17 +126,17 @@ DefineConsoleFunction( dbgSetParameters, void, (S32 port, const char * password,
|
|||
|
||||
DefineConsoleFunction( dbgIsConnected, bool, (), , "()"
|
||||
"Returns true if a script debugging client is connected else return false.\n"
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
{
|
||||
return TelDebugger && TelDebugger->isConnected();
|
||||
}
|
||||
|
||||
DefineConsoleFunction( dbgDisconnect, void, (), , "()"
|
||||
"Forcibly disconnects any attached script debugging client.\n"
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
{
|
||||
if (TelDebugger)
|
||||
TelDebugger->disconnect();
|
||||
TelDebugger->disconnect();
|
||||
}
|
||||
|
||||
static void debuggerConsumer(U32 level, const char *line)
|
||||
|
|
@ -244,9 +244,9 @@ void TelnetDebugger::setDebugParameters(S32 port, const char *password, bool wai
|
|||
mAcceptPort = port;
|
||||
if(mAcceptPort != -1 && mAcceptPort != 0)
|
||||
{
|
||||
NetAddress address;
|
||||
Net::getIdealListenAddress(&address);
|
||||
address.port = mAcceptPort;
|
||||
NetAddress address;
|
||||
Net::getIdealListenAddress(&address);
|
||||
address.port = mAcceptPort;
|
||||
|
||||
mAcceptSocket = Net::openSocket();
|
||||
Net::bindAddress(address, mAcceptSocket);
|
||||
|
|
@ -588,7 +588,7 @@ void TelnetDebugger::addAllBreakpoints(CodeBlock *code)
|
|||
// TODO: This assumes that the OS file names are case
|
||||
// insensitive... Torque needs a dFilenameCmp() function.
|
||||
if( dStricmp( cur->fileName, code->name ) == 0 )
|
||||
{
|
||||
{
|
||||
cur->code = code;
|
||||
|
||||
// Find the fist breakline starting from and
|
||||
|
|
@ -741,7 +741,7 @@ void TelnetDebugger::removeBreakpoint(const char *fileName, S32 line)
|
|||
{
|
||||
Breakpoint *brk = *bp;
|
||||
*bp = brk->next;
|
||||
if ( brk->code )
|
||||
if ( brk->code )
|
||||
brk->code->clearBreakpoint(brk->lineNumber);
|
||||
dFree(brk->testExpression);
|
||||
delete brk;
|
||||
|
|
@ -754,7 +754,7 @@ void TelnetDebugger::removeAllBreakpoints()
|
|||
while(walk)
|
||||
{
|
||||
Breakpoint *temp = walk->next;
|
||||
if ( walk->code )
|
||||
if ( walk->code )
|
||||
walk->code->clearBreakpoint(walk->lineNumber);
|
||||
dFree(walk->testExpression);
|
||||
delete walk;
|
||||
|
|
@ -792,10 +792,10 @@ void TelnetDebugger::setBreakOnNextStatement( bool enabled )
|
|||
for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile)
|
||||
walk->clearAllBreaks();
|
||||
for(Breakpoint *w = mBreakpoints; w; w = w->next)
|
||||
{
|
||||
if ( w->code )
|
||||
{
|
||||
if ( w->code )
|
||||
w->code->setBreakpoint(w->lineNumber);
|
||||
}
|
||||
}
|
||||
mBreakOnNextStatement = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -848,7 +848,7 @@ void TelnetDebugger::debugStepOut()
|
|||
setBreakOnNextStatement( false );
|
||||
mStackPopBreakIndex = gEvalState.getStackDepth() - 1;
|
||||
if ( mStackPopBreakIndex == 0 )
|
||||
mStackPopBreakIndex = -1;
|
||||
mStackPopBreakIndex = -1;
|
||||
mProgramPaused = false;
|
||||
send("RUNNING\r\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,42 +49,42 @@ void TypeValidator::consoleError(SimObject *object, const char *format, ...)
|
|||
|
||||
void FRangeValidator::validateType(SimObject *object, void *typePtr)
|
||||
{
|
||||
F32 *v = (F32 *) typePtr;
|
||||
if(*v < minV || *v > maxV)
|
||||
{
|
||||
consoleError(object, "Must be between %g and %g", minV, maxV);
|
||||
if(*v < minV)
|
||||
*v = minV;
|
||||
else if(*v > maxV)
|
||||
*v = maxV;
|
||||
}
|
||||
F32 *v = (F32 *) typePtr;
|
||||
if(*v < minV || *v > maxV)
|
||||
{
|
||||
consoleError(object, "Must be between %g and %g", minV, maxV);
|
||||
if(*v < minV)
|
||||
*v = minV;
|
||||
else if(*v > maxV)
|
||||
*v = maxV;
|
||||
}
|
||||
}
|
||||
|
||||
void IRangeValidator::validateType(SimObject *object, void *typePtr)
|
||||
{
|
||||
S32 *v = (S32 *) typePtr;
|
||||
if(*v < minV || *v > maxV)
|
||||
{
|
||||
consoleError(object, "Must be between %d and %d", minV, maxV);
|
||||
if(*v < minV)
|
||||
*v = minV;
|
||||
else if(*v > maxV)
|
||||
*v = maxV;
|
||||
}
|
||||
S32 *v = (S32 *) typePtr;
|
||||
if(*v < minV || *v > maxV)
|
||||
{
|
||||
consoleError(object, "Must be between %d and %d", minV, maxV);
|
||||
if(*v < minV)
|
||||
*v = minV;
|
||||
else if(*v > maxV)
|
||||
*v = maxV;
|
||||
}
|
||||
}
|
||||
|
||||
void IRangeValidatorScaled::validateType(SimObject *object, void *typePtr)
|
||||
{
|
||||
S32 *v = (S32 *) typePtr;
|
||||
*v /= factor;
|
||||
if(*v < minV || *v > maxV)
|
||||
{
|
||||
consoleError(object, "Scaled value must be between %d and %d", minV, maxV);
|
||||
if(*v < minV)
|
||||
*v = minV;
|
||||
else if(*v > maxV)
|
||||
*v = maxV;
|
||||
}
|
||||
S32 *v = (S32 *) typePtr;
|
||||
*v /= factor;
|
||||
if(*v < minV || *v > maxV)
|
||||
{
|
||||
consoleError(object, "Scaled value must be between %d and %d", minV, maxV);
|
||||
if(*v < minV)
|
||||
*v = minV;
|
||||
else if(*v > maxV)
|
||||
*v = maxV;
|
||||
}
|
||||
}
|
||||
|
||||
void Point3NormalizeValidator::validateType(SimObject *object, void *typePtr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue