xref: /titanic_51/usr/src/lib/libc/port/locale/lctype.h (revision d8e0a9a12d4d1ec2e9410b384d25d738daf9f240)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2013 Garrett D'Amore <garrett@damore.org>
14  */
15 
16 #ifndef	_LCTYPE_H_
17 #define	_LCTYPE_H_
18 
19 #include <wchar.h>
20 #include <sys/types.h>
21 
22 /* private LC_CTYPE related structures */
23 
24 /* encoding callbacks */
25 struct lc_ctype {
26 
27 	size_t (*lc_mbrtowc)(wchar_t *_RESTRICT_KYWD,
28 	    const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD,
29 	    boolean_t);
30 
31 	int (*lc_mbsinit)(const mbstate_t *);
32 
33 	size_t (*lc_mbsnrtowcs)(wchar_t *_RESTRICT_KYWD,
34 	    const char **_RESTRICT_KYWD, size_t, size_t,
35 	    mbstate_t *_RESTRICT_KYWD);
36 
37 	size_t (*lc_wcrtomb)(char *_RESTRICT_KYWD, wchar_t,
38 	    mbstate_t *_RESTRICT_KYWD);
39 
40 	size_t (*lc_wcsnrtombs)(char *_RESTRICT_KYWD,
41 	    const wchar_t **_RESTRICT_KYWD, size_t, size_t,
42 	    mbstate_t *_RESTRICT_KYWD);
43 
44 	unsigned char lc_is_ascii;
45 	unsigned char lc_max_mblen;
46 
47 	const int *lc_trans_upper;
48 	const int *lc_trans_lower;
49 	const unsigned *lc_ctype_mask;
50 };
51 
52 /*
53  * Default implementation (C locale, i.e. ASCII).
54  */
55 size_t	__mbrtowc_ascii(wchar_t *_RESTRICT_KYWD,
56     const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD, boolean_t);
57 int	__mbsinit_ascii(const mbstate_t *);
58 size_t	__mbsnrtowcs_ascii(wchar_t *_RESTRICT_KYWD dst,
59     const char **_RESTRICT_KYWD src, size_t nms, size_t len,
60     mbstate_t *_RESTRICT_KYWD);
61 size_t	__wcrtomb_ascii(char *_RESTRICT_KYWD, wchar_t,
62     mbstate_t *_RESTRICT_KYWD);
63 size_t	__wcsnrtombs_ascii(char *_RESTRICT_KYWD,
64     const wchar_t **_RESTRICT_KYWD,
65     size_t, size_t, mbstate_t *_RESTRICT_KYWD);
66 
67 
68 #endif /* !_LCTYPE_H_ */
69