1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
5 Copyright (C) 2006, 2007 Free Software Foundation, Inc.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
21 /* Written by Bruno Haible and Paul Eggert. */
24 * ISO C 99 <wctype.h> for platforms that lack it.
25 * <http://www.opengroup.org/susv3xbd/wctype.h.html>
27 * iswctype, towctrans, towlower, towupper, wctrans, wctype,
28 * wctrans_t, and wctype_t are not yet implemented.
34 /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
35 Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
37 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
38 included before <wchar.h>. */
45 /* Include the original <wctype.h> if it exists.
46 BeOS 5 has the functions but no <wctype.h>. */
47 /* The include_next requires a split double-inclusion guard. */
49 # @INCLUDE_NEXT@ @NEXT_WCTYPE_H@
56 typedef wint_t __wctype_wint_t;
58 typedef int __wctype_wint_t;
61 /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
62 Assume all 12 functions are implemented the same way, or not at all. */
65 /* IRIX 5.3 has macros but no functions, its isw* macros refer to an
66 undefined variable _ctmp_ and to <ctype.h> macros like _P, and they
67 refer to system functions like _iswctype that are not in the
68 standard C library. Rather than try to get ancient buggy
69 implementations like this to work, just disable them. */
84 iswalnum (__wctype_wint_t wc)
86 return ((wc >= '0' && wc <= '9')
87 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
91 iswalpha (__wctype_wint_t wc)
93 return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
97 iswblank (__wctype_wint_t wc)
99 return wc == ' ' || wc == '\t';
103 iswcntrl (__wctype_wint_t wc)
105 return (wc & ~0x1f) == 0 || wc == 0x7f;
109 iswdigit (__wctype_wint_t wc)
111 return wc >= '0' && wc <= '9';
115 iswgraph (__wctype_wint_t wc)
117 return wc >= '!' && wc <= '~';
121 iswlower (__wctype_wint_t wc)
123 return wc >= 'a' && wc <= 'z';
127 iswprint (__wctype_wint_t wc)
129 return wc >= ' ' && wc <= '~';
133 iswpunct (__wctype_wint_t wc)
135 return (wc >= '!' && wc <= '~'
136 && !((wc >= '0' && wc <= '9')
137 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
141 iswspace (__wctype_wint_t wc)
143 return (wc == ' ' || wc == '\t'
144 || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
148 iswupper (__wctype_wint_t wc)
150 return wc >= 'A' && wc <= 'Z';
154 iswxdigit (__wctype_wint_t wc)
156 return ((wc >= '0' && wc <= '9')
157 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
160 # endif /* ! HAVE_ISWCNTRL */
162 #endif /* _GL_WCTYPE_H */
163 #endif /* _GL_WCTYPE_H */