xref: /freebsd/include/uchar.h (revision 74b6b2bb9903e0b210d52e9e903aa28a594babe1)
150c77c6eSEd Schouten /*-
250c77c6eSEd Schouten  * Copyright (c) 2013 Ed Schouten <ed@FreeBSD.org>
350c77c6eSEd Schouten  * All rights reserved.
450c77c6eSEd Schouten  *
550c77c6eSEd Schouten  * Redistribution and use in source and binary forms, with or without
650c77c6eSEd Schouten  * modification, are permitted provided that the following conditions
750c77c6eSEd Schouten  * are met:
850c77c6eSEd Schouten  * 1. Redistributions of source code must retain the above copyright
950c77c6eSEd Schouten  *    notice, this list of conditions and the following disclaimer.
1050c77c6eSEd Schouten  * 2. Redistributions in binary form must reproduce the above copyright
1150c77c6eSEd Schouten  *    notice, this list of conditions and the following disclaimer in the
1250c77c6eSEd Schouten  *    documentation and/or other materials provided with the distribution.
1350c77c6eSEd Schouten  *
1450c77c6eSEd Schouten  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1550c77c6eSEd Schouten  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1650c77c6eSEd Schouten  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1750c77c6eSEd Schouten  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1850c77c6eSEd Schouten  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1950c77c6eSEd Schouten  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2050c77c6eSEd Schouten  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2150c77c6eSEd Schouten  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2250c77c6eSEd Schouten  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2350c77c6eSEd Schouten  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2450c77c6eSEd Schouten  * SUCH DAMAGE.
2550c77c6eSEd Schouten  *
2650c77c6eSEd Schouten  * $FreeBSD$
2750c77c6eSEd Schouten  */
2850c77c6eSEd Schouten 
2950c77c6eSEd Schouten #ifndef _UCHAR_H_
3050c77c6eSEd Schouten #define	_UCHAR_H_
3150c77c6eSEd Schouten 
3250c77c6eSEd Schouten #include <sys/cdefs.h>
3350c77c6eSEd Schouten #include <sys/_types.h>
3450c77c6eSEd Schouten 
35*74b6b2bbSEd Schouten #ifndef _CHAR16_T_DECLARED
36*74b6b2bbSEd Schouten typedef	__char16_t	char16_t;
37*74b6b2bbSEd Schouten #define	_CHAR16_T_DECLARED
38*74b6b2bbSEd Schouten #endif
39*74b6b2bbSEd Schouten 
40*74b6b2bbSEd Schouten #ifndef _CHAR32_T_DECLARED
41*74b6b2bbSEd Schouten typedef	__char32_t	char32_t;
42*74b6b2bbSEd Schouten #define	_CHAR32_T_DECLARED
43*74b6b2bbSEd Schouten #endif
44*74b6b2bbSEd Schouten 
4550c77c6eSEd Schouten #ifndef _MBSTATE_T_DECLARED
4650c77c6eSEd Schouten typedef	__mbstate_t	mbstate_t;
4750c77c6eSEd Schouten #define	_MBSTATE_T_DECLARED
4850c77c6eSEd Schouten #endif
4950c77c6eSEd Schouten 
5050c77c6eSEd Schouten #ifndef _SIZE_T_DECLARED
5150c77c6eSEd Schouten typedef	__size_t	size_t;
5250c77c6eSEd Schouten #define	_SIZE_T_DECLARED
5350c77c6eSEd Schouten #endif
5450c77c6eSEd Schouten 
5550c77c6eSEd Schouten __BEGIN_DECLS
5650c77c6eSEd Schouten size_t	c16rtomb(char * __restrict, char16_t, mbstate_t * __restrict);
5750c77c6eSEd Schouten size_t	c32rtomb(char * __restrict, char32_t, mbstate_t * __restrict);
5850c77c6eSEd Schouten size_t	mbrtoc16(char16_t * __restrict, const char * __restrict, size_t,
5950c77c6eSEd Schouten     mbstate_t * __restrict);
6050c77c6eSEd Schouten size_t	mbrtoc32(char32_t * __restrict, const char * __restrict, size_t,
6150c77c6eSEd Schouten     mbstate_t * __restrict);
6250c77c6eSEd Schouten #if __BSD_VISIBLE || defined(_XLOCALE_H_)
6350c77c6eSEd Schouten #include <xlocale/_uchar.h>
6450c77c6eSEd Schouten #endif
6550c77c6eSEd Schouten __END_DECLS
6650c77c6eSEd Schouten 
6750c77c6eSEd Schouten #endif /* !_UCHAR_H_ */
68