Changeset c8bf88d in mainline for kernel/generic/src
- Timestamp:
- 2009-04-03T15:52:14Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a7b1071
- Parents:
- 2398ee9
- Location:
- kernel/generic/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/kconsole.c
r2398ee9 rc8bf88d 260 260 261 261 if (wstr_remove(current, position - 1)) { 262 position--; 262 263 putchar('\b'); 263 printf("%ls", current + position); 264 position--; 265 print_cc('\b', wstr_length(current) - position); 264 printf("%ls ", current + position); 265 print_cc('\b', wstr_length(current) - position + 1); 266 266 continue; 267 267 } … … 334 334 } 335 335 336 if (ch == 0x1b) { 337 /* Special command */ 338 wchar_t mod = _getc(indev); 339 wchar_t ch = _getc(indev); 340 341 if ((mod != 0x5b) && (mod != 0x4f)) 336 if (ch == U_LEFT_ARROW) { 337 /* Left */ 338 if (position > 0) { 339 putchar('\b'); 340 position--; 341 } 342 continue; 343 } 344 345 if (ch == U_RIGHT_ARROW) { 346 /* Right */ 347 if (position < wstr_length(current)) { 348 putchar(current[position]); 349 position++; 350 } 351 continue; 352 } 353 354 if ((ch == U_UP_ARROW) || (ch == U_DOWN_ARROW)) { 355 /* Up, down */ 356 print_cc('\b', position); 357 print_cc(' ', wstr_length(current)); 358 print_cc('\b', wstr_length(current)); 359 360 if (ch == U_UP_ARROW) { 361 /* Up */ 362 if (history_pos == 0) 363 history_pos = KCONSOLE_HISTORY - 1; 364 else 365 history_pos--; 366 } else { 367 /* Down */ 368 history_pos++; 369 history_pos = history_pos % KCONSOLE_HISTORY; 370 } 371 current = history[history_pos]; 372 printf("%ls", current); 373 position = wstr_length(current); 374 continue; 375 } 376 377 if (ch == U_HOME_ARROW) { 378 /* Home */ 379 print_cc('\b', position); 380 position = 0; 381 continue; 382 } 383 384 if (ch == U_END_ARROW) { 385 /* End */ 386 printf("%ls", current + position); 387 position = wstr_length(current); 388 continue; 389 } 390 391 if (ch == U_DELETE) { 392 /* Delete */ 393 if (position == wstr_length(current)) 342 394 continue; 343 395 344 if ((ch == 0x33) && (_getc(indev) == 0x7e)) { 345 /* Delete */ 346 if (position == wstr_length(current)) 347 continue; 348 349 if (wstr_remove(current, position)) { 350 putchar('\b'); 351 printf("%ls", current + position); 352 position--; 353 print_cc('\b', wstr_length(current) - position); 354 } 355 } else if (ch == 0x48) { 356 /* Home */ 357 print_cc('\b', position); 358 position = 0; 359 } else if (ch == 0x46) { 360 /* End */ 361 printf("%ls", current + position); 362 position = wstr_length(current); 363 } else if (ch == 0x44) { 364 /* Left */ 365 if (position > 0) { 366 putchar('\b'); 367 position--; 368 } 369 } else if (ch == 0x43) { 370 /* Right */ 371 if (position < wstr_length(current)) { 372 putchar(current[position]); 373 position++; 374 } 375 } else if ((ch == 0x41) || (ch == 0x42)) { 376 /* Up, down */ 377 print_cc('\b', position); 378 print_cc(' ', wstr_length(current)); 379 print_cc('\b', wstr_length(current)); 380 381 if (ch == 0x41) { 382 /* Up */ 383 if (history_pos == 0) 384 history_pos = KCONSOLE_HISTORY - 1; 385 else 386 history_pos--; 387 } else { 388 /* Down */ 389 history_pos++; 390 history_pos = history_pos % KCONSOLE_HISTORY; 391 } 392 current = history[history_pos]; 393 printf("%ls", current); 394 position = wstr_length(current); 396 if (wstr_remove(current, position)) { 397 printf("%ls ", current + position); 398 print_cc('\b', wstr_length(current) - position + 1); 395 399 } 396 400 continue; -
kernel/generic/src/lib/string.c
r2398ee9 rc8bf88d 110 110 #include <align.h> 111 111 112 char invalch = '?';113 114 112 /** Byte mask consisting of lowest @n bits (out of 8) */ 115 113 #define LO_MASK_8(n) ((uint8_t) ((1 << (n)) - 1)) … … 135 133 * @param size Size of the string (in bytes). 136 134 * 137 * @return Value of decoded character, invalchon decoding error or135 * @return Value of decoded character, U_SPECIAL on decoding error or 138 136 * NULL if attempt to decode beyond @a size. 139 137 * … … 170 168 } else { 171 169 /* 10xxxxxx -- unexpected continuation byte */ 172 return invalch;170 return U_SPECIAL; 173 171 } 174 172 175 173 if (*offset + cbytes > size) 176 return invalch;174 return U_SPECIAL; 177 175 178 176 wchar_t ch = b0 & LO_MASK_8(b0_bits); … … 184 182 /* Must be 10xxxxxx */ 185 183 if ((b & 0xc0) != 0x80) 186 return invalch;184 return U_SPECIAL; 187 185 188 186 /* Shift data bits to ch */ -
kernel/generic/src/printf/printf_core.c
r2398ee9 rc8bf88d 82 82 static char digits_small[] = "0123456789abcdef"; 83 83 static char digits_big[] = "0123456789ABCDEF"; 84 static char invalch = U_SPECIAL; 84 85 85 86 /** Print one or more characters without adding newline.
Note:
See TracChangeset
for help on using the changeset viewer.