1129153Stjr/*-
2129153Stjr * Copyright (c) 2004 Tim J. Robbins.
3129153Stjr * All rights reserved.
4129153Stjr *
5227753Stheraven * Copyright (c) 2011 The FreeBSD Foundation
6227753Stheraven * All rights reserved.
7227753Stheraven * Portions of this software were developed by David Chisnall
8227753Stheraven * under sponsorship from the FreeBSD Foundation.
9227753Stheraven *
10129153Stjr * Redistribution and use in source and binary forms, with or without
11129153Stjr * modification, are permitted provided that the following conditions
12129153Stjr * are met:
13129153Stjr * 1. Redistributions of source code must retain the above copyright
14129153Stjr *    notice, this list of conditions and the following disclaimer.
15129153Stjr * 2. Redistributions in binary form must reproduce the above copyright
16129153Stjr *    notice, this list of conditions and the following disclaimer in the
17129153Stjr *    documentation and/or other materials provided with the distribution.
18129153Stjr *
19129153Stjr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20129153Stjr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21129153Stjr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22129153Stjr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23129153Stjr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24129153Stjr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25129153Stjr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26129153Stjr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27129153Stjr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28129153Stjr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29129153Stjr * SUCH DAMAGE.
30129153Stjr *
31129153Stjr * $FreeBSD: releng/10.2/lib/libc/locale/mblocal.h 227753 2011-11-20 14:45:42Z theraven $
32129153Stjr */
33129153Stjr
34129153Stjr#ifndef _MBLOCAL_H_
35129153Stjr#define	_MBLOCAL_H_
36129153Stjr
37173420Srafan#include <runetype.h>
38227753Stheraven#include "xlocale_private.h"
39173420Srafan
40227753Stheraven
41129153Stjr/*
42227753Stheraven * Conversion function pointers for current encoding.
43142654Sphantom */
44227753Stheravenstruct xlocale_ctype {
45227753Stheraven	struct xlocale_component header;
46227753Stheraven	_RuneLocale *runes;
47227753Stheraven	size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict,
48227753Stheraven		size_t, mbstate_t * __restrict);
49227753Stheraven	int (*__mbsinit)(const mbstate_t *);
50227753Stheraven	size_t (*__mbsnrtowcs)(wchar_t * __restrict, const char ** __restrict,
51227753Stheraven		size_t, size_t, mbstate_t * __restrict);
52227753Stheraven	size_t (*__wcrtomb)(char * __restrict, wchar_t, mbstate_t * __restrict);
53227753Stheraven	size_t (*__wcsnrtombs)(char * __restrict, const wchar_t ** __restrict,
54227753Stheraven		size_t, size_t, mbstate_t * __restrict);
55227753Stheraven	int __mb_cur_max;
56227753Stheraven	int __mb_sb_limit;
57227753Stheraven};
58227753Stheraven#define XLOCALE_CTYPE(x) ((struct xlocale_ctype*)(x)->components[XLC_CTYPE])
59227753Stheravenextern struct xlocale_ctype __xlocale_global_ctype;
60142654Sphantom
61142654Sphantom/*
62227753Stheraven * Rune initialization function prototypes.
63129153Stjr */
64227753Stheravenint	_none_init(struct xlocale_ctype *, _RuneLocale *);
65227753Stheravenint	_ascii_init(struct xlocale_ctype *, _RuneLocale *);
66227753Stheravenint	_UTF8_init(struct xlocale_ctype *, _RuneLocale *);
67227753Stheravenint	_EUC_init(struct xlocale_ctype *, _RuneLocale *);
68227753Stheravenint	_GB18030_init(struct xlocale_ctype *, _RuneLocale *);
69227753Stheravenint	_GB2312_init(struct xlocale_ctype *, _RuneLocale *);
70227753Stheravenint	_GBK_init(struct xlocale_ctype *, _RuneLocale *);
71227753Stheravenint	_BIG5_init(struct xlocale_ctype *, _RuneLocale *);
72227753Stheravenint	_MSKanji_init(struct xlocale_ctype *, _RuneLocale *);
73129153Stjr
74132497Stjrextern size_t __mbsnrtowcs_std(wchar_t * __restrict, const char ** __restrict,
75227753Stheraven	size_t, size_t, mbstate_t * __restrict);
76132497Stjrextern size_t __wcsnrtombs_std(char * __restrict, const wchar_t ** __restrict,
77227753Stheraven	size_t, size_t, mbstate_t * __restrict);
78129179Stjr
79129153Stjr#endif	/* _MBLOCAL_H_ */
80