xref: /dragonfly/include/uchar.h (revision 9d4f17d1)
10d5acd74SJohn Marino /*-
20d5acd74SJohn Marino  * Copyright (c) 2013 Ed Schouten <ed@FreeBSD.org>
30d5acd74SJohn Marino  * All rights reserved.
40d5acd74SJohn Marino  *
50d5acd74SJohn Marino  * Redistribution and use in source and binary forms, with or without
60d5acd74SJohn Marino  * modification, are permitted provided that the following conditions
70d5acd74SJohn Marino  * are met:
80d5acd74SJohn Marino  * 1. Redistributions of source code must retain the above copyright
90d5acd74SJohn Marino  *    notice, this list of conditions and the following disclaimer.
100d5acd74SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
110d5acd74SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
120d5acd74SJohn Marino  *    documentation and/or other materials provided with the distribution.
130d5acd74SJohn Marino  *
140d5acd74SJohn Marino  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
150d5acd74SJohn Marino  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
160d5acd74SJohn Marino  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
170d5acd74SJohn Marino  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
180d5acd74SJohn Marino  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
190d5acd74SJohn Marino  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
200d5acd74SJohn Marino  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
210d5acd74SJohn Marino  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
220d5acd74SJohn Marino  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
230d5acd74SJohn Marino  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
240d5acd74SJohn Marino  * SUCH DAMAGE.
250d5acd74SJohn Marino  *
260d5acd74SJohn Marino  * $FreeBSD: head/include/uchar.h 250985 2013-05-25 16:58:12Z ed $
270d5acd74SJohn Marino  */
280d5acd74SJohn Marino 
290d5acd74SJohn Marino #ifndef _UCHAR_H_
300d5acd74SJohn Marino #define	_UCHAR_H_
310d5acd74SJohn Marino 
320d5acd74SJohn Marino #include <sys/cdefs.h>
33*9d4f17d1Szrj #include <machine/stdint.h>
343cfdabcfSzrj #include <machine/wchar.h>	/* for __mbstate_t */
350d5acd74SJohn Marino 
366c21fbf7SSascha Wildner #if !defined(__cplusplus) || __cplusplus < 201103
376c21fbf7SSascha Wildner typedef	__uint_least16_t	char16_t;
386c21fbf7SSascha Wildner typedef	__uint_least32_t	char32_t;
390d5acd74SJohn Marino #endif
400d5acd74SJohn Marino 
410d5acd74SJohn Marino #ifndef _MBSTATE_T_DECLARED
420d5acd74SJohn Marino typedef	__mbstate_t	mbstate_t;
430d5acd74SJohn Marino #define	_MBSTATE_T_DECLARED
440d5acd74SJohn Marino #endif
450d5acd74SJohn Marino 
460d5acd74SJohn Marino #ifndef _SIZE_T_DECLARED
470d5acd74SJohn Marino typedef	__size_t	size_t;
480d5acd74SJohn Marino #define	_SIZE_T_DECLARED
490d5acd74SJohn Marino #endif
500d5acd74SJohn Marino 
510d5acd74SJohn Marino __BEGIN_DECLS
520d5acd74SJohn Marino size_t	c16rtomb(char * __restrict, char16_t, mbstate_t * __restrict);
530d5acd74SJohn Marino size_t	c32rtomb(char * __restrict, char32_t, mbstate_t * __restrict);
540d5acd74SJohn Marino size_t	mbrtoc16(char16_t * __restrict, const char * __restrict, size_t,
550d5acd74SJohn Marino     mbstate_t * __restrict);
560d5acd74SJohn Marino size_t	mbrtoc32(char32_t * __restrict, const char * __restrict, size_t,
570d5acd74SJohn Marino     mbstate_t * __restrict);
580d5acd74SJohn Marino #if __BSD_VISIBLE || defined(_XLOCALE_H_)
590d5acd74SJohn Marino #include <xlocale/_uchar.h>
600d5acd74SJohn Marino #endif
610d5acd74SJohn Marino __END_DECLS
620d5acd74SJohn Marino 
630d5acd74SJohn Marino #endif /* !_UCHAR_H_ */
64