xref: /illumos-gate/usr/src/lib/libc/port/locale/lctype.h (revision 0ac311ba)
12d08521bSGarrett D'Amore /*
22d08521bSGarrett D'Amore  * This file and its contents are supplied under the terms of the
32d08521bSGarrett D'Amore  * Common Development and Distribution License ("CDDL"), version 1.0.
42d08521bSGarrett D'Amore  * You may only use this file in accordance with the terms of version
52d08521bSGarrett D'Amore  * 1.0 of the CDDL.
62d08521bSGarrett D'Amore  *
72d08521bSGarrett D'Amore  * A full copy of the text of the CDDL should have accompanied this
82d08521bSGarrett D'Amore  * source.  A copy of the CDDL is also available via the Internet at
92d08521bSGarrett D'Amore  * http://www.illumos.org/license/CDDL.
102d08521bSGarrett D'Amore  */
112d08521bSGarrett D'Amore 
122d08521bSGarrett D'Amore /*
132d08521bSGarrett D'Amore  * Copyright 2013 Garrett D'Amore <garrett@damore.org>
142d08521bSGarrett D'Amore  */
152d08521bSGarrett D'Amore 
162d08521bSGarrett D'Amore #ifndef	_LCTYPE_H_
172d08521bSGarrett D'Amore #define	_LCTYPE_H_
182d08521bSGarrett D'Amore 
192d08521bSGarrett D'Amore #include <wchar.h>
20*0ac311baSRobert Mustacchi #include <sys/types.h>
212d08521bSGarrett D'Amore 
222d08521bSGarrett D'Amore /* private LC_CTYPE related structures */
232d08521bSGarrett D'Amore 
242d08521bSGarrett D'Amore /* encoding callbacks */
252d08521bSGarrett D'Amore struct lc_ctype {
262d08521bSGarrett D'Amore 
272d08521bSGarrett D'Amore 	size_t (*lc_mbrtowc)(wchar_t *_RESTRICT_KYWD,
28*0ac311baSRobert Mustacchi 	    const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD,
29*0ac311baSRobert Mustacchi 	    boolean_t);
302d08521bSGarrett D'Amore 
312d08521bSGarrett D'Amore 	int (*lc_mbsinit)(const mbstate_t *);
322d08521bSGarrett D'Amore 
332d08521bSGarrett D'Amore 	size_t (*lc_mbsnrtowcs)(wchar_t *_RESTRICT_KYWD,
342d08521bSGarrett D'Amore 	    const char **_RESTRICT_KYWD, size_t, size_t,
352d08521bSGarrett D'Amore 	    mbstate_t *_RESTRICT_KYWD);
362d08521bSGarrett D'Amore 
372d08521bSGarrett D'Amore 	size_t (*lc_wcrtomb)(char *_RESTRICT_KYWD, wchar_t,
382d08521bSGarrett D'Amore 	    mbstate_t *_RESTRICT_KYWD);
392d08521bSGarrett D'Amore 
402d08521bSGarrett D'Amore 	size_t (*lc_wcsnrtombs)(char *_RESTRICT_KYWD,
412d08521bSGarrett D'Amore 	    const wchar_t **_RESTRICT_KYWD, size_t, size_t,
422d08521bSGarrett D'Amore 	    mbstate_t *_RESTRICT_KYWD);
432d08521bSGarrett D'Amore 
442d08521bSGarrett D'Amore 	unsigned char lc_is_ascii;
452d08521bSGarrett D'Amore 	unsigned char lc_max_mblen;
462d08521bSGarrett D'Amore 
472d08521bSGarrett D'Amore 	const int *lc_trans_upper;
482d08521bSGarrett D'Amore 	const int *lc_trans_lower;
492d08521bSGarrett D'Amore 	const unsigned *lc_ctype_mask;
502d08521bSGarrett D'Amore };
512d08521bSGarrett D'Amore 
522d08521bSGarrett D'Amore /*
532d08521bSGarrett D'Amore  * Default implementation (C locale, i.e. ASCII).
542d08521bSGarrett D'Amore  */
552d08521bSGarrett D'Amore size_t	__mbrtowc_ascii(wchar_t *_RESTRICT_KYWD,
56*0ac311baSRobert Mustacchi     const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD, boolean_t);
572d08521bSGarrett D'Amore int	__mbsinit_ascii(const mbstate_t *);
582d08521bSGarrett D'Amore size_t	__mbsnrtowcs_ascii(wchar_t *_RESTRICT_KYWD dst,
592d08521bSGarrett D'Amore     const char **_RESTRICT_KYWD src, size_t nms, size_t len,
602d08521bSGarrett D'Amore     mbstate_t *_RESTRICT_KYWD);
612d08521bSGarrett D'Amore size_t	__wcrtomb_ascii(char *_RESTRICT_KYWD, wchar_t,
622d08521bSGarrett D'Amore     mbstate_t *_RESTRICT_KYWD);
632d08521bSGarrett D'Amore size_t	__wcsnrtombs_ascii(char *_RESTRICT_KYWD,
642d08521bSGarrett D'Amore     const wchar_t **_RESTRICT_KYWD,
652d08521bSGarrett D'Amore     size_t, size_t, mbstate_t *_RESTRICT_KYWD);
662d08521bSGarrett D'Amore 
672d08521bSGarrett D'Amore 
682d08521bSGarrett D'Amore #endif /* !_LCTYPE_H_ */
69