1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 2 /* A substitute for ISO C99 <wctype.h>, for platforms that lack it. 3 4 Copyright (C) 2006-2015 Free Software Foundation, Inc. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3, or (at your option) 9 any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, see <http://www.gnu.org/licenses/>. */ 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 31 #if __GNUC__ >= 3 32 #pragma GCC system_header 33 #endif 34 35 36 #if 1 37 /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. 38 Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before 39 <wchar.h>. 40 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be 41 included before <wchar.h>. */ 42 # include <stddef.h> 43 # include <stdio.h> 44 # include <time.h> 45 # include <wchar.h> 46 #endif 47 48 /* mingw has declarations of towupper and towlower in <ctype.h> as 49 well <wctype.h>. Include <ctype.h> in advance to avoid rpl_ prefix 50 being added to the declarations. */ 51 #ifdef __MINGW32__ 52 # include <ctype.h> 53 #endif 54 55 /* Include the original <wctype.h> if it exists. 56 BeOS 5 has the functions but no <wctype.h>. */ 57 /* The include_next requires a split double-inclusion guard. */ 58 #if 1 59 # include_next <wctype.h> 60 #endif 61 62 #ifndef _GL_WCTYPE_H 63 #define _GL_WCTYPE_H 64 65 #ifndef _GL_INLINE_HEADER_BEGIN 66 #error "Please include config.h first." 67 #endif 68 _GL_INLINE_HEADER_BEGIN 69 #ifndef _GL_WCTYPE_INLINE 70 # define _GL_WCTYPE_INLINE _GL_INLINE 71 #endif 72 73 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 74 #ifndef _GL_CXXDEFS_H 75 #define _GL_CXXDEFS_H 76 77 /* The three most frequent use cases of these macros are: 78 79 * For providing a substitute for a function that is missing on some 80 platforms, but is declared and works fine on the platforms on which 81 it exists: 82 83 #if @GNULIB_FOO@ 84 # if !@HAVE_FOO@ 85 _GL_FUNCDECL_SYS (foo, ...); 86 # endif 87 _GL_CXXALIAS_SYS (foo, ...); 88 _GL_CXXALIASWARN (foo); 89 #elif defined GNULIB_POSIXCHECK 90 ... 91 #endif 92 93 * For providing a replacement for a function that exists on all platforms, 94 but is broken/insufficient and needs to be replaced on some platforms: 95 96 #if @GNULIB_FOO@ 97 # if @REPLACE_FOO@ 98 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 99 # undef foo 100 # define foo rpl_foo 101 # endif 102 _GL_FUNCDECL_RPL (foo, ...); 103 _GL_CXXALIAS_RPL (foo, ...); 104 # else 105 _GL_CXXALIAS_SYS (foo, ...); 106 # endif 107 _GL_CXXALIASWARN (foo); 108 #elif defined GNULIB_POSIXCHECK 109 ... 110 #endif 111 112 * For providing a replacement for a function that exists on some platforms 113 but is broken/insufficient and needs to be replaced on some of them and 114 is additionally either missing or undeclared on some other platforms: 115 116 #if @GNULIB_FOO@ 117 # if @REPLACE_FOO@ 118 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 119 # undef foo 120 # define foo rpl_foo 121 # endif 122 _GL_FUNCDECL_RPL (foo, ...); 123 _GL_CXXALIAS_RPL (foo, ...); 124 # else 125 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 126 _GL_FUNCDECL_SYS (foo, ...); 127 # endif 128 _GL_CXXALIAS_SYS (foo, ...); 129 # endif 130 _GL_CXXALIASWARN (foo); 131 #elif defined GNULIB_POSIXCHECK 132 ... 133 #endif 134 */ 135 136 /* _GL_EXTERN_C declaration; 137 performs the declaration with C linkage. */ 138 #if defined __cplusplus 139 # define _GL_EXTERN_C extern "C" 140 #else 141 # define _GL_EXTERN_C extern 142 #endif 143 144 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 145 declares a replacement function, named rpl_func, with the given prototype, 146 consisting of return type, parameters, and attributes. 147 Example: 148 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 149 _GL_ARG_NONNULL ((1))); 150 */ 151 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 152 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 153 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 154 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 155 156 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 157 declares the system function, named func, with the given prototype, 158 consisting of return type, parameters, and attributes. 159 Example: 160 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 161 _GL_ARG_NONNULL ((1))); 162 */ 163 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 164 _GL_EXTERN_C rettype func parameters_and_attributes 165 166 /* _GL_CXXALIAS_RPL (func, rettype, parameters); 167 declares a C++ alias called GNULIB_NAMESPACE::func 168 that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 169 Example: 170 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 171 */ 172 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 173 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 174 #if defined __cplusplus && defined GNULIB_NAMESPACE 175 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 176 namespace GNULIB_NAMESPACE \ 177 { \ 178 rettype (*const func) parameters = ::rpl_func; \ 179 } \ 180 _GL_EXTERN_C int _gl_cxxalias_dummy 181 #else 182 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 183 _GL_EXTERN_C int _gl_cxxalias_dummy 184 #endif 185 186 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 187 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 188 except that the C function rpl_func may have a slightly different 189 declaration. A cast is used to silence the "invalid conversion" error 190 that would otherwise occur. */ 191 #if defined __cplusplus && defined GNULIB_NAMESPACE 192 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 193 namespace GNULIB_NAMESPACE \ 194 { \ 195 rettype (*const func) parameters = \ 196 reinterpret_cast<rettype(*)parameters>(::rpl_func); \ 197 } \ 198 _GL_EXTERN_C int _gl_cxxalias_dummy 199 #else 200 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 201 _GL_EXTERN_C int _gl_cxxalias_dummy 202 #endif 203 204 /* _GL_CXXALIAS_SYS (func, rettype, parameters); 205 declares a C++ alias called GNULIB_NAMESPACE::func 206 that redirects to the system provided function func, if GNULIB_NAMESPACE 207 is defined. 208 Example: 209 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 210 */ 211 #if defined __cplusplus && defined GNULIB_NAMESPACE 212 /* If we were to write 213 rettype (*const func) parameters = ::func; 214 like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls 215 better (remove an indirection through a 'static' pointer variable), 216 but then the _GL_CXXALIASWARN macro below would cause a warning not only 217 for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ 218 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 219 namespace GNULIB_NAMESPACE \ 220 { \ 221 static rettype (*func) parameters = ::func; \ 222 } \ 223 _GL_EXTERN_C int _gl_cxxalias_dummy 224 #else 225 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 226 _GL_EXTERN_C int _gl_cxxalias_dummy 227 #endif 228 229 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 230 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 231 except that the C function func may have a slightly different declaration. 232 A cast is used to silence the "invalid conversion" error that would 233 otherwise occur. */ 234 #if defined __cplusplus && defined GNULIB_NAMESPACE 235 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 236 namespace GNULIB_NAMESPACE \ 237 { \ 238 static rettype (*func) parameters = \ 239 reinterpret_cast<rettype(*)parameters>(::func); \ 240 } \ 241 _GL_EXTERN_C int _gl_cxxalias_dummy 242 #else 243 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 244 _GL_EXTERN_C int _gl_cxxalias_dummy 245 #endif 246 247 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 248 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 249 except that the C function is picked among a set of overloaded functions, 250 namely the one with rettype2 and parameters2. Two consecutive casts 251 are used to silence the "cannot find a match" and "invalid conversion" 252 errors that would otherwise occur. */ 253 #if defined __cplusplus && defined GNULIB_NAMESPACE 254 /* The outer cast must be a reinterpret_cast. 255 The inner cast: When the function is defined as a set of overloaded 256 functions, it works as a static_cast<>, choosing the designated variant. 257 When the function is defined as a single variant, it works as a 258 reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 259 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 260 namespace GNULIB_NAMESPACE \ 261 { \ 262 static rettype (*func) parameters = \ 263 reinterpret_cast<rettype(*)parameters>( \ 264 (rettype2(*)parameters2)(::func)); \ 265 } \ 266 _GL_EXTERN_C int _gl_cxxalias_dummy 267 #else 268 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 269 _GL_EXTERN_C int _gl_cxxalias_dummy 270 #endif 271 272 /* _GL_CXXALIASWARN (func); 273 causes a warning to be emitted when ::func is used but not when 274 GNULIB_NAMESPACE::func is used. func must be defined without overloaded 275 variants. */ 276 #if defined __cplusplus && defined GNULIB_NAMESPACE 277 # define _GL_CXXALIASWARN(func) \ 278 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 279 # define _GL_CXXALIASWARN_1(func,namespace) \ 280 _GL_CXXALIASWARN_2 (func, namespace) 281 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 282 we enable the warning only when not optimizing. */ 283 # if !__OPTIMIZE__ 284 # define _GL_CXXALIASWARN_2(func,namespace) \ 285 _GL_WARN_ON_USE (func, \ 286 "The symbol ::" #func " refers to the system function. " \ 287 "Use " #namespace "::" #func " instead.") 288 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 289 # define _GL_CXXALIASWARN_2(func,namespace) \ 290 extern __typeof__ (func) func 291 # else 292 # define _GL_CXXALIASWARN_2(func,namespace) \ 293 _GL_EXTERN_C int _gl_cxxalias_dummy 294 # endif 295 #else 296 # define _GL_CXXALIASWARN(func) \ 297 _GL_EXTERN_C int _gl_cxxalias_dummy 298 #endif 299 300 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 301 causes a warning to be emitted when the given overloaded variant of ::func 302 is used but not when GNULIB_NAMESPACE::func is used. */ 303 #if defined __cplusplus && defined GNULIB_NAMESPACE 304 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 305 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 306 GNULIB_NAMESPACE) 307 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 308 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 309 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 310 we enable the warning only when not optimizing. */ 311 # if !__OPTIMIZE__ 312 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 313 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 314 "The symbol ::" #func " refers to the system function. " \ 315 "Use " #namespace "::" #func " instead.") 316 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 317 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 318 extern __typeof__ (func) func 319 # else 320 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 321 _GL_EXTERN_C int _gl_cxxalias_dummy 322 # endif 323 #else 324 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 325 _GL_EXTERN_C int _gl_cxxalias_dummy 326 #endif 327 328 #endif /* _GL_CXXDEFS_H */ 329 330 /* The definition of _GL_WARN_ON_USE is copied here. */ 331 #ifndef _GL_WARN_ON_USE 332 333 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 334 /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 335 # define _GL_WARN_ON_USE(function, message) \ 336 extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 337 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 338 /* Verify the existence of the function. */ 339 # define _GL_WARN_ON_USE(function, message) \ 340 extern __typeof__ (function) function 341 # else /* Unsupported. */ 342 # define _GL_WARN_ON_USE(function, message) \ 343 _GL_WARN_EXTERN_C int _gl_warn_on_use 344 # endif 345 #endif 346 347 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 348 is like _GL_WARN_ON_USE (function, "string"), except that the function is 349 declared with the given prototype, consisting of return type, parameters, 350 and attributes. 351 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 352 not work in this case. */ 353 #ifndef _GL_WARN_ON_USE_CXX 354 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 355 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 356 extern rettype function parameters_and_attributes \ 357 __attribute__ ((__warning__ (msg))) 358 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 359 /* Verify the existence of the function. */ 360 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 361 extern rettype function parameters_and_attributes 362 # else /* Unsupported. */ 363 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 364 _GL_WARN_EXTERN_C int _gl_warn_on_use 365 # endif 366 #endif 367 368 /* _GL_WARN_EXTERN_C declaration; 369 performs the declaration with C linkage. */ 370 #ifndef _GL_WARN_EXTERN_C 371 # if defined __cplusplus 372 # define _GL_WARN_EXTERN_C extern "C" 373 # else 374 # define _GL_WARN_EXTERN_C extern 375 # endif 376 #endif 377 378 /* Solaris 2.6 <wctype.h> includes <widec.h> which includes <euc.h> which 379 #defines a number of identifiers in the application namespace. Revert 380 these #defines. */ 381 #ifdef __sun 382 # undef multibyte 383 # undef eucw1 384 # undef eucw2 385 # undef eucw3 386 # undef scrw1 387 # undef scrw2 388 # undef scrw3 389 #endif 390 391 /* Define wint_t and WEOF. (Also done in wchar.in.h.) */ 392 #if !1 && !defined wint_t 393 # define wint_t int 394 # ifndef WEOF 395 # define WEOF -1 396 # endif 397 #else 398 /* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>. 399 This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be 400 "unchanged by default argument promotions". Override it. */ 401 # if defined _MSC_VER 402 # if !GNULIB_defined_wint_t 403 # include <crtdefs.h> 404 typedef unsigned int rpl_wint_t; 405 # undef wint_t 406 # define wint_t rpl_wint_t 407 # define GNULIB_defined_wint_t 1 408 # endif 409 # endif 410 # ifndef WEOF 411 # define WEOF ((wint_t) -1) 412 # endif 413 #endif 414 415 416 #if !GNULIB_defined_wctype_functions 417 418 /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. 419 Linux libc5 has <wctype.h> and the functions but they are broken. 420 Assume all 11 functions (all isw* except iswblank) are implemented the 421 same way, or not at all. */ 422 # if ! 1 || 0 423 424 /* IRIX 5.3 has macros but no functions, its isw* macros refer to an 425 undefined variable _ctmp_ and to <ctype.h> macros like _P, and they 426 refer to system functions like _iswctype that are not in the 427 standard C library. Rather than try to get ancient buggy 428 implementations like this to work, just disable them. */ 429 # undef iswalnum 430 # undef iswalpha 431 # undef iswblank 432 # undef iswcntrl 433 # undef iswdigit 434 # undef iswgraph 435 # undef iswlower 436 # undef iswprint 437 # undef iswpunct 438 # undef iswspace 439 # undef iswupper 440 # undef iswxdigit 441 # undef towlower 442 # undef towupper 443 444 /* Linux libc5 has <wctype.h> and the functions but they are broken. */ 445 # if 0 446 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 447 # define iswalnum rpl_iswalnum 448 # define iswalpha rpl_iswalpha 449 # define iswblank rpl_iswblank 450 # define iswcntrl rpl_iswcntrl 451 # define iswdigit rpl_iswdigit 452 # define iswgraph rpl_iswgraph 453 # define iswlower rpl_iswlower 454 # define iswprint rpl_iswprint 455 # define iswpunct rpl_iswpunct 456 # define iswspace rpl_iswspace 457 # define iswupper rpl_iswupper 458 # define iswxdigit rpl_iswxdigit 459 # endif 460 # endif 461 # if 0 462 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 463 # define towlower rpl_towlower 464 # define towupper rpl_towupper 465 # endif 466 # endif 467 468 _GL_WCTYPE_INLINE int 469 # if 0 470 rpl_iswalnum 471 # else 472 iswalnum 473 # endif 474 (wint_t wc) 475 { 476 return ((wc >= '0' && wc <= '9') 477 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')); 478 } 479 480 _GL_WCTYPE_INLINE int 481 # if 0 482 rpl_iswalpha 483 # else 484 iswalpha 485 # endif 486 (wint_t wc) 487 { 488 return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; 489 } 490 491 _GL_WCTYPE_INLINE int 492 # if 0 493 rpl_iswblank 494 # else 495 iswblank 496 # endif 497 (wint_t wc) 498 { 499 return wc == ' ' || wc == '\t'; 500 } 501 502 _GL_WCTYPE_INLINE int 503 # if 0 504 rpl_iswcntrl 505 # else 506 iswcntrl 507 # endif 508 (wint_t wc) 509 { 510 return (wc & ~0x1f) == 0 || wc == 0x7f; 511 } 512 513 _GL_WCTYPE_INLINE int 514 # if 0 515 rpl_iswdigit 516 # else 517 iswdigit 518 # endif 519 (wint_t wc) 520 { 521 return wc >= '0' && wc <= '9'; 522 } 523 524 _GL_WCTYPE_INLINE int 525 # if 0 526 rpl_iswgraph 527 # else 528 iswgraph 529 # endif 530 (wint_t wc) 531 { 532 return wc >= '!' && wc <= '~'; 533 } 534 535 _GL_WCTYPE_INLINE int 536 # if 0 537 rpl_iswlower 538 # else 539 iswlower 540 # endif 541 (wint_t wc) 542 { 543 return wc >= 'a' && wc <= 'z'; 544 } 545 546 _GL_WCTYPE_INLINE int 547 # if 0 548 rpl_iswprint 549 # else 550 iswprint 551 # endif 552 (wint_t wc) 553 { 554 return wc >= ' ' && wc <= '~'; 555 } 556 557 _GL_WCTYPE_INLINE int 558 # if 0 559 rpl_iswpunct 560 # else 561 iswpunct 562 # endif 563 (wint_t wc) 564 { 565 return (wc >= '!' && wc <= '~' 566 && !((wc >= '0' && wc <= '9') 567 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'))); 568 } 569 570 _GL_WCTYPE_INLINE int 571 # if 0 572 rpl_iswspace 573 # else 574 iswspace 575 # endif 576 (wint_t wc) 577 { 578 return (wc == ' ' || wc == '\t' 579 || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'); 580 } 581 582 _GL_WCTYPE_INLINE int 583 # if 0 584 rpl_iswupper 585 # else 586 iswupper 587 # endif 588 (wint_t wc) 589 { 590 return wc >= 'A' && wc <= 'Z'; 591 } 592 593 _GL_WCTYPE_INLINE int 594 # if 0 595 rpl_iswxdigit 596 # else 597 iswxdigit 598 # endif 599 (wint_t wc) 600 { 601 return ((wc >= '0' && wc <= '9') 602 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')); 603 } 604 605 _GL_WCTYPE_INLINE wint_t 606 # if 0 607 rpl_towlower 608 # else 609 towlower 610 # endif 611 (wint_t wc) 612 { 613 return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc); 614 } 615 616 _GL_WCTYPE_INLINE wint_t 617 # if 0 618 rpl_towupper 619 # else 620 towupper 621 # endif 622 (wint_t wc) 623 { 624 return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc); 625 } 626 627 # elif 1 && (! 1 || 0) 628 /* Only the iswblank function is missing. */ 629 630 # if 0 631 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 632 # define iswblank rpl_iswblank 633 # endif 634 _GL_FUNCDECL_RPL (iswblank, int, (wint_t wc)); 635 # else 636 _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc)); 637 # endif 638 639 # endif 640 641 # if defined __MINGW32__ 642 643 /* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t. 644 The functions towlower and towupper are implemented in the MSVCRT library 645 to take a wchar_t argument and return a wchar_t result. mingw declares 646 these functions to take a wint_t argument and return a wint_t result. 647 This means that: 648 1. When the user passes an argument outside the range 0x0000..0xFFFF, the 649 function will look only at the lower 16 bits. This is allowed according 650 to POSIX. 651 2. The return value is returned in the lower 16 bits of the result register. 652 The upper 16 bits are random: whatever happened to be in that part of the 653 result register. We need to fix this by adding a zero-extend from 654 wchar_t to wint_t after the call. */ 655 656 _GL_WCTYPE_INLINE wint_t 657 rpl_towlower (wint_t wc) 658 { 659 return (wint_t) (wchar_t) towlower (wc); 660 } 661 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 662 # define towlower rpl_towlower 663 # endif 664 665 _GL_WCTYPE_INLINE wint_t 666 rpl_towupper (wint_t wc) 667 { 668 return (wint_t) (wchar_t) towupper (wc); 669 } 670 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 671 # define towupper rpl_towupper 672 # endif 673 674 # endif /* __MINGW32__ */ 675 676 # define GNULIB_defined_wctype_functions 1 677 #endif 678 679 #if 0 680 _GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc)); 681 _GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc)); 682 _GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc)); 683 _GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc)); 684 _GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc)); 685 _GL_CXXALIAS_RPL (iswlower, int, (wint_t wc)); 686 _GL_CXXALIAS_RPL (iswprint, int, (wint_t wc)); 687 _GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc)); 688 _GL_CXXALIAS_RPL (iswspace, int, (wint_t wc)); 689 _GL_CXXALIAS_RPL (iswupper, int, (wint_t wc)); 690 _GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc)); 691 #else 692 _GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc)); 693 _GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc)); 694 _GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc)); 695 _GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc)); 696 _GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc)); 697 _GL_CXXALIAS_SYS (iswlower, int, (wint_t wc)); 698 _GL_CXXALIAS_SYS (iswprint, int, (wint_t wc)); 699 _GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc)); 700 _GL_CXXALIAS_SYS (iswspace, int, (wint_t wc)); 701 _GL_CXXALIAS_SYS (iswupper, int, (wint_t wc)); 702 _GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc)); 703 #endif 704 _GL_CXXALIASWARN (iswalnum); 705 _GL_CXXALIASWARN (iswalpha); 706 _GL_CXXALIASWARN (iswcntrl); 707 _GL_CXXALIASWARN (iswdigit); 708 _GL_CXXALIASWARN (iswgraph); 709 _GL_CXXALIASWARN (iswlower); 710 _GL_CXXALIASWARN (iswprint); 711 _GL_CXXALIASWARN (iswpunct); 712 _GL_CXXALIASWARN (iswspace); 713 _GL_CXXALIASWARN (iswupper); 714 _GL_CXXALIASWARN (iswxdigit); 715 716 #if 1 717 # if 0 || 0 718 _GL_CXXALIAS_RPL (iswblank, int, (wint_t wc)); 719 # else 720 _GL_CXXALIAS_SYS (iswblank, int, (wint_t wc)); 721 # endif 722 _GL_CXXALIASWARN (iswblank); 723 #endif 724 725 #if !1 726 # if !GNULIB_defined_wctype_t 727 typedef void * wctype_t; 728 # define GNULIB_defined_wctype_t 1 729 # endif 730 #endif 731 732 /* Get a descriptor for a wide character property. */ 733 #if 0 734 # if !1 735 _GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name)); 736 # endif 737 _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name)); 738 _GL_CXXALIASWARN (wctype); 739 #elif defined GNULIB_POSIXCHECK 740 # undef wctype 741 # if HAVE_RAW_DECL_WCTYPE 742 _GL_WARN_ON_USE (wctype, "wctype is unportable - " 743 "use gnulib module wctype for portability"); 744 # endif 745 #endif 746 747 /* Test whether a wide character has a given property. 748 The argument WC must be either a wchar_t value or WEOF. 749 The argument DESC must have been returned by the wctype() function. */ 750 #if 1 751 # if !1 752 _GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc)); 753 # endif 754 _GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc)); 755 _GL_CXXALIASWARN (iswctype); 756 #elif defined GNULIB_POSIXCHECK 757 # undef iswctype 758 # if HAVE_RAW_DECL_ISWCTYPE 759 _GL_WARN_ON_USE (iswctype, "iswctype is unportable - " 760 "use gnulib module iswctype for portability"); 761 # endif 762 #endif 763 764 #if 0 || defined __MINGW32__ 765 _GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc)); 766 _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc)); 767 #else 768 _GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc)); 769 _GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc)); 770 #endif 771 _GL_CXXALIASWARN (towlower); 772 _GL_CXXALIASWARN (towupper); 773 774 #if !1 775 # if !GNULIB_defined_wctrans_t 776 typedef void * wctrans_t; 777 # define GNULIB_defined_wctrans_t 1 778 # endif 779 #endif 780 781 /* Get a descriptor for a wide character case conversion. */ 782 #if 0 783 # if !1 784 _GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name)); 785 # endif 786 _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name)); 787 _GL_CXXALIASWARN (wctrans); 788 #elif defined GNULIB_POSIXCHECK 789 # undef wctrans 790 # if HAVE_RAW_DECL_WCTRANS 791 _GL_WARN_ON_USE (wctrans, "wctrans is unportable - " 792 "use gnulib module wctrans for portability"); 793 # endif 794 #endif 795 796 /* Perform a given case conversion on a wide character. 797 The argument WC must be either a wchar_t value or WEOF. 798 The argument DESC must have been returned by the wctrans() function. */ 799 #if 0 800 # if !1 801 _GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); 802 # endif 803 _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); 804 _GL_CXXALIASWARN (towctrans); 805 #elif defined GNULIB_POSIXCHECK 806 # undef towctrans 807 # if HAVE_RAW_DECL_TOWCTRANS 808 _GL_WARN_ON_USE (towctrans, "towctrans is unportable - " 809 "use gnulib module towctrans for portability"); 810 # endif 811 #endif 812 813 _GL_INLINE_HEADER_END 814 815 #endif /* _GL_WCTYPE_H */ 816 #endif /* _GL_WCTYPE_H */ 817