Changeset 5329 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Oct 8, 2005, 11:07:21 PM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/lang/class_list.cc
r5194 r5329 24 24 #include <string.h> 25 25 #include <math.h> 26 #include "shell_command.h" 26 27 27 28 using namespace std; 28 29 30 SHELL_COMMAND_STATIC(debug, ClassList, ClassList::debug); 29 31 30 32 /** -
trunk/src/lib/shell/shell.cc
r5256 r5329 65 65 // Element2D and generals 66 66 this->setAbsCoor2D(3, -400); 67 this->textSize = 15;67 this->textSize = 20; 68 68 this->lineSpacing = 0; 69 69 this->bActive = false; -
trunk/src/lib/shell/shell_command.cc
r5328 r5329 422 422 if (ShellCommandClass::commandClassList == NULL) 423 423 return false; 424 425 424 426 425 long classID = CL_NULL; //< the classID retrieved from the Class. … … 482 481 } 483 482 484 if (classID != CL_NULL && inputSplits.getCount() >= 2 && objectList != NULL) 485 { 486 // Checking for a Match in the Objects of classID (else take the first) 487 tIterator<BaseObject>* itBO = objectList->getIterator(); 488 BaseObject* enumBO = itBO->firstElement(); 489 while(enumBO) 483 if (commandClass != NULL && inputSplits.getCount() >= 2) 484 { 485 if (objectList != NULL) 490 486 { 491 if (enumBO->getName() != NULL && !strcasecmp(enumBO->getName(), inputSplits.getString(1))) 487 // Checking for a Match in the Objects of classID (else take the first) 488 tIterator<BaseObject>* itBO = objectList->getIterator(); 489 BaseObject* enumBO = itBO->firstElement(); 490 while(enumBO) 492 491 { 493 objectPointer = enumBO; 494 fktPos++; 495 break; 496 } 497 enumBO = itBO->nextElement(); 492 if (enumBO->getName() != NULL && !strcasecmp(enumBO->getName(), inputSplits.getString(1))) 493 { 494 objectPointer = enumBO; 495 fktPos = 2; 496 break; 497 } 498 enumBO = itBO->nextElement(); 499 } 500 delete itBO; 501 502 // 503 if (objectPointer == NULL) 504 objectPointer = objectList->firstElement(); 498 505 } 499 delete itBO; 500 501 // 502 if (objectPointer == NULL) 503 objectPointer = objectList->firstElement(); 504 506 printf("test\n"); 505 507 // match a function. 506 if (commandClass != NULL && objectPointer != NULL &&(fktPos == 1 || (fktPos == 2 && inputSplits.getCount() >= 3)))508 if (commandClass != NULL && (fktPos == 1 || (fktPos == 2 && inputSplits.getCount() >= 3))) 507 509 { 508 510 tIterator<ShellCommandBase>* itCMD = commandClass->commandList->getIterator(); … … 512 514 if (!strcmp(enumCMD->getName(), inputSplits.getString(fktPos))) 513 515 { 516 if (objectPointer == NULL && enumCMD->functorType == ShellCommand_Objective) 517 { 518 delete itCMD; 519 return false; 520 } 514 521 if (inputSplits.getCount() > fktPos+1) 515 522 enumCMD->executeCommand(objectPointer, executionString+inputSplits.getOffset(fktPos +1)); … … 622 629 623 630 return this; 624 }625 626 627 /**628 * see ShellCommandBase::debug()629 */630 void ShellCommandBase::debugDyn()631 {632 this->debug();633 631 } 634 632 -
trunk/src/lib/shell/shell_command.h
r5328 r5329 39 39 #define SHELL_COMMAND(command, class, function) \ 40 40 ShellCommandBase* shell_command_##class##_##command = ShellCommand<class>::registerCommand(#command, #class, &class::function) 41 /** 42 * an easy to use Macro to create a Command 43 * @param command the name of the command (without "" around the string) 44 * @param class the name of the class to apply this command to (without the "" around the string) 45 * @param function the function to call 46 * 47 * MEANING: 48 * ShellCommandBase* someUniqueVarName = 49 * ShellCommand<ClassName>::registerCommand("commandNameInShell", "ClassName", &ClassName::FunctionToCall); 50 * 51 * In the Shell you would call this Command using: 52 * $ ClassName [ObjectName] commandNameInShell [parameters] 53 */ 54 #define SHELL_COMMAND_STATIC(command, class, function) \ 55 ShellCommandBase* shell_command_##class##_##command = ShellCommandStatic<class>::registerCommand(#command, #class, function) 41 56 42 57 … … 110 125 static bool isRegistered(const char* commandName, const char* className, unsigned int paramCount, ...); 111 126 static const char* paramToString(long parameter); 112 113 void debugDyn();114 127 115 128 private: -
trunk/src/lib/shell/shell_completion.cc
r5254 r5329 107 107 completeType |= SHELLC_CLASS; 108 108 completeType |= SHELLC_ALIAS; 109 110 109 } 111 110 else if (inputSplits.getCount() == 1 && emptyComplete == false) -
trunk/src/lib/util/helper_functions.cc
r5270 r5329 29 29 bool isBool(const char* BOOL, bool defaultValue) 30 30 { 31 if (BOOL == NULL) 32 return defaultValue; 31 33 if(!strcmp(BOOL, "1") || !strcmp( BOOL,"true") || !strcmp(BOOL,"TRUE")) 32 34 return true; … … 40 42 int isInt(const char* INT, int defaultValue) 41 43 { 44 if (INT == NULL) 45 return defaultValue; 42 46 char* endPtr = NULL; 47 43 48 int result = strtol(INT, &endPtr, 10); 44 49 … … 51 56 float isFloat(const char* FLOAT, float defaultValue) 52 57 { 58 if (FLOAT == NULL) 59 return defaultValue; 53 60 char* endPtr = NULL; 54 61 double result = strtod(FLOAT, &endPtr);
Note: See TracChangeset
for help on using the changeset viewer.