00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef _GL_WCTYPE_H
00032
00033 #if __GNUC__ >= 3
00034 @PRAGMA_SYSTEM_HEADER@
00035 #endif
00036 @PRAGMA_COLUMNS@
00037
00038 #if @HAVE_WINT_T@
00039
00040
00041
00042
00043
00044 # include <stddef.h>
00045 # include <stdio.h>
00046 # include <time.h>
00047 # include <wchar.h>
00048 #endif
00049
00050
00051
00052
00053 #if @HAVE_WCTYPE_H@
00054 # @INCLUDE_NEXT@ @NEXT_WCTYPE_H@
00055 #endif
00056
00057 #ifndef _GL_WCTYPE_H
00058 #define _GL_WCTYPE_H
00059
00060
00061
00062
00063
00064
00065 #if !@HAVE_WINT_T@ && !defined wint_t
00066 # define wint_t int
00067 # ifndef WEOF
00068 # define WEOF -1
00069 # endif
00070 #else
00071 # ifndef WEOF
00072 # define WEOF ((wint_t) -1)
00073 # endif
00074 #endif
00075
00076
00077 #if !GNULIB_defined_wctype_functions
00078
00079
00080
00081
00082
00083 # if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
00084
00085
00086
00087
00088
00089
00090 # undef iswalnum
00091 # undef iswalpha
00092 # undef iswblank
00093 # undef iswcntrl
00094 # undef iswdigit
00095 # undef iswgraph
00096 # undef iswlower
00097 # undef iswprint
00098 # undef iswpunct
00099 # undef iswspace
00100 # undef iswupper
00101 # undef iswxdigit
00102 # undef towlower
00103 # undef towupper
00104
00105
00106 # if @REPLACE_ISWCNTRL@
00107 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00108 # define iswalnum rpl_iswalnum
00109 # define iswalpha rpl_iswalpha
00110 # define iswblank rpl_iswblank
00111 # define iswcntrl rpl_iswcntrl
00112 # define iswdigit rpl_iswdigit
00113 # define iswgraph rpl_iswgraph
00114 # define iswlower rpl_iswlower
00115 # define iswprint rpl_iswprint
00116 # define iswpunct rpl_iswpunct
00117 # define iswspace rpl_iswspace
00118 # define iswupper rpl_iswupper
00119 # define iswxdigit rpl_iswxdigit
00120 # define towlower rpl_towlower
00121 # define towupper rpl_towupper
00122 # endif
00123 # endif
00124
00125 static inline int
00126 # if @REPLACE_ISWCNTRL@
00127 rpl_iswalnum
00128 # else
00129 iswalnum
00130 # endif
00131 (wint_t wc)
00132 {
00133 return ((wc >= '0' && wc <= '9')
00134 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
00135 }
00136
00137 static inline int
00138 # if @REPLACE_ISWCNTRL@
00139 rpl_iswalpha
00140 # else
00141 iswalpha
00142 # endif
00143 (wint_t wc)
00144 {
00145 return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
00146 }
00147
00148 static inline int
00149 # if @REPLACE_ISWCNTRL@
00150 rpl_iswblank
00151 # else
00152 iswblank
00153 # endif
00154 (wint_t wc)
00155 {
00156 return wc == ' ' || wc == '\t';
00157 }
00158
00159 static inline int
00160 # if @REPLACE_ISWCNTRL@
00161 rpl_iswcntrl
00162 # else
00163 iswcntrl
00164 # endif
00165 (wint_t wc)
00166 {
00167 return (wc & ~0x1f) == 0 || wc == 0x7f;
00168 }
00169
00170 static inline int
00171 # if @REPLACE_ISWCNTRL@
00172 rpl_iswdigit
00173 # else
00174 iswdigit
00175 # endif
00176 (wint_t wc)
00177 {
00178 return wc >= '0' && wc <= '9';
00179 }
00180
00181 static inline int
00182 # if @REPLACE_ISWCNTRL@
00183 rpl_iswgraph
00184 # else
00185 iswgraph
00186 # endif
00187 (wint_t wc)
00188 {
00189 return wc >= '!' && wc <= '~';
00190 }
00191
00192 static inline int
00193 # if @REPLACE_ISWCNTRL@
00194 rpl_iswlower
00195 # else
00196 iswlower
00197 # endif
00198 (wint_t wc)
00199 {
00200 return wc >= 'a' && wc <= 'z';
00201 }
00202
00203 static inline int
00204 # if @REPLACE_ISWCNTRL@
00205 rpl_iswprint
00206 # else
00207 iswprint
00208 # endif
00209 (wint_t wc)
00210 {
00211 return wc >= ' ' && wc <= '~';
00212 }
00213
00214 static inline int
00215 # if @REPLACE_ISWCNTRL@
00216 rpl_iswpunct
00217 # else
00218 iswpunct
00219 # endif
00220 (wint_t wc)
00221 {
00222 return (wc >= '!' && wc <= '~'
00223 && !((wc >= '0' && wc <= '9')
00224 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
00225 }
00226
00227 static inline int
00228 # if @REPLACE_ISWCNTRL@
00229 rpl_iswspace
00230 # else
00231 iswspace
00232 # endif
00233 (wint_t wc)
00234 {
00235 return (wc == ' ' || wc == '\t'
00236 || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
00237 }
00238
00239 static inline int
00240 # if @REPLACE_ISWCNTRL@
00241 rpl_iswupper
00242 # else
00243 iswupper
00244 # endif
00245 (wint_t wc)
00246 {
00247 return wc >= 'A' && wc <= 'Z';
00248 }
00249
00250 static inline int
00251 # if @REPLACE_ISWCNTRL@
00252 rpl_iswxdigit
00253 # else
00254 iswxdigit
00255 # endif
00256 (wint_t wc)
00257 {
00258 return ((wc >= '0' && wc <= '9')
00259 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
00260 }
00261
00262 static inline wint_t
00263 # if @REPLACE_ISWCNTRL@
00264 rpl_towlower
00265 # else
00266 towlower
00267 # endif
00268 (wint_t wc)
00269 {
00270 return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc);
00271 }
00272
00273 static inline wint_t
00274 # if @REPLACE_ISWCNTRL@
00275 rpl_towupper
00276 # else
00277 towupper
00278 # endif
00279 (wint_t wc)
00280 {
00281 return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
00282 }
00283
00284 # elif ! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@
00285
00286
00287 # if @REPLACE_ISWBLANK@
00288 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00289 # define iswblank rpl_iswblank
00290 # endif
00291 _GL_FUNCDECL_RPL (iswblank, int, (wint_t wc));
00292 # else
00293 _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc));
00294 # endif
00295
00296 # endif
00297
00298 # if defined __MINGW32__
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313 static inline wint_t
00314 rpl_towlower (wint_t wc)
00315 {
00316 return (wint_t) (wchar_t) towlower (wc);
00317 }
00318 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00319 # define towlower rpl_towlower
00320 # endif
00321
00322 static inline wint_t
00323 rpl_towupper (wint_t wc)
00324 {
00325 return (wint_t) (wchar_t) towupper (wc);
00326 }
00327 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00328 # define towupper rpl_towupper
00329 # endif
00330
00331 # endif
00332
00333 # define GNULIB_defined_wctype_functions 1
00334 #endif
00335
00336 #if @REPLACE_ISWCNTRL@
00337 _GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc));
00338 _GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc));
00339 _GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
00340 _GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc));
00341 _GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc));
00342 _GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc));
00343 _GL_CXXALIAS_RPL (iswlower, int, (wint_t wc));
00344 _GL_CXXALIAS_RPL (iswprint, int, (wint_t wc));
00345 _GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc));
00346 _GL_CXXALIAS_RPL (iswspace, int, (wint_t wc));
00347 _GL_CXXALIAS_RPL (iswupper, int, (wint_t wc));
00348 _GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc));
00349 #else
00350 _GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc));
00351 _GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc));
00352 # if @REPLACE_ISWBLANK@
00353 _GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
00354 # else
00355 _GL_CXXALIAS_SYS (iswblank, int, (wint_t wc));
00356 # endif
00357 _GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc));
00358 _GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc));
00359 _GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc));
00360 _GL_CXXALIAS_SYS (iswlower, int, (wint_t wc));
00361 _GL_CXXALIAS_SYS (iswprint, int, (wint_t wc));
00362 _GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc));
00363 _GL_CXXALIAS_SYS (iswspace, int, (wint_t wc));
00364 _GL_CXXALIAS_SYS (iswupper, int, (wint_t wc));
00365 _GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc));
00366 #endif
00367 _GL_CXXALIASWARN (iswalnum);
00368 _GL_CXXALIASWARN (iswalpha);
00369 _GL_CXXALIASWARN (iswblank);
00370 _GL_CXXALIASWARN (iswcntrl);
00371 _GL_CXXALIASWARN (iswdigit);
00372 _GL_CXXALIASWARN (iswgraph);
00373 _GL_CXXALIASWARN (iswlower);
00374 _GL_CXXALIASWARN (iswprint);
00375 _GL_CXXALIASWARN (iswpunct);
00376 _GL_CXXALIASWARN (iswspace);
00377 _GL_CXXALIASWARN (iswupper);
00378 _GL_CXXALIASWARN (iswxdigit);
00379
00380 #if @REPLACE_ISWCNTRL@ || defined __MINGW32__
00381 _GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc));
00382 _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc));
00383 #else
00384 _GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc));
00385 _GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc));
00386 #endif
00387 _GL_CXXALIASWARN (towlower);
00388 _GL_CXXALIASWARN (towupper);
00389
00390
00391 #endif
00392 #endif