Changeset 5193 in orxonox.OLD for trunk/src/lib/shell
- Timestamp:
- Sep 18, 2005, 1:20:36 AM (19 years ago)
- Location:
- trunk/src/lib/shell
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_completion.cc
r5192 r5193 71 71 SHELLC_TYPE firstType = SHELLC_NONE; 72 72 SHELLC_TYPE secondType = SHELLC_NONE; 73 long completeType = SHELLC_NONE; 74 const char* completeString; 73 75 74 76 … … 91 93 } 92 94 95 // CREATE INPUTS 93 96 if (this->input->getInput() == NULL) 94 97 completionLine = ""; 95 98 else 96 99 completionLine = this->input->getInput() + strspn(this->input->getInput(), " \t\n"); 97 98 100 SubString inputSplits(completionLine, true); 101 102 // What String will be completed 103 if (emptyComplete == true) 104 completeString = ""; 105 else 106 completeString = inputSplits.getString(inputSplits.getCount()-1); 99 107 100 108 // CLASS COMPLETION … … 102 110 { 103 111 PRINTF(5)("Listing all Classes\n"); 104 this->objectComplete("", CL_SHELL_COMMAND_CLASS);112 completeType |= SHELLC_CLASS; 105 113 } 106 114 else if (inputSplits.getCount() == 1 && emptyComplete == false) 107 115 { 108 116 printf("trying to complete a Class with '%s'\n", inputSplits.getString(0)); 109 this->objectComplete(inputSplits.getString(0), CL_SHELL_COMMAND_CLASS);117 completeType |= SHELLC_CLASS; 110 118 } 111 119 … … 121 129 else 122 130 { 123 firstType = SHELLC_CLASS; 124 if (inputSplits.getCount() == 2) 125 { 126 if (completionLine[strlen(completionLine)-1] != ' ') 127 this->objectComplete(inputSplits.getString(1), classID); 128 } 129 else 130 this->objectComplete("", classID); 131 } 132 } 131 completeType |= SHELLC_OBJECT; 132 } 133 } 134 135 if (completeType & SHELLC_CLASS) 136 this->objectComplete(completeString, CL_SHELL_COMMAND_CLASS); 137 if (completeType & SHELLC_OBJECT) 138 this->objectComplete(completeString, classID); 133 139 134 140 if (emptyComplete == false) … … 168 174 if (unlikely(objectBegin == NULL)) 169 175 return false; 170 tList<BaseObject>* boList = ClassList::getList(classID);176 const tList<BaseObject>* boList = ClassList::getList(classID); 171 177 if (boList != NULL) 172 178 { -
trunk/src/lib/shell/shell_completion.h
r5192 r5193 16 16 17 17 typedef enum { 18 SHELLC_NONE ,19 SHELLC_CLASS ,20 SHELLC_OBJECT ,21 SHELLC_FUNCTION ,22 SHELLC_ALIAS ,18 SHELLC_NONE = 0, 19 SHELLC_CLASS = 1, 20 SHELLC_OBJECT = 2, 21 SHELLC_FUNCTION = 4, 22 SHELLC_ALIAS = 8, 23 23 } SHELLC_TYPE; 24 24
Note: See TracChangeset
for help on using the changeset viewer.