12051a8f2STim J. Robbins /*- 27b247341SBaptiste Daroussin * Copyright 2013 Garrett D'Amore <garrett@damore.org> 37b247341SBaptiste Daroussin * Copyright 2011 Nexenta Systems, Inc. All rights reserved. 42051a8f2STim J. Robbins * Copyright (c) 2004 Tim J. Robbins. 52051a8f2STim J. Robbins * All rights reserved. 62051a8f2STim J. Robbins * 73c87aa1dSDavid Chisnall * Copyright (c) 2011 The FreeBSD Foundation 83c87aa1dSDavid Chisnall * All rights reserved. 93c87aa1dSDavid Chisnall * Portions of this software were developed by David Chisnall 103c87aa1dSDavid Chisnall * under sponsorship from the FreeBSD Foundation. 113c87aa1dSDavid Chisnall * 122051a8f2STim J. Robbins * Redistribution and use in source and binary forms, with or without 132051a8f2STim J. Robbins * modification, are permitted provided that the following conditions 142051a8f2STim J. Robbins * are met: 152051a8f2STim J. Robbins * 1. Redistributions of source code must retain the above copyright 162051a8f2STim J. Robbins * notice, this list of conditions and the following disclaimer. 172051a8f2STim J. Robbins * 2. Redistributions in binary form must reproduce the above copyright 182051a8f2STim J. Robbins * notice, this list of conditions and the following disclaimer in the 192051a8f2STim J. Robbins * documentation and/or other materials provided with the distribution. 202051a8f2STim J. Robbins * 212051a8f2STim J. Robbins * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 222051a8f2STim J. Robbins * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 232051a8f2STim J. Robbins * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 242051a8f2STim J. Robbins * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 252051a8f2STim J. Robbins * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 262051a8f2STim J. Robbins * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 272051a8f2STim J. Robbins * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 282051a8f2STim J. Robbins * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 292051a8f2STim J. Robbins * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 302051a8f2STim J. Robbins * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 312051a8f2STim J. Robbins * SUCH DAMAGE. 322051a8f2STim J. Robbins * 332051a8f2STim J. Robbins * $FreeBSD$ 342051a8f2STim J. Robbins */ 352051a8f2STim J. Robbins 362051a8f2STim J. Robbins #ifndef _MBLOCAL_H_ 372051a8f2STim J. Robbins #define _MBLOCAL_H_ 382051a8f2STim J. Robbins 39a964324eSRong-En Fan #include <runetype.h> 403c87aa1dSDavid Chisnall #include "xlocale_private.h" 41a964324eSRong-En Fan 427b247341SBaptiste Daroussin #define SS2 0x008e 437b247341SBaptiste Daroussin #define SS3 0x008f 44e94c6cb4SAlexey Zelkin 45e94c6cb4SAlexey Zelkin /* 462051a8f2STim J. Robbins * Conversion function pointers for current encoding. 472051a8f2STim J. Robbins */ 483c87aa1dSDavid Chisnall struct xlocale_ctype { 493c87aa1dSDavid Chisnall struct xlocale_component header; 503c87aa1dSDavid Chisnall _RuneLocale *runes; 513c87aa1dSDavid Chisnall size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict, 522051a8f2STim J. Robbins size_t, mbstate_t * __restrict); 533c87aa1dSDavid Chisnall int (*__mbsinit)(const mbstate_t *); 543c87aa1dSDavid Chisnall size_t (*__mbsnrtowcs)(wchar_t * __restrict, const char ** __restrict, 551949a347STim J. Robbins size_t, size_t, mbstate_t * __restrict); 563c87aa1dSDavid Chisnall size_t (*__wcrtomb)(char * __restrict, wchar_t, mbstate_t * __restrict); 573c87aa1dSDavid Chisnall size_t (*__wcsnrtombs)(char * __restrict, const wchar_t ** __restrict, 581949a347STim J. Robbins size_t, size_t, mbstate_t * __restrict); 593c87aa1dSDavid Chisnall int __mb_cur_max; 603c87aa1dSDavid Chisnall int __mb_sb_limit; 613c87aa1dSDavid Chisnall }; 623c87aa1dSDavid Chisnall #define XLOCALE_CTYPE(x) ((struct xlocale_ctype*)(x)->components[XLC_CTYPE]) 633c87aa1dSDavid Chisnall extern struct xlocale_ctype __xlocale_global_ctype; 643c87aa1dSDavid Chisnall 653c87aa1dSDavid Chisnall /* 663c87aa1dSDavid Chisnall * Rune initialization function prototypes. 673c87aa1dSDavid Chisnall */ 68*ba7161edSPedro F. Giffuni int _none_init(struct xlocale_ctype *, _RuneLocale *) __hidden; 69*ba7161edSPedro F. Giffuni int _UTF8_init(struct xlocale_ctype *, _RuneLocale *) __hidden; 70*ba7161edSPedro F. Giffuni int _EUC_CN_init(struct xlocale_ctype *, _RuneLocale *) __hidden; 71*ba7161edSPedro F. Giffuni int _EUC_JP_init(struct xlocale_ctype *, _RuneLocale *) __hidden; 72*ba7161edSPedro F. Giffuni int _EUC_KR_init(struct xlocale_ctype *, _RuneLocale *) __hidden; 73*ba7161edSPedro F. Giffuni int _EUC_TW_init(struct xlocale_ctype *, _RuneLocale *) __hidden; 74*ba7161edSPedro F. Giffuni int _GB18030_init(struct xlocale_ctype *, _RuneLocale *) __hidden; 75*ba7161edSPedro F. Giffuni int _GB2312_init(struct xlocale_ctype *, _RuneLocale *) __hidden; 76*ba7161edSPedro F. Giffuni int _GBK_init(struct xlocale_ctype *, _RuneLocale *) __hidden; 77*ba7161edSPedro F. Giffuni int _BIG5_init(struct xlocale_ctype *, _RuneLocale *) __hidden; 78*ba7161edSPedro F. Giffuni int _MSKanji_init(struct xlocale_ctype *, _RuneLocale *) __hidden; 79*ba7161edSPedro F. Giffuni int _ascii_init(struct xlocale_ctype *, _RuneLocale *) __hidden; 802051a8f2STim J. Robbins 817b247341SBaptiste Daroussin typedef size_t (*mbrtowc_pfn_t)(wchar_t * __restrict, 827b247341SBaptiste Daroussin const char * __restrict, size_t, mbstate_t * __restrict); 837b247341SBaptiste Daroussin typedef size_t (*wcrtomb_pfn_t)(char * __restrict, wchar_t, 847b247341SBaptiste Daroussin mbstate_t * __restrict); 857b247341SBaptiste Daroussin size_t __mbsnrtowcs_std(wchar_t * __restrict, const char ** __restrict, 867b247341SBaptiste Daroussin size_t, size_t, mbstate_t * __restrict, mbrtowc_pfn_t); 877b247341SBaptiste Daroussin size_t __wcsnrtombs_std(char * __restrict, const wchar_t ** __restrict, 887b247341SBaptiste Daroussin size_t, size_t, mbstate_t * __restrict, wcrtomb_pfn_t); 892051a8f2STim J. Robbins 902051a8f2STim J. Robbins #endif /* _MBLOCAL_H_ */ 91