Changeset 696b405 in mainline for common/include/uchar.h


Ignore:
Timestamp:
2025-04-13T12:54:10Z (3 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
9daee3de
Parents:
7d1497c
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-13 10:13:16)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-13 12:54:10)
Message:

Implement standard character conversion functions from <uchar.h> and <wchar.h>

These are more somewhat more flexible than the existing functions in <str.h> since
they can process incomplete stream and save unfinished character for next call.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • common/include/uchar.h

    r7d1497c r696b405  
    11/*
    2  * Copyright (c) 2020 Martin Decky
     2 * Copyright (c) 2025 Jiří Zárevúcky
    33 * All rights reserved.
    44 *
     
    3636#define _LIBC_UCHAR_H_
    3737
     38#include <_bits/mbstate_t.h>
     39#include <_bits/size_t.h>
    3840#include <_bits/uchar.h>
     41#include <stdint.h>
     42
     43size_t mbrtoc8(char8_t *__restrict pc8, const char *__restrict s, size_t n,
     44    mbstate_t *__restrict ps);
     45size_t c8rtomb(char *__restrict s, char8_t c8, mbstate_t *__restrict ps);
     46size_t mbrtoc16(char16_t *__restrict pc16, const char *__restrict s, size_t n,
     47    mbstate_t *__restrict ps);
     48size_t c16rtomb(char *__restrict s, char16_t c16, mbstate_t *__restrict ps);
     49size_t mbrtoc32(char32_t *__restrict pc32, const char *__restrict s, size_t n,
     50    mbstate_t *__restrict ps);
     51size_t c32rtomb(char *__restrict s, char32_t c32, mbstate_t *__restrict ps);
     52
     53#ifdef _HELENOS_SOURCE
     54#define UCHAR_ILSEQ      ((size_t) -1)
     55#define UCHAR_INCOMPLETE ((size_t) -2)
     56#define UCHAR_CONTINUED  ((size_t) -3)
     57#endif
    3958
    4059#endif
Note: See TracChangeset for help on using the changeset viewer.