1 /*-------------------------------------------------------------------------
2 uchar.h: Unicode utilities (ISO C 11 7.28)
4 Copyright (C) 2015-2016, Philipp Klaus Krause, pkk@spth.de
6 This library is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this library; see the file COPYING. If not, write to the
18 Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
21 As a special exception, if you link this library with other files,
22 some of which are compiled with SDCC, to produce an executable,
23 this library does not by itself cause the resulting executable to
24 be covered by the GNU General Public License. This exception does
25 not however invalidate any other reasons why the executable file
26 might be covered by the GNU General Public License.
27 -------------------------------------------------------------------------*/
29 #ifndef __STDC_VERSION_UCHAR_H__
30 #define __STDC_VERSION_UCHAR_H__ __STDC_VERSION__
32 #ifndef __MBSTATE_T_DEFINED
33 #define __MBSTATE_T_DEFINED
34 typedef struct {unsigned char c
[3];} mbstate_t;
37 #ifndef __SIZE_T_DEFINED
38 #define __SIZE_T_DEFINED
39 typedef unsigned int size_t;
42 #if __STDC_VERSION__ >= 202311L
43 #ifndef __CHAR8_T_DEFINED
44 #define __CHAR8_T_DEFINED
45 typedef unsigned char char8_t
;
49 #ifndef __CHAR16_T_DEFINED
50 #define __CHAR16_T_DEFINED
51 typedef unsigned int char16_t
;
54 #ifndef __CHAR32_T_DEFINED
55 #define __CHAR32_T_DEFINED
56 typedef unsigned long int char32_t
;
59 size_t mbrtoc16(char16_t
*restrict pc16
, const char *restrict s
, size_t n
, mbstate_t *restrict ps
);
60 size_t c16rtomb(char *restrict s
, char16_t c16
, mbstate_t *restrict ps
);
61 size_t mbrtoc32(char32_t
*restrict pc32
, const char *restrict s
, size_t n
, mbstate_t *restrict ps
);
62 size_t c32rtomb(char *restrict s
, char32_t c32
, mbstate_t *restrict ps
);
64 size_t __mbstoc16s(char16_t
*restrict c16s
, const char *restrict s
, size_t n
);
65 size_t __c16stombs(char *restrict s
, const char16_t
*restrict c16s
, size_t n
);