diff options
Diffstat (limited to 'gl/wctype_.h')
-rw-r--r-- | gl/wctype_.h | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/gl/wctype_.h b/gl/wctype_.h deleted file mode 100644 index 1297c61..0000000 --- a/gl/wctype_.h +++ /dev/null | |||
@@ -1,154 +0,0 @@ | |||
1 | /* A substitute for ISO C99 <wctype.h>, for platforms that lack it. | ||
2 | |||
3 | Copyright (C) 2006, 2007 Free Software Foundation, Inc. | ||
4 | |||
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. | ||
9 | |||
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. | ||
14 | |||
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. */ | ||
18 | |||
19 | /* Written by Bruno Haible and Paul Eggert. */ | ||
20 | |||
21 | /* | ||
22 | * ISO C 99 <wctype.h> for platforms that lack it. | ||
23 | * <http://www.opengroup.org/susv3xbd/wctype.h.html> | ||
24 | * | ||
25 | * iswctype, towctrans, towlower, towupper, wctrans, wctype, | ||
26 | * wctrans_t, and wctype_t are not yet implemented. | ||
27 | */ | ||
28 | |||
29 | #ifndef _GL_WCTYPE_H | ||
30 | #define _GL_WCTYPE_H | ||
31 | |||
32 | #if @HAVE_WINT_T@ | ||
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.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
37 | included before <wchar.h>. */ | ||
38 | # include <stddef.h> | ||
39 | # include <stdio.h> | ||
40 | # include <time.h> | ||
41 | # include <wchar.h> | ||
42 | typedef wint_t __wctype_wint_t; | ||
43 | #else | ||
44 | typedef int __wctype_wint_t; | ||
45 | #endif | ||
46 | |||
47 | /* Include the original <wctype.h> if it exists. | ||
48 | BeOS 5 has the functions but no <wctype.h>. */ | ||
49 | #if @HAVE_WCTYPE_H@ | ||
50 | # include @ABSOLUTE_WCTYPE_H@ | ||
51 | #endif | ||
52 | |||
53 | /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. | ||
54 | Assume all 12 functions are implemented the same way, or not at all. */ | ||
55 | #if ! HAVE_ISWCNTRL | ||
56 | |||
57 | /* IRIX 5.3 has macros but no functions, its isw* macros refer to an | ||
58 | undefined variable _ctmp_ and to <ctype.h> macros like _P, and they | ||
59 | refer to system functions like _iswctype that are not in the | ||
60 | standard C library. Rather than try to get ancient buggy | ||
61 | implementations like this to work, just disable them. */ | ||
62 | # undef iswalnum | ||
63 | # undef iswalpha | ||
64 | # undef iswblank | ||
65 | # undef iswcntrl | ||
66 | # undef iswdigit | ||
67 | # undef iswgraph | ||
68 | # undef iswlower | ||
69 | # undef iswprint | ||
70 | # undef iswpunct | ||
71 | # undef iswspace | ||
72 | # undef iswupper | ||
73 | # undef iswxdigit | ||
74 | |||
75 | static inline int | ||
76 | iswalnum (__wctype_wint_t wc) | ||
77 | { | ||
78 | return ((wc >= '0' && wc <= '9') | ||
79 | || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')); | ||
80 | } | ||
81 | |||
82 | static inline int | ||
83 | iswalpha (__wctype_wint_t wc) | ||
84 | { | ||
85 | return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; | ||
86 | } | ||
87 | |||
88 | static inline int | ||
89 | iswblank (__wctype_wint_t wc) | ||
90 | { | ||
91 | return wc == ' ' || wc == '\t'; | ||
92 | } | ||
93 | |||
94 | static inline int | ||
95 | iswcntrl (__wctype_wint_t wc) | ||
96 | { | ||
97 | return (wc & ~0x1f) == 0 || wc == 0x7f; | ||
98 | } | ||
99 | |||
100 | static inline int | ||
101 | iswdigit (__wctype_wint_t wc) | ||
102 | { | ||
103 | return wc >= '0' && wc <= '9'; | ||
104 | } | ||
105 | |||
106 | static inline int | ||
107 | iswgraph (__wctype_wint_t wc) | ||
108 | { | ||
109 | return wc >= '!' && wc <= '~'; | ||
110 | } | ||
111 | |||
112 | static inline int | ||
113 | iswlower (__wctype_wint_t wc) | ||
114 | { | ||
115 | return wc >= 'a' && wc <= 'z'; | ||
116 | } | ||
117 | |||
118 | static inline int | ||
119 | iswprint (__wctype_wint_t wc) | ||
120 | { | ||
121 | return wc >= ' ' && wc <= '~'; | ||
122 | } | ||
123 | |||
124 | static inline int | ||
125 | iswpunct (__wctype_wint_t wc) | ||
126 | { | ||
127 | return (wc >= '!' && wc <= '~' | ||
128 | && !((wc >= '0' && wc <= '9') | ||
129 | || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'))); | ||
130 | } | ||
131 | |||
132 | static inline int | ||
133 | iswspace (__wctype_wint_t wc) | ||
134 | { | ||
135 | return (wc == ' ' || wc == '\t' | ||
136 | || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'); | ||
137 | } | ||
138 | |||
139 | static inline int | ||
140 | iswupper (__wctype_wint_t wc) | ||
141 | { | ||
142 | return wc >= 'A' && wc <= 'Z'; | ||
143 | } | ||
144 | |||
145 | static inline int | ||
146 | iswxdigit (__wctype_wint_t wc) | ||
147 | { | ||
148 | return ((wc >= '0' && wc <= '9') | ||
149 | || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')); | ||
150 | } | ||
151 | |||
152 | # endif /* ! HAVE_ISWCNTRL */ | ||
153 | |||
154 | #endif /* _GL_WCTYPE_H */ | ||