Changeset ed88c8e in mainline
- Timestamp:
- 2018-05-29T13:25:07Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fc0b2a8
- Parents:
- a57fa32
- git-author:
- Jiri Svoboda <jiri@…> (2018-05-28 17:24:17)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-05-29 13:25:07)
- Files:
-
- 59 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/arm32/src/putchar.c
ra57fa32 red88c8e 195 195 * @param ch Character to display 196 196 */ 197 void put char(const wchar_t ch)197 void putwchar(const wchar_t ch) 198 198 { 199 199 if (ch == '\n') … … 203 203 scons_sendb((uint8_t) ch); 204 204 else 205 scons_sendb( U_SPECIAL);205 scons_sendb('?'); 206 206 } 207 207 -
boot/arch/ia64/include/arch/ski.h
ra57fa32 red88c8e 30 30 #define BOOT_ia64_SKI_H_ 31 31 32 #include <stddef.h> 33 #include <str.h> 34 35 extern void ski_putchar(const wchar_t); 32 extern void ski_putchar(char); 36 33 37 34 #endif -
boot/arch/ia64/src/putchar.c
ra57fa32 red88c8e 33 33 #include <arch/ski.h> 34 34 35 void put char(const wchar_t ch)35 void putwchar(const wchar_t ch) 36 36 { 37 37 #ifdef MACHINE_ski … … 39 39 ski_putchar(ch); 40 40 else 41 ski_putchar( U_SPECIAL);41 ski_putchar('?'); 42 42 #endif 43 43 } -
boot/arch/ia64/src/ski.c
ra57fa32 red88c8e 52 52 } 53 53 54 void ski_putchar(c onst wchar_tch)54 void ski_putchar(char ch) 55 55 { 56 56 ski_console_init(); -
boot/arch/mips32/src/putchar.c
ra57fa32 red88c8e 39 39 #if defined(MACHINE_msim) 40 40 #define _putchar(ch) msim_putchar((ch)) 41 static void msim_putchar(c onst wchar_tch)41 static void msim_putchar(char ch) 42 42 { 43 43 *((char *) MSIM_VIDEORAM_ADDRESS) = ch; … … 51 51 (yamon_print_count_ptr_t) YAMON_SUBR_PRINT_COUNT; 52 52 53 static void yamon_putchar(c onst wchar_t wch)53 static void yamon_putchar(char ch) 54 54 { 55 const char ch = (char) wch;56 57 55 (*yamon_print_count)(0, &ch, 1); 58 56 } 59 57 #endif 60 58 61 void put char(const wchar_t ch)59 void putwchar(const wchar_t ch) 62 60 { 63 61 if (ascii_check(ch)) 64 62 _putchar(ch); 65 63 else 66 _putchar( U_SPECIAL);64 _putchar('?'); 67 65 } 68 66 -
boot/arch/ppc32/src/ofw.c
ra57fa32 red88c8e 39 39 } 40 40 41 void put char(constwchar_t ch)41 void putwchar(wchar_t ch) 42 42 { 43 43 if (ch == '\n') … … 47 47 ofw_putchar(ch); 48 48 else 49 ofw_putchar( U_SPECIAL);49 ofw_putchar('?'); 50 50 } -
boot/arch/riscv64/src/putchar.c
ra57fa32 red88c8e 33 33 #include <arch/ucb.h> 34 34 35 void put char(constwchar_t ch)35 void putwchar(wchar_t ch) 36 36 { 37 37 if (ascii_check(ch)) 38 38 htif_cmd(HTIF_DEVICE_CONSOLE, HTIF_CONSOLE_PUTC, ch); 39 39 else 40 htif_cmd(HTIF_DEVICE_CONSOLE, HTIF_CONSOLE_PUTC, U_SPECIAL);40 htif_cmd(HTIF_DEVICE_CONSOLE, HTIF_CONSOLE_PUTC, '?'); 41 41 } -
boot/arch/sparc64/src/ofw.c
ra57fa32 red88c8e 43 43 #include <str.h> 44 44 45 void put char(constwchar_t ch)45 void putwchar(wchar_t ch) 46 46 { 47 47 if (ch == '\n') … … 51 51 ofw_putchar(ch); 52 52 else 53 ofw_putchar( U_SPECIAL);53 ofw_putchar('?'); 54 54 } 55 55 -
boot/genarch/include/genarch/ofw.h
ra57fa32 red88c8e 89 89 extern void ofw_init(void); 90 90 91 extern void ofw_putchar(c onst char);91 extern void ofw_putchar(char); 92 92 93 93 extern ofw_arg_t ofw_get_property(const phandle, const char *, void *, -
boot/genarch/src/ofw.c
ra57fa32 red88c8e 194 194 } 195 195 196 void ofw_putchar(c onst char ch)196 void ofw_putchar(char ch) 197 197 { 198 198 if (ofw_stdout == 0) -
boot/generic/include/putchar.h
ra57fa32 red88c8e 38 38 #include <stddef.h> 39 39 40 extern void put char(constwchar_t);40 extern void putwchar(wchar_t); 41 41 42 42 #endif -
boot/generic/src/vprintf.c
ra57fa32 red88c8e 42 42 43 43 while (offset < size) { 44 put char(str_decode(str, &offset, size));44 putwchar(str_decode(str, &offset, size)); 45 45 chars++; 46 46 } … … 56 56 57 57 while ((uc = str_decode(str, &offset, STR_NO_LIMIT)) != 0) { 58 put char(uc);58 putwchar(uc); 59 59 chars++; 60 60 } 61 61 62 put char('\n');62 putwchar('\n'); 63 63 return chars; 64 64 } -
kernel/arch/abs32le/src/abs32le.c
ra57fa32 red88c8e 136 136 } 137 137 138 void early_put char(wchar_t ch)138 void early_putwchar(wchar_t ch) 139 139 { 140 140 } -
kernel/arch/amd64/src/asm.S
ra57fa32 red88c8e 412 412 * 413 413 */ 414 FUNCTION_BEGIN(early_put char)414 FUNCTION_BEGIN(early_putwchar) 415 415 #if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB))) 416 416 … … 443 443 /* Sanity check for the cursor on screen */ 444 444 cmp $2000, %ax 445 jb early_put char_cursor_ok445 jb early_putwchar_cursor_ok 446 446 447 447 movw $1998, %ax 448 448 449 early_put char_cursor_ok:449 early_putwchar_cursor_ok: 450 450 451 451 movw %ax, %bx … … 456 456 457 457 cmp $0x0a, %al 458 jne early_put char_backspace458 jne early_putwchar_backspace 459 459 460 460 /* Interpret newline */ … … 470 470 subw %dx, %bx 471 471 472 jmp early_put char_skip473 474 early_put char_backspace:472 jmp early_putwchar_skip 473 474 early_putwchar_backspace: 475 475 476 476 cmp $0x08, %al 477 jne early_put char_print477 jne early_putwchar_print 478 478 479 479 /* Interpret backspace */ 480 480 481 481 cmp $0x0000, %bx 482 je early_put char_skip482 je early_putwchar_skip 483 483 484 484 dec %bx 485 jmp early_put char_skip486 487 early_put char_print:485 jmp early_putwchar_skip 486 487 early_putwchar_print: 488 488 489 489 /* Print character */ … … 493 493 inc %bx 494 494 495 early_put char_skip:495 early_putwchar_skip: 496 496 497 497 /* Sanity check for the cursor on the last line */ 498 498 cmp $2000, %bx 499 jb early_put char_no_scroll499 jb early_putwchar_no_scroll 500 500 501 501 /* Scroll the screen (24 rows) */ … … 513 513 movw $1920, %bx 514 514 515 early_put char_no_scroll:515 early_putwchar_no_scroll: 516 516 517 517 /* Write bits 8 - 15 of the cursor address */ … … 540 540 541 541 ret 542 FUNCTION_END(early_put char)542 FUNCTION_END(early_putwchar) -
kernel/arch/arm32/src/asm.S
ra57fa32 red88c8e 98 98 ldmia sp!, {r4, r5, pc} 99 99 100 FUNCTION_BEGIN(early_put char)100 FUNCTION_BEGIN(early_putwchar) 101 101 mov pc, lr 102 FUNCTION_END(early_put char)102 FUNCTION_END(early_putwchar) -
kernel/arch/ia32/src/asm.S
ra57fa32 red88c8e 451 451 * 452 452 */ 453 FUNCTION_BEGIN(early_put char)453 FUNCTION_BEGIN(early_putwchar) 454 454 455 455 #if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB))) … … 484 484 /* Sanity check for the cursor on screen */ 485 485 cmp $2000, %ax 486 jb early_put char_cursor_ok486 jb early_putwchar_cursor_ok 487 487 488 488 movw $1998, %ax 489 489 490 early_put char_cursor_ok:490 early_putwchar_cursor_ok: 491 491 492 492 movw %ax, %bx … … 497 497 498 498 cmp $0x0a, %al 499 jne early_put char_backspace499 jne early_putwchar_backspace 500 500 501 501 /* Interpret newline */ … … 511 511 subw %dx, %bx 512 512 513 jmp early_put char_skip514 515 early_put char_backspace:513 jmp early_putwchar_skip 514 515 early_putwchar_backspace: 516 516 517 517 cmp $0x08, %al 518 jne early_put char_print518 jne early_putwchar_print 519 519 520 520 /* Interpret backspace */ 521 521 522 522 cmp $0x0000, %bx 523 je early_put char_skip523 je early_putwchar_skip 524 524 525 525 dec %bx 526 jmp early_put char_skip527 528 early_put char_print:526 jmp early_putwchar_skip 527 528 early_putwchar_print: 529 529 530 530 /* Print character */ … … 534 534 inc %bx 535 535 536 early_put char_skip:536 early_putwchar_skip: 537 537 538 538 /* Sanity check for the cursor on the last line */ 539 539 cmp $2000, %bx 540 jb early_put char_no_scroll540 jb early_putwchar_no_scroll 541 541 542 542 /* Scroll the screen (24 rows) */ … … 554 554 movw $1920, %bx 555 555 556 early_put char_no_scroll:556 early_putwchar_no_scroll: 557 557 558 558 /* Write bits 8 - 15 of the cursor address */ … … 583 583 584 584 ret 585 FUNCTION_END(early_put char)586 585 FUNCTION_END(early_putwchar) 586 -
kernel/arch/ia64/src/asm.S
ra57fa32 red88c8e 191 191 FUNCTION_END(switch_to_userspace) 192 192 193 FUNCTION_BEGIN(early_put char)193 FUNCTION_BEGIN(early_putwchar) 194 194 br.ret.sptk.many b0 195 FUNCTION_END(early_put char)195 FUNCTION_END(early_putwchar) -
kernel/arch/ia64/src/drivers/ski.c
ra57fa32 red88c8e 58 58 }; 59 59 60 static void ski_put char(outdev_t *, const wchar_t);60 static void ski_putwchar(outdev_t *, const wchar_t); 61 61 62 62 static outdev_operations_t skidev_ops = { 63 .write = ski_put char,63 .write = ski_putwchar, 64 64 .redraw = NULL, 65 65 .scroll_up = NULL, … … 166 166 } 167 167 168 static void ski_do_putchar(c onst wchar_tch)168 static void ski_do_putchar(char ch) 169 169 { 170 170 asm volatile ( … … 187 187 * 188 188 */ 189 static void ski_put char(outdev_t *dev, constwchar_t ch)189 static void ski_putwchar(outdev_t *dev, wchar_t ch) 190 190 { 191 191 // TODO FIXME: … … 198 198 199 199 ski_do_putchar(ch); 200 } else 201 ski_do_putchar(U_SPECIAL); 200 } else { 201 ski_do_putchar('?'); 202 } 202 203 } 203 204 } -
kernel/arch/mips32/src/asm.S
ra57fa32 red88c8e 296 296 FUNCTION_END(fpu_context_restore) 297 297 298 FUNCTION_BEGIN(early_put char)298 FUNCTION_BEGIN(early_putwchar) 299 299 j $ra 300 300 nop 301 FUNCTION_END(early_put char)301 FUNCTION_END(early_putwchar) -
kernel/arch/mips32/src/mach/malta/malta.c
ra57fa32 red88c8e 81 81 (yamon_print_count_ptr_t) YAMON_SUBR_PRINT_COUNT; 82 82 83 static void yamon_put char(outdev_t *dev, const wchar_t wch)83 static void yamon_putwchar(outdev_t *dev, const wchar_t wch) 84 84 { 85 85 … … 91 91 static outdev_t yamon_outdev; 92 92 static outdev_operations_t yamon_outdev_ops = { 93 .write = yamon_put char,93 .write = yamon_putwchar, 94 94 .redraw = NULL, 95 95 .scroll_up = NULL, -
kernel/arch/ppc32/src/asm.S
ra57fa32 red88c8e 265 265 blr 266 266 267 FUNCTION_BEGIN(early_put char)267 FUNCTION_BEGIN(early_putwchar) 268 268 blr 269 FUNCTION_END(early_put char)269 FUNCTION_END(early_putwchar) -
kernel/arch/riscv64/include/arch/drivers/ucb.h
ra57fa32 red88c8e 42 42 extern void htif_init(volatile uint64_t *, volatile uint64_t *); 43 43 extern outdev_t *htifout_init(void); 44 extern void htif_put char(outdev_t *, const wchar_t);44 extern void htif_putwchar(outdev_t *, const wchar_t); 45 45 46 46 #endif -
kernel/arch/riscv64/src/asm.S
ra57fa32 red88c8e 35 35 FUNCTION_END(asm_delay_loop) 36 36 37 FUNCTION_BEGIN(early_put char)37 FUNCTION_BEGIN(early_putwchar) 38 38 ret 39 FUNCTION_END(early_put char)39 FUNCTION_END(early_putwchar) 40 40 41 41 FUNCTION_BEGIN(cpu_halt) -
kernel/arch/riscv64/src/drivers/ucb.c
ra57fa32 red88c8e 42 42 43 43 static outdev_operations_t htifdev_ops = { 44 .write = htif_put char,44 .write = htif_putwchar, 45 45 .redraw = NULL, 46 46 .scroll_up = NULL, … … 85 85 } 86 86 87 void htif_put char(outdev_t *dev, const wchar_t ch)87 void htif_putwchar(outdev_t *dev, const wchar_t ch) 88 88 { 89 89 if (ascii_check(ch)) -
kernel/arch/sparc64/src/asm.S
ra57fa32 red88c8e 189 189 mov %g0, %o0 /* return 0 on failure */ 190 190 191 FUNCTION_BEGIN(early_put char)191 FUNCTION_BEGIN(early_putwchar) 192 192 retl 193 193 nop 194 FUNCTION_END(early_put char)194 FUNCTION_END(early_putwchar) -
kernel/arch/sparc64/src/drivers/niagara.c
ra57fa32 red88c8e 58 58 static niagara_instance_t *instance = NULL; 59 59 60 static void niagara_put char(outdev_t *, const wchar_t);60 static void niagara_putwchar(outdev_t *, const wchar_t); 61 61 62 62 /** Character device operations */ 63 63 static outdev_operations_t niagara_ops = { 64 .write = niagara_put char,64 .write = niagara_putwchar, 65 65 .redraw = NULL, 66 66 .scroll_up = NULL, … … 96 96 97 97 /** Write a single character to the standard output. */ 98 static inline void do_putchar(c onst char c)98 static inline void do_putchar(char c) 99 99 { 100 100 /* Repeat until the buffer is non-full */ … … 104 104 105 105 /** Write a single character to the standard output. */ 106 static void niagara_put char(outdev_t *dev, constwchar_t ch)106 static void niagara_putwchar(outdev_t *dev, wchar_t ch) 107 107 { 108 108 if ((!outbuf_parea.mapped) || (console_override)) { 109 do_putchar(ch); 110 if (ch == '\n') 111 do_putchar('\r'); 109 if (ascii_check(ch)) { 110 do_putchar(ch); 111 if (ch == '\n') 112 do_putchar('\r'); 113 } else { 114 do_putchar('?'); 115 } 112 116 } 113 117 } -
kernel/genarch/src/drivers/dsrln/dsrlnout.c
ra57fa32 red88c8e 49 49 } dsrlnout_instance_t; 50 50 51 static void dsrlnout_put char(outdev_t *dev, const wchar_t ch)51 static void dsrlnout_putwchar(outdev_t *dev, const wchar_t ch) 52 52 { 53 53 dsrlnout_instance_t *instance = (dsrlnout_instance_t *) dev->data; … … 62 62 63 63 static outdev_operations_t dsrlndev_ops = { 64 .write = dsrlnout_put char,64 .write = dsrlnout_putwchar, 65 65 .redraw = NULL, 66 66 .scroll_up = NULL, -
kernel/genarch/src/drivers/ega/ega.c
ra57fa32 red88c8e 72 72 } ega_instance_t; 73 73 74 static void ega_put char(outdev_t *, wchar_t);74 static void ega_putwchar(outdev_t *, wchar_t); 75 75 static void ega_redraw(outdev_t *); 76 76 77 77 static outdev_operations_t egadev_ops = { 78 .write = ega_put char,78 .write = ega_putwchar, 79 79 .redraw = ega_redraw, 80 80 .scroll_up = NULL, … … 516 516 } 517 517 518 static void ega_display_ char(ega_instance_t *instance, wchar_t ch)518 static void ega_display_wchar(ega_instance_t *instance, wchar_t ch) 519 519 { 520 520 uint16_t index = ega_oem_glyph(ch); … … 539 539 } 540 540 541 static void ega_put char(outdev_t *dev, wchar_t ch)541 static void ega_putwchar(outdev_t *dev, wchar_t ch) 542 542 { 543 543 ega_instance_t *instance = (ega_instance_t *) dev->data; … … 559 559 break; 560 560 default: 561 ega_display_ char(instance, ch);561 ega_display_wchar(instance, ch); 562 562 instance->cursor++; 563 563 break; -
kernel/genarch/src/drivers/ns16550/ns16550.c
ra57fa32 red88c8e 92 92 } 93 93 94 static void ns16550_put char(outdev_t *dev, wchar_t ch)94 static void ns16550_putwchar(outdev_t *dev, wchar_t ch) 95 95 { 96 96 ns16550_instance_t *instance = (ns16550_instance_t *) dev->data; … … 105 105 106 106 static outdev_operations_t ns16550_ops = { 107 .write = ns16550_put char,107 .write = ns16550_putwchar, 108 108 .redraw = NULL 109 109 }; -
kernel/genarch/src/drivers/omap/uart.c
ra57fa32 red88c8e 49 49 } 50 50 51 static void omap_uart_put char(outdev_t *dev, wchar_t ch)51 static void omap_uart_putwchar(outdev_t *dev, wchar_t ch) 52 52 { 53 53 omap_uart_t *uart = dev->data; … … 62 62 63 63 static outdev_operations_t omap_uart_ops = { 64 .write = omap_uart_put char,64 .write = omap_uart_putwchar, 65 65 .redraw = NULL, 66 66 .scroll_up = NULL, -
kernel/genarch/src/drivers/pl011/pl011.c
ra57fa32 red88c8e 56 56 } 57 57 58 static void pl011_uart_put char(outdev_t *dev, wchar_t ch)58 static void pl011_uart_putwchar(outdev_t *dev, wchar_t ch) 59 59 { 60 60 pl011_uart_t *uart = dev->data; … … 70 70 71 71 static outdev_operations_t pl011_uart_ops = { 72 .write = pl011_uart_put char,72 .write = pl011_uart_putwchar, 73 73 .redraw = NULL, 74 74 .scroll_up = NULL, -
kernel/genarch/src/drivers/s3c24xx/uart.c
ra57fa32 red88c8e 61 61 } 62 62 63 static void s3c24xx_uart_put char(outdev_t *dev, wchar_t ch)63 static void s3c24xx_uart_putwchar(outdev_t *dev, wchar_t ch) 64 64 { 65 65 s3c24xx_uart_t *uart = … … 94 94 95 95 static outdev_operations_t s3c24xx_uart_ops = { 96 .write = s3c24xx_uart_put char,96 .write = s3c24xx_uart_putwchar, 97 97 .redraw = NULL, 98 98 .scroll_up = NULL, -
kernel/genarch/src/fb/fb.c
ra57fa32 red88c8e 122 122 } fb_instance_t; 123 123 124 static void fb_put char(outdev_t *, wchar_t);124 static void fb_putwchar(outdev_t *, wchar_t); 125 125 static void fb_redraw(outdev_t *); 126 126 static void fb_scroll_up(outdev_t *); … … 128 128 129 129 static outdev_operations_t fbdev_ops = { 130 .write = fb_put char,130 .write = fb_putwchar, 131 131 .redraw = fb_redraw, 132 132 .scroll_up = fb_scroll_up, … … 410 410 * 411 411 */ 412 static void fb_put char(outdev_t *dev, wchar_t ch)412 static void fb_putwchar(outdev_t *dev, wchar_t ch) 413 413 { 414 414 fb_instance_t *instance = (fb_instance_t *) dev->data; -
kernel/generic/include/console/console.h
ra57fa32 red88c8e 57 57 extern outdev_t *stdout; 58 58 59 extern void early_put char(wchar_t);59 extern void early_putwchar(wchar_t); 60 60 61 61 extern indev_t *stdin_wire(void); -
kernel/generic/include/putchar.h
ra57fa32 red88c8e 36 36 #define KERN_PUTCHAR_H_ 37 37 38 extern void putchar(const wchar_t ch); 38 #include <stddef.h> 39 40 extern void putwchar(wchar_t); 39 41 40 42 #endif -
kernel/generic/src/console/console.c
ra57fa32 red88c8e 262 262 if (count > 0) { 263 263 /* Space, backspace, space */ 264 put char('\b');265 put char(' ');266 put char('\b');264 putwchar('\b'); 265 putwchar(' '); 266 putwchar('\b'); 267 267 268 268 count--; … … 273 273 274 274 if (chr_encode(ch, buf, &offset, buflen - 1) == EOK) { 275 put char(ch);275 putwchar(ch); 276 276 count++; 277 277 buf[offset] = 0; … … 286 286 { 287 287 wchar_t ch = indev_pop_character(indev); 288 put char(ch);288 putwchar(ch); 289 289 return ch; 290 290 } … … 356 356 } 357 357 358 void put char(const wchar_t ch)358 void putwchar(const wchar_t ch) 359 359 { 360 360 bool ordy = ((stdout) && (stdout->op->write)); … … 373 373 * for possible future output. 374 374 * 375 * The early_put char() function is used to output375 * The early_putwchar() function is used to output 376 376 * the character for low-level debugging purposes. 377 377 * Note that the early_putc() function might be 378 378 * a no-op on certain hardware configurations. 379 379 */ 380 early_put char(ch);380 early_putwchar(ch); 381 381 } 382 382 -
kernel/generic/src/console/kconsole.c
ra57fa32 red88c8e 160 160 size_t i; 161 161 for (i = 0; i < count; i++) 162 put char(ch);162 putwchar(ch); 163 163 } 164 164 … … 339 339 if (ch == '\n') { 340 340 /* Enter */ 341 put char(ch);341 putwchar(ch); 342 342 break; 343 343 } … … 350 350 if (wstr_remove(current, position - 1)) { 351 351 position--; 352 put char('\b');352 putwchar('\b'); 353 353 printf("%ls ", current + position); 354 354 print_cc('\b', wstr_length(current) - position + 1); … … 363 363 for (; (current[position] != 0) && (!isspace(current[position])); 364 364 position++) 365 put char(current[position]);365 putwchar(current[position]); 366 366 367 367 … … 459 459 /* Left */ 460 460 if (position > 0) { 461 put char('\b');461 putwchar('\b'); 462 462 position--; 463 463 } … … 468 468 /* Right */ 469 469 if (position < wstr_length(current)) { 470 put char(current[position]);470 putwchar(current[position]); 471 471 position++; 472 472 } -
kernel/generic/src/printf/vprintf.c
ra57fa32 red88c8e 47 47 48 48 while (offset < size) { 49 put char(str_decode(str, &offset, size));49 putwchar(str_decode(str, &offset, size)); 50 50 chars++; 51 51 } … … 60 60 61 61 while (offset < size) { 62 put char(str[chars]);62 putwchar(str[chars]); 63 63 chars++; 64 64 offset += sizeof(wchar_t); … … 75 75 76 76 while ((uc = str_decode(str, &offset, STR_NO_LIMIT)) != 0) { 77 put char(uc);77 putwchar(uc); 78 78 chars++; 79 79 } 80 80 81 put char('\n');81 putwchar('\n'); 82 82 return chars; 83 83 } -
uspace/app/bdsh/cmds/modules/cat/cat.c
ra57fa32 red88c8e 160 160 printf("%6u ", lineno); 161 161 } 162 put char(c);162 putwchar(c); 163 163 last_char_was_newline = c == '\n'; 164 164 if (paging_enabled) { -
uspace/app/bdsh/cmds/modules/printf/printf.c
ra57fa32 red88c8e 172 172 break; 173 173 } 174 put char(ch);174 putwchar(ch); 175 175 break; 176 176 177 177 emit: 178 put char(ch);178 putwchar(ch); 179 179 esc_flag = false; 180 180 } -
uspace/app/edit/edit.c
ra57fa32 red88c8e 671 671 default: 672 672 if (kev->c >= 32 && nc < max_len) { 673 put char(kev->c);673 putwchar(kev->c); 674 674 console_flush(con); 675 675 buffer[nc++] = kev->c; -
uspace/app/kio/kio.c
ra57fa32 red88c8e 122 122 123 123 for (size_t i = 0; i < item->length; i++) 124 put char(item->data[i]);124 putwchar(item->data[i]); 125 125 126 126 if (log != NULL) { 127 127 for (size_t i = 0; i < item->length; i++) 128 fput c(item->data[i], log);128 fputwc(item->data[i], log); 129 129 130 130 fflush(log); -
uspace/dist/src/c/demos/edit/edit.c
ra57fa32 red88c8e 671 671 default: 672 672 if (kev->c >= 32 && nc < max_len) { 673 put char(kev->c);673 putwchar(kev->c); 674 674 console_flush(con); 675 675 buffer[nc++] = kev->c; -
uspace/lib/c/generic/io/chargrid.c
ra57fa32 red88c8e 140 140 * 141 141 */ 142 sysarg_t chargrid_put char(chargrid_t *scrbuf, wchar_t ch, bool update)142 sysarg_t chargrid_putwchar(chargrid_t *scrbuf, wchar_t ch, bool update) 143 143 { 144 144 assert(scrbuf->col < scrbuf->cols); … … 199 199 200 200 for (sysarg_t i = 0; i < spaces; i++) 201 flush += chargrid_put char(scrbuf, ' ', true) - 1;201 flush += chargrid_putwchar(scrbuf, ' ', true) - 1; 202 202 203 203 return flush; … … 228 228 scrbuf->row--; 229 229 230 chargrid_put char(scrbuf, ' ', false);230 chargrid_putwchar(scrbuf, ' ', false); 231 231 return 2; 232 232 } 233 233 234 234 scrbuf->col--; 235 chargrid_put char(scrbuf, ' ', false);235 chargrid_putwchar(scrbuf, ' ', false); 236 236 return 1; 237 237 } -
uspace/lib/c/generic/io/io.c
ra57fa32 red88c8e 46 46 #include <ipc/loc.h> 47 47 #include <adt/list.h> 48 #include <wchar.h> 48 49 #include "../private/io.h" 49 50 #include "../private/stdio.h" … … 702 703 } 703 704 704 int fputc(wchar_tc, FILE *stream)705 wint_t fputwc(wchar_t wc, FILE *stream) 705 706 { 706 707 char buf[STR_BOUNDS(1)]; 707 708 size_t sz = 0; 708 709 709 if (chr_encode(c, buf, &sz, STR_BOUNDS(1)) == EOK) { 710 size_t wr = fwrite(buf, 1, sz, stream); 711 712 if (wr < sz) 713 return EOF; 714 715 return (int) c; 716 } 717 718 return EOF; 719 } 720 721 int putchar(wchar_t c) 710 if (chr_encode(wc, buf, &sz, STR_BOUNDS(1)) != EOK) { 711 errno = EILSEQ; 712 return WEOF; 713 } 714 715 size_t wr = fwrite(buf, 1, sz, stream); 716 if (wr < sz) 717 return WEOF; 718 719 return wc; 720 } 721 722 wint_t putwchar(wchar_t wc) 723 { 724 return fputwc(wc, stdout); 725 } 726 727 int fputc(int c, FILE *stream) 728 { 729 unsigned char b; 730 size_t wr; 731 732 b = (unsigned char) c; 733 wr = fwrite(&b, sizeof(b), 1, stream); 734 if (wr < 1) 735 return EOF; 736 737 return b; 738 } 739 740 int putchar(int c) 722 741 { 723 742 return fputc(c, stdout); -
uspace/lib/c/generic/io/vprintf.c
ra57fa32 red88c8e 54 54 55 55 while (offset < size) { 56 if (fput c(str[chars], (FILE *) stream) <= 0)56 if (fputwc(str[chars], (FILE *) stream) <= 0) 57 57 break; 58 58 -
uspace/lib/c/include/io/chargrid.h
ra57fa32 red88c8e 79 79 extern sysarg_t chargrid_get_top_row(chargrid_t *); 80 80 81 extern sysarg_t chargrid_put char(chargrid_t *, wchar_t, bool);81 extern sysarg_t chargrid_putwchar(chargrid_t *, wchar_t, bool); 82 82 extern sysarg_t chargrid_newline(chargrid_t *); 83 83 extern sysarg_t chargrid_tabstop(chargrid_t *, sysarg_t); -
uspace/lib/c/include/stdio.h
ra57fa32 red88c8e 40 40 #include <_bits/size_t.h> 41 41 #include <_bits/wchar_t.h> 42 #include <_bits/wint_t.h> 42 43 43 44 #define EOF (-1) … … 73 74 74 75 /* Character and string output functions */ 75 extern int fputc( wchar_t, FILE *);76 extern int fputc(int, FILE *); 76 77 extern int fputs(const char *, FILE *); 77 78 78 // FIXME: putchar and fputc are byte-oriented. 79 // They shouldn't accept wide characters. 80 extern int putchar(wchar_t); 79 extern int putchar(int); 81 80 extern int puts(const char *); 82 81 83 82 extern int ungetc(int, FILE *); 83 84 extern wint_t fputwc(wchar_t, FILE *); 85 extern wint_t putwchar(wchar_t); 84 86 85 87 /* Formatted string output functions */ -
uspace/lib/c/include/wchar.h
ra57fa32 red88c8e 44 44 #include <_bits/wchar_t.h> 45 45 #include <_bits/wint_t.h> 46 #include <_bits/WEOF.h> 46 47 47 48 #include <_bits/NULL.h> -
uspace/lib/clui/tinput.c
ra57fa32 red88c8e 145 145 146 146 for (p = 0; p < pad; p++) 147 put char(' ');147 putwchar(' '); 148 148 149 149 console_flush(ti->console); … … 182 182 tinput_console_set_lpos(ti, ti->text_coord + ti->nc); 183 183 console_flush(ti->console); 184 put char('\n');184 putwchar('\n'); 185 185 } 186 186 -
uspace/lib/fmtutil/fmtutil.c
ra57fa32 red88c8e 95 95 for (i = 0; i < width; i++) { 96 96 if (i < len) 97 put char(wstr[i]);97 putwchar(wstr[i]); 98 98 else 99 put char(' ');99 putwchar(' '); 100 100 } 101 101 } else if (mode == ALIGN_RIGHT) { 102 102 for (i = 0; i < width; i++) { 103 103 if (i < width - len) 104 put char(' ');104 putwchar(' '); 105 105 else 106 put char(wstr[i - (width - len)]);106 putwchar(wstr[i - (width - len)]); 107 107 } 108 108 } else if (mode == ALIGN_CENTER) { … … 110 110 for (i = 0; i < width; i++) { 111 111 if ((i < padding) || ((i - padding) >= len)) 112 put char(' ');112 putwchar(' '); 113 113 else 114 put char(wstr[i - padding]);114 putwchar(wstr[i - padding]); 115 115 } 116 116 } else if (mode == ALIGN_JUSTIFY) { … … 146 146 (words - 1))); 147 147 for (j = 0; j < spaces; j++) { 148 put char(' ');148 putwchar(' '); 149 149 } 150 150 done_chars += spaces; 151 151 } 152 152 while (i < len && wstr[i] != ' ') { 153 put char(wstr[i++]);153 putwchar(wstr[i++]); 154 154 done_chars++; 155 155 } … … 158 158 skip_words: 159 159 while (done_chars < width) { 160 put char(' ');160 putwchar(' '); 161 161 done_chars++; 162 162 } -
uspace/lib/gui/terminal.c
ra57fa32 red88c8e 456 456 break; 457 457 default: 458 updated = chargrid_put char(term->frontbuf, ch, true);458 updated = chargrid_putwchar(term->frontbuf, ch, true); 459 459 } 460 460 -
uspace/lib/posix/include/posix/stdio.h
ra57fa32 red88c8e 75 75 extern char *gets(char *, size_t); 76 76 77 extern int fputc( wchar_t, FILE *);77 extern int fputc(int, FILE *); 78 78 extern int fputs(const char *, FILE *); 79 79 80 extern int putchar( wchar_t);80 extern int putchar(int); 81 81 extern int puts(const char *); 82 82 -
uspace/srv/hid/console/console.c
ra57fa32 red88c8e 311 311 break; 312 312 default: 313 updated = chargrid_put char(cons->frontbuf, ch, true);313 updated = chargrid_putwchar(cons->frontbuf, ch, true); 314 314 } 315 315 -
uspace/srv/hid/output/ctl/serial.c
ra57fa32 red88c8e 57 57 vt100_goto(state, col, row); 58 58 vt100_set_attr(state, field->attrs); 59 vt100_put char(state, field->ch);59 vt100_putwchar(state, field->ch); 60 60 } 61 61 … … 122 122 }; 123 123 124 errno_t serial_init(vt100_put char_t putchar_fn,124 errno_t serial_init(vt100_putwchar_t putwchar_fn, 125 125 vt100_control_puts_t control_puts_fn, vt100_flush_t flush_fn) 126 126 { 127 127 vt100_state_t *state = 128 vt100_state_create(SERIAL_COLS, SERIAL_ROWS, put char_fn,128 vt100_state_create(SERIAL_COLS, SERIAL_ROWS, putwchar_fn, 129 129 control_puts_fn, flush_fn); 130 130 if (state == NULL) -
uspace/srv/hid/output/ctl/serial.h
ra57fa32 red88c8e 36 36 #include "../proto/vt100.h" 37 37 38 extern errno_t serial_init(vt100_put char_t, vt100_control_puts_t, vt100_flush_t);38 extern errno_t serial_init(vt100_putwchar_t, vt100_control_puts_t, vt100_flush_t); 39 39 40 40 #endif -
uspace/srv/hid/output/port/chardev.c
ra57fa32 red88c8e 77 77 } 78 78 79 static void chardev_put char(wchar_t ch)79 static void chardev_putwchar(wchar_t ch) 80 80 { 81 81 if (chardev_bused == chardev_buf_size) … … 92 92 p = str; 93 93 while (*p != '\0') 94 chardev_put char(*p++);94 chardev_putwchar(*p++); 95 95 } 96 96 … … 198 198 } 199 199 200 serial_init(chardev_put char, chardev_control_puts, chardev_flush);200 serial_init(chardev_putwchar, chardev_control_puts, chardev_flush); 201 201 202 202 discovery_finished = true; -
uspace/srv/hid/output/proto/vt100.c
ra57fa32 red88c8e 139 139 140 140 vt100_state_t *vt100_state_create(sysarg_t cols, sysarg_t rows, 141 vt100_put char_t putchar_fn, vt100_control_puts_t control_puts_fn,141 vt100_putwchar_t putwchar_fn, vt100_control_puts_t control_puts_fn, 142 142 vt100_flush_t flush_fn) 143 143 { … … 146 146 return NULL; 147 147 148 state->put char = putchar_fn;148 state->putwchar = putwchar_fn; 149 149 state->control_puts = control_puts_fn; 150 150 state->flush = flush_fn; … … 219 219 } 220 220 221 void vt100_put char(vt100_state_t *state, wchar_t ch)222 { 223 state->put char(ch == 0 ? ' ' : ch);221 void vt100_putwchar(vt100_state_t *state, wchar_t ch) 222 { 223 state->putwchar(ch == 0 ? ' ' : ch); 224 224 state->cur_col++; 225 225 -
uspace/srv/hid/output/proto/vt100.h
ra57fa32 red88c8e 35 35 #include <io/charfield.h> 36 36 37 typedef void (*vt100_put char_t)(wchar_t ch);37 typedef void (*vt100_putwchar_t)(wchar_t ch); 38 38 typedef void (*vt100_control_puts_t)(const char *str); 39 39 typedef void (*vt100_flush_t)(void); … … 47 47 char_attrs_t cur_attrs; 48 48 49 vt100_put char_t putchar;49 vt100_putwchar_t putwchar; 50 50 vt100_control_puts_t control_puts; 51 51 vt100_flush_t flush; 52 52 } vt100_state_t; 53 53 54 extern vt100_state_t *vt100_state_create(sysarg_t, sysarg_t, vt100_put char_t,54 extern vt100_state_t *vt100_state_create(sysarg_t, sysarg_t, vt100_putwchar_t, 55 55 vt100_control_puts_t, vt100_flush_t); 56 56 extern void vt100_state_destroy(vt100_state_t *); … … 63 63 extern void vt100_set_attr(vt100_state_t *, char_attrs_t); 64 64 extern void vt100_cursor_visibility(vt100_state_t *, bool); 65 extern void vt100_put char(vt100_state_t *, wchar_t);65 extern void vt100_putwchar(vt100_state_t *, wchar_t); 66 66 extern void vt100_flush(vt100_state_t *); 67 67
Note:
See TracChangeset
for help on using the changeset viewer.