Changeset ed88c8e in mainline


Ignore:
Timestamp:
2018-05-29T13:25:07Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
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)
Message:

fputc, putchar vs. fputwc, putwchar.

Files:
59 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/arm32/src/putchar.c

    ra57fa32 red88c8e  
    195195 * @param ch    Character to display
    196196 */
    197 void putchar(const wchar_t ch)
     197void putwchar(const wchar_t ch)
    198198{
    199199        if (ch == '\n')
     
    203203                scons_sendb((uint8_t) ch);
    204204        else
    205                 scons_sendb(U_SPECIAL);
     205                scons_sendb('?');
    206206}
    207207
  • boot/arch/ia64/include/arch/ski.h

    ra57fa32 red88c8e  
    3030#define BOOT_ia64_SKI_H_
    3131
    32 #include <stddef.h>
    33 #include <str.h>
    34 
    35 extern void ski_putchar(const wchar_t);
     32extern void ski_putchar(char);
    3633
    3734#endif
  • boot/arch/ia64/src/putchar.c

    ra57fa32 red88c8e  
    3333#include <arch/ski.h>
    3434
    35 void putchar(const wchar_t ch)
     35void putwchar(const wchar_t ch)
    3636{
    3737#ifdef MACHINE_ski
     
    3939                ski_putchar(ch);
    4040        else
    41                 ski_putchar(U_SPECIAL);
     41                ski_putchar('?');
    4242#endif
    4343}
  • boot/arch/ia64/src/ski.c

    ra57fa32 red88c8e  
    5252}
    5353
    54 void ski_putchar(const wchar_t ch)
     54void ski_putchar(char ch)
    5555{
    5656        ski_console_init();
  • boot/arch/mips32/src/putchar.c

    ra57fa32 red88c8e  
    3939#if defined(MACHINE_msim)
    4040#define _putchar(ch)    msim_putchar((ch))
    41 static void msim_putchar(const wchar_t ch)
     41static void msim_putchar(char ch)
    4242{
    4343        *((char *) MSIM_VIDEORAM_ADDRESS) = ch;
     
    5151    (yamon_print_count_ptr_t) YAMON_SUBR_PRINT_COUNT;
    5252
    53 static void yamon_putchar(const wchar_t wch)
     53static void yamon_putchar(char ch)
    5454{
    55         const char ch = (char) wch;
    56 
    5755        (*yamon_print_count)(0, &ch, 1);
    5856}
    5957#endif
    6058
    61 void putchar(const wchar_t ch)
     59void putwchar(const wchar_t ch)
    6260{
    6361        if (ascii_check(ch))
    6462                _putchar(ch);
    6563        else
    66                 _putchar(U_SPECIAL);
     64                _putchar('?');
    6765}
    6866
  • boot/arch/ppc32/src/ofw.c

    ra57fa32 red88c8e  
    3939}
    4040
    41 void putchar(const wchar_t ch)
     41void putwchar(wchar_t ch)
    4242{
    4343        if (ch == '\n')
     
    4747                ofw_putchar(ch);
    4848        else
    49                 ofw_putchar(U_SPECIAL);
     49                ofw_putchar('?');
    5050}
  • boot/arch/riscv64/src/putchar.c

    ra57fa32 red88c8e  
    3333#include <arch/ucb.h>
    3434
    35 void putchar(const wchar_t ch)
     35void putwchar(wchar_t ch)
    3636{
    3737        if (ascii_check(ch))
    3838                htif_cmd(HTIF_DEVICE_CONSOLE, HTIF_CONSOLE_PUTC, ch);
    3939        else
    40                 htif_cmd(HTIF_DEVICE_CONSOLE, HTIF_CONSOLE_PUTC, U_SPECIAL);
     40                htif_cmd(HTIF_DEVICE_CONSOLE, HTIF_CONSOLE_PUTC, '?');
    4141}
  • boot/arch/sparc64/src/ofw.c

    ra57fa32 red88c8e  
    4343#include <str.h>
    4444
    45 void putchar(const wchar_t ch)
     45void putwchar(wchar_t ch)
    4646{
    4747        if (ch == '\n')
     
    5151                ofw_putchar(ch);
    5252        else
    53                 ofw_putchar(U_SPECIAL);
     53                ofw_putchar('?');
    5454}
    5555
  • boot/genarch/include/genarch/ofw.h

    ra57fa32 red88c8e  
    8989extern void ofw_init(void);
    9090
    91 extern void ofw_putchar(const char);
     91extern void ofw_putchar(char);
    9292
    9393extern ofw_arg_t ofw_get_property(const phandle, const char *, void *,
  • boot/genarch/src/ofw.c

    ra57fa32 red88c8e  
    194194}
    195195
    196 void ofw_putchar(const char ch)
     196void ofw_putchar(char ch)
    197197{
    198198        if (ofw_stdout == 0)
  • boot/generic/include/putchar.h

    ra57fa32 red88c8e  
    3838#include <stddef.h>
    3939
    40 extern void putchar(const wchar_t);
     40extern void putwchar(wchar_t);
    4141
    4242#endif
  • boot/generic/src/vprintf.c

    ra57fa32 red88c8e  
    4242
    4343        while (offset < size) {
    44                 putchar(str_decode(str, &offset, size));
     44                putwchar(str_decode(str, &offset, size));
    4545                chars++;
    4646        }
     
    5656
    5757        while ((uc = str_decode(str, &offset, STR_NO_LIMIT)) != 0) {
    58                 putchar(uc);
     58                putwchar(uc);
    5959                chars++;
    6060        }
    6161
    62         putchar('\n');
     62        putwchar('\n');
    6363        return chars;
    6464}
  • kernel/arch/abs32le/src/abs32le.c

    ra57fa32 red88c8e  
    136136}
    137137
    138 void early_putchar(wchar_t ch)
     138void early_putwchar(wchar_t ch)
    139139{
    140140}
  • kernel/arch/amd64/src/asm.S

    ra57fa32 red88c8e  
    412412 *
    413413 */
    414 FUNCTION_BEGIN(early_putchar)
     414FUNCTION_BEGIN(early_putwchar)
    415415#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
    416416
     
    443443        /* Sanity check for the cursor on screen */
    444444        cmp $2000, %ax
    445         jb early_putchar_cursor_ok
     445        jb early_putwchar_cursor_ok
    446446
    447447                movw $1998, %ax
    448448
    449         early_putchar_cursor_ok:
     449        early_putwchar_cursor_ok:
    450450
    451451        movw %ax, %bx
     
    456456
    457457        cmp $0x0a, %al
    458         jne early_putchar_backspace
     458        jne early_putwchar_backspace
    459459
    460460                /* Interpret newline */
     
    470470                subw %dx, %bx
    471471
    472                 jmp early_putchar_skip
    473 
    474         early_putchar_backspace:
     472                jmp early_putwchar_skip
     473
     474        early_putwchar_backspace:
    475475
    476476                cmp $0x08, %al
    477                 jne early_putchar_print
     477                jne early_putwchar_print
    478478
    479479                /* Interpret backspace */
    480480
    481481                cmp $0x0000, %bx
    482                 je early_putchar_skip
     482                je early_putwchar_skip
    483483
    484484                dec %bx
    485                 jmp early_putchar_skip
    486 
    487         early_putchar_print:
     485                jmp early_putwchar_skip
     486
     487        early_putwchar_print:
    488488
    489489                /* Print character */
     
    493493                inc %bx
    494494
    495         early_putchar_skip:
     495        early_putwchar_skip:
    496496
    497497        /* Sanity check for the cursor on the last line */
    498498        cmp $2000, %bx
    499         jb early_putchar_no_scroll
     499        jb early_putwchar_no_scroll
    500500
    501501                /* Scroll the screen (24 rows) */
     
    513513                movw $1920, %bx
    514514
    515         early_putchar_no_scroll:
     515        early_putwchar_no_scroll:
    516516
    517517        /* Write bits 8 - 15 of the cursor address */
     
    540540
    541541        ret
    542 FUNCTION_END(early_putchar)
     542FUNCTION_END(early_putwchar)
  • kernel/arch/arm32/src/asm.S

    ra57fa32 red88c8e  
    9898        ldmia sp!, {r4, r5, pc}
    9999
    100 FUNCTION_BEGIN(early_putchar)
     100FUNCTION_BEGIN(early_putwchar)
    101101        mov pc, lr
    102 FUNCTION_END(early_putchar)
     102FUNCTION_END(early_putwchar)
  • kernel/arch/ia32/src/asm.S

    ra57fa32 red88c8e  
    451451 *
    452452 */
    453 FUNCTION_BEGIN(early_putchar)
     453FUNCTION_BEGIN(early_putwchar)
    454454
    455455#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
     
    484484        /* Sanity check for the cursor on screen */
    485485        cmp $2000, %ax
    486         jb early_putchar_cursor_ok
     486        jb early_putwchar_cursor_ok
    487487
    488488                movw $1998, %ax
    489489
    490         early_putchar_cursor_ok:
     490        early_putwchar_cursor_ok:
    491491
    492492        movw %ax, %bx
     
    497497
    498498        cmp $0x0a, %al
    499         jne early_putchar_backspace
     499        jne early_putwchar_backspace
    500500
    501501                /* Interpret newline */
     
    511511                subw %dx, %bx
    512512
    513                 jmp early_putchar_skip
    514 
    515         early_putchar_backspace:
     513                jmp early_putwchar_skip
     514
     515        early_putwchar_backspace:
    516516
    517517                cmp $0x08, %al
    518                 jne early_putchar_print
     518                jne early_putwchar_print
    519519
    520520                /* Interpret backspace */
    521521
    522522                cmp $0x0000, %bx
    523                 je early_putchar_skip
     523                je early_putwchar_skip
    524524
    525525                dec %bx
    526                 jmp early_putchar_skip
    527 
    528         early_putchar_print:
     526                jmp early_putwchar_skip
     527
     528        early_putwchar_print:
    529529
    530530                /* Print character */
     
    534534                inc %bx
    535535
    536         early_putchar_skip:
     536        early_putwchar_skip:
    537537
    538538        /* Sanity check for the cursor on the last line */
    539539        cmp $2000, %bx
    540         jb early_putchar_no_scroll
     540        jb early_putwchar_no_scroll
    541541
    542542                /* Scroll the screen (24 rows) */
     
    554554                movw $1920, %bx
    555555
    556         early_putchar_no_scroll:
     556        early_putwchar_no_scroll:
    557557
    558558        /* Write bits 8 - 15 of the cursor address */
     
    583583
    584584        ret
    585 FUNCTION_END(early_putchar)
    586 
     585FUNCTION_END(early_putwchar)
     586
  • kernel/arch/ia64/src/asm.S

    ra57fa32 red88c8e  
    191191FUNCTION_END(switch_to_userspace)
    192192
    193 FUNCTION_BEGIN(early_putchar)
     193FUNCTION_BEGIN(early_putwchar)
    194194        br.ret.sptk.many b0
    195 FUNCTION_END(early_putchar)
     195FUNCTION_END(early_putwchar)
  • kernel/arch/ia64/src/drivers/ski.c

    ra57fa32 red88c8e  
    5858};
    5959
    60 static void ski_putchar(outdev_t *, const wchar_t);
     60static void ski_putwchar(outdev_t *, const wchar_t);
    6161
    6262static outdev_operations_t skidev_ops = {
    63         .write = ski_putchar,
     63        .write = ski_putwchar,
    6464        .redraw = NULL,
    6565        .scroll_up = NULL,
     
    166166}
    167167
    168 static void ski_do_putchar(const wchar_t ch)
     168static void ski_do_putchar(char ch)
    169169{
    170170        asm volatile (
     
    187187 *
    188188 */
    189 static void ski_putchar(outdev_t *dev, const wchar_t ch)
     189static void ski_putwchar(outdev_t *dev, wchar_t ch)
    190190{
    191191        // TODO FIXME:
     
    198198
    199199                        ski_do_putchar(ch);
    200                 } else
    201                         ski_do_putchar(U_SPECIAL);
     200                } else {
     201                        ski_do_putchar('?');
     202                }
    202203        }
    203204}
  • kernel/arch/mips32/src/asm.S

    ra57fa32 red88c8e  
    296296FUNCTION_END(fpu_context_restore)
    297297
    298 FUNCTION_BEGIN(early_putchar)
     298FUNCTION_BEGIN(early_putwchar)
    299299        j $ra
    300300        nop
    301 FUNCTION_END(early_putchar)
     301FUNCTION_END(early_putwchar)
  • kernel/arch/mips32/src/mach/malta/malta.c

    ra57fa32 red88c8e  
    8181    (yamon_print_count_ptr_t) YAMON_SUBR_PRINT_COUNT;
    8282
    83 static void yamon_putchar(outdev_t *dev, const wchar_t wch)
     83static void yamon_putwchar(outdev_t *dev, const wchar_t wch)
    8484{
    8585
     
    9191static outdev_t yamon_outdev;
    9292static outdev_operations_t yamon_outdev_ops = {
    93         .write = yamon_putchar,
     93        .write = yamon_putwchar,
    9494        .redraw = NULL,
    9595        .scroll_up = NULL,
  • kernel/arch/ppc32/src/asm.S

    ra57fa32 red88c8e  
    265265        blr
    266266
    267 FUNCTION_BEGIN(early_putchar)
     267FUNCTION_BEGIN(early_putwchar)
    268268        blr
    269 FUNCTION_END(early_putchar)
     269FUNCTION_END(early_putwchar)
  • kernel/arch/riscv64/include/arch/drivers/ucb.h

    ra57fa32 red88c8e  
    4242extern void htif_init(volatile uint64_t *, volatile uint64_t *);
    4343extern outdev_t *htifout_init(void);
    44 extern void htif_putchar(outdev_t *, const wchar_t);
     44extern void htif_putwchar(outdev_t *, const wchar_t);
    4545
    4646#endif
  • kernel/arch/riscv64/src/asm.S

    ra57fa32 red88c8e  
    3535FUNCTION_END(asm_delay_loop)
    3636
    37 FUNCTION_BEGIN(early_putchar)
     37FUNCTION_BEGIN(early_putwchar)
    3838        ret
    39 FUNCTION_END(early_putchar)
     39FUNCTION_END(early_putwchar)
    4040
    4141FUNCTION_BEGIN(cpu_halt)
  • kernel/arch/riscv64/src/drivers/ucb.c

    ra57fa32 red88c8e  
    4242
    4343static outdev_operations_t htifdev_ops = {
    44         .write = htif_putchar,
     44        .write = htif_putwchar,
    4545        .redraw = NULL,
    4646        .scroll_up = NULL,
     
    8585}
    8686
    87 void htif_putchar(outdev_t *dev, const wchar_t ch)
     87void htif_putwchar(outdev_t *dev, const wchar_t ch)
    8888{
    8989        if (ascii_check(ch))
  • kernel/arch/sparc64/src/asm.S

    ra57fa32 red88c8e  
    189189        mov %g0, %o0  /* return 0 on failure */
    190190
    191 FUNCTION_BEGIN(early_putchar)
     191FUNCTION_BEGIN(early_putwchar)
    192192        retl
    193193        nop
    194 FUNCTION_END(early_putchar)
     194FUNCTION_END(early_putwchar)
  • kernel/arch/sparc64/src/drivers/niagara.c

    ra57fa32 red88c8e  
    5858static niagara_instance_t *instance = NULL;
    5959
    60 static void niagara_putchar(outdev_t *, const wchar_t);
     60static void niagara_putwchar(outdev_t *, const wchar_t);
    6161
    6262/** Character device operations */
    6363static outdev_operations_t niagara_ops = {
    64         .write = niagara_putchar,
     64        .write = niagara_putwchar,
    6565        .redraw = NULL,
    6666        .scroll_up = NULL,
     
    9696
    9797/** Write a single character to the standard output. */
    98 static inline void do_putchar(const char c)
     98static inline void do_putchar(char c)
    9999{
    100100        /* Repeat until the buffer is non-full */
     
    104104
    105105/** Write a single character to the standard output. */
    106 static void niagara_putchar(outdev_t *dev, const wchar_t ch)
     106static void niagara_putwchar(outdev_t *dev, wchar_t ch)
    107107{
    108108        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                }
    112116        }
    113117}
  • kernel/genarch/src/drivers/dsrln/dsrlnout.c

    ra57fa32 red88c8e  
    4949} dsrlnout_instance_t;
    5050
    51 static void dsrlnout_putchar(outdev_t *dev, const wchar_t ch)
     51static void dsrlnout_putwchar(outdev_t *dev, const wchar_t ch)
    5252{
    5353        dsrlnout_instance_t *instance = (dsrlnout_instance_t *) dev->data;
     
    6262
    6363static outdev_operations_t dsrlndev_ops = {
    64         .write = dsrlnout_putchar,
     64        .write = dsrlnout_putwchar,
    6565        .redraw = NULL,
    6666        .scroll_up = NULL,
  • kernel/genarch/src/drivers/ega/ega.c

    ra57fa32 red88c8e  
    7272} ega_instance_t;
    7373
    74 static void ega_putchar(outdev_t *, wchar_t);
     74static void ega_putwchar(outdev_t *, wchar_t);
    7575static void ega_redraw(outdev_t *);
    7676
    7777static outdev_operations_t egadev_ops = {
    78         .write = ega_putchar,
     78        .write = ega_putwchar,
    7979        .redraw = ega_redraw,
    8080        .scroll_up = NULL,
     
    516516}
    517517
    518 static void ega_display_char(ega_instance_t *instance, wchar_t ch)
     518static void ega_display_wchar(ega_instance_t *instance, wchar_t ch)
    519519{
    520520        uint16_t index = ega_oem_glyph(ch);
     
    539539}
    540540
    541 static void ega_putchar(outdev_t *dev, wchar_t ch)
     541static void ega_putwchar(outdev_t *dev, wchar_t ch)
    542542{
    543543        ega_instance_t *instance = (ega_instance_t *) dev->data;
     
    559559                break;
    560560        default:
    561                 ega_display_char(instance, ch);
     561                ega_display_wchar(instance, ch);
    562562                instance->cursor++;
    563563                break;
  • kernel/genarch/src/drivers/ns16550/ns16550.c

    ra57fa32 red88c8e  
    9292}
    9393
    94 static void ns16550_putchar(outdev_t *dev, wchar_t ch)
     94static void ns16550_putwchar(outdev_t *dev, wchar_t ch)
    9595{
    9696        ns16550_instance_t *instance = (ns16550_instance_t *) dev->data;
     
    105105
    106106static outdev_operations_t ns16550_ops = {
    107         .write = ns16550_putchar,
     107        .write = ns16550_putwchar,
    108108        .redraw = NULL
    109109};
  • kernel/genarch/src/drivers/omap/uart.c

    ra57fa32 red88c8e  
    4949}
    5050
    51 static void omap_uart_putchar(outdev_t *dev, wchar_t ch)
     51static void omap_uart_putwchar(outdev_t *dev, wchar_t ch)
    5252{
    5353        omap_uart_t *uart = dev->data;
     
    6262
    6363static outdev_operations_t omap_uart_ops = {
    64         .write = omap_uart_putchar,
     64        .write = omap_uart_putwchar,
    6565        .redraw = NULL,
    6666        .scroll_up = NULL,
  • kernel/genarch/src/drivers/pl011/pl011.c

    ra57fa32 red88c8e  
    5656}
    5757
    58 static void pl011_uart_putchar(outdev_t *dev, wchar_t ch)
     58static void pl011_uart_putwchar(outdev_t *dev, wchar_t ch)
    5959{
    6060        pl011_uart_t *uart = dev->data;
     
    7070
    7171static outdev_operations_t pl011_uart_ops = {
    72         .write = pl011_uart_putchar,
     72        .write = pl011_uart_putwchar,
    7373        .redraw = NULL,
    7474        .scroll_up = NULL,
  • kernel/genarch/src/drivers/s3c24xx/uart.c

    ra57fa32 red88c8e  
    6161}
    6262
    63 static void s3c24xx_uart_putchar(outdev_t *dev, wchar_t ch)
     63static void s3c24xx_uart_putwchar(outdev_t *dev, wchar_t ch)
    6464{
    6565        s3c24xx_uart_t *uart =
     
    9494
    9595static outdev_operations_t s3c24xx_uart_ops = {
    96         .write = s3c24xx_uart_putchar,
     96        .write = s3c24xx_uart_putwchar,
    9797        .redraw = NULL,
    9898        .scroll_up = NULL,
  • kernel/genarch/src/fb/fb.c

    ra57fa32 red88c8e  
    122122} fb_instance_t;
    123123
    124 static void fb_putchar(outdev_t *, wchar_t);
     124static void fb_putwchar(outdev_t *, wchar_t);
    125125static void fb_redraw(outdev_t *);
    126126static void fb_scroll_up(outdev_t *);
     
    128128
    129129static outdev_operations_t fbdev_ops = {
    130         .write = fb_putchar,
     130        .write = fb_putwchar,
    131131        .redraw = fb_redraw,
    132132        .scroll_up = fb_scroll_up,
     
    410410 *
    411411 */
    412 static void fb_putchar(outdev_t *dev, wchar_t ch)
     412static void fb_putwchar(outdev_t *dev, wchar_t ch)
    413413{
    414414        fb_instance_t *instance = (fb_instance_t *) dev->data;
  • kernel/generic/include/console/console.h

    ra57fa32 red88c8e  
    5757extern outdev_t *stdout;
    5858
    59 extern void early_putchar(wchar_t);
     59extern void early_putwchar(wchar_t);
    6060
    6161extern indev_t *stdin_wire(void);
  • kernel/generic/include/putchar.h

    ra57fa32 red88c8e  
    3636#define KERN_PUTCHAR_H_
    3737
    38 extern void putchar(const wchar_t ch);
     38#include <stddef.h>
     39
     40extern void putwchar(wchar_t);
    3941
    4042#endif
  • kernel/generic/src/console/console.c

    ra57fa32 red88c8e  
    262262                        if (count > 0) {
    263263                                /* Space, backspace, space */
    264                                 putchar('\b');
    265                                 putchar(' ');
    266                                 putchar('\b');
     264                                putwchar('\b');
     265                                putwchar(' ');
     266                                putwchar('\b');
    267267
    268268                                count--;
     
    273273
    274274                if (chr_encode(ch, buf, &offset, buflen - 1) == EOK) {
    275                         putchar(ch);
     275                        putwchar(ch);
    276276                        count++;
    277277                        buf[offset] = 0;
     
    286286{
    287287        wchar_t ch = indev_pop_character(indev);
    288         putchar(ch);
     288        putwchar(ch);
    289289        return ch;
    290290}
     
    356356}
    357357
    358 void putchar(const wchar_t ch)
     358void putwchar(const wchar_t ch)
    359359{
    360360        bool ordy = ((stdout) && (stdout->op->write));
     
    373373                 * for possible future output.
    374374                 *
    375                  * The early_putchar() function is used to output
     375                 * The early_putwchar() function is used to output
    376376                 * the character for low-level debugging purposes.
    377377                 * Note that the early_putc() function might be
    378378                 * a no-op on certain hardware configurations.
    379379                 */
    380                 early_putchar(ch);
     380                early_putwchar(ch);
    381381        }
    382382
  • kernel/generic/src/console/kconsole.c

    ra57fa32 red88c8e  
    160160        size_t i;
    161161        for (i = 0; i < count; i++)
    162                 putchar(ch);
     162                putwchar(ch);
    163163}
    164164
     
    339339                if (ch == '\n') {
    340340                        /* Enter */
    341                         putchar(ch);
     341                        putwchar(ch);
    342342                        break;
    343343                }
     
    350350                        if (wstr_remove(current, position - 1)) {
    351351                                position--;
    352                                 putchar('\b');
     352                                putwchar('\b');
    353353                                printf("%ls ", current + position);
    354354                                print_cc('\b', wstr_length(current) - position + 1);
     
    363363                        for (; (current[position] != 0) && (!isspace(current[position]));
    364364                            position++)
    365                                 putchar(current[position]);
     365                                putwchar(current[position]);
    366366
    367367
     
    459459                        /* Left */
    460460                        if (position > 0) {
    461                                 putchar('\b');
     461                                putwchar('\b');
    462462                                position--;
    463463                        }
     
    468468                        /* Right */
    469469                        if (position < wstr_length(current)) {
    470                                 putchar(current[position]);
     470                                putwchar(current[position]);
    471471                                position++;
    472472                        }
  • kernel/generic/src/printf/vprintf.c

    ra57fa32 red88c8e  
    4747
    4848        while (offset < size) {
    49                 putchar(str_decode(str, &offset, size));
     49                putwchar(str_decode(str, &offset, size));
    5050                chars++;
    5151        }
     
    6060
    6161        while (offset < size) {
    62                 putchar(str[chars]);
     62                putwchar(str[chars]);
    6363                chars++;
    6464                offset += sizeof(wchar_t);
     
    7575
    7676        while ((uc = str_decode(str, &offset, STR_NO_LIMIT)) != 0) {
    77                 putchar(uc);
     77                putwchar(uc);
    7878                chars++;
    7979        }
    8080
    81         putchar('\n');
     81        putwchar('\n');
    8282        return chars;
    8383}
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    ra57fa32 red88c8e  
    160160                printf("%6u  ", lineno);
    161161        }
    162         putchar(c);
     162        putwchar(c);
    163163        last_char_was_newline = c == '\n';
    164164        if (paging_enabled) {
  • uspace/app/bdsh/cmds/modules/printf/printf.c

    ra57fa32 red88c8e  
    172172                                break;
    173173                        }
    174                         putchar(ch);
     174                        putwchar(ch);
    175175                        break;
    176176
    177177                emit:
    178                         putchar(ch);
     178                        putwchar(ch);
    179179                        esc_flag = false;
    180180                }
  • uspace/app/edit/edit.c

    ra57fa32 red88c8e  
    671671                                default:
    672672                                        if (kev->c >= 32 && nc < max_len) {
    673                                                 putchar(kev->c);
     673                                                putwchar(kev->c);
    674674                                                console_flush(con);
    675675                                                buffer[nc++] = kev->c;
  • uspace/app/kio/kio.c

    ra57fa32 red88c8e  
    122122
    123123                for (size_t i = 0; i < item->length; i++)
    124                         putchar(item->data[i]);
     124                        putwchar(item->data[i]);
    125125
    126126                if (log != NULL) {
    127127                        for (size_t i = 0; i < item->length; i++)
    128                                 fputc(item->data[i], log);
     128                                fputwc(item->data[i], log);
    129129
    130130                        fflush(log);
  • uspace/dist/src/c/demos/edit/edit.c

    ra57fa32 red88c8e  
    671671                                default:
    672672                                        if (kev->c >= 32 && nc < max_len) {
    673                                                 putchar(kev->c);
     673                                                putwchar(kev->c);
    674674                                                console_flush(con);
    675675                                                buffer[nc++] = kev->c;
  • uspace/lib/c/generic/io/chargrid.c

    ra57fa32 red88c8e  
    140140 *
    141141 */
    142 sysarg_t chargrid_putchar(chargrid_t *scrbuf, wchar_t ch, bool update)
     142sysarg_t chargrid_putwchar(chargrid_t *scrbuf, wchar_t ch, bool update)
    143143{
    144144        assert(scrbuf->col < scrbuf->cols);
     
    199199
    200200        for (sysarg_t i = 0; i < spaces; i++)
    201                 flush += chargrid_putchar(scrbuf, ' ', true) - 1;
     201                flush += chargrid_putwchar(scrbuf, ' ', true) - 1;
    202202
    203203        return flush;
     
    228228                scrbuf->row--;
    229229
    230                 chargrid_putchar(scrbuf, ' ', false);
     230                chargrid_putwchar(scrbuf, ' ', false);
    231231                return 2;
    232232        }
    233233
    234234        scrbuf->col--;
    235         chargrid_putchar(scrbuf, ' ', false);
     235        chargrid_putwchar(scrbuf, ' ', false);
    236236        return 1;
    237237}
  • uspace/lib/c/generic/io/io.c

    ra57fa32 red88c8e  
    4646#include <ipc/loc.h>
    4747#include <adt/list.h>
     48#include <wchar.h>
    4849#include "../private/io.h"
    4950#include "../private/stdio.h"
     
    702703}
    703704
    704 int fputc(wchar_t c, FILE *stream)
     705wint_t fputwc(wchar_t wc, FILE *stream)
    705706{
    706707        char buf[STR_BOUNDS(1)];
    707708        size_t sz = 0;
    708709
    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
     722wint_t putwchar(wchar_t wc)
     723{
     724        return fputwc(wc, stdout);
     725}
     726
     727int 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
     740int putchar(int c)
    722741{
    723742        return fputc(c, stdout);
  • uspace/lib/c/generic/io/vprintf.c

    ra57fa32 red88c8e  
    5454
    5555        while (offset < size) {
    56                 if (fputc(str[chars], (FILE *) stream) <= 0)
     56                if (fputwc(str[chars], (FILE *) stream) <= 0)
    5757                        break;
    5858
  • uspace/lib/c/include/io/chargrid.h

    ra57fa32 red88c8e  
    7979extern sysarg_t chargrid_get_top_row(chargrid_t *);
    8080
    81 extern sysarg_t chargrid_putchar(chargrid_t *, wchar_t, bool);
     81extern sysarg_t chargrid_putwchar(chargrid_t *, wchar_t, bool);
    8282extern sysarg_t chargrid_newline(chargrid_t *);
    8383extern sysarg_t chargrid_tabstop(chargrid_t *, sysarg_t);
  • uspace/lib/c/include/stdio.h

    ra57fa32 red88c8e  
    4040#include <_bits/size_t.h>
    4141#include <_bits/wchar_t.h>
     42#include <_bits/wint_t.h>
    4243
    4344#define EOF  (-1)
     
    7374
    7475/* Character and string output functions */
    75 extern int fputc(wchar_t, FILE *);
     76extern int fputc(int, FILE *);
    7677extern int fputs(const char *, FILE *);
    7778
    78 // FIXME: putchar and fputc are byte-oriented.
    79 // They shouldn't accept wide characters.
    80 extern int putchar(wchar_t);
     79extern int putchar(int);
    8180extern int puts(const char *);
    8281
    8382extern int ungetc(int, FILE *);
     83
     84extern wint_t fputwc(wchar_t, FILE *);
     85extern wint_t putwchar(wchar_t);
    8486
    8587/* Formatted string output functions */
  • uspace/lib/c/include/wchar.h

    ra57fa32 red88c8e  
    4444#include <_bits/wchar_t.h>
    4545#include <_bits/wint_t.h>
     46#include <_bits/WEOF.h>
    4647
    4748#include <_bits/NULL.h>
  • uspace/lib/clui/tinput.c

    ra57fa32 red88c8e  
    145145
    146146        for (p = 0; p < pad; p++)
    147                 putchar(' ');
     147                putwchar(' ');
    148148
    149149        console_flush(ti->console);
     
    182182        tinput_console_set_lpos(ti, ti->text_coord + ti->nc);
    183183        console_flush(ti->console);
    184         putchar('\n');
     184        putwchar('\n');
    185185}
    186186
  • uspace/lib/fmtutil/fmtutil.c

    ra57fa32 red88c8e  
    9595                for (i = 0; i < width; i++) {
    9696                        if (i < len)
    97                                 putchar(wstr[i]);
     97                                putwchar(wstr[i]);
    9898                        else
    99                                 putchar(' ');
     99                                putwchar(' ');
    100100                }
    101101        } else if (mode == ALIGN_RIGHT) {
    102102                for (i = 0; i < width; i++) {
    103103                        if (i < width - len)
    104                                 putchar(' ');
     104                                putwchar(' ');
    105105                        else
    106                                 putchar(wstr[i - (width - len)]);
     106                                putwchar(wstr[i - (width - len)]);
    107107                }
    108108        } else if (mode == ALIGN_CENTER) {
     
    110110                for (i = 0; i < width; i++) {
    111111                        if ((i < padding) || ((i - padding) >= len))
    112                                 putchar(' ');
     112                                putwchar(' ');
    113113                        else
    114                                 putchar(wstr[i - padding]);
     114                                putwchar(wstr[i - padding]);
    115115                }
    116116        } else if (mode == ALIGN_JUSTIFY) {
     
    146146                                    (words - 1)));
    147147                                for (j = 0; j < spaces; j++) {
    148                                         putchar(' ');
     148                                        putwchar(' ');
    149149                                }
    150150                                done_chars += spaces;
    151151                        }
    152152                        while (i < len && wstr[i] != ' ') {
    153                                 putchar(wstr[i++]);
     153                                putwchar(wstr[i++]);
    154154                                done_chars++;
    155155                        }
     
    158158        skip_words:
    159159                while (done_chars < width) {
    160                         putchar(' ');
     160                        putwchar(' ');
    161161                        done_chars++;
    162162                }
  • uspace/lib/gui/terminal.c

    ra57fa32 red88c8e  
    456456                break;
    457457        default:
    458                 updated = chargrid_putchar(term->frontbuf, ch, true);
     458                updated = chargrid_putwchar(term->frontbuf, ch, true);
    459459        }
    460460
  • uspace/lib/posix/include/posix/stdio.h

    ra57fa32 red88c8e  
    7575extern char *gets(char *, size_t);
    7676
    77 extern int fputc(wchar_t, FILE *);
     77extern int fputc(int, FILE *);
    7878extern int fputs(const char *, FILE *);
    7979
    80 extern int putchar(wchar_t);
     80extern int putchar(int);
    8181extern int puts(const char *);
    8282
  • uspace/srv/hid/console/console.c

    ra57fa32 red88c8e  
    311311                break;
    312312        default:
    313                 updated = chargrid_putchar(cons->frontbuf, ch, true);
     313                updated = chargrid_putwchar(cons->frontbuf, ch, true);
    314314        }
    315315
  • uspace/srv/hid/output/ctl/serial.c

    ra57fa32 red88c8e  
    5757        vt100_goto(state, col, row);
    5858        vt100_set_attr(state, field->attrs);
    59         vt100_putchar(state, field->ch);
     59        vt100_putwchar(state, field->ch);
    6060}
    6161
     
    122122};
    123123
    124 errno_t serial_init(vt100_putchar_t putchar_fn,
     124errno_t serial_init(vt100_putwchar_t putwchar_fn,
    125125    vt100_control_puts_t control_puts_fn, vt100_flush_t flush_fn)
    126126{
    127127        vt100_state_t *state =
    128             vt100_state_create(SERIAL_COLS, SERIAL_ROWS, putchar_fn,
     128            vt100_state_create(SERIAL_COLS, SERIAL_ROWS, putwchar_fn,
    129129            control_puts_fn, flush_fn);
    130130        if (state == NULL)
  • uspace/srv/hid/output/ctl/serial.h

    ra57fa32 red88c8e  
    3636#include "../proto/vt100.h"
    3737
    38 extern errno_t serial_init(vt100_putchar_t, vt100_control_puts_t, vt100_flush_t);
     38extern errno_t serial_init(vt100_putwchar_t, vt100_control_puts_t, vt100_flush_t);
    3939
    4040#endif
  • uspace/srv/hid/output/port/chardev.c

    ra57fa32 red88c8e  
    7777}
    7878
    79 static void chardev_putchar(wchar_t ch)
     79static void chardev_putwchar(wchar_t ch)
    8080{
    8181        if (chardev_bused == chardev_buf_size)
     
    9292        p = str;
    9393        while (*p != '\0')
    94                 chardev_putchar(*p++);
     94                chardev_putwchar(*p++);
    9595}
    9696
     
    198198        }
    199199
    200         serial_init(chardev_putchar, chardev_control_puts, chardev_flush);
     200        serial_init(chardev_putwchar, chardev_control_puts, chardev_flush);
    201201
    202202        discovery_finished = true;
  • uspace/srv/hid/output/proto/vt100.c

    ra57fa32 red88c8e  
    139139
    140140vt100_state_t *vt100_state_create(sysarg_t cols, sysarg_t rows,
    141     vt100_putchar_t putchar_fn, vt100_control_puts_t control_puts_fn,
     141    vt100_putwchar_t putwchar_fn, vt100_control_puts_t control_puts_fn,
    142142    vt100_flush_t flush_fn)
    143143{
     
    146146                return NULL;
    147147
    148         state->putchar = putchar_fn;
     148        state->putwchar = putwchar_fn;
    149149        state->control_puts = control_puts_fn;
    150150        state->flush = flush_fn;
     
    219219}
    220220
    221 void vt100_putchar(vt100_state_t *state, wchar_t ch)
    222 {
    223         state->putchar(ch == 0 ? ' ' : ch);
     221void vt100_putwchar(vt100_state_t *state, wchar_t ch)
     222{
     223        state->putwchar(ch == 0 ? ' ' : ch);
    224224        state->cur_col++;
    225225
  • uspace/srv/hid/output/proto/vt100.h

    ra57fa32 red88c8e  
    3535#include <io/charfield.h>
    3636
    37 typedef void (*vt100_putchar_t)(wchar_t ch);
     37typedef void (*vt100_putwchar_t)(wchar_t ch);
    3838typedef void (*vt100_control_puts_t)(const char *str);
    3939typedef void (*vt100_flush_t)(void);
     
    4747        char_attrs_t cur_attrs;
    4848
    49         vt100_putchar_t putchar;
     49        vt100_putwchar_t putwchar;
    5050        vt100_control_puts_t control_puts;
    5151        vt100_flush_t flush;
    5252} vt100_state_t;
    5353
    54 extern vt100_state_t *vt100_state_create(sysarg_t, sysarg_t, vt100_putchar_t,
     54extern vt100_state_t *vt100_state_create(sysarg_t, sysarg_t, vt100_putwchar_t,
    5555    vt100_control_puts_t, vt100_flush_t);
    5656extern void vt100_state_destroy(vt100_state_t *);
     
    6363extern void vt100_set_attr(vt100_state_t *, char_attrs_t);
    6464extern void vt100_cursor_visibility(vt100_state_t *, bool);
    65 extern void vt100_putchar(vt100_state_t *, wchar_t);
     65extern void vt100_putwchar(vt100_state_t *, wchar_t);
    6666extern void vt100_flush(vt100_state_t *);
    6767
Note: See TracChangeset for help on using the changeset viewer.