150c77c6eSEd Schouten /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3e58eb3c4SPedro F. Giffuni * 450c77c6eSEd Schouten * Copyright (c) 2013 Ed Schouten <ed@FreeBSD.org> 550c77c6eSEd Schouten * All rights reserved. 650c77c6eSEd Schouten * 750c77c6eSEd Schouten * Redistribution and use in source and binary forms, with or without 850c77c6eSEd Schouten * modification, are permitted provided that the following conditions 950c77c6eSEd Schouten * are met: 1050c77c6eSEd Schouten * 1. Redistributions of source code must retain the above copyright 1150c77c6eSEd Schouten * notice, this list of conditions and the following disclaimer. 1250c77c6eSEd Schouten * 2. Redistributions in binary form must reproduce the above copyright 1350c77c6eSEd Schouten * notice, this list of conditions and the following disclaimer in the 1450c77c6eSEd Schouten * documentation and/or other materials provided with the distribution. 1550c77c6eSEd Schouten * 1650c77c6eSEd Schouten * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1750c77c6eSEd Schouten * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1850c77c6eSEd Schouten * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1950c77c6eSEd Schouten * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2050c77c6eSEd Schouten * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2150c77c6eSEd Schouten * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2250c77c6eSEd Schouten * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2350c77c6eSEd Schouten * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2450c77c6eSEd Schouten * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2550c77c6eSEd Schouten * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2650c77c6eSEd Schouten * SUCH DAMAGE. 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 3574b6b2bbSEd Schouten #ifndef _CHAR16_T_DECLARED 3674b6b2bbSEd Schouten typedef __char16_t char16_t; 3774b6b2bbSEd Schouten #define _CHAR16_T_DECLARED 3874b6b2bbSEd Schouten #endif 3974b6b2bbSEd Schouten 4074b6b2bbSEd Schouten #ifndef _CHAR32_T_DECLARED 4174b6b2bbSEd Schouten typedef __char32_t char32_t; 4274b6b2bbSEd Schouten #define _CHAR32_T_DECLARED 4374b6b2bbSEd Schouten #endif 4474b6b2bbSEd 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