From 45ae5e71cba30210aebaf1a41c457b28e5d9b2ae Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 18:04:28 -0500 Subject: [PATCH] fixed lots of tabs and space --- Engine/source/T3D/aiPlayer.cpp | 46 +- Engine/source/T3D/tsStatic.cpp | 42 +- Engine/source/app/badWordFilter.cpp | 34 +- Engine/source/console/CMDscan.cpp | 1484 ++++++++--------- Engine/source/console/SimXMLDocument.cpp | 142 +- Engine/source/console/SimXMLDocument.h | 24 +- Engine/source/console/arrayObject.h | 2 +- Engine/source/console/cmdgram.cpp | 386 ++--- Engine/source/console/cmdgram.h | 144 +- Engine/source/console/codeBlock.cpp | 8 +- Engine/source/console/compiledEval.cpp | 16 +- Engine/source/console/console.cpp | 68 +- Engine/source/console/console.h | 68 +- Engine/source/console/consoleDoc.cpp | 4 +- Engine/source/console/consoleFunctions.cpp | 130 +- Engine/source/console/consoleInternal.cpp | 14 +- Engine/source/console/consoleLogger.cpp | 56 +- Engine/source/console/consoleObject.cpp | 58 +- Engine/source/console/consoleParser.cpp | 44 +- Engine/source/console/consoleParser.h | 30 +- Engine/source/console/engineAPI.h | 274 +-- Engine/source/console/engineFunctions.h | 54 +- Engine/source/console/fieldBrushObject.cpp | 24 +- Engine/source/console/fileSystemFunctions.cpp | 150 +- Engine/source/console/persistenceManager.cpp | 62 +- Engine/source/console/scriptFilename.cpp | 22 +- Engine/source/console/scriptObjects.cpp | 84 +- Engine/source/console/sim.cpp | 22 +- Engine/source/console/simDictionary.cpp | 8 +- Engine/source/console/simDictionary.h | 2 +- Engine/source/console/simEvents.cpp | 8 +- Engine/source/console/simManager.cpp | 12 +- Engine/source/console/simObject.cpp | 20 +- Engine/source/console/simObject.h | 2 +- Engine/source/console/simObjectMemento.cpp | 46 +- Engine/source/console/simObjectMemento.h | 2 +- Engine/source/console/simPersistSet.cpp | 14 +- Engine/source/console/simSerialize.cpp | 14 +- Engine/source/console/stringStack.cpp | 2 +- Engine/source/console/telnetConsole.cpp | 12 +- Engine/source/console/telnetDebugger.cpp | 30 +- Engine/source/console/typeValidators.cpp | 56 +- Engine/source/gfx/video/videoCapture.cpp | 2 +- Engine/source/gui/core/guiCanvas.cpp | 488 +++--- Engine/source/gui/editor/guiEditCtrl.cpp | 24 +- Engine/source/gui/editor/guiMenuBar.cpp | 248 +-- Engine/source/lighting/lightManager.cpp | 14 +- Engine/source/platform/platformNet.h | 56 +- Engine/source/platform/profiler.cpp | 78 +- Engine/source/platformMac/macFileIO.mm | 158 +- Engine/source/scene/sceneContainer.cpp | 6 +- Engine/source/sim/actionMap.cpp | 582 +++---- Engine/source/ts/tsShapeConstruct.h | 14 +- 53 files changed, 2695 insertions(+), 2695 deletions(-) diff --git a/Engine/source/T3D/aiPlayer.cpp b/Engine/source/T3D/aiPlayer.cpp index 7565f7831..28f8ec6e5 100644 --- a/Engine/source/T3D/aiPlayer.cpp +++ b/Engine/source/T3D/aiPlayer.cpp @@ -35,9 +35,9 @@ static U32 sAIPlayerLoSMask = TerrainObjectType | StaticShapeObjectType | Static IMPLEMENT_CO_NETOBJECT_V1(AIPlayer); ConsoleDocClass( AIPlayer, - "@brief A Player object not controlled by conventional input, but by an AI engine.\n\n" + "@brief A Player object not controlled by conventional input, but by an AI engine.\n\n" - "The AIPlayer provides a Player object that may be controlled from script. You control " + "The AIPlayer provides a Player object that may be controlled from script. You control " "where the player moves and how fast. You may also set where the AIPlayer is aiming at " "-- either a location or another game object.\n\n" @@ -70,19 +70,19 @@ ConsoleDocClass( AIPlayer, "position to the center of the target's bounding box. The LOS ray test only checks against interiors, " "statis shapes, and terrain.\n\n" - "@tsexample\n" - "// Create the demo player object\n" - "%player = new AiPlayer()\n" - "{\n" - " dataBlock = DemoPlayer;\n" - " path = \"\";\n" - "};\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Create the demo player object\n" + "%player = new AiPlayer()\n" + "{\n" + " dataBlock = DemoPlayer;\n" + " path = \"\";\n" + "};\n" + "@endtsexample\n\n" - "@see Player for a list of all inherited functions, variables, and base description\n" + "@see Player for a list of all inherited functions, variables, and base description\n" - "@ingroup AI\n" - "@ingroup gameObjects\n"); + "@ingroup AI\n" + "@ingroup gameObjects\n"); /** * Constructor */ @@ -147,7 +147,7 @@ void AIPlayer::initPersistFields() addField( "AttackRadius", TypeF32, Offset( mAttackRadius, AIPlayer ), "@brief Distance considered in firing range for callback purposes."); - + endGroup( "AI" ); #ifdef TORQUE_NAVIGATION_ENABLED @@ -399,11 +399,11 @@ bool AIPlayer::getAIMove(Move *movePtr) { clearPath(); mMoveState = ModeStop; - throwCallback("onTargetInRange"); + throwCallback("onTargetInRange"); } else if((getPosition() - mFollowData.object->getPosition()).len() < mAttackRadius) { - throwCallback("onTargetInFiringRange"); + throwCallback("onTargetInFiringRange"); } } } @@ -854,7 +854,7 @@ DefineEngineMethod(AIPlayer, getPathDestination, Point3F, (),, "@see setPathDestination()\n") { - return object->getPathDestination(); + return object->getPathDestination(); } void AIPlayer::followNavPath(NavPath *path) @@ -1148,7 +1148,7 @@ DefineEngineMethod( AIPlayer, setMoveSpeed, void, ( F32 speed ),, "@see getMoveDestination()\n") { - object->setMoveSpeed(speed); + object->setMoveSpeed(speed); } DefineEngineMethod( AIPlayer, getMoveSpeed, F32, ( ),, @@ -1186,7 +1186,7 @@ DefineEngineMethod( AIPlayer, getMoveDestination, Point3F, (),, "@see setMoveDestination()\n") { - return object->getMoveDestination(); + return object->getMoveDestination(); } DefineEngineMethod( AIPlayer, setAimLocation, void, ( Point3F target ),, @@ -1196,7 +1196,7 @@ DefineEngineMethod( AIPlayer, setAimLocation, void, ( Point3F target ),, "@see getAimLocation()\n") { - object->setAimLocation(target); + object->setAimLocation(target); } DefineEngineMethod( AIPlayer, getAimLocation, Point3F, (),, @@ -1212,7 +1212,7 @@ DefineEngineMethod( AIPlayer, getAimLocation, Point3F, (),, "@see setAimLocation()\n" "@see setAimObject()\n") { - return object->getAimLocation(); + return object->getAimLocation(); } ConsoleDocFragment _setAimObject( @@ -1240,7 +1240,7 @@ ConsoleDocFragment _setAimObject( DefineConsoleMethod( AIPlayer, setAimObject, void, ( const char * objName, Point3F offset ), (Point3F::Zero), "( GameBase obj, [Point3F offset] )" "Sets the bot's target object. Optionally set an offset from target location." - "@hide") + "@hide") { // Find the target @@ -1262,7 +1262,7 @@ DefineEngineMethod( AIPlayer, getAimObject, S32, (),, "@see setAimObject()\n") { - GameBase* obj = object->getAimObject(); + GameBase* obj = object->getAimObject(); return obj? obj->getId(): -1; } diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 0f7b69ef3..84b3b0797 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -1222,17 +1222,17 @@ DefineEngineMethod( TSStatic, getTargetName, const char*, ( S32 index ),(0), "@return the name of the indexed material.\n" "@see getTargetCount()\n") { - TSStatic *obj = dynamic_cast< TSStatic* > ( object ); - if(obj) - { - // Try to use the client object (so we get the reskinned targets in the Material Editor) - if ((TSStatic*)obj->getClientObject()) - obj = (TSStatic*)obj->getClientObject(); + TSStatic *obj = dynamic_cast< TSStatic* > ( object ); + if(obj) + { + // Try to use the client object (so we get the reskinned targets in the Material Editor) + if ((TSStatic*)obj->getClientObject()) + obj = (TSStatic*)obj->getClientObject(); - return obj->getShapeInstance()->getTargetName(index); - } + return obj->getShapeInstance()->getTargetName(index); + } - return ""; + return ""; } DefineEngineMethod( TSStatic, getTargetCount, S32,(),, @@ -1240,17 +1240,17 @@ DefineEngineMethod( TSStatic, getTargetCount, S32,(),, "@return the number of materials in the shape.\n" "@see getTargetName()\n") { - TSStatic *obj = dynamic_cast< TSStatic* > ( object ); - if(obj) - { - // Try to use the client object (so we get the reskinned targets in the Material Editor) - if ((TSStatic*)obj->getClientObject()) - obj = (TSStatic*)obj->getClientObject(); + TSStatic *obj = dynamic_cast< TSStatic* > ( object ); + if(obj) + { + // Try to use the client object (so we get the reskinned targets in the Material Editor) + if ((TSStatic*)obj->getClientObject()) + obj = (TSStatic*)obj->getClientObject(); - return obj->getShapeInstance()->getTargetCount(); - } + return obj->getShapeInstance()->getTargetCount(); + } - return -1; + return -1; } // This method is able to change materials per map to with others. The material that is being replaced is being mapped to @@ -1317,10 +1317,10 @@ DefineEngineMethod( TSStatic, getModelFile, const char *, (),, "@return the shape filename\n\n" "@tsexample\n" - "// Acquire the model filename used on this shape.\n" - "%modelFilename = %obj.getModelFile();\n" + "// Acquire the model filename used on this shape.\n" + "%modelFilename = %obj.getModelFile();\n" "@endtsexample\n" ) { - return object->getShapeFileName(); + return object->getShapeFileName(); } diff --git a/Engine/source/app/badWordFilter.cpp b/Engine/source/app/badWordFilter.cpp index e267f5032..d0547e5ee 100644 --- a/Engine/source/app/badWordFilter.cpp +++ b/Engine/source/app/badWordFilter.cpp @@ -65,7 +65,7 @@ void BadWordFilter::create() { Con::addVariable("pref::enableBadWordFilter", TypeBool, &filteringEnabled, "@brief If true, the bad word filter will be enabled.\n\n" - "@ingroup Game"); + "@ingroup Game"); gBadWordFilter = new BadWordFilter; gBadWordFilter->addBadWord("shit"); gBadWordFilter->addBadWord("fuck"); @@ -251,7 +251,7 @@ DefineEngineFunction(addBadWord, bool, (const char* badWord),, "@ingroup Game") { - return gBadWordFilter->addBadWord(badWord); + return gBadWordFilter->addBadWord(badWord); } DefineEngineFunction(filterString, const char *, (const char* baseString, const char* replacementChars), (nullAsType(), nullAsType()), @@ -279,17 +279,17 @@ DefineEngineFunction(filterString, const char *, (const char* baseString, const "@ingroup Game") { - const char *replaceStr = NULL; + const char *replaceStr = NULL; - if(replacementChars) - replaceStr = replacementChars; - else - replaceStr = gBadWordFilter->getDefaultReplaceStr(); + if(replacementChars) + replaceStr = replacementChars; + else + replaceStr = gBadWordFilter->getDefaultReplaceStr(); - char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1); - dStrcpy(ret, baseString); - gBadWordFilter->filterString(ret, replaceStr); - return ret; + char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1); + dStrcpy(ret, baseString); + gBadWordFilter->filterString(ret, replaceStr); + return ret; } DefineEngineFunction(containsBadWords, bool, (const char* text),, @@ -316,17 +316,17 @@ DefineEngineFunction(containsBadWords, bool, (const char* text),, "// Otherwise print the original text\n" "if(containsBadWords(%userText))\n" "{\n" - " // Filter the string\n" - " %filteredText = filterString(%userText, %replacementChars);\n\n" - " // Print filtered text\n" - " echo(%filteredText);\n" + " // Filter the string\n" + " %filteredText = filterString(%userText, %replacementChars);\n\n" + " // Print filtered text\n" + " echo(%filteredText);\n" "}\n" "else\n" - " echo(%userText);\n\n" + " echo(%userText);\n\n" "@endtsexample\n" "@ingroup Game") { - return gBadWordFilter->containsBadWords(text); + return gBadWordFilter->containsBadWords(text); } diff --git a/Engine/source/console/CMDscan.cpp b/Engine/source/console/CMDscan.cpp index 6aedd587f..4a1c132b9 100644 --- a/Engine/source/console/CMDscan.cpp +++ b/Engine/source/console/CMDscan.cpp @@ -49,15 +49,15 @@ /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch @@ -128,10 +128,10 @@ extern FILE *yyin, *yyout; * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all @@ -141,14 +141,14 @@ extern FILE *yyin, *yyout; /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) @@ -160,61 +160,61 @@ typedef unsigned int yy_size_t; struct yy_buffer_state - { - FILE *yy_input_file; + { + FILE *yy_input_file; - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; - int yy_buffer_status; + int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - }; + }; static YY_BUFFER_STATE yy_current_buffer = 0; @@ -228,15 +228,15 @@ static YY_BUFFER_STATE yy_current_buffer = 0; /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... @@ -264,18 +264,18 @@ static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } #define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) @@ -294,11 +294,11 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; #define YY_NUM_RULES 94 #define YY_END_OF_BUFFER 95 @@ -715,21 +715,21 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -770,280 +770,280 @@ YY_MALLOC_DECL #endif #define YY_RULE_SETUP \ - YY_USER_ACTION + YY_USER_ACTION YY_DECL - { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; + { + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; #line 105 "CMDscan.l" ; #line 785 "CMDscan.cpp" - if ( yy_init ) - { - yy_init = 0; + if ( yy_init ) + { + yy_init = 0; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! yy_start ) + yy_start = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! yyout ) + yyout = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); - yy_load_buffer_state(); - } + yy_load_buffer_state(); + } - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; - /* Support of yytext. */ - *yy_cp = yy_hold_char; + /* Support of yytext. */ + *yy_cp = yy_hold_char; - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = yy_start; yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 338 ); + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 224 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 338 ); yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } - YY_DO_BEFORE_ACTION; + YY_DO_BEFORE_ACTION; -do_action: /* This label is used only to access EOF actions. */ +do_action: /* This label is used only to access EOF actions. */ - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; case 1: YY_RULE_SETUP #line 107 "CMDscan.l" { } - YY_BREAK + YY_BREAK case 2: YY_RULE_SETUP #line 108 "CMDscan.l" { return(Sc_ScanDocBlock()); } - YY_BREAK + YY_BREAK case 3: YY_RULE_SETUP #line 109 "CMDscan.l" ; - YY_BREAK + YY_BREAK case 4: YY_RULE_SETUP #line 110 "CMDscan.l" ; - YY_BREAK + YY_BREAK case 5: YY_RULE_SETUP #line 111 "CMDscan.l" {lineIndex++;} - YY_BREAK + YY_BREAK case 6: YY_RULE_SETUP #line 112 "CMDscan.l" { return(Sc_ScanString(STRATOM)); } - YY_BREAK + YY_BREAK case 7: YY_RULE_SETUP #line 113 "CMDscan.l" { return(Sc_ScanString(TAGATOM)); } - YY_BREAK + YY_BREAK case 8: YY_RULE_SETUP #line 114 "CMDscan.l" { CMDlval.i = MakeToken< int >( opEQ, lineIndex ); return opEQ; } - YY_BREAK + YY_BREAK case 9: YY_RULE_SETUP #line 115 "CMDscan.l" { CMDlval.i = MakeToken< int >( opNE, lineIndex ); return opNE; } - YY_BREAK + YY_BREAK case 10: YY_RULE_SETUP #line 116 "CMDscan.l" { CMDlval.i = MakeToken< int >( opGE, lineIndex ); return opGE; } - YY_BREAK + YY_BREAK case 11: YY_RULE_SETUP #line 117 "CMDscan.l" { CMDlval.i = MakeToken< int >( opLE, lineIndex ); return opLE; } - YY_BREAK + YY_BREAK case 12: YY_RULE_SETUP #line 118 "CMDscan.l" { CMDlval.i = MakeToken< int >( opAND, lineIndex ); return opAND; } - YY_BREAK + YY_BREAK case 13: YY_RULE_SETUP #line 119 "CMDscan.l" { CMDlval.i = MakeToken< int >( opOR, lineIndex ); return opOR; } - YY_BREAK + YY_BREAK case 14: YY_RULE_SETUP #line 120 "CMDscan.l" { CMDlval.i = MakeToken< int >( opCOLONCOLON, lineIndex ); return opCOLONCOLON; } - YY_BREAK + YY_BREAK case 15: YY_RULE_SETUP #line 121 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMINUSMINUS, lineIndex ); return opMINUSMINUS; } - YY_BREAK + YY_BREAK case 16: YY_RULE_SETUP #line 122 "CMDscan.l" { CMDlval.i = MakeToken< int >( opPLUSPLUS, lineIndex ); return opPLUSPLUS; } - YY_BREAK + YY_BREAK case 17: YY_RULE_SETUP #line 123 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSTREQ, lineIndex ); return opSTREQ; } - YY_BREAK + YY_BREAK case 18: YY_RULE_SETUP #line 124 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSTRNE, lineIndex ); return opSTRNE; } - YY_BREAK + YY_BREAK case 19: YY_RULE_SETUP #line 125 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSHL, lineIndex ); return opSHL; } - YY_BREAK + YY_BREAK case 20: YY_RULE_SETUP #line 126 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSHR, lineIndex ); return opSHR; } - YY_BREAK + YY_BREAK case 21: YY_RULE_SETUP #line 127 "CMDscan.l" { CMDlval.i = MakeToken< int >( opPLASN, lineIndex ); return opPLASN; } - YY_BREAK + YY_BREAK case 22: YY_RULE_SETUP #line 128 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMIASN, lineIndex ); return opMIASN; } - YY_BREAK + YY_BREAK case 23: YY_RULE_SETUP #line 129 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMLASN, lineIndex ); return opMLASN; } - YY_BREAK + YY_BREAK case 24: YY_RULE_SETUP #line 130 "CMDscan.l" { CMDlval.i = MakeToken< int >( opDVASN, lineIndex ); return opDVASN; } - YY_BREAK + YY_BREAK case 25: YY_RULE_SETUP #line 131 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMODASN, lineIndex ); return opMODASN; } - YY_BREAK + YY_BREAK case 26: YY_RULE_SETUP #line 132 "CMDscan.l" { CMDlval.i = MakeToken< int >( opANDASN, lineIndex ); return opANDASN; } - YY_BREAK + YY_BREAK case 27: YY_RULE_SETUP #line 133 "CMDscan.l" { CMDlval.i = MakeToken< int >( opXORASN, lineIndex ); return opXORASN; } - YY_BREAK + YY_BREAK case 28: YY_RULE_SETUP #line 134 "CMDscan.l" { CMDlval.i = MakeToken< int >( opORASN, lineIndex ); return opORASN; } - YY_BREAK + YY_BREAK case 29: YY_RULE_SETUP #line 135 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSLASN, lineIndex ); return opSLASN; } - YY_BREAK + YY_BREAK case 30: YY_RULE_SETUP #line 136 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSRASN, lineIndex ); return opSRASN; } - YY_BREAK + YY_BREAK case 31: YY_RULE_SETUP #line 137 "CMDscan.l" { CMDlval.i = MakeToken< int >( opINTNAME, lineIndex ); return opINTNAME; } - YY_BREAK + YY_BREAK case 32: YY_RULE_SETUP #line 138 "CMDscan.l" { CMDlval.i = MakeToken< int >( opINTNAMER, lineIndex ); return opINTNAMER; } - YY_BREAK + YY_BREAK case 33: YY_RULE_SETUP #line 139 "CMDscan.l" { CMDlval.i = MakeToken< int >( '\n', lineIndex ); return '@'; } - YY_BREAK + YY_BREAK case 34: YY_RULE_SETUP #line 140 "CMDscan.l" { CMDlval.i = MakeToken< int >( '\t', lineIndex ); return '@'; } - YY_BREAK + YY_BREAK case 35: YY_RULE_SETUP #line 141 "CMDscan.l" { CMDlval.i = MakeToken< int >( ' ', lineIndex ); return '@'; } - YY_BREAK + YY_BREAK case 36: YY_RULE_SETUP #line 142 "CMDscan.l" { CMDlval.i = MakeToken< int >( 0, lineIndex ); return '@'; } - YY_BREAK + YY_BREAK case 37: YY_RULE_SETUP #line 143 "CMDscan.l" @@ -1070,7 +1070,7 @@ YY_RULE_SETUP break; } } - YY_BREAK + YY_BREAK case 38: #line 167 "CMDscan.l" case 39: @@ -1121,475 +1121,475 @@ case 61: YY_RULE_SETUP #line 189 "CMDscan.l" { CMDlval.i = MakeToken< int >( CMDtext[ 0 ], lineIndex ); return CMDtext[ 0 ]; } - YY_BREAK + YY_BREAK case 62: YY_RULE_SETUP #line 190 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwIN, lineIndex ); return(rwIN); } - YY_BREAK + YY_BREAK case 63: YY_RULE_SETUP #line 191 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwCASEOR, lineIndex ); return(rwCASEOR); } - YY_BREAK + YY_BREAK case 64: YY_RULE_SETUP #line 192 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwBREAK, lineIndex ); return(rwBREAK); } - YY_BREAK + YY_BREAK case 65: YY_RULE_SETUP #line 193 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwRETURN, lineIndex ); return(rwRETURN); } - YY_BREAK + YY_BREAK case 66: YY_RULE_SETUP #line 194 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwELSE, lineIndex ); return(rwELSE); } - YY_BREAK + YY_BREAK case 67: YY_RULE_SETUP #line 195 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwASSERT, lineIndex ); return(rwASSERT); } - YY_BREAK + YY_BREAK case 68: YY_RULE_SETUP #line 196 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwWHILE, lineIndex ); return(rwWHILE); } - YY_BREAK + YY_BREAK case 69: YY_RULE_SETUP #line 197 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDO, lineIndex ); return(rwDO); } - YY_BREAK + YY_BREAK case 70: YY_RULE_SETUP #line 198 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwIF, lineIndex ); return(rwIF); } - YY_BREAK + YY_BREAK case 71: YY_RULE_SETUP #line 199 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwFOREACHSTR, lineIndex ); return(rwFOREACHSTR); } - YY_BREAK + YY_BREAK case 72: YY_RULE_SETUP #line 200 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwFOREACH, lineIndex ); return(rwFOREACH); } - YY_BREAK + YY_BREAK case 73: YY_RULE_SETUP #line 201 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwFOR, lineIndex ); return(rwFOR); } - YY_BREAK + YY_BREAK case 74: YY_RULE_SETUP #line 202 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwCONTINUE, lineIndex ); return(rwCONTINUE); } - YY_BREAK + YY_BREAK case 75: YY_RULE_SETUP #line 203 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDEFINE, lineIndex ); return(rwDEFINE); } - YY_BREAK + YY_BREAK case 76: YY_RULE_SETUP #line 204 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDECLARE, lineIndex ); return(rwDECLARE); } - YY_BREAK + YY_BREAK case 77: YY_RULE_SETUP #line 205 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDECLARESINGLETON, lineIndex ); return(rwDECLARESINGLETON); } - YY_BREAK + YY_BREAK case 78: YY_RULE_SETUP #line 206 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDATABLOCK, lineIndex ); return(rwDATABLOCK); } - YY_BREAK + YY_BREAK case 79: YY_RULE_SETUP #line 207 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwCASE, lineIndex ); return(rwCASE); } - YY_BREAK + YY_BREAK case 80: YY_RULE_SETUP #line 208 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwSWITCHSTR, lineIndex ); return(rwSWITCHSTR); } - YY_BREAK + YY_BREAK case 81: YY_RULE_SETUP #line 209 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwSWITCH, lineIndex ); return(rwSWITCH); } - YY_BREAK + YY_BREAK case 82: YY_RULE_SETUP #line 210 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDEFAULT, lineIndex ); return(rwDEFAULT); } - YY_BREAK + YY_BREAK case 83: YY_RULE_SETUP #line 211 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwPACKAGE, lineIndex ); return(rwPACKAGE); } - YY_BREAK + YY_BREAK case 84: YY_RULE_SETUP #line 212 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwNAMESPACE, lineIndex ); return(rwNAMESPACE); } - YY_BREAK + YY_BREAK case 85: YY_RULE_SETUP #line 213 "CMDscan.l" { CMDlval.i = MakeToken< int >( 1, lineIndex ); return INTCONST; } - YY_BREAK + YY_BREAK case 86: YY_RULE_SETUP #line 214 "CMDscan.l" { CMDlval.i = MakeToken< int >( 0, lineIndex ); return INTCONST; } - YY_BREAK + YY_BREAK case 87: YY_RULE_SETUP #line 215 "CMDscan.l" { return(Sc_ScanVar()); } - YY_BREAK + YY_BREAK case 88: YY_RULE_SETUP #line 216 "CMDscan.l" { return Sc_ScanIdent(); } - YY_BREAK + YY_BREAK case 89: YY_RULE_SETUP #line 217 "CMDscan.l" return(Sc_ScanHex()); - YY_BREAK + YY_BREAK case 90: YY_RULE_SETUP #line 218 "CMDscan.l" { CMDtext[CMDleng] = 0; CMDlval.i = MakeToken< int >( dAtoi(CMDtext), lineIndex ); return INTCONST; } - YY_BREAK + YY_BREAK case 91: YY_RULE_SETUP #line 219 "CMDscan.l" return Sc_ScanNum(); - YY_BREAK + YY_BREAK case 92: YY_RULE_SETUP #line 220 "CMDscan.l" return(ILLEGAL_TOKEN); - YY_BREAK + YY_BREAK case 93: YY_RULE_SETUP #line 221 "CMDscan.l" return(ILLEGAL_TOKEN); - YY_BREAK + YY_BREAK case 94: YY_RULE_SETUP #line 222 "CMDscan.l" ECHO; - YY_BREAK + YY_BREAK #line 1291 "CMDscan.cpp" case YY_STATE_EOF(INITIAL): - yyterminate(); + yyterminate(); - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ - yy_next_state = yy_try_NUL_trans( yy_current_state ); + yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = yytext_ptr + YY_MORE_ADJ; - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() - { - char *dest = yy_current_buffer->yy_ch_buf; - char *source = yytext_ptr; - int number_to_move, i; - int ret_val; + { + char *dest = yy_current_buffer->yy_ch_buf; + char *source = yytext_ptr; + int number_to_move, i; + int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a singled characater, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a singled characater, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } - /* Try to read more data. */ + /* Try to read more data. */ - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT - YY_FATAL_ERROR( + YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; #endif - } + } - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } - else - ret_val = EOB_ACT_CONTINUE_SCAN; + else + ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - return ret_val; - } + return ret_val; + } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() - { - yy_state_type yy_current_state; - char *yy_cp; + { + yy_state_type yy_current_state; + char *yy_cp; - yy_current_state = yy_start; + yy_current_state = yy_start; - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 224 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } - return yy_current_state; - } + return yy_current_state; + } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis - * next_state = yy_try_NUL_trans( current_state ); + * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS @@ -1598,27 +1598,27 @@ static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif - { - int yy_is_jam; - char *yy_cp = yy_c_buf_p; + { + int yy_is_jam; + char *yy_cp = yy_c_buf_p; - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 223); + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 224 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 223); - return yy_is_jam ? 0 : yy_current_state; - } + return yy_is_jam ? 0 : yy_current_state; + } #ifndef YY_NO_UNPUT @@ -1629,40 +1629,40 @@ static void yyunput( c, yy_bp ) int c; char *yy_bp; #endif - { - char *yy_cp = yy_c_buf_p; + { + char *yy_cp = yy_c_buf_p; - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = yy_n_chars + 2; - char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = yy_n_chars + 2; + char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_n_chars = yy_current_buffer->yy_buf_size; + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_n_chars = yy_current_buffer->yy_buf_size; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - *--yy_cp = (char) c; + *--yy_cp = (char) c; - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus @@ -1670,69 +1670,69 @@ static int yyinput() #else static int input() #endif - { - int c; + { + int c; - *yy_c_buf_p = yy_hold_char; + *yy_c_buf_p = yy_hold_char; - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; - else - { /* need more input */ - yytext_ptr = yy_c_buf_p; - ++yy_c_buf_p; + else + { /* need more input */ + yytext_ptr = yy_c_buf_p; + ++yy_c_buf_p; - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - { - yy_c_buf_p = - yytext_ptr + YY_MORE_ADJ; - return EOF; - } + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + yy_c_buf_p = + yytext_ptr + YY_MORE_ADJ; + return EOF; + } - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; #ifdef __cplusplus - return yyinput(); + return yyinput(); #else - return input(); + return input(); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - break; + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + break; - case EOB_ACT_LAST_MATCH: + case EOB_ACT_LAST_MATCH: #ifdef __cplusplus - YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); + YY_FATAL_ERROR( + "unexpected last match in yyinput()" ); #else - YY_FATAL_ERROR( - "unexpected last match in input()" ); + YY_FATAL_ERROR( + "unexpected last match in input()" ); #endif - } - } - } + } + } + } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; - return c; - } + return c; + } #ifdef YY_USE_PROTOS @@ -1741,13 +1741,13 @@ void yyrestart( FILE *input_file ) void yyrestart( input_file ) FILE *input_file; #endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } #ifdef YY_USE_PROTOS @@ -1756,28 +1756,28 @@ void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif - { - if ( yy_current_buffer == new_buffer ) - return; + { + if ( yy_current_buffer == new_buffer ) + return; - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } - yy_current_buffer = new_buffer; - yy_load_buffer_state(); + yy_current_buffer = new_buffer; + yy_load_buffer_state(); - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } #ifdef YY_USE_PROTOS @@ -1785,12 +1785,12 @@ void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } #ifdef YY_USE_PROTOS @@ -1800,28 +1800,28 @@ YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif - { - YY_BUFFER_STATE b; + { + YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = size; - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_is_our_buffer = 1; + b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + yy_init_buffer( b, file ); - return b; - } + return b; + } #ifdef YY_USE_PROTOS @@ -1830,18 +1830,18 @@ void yy_delete_buffer( YY_BUFFER_STATE b ) void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif - { - if ( ! b ) - return; + { + if ( ! b ) + return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); - yy_flex_free( (void *) b ); - } + yy_flex_free( (void *) b ); + } #ifndef YY_ALWAYS_INTERACTIVE @@ -1859,22 +1859,22 @@ FILE *file; #endif - { - yy_flush_buffer( b ); + { + yy_flush_buffer( b ); - b->yy_input_file = file; - b->yy_fill_buffer = 1; + b->yy_input_file = file; + b->yy_fill_buffer = 1; #if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; + b->yy_is_interactive = 1; #else #if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; + b->yy_is_interactive = 0; #else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif - } + } #ifdef YY_USE_PROTOS @@ -1884,24 +1884,24 @@ void yy_flush_buffer( b ) YY_BUFFER_STATE b; #endif - { - b->yy_n_chars = 0; + { + b->yy_n_chars = 0; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_buf_pos = &b->yy_ch_buf[0]; + b->yy_buf_pos = &b->yy_ch_buf[0]; - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } #ifndef YY_NO_SCAN_BUFFER @@ -1912,33 +1912,33 @@ YY_BUFFER_STATE yy_scan_buffer( base, size ) char *base; yy_size_t size; #endif - { - YY_BUFFER_STATE b; + { + YY_BUFFER_STATE b; - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + yy_switch_to_buffer( b ); - return b; - } + return b; + } #endif @@ -1949,13 +1949,13 @@ YY_BUFFER_STATE yy_scan_string( yyconst char *str ) YY_BUFFER_STATE yy_scan_string( str ) yyconst char *str; #endif - { - int len; - for ( len = 0; str[len]; ++len ) - ; + { + int len; + for ( len = 0; str[len]; ++len ) + ; - return yy_scan_bytes( str, len ); - } + return yy_scan_bytes( str, len ); + } #endif @@ -1967,34 +1967,34 @@ YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; int len; #endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; - return b; - } + return b; + } #endif @@ -2005,49 +2005,49 @@ static void yy_push_state( int new_state ) static void yy_push_state( new_state ) int new_state; #endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } - yy_start_stack[yy_start_stack_ptr++] = YY_START; + yy_start_stack[yy_start_stack_ptr++] = YY_START; - BEGIN(new_state); - } + BEGIN(new_state); + } #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } #endif #ifndef YY_EXIT_FAILURE @@ -2060,10 +2060,10 @@ static void yy_fatal_error( yyconst char msg[] ) static void yy_fatal_error( msg ) char msg[]; #endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } @@ -2071,16 +2071,16 @@ char msg[]; #undef yyless #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) /* Internal utility routines. */ @@ -2094,11 +2094,11 @@ char *s1; yyconst char *s2; int n; #endif - { - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } + { + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } #endif @@ -2108,9 +2108,9 @@ static void *yy_flex_alloc( yy_size_t size ) static void *yy_flex_alloc( size ) yy_size_t size; #endif - { - return (void *) malloc( size ); - } + { + return (void *) malloc( size ); + } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) @@ -2119,16 +2119,16 @@ static void *yy_flex_realloc( ptr, size ) void *ptr; yy_size_t size; #endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) @@ -2136,16 +2136,16 @@ static void yy_flex_free( void *ptr ) static void yy_flex_free( ptr ) void *ptr; #endif - { - free( ptr ); - } + { + free( ptr ); + } #if YY_MAIN int main() - { - yylex(); - return 0; - } + { + yylex(); + return 0; + } #endif #line 222 "CMDscan.l" diff --git a/Engine/source/console/SimXMLDocument.cpp b/Engine/source/console/SimXMLDocument.cpp index 840f36ca8..faa4a6017 100644 --- a/Engine/source/console/SimXMLDocument.cpp +++ b/Engine/source/console/SimXMLDocument.cpp @@ -49,40 +49,40 @@ ConsoleDocClass( SimXMLDocument, "// Thanks to Rex Hiebert for this example\n" "// Given the following XML\n" "\n" - "\n" - " \n" - " Triangle\n" - " Square\n" - " Circle\n" - "
\n" - " \n" - " Pyramid\n" - " Cube\n" - " Sphere\n" - "
\n" - "
\n\n" + "\n" + " \n" + " Triangle\n" + " Square\n" + " Circle\n" + "
\n" + " \n" + " Pyramid\n" + " Cube\n" + " Sphere\n" + "
\n" + "
\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, "// \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" + "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 " diff --git a/Engine/source/console/SimXMLDocument.h b/Engine/source/console/SimXMLDocument.h index 3f6e2661c..342917cff 100644 --- a/Engine/source/console/SimXMLDocument.h +++ b/Engine/source/console/SimXMLDocument.h @@ -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 m_paNode; - // The current attribute - TiXmlAttribute* m_CurrentAttribute; + // The current attribute + TiXmlAttribute* m_CurrentAttribute; public: DECLARE_CONOBJECT(SimXMLDocument); diff --git a/Engine/source/console/arrayObject.h b/Engine/source/console/arrayObject.h index caab6dbd5..81531b6c2 100644 --- a/Engine/source/console/arrayObject.h +++ b/Engine/source/console/arrayObject.h @@ -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; diff --git a/Engine/source/console/cmdgram.cpp b/Engine/source/console/cmdgram.cpp index 064394aaa..39fe8d3c3 100644 --- a/Engine/source/console/cmdgram.cpp +++ b/Engine/source/console/cmdgram.cpp @@ -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; } diff --git a/Engine/source/console/cmdgram.h b/Engine/source/console/cmdgram.h index 83736a565..fc22f3df2 100644 --- a/Engine/source/console/cmdgram.h +++ b/Engine/source/console/cmdgram.h @@ -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; diff --git a/Engine/source/console/codeBlock.cpp b/Engine/source/console/codeBlock.cpp index 1559f41d8..904558bef 100644 --- a/Engine/source/console/codeBlock.cpp +++ b/Engine/source/console/codeBlock.cpp @@ -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 ); diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index d61a8f353..f189d6268 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -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(); diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index d6e8908b4..2a070814b 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -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) diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index e863c60f1..f2d56c843 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -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 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 - ConsoleValueRef executef(R r, ArgTs ...argTs) - { - _EngineConsoleExecCallbackHelper callback( r ); - return callback.template call(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 + ConsoleValueRef executef(R r, ArgTs ...argTs) + { + _EngineConsoleExecCallbackHelper callback( r ); + return callback.template call(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(); }; diff --git a/Engine/source/console/consoleDoc.cpp b/Engine/source/console/consoleDoc.cpp index 41c5e8027..b442841a4 100644 --- a/Engine/source/console/consoleDoc.cpp +++ b/Engine/source/console/consoleDoc.cpp @@ -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 ); } diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index 7f8fbf1c0..1cf0335c0 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -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; } diff --git a/Engine/source/console/consoleInternal.cpp b/Engine/source/console/consoleInternal.cpp index c562b85c0..c9016e8dc 100644 --- a/Engine/source/console/consoleInternal.cpp +++ b/Engine/source/console/consoleInternal.cpp @@ -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(); diff --git a/Engine/source/console/consoleLogger.cpp b/Engine/source/console/consoleLogger.cpp index cc0e2afaf..84347a332 100644 --- a/Engine/source/console/consoleLogger.cpp +++ b/Engine/source/console/consoleLogger.cpp @@ -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( 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( object ); return logger->detach(); diff --git a/Engine/source/console/consoleObject.cpp b/Engine/source/console/consoleObject.cpp index 43ffda293..2d9ba2a1e 100644 --- a/Engine/source/console/consoleObject.cpp +++ b/Engine/source/console/consoleObject.cpp @@ -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); diff --git a/Engine/source/console/consoleParser.cpp b/Engine/source/console/consoleParser.cpp index 2491ea738..e2dd339f5 100644 --- a/Engine/source/console/consoleParser.cpp +++ b/Engine/source/console/consoleParser.cpp @@ -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 diff --git a/Engine/source/console/consoleParser.h b/Engine/source/console/consoleParser.h index d033f75f4..ac1badaae 100644 --- a/Engine/source/console/consoleParser.h +++ b/Engine/source/console/consoleParser.h @@ -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 diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index 829893641..79decae13 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -339,14 +339,14 @@ struct EngineUnmarshallData< ConsoleValueRef > template struct _EngineTrampoline { - struct Args {}; + struct Args {}; }; template< typename R, typename ...ArgTs > struct _EngineTrampoline< R( ArgTs ... ) > { - typedef std::tuple Args; - std::tuple argT; + typedef std::tuple Args; + std::tuple 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 struct Seq {}; - template struct Gens : Gens {}; - template struct Gens<0, I...>{ typedef Seq type; }; - - template - static R dispatchHelper(typename Super::FunctionType fn, const ArgsType& args, Seq) { - return R( fn(std::get(args) ...) ); - } + using Super = _EngineFunctionTrampolineBase< R(ArgTs...) >; + using ArgsType = typename Super::Args; + + template struct Seq {}; + template struct Gens : Gens {}; + template struct Gens<0, I...>{ typedef Seq type; }; + + template + static R dispatchHelper(typename Super::FunctionType fn, const ArgsType& args, Seq) { + return R( fn(std::get(args) ...) ); + } - using SeqType = typename Gens::type; + using SeqType = typename Gens::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 struct Seq {}; - template struct Gens : Gens {}; - template struct Gens<0, I...>{ typedef Seq type; }; - - template - static R dispatchHelper(Frame f, const ArgsType& args, Seq) { - return R( f._exec(std::get(args) ...) ); - } - - using SeqType = typename Gens::type; + using Super = _EngineMethodTrampolineBase< R(ArgTs ...) >; + using ArgsType = typename _EngineFunctionTrampolineBase< R(ArgTs ...) >::Args; + + template struct Seq {}; + template struct Gens : Gens {}; + template struct Gens<0, I...>{ typedef Seq type; }; + + template + static R dispatchHelper(Frame f, const ArgsType& args, Seq) { + return R( f._exec(std::get(args) ...) ); + } + + using SeqType = typename Gens::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 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 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 - struct ThunkHelpers { - using SelfType = ThunkHelpers; - using FunctionType = R(*)(ArgTs...); - template using MethodType = R(Frame::*)(ArgTs ...) const; - template using IthArgType = typename std::tuple_element >::type; - - template struct Seq {}; - template struct Gens : Gens {}; - template struct Gens<0, I...>{ typedef Seq type; }; - - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static constexpr S32 NUM_ARGS = sizeof...(ArgTs) + startArgc; - - template - static IthArgType getRealArgValue(S32 argc, ConsoleValueRef *argv, const _EngineFunctionDefaultArguments< void(RealArgTs...) >& defaultArgs) - { - if((startArgc + index) < argc) - { - return EngineUnmarshallData< IthArgType >()( argv[ startArgc + index ] ); - } else { - return std::get(defaultArgs.mArgs); - } - } - - template - static R dispatchHelper(S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs, Seq){ - return fn(SelfType::getRealArgValue(argc, argv, defaultArgs) ...); - } - - template - static R dispatchHelper(S32 argc, ConsoleValueRef *argv, MethodType fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs, Seq){ - return (frame->*fn)(SelfType::getRealArgValue(argc, argv, defaultArgs) ...); - } - - using SeqType = typename Gens::type; - }; - - template struct MarshallHelpers { - template static void marshallEach(S32 &argc, ArgVT *argv, const ArgTs& ...args){} - template static void marshallEach(S32 &argc, ArgVT *argv, const H& head, const Tail& ...tail){ - argv[argc++] = EngineMarshallData(head); - marshallEach(argc, argv, tail...); - } - }; - - template<> struct MarshallHelpers { - template static void marshallEach(S32 &argc, ConsoleValueRef *argv, const ArgTs& ...args){} - template static void marshallEach(S32 &argc, ConsoleValueRef *argv, const H& head, const Tail& ...tail){ - EngineMarshallData(head, argc, argv); - marshallEach(argc, argv, tail...); - } - }; - } + namespace detail{ + template + struct ThunkHelpers { + using SelfType = ThunkHelpers; + using FunctionType = R(*)(ArgTs...); + template using MethodType = R(Frame::*)(ArgTs ...) const; + template using IthArgType = typename std::tuple_element >::type; + + template struct Seq {}; + template struct Gens : Gens {}; + template struct Gens<0, I...>{ typedef Seq type; }; + + typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; + static constexpr S32 NUM_ARGS = sizeof...(ArgTs) + startArgc; + + template + static IthArgType getRealArgValue(S32 argc, ConsoleValueRef *argv, const _EngineFunctionDefaultArguments< void(RealArgTs...) >& defaultArgs) + { + if((startArgc + index) < argc) + { + return EngineUnmarshallData< IthArgType >()( argv[ startArgc + index ] ); + } else { + return std::get(defaultArgs.mArgs); + } + } + + template + static R dispatchHelper(S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs, Seq){ + return fn(SelfType::getRealArgValue(argc, argv, defaultArgs) ...); + } + + template + static R dispatchHelper(S32 argc, ConsoleValueRef *argv, MethodType fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs, Seq){ + return (frame->*fn)(SelfType::getRealArgValue(argc, argv, defaultArgs) ...); + } + + using SeqType = typename Gens::type; + }; + + template struct MarshallHelpers { + template static void marshallEach(S32 &argc, ArgVT *argv, const ArgTs& ...args){} + template static void marshallEach(S32 &argc, ArgVT *argv, const H& head, const Tail& ...tail){ + argv[argc++] = EngineMarshallData(head); + marshallEach(argc, argv, tail...); + } + }; + + template<> struct MarshallHelpers { + template static void marshallEach(S32 &argc, ConsoleValueRef *argv, const ArgTs& ...args){} + template 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; - using SeqType = typename Helper::SeqType; + using Helper = engineAPI::detail::ThunkHelpers; + using SeqType = typename Helper::SeqType; public: - typedef typename Helper::FunctionType FunctionType; - typedef typename Helper::ReturnType ReturnType; - template using MethodType = typename Helper::template MethodType; - static constexpr S32 NUM_ARGS = Helper::NUM_ARGS; - + typedef typename Helper::FunctionType FunctionType; + typedef typename Helper::ReturnType ReturnType; + template using MethodType = typename Helper::template MethodType; + 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 fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs) + static ReturnType thunk( S32 argc, ConsoleValueRef *argv, MethodType 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 struct _EngineConsoleThunk { private: - using Helper = engineAPI::detail::ThunkHelpers; - using SeqType = typename Helper::SeqType; + using Helper = engineAPI::detail::ThunkHelpers; + using SeqType = typename Helper::SeqType; public: - typedef typename Helper::FunctionType FunctionType; - typedef typename Helper::ReturnType ReturnType; - template using MethodType = typename Helper::template MethodType; - 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 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 using MethodType = typename Helper::template MethodType; + 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 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; + using Helper = engineAPI::detail::MarshallHelpers; 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 struct _EngineConsoleExecCallbackHelper : public _BaseEngineConsoleCallbackHelper { private: - using Helper = engineAPI::detail::MarshallHelpers; + using Helper = engineAPI::detail::MarshallHelpers; 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 : public _BaseEngineConsoleCallbackHelper { private: - using Helper = engineAPI::detail::MarshallHelpers; + using Helper = engineAPI::detail::MarshallHelpers; 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() ) ); diff --git a/Engine/source/console/engineFunctions.h b/Engine/source/console/engineFunctions.h index 4346b39cf..08249ec16 100644 --- a/Engine/source/console/engineFunctions.h +++ b/Engine/source/console/engineFunctions.h @@ -93,35 +93,35 @@ struct _EngineFunctionDefaultArguments {}; template struct _EngineFunctionDefaultArguments< void(ArgTs...) > : public EngineFunctionDefaultArguments { - template using DefVST = typename EngineTypeTraits::DefaultArgumentValueStoreType; - std::tuple ...> mArgs; + template using DefVST = typename EngineTypeTraits::DefaultArgumentValueStoreType; + std::tuple ...> mArgs; private: - using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >; - - template struct Seq {}; - template struct Gens : Gens {}; - - template struct Gens<0, I...>{ typedef Seq type; }; - - template - static void copyHelper(std::tuple ...> &args, std::tuple ...> &defaultArgs, Seq) { - constexpr size_t offset = (sizeof...(ArgTs) - sizeof...(TailTs)); - std::tie(std::get(args)...) = defaultArgs; - } - - template using MaybeSelfEnabled = typename std::enable_if::type; - - template static MaybeSelfEnabled tailInit(TailTs ...tail) { - std::tuple...> argsT; - std::tuple...> tailT = std::make_tuple(tail...); - SelfType::copyHelper(argsT, tailT, typename Gens::type()); - return argsT; - }; - + using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >; + + template struct Seq {}; + template struct Gens : Gens {}; + + template struct Gens<0, I...>{ typedef Seq type; }; + + template + static void copyHelper(std::tuple ...> &args, std::tuple ...> &defaultArgs, Seq) { + constexpr size_t offset = (sizeof...(ArgTs) - sizeof...(TailTs)); + std::tie(std::get(args)...) = defaultArgs; + } + + template using MaybeSelfEnabled = typename std::enable_if::type; + + template static MaybeSelfEnabled tailInit(TailTs ...tail) { + std::tuple...> argsT; + std::tuple...> tailT = std::make_tuple(tail...); + SelfType::copyHelper(argsT, tailT, typename Gens::type()); + return argsT; + }; + public: - template _EngineFunctionDefaultArguments(TailTs ...tail) - : EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(SelfType::tailInit(tail...)) - {} + template _EngineFunctionDefaultArguments(TailTs ...tail) + : EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(SelfType::tailInit(tail...)) + {} }; #pragma pack( pop ) diff --git a/Engine/source/console/fieldBrushObject.cpp b/Engine/source/console/fieldBrushObject.cpp index d0eaf541c..484178dec 100644 --- a/Engine/source/console/fieldBrushObject.cpp +++ b/Engine/source/console/fieldBrushObject.cpp @@ -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( 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( 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( 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( Sim::findObject( simObjName ) ); diff --git a/Engine/source/console/fileSystemFunctions.cpp b/Engine/source/console/fileSystemFunctions.cpp index d5ee048ca..d8531ff7c 100644 --- a/Engine/source/console/fileSystemFunctions.cpp +++ b/Engine/source/console/fileSystemFunctions.cpp @@ -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 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 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(); } diff --git a/Engine/source/console/persistenceManager.cpp b/Engine/source/console/persistenceManager.cpp index 322626801..7db907475 100644 --- a/Engine/source/console/persistenceManager.cpp +++ b/Engine/source/console/persistenceManager.cpp @@ -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();\n" - " - Remove objects from dirty list: FooManager.removeDirty();\n" - " - List all currently dirty objects: FooManager.listDirty();\n" - " - Check to see if an object is dirty: FooManager.isDirty();\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();\n" + " - Remove objects from dirty list: FooManager.removeDirty();\n" + " - List all currently dirty objects: FooManager.listDirty();\n" + " - Check to see if an object is dirty: FooManager.isDirty();\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)) { diff --git a/Engine/source/console/scriptFilename.cpp b/Engine/source/console/scriptFilename.cpp index 60c81f200..7a72756af 100644 --- a/Engine/source/console/scriptFilename.cpp +++ b/Engine/source/console/scriptFilename.cpp @@ -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]); } diff --git a/Engine/source/console/scriptObjects.cpp b/Engine/source/console/scriptObjects.cpp index e5916fb64..6218e4e3d 100644 --- a/Engine/source/console/scriptObjects.cpp +++ b/Engine/source/console/scriptObjects.cpp @@ -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(); } diff --git a/Engine/source/console/sim.cpp b/Engine/source/console/sim.cpp index e0465050f..0ea902b5c 100644 --- a/Engine/source/console/sim.cpp +++ b/Engine/source/console/sim.cpp @@ -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, 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); -} +} //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- diff --git a/Engine/source/console/simDictionary.h b/Engine/source/console/simDictionary.h index bbfb0f385..1247d504e 100644 --- a/Engine/source/console/simDictionary.h +++ b/Engine/source/console/simDictionary.h @@ -61,7 +61,7 @@ struct StringTableEntryEq } }; -typedef std::unordered_map StringDictDef; +typedef std::unordered_map StringDictDef; typedef std::unordered_map SimObjectIdDictDef; #endif diff --git a/Engine/source/console/simEvents.cpp b/Engine/source/console/simEvents.cpp index bc1e1789c..ab87f5f0b 100644 --- a/Engine/source/console/simEvents.cpp +++ b/Engine/source/console/simEvents.cpp @@ -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]); + } } } diff --git a/Engine/source/console/simManager.cpp b/Engine/source/console/simManager.cpp index b1ee96f5c..4f12fa85f 100644 --- a/Engine/source/console/simManager.cpp +++ b/Engine/source/console/simManager.cpp @@ -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); } } diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index b07bc6840..73a1ffa3d 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -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(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; diff --git a/Engine/source/console/simObject.h b/Engine/source/console/simObject.h index 8a38e8675..6cba1beff 100644 --- a/Engine/source/console/simObject.h +++ b/Engine/source/console/simObject.h @@ -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;} diff --git a/Engine/source/console/simObjectMemento.cpp b/Engine/source/console/simObjectMemento.cpp index 839ae0846..ef2e8f732 100644 --- a/Engine/source/console/simObjectMemento.cpp +++ b/Engine/source/console/simObjectMemento.cpp @@ -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(object); - if( !db ) - stream.write( sizeof( "return " ) - 1, "return " ); - else + SimDataBlock* db = dynamic_cast(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; } diff --git a/Engine/source/console/simObjectMemento.h b/Engine/source/console/simObjectMemento.h index 8fc029726..45b8a9e4d 100644 --- a/Engine/source/console/simObjectMemento.h +++ b/Engine/source/console/simObjectMemento.h @@ -42,7 +42,7 @@ protected: /// The captured object's name. String mObjectName; - bool mIsDatablock; + bool mIsDatablock; public: diff --git a/Engine/source/console/simPersistSet.cpp b/Engine/source/console/simPersistSet.cpp index 1fe272478..2dea6416e 100644 --- a/Engine/source/console/simPersistSet.cpp +++ b/Engine/source/console/simPersistSet.cpp @@ -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"); //----------------------------------------------------------------------------- diff --git a/Engine/source/console/simSerialize.cpp b/Engine/source/console/simSerialize.cpp index e3f64be4c..6a7a84b17 100644 --- a/Engine/source/console/simSerialize.cpp +++ b/Engine/source/console/simSerialize.cpp @@ -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); } diff --git a/Engine/source/console/stringStack.cpp b/Engine/source/console/stringStack.cpp index 45fd83740..681de2898 100644 --- a/Engine/source/console/stringStack.cpp +++ b/Engine/source/console/stringStack.cpp @@ -121,7 +121,7 @@ bool ConsoleValueStack::reserveValues(U32 count, ConsoleValueRef *outValues) //Con::printf("[%i]CSTK reserveValues %i", mStackPos, count); for (U32 i=0; isetTelnetParameters(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); diff --git a/Engine/source/console/telnetDebugger.cpp b/Engine/source/console/telnetDebugger.cpp index 8f95aaf9f..7db6e9710 100644 --- a/Engine/source/console/telnetDebugger.cpp +++ b/Engine/source/console/telnetDebugger.cpp @@ -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"); } diff --git a/Engine/source/console/typeValidators.cpp b/Engine/source/console/typeValidators.cpp index 11249daf7..6b2ea7475 100644 --- a/Engine/source/console/typeValidators.cpp +++ b/Engine/source/console/typeValidators.cpp @@ -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) diff --git a/Engine/source/gfx/video/videoCapture.cpp b/Engine/source/gfx/video/videoCapture.cpp index 0af46af10..8f7b7e52e 100644 --- a/Engine/source/gfx/video/videoCapture.cpp +++ b/Engine/source/gfx/video/videoCapture.cpp @@ -340,7 +340,7 @@ DefineEngineFunction( stopVideoCapture, void, (),, DefineEngineFunction( playJournalToVideo, void, ( const char *journalFile, const char *videoFile, const char *encoder, F32 framerate, Point2I resolution ), - ( nullAsType(), "THEORA", 30.0f, Point2I::Zero ), + ( nullAsType(), "THEORA", 30.0f, Point2I::Zero ), "Load a journal file and capture it video.\n" "@ingroup Rendering\n" ) { diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index 400e50d73..0c91ec54f 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -52,42 +52,42 @@ IMPLEMENT_CONOBJECT(GuiCanvas); ConsoleDocClass( GuiCanvas, - "@brief A canvas on which rendering occurs.\n\n" + "@brief A canvas on which rendering occurs.\n\n" - "@section GuiCanvas_contents What a GUICanvas Can Contain...\n\n" + "@section GuiCanvas_contents What a GUICanvas Can Contain...\n\n" - "@subsection GuiCanvas_content_contentcontrol Content Control\n" - "A content control is the top level GuiControl for a screen. This GuiControl " - "will be the parent control for all other GuiControls on that particular " - "screen.\n\n" + "@subsection GuiCanvas_content_contentcontrol Content Control\n" + "A content control is the top level GuiControl for a screen. This GuiControl " + "will be the parent control for all other GuiControls on that particular " + "screen.\n\n" - "@subsection GuiCanvas_content_dialogs Dialogs\n\n" + "@subsection GuiCanvas_content_dialogs Dialogs\n\n" - "A dialog is essentially another screen, only it gets overlaid on top of the " - "current content control, and all input goes to the dialog. This is most akin " - "to the \"Open File\" dialog box found in most operating systems. When you " - "choose to open a file, and the \"Open File\" dialog pops up, you can no longer " - "send input to the application, and must complete or cancel the open file " - "request. Torque keeps track of layers of dialogs. The dialog with the highest " - "layer is on top and will get all the input, unless the dialog is " - "modeless, which is a profile option.\n\n" + "A dialog is essentially another screen, only it gets overlaid on top of the " + "current content control, and all input goes to the dialog. This is most akin " + "to the \"Open File\" dialog box found in most operating systems. When you " + "choose to open a file, and the \"Open File\" dialog pops up, you can no longer " + "send input to the application, and must complete or cancel the open file " + "request. Torque keeps track of layers of dialogs. The dialog with the highest " + "layer is on top and will get all the input, unless the dialog is " + "modeless, which is a profile option.\n\n" - "@see GuiControlProfile\n\n" + "@see GuiControlProfile\n\n" - "@section GuiCanvas_dirty Dirty Rectangles\n\n" + "@section GuiCanvas_dirty Dirty Rectangles\n\n" - "The GuiCanvas is based on dirty regions. " - "Every frame the canvas paints only the areas of the canvas that are 'dirty' " - "or need updating. In most cases, this only is the area under the mouse cursor. " - "This is why if you look in guiCanvas.cc the call to glClear is commented out. " - - "What you will see is a black screen, except in the dirty regions, where the " - "screen will be painted normally. If you are making an animated GuiControl " - "you need to add your control to the dirty areas of the canvas.\n\n" + "The GuiCanvas is based on dirty regions. " + "Every frame the canvas paints only the areas of the canvas that are 'dirty' " + "or need updating. In most cases, this only is the area under the mouse cursor. " + "This is why if you look in guiCanvas.cc the call to glClear is commented out. " + + "What you will see is a black screen, except in the dirty regions, where the " + "screen will be painted normally. If you are making an animated GuiControl " + "you need to add your control to the dirty areas of the canvas.\n\n" - "@see GuiControl\n\n" + "@see GuiControl\n\n" - "@ingroup GuiCore\n"); + "@ingroup GuiCore\n"); ColorI gCanvasClearColor( 255, 0, 255 ); ///< For GFX->clear @@ -209,29 +209,29 @@ bool GuiCanvas::onAdd() //If we're recording, store the intial video resolution if (Journal::IsRecording()) { - Journal::Write(vm.resolution.x); - Journal::Write(vm.resolution.y); - Journal::Write(vm.fullScreen); + Journal::Write(vm.resolution.x); + Journal::Write(vm.resolution.y); + Journal::Write(vm.fullScreen); } //If we're playing, read the intial video resolution from the journal if (Journal::IsPlaying()) { - Journal::Read(&vm.resolution.x); - Journal::Read(&vm.resolution.y); - Journal::Read(&vm.fullScreen); + Journal::Read(&vm.resolution.x); + Journal::Read(&vm.resolution.y); + Journal::Read(&vm.fullScreen); } if (a && a->mType != NullDevice) { mPlatformWindow = WindowManager->createWindow(newDevice, vm); - //Disable window resizing if recording ir playing a journal - if (Journal::IsRecording() || Journal::IsPlaying()) - mPlatformWindow->lockSize(true); - - // Set a minimum on the window size so people can't break us by resizing tiny. - mPlatformWindow->setMinimumWindowSize(Point2I(640,480)); + //Disable window resizing if recording ir playing a journal + if (Journal::IsRecording() || Journal::IsPlaying()) + mPlatformWindow->lockSize(true); + + // Set a minimum on the window size so people can't break us by resizing tiny. + mPlatformWindow->setMinimumWindowSize(Point2I(640,480)); // Now, we have to hook in our event callbacks so we'll get // appropriate events from the window. @@ -326,12 +326,12 @@ CanvasSizeChangeSignal GuiCanvas::smCanvasSizeChangeSignal; void GuiCanvas::handleResize( WindowId did, S32 width, S32 height ) { getCanvasSizeChangeSignal().trigger(this); - if (Journal::IsPlaying() && mPlatformWindow) - { - mPlatformWindow->lockSize(false); - mPlatformWindow->setSize(Point2I(width, height)); - mPlatformWindow->lockSize(true); - } + if (Journal::IsPlaying() && mPlatformWindow) + { + mPlatformWindow->lockSize(false); + mPlatformWindow->setSize(Point2I(width, height)); + mPlatformWindow->lockSize(true); + } // Notify the scripts if ( isMethod( "onResize" ) ) @@ -342,9 +342,9 @@ void GuiCanvas::handlePaintEvent(WindowId did) { bool canRender = mPlatformWindow->isVisible() && GFX->allowRender() && !GFX->canCurrentlyRender(); - // Do the screenshot first. + // Do the screenshot first. if ( gScreenShot != NULL && gScreenShot->isPending() && canRender ) - gScreenShot->capture( this ); + gScreenShot->capture( this ); // If the video capture is waiting for a canvas, start the capture if ( VIDCAP->isWaitingForCanvas() && canRender ) @@ -560,19 +560,19 @@ bool GuiCanvas::tabNext(void) //save the old GuiControl *oldResponder = mFirstResponder; - GuiControl* newResponder = ctrl->findNextTabable(mFirstResponder); + GuiControl* newResponder = ctrl->findNextTabable(mFirstResponder); if ( !newResponder ) newResponder = ctrl->findFirstTabable(); - if ( newResponder && newResponder != oldResponder ) - { - newResponder->setFirstResponder(); + if ( newResponder && newResponder != oldResponder ) + { + newResponder->setFirstResponder(); // CodeReview Can this get killed? Note tabPrev code. BJG - 3/25/07 -// if ( oldResponder ) -// oldResponder->onLoseFirstResponder(); +// if ( oldResponder ) +// oldResponder->onLoseFirstResponder(); return true; - } + } } return false; } @@ -585,30 +585,30 @@ bool GuiCanvas::tabPrev(void) //save the old GuiControl *oldResponder = mFirstResponder; - GuiControl* newResponder = ctrl->findPrevTabable(mFirstResponder); - if ( !newResponder ) + GuiControl* newResponder = ctrl->findPrevTabable(mFirstResponder); + if ( !newResponder ) newResponder = ctrl->findLastTabable(); - if ( newResponder && newResponder != oldResponder ) - { - newResponder->setFirstResponder(); - + if ( newResponder && newResponder != oldResponder ) + { + newResponder->setFirstResponder(); + // CodeReview As with tabNext() above, looks like this can now go. DAW - 7/05/09 - //if ( oldResponder ) - // oldResponder->onLoseFirstResponder(); + //if ( oldResponder ) + // oldResponder->onLoseFirstResponder(); return true; - } + } } return false; } bool GuiCanvas::processInputEvent(InputEventInfo &inputEvent) { - // First call the general input handler (on the extremely off-chance that it will be handled): - if (mFirstResponder && mFirstResponder->onInputEvent(inputEvent)) + // First call the general input handler (on the extremely off-chance that it will be handled): + if (mFirstResponder && mFirstResponder->onInputEvent(inputEvent)) { - return(true); + return(true); } switch (inputEvent.deviceType) @@ -1786,9 +1786,9 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */) addUpdateRegion(pos - Point2I(2, 2), Point2I(cext.x + 4, cext.y + 4)); } - mLastCursorEnabled = cursorVisible; - mLastCursor = mouseCursor; - mLastCursorPt = cursorPos; + mLastCursorEnabled = cursorVisible; + mLastCursor = mouseCursor; + mLastCursorPt = cursorPos; // Begin GFX PROFILE_START(GFXBeginScene); @@ -1830,7 +1830,7 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */) resetUpdateRegions(); - // Make sure we have a clean matrix state + // Make sure we have a clean matrix state // before we start rendering anything! GFX->setWorldMatrix( MatrixF::Identity ); GFX->setViewMatrix( MatrixF::Identity ); @@ -2039,46 +2039,46 @@ void GuiCanvas::resetUpdateRegions() void GuiCanvas::setFirstResponder( GuiControl* newResponder ) { - GuiControl* oldResponder = mFirstResponder; - Parent::setFirstResponder( newResponder ); + GuiControl* oldResponder = mFirstResponder; + Parent::setFirstResponder( newResponder ); if( oldResponder == mFirstResponder ) return; - if( oldResponder && ( oldResponder != newResponder ) ) - oldResponder->onLoseFirstResponder(); + if( oldResponder && ( oldResponder != newResponder ) ) + oldResponder->onLoseFirstResponder(); if( newResponder && ( newResponder != oldResponder ) ) newResponder->onGainFirstResponder(); } DefineEngineMethod( GuiCanvas, getContent, S32, (),, - "@brief Get the GuiControl which is being used as the content.\n\n" + "@brief Get the GuiControl which is being used as the content.\n\n" - "@tsexample\n" - "Canvas.getContent();\n" - "@endtsexample\n\n" + "@tsexample\n" + "Canvas.getContent();\n" + "@endtsexample\n\n" - "@return ID of current content control") + "@return ID of current content control") { - GuiControl *ctrl = object->getContentControl(); + GuiControl *ctrl = object->getContentControl(); if(ctrl) return ctrl->getId(); return -1; } DefineEngineMethod( GuiCanvas, setContent, void, (GuiControl* ctrl),, - "@brief Set the content of the canvas to a specified control.\n\n" + "@brief Set the content of the canvas to a specified control.\n\n" - "@param ctrl ID or name of GuiControl to set content to\n\n" + "@param ctrl ID or name of GuiControl to set content to\n\n" - "@tsexample\n" - "Canvas.setContent(PlayGui);\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.setContent(PlayGui);\n" + "@endtsexample\n\n") { - // Not using old error reporting until we modify the engineAPI - mperry + // Not using old error reporting until we modify the engineAPI - mperry - //GuiControl *gui = NULL; + //GuiControl *gui = NULL; // if(argv[2][0]) // { // if (!Sim::findObject(argv[2], gui)) @@ -2088,11 +2088,11 @@ DefineEngineMethod( GuiCanvas, setContent, void, (GuiControl* ctrl),, // } // } - if(!ctrl) - { - Con::errorf("GuiCanvas::setContent - Invalid control specified')"); - return; - } + if(!ctrl) + { + Con::errorf("GuiCanvas::setContent - Invalid control specified')"); + return; + } //set the new content control object->setContentControl(ctrl); @@ -2111,11 +2111,11 @@ ConsoleDocFragment _pushDialog( ); DefineConsoleMethod( GuiCanvas, pushDialog, void, (const char * ctrlName, S32 layer, bool center), ( 0, false), "(GuiControl ctrl, int layer=0, bool center=false)" - "@hide") + "@hide") { GuiControl *gui; - if (! Sim::findObject(ctrlName, gui)) + if (! Sim::findObject(ctrlName, gui)) { Con::printf("pushDialog(): Invalid control: %s", ctrlName); return; @@ -2148,7 +2148,7 @@ ConsoleDocFragment _popDialog2( ); DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (nullAsType()), "(GuiControl ctrl=NULL)" - "@hide") + "@hide") { if (gui) object->popDialogControl(gui); @@ -2157,160 +2157,160 @@ DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (nullAsType } ConsoleDocFragment _popLayer1( - "@brief Removes the top most layer of dialogs\n\n" - "@tsexample\n" - "Canvas.popLayer();\n" - "@endtsexample\n\n", - "GuiCanvas", - "void popLayer();" + "@brief Removes the top most layer of dialogs\n\n" + "@tsexample\n" + "Canvas.popLayer();\n" + "@endtsexample\n\n", + "GuiCanvas", + "void popLayer();" ); ConsoleDocFragment _popLayer2( - "@brief Removes a specified layer of dialogs\n\n" - "@param layer Number of the layer to pop\n\n" - "@tsexample\n" - "Canvas.popLayer(1);\n" - "@endtsexample\n\n", - "GuiCanvas", - "void popLayer(S32 layer);" + "@brief Removes a specified layer of dialogs\n\n" + "@param layer Number of the layer to pop\n\n" + "@tsexample\n" + "Canvas.popLayer(1);\n" + "@endtsexample\n\n", + "GuiCanvas", + "void popLayer(S32 layer);" ); DefineConsoleMethod( GuiCanvas, popLayer, void, (S32 layer), (0), "(int layer)" - "@hide") + "@hide") { object->popDialogControl(layer); } DefineEngineMethod( GuiCanvas, cursorOn, void, (),, - "@brief Turns on the mouse cursor.\n\n" - "@tsexample\n" - "Canvas.cursorOn();\n" - "@endtsexample\n\n") + "@brief Turns on the mouse cursor.\n\n" + "@tsexample\n" + "Canvas.cursorOn();\n" + "@endtsexample\n\n") { - object->setCursorON(true); + object->setCursorON(true); } DefineEngineMethod( GuiCanvas, cursorOff, void, (),, - "@brief Turns on the mouse off.\n\n" - "@tsexample\n" - "Canvas.cursorOff();\n" - "@endtsexample\n\n") + "@brief Turns on the mouse off.\n\n" + "@tsexample\n" + "Canvas.cursorOff();\n" + "@endtsexample\n\n") { - object->setCursorON(false); + object->setCursorON(false); } DefineEngineMethod( GuiCanvas, setCursor, void, (GuiCursor* cursor),, - "@brief Sets the cursor for the canvas.\n\n" + "@brief Sets the cursor for the canvas.\n\n" - "@param cursor Name of the GuiCursor to use\n\n" + "@param cursor Name of the GuiCursor to use\n\n" - "@tsexample\n" - "Canvas.setCursor(\"DefaultCursor\");\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.setCursor(\"DefaultCursor\");\n" + "@endtsexample\n\n") { - if(!cursor) - { - Con::errorf("GuiCanvas::setCursor - Invalid GuiCursor name or ID"); - return; - } - object->setCursor(cursor); + if(!cursor) + { + Con::errorf("GuiCanvas::setCursor - Invalid GuiCursor name or ID"); + return; + } + object->setCursor(cursor); } DefineEngineMethod( GuiCanvas, renderFront, void, ( bool enable ),, - "@brief This turns on/off front-buffer rendering.\n\n" + "@brief This turns on/off front-buffer rendering.\n\n" - "@param enable True if all rendering should be done to the front buffer\n\n" + "@param enable True if all rendering should be done to the front buffer\n\n" - "@tsexample\n" - "Canvas.renderFront(false);\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.renderFront(false);\n" + "@endtsexample\n\n") { - object->setRenderFront(enable); + object->setRenderFront(enable); } DefineEngineMethod( GuiCanvas, showCursor, void, (),, - "@brief Enable rendering of the cursor.\n\n" + "@brief Enable rendering of the cursor.\n\n" - "@tsexample\n" - "Canvas.showCursor();\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.showCursor();\n" + "@endtsexample\n\n") { - object->showCursor(true); + object->showCursor(true); } DefineEngineMethod( GuiCanvas, hideCursor, void, (),, - "@brief Disable rendering of the cursor.\n\n" + "@brief Disable rendering of the cursor.\n\n" - "@tsexample\n" - "Canvas.hideCursor();\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.hideCursor();\n" + "@endtsexample\n\n") { - object->showCursor(false); + object->showCursor(false); } DefineEngineMethod( GuiCanvas, isCursorOn, bool, (),, - "@brief Determines if mouse cursor is enabled.\n\n" + "@brief Determines if mouse cursor is enabled.\n\n" - "@tsexample\n" - "// Is cursor on?\n" - "if(Canvas.isCursorOn())\n" - " echo(\"Canvas cursor is on\");\n" - "@endtsexample\n\n" - "@return Returns true if the cursor is on.\n\n") + "@tsexample\n" + "// Is cursor on?\n" + "if(Canvas.isCursorOn())\n" + " echo(\"Canvas cursor is on\");\n" + "@endtsexample\n\n" + "@return Returns true if the cursor is on.\n\n") { - return object->isCursorON(); + return object->isCursorON(); } DefineEngineMethod( GuiCanvas, isCursorShown, bool, (),, - "@brief Determines if mouse cursor is rendering.\n\n" + "@brief Determines if mouse cursor is rendering.\n\n" - "@tsexample\n" - "// Is cursor rendering?\n" - "if(Canvas.isCursorShown())\n" - " echo(\"Canvas cursor is rendering\");\n" - "@endtsexample\n\n" - "@return Returns true if the cursor is rendering.\n\n") + "@tsexample\n" + "// Is cursor rendering?\n" + "if(Canvas.isCursorShown())\n" + " echo(\"Canvas cursor is rendering\");\n" + "@endtsexample\n\n" + "@return Returns true if the cursor is rendering.\n\n") { - return object->isCursorShown(); + return object->isCursorShown(); } DefineEngineMethod( GuiCanvas, repaint, void, ( S32 elapsedMS ), (0), - "@brief Force canvas to redraw.\n" + "@brief Force canvas to redraw.\n" "If the elapsed time is greater than the time since the last paint " "then the repaint will be skipped.\n" "@param elapsedMS The optional elapsed time in milliseconds.\n\n" - "@tsexample\n" - "Canvas.repaint();\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.repaint();\n" + "@endtsexample\n\n") { - object->repaint(elapsedMS < 0 ? 0 : elapsedMS); + object->repaint(elapsedMS < 0 ? 0 : elapsedMS); } DefineEngineMethod( GuiCanvas, reset, void, (),, - "@brief Reset the update regions for the canvas.\n\n" + "@brief Reset the update regions for the canvas.\n\n" - "@tsexample\n" - "Canvas.reset();\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.reset();\n" + "@endtsexample\n\n") { - object->resetUpdateRegions(); + object->resetUpdateRegions(); } DefineEngineMethod( GuiCanvas, getCursorPos, Point2I, (),, - "@brief Get the current position of the cursor in screen-space. Note that this position" + "@brief Get the current position of the cursor in screen-space. Note that this position" " might be outside the Torque window. If you want to get the position within the Canvas," " call screenToClient on the result.\n\n" "@see Canvas::screenToClient()\n\n" - "@param param Description\n\n" - "@tsexample\n" - "%cursorPos = Canvas.getCursorPos();\n" - "@endtsexample\n\n" - "@return Screen coordinates of mouse cursor, in format \"X Y\"") + "@param param Description\n\n" + "@tsexample\n" + "%cursorPos = Canvas.getCursorPos();\n" + "@endtsexample\n\n" + "@return Screen coordinates of mouse cursor, in format \"X Y\"") { - return object->getCursorPos(); + return object->getCursorPos(); } ConsoleDocFragment _setCursorPos1( @@ -2334,21 +2334,21 @@ ConsoleDocFragment _setCursorPos2( ); DefineConsoleMethod( GuiCanvas, setCursorPos, void, (Point2I pos), , "(Point2I pos)" - "@hide") + "@hide") { object->setCursorPos(pos); } DefineEngineMethod( GuiCanvas, getMouseControl, S32, (),, - "@brief Gets the gui control under the mouse.\n\n" - "@tsexample\n" - "%underMouse = Canvas.getMouseControl();\n" - "@endtsexample\n\n" + "@brief Gets the gui control under the mouse.\n\n" + "@tsexample\n" + "%underMouse = Canvas.getMouseControl();\n" + "@endtsexample\n\n" - "@return ID of the gui control, if one was found. NULL otherwise") + "@return ID of the gui control, if one was found. NULL otherwise") { - GuiControl* control = object->getMouseControl(); + GuiControl* control = object->getMouseControl(); if (control) return control->getId(); @@ -2356,18 +2356,18 @@ DefineEngineMethod( GuiCanvas, getMouseControl, S32, (),, } DefineEngineFunction(excludeOtherInstance, bool, (const char* appIdentifer),, - "@brief Used to exclude/prevent all other instances using the same identifier specified\n\n" + "@brief Used to exclude/prevent all other instances using the same identifier specified\n\n" - "@note Not used on OSX, Xbox, or in Win debug builds\n\n" + "@note Not used on OSX, Xbox, or in Win debug builds\n\n" - "@param appIdentifier Name of the app set up for exclusive use.\n" + "@param appIdentifier Name of the app set up for exclusive use.\n" - "@return False if another app is running that specified the same appIdentifier\n\n" + "@return False if another app is running that specified the same appIdentifier\n\n" - "@ingroup Platform\n" - "@ingroup GuiCore") + "@ingroup Platform\n" + "@ingroup GuiCore") { - // mac/360 can only run one instance in general. + // mac/360 can only run one instance in general. #if !defined(TORQUE_OS_MAC) && !defined(TORQUE_OS_XENON) && !defined(TORQUE_DEBUG) && !defined(TORQUE_OS_LINUX) return Platform::excludeOtherInstances(appIdentifer); #else @@ -2377,82 +2377,82 @@ DefineEngineFunction(excludeOtherInstance, bool, (const char* appIdentifer),, } DefineEngineMethod( GuiCanvas, getExtent, Point2I, (),, - "@brief Returns the dimensions of the canvas\n\n" + "@brief Returns the dimensions of the canvas\n\n" - "@tsexample\n" - "%extent = Canvas.getExtent();\n" - "@endtsexample\n\n" + "@tsexample\n" + "%extent = Canvas.getExtent();\n" + "@endtsexample\n\n" - "@return Width and height of canvas. Formatted as numerical values in a single string \"# #\"") + "@return Width and height of canvas. Formatted as numerical values in a single string \"# #\"") { - return object->getExtent(); + return object->getExtent(); } DefineEngineMethod( GuiCanvas, setWindowTitle, void, ( const char* newTitle),, - "@brief Change the title of the OS window.\n\n" + "@brief Change the title of the OS window.\n\n" - "@param newTitle String containing the new name\n\n" + "@param newTitle String containing the new name\n\n" - "@tsexample\n" - "Canvas.setWindowTitle(\"Documentation Rocks!\");\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.setWindowTitle(\"Documentation Rocks!\");\n" + "@endtsexample\n\n") { - object->setWindowTitle(newTitle); + object->setWindowTitle(newTitle); } DefineEngineMethod( GuiCanvas, findFirstMatchingMonitor, S32, (const char* name),, - "@brief Find the first monitor index that matches the given name.\n\n" + "@brief Find the first monitor index that matches the given name.\n\n" "The actual match algorithm depends on the implementation.\n" "@param name The name to search for.\n\n" - "@return The number of monitors attached to the system, including the default monoitor.") + "@return The number of monitors attached to the system, including the default monoitor.") { return PlatformWindowManager::get()->findFirstMatchingMonitor(name); } DefineEngineMethod( GuiCanvas, getMonitorCount, S32, (),, - "@brief Gets the number of monitors attached to the system.\n\n" + "@brief Gets the number of monitors attached to the system.\n\n" - "@return The number of monitors attached to the system, including the default monoitor.") + "@return The number of monitors attached to the system, including the default monoitor.") { return PlatformWindowManager::get()->getMonitorCount(); } DefineEngineMethod( GuiCanvas, getMonitorName, const char*, (S32 index),, - "@brief Gets the name of the requested monitor.\n\n" + "@brief Gets the name of the requested monitor.\n\n" "@param index The monitor index.\n\n" - "@return The name of the requested monitor.") + "@return The name of the requested monitor.") { return PlatformWindowManager::get()->getMonitorName(index); } DefineEngineMethod( GuiCanvas, getMonitorRect, RectI, (S32 index),, - "@brief Gets the region of the requested monitor.\n\n" + "@brief Gets the region of the requested monitor.\n\n" "@param index The monitor index.\n\n" - "@return The rectangular region of the requested monitor.") + "@return The rectangular region of the requested monitor.") { return PlatformWindowManager::get()->getMonitorRect(index); } DefineEngineMethod( GuiCanvas, getVideoMode, const char*, (),, - "@brief Gets the current screen mode as a string.\n\n" + "@brief Gets the current screen mode as a string.\n\n" - "The return string will contain 5 values (width, height, fullscreen, bitdepth, refreshRate). " - "You will need to parse out each one for individual use.\n\n" + "The return string will contain 5 values (width, height, fullscreen, bitdepth, refreshRate). " + "You will need to parse out each one for individual use.\n\n" - "@tsexample\n" - "%screenWidth = getWord(Canvas.getVideoMode(), 0);\n" - "%screenHeight = getWord(Canvas.getVideoMode(), 1);\n" - "%isFullscreen = getWord(Canvas.getVideoMode(), 2);\n" - "%bitdepth = getWord(Canvas.getVideoMode(), 3);\n" - "%refreshRate = getWord(Canvas.getVideoMode(), 4);\n" - "@endtsexample\n\n" + "@tsexample\n" + "%screenWidth = getWord(Canvas.getVideoMode(), 0);\n" + "%screenHeight = getWord(Canvas.getVideoMode(), 1);\n" + "%isFullscreen = getWord(Canvas.getVideoMode(), 2);\n" + "%bitdepth = getWord(Canvas.getVideoMode(), 3);\n" + "%refreshRate = getWord(Canvas.getVideoMode(), 4);\n" + "@endtsexample\n\n" - "@return String formatted with screen width, screen height, screen mode, bit depth, and refresh rate.") + "@return String formatted with screen width, screen height, screen mode, bit depth, and refresh rate.") { - // Grab the video mode. + // Grab the video mode. if (!object->getPlatformWindow()) return ""; @@ -2463,17 +2463,17 @@ DefineEngineMethod( GuiCanvas, getVideoMode, const char*, (),, DefineEngineMethod( GuiCanvas, getModeCount, S32, (),, - "@brief Gets the number of modes available on this device.\n\n" + "@brief Gets the number of modes available on this device.\n\n" - "@param param Description\n\n" + "@param param Description\n\n" - "@tsexample\n" - "%modeCount = Canvas.getModeCount()\n" - "@endtsexample\n\n" + "@tsexample\n" + "%modeCount = Canvas.getModeCount()\n" + "@endtsexample\n\n" - "@return The number of video modes supported by the device") + "@return The number of video modes supported by the device") { - if (!object->getPlatformWindow()) + if (!object->getPlatformWindow()) return 0; // Grab the available mode list from the device. @@ -2485,12 +2485,12 @@ DefineEngineMethod( GuiCanvas, getModeCount, S32, (),, } DefineEngineMethod( GuiCanvas, getMode, const char*, (S32 modeId),, - "@brief Gets information on the specified mode of this device.\n\n" - "@param modeId Index of the mode to get data from.\n" - "@return A video mode string given an adapter and mode index.\n\n" - "@see GuiCanvas::getVideoMode()") + "@brief Gets information on the specified mode of this device.\n\n" + "@param modeId Index of the mode to get data from.\n" + "@return A video mode string given an adapter and mode index.\n\n" + "@see GuiCanvas::getVideoMode()") { - if (!object->getPlatformWindow()) + if (!object->getPlatformWindow()) return 0; // Grab the available mode list from the device. @@ -2515,14 +2515,14 @@ DefineEngineMethod( GuiCanvas, getMode, const char*, (S32 modeId),, DefineEngineMethod( GuiCanvas, toggleFullscreen, void, (),, - "@brief toggle canvas from fullscreen to windowed mode or back.\n\n" + "@brief toggle canvas from fullscreen to windowed mode or back.\n\n" - "@tsexample\n" - "// If we are in windowed mode, the following will put is in fullscreen\n" - "Canvas.toggleFullscreen();" - "@endtsexample\n\n") + "@tsexample\n" + "// If we are in windowed mode, the following will put is in fullscreen\n" + "Canvas.toggleFullscreen();" + "@endtsexample\n\n") { - if (Platform::getWebDeployment()) + if (Platform::getWebDeployment()) return; if (!object->getPlatformWindow()) @@ -2693,7 +2693,7 @@ DefineConsoleMethod( GuiCanvas, setVideoMode, void, "\\param fullscreen Specify true to run fullscreen or false to run in a window\n" "\\param bitDepth [optional] The desired bit-depth. Defaults to the current setting. This parameter is ignored if you are running in a window.\n" "\\param refreshRate [optional] The desired refresh rate. Defaults to the current setting. This parameter is ignored if you are running in a window" - "\\param antialiasLevel [optional] The level of anti-aliasing to apply 0 = none" ) + "\\param antialiasLevel [optional] The level of anti-aliasing to apply 0 = none" ) { if (!object->getPlatformWindow()) return; diff --git a/Engine/source/gui/editor/guiEditCtrl.cpp b/Engine/source/gui/editor/guiEditCtrl.cpp index 5c4c09fb3..aa002f05d 100644 --- a/Engine/source/gui/editor/guiEditCtrl.cpp +++ b/Engine/source/gui/editor/guiEditCtrl.cpp @@ -716,16 +716,16 @@ void GuiEditCtrl::onRender(Point2I offset, const RectI &updateRect) ctOffset = getCurrentAddSet()->localToGlobalCoord(Point2I(0,0)); RectI box(ctOffset.x, ctOffset.y, cext.x, cext.y); - box.inset( -5, -5 ); + box.inset( -5, -5 ); drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) ); - box.inset( 1, 1 ); + box.inset( 1, 1 ); drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) ); - box.inset( 1, 1 ); + box.inset( 1, 1 ); drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) ); - box.inset( 1, 1 ); + box.inset( 1, 1 ); + drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) ); + box.inset( 1, 1 ); drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) ); - box.inset( 1, 1 ); - drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) ); } Vector::iterator i; bool multisel = mSelectedControls.size() > 1; @@ -2481,16 +2481,16 @@ DefineConsoleMethod( GuiEditCtrl, getContentControl, S32, (), , "() - Return the DefineConsoleMethod( GuiEditCtrl, setContentControl, void, (GuiControl *ctrl ), , "( GuiControl ctrl ) - Set the toplevel control to edit in the GUI editor." ) { - if (ctrl) - object->setContentControl(ctrl); + if (ctrl) + object->setContentControl(ctrl); } //----------------------------------------------------------------------------- DefineConsoleMethod( GuiEditCtrl, addNewCtrl, void, (GuiControl *ctrl), , "(GuiControl ctrl)") { - if (ctrl) - object->addNewControl(ctrl); + if (ctrl) + object->addNewControl(ctrl); } //----------------------------------------------------------------------------- @@ -2518,7 +2518,7 @@ DefineConsoleMethod( GuiEditCtrl, clearSelection, void, (), , "Clear selected co DefineConsoleMethod( GuiEditCtrl, select, void, (GuiControl *ctrl), , "(GuiControl ctrl)") { - if (ctrl) + if (ctrl) object->setSelection(ctrl, false); } @@ -2526,7 +2526,7 @@ DefineConsoleMethod( GuiEditCtrl, select, void, (GuiControl *ctrl), , "(GuiContr DefineConsoleMethod( GuiEditCtrl, setCurrentAddSet, void, (GuiControl *addSet), , "(GuiControl ctrl)") { - if (addSet) + if (addSet) object->setCurrentAddSet(addSet); } diff --git a/Engine/source/gui/editor/guiMenuBar.cpp b/Engine/source/gui/editor/guiMenuBar.cpp index ea16d4728..688531a87 100644 --- a/Engine/source/gui/editor/guiMenuBar.cpp +++ b/Engine/source/gui/editor/guiMenuBar.cpp @@ -81,8 +81,8 @@ ConsoleDocClass( GuiMenuBar, "@tsexample\n" "new GuiMenuBar(newMenuBar)\n" "{\n" - " Padding = \"0\";\n" - " //Properties not specific to this control have been omitted from this example.\n" + " Padding = \"0\";\n" + " //Properties not specific to this control have been omitted from this example.\n" "};\n\n" "// Add a menu to the menu bar\n" "newMenuBar.addMenu(0,\"New Menu\");\n\n" @@ -105,7 +105,7 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMouseInMenu, void, (bool isInMenu),( isInMenu "// Mouse enters or persists within the menu, causing the callback to occur.\n" "GuiMenuBar::onMouseInMenu(%this,%hasLeftMenu)\n" "{\n" - " // Code to run when the callback occurs\n" + " // Code to run when the callback occurs\n" "}\n" "@endtsexample\n\n" "@see GuiTickCtrl\n\n" @@ -119,14 +119,14 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMenuSelect, void, ( S32 menuId, const char* me "// A menu has been selected, causing the callback to occur.\n" "GuiMenuBar::onMenuSelect(%this,%menuId,%menuText)\n" "{\n" - " // Code to run when the callback occurs\n" + " // Code to run when the callback occurs\n" "}\n" "@endtsexample\n\n" "@see GuiTickCtrl\n\n" ); IMPLEMENT_CALLBACK( GuiMenuBar, onMenuItemSelect, void, ( S32 menuId, const char* menuText, S32 menuItemId, const char* menuItemText ), - ( menuId, menuText, menuItemId, menuItemText ), + ( menuId, menuText, menuItemId, menuItemText ), "@brief Called whenever an item in a menu is selected.\n\n" "@param menuId Index id of the menu which contains the selected menu item\n" "@param menuText Text of the menu which contains the selected menu item\n\n" @@ -136,7 +136,7 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMenuItemSelect, void, ( S32 menuId, const char "// A menu item has been selected, causing the callback to occur.\n" "GuiMenuBar::onMenuItemSelect(%this,%menuId,%menuText,%menuItemId,%menuItemText)\n" "{\n" - " // Code to run when the callback occurs\n" + " // Code to run when the callback occurs\n" "}\n" "@endtsexample\n\n" "@see GuiTickCtrl\n\n" @@ -149,7 +149,7 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onSubmenuSelect, void, ( S32 submenuId, const ch "@tsexample\n" "GuiMenuBar::onSubmenuSelect(%this,%submenuId,%submenuText)\n" "{\n" - " // Code to run when the callback occurs\n" + " // Code to run when the callback occurs\n" "}\n" "@endtsexample\n\n" "@see GuiTickCtrl\n\n" @@ -216,7 +216,7 @@ DefineEngineMethod(GuiMenuBar, addMenu, void, (const char* menuText, S32 menuId) } DefineEngineMethod(GuiMenuBar, addMenuItem, void, (const char* targetMenu, const char* menuItemText, S32 menuItemId, const char* accelerator, int checkGroup, const char *cmd), - ("","",0,nullAsType(),-1,""), + ("","",0,nullAsType(),-1,""), "@brief Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.\n\n" "@param menu Menu name or menu Id to add the new item to.\n" "@param menuItemText Text for the new menu item.\n" @@ -637,7 +637,7 @@ DefineEngineMethod(GuiMenuBar, setMenuItemSubmenuState, void, (const char* menuT } DefineEngineMethod(GuiMenuBar, addSubmenuItem, void, (const char* menuTarget, const char* menuItem, const char* submenuItemText, - int submenuItemId, const char* accelerator, int checkGroup),, + int submenuItemId, const char* accelerator, int checkGroup),, "@brief Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.\n\n" "@param menuTarget Menu to affect a submenu in\n" "@param menuItem Menu item to affect\n" @@ -814,21 +814,21 @@ void GuiMenuBar::addMenu(const char *menuText, U32 menuId) GuiMenuBar::Menu *GuiMenuBar::findMenu(const char *menu) { - if(dIsdigit(menu[0])) - { - U32 id = dAtoi(menu); + if(dIsdigit(menu[0])) + { + U32 id = dAtoi(menu); for (U32 i = 0; i < mMenuList.size(); ++i) if (id == mMenuList[i]->id) return mMenuList[i]; - return NULL; - } - else - { + return NULL; + } + else + { for (U32 i = 0; i < mMenuList.size(); ++i) if (!dStricmp(menu, mMenuList[i]->text)) return mMenuList[i]; - return NULL; - } + return NULL; + } } GuiMenuBar::MenuItem *GuiMenuBar::findMenuItem(Menu *menu, const char *menuItem) @@ -981,13 +981,13 @@ GuiMenuBar::MenuItem *GuiMenuBar::findSubmenuItem(Menu *menu, const char *menuIt U32 id = dAtoi(menuItem); for(MenuItem *walk = menu->firstMenuItem; walk; walk = walk->nextMenuItem) if(id == walk->id) - { - if(walk->isSubmenu && walk->submenu) - { + { + if(walk->isSubmenu && walk->submenu) + { return GuiMenuBar::findMenuItem(walk->submenu, submenuItem); - } - return NULL; - } + } + return NULL; + } return NULL; } else @@ -995,13 +995,13 @@ GuiMenuBar::MenuItem *GuiMenuBar::findSubmenuItem(Menu *menu, const char *menuIt // Search by name for(MenuItem *walk = menu->firstMenuItem; walk; walk = walk->nextMenuItem) if(!dStricmp(menuItem, walk->text)) - { - if(walk->isSubmenu && walk->submenu) - { + { + if(walk->isSubmenu && walk->submenu) + { return GuiMenuBar::findMenuItem(walk->submenu, submenuItem); - } - return NULL; - } + } + return NULL; + } return NULL; } } @@ -1021,7 +1021,7 @@ void GuiMenuBar::addSubmenuItem(Menu *menu, MenuItem *submenu, const char *text, if(submenu && !submenu->isSubmenu) { Con::errorf("GuiMenuBar::addSubmenuItem: Attempting to add menuitem '%s' to an invalid submenu",text); - return; + return; } // allocate the new menu item @@ -1074,7 +1074,7 @@ void GuiMenuBar::removeSubmenuItem(MenuItem *menuItem, MenuItem *submenuItem) if(menuItem && !menuItem->isSubmenu) { Con::errorf("GuiMenuBar::removeSubmenuItem: Attempting to remove submenuitem '%s' from an invalid submenu",submenuItem->text); - return; + return; } GuiMenuBar::removeMenuItem(menuItem->submenu, submenuItem); @@ -1087,7 +1087,7 @@ void GuiMenuBar::clearSubmenuItems(MenuItem *menuitem) if(menuitem && !menuitem->isSubmenu) { Con::errorf("GuiMenuBar::clearSubmenuItems: Attempting to clear an invalid submenu"); - return; + return; } while(menuitem->submenu->firstMenuItem) @@ -1175,33 +1175,33 @@ void GuiMenuBar::onPreRender() if (!mMenuList[i]->visible) continue; - // Bounds depends on if there is a bitmap to be drawn or not + // Bounds depends on if there is a bitmap to be drawn or not if (mMenuList[i]->bitmapIndex == -1) - { + { // Text only mMenuList[i]->bounds.set(curX, 0, mProfile->mFont->getStrWidth(mMenuList[i]->text) + (mHorizontalMargin * 2), getHeight() - (mVerticalMargin * 2)); } else - { + { // Will the bitmap and text be draw? if (!mMenuList[i]->drawBitmapOnly) - { + { // Draw the bitmap and the text RectI *bitmapBounds = mProfile->mBitmapArrayRects.address(); mMenuList[i]->bounds.set(curX, 0, bitmapBounds[mMenuList[i]->bitmapIndex].extent.x + mProfile->mFont->getStrWidth(mMenuList[i]->text) + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2)); - } else - { + } else + { // Only the bitmap will be drawn RectI *bitmapBounds = mProfile->mBitmapArrayRects.address(); mMenuList[i]->bounds.set(curX, 0, bitmapBounds[mMenuList[i]->bitmapIndex].extent.x + mBitmapMargin + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2)); - } - } + } + } curX += mMenuList[i]->bounds.extent.x; } - mouseOverMenu = NULL; - mouseDownMenu = NULL; + mouseOverMenu = NULL; + mouseDownMenu = NULL; } } @@ -1222,35 +1222,35 @@ void GuiMenuBar::checkMenuMouseMove(const GuiEvent &event) void GuiMenuBar::onMouseMove(const GuiEvent &event) { Menu *hit = findHitMenu(event.mousePoint); - if(hit != mouseOverMenu) - { - // If we need to, reset the mouse over menu counter and indicate - // that we should track it. - if(hit) + if(hit != mouseOverMenu) + { + // If we need to, reset the mouse over menu counter and indicate + // that we should track it. + if(hit) mMouseOverCounter = 0; - if(!mCountMouseOver) - { + if(!mCountMouseOver) + { // We've never started the counter, so start it. if(hit) mCountMouseOver = true; - } + } - mouseOverMenu = hit; - setUpdate(); - } + mouseOverMenu = hit; + setUpdate(); + } } void GuiMenuBar::onMouseLeave(const GuiEvent &event) { if(mouseOverMenu) - setUpdate(); - mouseOverMenu = NULL; + setUpdate(); + mouseOverMenu = NULL; // As we've left the control, don't track how long the mouse has been // within it. if(mCountMouseOver && mMouseOverCounter >= mMouseHoverAmount) { - onMouseInMenu_callback(false); // Last parameter indicates if we've entered or left the menu + onMouseInMenu_callback(false); // Last parameter indicates if we've entered or left the menu } mCountMouseOver = false; mMouseOverCounter = 0; @@ -1259,38 +1259,38 @@ void GuiMenuBar::onMouseLeave(const GuiEvent &event) void GuiMenuBar::onMouseDragged(const GuiEvent &event) { Menu *hit = findHitMenu(event.mousePoint); - - if(hit != mouseOverMenu) - { - // If we need to, reset the mouse over menu counter and indicate - // that we should track it. - if(hit) + + if(hit != mouseOverMenu) + { + // If we need to, reset the mouse over menu counter and indicate + // that we should track it. + if(hit) mMouseOverCounter = 0; - if(!mCountMouseOver) - { + if(!mCountMouseOver) + { // We've never started the counter, so start it. if(hit) mCountMouseOver = true; - } + } - mouseOverMenu = hit; + mouseOverMenu = hit; mouseDownMenu = hit; - setUpdate(); + setUpdate(); onAction(); - } + } } void GuiMenuBar::onMouseDown(const GuiEvent &event) { mouseDownMenu = mouseOverMenu = findHitMenu(event.mousePoint); - setUpdate(); + setUpdate(); onAction(); } void GuiMenuBar::onMouseUp(const GuiEvent &event) { mouseDownMenu = NULL; - setUpdate(); + setUpdate(); } void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect) @@ -1320,20 +1320,20 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect) start.x = mMenuList[i]->bounds.point.x + mHorizontalMargin; start.y = mMenuList[i]->bounds.point.y + (mMenuList[i]->bounds.extent.y - mProfile->mFont->getHeight()) / 2; - // Draw the border + // Draw the border if (mMenuList[i]->drawBorder) - { + { RectI highlightBounds = bounds; highlightBounds.inset(1,1); if (mMenuList[i] == mouseDownMenu) renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL ); else if (mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL) renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL); - } + } - // Do we draw a bitmap? + // Do we draw a bitmap? if (mMenuList[i]->bitmapIndex != -1) - { + { S32 index = mMenuList[i]->bitmapIndex * 3; if (mMenuList[i] == mouseDownMenu) ++index; @@ -1342,24 +1342,24 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect) RectI rect = mProfile->mBitmapArrayRects[index]; - Point2I bitmapstart(start); + Point2I bitmapstart(start); bitmapstart.y = mMenuList[i]->bounds.point.y + (mMenuList[i]->bounds.extent.y - rect.extent.y) / 2; drawUtil->clearBitmapModulation(); drawUtil->drawBitmapSR( mProfile->mTextureObject, offset + bitmapstart, rect); - // Should we also draw the text? + // Should we also draw the text? if (!mMenuList[i]->drawBitmapOnly) - { + { start.x += mBitmapMargin; drawUtil->setBitmapModulation( fontColor ); drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i]->text, mProfile->mFontColors); - } - } else - { + } + } else + { drawUtil->setBitmapModulation( fontColor ); drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i]->text, mProfile->mFontColors); - } + } } renderChildControls( offset, updateRect ); @@ -1381,7 +1381,7 @@ void GuiMenuBar::buildWindowAcceleratorMap( WindowInputGenerator &inputGenerator continue; } EventDescriptor accelEvent; - ActionMap::createEventDescriptor(item->accelerator, &accelEvent); + ActionMap::createEventDescriptor(item->accelerator, &accelEvent); //now we have a modifier, and a key, add them to the canvas inputGenerator.addAcceleratorKey( this, item->cmd, accelEvent.eventCode, accelEvent.flags); @@ -1412,7 +1412,7 @@ void GuiMenuBar::acceleratorKeyPress(U32 index) { // first, call the script callback for menu selection: onMenuSelect_callback(mMenuList[i]->id, mMenuList[i]->text); - + if(item->visible) menuItemSelected(mMenuList[i], item); return; @@ -1551,15 +1551,15 @@ void GuiMenuTextListCtrl::onMouseUp(const GuiEvent &event) void GuiMenuTextListCtrl::onCellHighlighted(Point2I cell) { - // If this text list control is part of a submenu, then don't worry about - // passing this along - if(!isSubMenu) - { - RectI globalbounds(getBounds()); - Point2I globalpoint = localToGlobalCoord(globalbounds.point); - globalbounds.point = globalpoint; - mMenuBarCtrl->highlightedMenuItem(cell.y, globalbounds, mCellSize); - } + // If this text list control is part of a submenu, then don't worry about + // passing this along + if(!isSubMenu) + { + RectI globalbounds(getBounds()); + Point2I globalpoint = localToGlobalCoord(globalbounds.point); + globalbounds.point = globalpoint; + mMenuBarCtrl->highlightedMenuItem(cell.y, globalbounds, mCellSize); + } } //------------------------------------------------------------------------------ @@ -1582,9 +1582,9 @@ bool GuiSubmenuBackgroundCtrl::pointInControl(const Point2I& parentCoordPoint) S32 yt = parentCoordPoint.y - getTop(); if(findHitControl(Point2I(xt,yt)) == this) - return false; + return false; else - return true; + return true; // return xt >= 0 && yt >= 0 && xt < getWidth() && yt < getHeight(); } @@ -1609,7 +1609,7 @@ void GuiMenuBar::onSleep() void GuiMenuBar::closeMenu() { // First close any open submenu - closeSubmenu(); + closeSubmenu(); // Get the selection from the text list: S32 selectionIndex = mTextList->getSelectedCell().y; @@ -1657,25 +1657,25 @@ void GuiMenuBar::highlightedMenuItem(S32 selectionIndex, const RectI& bounds, Po } if(list) - { + { // If the highlighted item has changed... if(mouseOverSubmenu != list) - { + { closeSubmenu(); mouseOverSubmenu = NULL; // Check if this is a submenu. If so, open the submenu. if(list->isSubmenu) - { - // If there are submenu items, then open the submenu + { + // If there are submenu items, then open the submenu if(list->submenu->firstMenuItem) - { - mouseOverSubmenu = list; - onSubmenuAction(selstore, bounds, cellSize); - } - } - } - } + { + mouseOverSubmenu = list; + onSubmenuAction(selstore, bounds, cellSize); + } + } + } + } } } @@ -1745,11 +1745,11 @@ void GuiMenuBar::onAction() char buf[512]; - // If this menu item is a submenu, then set the isSubmenu to 2 to indicate - // an arrow should be drawn. Otherwise set the isSubmenu normally. - char isSubmenu = 1; - if(walk->isSubmenu) - isSubmenu = 2; + // If this menu item is a submenu, then set the isSubmenu to 2 to indicate + // an arrow should be drawn. Otherwise set the isSubmenu normally. + char isSubmenu = 1; + if(walk->isSubmenu) + isSubmenu = 2; char bitmapIndex = 1; if(walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= mProfile->mBitmapArrayRects.size())) @@ -1861,8 +1861,8 @@ void GuiMenuBar::onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2 char buf[512]; - // Can't have submenus within submenus. - char isSubmenu = 1; + // Can't have submenus within submenus. + char isSubmenu = 1; char bitmapIndex = 1; if(walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= mProfile->mBitmapArrayRects.size())) @@ -1916,7 +1916,7 @@ void GuiMenuBar::onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2 void GuiMenuBar::closeSubmenu() { if(!mSubmenuBackground || !mSubmenuTextList) - return; + return; // Get the selection from the text list: S32 selectionIndex = mSubmenuTextList->getSelectedCell().y; @@ -1934,8 +1934,8 @@ void GuiMenuBar::closeSubmenu() if ( selectionIndex != -1 ) { MenuItem *list = NULL; - if(mouseOverSubmenu) - { + if(mouseOverSubmenu) + { list = mouseOverSubmenu->submenu->firstMenuItem; while(selectionIndex && list) @@ -1943,7 +1943,7 @@ void GuiMenuBar::closeSubmenu() list = list->nextMenuItem; selectionIndex--; } - } + } if(list) menuItemSelected(list->submenuParentMenu, list); } @@ -1981,13 +1981,13 @@ void GuiMenuBar::processTick() { // If we're at a particular number of ticks, notify the script function if(mMouseOverCounter < mMouseHoverAmount) - { + { ++mMouseOverCounter; - } else if(mMouseOverCounter == mMouseHoverAmount) - { + } else if(mMouseOverCounter == mMouseHoverAmount) + { ++mMouseOverCounter; - onMouseInMenu_callback(true); // Last parameter indicates if we've entered or left the menu - } + onMouseInMenu_callback(true); // Last parameter indicates if we've entered or left the menu + } } } diff --git a/Engine/source/lighting/lightManager.cpp b/Engine/source/lighting/lightManager.cpp index 2f8ddd5ee..58f0949c2 100644 --- a/Engine/source/lighting/lightManager.cpp +++ b/Engine/source/lighting/lightManager.cpp @@ -306,7 +306,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData, GFXShaderConstHandle *lightInvRadiusSqSC, GFXShaderConstHandle *lightSpotDirSC, GFXShaderConstHandle *lightSpotAngleSC, - GFXShaderConstHandle *lightSpotFalloffSC, + GFXShaderConstHandle *lightSpotFalloffSC, GFXShaderConstBuffer *shaderConsts ) { PROFILE_SCOPE( LightManager_Update4LightConsts ); @@ -317,7 +317,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData, lightInvRadiusSqSC->isValid() || lightSpotDirSC->isValid() || lightSpotAngleSC->isValid() || - lightSpotFalloffSC->isValid() ) + lightSpotFalloffSC->isValid() ) { PROFILE_SCOPE( LightManager_Update4LightConsts_setLights ); @@ -326,7 +326,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData, static AlignedArray lightColors( 4, sizeof( Point4F ) ); static Point4F lightInvRadiusSq; static Point4F lightSpotAngle; - static Point4F lightSpotFalloff; + static Point4F lightSpotFalloff; F32 range; // Need to clear the buffers so that we don't leak @@ -359,10 +359,10 @@ void LightManager::_update4LightConsts( const SceneData &sgData, lightSpotDirs[2][i] = lightDir.z; if ( light->getType() == LightInfo::Spot ) - { + { lightSpotAngle[i] = mCos( mDegToRad( light->getOuterConeAngle() / 2.0f ) ); - lightSpotFalloff[i] = 1.0f / getMax( F32_MIN, mCos( mDegToRad( light->getInnerConeAngle() / 2.0f ) ) - lightSpotAngle[i] ); - } + lightSpotFalloff[i] = 1.0f / getMax( F32_MIN, mCos( mDegToRad( light->getInnerConeAngle() / 2.0f ) ) - lightSpotAngle[i] ); + } // Prescale the light color by the brightness to // avoid doing this in the shader. @@ -379,7 +379,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData, shaderConsts->setSafe( lightSpotDirSC, lightSpotDirs ); shaderConsts->setSafe( lightSpotAngleSC, lightSpotAngle ); - shaderConsts->setSafe( lightSpotFalloffSC, lightSpotFalloff ); + shaderConsts->setSafe( lightSpotFalloffSC, lightSpotFalloff ); } diff --git a/Engine/source/platform/platformNet.h b/Engine/source/platform/platformNet.h index 4e8de1d70..c07c2d9f6 100644 --- a/Engine/source/platform/platformNet.h +++ b/Engine/source/platform/platformNet.h @@ -78,8 +78,8 @@ struct NetAddress bool isSameAddress(const NetAddress &other) const { - if (type != other.type) - return false; + if (type != other.type) + return false; switch (type) { @@ -102,32 +102,32 @@ struct NetAddress bool isSameAddressAndPort(const NetAddress &other) const { - if (type != other.type) - return false; + if (type != other.type) + return false; - switch (type) - { - case NetAddress::IPAddress: - return (dMemcmp(other.address.ipv4.netNum, address.ipv4.netNum, 4) == 0) && other.port == port; - break; - case NetAddress::IPV6Address: - return (dMemcmp(other.address.ipv6.netNum, address.ipv6.netNum, 16) == 0) && other.port == port; - break; - case NetAddress::IPBroadcastAddress: - return true; - break; - case NetAddress::IPV6MulticastAddress: - return true; - break; - } + switch (type) + { + case NetAddress::IPAddress: + return (dMemcmp(other.address.ipv4.netNum, address.ipv4.netNum, 4) == 0) && other.port == port; + break; + case NetAddress::IPV6Address: + return (dMemcmp(other.address.ipv6.netNum, address.ipv6.netNum, 16) == 0) && other.port == port; + break; + case NetAddress::IPBroadcastAddress: + return true; + break; + case NetAddress::IPV6MulticastAddress: + return true; + break; + } - return false; + return false; } bool isEqual(const NetAddress &other) const { - if (type != other.type) - return false; + if (type != other.type) + return false; switch (type) { @@ -193,7 +193,7 @@ struct Net WouldBlock, NotASocket, UnknownError, - NeedHostLookup + NeedHostLookup }; enum ConnectionState { @@ -214,11 +214,11 @@ struct Net static bool smMulticastEnabled; static bool smIpv4Enabled; static bool smIpv6Enabled; - - static ConnectionNotifyEvent* smConnectionNotify; - static ConnectionAcceptedEvent* smConnectionAccept; - static ConnectionReceiveEvent* smConnectionReceive; - static PacketReceiveEvent* smPacketReceive; + + static ConnectionNotifyEvent* smConnectionNotify; + static ConnectionAcceptedEvent* smConnectionAccept; + static ConnectionReceiveEvent* smConnectionReceive; + static PacketReceiveEvent* smPacketReceive; static bool init(); diff --git a/Engine/source/platform/profiler.cpp b/Engine/source/platform/profiler.cpp index 7460ad315..c8f68915b 100644 --- a/Engine/source/platform/profiler.cpp +++ b/Engine/source/platform/profiler.cpp @@ -135,26 +135,26 @@ U32 endHighResolutionTimer(U32 time[2]) void startHighResolutionTimer(U32 time[2]) { - U64 now = mach_absolute_time(); - AssertFatal(sizeof(U32[2]) == sizeof(U64), "Can't pack mach_absolute_time into U32[2]"); - memcpy(time, &now, sizeof(U64)); + U64 now = mach_absolute_time(); + AssertFatal(sizeof(U32[2]) == sizeof(U64), "Can't pack mach_absolute_time into U32[2]"); + memcpy(time, &now, sizeof(U64)); } U32 endHighResolutionTimer(U32 time[2]) { - static mach_timebase_info_data_t sTimebaseInfo = {0, 0}; - - U64 now = mach_absolute_time(); - AssertFatal(sizeof(U32[2]) == sizeof(U64), "Can't pack mach_absolute_time into U32[2]"); - U64 then; - memcpy(&then, time, sizeof(U64)); - - if(sTimebaseInfo.denom == 0){ - mach_timebase_info(&sTimebaseInfo); - } - // Handle the micros/nanos conversion first, because shedding a few bits is better than overflowing. - U64 elapsedMicros = ((now - then) / 1000) * sTimebaseInfo.numer / sTimebaseInfo.denom; - - return (U32)elapsedMicros; // Just truncate, and hope we didn't overflow + static mach_timebase_info_data_t sTimebaseInfo = {0, 0}; + + U64 now = mach_absolute_time(); + AssertFatal(sizeof(U32[2]) == sizeof(U64), "Can't pack mach_absolute_time into U32[2]"); + U64 then; + memcpy(&then, time, sizeof(U64)); + + if(sTimebaseInfo.denom == 0){ + mach_timebase_info(&sTimebaseInfo); + } + // Handle the micros/nanos conversion first, because shedding a few bits is better than overflowing. + U64 elapsedMicros = ((now - then) / 1000) * sTimebaseInfo.numer / sTimebaseInfo.denom; + + return (U32)elapsedMicros; // Just truncate, and hope we didn't overflow } #else @@ -730,37 +730,37 @@ DefineEngineFunction( profilerMarkerEnable, void, ( const char* markerName, bool //----------------------------------------------------------------------------- DefineEngineFunction( profilerEnable, void, ( bool enable ),, - "@brief Enables or disables the profiler.\n\n" - "Data is only gathered while the profiler is enabled.\n\n" - "@note Profiler is not available in shipping builds.\n" - "T3D has predefined profiling areas surrounded by markers, " - "but you may need to define additional markers (in C++) around areas you wish to profile," - " by using the PROFILE_START( markerName ); and PROFILE_END(); macros.\n\n" - "@ingroup Debugging\n" ) + "@brief Enables or disables the profiler.\n\n" + "Data is only gathered while the profiler is enabled.\n\n" + "@note Profiler is not available in shipping builds.\n" + "T3D has predefined profiling areas surrounded by markers, " + "but you may need to define additional markers (in C++) around areas you wish to profile," + " by using the PROFILE_START( markerName ); and PROFILE_END(); macros.\n\n" + "@ingroup Debugging\n" ) { if(gProfiler) gProfiler->enable(enable); } DefineEngineFunction(profilerDump, void, (),, - "@brief Dumps current profiling stats to the console window.\n\n" - "@note Markers disabled with profilerMarkerEnable() will be skipped over. " - "If the profiler is currently running, it will be disabled.\n" - "@ingroup Debugging") + "@brief Dumps current profiling stats to the console window.\n\n" + "@note Markers disabled with profilerMarkerEnable() will be skipped over. " + "If the profiler is currently running, it will be disabled.\n" + "@ingroup Debugging") { if(gProfiler) gProfiler->dumpToConsole(); } DefineEngineFunction( profilerDumpToFile, void, ( const char* fileName ),, - "@brief Dumps current profiling stats to a file.\n\n" - "@note If the profiler is currently running, it will be disabled.\n" - "@param fileName Name and path of file to save profiling stats to. Must use forward slashes (/). " - "Will attempt to create the file if it does not already exist.\n" - "@tsexample\n" - "profilerDumpToFile( \"C:/Torque/log1.txt\" );\n" - "@endtsexample\n\n" - "@ingroup Debugging" ) + "@brief Dumps current profiling stats to a file.\n\n" + "@note If the profiler is currently running, it will be disabled.\n" + "@param fileName Name and path of file to save profiling stats to. Must use forward slashes (/). " + "Will attempt to create the file if it does not already exist.\n" + "@tsexample\n" + "profilerDumpToFile( \"C:/Torque/log1.txt\" );\n" + "@endtsexample\n\n" + "@ingroup Debugging" ) { if(gProfiler) gProfiler->dumpToFile(fileName); @@ -768,9 +768,9 @@ DefineEngineFunction( profilerDumpToFile, void, ( const char* fileName ),, DefineEngineFunction( profilerReset, void, (),, "@brief Resets the profiler, clearing it of all its data.\n\n" - "If the profiler is currently running, it will first be disabled. " - "All markers will retain their current enabled/disabled status.\n\n" - "@ingroup Debugging" ) + "If the profiler is currently running, it will first be disabled. " + "All markers will retain their current enabled/disabled status.\n\n" + "@ingroup Debugging" ) { if(gProfiler) gProfiler->reset(); diff --git a/Engine/source/platformMac/macFileIO.mm b/Engine/source/platformMac/macFileIO.mm index 2815b5af4..b6fae59d1 100644 --- a/Engine/source/platformMac/macFileIO.mm +++ b/Engine/source/platformMac/macFileIO.mm @@ -68,54 +68,54 @@ bool dFileTouch(const char *path) //----------------------------------------------------------------------------- bool dPathCopy(const char* source, const char* dest, bool nooverwrite) { - if(source == NULL || dest == NULL) - return false; - - @autoreleasepool { - NSFileManager *manager = [NSFileManager defaultManager]; - - NSString *nsource = [manager stringWithFileSystemRepresentation:source length:dStrlen(source)]; - NSString *ndest = [manager stringWithFileSystemRepresentation:dest length:dStrlen(dest)]; - NSString *ndestFolder = [ndest stringByDeletingLastPathComponent]; - - if(! [manager fileExistsAtPath:nsource]) - { - Con::errorf("dPathCopy: no file exists at %s",source); - return false; - } - - if( [manager fileExistsAtPath:ndest] ) - { - if(nooverwrite) - { - Con::errorf("dPathCopy: file already exists at %s",dest); - return false; - } - Con::warnf("Deleting files at path: %s", dest); - if(![manager removeItemAtPath:ndest error:nil] || [manager fileExistsAtPath:ndest]) - { - Con::errorf("Copy failed! Could not delete files at path: %s", dest); - return false; - } - } - - if([manager fileExistsAtPath:ndestFolder] == NO) - { - ndestFolder = [ndestFolder stringByAppendingString:@"/"]; // createpath requires a trailing slash - Platform::createPath([ndestFolder UTF8String]); - } - - bool ret = [manager copyItemAtPath:nsource toPath:ndest error:nil]; - // n.b.: The "success" semantics don't guarantee a copy actually took place, so we'll verify - // because this is surprising behavior for a method called copy. - if( ![manager fileExistsAtPath:ndest] ) - { - Con::warnf("The filemanager returned success, but the file was not copied. Something strange is happening"); - ret = false; - } - return ret; - } - + if(source == NULL || dest == NULL) + return false; + + @autoreleasepool { + NSFileManager *manager = [NSFileManager defaultManager]; + + NSString *nsource = [manager stringWithFileSystemRepresentation:source length:dStrlen(source)]; + NSString *ndest = [manager stringWithFileSystemRepresentation:dest length:dStrlen(dest)]; + NSString *ndestFolder = [ndest stringByDeletingLastPathComponent]; + + if(! [manager fileExistsAtPath:nsource]) + { + Con::errorf("dPathCopy: no file exists at %s",source); + return false; + } + + if( [manager fileExistsAtPath:ndest] ) + { + if(nooverwrite) + { + Con::errorf("dPathCopy: file already exists at %s",dest); + return false; + } + Con::warnf("Deleting files at path: %s", dest); + if(![manager removeItemAtPath:ndest error:nil] || [manager fileExistsAtPath:ndest]) + { + Con::errorf("Copy failed! Could not delete files at path: %s", dest); + return false; + } + } + + if([manager fileExistsAtPath:ndestFolder] == NO) + { + ndestFolder = [ndestFolder stringByAppendingString:@"/"]; // createpath requires a trailing slash + Platform::createPath([ndestFolder UTF8String]); + } + + bool ret = [manager copyItemAtPath:nsource toPath:ndest error:nil]; + // n.b.: The "success" semantics don't guarantee a copy actually took place, so we'll verify + // because this is surprising behavior for a method called copy. + if( ![manager fileExistsAtPath:ndest] ) + { + Con::warnf("The filemanager returned success, but the file was not copied. Something strange is happening"); + ret = false; + } + return ret; + } + } //----------------------------------------------------------------------------- @@ -124,36 +124,36 @@ bool dFileRename(const char *source, const char *dest) { if(source == NULL || dest == NULL) return false; - - @autoreleasepool { - NSFileManager *manager = [NSFileManager defaultManager]; - - NSString *nsource = [manager stringWithFileSystemRepresentation:source length:dStrlen(source)]; - NSString *ndest = [manager stringWithFileSystemRepresentation:dest length:dStrlen(dest)]; - - if(! [manager fileExistsAtPath:nsource]) - { - Con::errorf("dFileRename: no file exists at %s",source); - return false; - } - - if( [manager fileExistsAtPath:ndest] ) - { - Con::warnf("dFileRename: Deleting files at path: %s", dest); - } - - bool ret = [manager moveItemAtPath:nsource toPath:ndest error:nil]; - // n.b.: The "success" semantics don't guarantee a move actually took place, so we'll verify - // because this is surprising behavior for a method called rename. - - if( ![manager fileExistsAtPath:ndest] ) - { - Con::warnf("The filemanager returned success, but the file was not moved. Something strange is happening"); - ret = false; - } - - return ret; - } + + @autoreleasepool { + NSFileManager *manager = [NSFileManager defaultManager]; + + NSString *nsource = [manager stringWithFileSystemRepresentation:source length:dStrlen(source)]; + NSString *ndest = [manager stringWithFileSystemRepresentation:dest length:dStrlen(dest)]; + + if(! [manager fileExistsAtPath:nsource]) + { + Con::errorf("dFileRename: no file exists at %s",source); + return false; + } + + if( [manager fileExistsAtPath:ndest] ) + { + Con::warnf("dFileRename: Deleting files at path: %s", dest); + } + + bool ret = [manager moveItemAtPath:nsource toPath:ndest error:nil]; + // n.b.: The "success" semantics don't guarantee a move actually took place, so we'll verify + // because this is surprising behavior for a method called rename. + + if( ![manager fileExistsAtPath:ndest] ) + { + Con::warnf("The filemanager returned success, but the file was not moved. Something strange is happening"); + ret = false; + } + + return ret; + } } //----------------------------------------------------------------------------- @@ -857,7 +857,7 @@ static bool recurseDumpDirectories(const char *basePath, const char *subPath, Ve while (d = readdir(dip)) { - bool isDir; + bool isDir; isDir = false; if (d->d_type == DT_UNKNOWN) { diff --git a/Engine/source/scene/sceneContainer.cpp b/Engine/source/scene/sceneContainer.cpp index fbcd485aa..7ccb8b0b6 100644 --- a/Engine/source/scene/sceneContainer.cpp +++ b/Engine/source/scene/sceneContainer.cpp @@ -892,7 +892,7 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en *info = ri; info->point.interpolate(start, end, info->t); currentT = ri.t; - info->distance = (start - info->point).len(); + info->distance = (start - info->point).len(); } } } @@ -991,7 +991,7 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en *info = ri; info->point.interpolate(start, end, info->t); currentT = ri.t; - info->distance = (start - info->point).len(); + info->distance = (start - info->point).len(); } } } @@ -1088,7 +1088,7 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en *info = ri; info->point.interpolate(start, end, info->t); currentT = ri.t; - info->distance = (start - info->point).len(); + info->distance = (start - info->point).len(); } } } diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index a1b5c6ac2..88bcde89e 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -36,138 +36,138 @@ IMPLEMENT_CONOBJECT(ActionMap); ConsoleDocClass( ActionMap, - "@brief ActionMaps assign platform input events to console commands.\n\n" + "@brief ActionMaps assign platform input events to console commands.\n\n" - "Any platform input event can be bound in a single, generic way. In theory, the game doesn't need to know if the event came from the keyboard, mouse, joystick " - "or some other input device. This allows users of the game to map keys and actions according to their own preferences. " - "Game action maps are arranged in a stack for processing so individual parts of the game can define specific " - "actions. For example, when the player jumps into a vehicle it could push a vehicle action map and pop the default player action map.\n\n" + "Any platform input event can be bound in a single, generic way. In theory, the game doesn't need to know if the event came from the keyboard, mouse, joystick " + "or some other input device. This allows users of the game to map keys and actions according to their own preferences. " + "Game action maps are arranged in a stack for processing so individual parts of the game can define specific " + "actions. For example, when the player jumps into a vehicle it could push a vehicle action map and pop the default player action map.\n\n" - "@section ActionMap_creation Creating an ActionMap\n" + "@section ActionMap_creation Creating an ActionMap\n" - "The input system allows for the creation of multiple ActionMaps, so long as they have unique names and do not already exist. It's a simple " - "three step process.\n\n" - "1. Check to see if the ActionMap exists\n" - "2. Delete it if it exists\n" - "3. Instantiate the ActionMap\n\n" + "The input system allows for the creation of multiple ActionMaps, so long as they have unique names and do not already exist. It's a simple " + "three step process.\n\n" + "1. Check to see if the ActionMap exists\n" + "2. Delete it if it exists\n" + "3. Instantiate the ActionMap\n\n" - "The following is an example of how to create a new ActionMap:\n" + "The following is an example of how to create a new ActionMap:\n" - "@tsexample\n" - "if ( isObject( moveMap ) )\n" - " moveMap.delete();\n" - "new ActionMap(moveMap);" - "@endtsexample\n\n\n" - - "@section ActionMap_binding Binding Functions\n" - "Once you have created an ActionMap, you can start binding functionality to events. Currently, Torque 3D supports the following devices out of the box\n\n" - "* Mouse\n\n" - "* Keyboard\n\n" - "* Joystick/Gamepad\n\n" - "* Xbox 360 Controller\n\n" + "@tsexample\n" + "if ( isObject( moveMap ) )\n" + " moveMap.delete();\n" + "new ActionMap(moveMap);" + "@endtsexample\n\n\n" + + "@section ActionMap_binding Binding Functions\n" + "Once you have created an ActionMap, you can start binding functionality to events. Currently, Torque 3D supports the following devices out of the box\n\n" + "* Mouse\n\n" + "* Keyboard\n\n" + "* Joystick/Gamepad\n\n" + "* Xbox 360 Controller\n\n" - "The two most commonly used binding methods are bind() and bindCmd(). Both are similar in that they will bind functionality to a device and event, " + "The two most commonly used binding methods are bind() and bindCmd(). Both are similar in that they will bind functionality to a device and event, " "but different in how the event is interpreted. With bind(), " - "you specify a device, action to bind, then a function to be called when the event happens.\n\n" + "you specify a device, action to bind, then a function to be called when the event happens.\n\n" - "@tsexample\n" - "// Simple function that prints to console\n" - "// %val - Sent by the device letting the user know\n" - "// if an input was pressed (true) or released (false)\n" - "function testInput(%val)\n" - "{\n" - " if(%val)\n" - " echo(\"Key is down\");\n" - " else\n" - " echo(\"Key was released\");\n" - "}\n\n" - "// Bind the \'K\' key to the testInput function\n" - "moveMap.bind(keyboard, \"k\", testInput);\n\n" - "@endtsexample\n\n\n" + "@tsexample\n" + "// Simple function that prints to console\n" + "// %val - Sent by the device letting the user know\n" + "// if an input was pressed (true) or released (false)\n" + "function testInput(%val)\n" + "{\n" + " if(%val)\n" + " echo(\"Key is down\");\n" + " else\n" + " echo(\"Key was released\");\n" + "}\n\n" + "// Bind the \'K\' key to the testInput function\n" + "moveMap.bind(keyboard, \"k\", testInput);\n\n" + "@endtsexample\n\n\n" - "bindCmd is an alternative method for binding commands. This function is similar to bind(), " + "bindCmd is an alternative method for binding commands. This function is similar to bind(), " "except two functions are set to be called when the event is processed.\n\n" - "One will be called when the event is activated (input down), while the other is activated when the event is broken (input release). " + "One will be called when the event is activated (input down), while the other is activated when the event is broken (input release). " "When using bindCmd(), pass the functions as strings rather than the function names.\n\n" - "@tsexample\n" - "// Print to the console when the spacebar is pressed\n" - "function onSpaceDown()\n" - "{\n" - " echo(\"Space bar down!\");\n" - "}\n\n" + "@tsexample\n" + "// Print to the console when the spacebar is pressed\n" + "function onSpaceDown()\n" + "{\n" + " echo(\"Space bar down!\");\n" + "}\n\n" - "// Print to the console when the spacebar is released\n" - "function onSpaceUp()\n" - "{\n" - " echo(\"Space bar up!\");\n" - "}\n\n" + "// Print to the console when the spacebar is released\n" + "function onSpaceUp()\n" + "{\n" + " echo(\"Space bar up!\");\n" + "}\n\n" - "// Bind the commands onSpaceDown and onSpaceUp to spacebar events\n" - "moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n" - "@endtsexample\n\n" - - "@section ActionMap_switching Switching ActionMaps\n" - "Let's say you want to have different ActionMaps activated based on game play situations. A classic example would be first person shooter controls and racing controls " - "in the same game. On foot, spacebar may cause your player to jump. In a vehicle, it may cause some kind of \"turbo charge\". You simply need to push/pop the ActionMaps appropriately:\n\n" + "// Bind the commands onSpaceDown and onSpaceUp to spacebar events\n" + "moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n" + "@endtsexample\n\n" + + "@section ActionMap_switching Switching ActionMaps\n" + "Let's say you want to have different ActionMaps activated based on game play situations. A classic example would be first person shooter controls and racing controls " + "in the same game. On foot, spacebar may cause your player to jump. In a vehicle, it may cause some kind of \"turbo charge\". You simply need to push/pop the ActionMaps appropriately:\n\n" - "First, create two separate ActionMaps:\n\n" - "@tsexample\n" - "// Create the two ActionMaps\n" - "if ( isObject( moveMap ) )\n" - " moveMap.delete();\n" - "new ActionMap(moveMap);\n\n" - "if ( isObject( carMap ) )\n" - " carMap.delete();\n" - "new ActionMap(carMap);\n\n" - "@endtsexample\n\n" + "First, create two separate ActionMaps:\n\n" + "@tsexample\n" + "// Create the two ActionMaps\n" + "if ( isObject( moveMap ) )\n" + " moveMap.delete();\n" + "new ActionMap(moveMap);\n\n" + "if ( isObject( carMap ) )\n" + " carMap.delete();\n" + "new ActionMap(carMap);\n\n" + "@endtsexample\n\n" - "Next, create the two separate functions. Both will be bound to spacebar, but not the same ActionMap:\n\n" - "@tsexample\n" - "// Print to the console the player is jumping\n" - "function playerJump(%val)\n" - "{\n" - " if(%val)\n" - " echo(\"Player jumping!\");\n" - "}\n\n" - "// Print to the console the vehicle is charging\n" - "function turboCharge()\n" - "{\n" - " if(%val)\n" - " echo(\"Vehicle turbo charging!\");\n" - "}\n" - "@endtsexample\n\n" - - "You are now ready to bind functions to your ActionMaps' devices:\n\n" + "Next, create the two separate functions. Both will be bound to spacebar, but not the same ActionMap:\n\n" + "@tsexample\n" + "// Print to the console the player is jumping\n" + "function playerJump(%val)\n" + "{\n" + " if(%val)\n" + " echo(\"Player jumping!\");\n" + "}\n\n" + "// Print to the console the vehicle is charging\n" + "function turboCharge()\n" + "{\n" + " if(%val)\n" + " echo(\"Vehicle turbo charging!\");\n" + "}\n" + "@endtsexample\n\n" + + "You are now ready to bind functions to your ActionMaps' devices:\n\n" - "@tsexample\n" - "// Bind the spacebar to the playerJump function\n" - "// when moveMap is the active ActionMap\n" - "moveMap.bind(keyboard, \"space\", playerJump);\n\n" - "// Bind the spacebar to the turboCharge function\n" - "// when carMap is the active ActionMap\n" - "carMap.bind(keyboard, \"space\", turboCharge);\n" - "@endtsexample\n" + "@tsexample\n" + "// Bind the spacebar to the playerJump function\n" + "// when moveMap is the active ActionMap\n" + "moveMap.bind(keyboard, \"space\", playerJump);\n\n" + "// Bind the spacebar to the turboCharge function\n" + "// when carMap is the active ActionMap\n" + "carMap.bind(keyboard, \"space\", turboCharge);\n" + "@endtsexample\n" - "Finally, you can use the push() and pop() commands on each ActionMap to toggle activation. To activate an ActionMap, use push():\n\n" + "Finally, you can use the push() and pop() commands on each ActionMap to toggle activation. To activate an ActionMap, use push():\n\n" - "@tsexample\n" - "// Make moveMap the active action map\n" - "// You should now be able to activate playerJump with spacebar\n" - "moveMap.push();\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Make moveMap the active action map\n" + "// You should now be able to activate playerJump with spacebar\n" + "moveMap.push();\n" + "@endtsexample\n\n" - "To switch ActionMaps, first pop() the old one. Then you can push() the new one:\n\n" + "To switch ActionMaps, first pop() the old one. Then you can push() the new one:\n\n" - "@tsexample\n" - "// Deactivate moveMap\n" - "moveMap.pop();\n\n" - "// Activate carMap\n" - "carMap.push();\n\n" - "@endtsexample\n\n\n" + "@tsexample\n" + "// Deactivate moveMap\n" + "moveMap.pop();\n\n" + "// Activate carMap\n" + "carMap.push();\n\n" + "@endtsexample\n\n\n" - "@ingroup Input" - + "@ingroup Input" + ); // This is used for determing keys that have ascii codes for the foreign keyboards. IsAlpha doesn't work on foreign keys. @@ -775,32 +775,32 @@ const char* ActionMap::getBinding( const char* command ) // const char* ActionMap::getCommand( const char* device, const char* action ) { - U32 deviceType; - U32 deviceInst; - if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) - { - EventDescriptor eventDescriptor; - if ( createEventDescriptor( action, &eventDescriptor ) ) - { - const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); - if ( mapNode ) - { - if ( mapNode->flags & Node::BindCmd ) - { - S32 bufferLen = dStrlen( mapNode->makeConsoleCommand ) + dStrlen( mapNode->breakConsoleCommand ) + 2; - char* returnString = Con::getReturnBuffer( bufferLen ); - dSprintf( returnString, bufferLen, "%s\t%s", - ( mapNode->makeConsoleCommand ? mapNode->makeConsoleCommand : "" ), - ( mapNode->breakConsoleCommand ? mapNode->breakConsoleCommand : "" ) ); - return( returnString ); - } - else - return( mapNode->consoleFunction ); - } - } - } + U32 deviceType; + U32 deviceInst; + if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) + { + EventDescriptor eventDescriptor; + if ( createEventDescriptor( action, &eventDescriptor ) ) + { + const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); + if ( mapNode ) + { + if ( mapNode->flags & Node::BindCmd ) + { + S32 bufferLen = dStrlen( mapNode->makeConsoleCommand ) + dStrlen( mapNode->breakConsoleCommand ) + 2; + char* returnString = Con::getReturnBuffer( bufferLen ); + dSprintf( returnString, bufferLen, "%s\t%s", + ( mapNode->makeConsoleCommand ? mapNode->makeConsoleCommand : "" ), + ( mapNode->breakConsoleCommand ? mapNode->breakConsoleCommand : "" ) ); + return( returnString ); + } + else + return( mapNode->consoleFunction ); + } + } + } - return( "" ); + return( "" ); } //------------------------------------------------------------------------------ @@ -808,92 +808,92 @@ const char* ActionMap::getCommand( const char* device, const char* action ) // Obviously, this should only be used for axes. bool ActionMap::isInverted( const char* device, const char* action ) { - U32 deviceType; - U32 deviceInst; - if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) - { - EventDescriptor eventDescriptor; - if ( createEventDescriptor( action, &eventDescriptor ) ) - { - const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); - if ( mapNode ) - return( mapNode->flags & Node::Inverted ); - } - } + U32 deviceType; + U32 deviceInst; + if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) + { + EventDescriptor eventDescriptor; + if ( createEventDescriptor( action, &eventDescriptor ) ) + { + const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); + if ( mapNode ) + return( mapNode->flags & Node::Inverted ); + } + } - Con::errorf( "The input event specified by %s %s is not in this action map!", device, action ); - return( false ); + Con::errorf( "The input event specified by %s %s is not in this action map!", device, action ); + return( false ); } //------------------------------------------------------------------------------ F32 ActionMap::getScale( const char* device, const char* action ) { - U32 deviceType; - U32 deviceInst; - if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) - { - EventDescriptor eventDescriptor; - if ( createEventDescriptor( action, &eventDescriptor ) ) - { - const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); - if ( mapNode ) - { - if ( mapNode->flags & Node::HasScale ) - return( mapNode->scaleFactor ); + U32 deviceType; + U32 deviceInst; + if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) + { + EventDescriptor eventDescriptor; + if ( createEventDescriptor( action, &eventDescriptor ) ) + { + const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); + if ( mapNode ) + { + if ( mapNode->flags & Node::HasScale ) + return( mapNode->scaleFactor ); else return( 1.0f ); } - } - } + } + } - Con::errorf( "The input event specified by %s %s is not in this action map!", device, action ); - return( 1.0f ); + Con::errorf( "The input event specified by %s %s is not in this action map!", device, action ); + return( 1.0f ); } //------------------------------------------------------------------------------ const char* ActionMap::getDeadZone( const char* device, const char* action ) { - U32 deviceType; - U32 deviceInst; - if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) - { - EventDescriptor eventDescriptor; - if ( createEventDescriptor( action, &eventDescriptor ) ) - { - const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); - if ( mapNode ) - { - if ( mapNode->flags & Node::HasDeadZone ) + U32 deviceType; + U32 deviceInst; + if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) + { + EventDescriptor eventDescriptor; + if ( createEventDescriptor( action, &eventDescriptor ) ) + { + const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); + if ( mapNode ) + { + if ( mapNode->flags & Node::HasDeadZone ) { - char buf[64]; - dSprintf( buf, sizeof( buf ), "%g %g", mapNode->deadZoneBegin, mapNode->deadZoneEnd ); - char* returnString = Con::getReturnBuffer( dStrlen( buf ) + 1 ); - dStrcpy( returnString, buf ); - return( returnString ); - } - else - return( "0 0" ); - } - } - } + char buf[64]; + dSprintf( buf, sizeof( buf ), "%g %g", mapNode->deadZoneBegin, mapNode->deadZoneEnd ); + char* returnString = Con::getReturnBuffer( dStrlen( buf ) + 1 ); + dStrcpy( returnString, buf ); + return( returnString ); + } + else + return( "0 0" ); + } + } + } - Con::errorf( "The input event specified by %s %s is not in this action map!", device, action ); - return( "" ); + Con::errorf( "The input event specified by %s %s is not in this action map!", device, action ); + return( "" ); } //------------------------------------------------------------------------------ const char* ActionMap::buildActionString( const InputEventInfo* event ) { - const char* modifierString = getModifierString( event->modifier ); + const char* modifierString = getModifierString( event->modifier ); - char objectBuffer[64]; - if ( !getKeyString( event->objInst, objectBuffer ) ) - return( "" ); + char objectBuffer[64]; + if ( !getKeyString( event->objInst, objectBuffer ) ) + return( "" ); - U32 returnLen = dStrlen( modifierString ) + dStrlen( objectBuffer ) + 2; - char* returnString = Con::getReturnBuffer( returnLen ); - dSprintf( returnString, returnLen - 1, "%s%s", modifierString, objectBuffer ); - return( returnString ); + U32 returnLen = dStrlen( modifierString ) + dStrlen( objectBuffer ) + 2; + char* returnString = Con::getReturnBuffer( returnLen ); + dSprintf( returnString, returnLen - 1, "%s%s", modifierString, objectBuffer ); + return( returnString ); } //------------------------------------------------------------------------------ @@ -989,15 +989,15 @@ bool ActionMap::getDeviceName(const U32 deviceType, const U32 deviceInstance, ch //------------------------------------------------------------------------------ const char* ActionMap::getModifierString(const U32 modifiers) { - U32 realModifiers = modifiers; - if ( modifiers & SI_LSHIFT || modifiers & SI_RSHIFT ) - realModifiers |= SI_SHIFT; - if ( modifiers & SI_LCTRL || modifiers & SI_RCTRL ) - realModifiers |= SI_CTRL; - if ( modifiers & SI_LALT || modifiers & SI_RALT ) - realModifiers |= SI_ALT; - if ( modifiers & SI_MAC_LOPT || modifiers & SI_MAC_ROPT ) - realModifiers |= SI_MAC_OPT; + U32 realModifiers = modifiers; + if ( modifiers & SI_LSHIFT || modifiers & SI_RSHIFT ) + realModifiers |= SI_SHIFT; + if ( modifiers & SI_LCTRL || modifiers & SI_RCTRL ) + realModifiers |= SI_CTRL; + if ( modifiers & SI_LALT || modifiers & SI_RALT ) + realModifiers |= SI_ALT; + if ( modifiers & SI_MAC_LOPT || modifiers & SI_MAC_ROPT ) + realModifiers |= SI_MAC_OPT; switch (realModifiers & (SI_SHIFT|SI_CTRL|SI_ALT|SI_MAC_OPT)) { @@ -1820,19 +1820,19 @@ static ConsoleDocFragment _ActionMapbind1( "@param command The function to bind to the action. Function must have a single boolean argument.\n" "@return True if the binding was successful, false if the device was unknown or description failed.\n\n" "@tsexample\n" - "// Simple function that prints to console\n" - "// %val - Sent by the device letting the user know\n" - "// if an input was pressed (true) or released (false)\n" - "function testInput(%val)\n" - "{\n" - " if(%val)\n" - " echo(\"Key is down\");\n" - " else\n" - " echo(\"Key was released\");\n" - "}\n\n" - "// Bind the \'K\' key to the testInput function\n" - "moveMap.bind(keyboard, k, testInput);\n\n" - "@endtsexample\n\n\n", + "// Simple function that prints to console\n" + "// %val - Sent by the device letting the user know\n" + "// if an input was pressed (true) or released (false)\n" + "function testInput(%val)\n" + "{\n" + " if(%val)\n" + " echo(\"Key is down\");\n" + " else\n" + " echo(\"Key was released\");\n" + "}\n\n" + "// Bind the \'K\' key to the testInput function\n" + "moveMap.bind(keyboard, k, testInput);\n\n" + "@endtsexample\n\n\n", "ActionMap", "bool bind( string device, string action, string command );"); @@ -1854,22 +1854,22 @@ static ConsoleDocFragment _ActionMapbind2( "@param command The function bound to the action. Must take in a single argument.\n" "@return True if the binding was successful, false if the device was unknown or description failed.\n\n" "@tsexample\n" - "// Simple function that adjusts the pitch of the camera based on the " + "// Simple function that adjusts the pitch of the camera based on the " "mouse's movement along the X axis.\n" - "function testPitch(%val)\n" - "{\n" - " %pitchAdj = getMouseAdjustAmount(%val);\n" - " $mvPitch += %pitchAdj;\n" - "}\n\n" - "// Bind the mouse's X axis to the testPitch function\n" - "// DI is flagged, meaning input is inverted and has a deadzone\n" - "%this.bind( mouse, \"xaxis\", \"DI\", \"-0.23 0.23\", testPitch );\n" - "@endtsexample\n\n\n", + "function testPitch(%val)\n" + "{\n" + " %pitchAdj = getMouseAdjustAmount(%val);\n" + " $mvPitch += %pitchAdj;\n" + "}\n\n" + "// Bind the mouse's X axis to the testPitch function\n" + "// DI is flagged, meaning input is inverted and has a deadzone\n" + "%this.bind( mouse, \"xaxis\", \"DI\", \"-0.23 0.23\", testPitch );\n" + "@endtsexample\n\n\n", "ActionMap", "bool bind( string device, string action, string flag, string deadZone, string scale, string command );"); ConsoleMethod( ActionMap, bind, bool, 5, 10, "actionMap.bind( device, action, [modifier spec, mod...], command )" - "@hide") + "@hide") { StringStackWrapper args(argc - 2, argv + 2); return object->processBind( args.count(), args, NULL ); @@ -1918,7 +1918,7 @@ static ConsoleDocFragment _ActionMapbindObj2( "bool bindObj( string device, string action, string flag, string deadZone, string scale, string command, SimObjectID object );"); ConsoleMethod( ActionMap, bindObj, bool, 6, 11, "(device, action, [modifier spec, mod...], command, object)" - "@hide") + "@hide") { SimObject* simObject = Sim::findObject(argv[argc - 1]); if ( simObject == NULL ) @@ -1941,20 +1941,20 @@ DefineEngineMethod( ActionMap, bindCmd, bool, ( const char* device, const char* "@param makeCmd The command to execute when the device/action is made.\n" "@param breakCmd [optional] The command to execute when the device or action is unmade.\n" "@return True the bind was successful, false if the device was unknown or description failed.\n" - "@tsexample\n" - "// Print to the console when the spacebar is pressed\n" - "function onSpaceDown()\n" - "{\n" - " echo(\"Space bar down!\");\n" - "}\n\n" - "// Print to the console when the spacebar is released\n" - "function onSpaceUp()\n" - "{\n" - " echo(\"Space bar up!\");\n" - "}\n\n" + "@tsexample\n" + "// Print to the console when the spacebar is pressed\n" + "function onSpaceDown()\n" + "{\n" + " echo(\"Space bar down!\");\n" + "}\n\n" + "// Print to the console when the spacebar is released\n" + "function onSpaceUp()\n" + "{\n" + " echo(\"Space bar up!\");\n" + "}\n\n" "// Bind the commands onSpaceDown() and onSpaceUp() to spacebar events\n\n" - "moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n" - "@endtsexample\n\n") + "moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n" + "@endtsexample\n\n") { return object->processBindCmd( device, action, makeCmd, breakCmd ); } @@ -1964,9 +1964,9 @@ DefineEngineMethod( ActionMap, unbind, bool, ( const char* device, const char* a "@param device The device to unbind from. Can be a keyboard, mouse, joystick or a gamepad.\n" "@param action The device action to unbind from. The action is dependant upon the device. Specify a key for keyboards.\n" "@return True if the unbind was successful, false if the device was unknown or description failed.\n\n" - "@tsexample\n" - "moveMap.unbind(\"keyboard\", \"space\");\n" - "@endtsexample\n\n") + "@tsexample\n" + "moveMap.unbind(\"keyboard\", \"space\");\n" + "@endtsexample\n\n") { return object->processUnbind( device, action ); } @@ -1977,7 +1977,7 @@ DefineEngineMethod( ActionMap, unbindObj, bool, ( const char* device, const char "@param action The device action to unbind from. The action is dependant upon the device. Specify a key for keyboards.\n" "@param obj The object to perform unbind against.\n" "@return True if the unbind was successful, false if the device was unknown or description failed.\n" - "@tsexample\n" + "@tsexample\n" "moveMap.unbindObj(\"keyboard\", \"numpad1\", \"rangeChange\", %player);" "@endtsexample\n\n\n") { @@ -1996,10 +1996,10 @@ DefineEngineMethod( ActionMap, save, void, ( const char* fileName, bool append ) "@param fileName The file path to save the ActionMap to. If a filename is not specified " " the ActionMap will be dumped to the console.\n" "@param append Whether to write the ActionMap at the end of the file or overwrite it.\n" - "@tsexample\n" - "// Write out the actionmap into the config.cs file\n" + "@tsexample\n" + "// Write out the actionmap into the config.cs file\n" "moveMap.save( \"scripts/client/config.cs\" );" - "@endtsexample\n\n") + "@endtsexample\n\n") { char buffer[1024]; @@ -2015,7 +2015,7 @@ DefineEngineMethod( ActionMap, save, void, ( const char* fileName, bool append ) DefineEngineFunction( getCurrentActionMap, ActionMap*, (),, "@brief Returns the current %ActionMap.\n" "@see ActionMap" - "@ingroup Input") + "@ingroup Input") { SimSet* pActionMapSet = Sim::getActiveActionMapSet(); return dynamic_cast< ActionMap* >( pActionMapSet->last() ); @@ -2024,10 +2024,10 @@ DefineEngineFunction( getCurrentActionMap, ActionMap*, (),, DefineEngineMethod( ActionMap, push, void, (),, "@brief Push the ActionMap onto the %ActionMap stack.\n\n" "Activates an ActionMap and placees it at the top of the ActionMap stack.\n\n" - "@tsexample\n" - "// Make moveMap the active action map\n" - "moveMap.push();\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Make moveMap the active action map\n" + "moveMap.push();\n" + "@endtsexample\n\n" "@see ActionMap") { SimSet* pActionMapSet = Sim::getActiveActionMapSet(); @@ -2037,10 +2037,10 @@ DefineEngineMethod( ActionMap, push, void, (),, DefineEngineMethod( ActionMap, pop, void, (),, "@brief Pop the ActionMap off the %ActionMap stack.\n\n" "Deactivates an %ActionMap and removes it from the @ActionMap stack.\n" - "@tsexample\n" - "// Deactivate moveMap\n" - "moveMap.pop();\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Deactivate moveMap\n" + "moveMap.pop();\n" + "@endtsexample\n\n" "@see ActionMap") { SimSet* pActionMapSet = Sim::getActiveActionMapSet(); @@ -2053,20 +2053,20 @@ DefineEngineMethod( ActionMap, getBinding, const char*, ( const char* command ), "@param command The function to search bindings for.\n" "@return The binding against the specified command. Returns an empty string(\"\") " "if a binding wasn't found.\n" - "@tsexample\n" - "// Find what the function \"jump()\" is bound to in moveMap\n" - "%bind = moveMap.getBinding( \"jump\" );\n\n" - "if ( %bind !$= \"\" )\n" - "{\n" - "// Find out what device is used in the binding\n" - " %device = getField( %bind, 0 );\n\n" - "// Find out what action (such as a key) is used in the binding\n" - " %action = getField( %bind, 1 );\n" - "}\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Find what the function \"jump()\" is bound to in moveMap\n" + "%bind = moveMap.getBinding( \"jump\" );\n\n" + "if ( %bind !$= \"\" )\n" + "{\n" + "// Find out what device is used in the binding\n" + " %device = getField( %bind, 0 );\n\n" + "// Find out what action (such as a key) is used in the binding\n" + " %action = getField( %bind, 1 );\n" + "}\n" + "@endtsexample\n\n" "@see getField") { - return object->getBinding( command ); + return object->getBinding( command ); } DefineEngineMethod( ActionMap, getCommand, const char*, ( const char* device, const char* action ),, @@ -2074,15 +2074,15 @@ DefineEngineMethod( ActionMap, getCommand, const char*, ( const char* device, co "@param device The device that was bound. Can be a keyboard, mouse, joystick or a gamepad.\n" "@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n" "@return The command against the specified device and action.\n" - "@tsexample\n" - "// Find what function is bound to a device\'s action\n" - "// In this example, \"jump()\" was assigned to the space key in another script\n" - "%command = moveMap.getCommand(\"keyboard\", \"space\");\n\n" - "// Should print \"jump\" in the console\n" - "echo(%command)\n" - "@endtsexample\n\n") + "@tsexample\n" + "// Find what function is bound to a device\'s action\n" + "// In this example, \"jump()\" was assigned to the space key in another script\n" + "%command = moveMap.getCommand(\"keyboard\", \"space\");\n\n" + "// Should print \"jump\" in the console\n" + "echo(%command)\n" + "@endtsexample\n\n") { - return object->getCommand( device, action ); + return object->getCommand( device, action ); } DefineEngineMethod( ActionMap, isInverted, bool, ( const char* device, const char* action ),, @@ -2091,12 +2091,12 @@ DefineEngineMethod( ActionMap, isInverted, bool, ( const char* device, const cha "@param device The device that was bound. Can be a keyboard, mouse, joystick or a gamepad.\n" "@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n" "@return True if the specified device and action is inverted.\n" - "@tsexample\n" + "@tsexample\n" "%if ( moveMap.isInverted( \"mouse\", \"xaxis\"))\n" " echo(\"Mouse's xAxis is inverted\");" - "@endtsexample\n\n") + "@endtsexample\n\n") { - return object->isInverted( device, action ); + return object->isInverted( device, action ); } DefineEngineMethod( ActionMap, getScale, F32, ( const char* device, const char* action ),, @@ -2104,11 +2104,11 @@ DefineEngineMethod( ActionMap, getScale, F32, ( const char* device, const char* "@param device The device that was bound. Can be keyboard, mouse, joystick or gamepad.\n" "@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n" "@return Any scaling applied to the specified device and action.\n" - "@tsexample\n" - "%scale = %moveMap.getScale( \"gamepad\", \"thumbrx\");\n" - "@endtsexample\n\n") + "@tsexample\n" + "%scale = %moveMap.getScale( \"gamepad\", \"thumbrx\");\n" + "@endtsexample\n\n") { - return object->getScale( device, action ); + return object->getScale( device, action ); } DefineEngineMethod( ActionMap, getDeadZone, const char*, ( const char* device, const char* action ),, @@ -2117,11 +2117,11 @@ DefineEngineMethod( ActionMap, getDeadZone, const char*, ( const char* device, c "@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n" "@return The dead zone for the specified device and action. Returns \"0 0\" if there is no dead zone " "or an empty string(\"\") if the mapping was not found.\n" - "@tsexample\n" - "%deadZone = moveMap.getDeadZone( \"gamepad\", \"thumbrx\");\n" - "@endtsexample\n\n") + "@tsexample\n" + "%deadZone = moveMap.getDeadZone( \"gamepad\", \"thumbrx\");\n" + "@endtsexample\n\n") { - return object->getDeadZone( device, action ); + return object->getDeadZone( device, action ); } //------------------------------------------------------------------------------ diff --git a/Engine/source/ts/tsShapeConstruct.h b/Engine/source/ts/tsShapeConstruct.h index 78c3a8f9f..f3de7f490 100644 --- a/Engine/source/ts/tsShapeConstruct.h +++ b/Engine/source/ts/tsShapeConstruct.h @@ -97,7 +97,7 @@ public: { eCommandType type; // Command type StringTableEntry name; // Command name - static constexpr U32 MAX_ARGS = 10; + static constexpr U32 MAX_ARGS = 10; String argv[MAX_ARGS]; // Command arguments S32 argc; // Number of arguments Command() : type(CmdInvalid), name(0), argc(0) { } @@ -106,12 +106,12 @@ public: { name = StringTable->insert( _name ); } - - // Helper functions to fill in the command arguments - template inline void addArgs(ArgTs ...args){ - using Helper = engineAPI::detail::MarshallHelpers; - Helper::marshallEach(argc, argv, args...); - } + + // Helper functions to fill in the command arguments + template inline void addArgs(ArgTs ...args){ + using Helper = engineAPI::detail::MarshallHelpers; + Helper::marshallEach(argc, argv, args...); + } }; Vector mCommands;