Changeset 1e01a35 in mainline for kernel/generic/src/debug/symtab.c
- Timestamp:
- 2012-07-10T12:01:07Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f0d7bd9
- Parents:
- b4ca0a9c
- git-author:
- Sandeep Kumar <> (2012-07-10 12:01:07)
- git-committer:
- Vojtech Horky <vojtechhorky@…> (2012-07-10 12:01:07)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/debug/symtab.c
rb4ca0a9c r1e01a35 209 209 * 210 210 */ 211 int symtab_compl(char *input, size_t size )211 int symtab_compl(char *input, size_t size, indev_t * indev) 212 212 { 213 213 #ifdef CONFIG_SYMTAB … … 226 226 const char *hint; 227 227 char output[MAX_SYMBOL_NAME]; 228 /* Maximum Match Length : Length of longest matching common substring in 229 case more than one match is found */ 230 size_t max_match_len = size; 231 size_t max_match_len_tmp = size; 232 size_t input_len = str_length(input); 233 char *sym_name; 234 char display = 'y'; 235 size_t hints_to_show = MAX_TAB_HINTS - 1; 236 size_t total_hints_shown = 0; 237 char continue_showing_hints = 'y'; 228 238 229 239 output[0] = 0; 240 241 while ((hint = symtab_search_one(name, &pos))) { 242 ++pos; 243 } 244 245 pos = 0; 230 246 231 247 while ((hint = symtab_search_one(name, &pos))) { … … 237 253 } 238 254 255 /* If possible completions are more than MAX_TAB_HINTS, ask user whether to display them or not. */ 256 if (found > MAX_TAB_HINTS) { 257 printf("\nDisplay all %zu possibilities? (y or n)", found); 258 do { 259 display = indev_pop_character(indev); 260 } while (display != 'y' && display != 'n' && display != 'Y' && display != 'N'); 261 } 262 239 263 if ((found > 1) && (str_length(output) != 0)) { 240 264 printf("\n"); 241 265 pos = 0; 242 266 while (symtab_search_one(name, &pos)) { 243 printf("%s\n", symbol_table[pos].symbol_name);267 sym_name = symbol_table[pos].symbol_name; 244 268 pos++; 269 270 if (display == 'y' || display == 'Y') { /* We are still showing hints */ 271 printf("%s\n", sym_name); 272 --hints_to_show; 273 ++total_hints_shown; 274 275 if (hints_to_show == 0 && total_hints_shown != found) { /* Time to ask user to continue */ 276 printf("--More--"); 277 do { 278 continue_showing_hints = indev_pop_character(indev); 279 if (continue_showing_hints == 'y' || continue_showing_hints == 'Y' 280 || continue_showing_hints == ' ') { 281 hints_to_show = MAX_TAB_HINTS - 1; /* Display a full page again */ 282 break; 283 } 284 285 if (continue_showing_hints == 'n' || continue_showing_hints == 'N' 286 || continue_showing_hints == 'q' || continue_showing_hints == 'Q') { 287 display = 'n'; /* Stop displaying hints */ 288 break; 289 } 290 291 if (continue_showing_hints == '\n') { 292 hints_to_show = 1; /* Show one more hint */ 293 break; 294 } 295 } while (1); 296 297 printf("\r \r"); /* Delete the --More-- option */ 298 } 299 } 300 301 for(max_match_len_tmp = 0; output[max_match_len_tmp] == sym_name[input_len + max_match_len_tmp] 302 && max_match_len_tmp < max_match_len; ++max_match_len_tmp); 303 max_match_len = max_match_len_tmp; 245 304 } 305 /* keep only the characters common in all completions */ 306 output[max_match_len] = 0; 246 307 } 247 308
Note:
See TracChangeset
for help on using the changeset viewer.