xref: /freebsd/include/uchar.h (revision 50c77c6e8b152e463f99c4e9225f5603c02d979c)
1*50c77c6eSEd Schouten /*-
2*50c77c6eSEd Schouten  * Copyright (c) 2013 Ed Schouten <ed@FreeBSD.org>
3*50c77c6eSEd Schouten  * All rights reserved.
4*50c77c6eSEd Schouten  *
5*50c77c6eSEd Schouten  * Redistribution and use in source and binary forms, with or without
6*50c77c6eSEd Schouten  * modification, are permitted provided that the following conditions
7*50c77c6eSEd Schouten  * are met:
8*50c77c6eSEd Schouten  * 1. Redistributions of source code must retain the above copyright
9*50c77c6eSEd Schouten  *    notice, this list of conditions and the following disclaimer.
10*50c77c6eSEd Schouten  * 2. Redistributions in binary form must reproduce the above copyright
11*50c77c6eSEd Schouten  *    notice, this list of conditions and the following disclaimer in the
12*50c77c6eSEd Schouten  *    documentation and/or other materials provided with the distribution.
13*50c77c6eSEd Schouten  *
14*50c77c6eSEd Schouten  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15*50c77c6eSEd Schouten  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*50c77c6eSEd Schouten  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*50c77c6eSEd Schouten  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18*50c77c6eSEd Schouten  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*50c77c6eSEd Schouten  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20*50c77c6eSEd Schouten  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21*50c77c6eSEd Schouten  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22*50c77c6eSEd Schouten  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23*50c77c6eSEd Schouten  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24*50c77c6eSEd Schouten  * SUCH DAMAGE.
25*50c77c6eSEd Schouten  *
26*50c77c6eSEd Schouten  * $FreeBSD$
27*50c77c6eSEd Schouten  */
28*50c77c6eSEd Schouten 
29*50c77c6eSEd Schouten #ifndef _UCHAR_H_
30*50c77c6eSEd Schouten #define	_UCHAR_H_
31*50c77c6eSEd Schouten 
32*50c77c6eSEd Schouten #include <sys/cdefs.h>
33*50c77c6eSEd Schouten #include <sys/_types.h>
34*50c77c6eSEd Schouten 
35*50c77c6eSEd Schouten #ifndef _MBSTATE_T_DECLARED
36*50c77c6eSEd Schouten typedef	__mbstate_t	mbstate_t;
37*50c77c6eSEd Schouten #define	_MBSTATE_T_DECLARED
38*50c77c6eSEd Schouten #endif
39*50c77c6eSEd Schouten 
40*50c77c6eSEd Schouten #ifndef _SIZE_T_DECLARED
41*50c77c6eSEd Schouten typedef	__size_t	size_t;
42*50c77c6eSEd Schouten #define	_SIZE_T_DECLARED
43*50c77c6eSEd Schouten #endif
44*50c77c6eSEd Schouten 
45*50c77c6eSEd Schouten typedef	__char16_t	char16_t;
46*50c77c6eSEd Schouten typedef	__char32_t	char32_t;
47*50c77c6eSEd Schouten 
48*50c77c6eSEd Schouten __BEGIN_DECLS
49*50c77c6eSEd Schouten size_t	c16rtomb(char * __restrict, char16_t, mbstate_t * __restrict);
50*50c77c6eSEd Schouten size_t	c32rtomb(char * __restrict, char32_t, mbstate_t * __restrict);
51*50c77c6eSEd Schouten size_t	mbrtoc16(char16_t * __restrict, const char * __restrict, size_t,
52*50c77c6eSEd Schouten     mbstate_t * __restrict);
53*50c77c6eSEd Schouten size_t	mbrtoc32(char32_t * __restrict, const char * __restrict, size_t,
54*50c77c6eSEd Schouten     mbstate_t * __restrict);
55*50c77c6eSEd Schouten #if __BSD_VISIBLE || defined(_XLOCALE_H_)
56*50c77c6eSEd Schouten #include <xlocale/_uchar.h>
57*50c77c6eSEd Schouten #endif
58*50c77c6eSEd Schouten __END_DECLS
59*50c77c6eSEd Schouten 
60*50c77c6eSEd Schouten #endif /* !_UCHAR_H_ */
61