wctype.h revision 227476
1254721Semaste/*-
2254721Semaste * Copyright (c)1999 Citrus Project,
3254721Semaste * All rights reserved.
4254721Semaste *
5254721Semaste * Redistribution and use in source and binary forms, with or without
6254721Semaste * modification, are permitted provided that the following conditions
7254721Semaste * are met:
8254721Semaste * 1. Redistributions of source code must retain the above copyright
9254721Semaste *    notice, this list of conditions and the following disclaimer.
10254721Semaste * 2. Redistributions in binary form must reproduce the above copyright
11254721Semaste *    notice, this list of conditions and the following disclaimer in the
12254721Semaste *    documentation and/or other materials provided with the distribution.
13254721Semaste *
14254721Semaste * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15254721Semaste * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16254721Semaste * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17254721Semaste * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18254721Semaste * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19254721Semaste * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20254721Semaste * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21254721Semaste * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22254721Semaste * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23254721Semaste * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24254721Semaste * SUCH DAMAGE.
25263367Semaste *
26254721Semaste *	citrus Id: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp
27254721Semaste *	$NetBSD: wctype.h,v 1.3 2000/12/22 14:16:16 itojun Exp $
28254721Semaste * $FreeBSD: head/include/wctype.h 227476 2011-11-12 20:45:10Z theraven $
29254721Semaste */
30263363Semaste
31254721Semaste#ifndef _WCTYPE_H_
32254721Semaste#define	_WCTYPE_H_
33254721Semaste
34254721Semaste#include <sys/cdefs.h>
35263363Semaste#include <sys/_types.h>
36263363Semaste
37263363Semaste#include <_ctype.h>
38263363Semaste
39263363Semaste#ifndef _WCTRANS_T
40263363Semastetypedef	int	wctrans_t;
41263363Semaste#define	_WCTRANS_T
42263363Semaste#endif
43263363Semaste
44263363Semaste#ifndef _WCTYPE_T
45263363Semastetypedef	unsigned long	wctype_t;
46263363Semaste#define	_WCTYPE_T
47263363Semaste#endif
48263363Semaste
49263363Semaste#ifndef _WINT_T_DECLARED
50263363Semastetypedef	__wint_t	wint_t;
51263363Semaste#define	_WINT_T_DECLARED
52263363Semaste#endif
53263363Semaste
54263363Semaste#ifndef WEOF
55263363Semaste#define	WEOF	((wint_t)-1)
56263363Semaste#endif
57263363Semaste
58263363Semaste__BEGIN_DECLS
59263363Semasteint	iswalnum(wint_t);
60263363Semasteint	iswalpha(wint_t);
61263363Semasteint	iswblank(wint_t);
62263363Semasteint	iswcntrl(wint_t);
63254721Semasteint	iswctype(wint_t, wctype_t);
64263363Semasteint	iswdigit(wint_t);
65263363Semasteint	iswgraph(wint_t);
66263363Semasteint	iswlower(wint_t);
67263363Semasteint	iswprint(wint_t);
68263363Semasteint	iswpunct(wint_t);
69263363Semasteint	iswspace(wint_t);
70263363Semasteint	iswupper(wint_t);
71263363Semasteint	iswxdigit(wint_t);
72263363Semastewint_t	towctrans(wint_t, wctrans_t);
73263363Semastewint_t	towlower(wint_t);
74263363Semastewint_t	towupper(wint_t);
75263363Semastewctrans_t
76263363Semaste	wctrans(const char *);
77263363Semastewctype_t
78263363Semaste	wctype(const char *);
79263363Semaste
80263363Semaste#if __BSD_VISIBLE
81263363Semastewint_t	iswascii(wint_t);
82263363Semastewint_t	iswhexnumber(wint_t);
83263363Semastewint_t	iswideogram(wint_t);
84263363Semastewint_t	iswnumber(wint_t);
85263363Semastewint_t	iswphonogram(wint_t);
86263363Semastewint_t	iswrune(wint_t);
87263363Semastewint_t	iswspecial(wint_t);
88263363Semastewint_t	nextwctype(wint_t, wctype_t);
89263363Semaste#endif
90263363Semaste__END_DECLS
91263363Semaste
92263363Semaste#ifndef __cplusplus
93263363Semaste#define	iswalnum(wc)		__istype((wc), _CTYPE_A|_CTYPE_D)
94263363Semaste#define	iswalpha(wc)		__istype((wc), _CTYPE_A)
95263363Semaste#define	iswblank(wc)		__istype((wc), _CTYPE_B)
96263363Semaste#define	iswcntrl(wc)		__istype((wc), _CTYPE_C)
97263363Semaste#define	iswctype(wc, charclass)	__istype((wc), (charclass))
98263363Semaste#define	iswdigit(wc)		__isctype((wc), _CTYPE_D)
99263363Semaste#define	iswgraph(wc)		__istype((wc), _CTYPE_G)
100263363Semaste#define	iswlower(wc)		__istype((wc), _CTYPE_L)
101263363Semaste#define	iswprint(wc)		__istype((wc), _CTYPE_R)
102263363Semaste#define	iswpunct(wc)		__istype((wc), _CTYPE_P)
103263363Semaste#define	iswspace(wc)		__istype((wc), _CTYPE_S)
104263363Semaste#define	iswupper(wc)		__istype((wc), _CTYPE_U)
105263363Semaste#define	iswxdigit(wc)		__isctype((wc), _CTYPE_X)
106263363Semaste#define	towlower(wc)		__tolower(wc)
107263363Semaste#define	towupper(wc)		__toupper(wc)
108263363Semaste
109263363Semaste#if __BSD_VISIBLE
110263363Semaste#define	iswascii(wc)		(((wc) & ~0x7F) == 0)
111263363Semaste#define	iswhexnumber(wc)	__istype((wc), _CTYPE_X)
112263363Semaste#define	iswideogram(wc)		__istype((wc), _CTYPE_I)
113263363Semaste#define	iswnumber(wc)		__istype((wc), _CTYPE_D)
114263363Semaste#define	iswphonogram(wc)	__istype((wc), _CTYPE_Q)
115263363Semaste#define	iswrune(wc)		__istype((wc), 0xFFFFFF00L)
116263363Semaste#define	iswspecial(wc)		__istype((wc), _CTYPE_T)
117263363Semaste#endif /* __BSD_VISIBLE */
118263363Semaste#endif /* __cplusplus */
119263363Semaste
120263363Semaste#endif		/* _WCTYPE_H_ */
121263363Semaste