1 /* @(#)wctype.h	1.14 19/08/17 Copyright 2009-2019 J. Schilling */
2 /*
3  *	Abstraction from wctype.h
4  *
5  *	Copyright (c) 2009-2019 J. Schilling
6  */
7 /*
8  * The contents of this file are subject to the terms of the
9  * Common Development and Distribution License, Version 1.0 only
10  * (the "License").  You may not use this file except in compliance
11  * with the License.
12  *
13  * See the file CDDL.Schily.txt in this distribution for details.
14  * A copy of the CDDL is also available via the Internet at
15  * http://www.opensource.org/licenses/cddl1.txt
16  *
17  * When distributing Covered Code, include this CDDL HEADER in each
18  * file and include the License file CDDL.Schily.txt from this distribution.
19  */
20 
21 #ifndef _SCHILY_WCTYPE_H
22 #define	_SCHILY_WCTYPE_H
23 
24 #ifndef	_SCHILY_MCONFIG_H
25 #include <schily/mconfig.h>
26 #endif
27 
28 #ifndef	_SCHILY_WCHAR_H
29 #include <schily/wchar.h>
30 #endif
31 
32 #ifdef	HAVE_WCTYPE_H
33 /*
34  * Include wctype.h if wchars have been enabled in schily/wchar.h
35  */
36 #ifdef	USE_WCHAR
37 #ifndef	_INCL_WCTYPE_H
38 #include <wctype.h>
39 #define	_INCL_WCTYPE_H
40 #endif
41 #ifndef	USE_WCTYPE
42 #define	USE_WCTYPE
43 #endif
44 #endif	/* USE_WCHAR */
45 #endif	/* HAVE_WCTYPE_H */
46 
47 #if	defined(HAVE_ISWPRINT) && defined(USE_WCHAR)
48 #ifndef	USE_WCTYPE
49 #define	USE_WCTYPE
50 #endif
51 #endif
52 
53 /*
54  * DJGPP has wctype.h but no iswprint()...
55  * HP-UX-10.x has iswprint()... in wchar.h
56  */
57 #if	(!defined(HAVE_WCTYPE_H) && !defined(HAVE_WCHAR_H)) || \
58 	!defined(HAVE_ISWPRINT)
59 #undef	USE_WCTYPE
60 #endif
61 
62 #ifdef	NO_WCTYPE
63 #undef	USE_WCTYPE
64 #endif
65 
66 #ifndef	USE_WCTYPE
67 
68 #ifndef	_SCHILY_CTYPE_H
69 #include <schily/ctype.h>
70 #endif
71 
72 #undef	iswalnum
73 #define	iswalnum(c)	isalnum(c)
74 #undef	iswalpha
75 #define	iswalpha(c)	isalpha(c)
76 #ifdef	HAVE_ISBLANK
77 #undef	iswblank
78 #define	iswblank(c)	isblank(c)
79 #endif
80 #undef	iswcntrl
81 #define	iswcntrl(c)	iscntrl(c)
82 #undef	iswcntrl
83 #define	iswcntrl(c)	iscntrl(c)
84 #undef	iswdigit
85 #define	iswdigit(c)	isdigit(c)
86 #undef	iswgraph
87 #define	iswgraph(c)	isgraph(c)
88 #undef	iswlower
89 #define	iswlower(c)	islower(c)
90 #undef	iswprint
91 #define	iswprint(c)	isprint(c)
92 #undef	iswpunct
93 #define	iswpunct(c)	ispunct(c)
94 #undef	iswspace
95 #define	iswspace(c)	isspace(c)
96 #undef	iswupper
97 #define	iswupper(c)	isupper(c)
98 #undef	iswxdigit
99 #define	iswxdigit(c)	isxdigit(c)
100 
101 #undef	towlower
102 #define	towlower(c)	tolower(c)
103 #undef	towupper
104 #define	towupper(c)	toupper(c)
105 
106 #endif	/* !USE_WCTYPE */
107 
108 #ifdef	__cplusplus
109 extern "C" {
110 #endif
111 
112 #ifndef	HAVE_WCTYPE
113 extern	wctype_t	wctype		__PR((const char *));
114 #endif
115 #ifndef	HAVE_ISWCTYPE
116 extern	int		iswctype	__PR((wint_t, wctype_t));
117 #endif
118 
119 #ifdef	__cplusplus
120 }
121 #endif
122 
123 #endif	/* _SCHILY_WCTYPE_H */
124