Changeset 28a5ebd in mainline for uspace/lib/c/include/io


Ignore:
Timestamp:
2020-06-18T15:39:50Z (6 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ce52c333
Parents:
4f663f3e
Message:

Use char32_t instead of wchat_t to represent UTF-32 strings

The intention of the native HelenOS string API has been always to
support Unicode in the UTF-8 and UTF-32 encodings as the sole character
representations and ignore the obsolete mess of older single-byte and
multibyte character encodings. Before C11, the wchar_t type has been
slightly misused for the purpose of the UTF-32 strings. The newer
char32_t type is obviously a much more suitable option. The standard
defines char32_t as uint_least32_t, thus we can take the liberty to fix
it to uint32_t.

To maintain compatilibity with the C Standard, the putwchar(wchar_t)
functions has been replaced by our custom putuchar(char32_t) functions
where appropriate.

Location:
uspace/lib/c/include/io
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/io/charfield.h

    r4f663f3e r28a5ebd  
    3838
    3939#include <stdbool.h>
    40 #include <wchar.h>
     40#include <uchar.h>
    4141#include <io/color.h>
    4242#include <io/style.h>
     
    7777
    7878typedef struct {
    79         wchar_t ch;
     79        char32_t ch;
    8080        char_attrs_t attrs;
    8181        char_flags_t flags;
  • uspace/lib/c/include/io/chargrid.h

    r4f663f3e r28a5ebd  
    7979extern sysarg_t chargrid_get_top_row(chargrid_t *);
    8080
    81 extern sysarg_t chargrid_putwchar(chargrid_t *, wchar_t, bool);
     81extern sysarg_t chargrid_putuchar(chargrid_t *, char32_t, bool);
    8282extern sysarg_t chargrid_newline(chargrid_t *);
    8383extern sysarg_t chargrid_tabstop(chargrid_t *, sysarg_t);
  • uspace/lib/c/include/io/input.h

    r4f663f3e r28a5ebd  
    5050        errno_t (*active)(input_t *);
    5151        errno_t (*deactive)(input_t *);
    52         errno_t (*key)(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t);
     52        errno_t (*key)(input_t *, kbd_event_type_t, keycode_t, keymod_t, char32_t);
    5353        errno_t (*move)(input_t *, int, int);
    5454        errno_t (*abs_move)(input_t *, unsigned, unsigned, unsigned, unsigned);
  • uspace/lib/c/include/io/kbd_event.h

    r4f663f3e r28a5ebd  
    5959
    6060        /** The character that was generated or '\0' for none. */
    61         wchar_t c;
     61        char32_t c;
    6262} kbd_event_t;
    6363
  • uspace/lib/c/include/io/printf_core.h

    r4f663f3e r28a5ebd  
    3838#include <stddef.h>
    3939#include <stdarg.h>
     40#include <uchar.h>
    4041
    4142/** Structure for specifying output methods for different printf clones. */
     
    4546
    4647        /* Wide string output function, returns number of printed characters or EOF */
    47         int (*wstr_write)(const wchar_t *, size_t, void *);
     48        int (*wstr_write)(const char32_t *, size_t, void *);
    4849
    4950        /* User data - output stream specification, state, locks, etc. */
Note: See TracChangeset for help on using the changeset viewer.