Rev 602 | Rev 625 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 602 | Rev 616 | ||
|---|---|---|---|
| Line 142... | Line 142... | ||
| 142 | /** Symtab completion |
142 | /** Symtab completion |
| 143 | * |
143 | * |
| 144 | * @param name - Search string, completes to symbol name |
144 | * @param name - Search string, completes to symbol name |
| 145 | * @returns - 0 - nothing found, 1 - success, >1 print duplicates |
145 | * @returns - 0 - nothing found, 1 - success, >1 print duplicates |
| 146 | */ |
146 | */ |
| 147 | int symtab_compl(char *name) |
147 | int symtab_compl(char *input) |
| 148 | { |
148 | { |
| 149 | char output[MAX_SYMBOL_NAME+1]; |
149 | char output[MAX_SYMBOL_NAME+1]; |
| 150 | int startpos = 0; |
150 | int startpos = 0; |
| 151 | char *foundtxt; |
151 | char *foundtxt; |
| 152 | int found = 0; |
152 | int found = 0; |
| 153 | int i; |
153 | int i; |
| - | 154 | char *name = input; |
|
| - | 155 | ||
| - | 156 | /* Allow completion of pointers */ |
|
| - | 157 | if (name[0] == '*' || name[0] == '&') |
|
| - | 158 | name++; |
|
| 154 | 159 | ||
| 155 | /* Do not print everything */ |
160 | /* Do not print everything */ |
| 156 | if (!strlen(name)) |
161 | if (!strlen(name)) |
| 157 | return 0; |
162 | return 0; |
| - | 163 | ||
| 158 | 164 | ||
| 159 | output[0] = '\0'; |
165 | output[0] = '\0'; |
| 160 | 166 | ||
| 161 | while ((foundtxt = symtab_search_one(name, &startpos))) { |
167 | while ((foundtxt = symtab_search_one(name, &startpos))) { |
| 162 | startpos++; |
168 | startpos++; |
| Line 178... | Line 184... | ||
| 178 | while ((foundtxt = symtab_search_one(name, &startpos))) { |
184 | while ((foundtxt = symtab_search_one(name, &startpos))) { |
| 179 | printf("%s\n", symbol_table[startpos].symbol_name); |
185 | printf("%s\n", symbol_table[startpos].symbol_name); |
| 180 | startpos++; |
186 | startpos++; |
| 181 | } |
187 | } |
| 182 | } |
188 | } |
| 183 | strncpy(name, output, MAX_SYMBOL_NAME); |
189 | strncpy(input, output, MAX_SYMBOL_NAME); |
| 184 | return found; |
190 | return found; |
| 185 | 191 | ||
| 186 | } |
192 | } |