add Param_Polyhedron_Scale_Integer prototype
[barvinok.git] / lib / wctype_.h
blobaa17f9c8f839b1e7a79b1c7b1c729c34de38f29d
1 /* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
3 Copyright (C) 2006 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 /* Written by Bruno Haible and Paul Eggert. */
22 * ISO C 99 <wctype.h> for platforms that lack it.
23 * <http://www.opengroup.org/susv3xbd/wctype.h.html>
25 * iswctype, towctrans, towlower, towupper, wctrans, wctype,
26 * wctrans_t, and wctype_t are not yet implemented.
29 #ifndef _GL_WCTYPE_H
30 #define _GL_WCTYPE_H
32 #if @HAVE_WINT_T@ - 0
33 /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
34 Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
35 <wchar.h>.
36 BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
37 <wchar.h>. */
38 # include <stdio.h>
39 # include <time.h>
40 # include <wchar.h>
41 typedef wint_t __wctype_wint_t;
42 #else
43 typedef int __wctype_wint_t;
44 #endif
46 /* Include the original <wctype.h> if it exists.
47 BeOS 5 has the functions but no <wctype.h>. */
48 #if @HAVE_WCTYPE_H@
49 # include @ABSOLUTE_WCTYPE_H@
50 #endif
52 /* IRIX 5.3 has a bug: its isw* macros reference an undefined variable
53 _ctmp_. */
54 #if @HAVE_WCTYPE_CTMP_BUG@
55 static wint_t _ctmp_;
56 #endif
58 /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
59 Assume all 12 functions are implemented the same way, or not at all. */
61 #if !defined iswalnum && !HAVE_ISWCNTRL
62 static inline int
63 iswalnum (__wctype_wint_t wc)
65 return ((wc >= '0' && wc <= '9')
66 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
68 # define iswalnum iswalnum
69 #endif
71 #if !defined iswalpha && !HAVE_ISWCNTRL
72 static inline int
73 iswalpha (__wctype_wint_t wc)
75 return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
77 # define iswalpha iswalpha
78 #endif
80 #if !defined iswblank && !HAVE_ISWCNTRL
81 static inline int
82 iswblank (__wctype_wint_t wc)
84 return wc == ' ' || wc == '\t';
86 # define iswblank iswblank
87 #endif
89 #if !defined iswcntrl && !HAVE_ISWCNTRL
90 static inline int
91 iswcntrl (__wctype_wint_t wc)
93 return (wc & ~0x1f) == 0 || wc == 0x7f;
95 # define iswcntrl iswcntrl
96 #endif
98 #if !defined iswdigit && !HAVE_ISWCNTRL
99 static inline int
100 iswdigit (__wctype_wint_t wc)
102 return wc >= '0' && wc <= '9';
104 # define iswdigit iswdigit
105 #endif
107 #if !defined iswgraph && !HAVE_ISWCNTRL
108 static inline int
109 iswgraph (__wctype_wint_t wc)
111 return wc >= '!' && wc <= '~';
113 # define iswgraph iswgraph
114 #endif
116 #if !defined iswlower && !HAVE_ISWCNTRL
117 static inline int
118 iswlower (__wctype_wint_t wc)
120 return wc >= 'a' && wc <= 'z';
122 # define iswlower iswlower
123 #endif
125 #if !defined iswprint && !HAVE_ISWCNTRL
126 static inline int
127 iswprint (__wctype_wint_t wc)
129 return wc >= ' ' && wc <= '~';
131 # define iswprint iswprint
132 #endif
134 #if !defined iswpunct && !HAVE_ISWCNTRL
135 static inline int
136 iswpunct (__wctype_wint_t wc)
138 return (wc >= '!' && wc <= '~'
139 && !((wc >= '0' && wc <= '9')
140 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
142 # define iswpunct iswpunct
143 #endif
145 #if !defined iswspace && !HAVE_ISWCNTRL
146 static inline int
147 iswspace (__wctype_wint_t wc)
149 return (wc == ' ' || wc == '\t'
150 || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
152 # define iswspace iswspace
153 #endif
155 #if !defined iswupper && !HAVE_ISWCNTRL
156 static inline int
157 iswupper (__wctype_wint_t wc)
159 return wc >= 'A' && wc <= 'Z';
161 # define iswupper iswupper
162 #endif
164 #if !defined iswxdigit && !HAVE_ISWCNTRL
165 static inline int
166 iswxdigit (__wctype_wint_t wc)
168 return ((wc >= '0' && wc <= '9')
169 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
171 # define iswxdigit iswxdigit
172 #endif
175 #endif /* _GL_WCTYPE_H */