Changeset 5204 in orxonox.OLD for trunk/src/lib/shell
- Timestamp:
- Sep 18, 2005, 1:37:58 PM (19 years ago)
- Location:
- trunk/src/lib/shell
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell.cc
r5201 r5204 40 40 SHELL_COMMAND(deactivate, Shell, deactivate) 41 41 ->describe("Deactivates the Shell. (moves it into background)") 42 ->setAlias("deactivate"); 43 42 ->setAlias("hide"); 44 43 45 44 /** -
trunk/src/lib/shell/shell.h
r5197 r5204 2 2 * @file shell.h 3 3 * Definition of a on-screen-shell 4 */ 4 * 5 * @todo check for smooth deletion process 6 */ 5 7 6 8 #ifndef _SHELL_H -
trunk/src/lib/shell/shell_command.cc
r5203 r5204 212 212 ShellCommandClass::commandClassList = new tList<ShellCommandClass>; 213 213 ShellCommand<ShellCommandBase>::registerCommand("debug", "ShellCommand", &ShellCommandBase::debugDyn); 214 } 215 } 216 217 void ShellCommandClass::help(const char* className) 218 { 219 if (className == NULL) 220 return; 221 if (likely(ShellCommandClass::commandClassList != NULL)) 222 { 223 tIterator<ShellCommandClass>* itCL = ShellCommandClass::commandClassList->getIterator(); 224 ShellCommandClass* elemCL = itCL->firstElement(); 225 while(elemCL != NULL) 226 { 227 if (elemCL->className && !strcasecmp(className, elemCL->className)) 228 { 229 PRINT(0)("Class:'%s' registered %d commands: \n", elemCL->className, elemCL->commandList->getSize()); 230 tIterator<ShellCommandBase>* iterator = elemCL->commandList->getIterator(); 231 const ShellCommandBase* elem = iterator->firstElement(); 232 while(elem != NULL) 233 { 234 PRINT(0)(" command:'%s' : params:%d: ", elem->getName(), elem->paramCount); 235 for (unsigned int i = 0; i< elem->paramCount; i++) 236 PRINT(0)("%s ", ShellCommandBase::paramToString(elem->parameters[i])); 237 if (elem->description != NULL) 238 PRINT(0)("- %s", elem->description); 239 PRINT(0)("\n"); 240 elem = iterator->nextElement(); 241 } 242 delete iterator; 243 244 delete itCL; 245 return; 246 } 247 elemCL = itCL->nextElement(); 248 } 249 delete itCL; 250 PRINTF(3)("Class %s not found in Command's classes\n", className); 251 } 252 else 253 { 254 PRINTF(1)("List of commandClasses does not exist"); 214 255 } 215 256 } … … 413 454 if (objectList != NULL) 414 455 { 415 elemAL->getCommand()->executeCommand(objectList->firstElement(), executionString+inputSplits.getOffset(1)); 456 if (inputSplits.getCount() > 1) 457 elemAL->getCommand()->executeCommand(objectList->firstElement(), executionString+inputSplits.getOffset(1)); 458 else 459 elemAL->getCommand()->executeCommand(objectList->firstElement(), ""); 416 460 delete itAL; 417 461 return true; … … 441 485 delete itCL; 442 486 } 443 444 487 445 488 if (classID != CL_NULL && inputSplits.getCount() >= 2 && objectList != NULL) … … 484 527 } 485 528 delete itCMD; 486 487 } 488 489 } 490 491 492 } 493 529 } 530 } 531 } 494 532 } 495 533 -
trunk/src/lib/shell/shell_command.h
r5197 r5204 2 2 * @file shell_command.h 3 3 * Definition of a on-screen-shell 4 * @todo simple way to supply Default Values with the macro. 4 5 */ 5 6 … … 59 60 static void unregisterAllCommands(); 60 61 62 static void help (const char* className); 63 61 64 private: 62 65 ShellCommandClass(const char* className); … … 310 313 { 311 314 // if (parameters != NULL) 312 SubString sub(parameters );315 SubString sub(parameters, true); 313 316 //! FUNCTOR_LIST is the List of Executive Functions 314 317 #define FUNCTOR_LIST(x) ShellCommandExecute ## x -
trunk/src/lib/shell/shell_input.cc
r5202 r5204 177 177 * prints out some nice help about the Shell 178 178 */ 179 void ShellInput::help() 180 { 181 PRINT(0)("Help for the most important Shell-commands\n"); 182 PRINT(0)("F1 - HELP; F2 - DEBUG; ` - open/close shell\n"); 183 PRINT(0)("input order:\n"); 184 PRINT(0)("ClassName [objectName] function [parameter1, [parameter2 ...]] or\n"); 185 PRINT(0)("Alias [parameter]\n"); 179 void ShellInput::help(const char* className, const char* functionName) 180 { 181 if (strlen(className) == 0) 182 { 183 PRINT(0)("Help for the most important Shell-commands\n"); 184 PRINT(0)("F1 - HELP; F2 - DEBUG; ` - open/close shell\n"); 185 PRINT(0)("input order:\n"); 186 PRINT(0)("ClassName [objectName] function [parameter1, [parameter2 ...]] or\n"); 187 PRINT(0)("Alias [parameter]\n"); 188 PRINT(0)("- Also try 'help className'"); 189 } 190 else if (strlen (className) > 0 && strlen (functionName) == 0) 191 { 192 ShellCommandClass::help(className); 193 //PRINTF(1)("%s::%s\n", className, functionName); 194 } 186 195 } 187 196 -
trunk/src/lib/shell/shell_input.h
r5202 r5204 32 32 void setRepeatDelay(float repeatDelay, float repeatRate); 33 33 bool executeCommand(); 34 void help( );34 void help(const char* className = "", const char* function = ""); 35 35 36 36 virtual void tick(float dt);
Note: See TracChangeset
for help on using the changeset viewer.