diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2009-01-15 09:22:57 (GMT) |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2009-01-15 10:19:08 (GMT) |
commit | 71cdb52799220f8d9052643baf1d3e9836a9c755 (patch) | |
tree | 27aee97a35d9ab51f0d8f64a46690bd41a5f8c1b /gl/wctype.in.h | |
parent | f7afa46586645e50498d8b2d0c67884f014dc3a4 (diff) | |
download | monitoring-plugins-71cdb52799220f8d9052643baf1d3e9836a9c755.tar.gz |
Sync with gnulib
Diffstat (limited to 'gl/wctype.in.h')
-rw-r--r-- | gl/wctype.in.h | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/gl/wctype.in.h b/gl/wctype.in.h index a86b5ad..f008d8f 100644 --- a/gl/wctype.in.h +++ b/gl/wctype.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A substitute for ISO C99 <wctype.h>, for platforms that lack it. | 1 | /* A substitute for ISO C99 <wctype.h>, for platforms that lack it. |
2 | 2 | ||
3 | Copyright (C) 2006, 2007 Free Software Foundation, Inc. | 3 | Copyright (C) 2006-2008 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published by |
@@ -28,6 +28,10 @@ | |||
28 | 28 | ||
29 | #ifndef _GL_WCTYPE_H | 29 | #ifndef _GL_WCTYPE_H |
30 | 30 | ||
31 | #if __GNUC__ >= 3 | ||
32 | @PRAGMA_SYSTEM_HEADER@ | ||
33 | #endif | ||
34 | |||
31 | #if @HAVE_WINT_T@ | 35 | #if @HAVE_WINT_T@ |
32 | /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. | 36 | /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. |
33 | Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | 37 | Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before |
@@ -50,15 +54,18 @@ | |||
50 | #ifndef _GL_WCTYPE_H | 54 | #ifndef _GL_WCTYPE_H |
51 | #define _GL_WCTYPE_H | 55 | #define _GL_WCTYPE_H |
52 | 56 | ||
53 | #if @HAVE_WINT_T@ | 57 | /* Define wint_t. (Also done in wchar.in.h.) */ |
54 | typedef wint_t __wctype_wint_t; | 58 | #if !@HAVE_WINT_T@ && !defined wint_t |
55 | #else | 59 | # define wint_t int |
56 | typedef int __wctype_wint_t; | 60 | # ifndef WEOF |
61 | # define WEOF -1 | ||
62 | # endif | ||
57 | #endif | 63 | #endif |
58 | 64 | ||
59 | /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. | 65 | /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. |
66 | Linux libc5 has <wctype.h> and the functions but they are broken. | ||
60 | Assume all 12 functions are implemented the same way, or not at all. */ | 67 | Assume all 12 functions are implemented the same way, or not at all. */ |
61 | #if ! @HAVE_ISWCNTRL@ | 68 | #if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ |
62 | 69 | ||
63 | /* IRIX 5.3 has macros but no functions, its isw* macros refer to an | 70 | /* IRIX 5.3 has macros but no functions, its isw* macros refer to an |
64 | undefined variable _ctmp_ and to <ctype.h> macros like _P, and they | 71 | undefined variable _ctmp_ and to <ctype.h> macros like _P, and they |
@@ -78,57 +85,73 @@ typedef int __wctype_wint_t; | |||
78 | # undef iswupper | 85 | # undef iswupper |
79 | # undef iswxdigit | 86 | # undef iswxdigit |
80 | 87 | ||
88 | /* Linux libc5 has <wctype.h> and the functions but they are broken. */ | ||
89 | # if @REPLACE_ISWCNTRL@ | ||
90 | # define iswalnum rpl_iswalnum | ||
91 | # define iswalpha rpl_iswalpha | ||
92 | # define iswblank rpl_iswblank | ||
93 | # define iswcntrl rpl_iswcntrl | ||
94 | # define iswdigit rpl_iswdigit | ||
95 | # define iswgraph rpl_iswgraph | ||
96 | # define iswlower rpl_iswlower | ||
97 | # define iswprint rpl_iswprint | ||
98 | # define iswpunct rpl_iswpunct | ||
99 | # define iswspace rpl_iswspace | ||
100 | # define iswupper rpl_iswupper | ||
101 | # define iswxdigit rpl_iswxdigit | ||
102 | # endif | ||
103 | |||
81 | static inline int | 104 | static inline int |
82 | iswalnum (__wctype_wint_t wc) | 105 | iswalnum (wint_t wc) |
83 | { | 106 | { |
84 | return ((wc >= '0' && wc <= '9') | 107 | return ((wc >= '0' && wc <= '9') |
85 | || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')); | 108 | || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')); |
86 | } | 109 | } |
87 | 110 | ||
88 | static inline int | 111 | static inline int |
89 | iswalpha (__wctype_wint_t wc) | 112 | iswalpha (wint_t wc) |
90 | { | 113 | { |
91 | return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; | 114 | return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; |
92 | } | 115 | } |
93 | 116 | ||
94 | static inline int | 117 | static inline int |
95 | iswblank (__wctype_wint_t wc) | 118 | iswblank (wint_t wc) |
96 | { | 119 | { |
97 | return wc == ' ' || wc == '\t'; | 120 | return wc == ' ' || wc == '\t'; |
98 | } | 121 | } |
99 | 122 | ||
100 | static inline int | 123 | static inline int |
101 | iswcntrl (__wctype_wint_t wc) | 124 | iswcntrl (wint_t wc) |
102 | { | 125 | { |
103 | return (wc & ~0x1f) == 0 || wc == 0x7f; | 126 | return (wc & ~0x1f) == 0 || wc == 0x7f; |
104 | } | 127 | } |
105 | 128 | ||
106 | static inline int | 129 | static inline int |
107 | iswdigit (__wctype_wint_t wc) | 130 | iswdigit (wint_t wc) |
108 | { | 131 | { |
109 | return wc >= '0' && wc <= '9'; | 132 | return wc >= '0' && wc <= '9'; |
110 | } | 133 | } |
111 | 134 | ||
112 | static inline int | 135 | static inline int |
113 | iswgraph (__wctype_wint_t wc) | 136 | iswgraph (wint_t wc) |
114 | { | 137 | { |
115 | return wc >= '!' && wc <= '~'; | 138 | return wc >= '!' && wc <= '~'; |
116 | } | 139 | } |
117 | 140 | ||
118 | static inline int | 141 | static inline int |
119 | iswlower (__wctype_wint_t wc) | 142 | iswlower (wint_t wc) |
120 | { | 143 | { |
121 | return wc >= 'a' && wc <= 'z'; | 144 | return wc >= 'a' && wc <= 'z'; |
122 | } | 145 | } |
123 | 146 | ||
124 | static inline int | 147 | static inline int |
125 | iswprint (__wctype_wint_t wc) | 148 | iswprint (wint_t wc) |
126 | { | 149 | { |
127 | return wc >= ' ' && wc <= '~'; | 150 | return wc >= ' ' && wc <= '~'; |
128 | } | 151 | } |
129 | 152 | ||
130 | static inline int | 153 | static inline int |
131 | iswpunct (__wctype_wint_t wc) | 154 | iswpunct (wint_t wc) |
132 | { | 155 | { |
133 | return (wc >= '!' && wc <= '~' | 156 | return (wc >= '!' && wc <= '~' |
134 | && !((wc >= '0' && wc <= '9') | 157 | && !((wc >= '0' && wc <= '9') |
@@ -136,20 +159,20 @@ iswpunct (__wctype_wint_t wc) | |||
136 | } | 159 | } |
137 | 160 | ||
138 | static inline int | 161 | static inline int |
139 | iswspace (__wctype_wint_t wc) | 162 | iswspace (wint_t wc) |
140 | { | 163 | { |
141 | return (wc == ' ' || wc == '\t' | 164 | return (wc == ' ' || wc == '\t' |
142 | || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'); | 165 | || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'); |
143 | } | 166 | } |
144 | 167 | ||
145 | static inline int | 168 | static inline int |
146 | iswupper (__wctype_wint_t wc) | 169 | iswupper (wint_t wc) |
147 | { | 170 | { |
148 | return wc >= 'A' && wc <= 'Z'; | 171 | return wc >= 'A' && wc <= 'Z'; |
149 | } | 172 | } |
150 | 173 | ||
151 | static inline int | 174 | static inline int |
152 | iswxdigit (__wctype_wint_t wc) | 175 | iswxdigit (wint_t wc) |
153 | { | 176 | { |
154 | return ((wc >= '0' && wc <= '9') | 177 | return ((wc >= '0' && wc <= '9') |
155 | || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')); | 178 | || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')); |