1/* This file is automatically generated. DO NOT EDIT! */ 2/* Generated from: NetBSD: mknative-gdb,v 1.15 2020/12/05 21:27:31 christos Exp */ 3/* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp */ 4 5/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 6/* A substitute for ISO C99 <wctype.h>, for platforms that lack it. 7 8 Copyright (C) 2006-2020 Free Software Foundation, Inc. 9 10 This program is free software; you can redistribute it and/or modify 11 it under the terms of the GNU General Public License as published by 12 the Free Software Foundation; either version 3, or (at your option) 13 any later version. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with this program; if not, see <https://www.gnu.org/licenses/>. */ 22 23/* Written by Bruno Haible and Paul Eggert. */ 24 25/* 26 * ISO C 99 <wctype.h> for platforms that lack it. 27 * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html> 28 * 29 * iswctype, towctrans, towlower, towupper, wctrans, wctype, 30 * wctrans_t, and wctype_t are not yet implemented. 31 */ 32 33#if __GNUC__ >= 3 34#pragma GCC system_header 35#endif 36 37 38#if (defined __MINGW32__ && defined __CTYPE_H_SOURCED__) 39 40/* Special invocation convention: 41 - With MinGW 3.22, when <ctype.h> includes <wctype.h>, only some part of 42 <wctype.h> is being processed, which doesn't include the idempotency 43 guard. */ 44 45#include_next <wctype.h> 46 47#else 48/* Normal invocation convention. */ 49 50#ifndef _GL_WCTYPE_H 51 52#if 1 53/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. 54 Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before 55 <wchar.h>. 56 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be 57 included before <wchar.h>. */ 58# include <stddef.h> 59# include <stdio.h> 60# include <time.h> 61# include <wchar.h> 62#endif 63 64/* Native Windows (mingw, MSVC) have declarations of towupper, towlower, and 65 isw* functions in <ctype.h>, <wchar.h> as well as in <wctype.h>. Include 66 <ctype.h>, <wchar.h> in advance to avoid rpl_ prefix being added to the 67 declarations. */ 68#if defined _WIN32 && ! defined __CYGWIN__ 69# include <ctype.h> 70# include <wchar.h> 71#endif 72 73/* Include the original <wctype.h> if it exists. 74 BeOS 5 has the functions but no <wctype.h>. */ 75/* The include_next requires a split double-inclusion guard. */ 76#if 1 77# include_next <wctype.h> 78#endif 79 80#ifndef _GL_WCTYPE_H 81#define _GL_WCTYPE_H 82 83#ifndef _GL_INLINE_HEADER_BEGIN 84 #error "Please include config.h first." 85#endif 86_GL_INLINE_HEADER_BEGIN 87#ifndef _GL_WCTYPE_INLINE 88# define _GL_WCTYPE_INLINE _GL_INLINE 89#endif 90 91/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 92/* C++ compatible function declaration macros. 93 Copyright (C) 2010-2020 Free Software Foundation, Inc. 94 95 This program is free software: you can redistribute it and/or modify it 96 under the terms of the GNU General Public License as published 97 by the Free Software Foundation; either version 3 of the License, or 98 (at your option) any later version. 99 100 This program is distributed in the hope that it will be useful, 101 but WITHOUT ANY WARRANTY; without even the implied warranty of 102 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 103 General Public License for more details. 104 105 You should have received a copy of the GNU General Public License 106 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 107 108#ifndef _GL_CXXDEFS_H 109#define _GL_CXXDEFS_H 110 111/* Begin/end the GNULIB_NAMESPACE namespace. */ 112#if defined __cplusplus && defined GNULIB_NAMESPACE 113# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 114# define _GL_END_NAMESPACE } 115#else 116# define _GL_BEGIN_NAMESPACE 117# define _GL_END_NAMESPACE 118#endif 119 120/* The three most frequent use cases of these macros are: 121 122 * For providing a substitute for a function that is missing on some 123 platforms, but is declared and works fine on the platforms on which 124 it exists: 125 126 #if @GNULIB_FOO@ 127 # if !@HAVE_FOO@ 128 _GL_FUNCDECL_SYS (foo, ...); 129 # endif 130 _GL_CXXALIAS_SYS (foo, ...); 131 _GL_CXXALIASWARN (foo); 132 #elif defined GNULIB_POSIXCHECK 133 ... 134 #endif 135 136 * For providing a replacement for a function that exists on all platforms, 137 but is broken/insufficient and needs to be replaced on some platforms: 138 139 #if @GNULIB_FOO@ 140 # if @REPLACE_FOO@ 141 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 142 # undef foo 143 # define foo rpl_foo 144 # endif 145 _GL_FUNCDECL_RPL (foo, ...); 146 _GL_CXXALIAS_RPL (foo, ...); 147 # else 148 _GL_CXXALIAS_SYS (foo, ...); 149 # endif 150 _GL_CXXALIASWARN (foo); 151 #elif defined GNULIB_POSIXCHECK 152 ... 153 #endif 154 155 * For providing a replacement for a function that exists on some platforms 156 but is broken/insufficient and needs to be replaced on some of them and 157 is additionally either missing or undeclared on some other platforms: 158 159 #if @GNULIB_FOO@ 160 # if @REPLACE_FOO@ 161 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 162 # undef foo 163 # define foo rpl_foo 164 # endif 165 _GL_FUNCDECL_RPL (foo, ...); 166 _GL_CXXALIAS_RPL (foo, ...); 167 # else 168 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 169 _GL_FUNCDECL_SYS (foo, ...); 170 # endif 171 _GL_CXXALIAS_SYS (foo, ...); 172 # endif 173 _GL_CXXALIASWARN (foo); 174 #elif defined GNULIB_POSIXCHECK 175 ... 176 #endif 177*/ 178 179/* _GL_EXTERN_C declaration; 180 performs the declaration with C linkage. */ 181#if defined __cplusplus 182# define _GL_EXTERN_C extern "C" 183#else 184# define _GL_EXTERN_C extern 185#endif 186 187/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 188 declares a replacement function, named rpl_func, with the given prototype, 189 consisting of return type, parameters, and attributes. 190 Example: 191 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 192 _GL_ARG_NONNULL ((1))); 193 */ 194#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 195 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 196#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 197 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 198 199/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 200 declares the system function, named func, with the given prototype, 201 consisting of return type, parameters, and attributes. 202 Example: 203 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 204 _GL_ARG_NONNULL ((1))); 205 */ 206#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 207 _GL_EXTERN_C rettype func parameters_and_attributes 208 209/* _GL_CXXALIAS_RPL (func, rettype, parameters); 210 declares a C++ alias called GNULIB_NAMESPACE::func 211 that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 212 Example: 213 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 214 215 Wrapping rpl_func in an object with an inline conversion operator 216 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 217 actually used in the program. */ 218#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 219 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 220#if defined __cplusplus && defined GNULIB_NAMESPACE 221# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 222 namespace GNULIB_NAMESPACE \ 223 { \ 224 static const struct _gl_ ## func ## _wrapper \ 225 { \ 226 typedef rettype (*type) parameters; \ 227 \ 228 inline operator type () const \ 229 { \ 230 return ::rpl_func; \ 231 } \ 232 } func = {}; \ 233 } \ 234 _GL_EXTERN_C int _gl_cxxalias_dummy 235#else 236# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 237 _GL_EXTERN_C int _gl_cxxalias_dummy 238#endif 239 240/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 241 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 242 except that the C function rpl_func may have a slightly different 243 declaration. A cast is used to silence the "invalid conversion" error 244 that would otherwise occur. */ 245#if defined __cplusplus && defined GNULIB_NAMESPACE 246# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 247 namespace GNULIB_NAMESPACE \ 248 { \ 249 static const struct _gl_ ## func ## _wrapper \ 250 { \ 251 typedef rettype (*type) parameters; \ 252 \ 253 inline operator type () const \ 254 { \ 255 return reinterpret_cast<type>(::rpl_func); \ 256 } \ 257 } func = {}; \ 258 } \ 259 _GL_EXTERN_C int _gl_cxxalias_dummy 260#else 261# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 262 _GL_EXTERN_C int _gl_cxxalias_dummy 263#endif 264 265/* _GL_CXXALIAS_SYS (func, rettype, parameters); 266 declares a C++ alias called GNULIB_NAMESPACE::func 267 that redirects to the system provided function func, if GNULIB_NAMESPACE 268 is defined. 269 Example: 270 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 271 272 Wrapping func in an object with an inline conversion operator 273 avoids a reference to func unless GNULIB_NAMESPACE::func is 274 actually used in the program. */ 275#if defined __cplusplus && defined GNULIB_NAMESPACE 276# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 277 namespace GNULIB_NAMESPACE \ 278 { \ 279 static const struct _gl_ ## func ## _wrapper \ 280 { \ 281 typedef rettype (*type) parameters; \ 282 \ 283 inline operator type () const \ 284 { \ 285 return ::func; \ 286 } \ 287 } func = {}; \ 288 } \ 289 _GL_EXTERN_C int _gl_cxxalias_dummy 290#else 291# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 292 _GL_EXTERN_C int _gl_cxxalias_dummy 293#endif 294 295/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 296 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 297 except that the C function func may have a slightly different declaration. 298 A cast is used to silence the "invalid conversion" error that would 299 otherwise occur. */ 300#if defined __cplusplus && defined GNULIB_NAMESPACE 301# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 302 namespace GNULIB_NAMESPACE \ 303 { \ 304 static const struct _gl_ ## func ## _wrapper \ 305 { \ 306 typedef rettype (*type) parameters; \ 307 \ 308 inline operator type () const \ 309 { \ 310 return reinterpret_cast<type>(::func); \ 311 } \ 312 } func = {}; \ 313 } \ 314 _GL_EXTERN_C int _gl_cxxalias_dummy 315#else 316# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 317 _GL_EXTERN_C int _gl_cxxalias_dummy 318#endif 319 320/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 321 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 322 except that the C function is picked among a set of overloaded functions, 323 namely the one with rettype2 and parameters2. Two consecutive casts 324 are used to silence the "cannot find a match" and "invalid conversion" 325 errors that would otherwise occur. */ 326#if defined __cplusplus && defined GNULIB_NAMESPACE 327 /* The outer cast must be a reinterpret_cast. 328 The inner cast: When the function is defined as a set of overloaded 329 functions, it works as a static_cast<>, choosing the designated variant. 330 When the function is defined as a single variant, it works as a 331 reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 332# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 333 namespace GNULIB_NAMESPACE \ 334 { \ 335 static const struct _gl_ ## func ## _wrapper \ 336 { \ 337 typedef rettype (*type) parameters; \ 338 \ 339 inline operator type () const \ 340 { \ 341 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 342 } \ 343 } func = {}; \ 344 } \ 345 _GL_EXTERN_C int _gl_cxxalias_dummy 346#else 347# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 348 _GL_EXTERN_C int _gl_cxxalias_dummy 349#endif 350 351/* _GL_CXXALIASWARN (func); 352 causes a warning to be emitted when ::func is used but not when 353 GNULIB_NAMESPACE::func is used. func must be defined without overloaded 354 variants. */ 355#if defined __cplusplus && defined GNULIB_NAMESPACE 356# define _GL_CXXALIASWARN(func) \ 357 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 358# define _GL_CXXALIASWARN_1(func,namespace) \ 359 _GL_CXXALIASWARN_2 (func, namespace) 360/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 361 we enable the warning only when not optimizing. */ 362# if !__OPTIMIZE__ 363# define _GL_CXXALIASWARN_2(func,namespace) \ 364 _GL_WARN_ON_USE (func, \ 365 "The symbol ::" #func " refers to the system function. " \ 366 "Use " #namespace "::" #func " instead.") 367# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 368# define _GL_CXXALIASWARN_2(func,namespace) \ 369 extern __typeof__ (func) func 370# else 371# define _GL_CXXALIASWARN_2(func,namespace) \ 372 _GL_EXTERN_C int _gl_cxxalias_dummy 373# endif 374#else 375# define _GL_CXXALIASWARN(func) \ 376 _GL_EXTERN_C int _gl_cxxalias_dummy 377#endif 378 379/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 380 causes a warning to be emitted when the given overloaded variant of ::func 381 is used but not when GNULIB_NAMESPACE::func is used. */ 382#if defined __cplusplus && defined GNULIB_NAMESPACE 383# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 384 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 385 GNULIB_NAMESPACE) 386# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 387 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 388/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 389 we enable the warning only when not optimizing. */ 390# if !__OPTIMIZE__ 391# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 392 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 393 "The symbol ::" #func " refers to the system function. " \ 394 "Use " #namespace "::" #func " instead.") 395# else 396# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 397 _GL_EXTERN_C int _gl_cxxalias_dummy 398# endif 399#else 400# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 401 _GL_EXTERN_C int _gl_cxxalias_dummy 402#endif 403 404#endif /* _GL_CXXDEFS_H */ 405 406/* The definition of _GL_WARN_ON_USE is copied here. */ 407/* A C macro for emitting warnings if a function is used. 408 Copyright (C) 2010-2020 Free Software Foundation, Inc. 409 410 This program is free software: you can redistribute it and/or modify it 411 under the terms of the GNU General Public License as published 412 by the Free Software Foundation; either version 3 of the License, or 413 (at your option) any later version. 414 415 This program is distributed in the hope that it will be useful, 416 but WITHOUT ANY WARRANTY; without even the implied warranty of 417 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 418 General Public License for more details. 419 420 You should have received a copy of the GNU General Public License 421 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 422 423/* _GL_WARN_ON_USE (function, "literal string") issues a declaration 424 for FUNCTION which will then trigger a compiler warning containing 425 the text of "literal string" anywhere that function is called, if 426 supported by the compiler. If the compiler does not support this 427 feature, the macro expands to an unused extern declaration. 428 429 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 430 attribute used in _GL_WARN_ON_USE. If the compiler does not support 431 this feature, it expands to empty. 432 433 These macros are useful for marking a function as a potential 434 portability trap, with the intent that "literal string" include 435 instructions on the replacement function that should be used 436 instead. 437 _GL_WARN_ON_USE is for functions with 'extern' linkage. 438 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 439 linkage. 440 441 However, one of the reasons that a function is a portability trap is 442 if it has the wrong signature. Declaring FUNCTION with a different 443 signature in C is a compilation error, so this macro must use the 444 same type as any existing declaration so that programs that avoid 445 the problematic FUNCTION do not fail to compile merely because they 446 included a header that poisoned the function. But this implies that 447 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 448 have a declaration. Use of this macro implies that there must not 449 be any other macro hiding the declaration of FUNCTION; but 450 undefining FUNCTION first is part of the poisoning process anyway 451 (although for symbols that are provided only via a macro, the result 452 is a compilation error rather than a warning containing 453 "literal string"). Also note that in C++, it is only safe to use if 454 FUNCTION has no overloads. 455 456 For an example, it is possible to poison 'getline' by: 457 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 458 [getline]) in configure.ac, which potentially defines 459 HAVE_RAW_DECL_GETLINE 460 - adding this code to a header that wraps the system <stdio.h>: 461 #undef getline 462 #if HAVE_RAW_DECL_GETLINE 463 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 464 "not universally present; use the gnulib module getline"); 465 #endif 466 467 It is not possible to directly poison global variables. But it is 468 possible to write a wrapper accessor function, and poison that 469 (less common usage, like &environ, will cause a compilation error 470 rather than issue the nice warning, but the end result of informing 471 the developer about their portability problem is still achieved): 472 #if HAVE_RAW_DECL_ENVIRON 473 static char *** 474 rpl_environ (void) { return &environ; } 475 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 476 # undef environ 477 # define environ (*rpl_environ ()) 478 #endif 479 or better (avoiding contradictory use of 'static' and 'extern'): 480 #if HAVE_RAW_DECL_ENVIRON 481 static char *** 482 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 483 rpl_environ (void) { return &environ; } 484 # undef environ 485 # define environ (*rpl_environ ()) 486 #endif 487 */ 488#ifndef _GL_WARN_ON_USE 489 490# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 491/* A compiler attribute is available in gcc versions 4.3.0 and later. */ 492# define _GL_WARN_ON_USE(function, message) \ 493extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 494# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 495 __attribute__ ((__warning__ (message))) 496# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 497/* Verify the existence of the function. */ 498# define _GL_WARN_ON_USE(function, message) \ 499extern __typeof__ (function) function 500# define _GL_WARN_ON_USE_ATTRIBUTE(message) 501# else /* Unsupported. */ 502# define _GL_WARN_ON_USE(function, message) \ 503_GL_WARN_EXTERN_C int _gl_warn_on_use 504# define _GL_WARN_ON_USE_ATTRIBUTE(message) 505# endif 506#endif 507 508/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 509 is like _GL_WARN_ON_USE (function, "string"), except that in C++ mode the 510 function is declared with the given prototype, consisting of return type, 511 parameters, and attributes. 512 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 513 not work in this case. */ 514#ifndef _GL_WARN_ON_USE_CXX 515# if !defined __cplusplus 516# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 517 _GL_WARN_ON_USE (function, msg) 518# else 519# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 520# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 521extern rettype function parameters_and_attributes \ 522 __attribute__ ((__warning__ (msg))) 523# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 524/* Verify the existence of the function. */ 525# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 526extern rettype function parameters_and_attributes 527# else /* Unsupported. */ 528# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 529_GL_WARN_EXTERN_C int _gl_warn_on_use 530# endif 531# endif 532#endif 533 534/* _GL_WARN_EXTERN_C declaration; 535 performs the declaration with C linkage. */ 536#ifndef _GL_WARN_EXTERN_C 537# if defined __cplusplus 538# define _GL_WARN_EXTERN_C extern "C" 539# else 540# define _GL_WARN_EXTERN_C extern 541# endif 542#endif 543 544/* Solaris 2.6 <wctype.h> includes <widec.h> which includes <euc.h> which 545 #defines a number of identifiers in the application namespace. Revert 546 these #defines. */ 547#ifdef __sun 548# undef multibyte 549# undef eucw1 550# undef eucw2 551# undef eucw3 552# undef scrw1 553# undef scrw2 554# undef scrw3 555#endif 556 557/* Define wint_t and WEOF. (Also done in wchar.in.h.) */ 558#if !1 && !defined wint_t 559# define wint_t int 560# ifndef WEOF 561# define WEOF -1 562# endif 563#else 564/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or 565 <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that 566 wint_t must be "unchanged by default argument promotions". Override it. */ 567# if 0 568# if !GNULIB_defined_wint_t 569# if 0 570# include <crtdefs.h> 571# else 572# include <stddef.h> 573# endif 574typedef unsigned int rpl_wint_t; 575# undef wint_t 576# define wint_t rpl_wint_t 577# define GNULIB_defined_wint_t 1 578# endif 579# endif 580# ifndef WEOF 581# define WEOF ((wint_t) -1) 582# endif 583#endif 584 585 586#if !GNULIB_defined_wctype_functions 587 588/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. 589 Linux libc5 has <wctype.h> and the functions but they are broken. 590 mingw and MSVC have <wctype.h> and the functions but they take a wchar_t 591 as argument, not an rpl_wint_t. 592 Assume all 11 functions (all isw* except iswblank) are implemented the 593 same way, or not at all. */ 594# if ! 1 || 0 595 596# if 0 /* implies 0 */ 597 598_GL_WCTYPE_INLINE int 599rpl_iswalnum (wint_t wc) 600{ 601 return ((wchar_t) wc == wc ? iswalnum ((wchar_t) wc) : 0); 602} 603 604_GL_WCTYPE_INLINE int 605rpl_iswalpha (wint_t wc) 606{ 607 return ((wchar_t) wc == wc ? iswalpha ((wchar_t) wc) : 0); 608} 609 610_GL_WCTYPE_INLINE int 611rpl_iswblank (wint_t wc) 612{ 613 return ((wchar_t) wc == wc ? iswblank ((wchar_t) wc) : 0); 614} 615 616_GL_WCTYPE_INLINE int 617rpl_iswcntrl (wint_t wc) 618{ 619 return ((wchar_t) wc == wc ? iswcntrl ((wchar_t) wc) : 0); 620} 621 622_GL_WCTYPE_INLINE int 623rpl_iswdigit (wint_t wc) 624{ 625 return ((wchar_t) wc == wc ? wc >= '0' && wc <= '9' : 0); 626} 627 628_GL_WCTYPE_INLINE int 629rpl_iswgraph (wint_t wc) 630{ 631 return ((wchar_t) wc == wc ? iswgraph ((wchar_t) wc) : 0); 632} 633 634_GL_WCTYPE_INLINE int 635rpl_iswlower (wint_t wc) 636{ 637 return ((wchar_t) wc == wc ? iswlower ((wchar_t) wc) : 0); 638} 639 640_GL_WCTYPE_INLINE int 641rpl_iswprint (wint_t wc) 642{ 643 return ((wchar_t) wc == wc ? iswprint ((wchar_t) wc) : 0); 644} 645 646_GL_WCTYPE_INLINE int 647rpl_iswpunct (wint_t wc) 648{ 649 return ((wchar_t) wc == wc ? iswpunct ((wchar_t) wc) : 0); 650} 651 652_GL_WCTYPE_INLINE int 653rpl_iswspace (wint_t wc) 654{ 655 return ((wchar_t) wc == wc ? iswspace ((wchar_t) wc) : 0); 656} 657 658_GL_WCTYPE_INLINE int 659rpl_iswupper (wint_t wc) 660{ 661 return ((wchar_t) wc == wc ? iswupper ((wchar_t) wc) : 0); 662} 663 664_GL_WCTYPE_INLINE int 665rpl_iswxdigit (wint_t wc) 666{ 667 return ((wchar_t) wc == wc 668 ? (wc >= '0' && wc <= '9') 669 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F') 670 : 0); 671} 672 673_GL_WCTYPE_INLINE wint_t 674rpl_towlower (wint_t wc) 675{ 676 return ((wchar_t) wc == wc ? (wchar_t) towlower ((wchar_t) wc) : wc); 677} 678 679_GL_WCTYPE_INLINE wint_t 680rpl_towupper (wint_t wc) 681{ 682 return ((wchar_t) wc == wc ? (wchar_t) towupper ((wchar_t) wc) : wc); 683} 684 685# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 686# undef iswalnum 687# undef iswalpha 688# undef iswblank 689# undef iswcntrl 690# undef iswdigit 691# undef iswgraph 692# undef iswlower 693# undef iswprint 694# undef iswpunct 695# undef iswspace 696# undef iswupper 697# undef iswxdigit 698# undef towlower 699# undef towupper 700# define iswalnum rpl_iswalnum 701# define iswalpha rpl_iswalpha 702# define iswblank rpl_iswblank 703# define iswcntrl rpl_iswcntrl 704# define iswdigit rpl_iswdigit 705# define iswgraph rpl_iswgraph 706# define iswlower rpl_iswlower 707# define iswprint rpl_iswprint 708# define iswpunct rpl_iswpunct 709# define iswspace rpl_iswspace 710# define iswupper rpl_iswupper 711# define iswxdigit rpl_iswxdigit 712# define towlower rpl_towlower 713# define towupper rpl_towupper 714# endif 715 716# else 717 718/* IRIX 5.3 has macros but no functions, its isw* macros refer to an 719 undefined variable _ctmp_ and to <ctype.h> macros like _P, and they 720 refer to system functions like _iswctype that are not in the 721 standard C library. Rather than try to get ancient buggy 722 implementations like this to work, just disable them. */ 723# undef iswalnum 724# undef iswalpha 725# undef iswblank 726# undef iswcntrl 727# undef iswdigit 728# undef iswgraph 729# undef iswlower 730# undef iswprint 731# undef iswpunct 732# undef iswspace 733# undef iswupper 734# undef iswxdigit 735# undef towlower 736# undef towupper 737 738/* Linux libc5 has <wctype.h> and the functions but they are broken. */ 739# if 0 740# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 741# define iswalnum rpl_iswalnum 742# define iswalpha rpl_iswalpha 743# define iswblank rpl_iswblank 744# define iswcntrl rpl_iswcntrl 745# define iswdigit rpl_iswdigit 746# define iswgraph rpl_iswgraph 747# define iswlower rpl_iswlower 748# define iswprint rpl_iswprint 749# define iswpunct rpl_iswpunct 750# define iswspace rpl_iswspace 751# define iswupper rpl_iswupper 752# define iswxdigit rpl_iswxdigit 753# endif 754# endif 755# if 0 756# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 757# define towlower rpl_towlower 758# define towupper rpl_towupper 759# endif 760# endif 761 762_GL_WCTYPE_INLINE int 763# if 0 764rpl_iswalnum 765# else 766iswalnum 767# endif 768 (wint_t wc) 769{ 770 return ((wc >= '0' && wc <= '9') 771 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')); 772} 773 774_GL_WCTYPE_INLINE int 775# if 0 776rpl_iswalpha 777# else 778iswalpha 779# endif 780 (wint_t wc) 781{ 782 return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; 783} 784 785_GL_WCTYPE_INLINE int 786# if 0 787rpl_iswblank 788# else 789iswblank 790# endif 791 (wint_t wc) 792{ 793 return wc == ' ' || wc == '\t'; 794} 795 796_GL_WCTYPE_INLINE int 797# if 0 798rpl_iswcntrl 799# else 800iswcntrl 801# endif 802 (wint_t wc) 803{ 804 return (wc & ~0x1f) == 0 || wc == 0x7f; 805} 806 807_GL_WCTYPE_INLINE int 808# if 0 809rpl_iswdigit 810# else 811iswdigit 812# endif 813 (wint_t wc) 814{ 815 return wc >= '0' && wc <= '9'; 816} 817 818_GL_WCTYPE_INLINE int 819# if 0 820rpl_iswgraph 821# else 822iswgraph 823# endif 824 (wint_t wc) 825{ 826 return wc >= '!' && wc <= '~'; 827} 828 829_GL_WCTYPE_INLINE int 830# if 0 831rpl_iswlower 832# else 833iswlower 834# endif 835 (wint_t wc) 836{ 837 return wc >= 'a' && wc <= 'z'; 838} 839 840_GL_WCTYPE_INLINE int 841# if 0 842rpl_iswprint 843# else 844iswprint 845# endif 846 (wint_t wc) 847{ 848 return wc >= ' ' && wc <= '~'; 849} 850 851_GL_WCTYPE_INLINE int 852# if 0 853rpl_iswpunct 854# else 855iswpunct 856# endif 857 (wint_t wc) 858{ 859 return (wc >= '!' && wc <= '~' 860 && !((wc >= '0' && wc <= '9') 861 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'))); 862} 863 864_GL_WCTYPE_INLINE int 865# if 0 866rpl_iswspace 867# else 868iswspace 869# endif 870 (wint_t wc) 871{ 872 return (wc == ' ' || wc == '\t' 873 || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'); 874} 875 876_GL_WCTYPE_INLINE int 877# if 0 878rpl_iswupper 879# else 880iswupper 881# endif 882 (wint_t wc) 883{ 884 return wc >= 'A' && wc <= 'Z'; 885} 886 887_GL_WCTYPE_INLINE int 888# if 0 889rpl_iswxdigit 890# else 891iswxdigit 892# endif 893 (wint_t wc) 894{ 895 return ((wc >= '0' && wc <= '9') 896 || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')); 897} 898 899_GL_WCTYPE_INLINE wint_t 900# if 0 901rpl_towlower 902# else 903towlower 904# endif 905 (wint_t wc) 906{ 907 return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc); 908} 909 910_GL_WCTYPE_INLINE wint_t 911# if 0 912rpl_towupper 913# else 914towupper 915# endif 916 (wint_t wc) 917{ 918 return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc); 919} 920 921# endif 922 923# else 924/* Only some of the functions are missing or broken. */ 925 926# if 0 && (! 1 || 0) 927/* Only the iswblank function is missing. */ 928# if 0 929# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 930# define iswblank rpl_iswblank 931# endif 932_GL_FUNCDECL_RPL (iswblank, int, (wint_t wc)); 933# else 934_GL_FUNCDECL_SYS (iswblank, int, (wint_t wc)); 935# endif 936# endif 937 938# if 0 939# if 0 940# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 941# undef iswdigit 942# define iswdigit rpl_iswdigit 943# endif 944_GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc)); 945# endif 946# endif 947 948# if 0 949# if 0 950# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 951# undef iswxdigit 952# define iswxdigit rpl_iswxdigit 953# endif 954_GL_FUNCDECL_RPL (iswxdigit, int, (wint_t wc)); 955# endif 956# endif 957 958# endif 959 960# if defined __MINGW32__ && !0 961 962/* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t. 963 The functions towlower and towupper are implemented in the MSVCRT library 964 to take a wchar_t argument and return a wchar_t result. mingw declares 965 these functions to take a wint_t argument and return a wint_t result. 966 This means that: 967 1. When the user passes an argument outside the range 0x0000..0xFFFF, the 968 function will look only at the lower 16 bits. This is allowed according 969 to POSIX. 970 2. The return value is returned in the lower 16 bits of the result register. 971 The upper 16 bits are random: whatever happened to be in that part of the 972 result register. We need to fix this by adding a zero-extend from 973 wchar_t to wint_t after the call. */ 974 975_GL_WCTYPE_INLINE wint_t 976rpl_towlower (wint_t wc) 977{ 978 return (wint_t) (wchar_t) towlower (wc); 979} 980# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 981# define towlower rpl_towlower 982# endif 983 984_GL_WCTYPE_INLINE wint_t 985rpl_towupper (wint_t wc) 986{ 987 return (wint_t) (wchar_t) towupper (wc); 988} 989# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 990# define towupper rpl_towupper 991# endif 992 993# endif /* __MINGW32__ && !0 */ 994 995# define GNULIB_defined_wctype_functions 1 996#endif 997 998#if 0 999_GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc)); 1000#else 1001_GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc)); 1002#endif 1003#if 0 1004_GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc)); 1005#else 1006_GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc)); 1007#endif 1008#if 0 1009_GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc)); 1010#else 1011_GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc)); 1012#endif 1013#if 0 1014# if 0 1015_GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc)); 1016# else 1017_GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc)); 1018# endif 1019#endif 1020#if 0 1021_GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc)); 1022#else 1023_GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc)); 1024#endif 1025#if 0 1026_GL_CXXALIAS_RPL (iswlower, int, (wint_t wc)); 1027#else 1028_GL_CXXALIAS_SYS (iswlower, int, (wint_t wc)); 1029#endif 1030#if 0 1031_GL_CXXALIAS_RPL (iswprint, int, (wint_t wc)); 1032#else 1033_GL_CXXALIAS_SYS (iswprint, int, (wint_t wc)); 1034#endif 1035#if 0 1036_GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc)); 1037#else 1038_GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc)); 1039#endif 1040#if 0 1041_GL_CXXALIAS_RPL (iswspace, int, (wint_t wc)); 1042#else 1043_GL_CXXALIAS_SYS (iswspace, int, (wint_t wc)); 1044#endif 1045#if 0 1046_GL_CXXALIAS_RPL (iswupper, int, (wint_t wc)); 1047#else 1048_GL_CXXALIAS_SYS (iswupper, int, (wint_t wc)); 1049#endif 1050#if 0 1051# if 0 1052_GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc)); 1053# else 1054_GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc)); 1055# endif 1056#endif 1057#if __GLIBC__ >= 2 1058_GL_CXXALIASWARN (iswalnum); 1059_GL_CXXALIASWARN (iswalpha); 1060_GL_CXXALIASWARN (iswcntrl); 1061_GL_CXXALIASWARN (iswdigit); 1062_GL_CXXALIASWARN (iswgraph); 1063_GL_CXXALIASWARN (iswlower); 1064_GL_CXXALIASWARN (iswprint); 1065_GL_CXXALIASWARN (iswpunct); 1066_GL_CXXALIASWARN (iswspace); 1067_GL_CXXALIASWARN (iswupper); 1068_GL_CXXALIASWARN (iswxdigit); 1069#endif 1070 1071#if 0 1072# if 0 || 0 1073_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc)); 1074# else 1075_GL_CXXALIAS_SYS (iswblank, int, (wint_t wc)); 1076# endif 1077# if __GLIBC__ >= 2 1078_GL_CXXALIASWARN (iswblank); 1079# endif 1080#endif 1081 1082#if !1 1083# if !GNULIB_defined_wctype_t 1084typedef void * wctype_t; 1085# define GNULIB_defined_wctype_t 1 1086# endif 1087#endif 1088 1089/* Get a descriptor for a wide character property. */ 1090#if 0 1091# if !1 1092_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name)); 1093# endif 1094_GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name)); 1095# if __GLIBC__ >= 2 1096_GL_CXXALIASWARN (wctype); 1097# endif 1098#elif defined GNULIB_POSIXCHECK 1099# undef wctype 1100# if HAVE_RAW_DECL_WCTYPE 1101_GL_WARN_ON_USE (wctype, "wctype is unportable - " 1102 "use gnulib module wctype for portability"); 1103# endif 1104#endif 1105 1106/* Test whether a wide character has a given property. 1107 The argument WC must be either a wchar_t value or WEOF. 1108 The argument DESC must have been returned by the wctype() function. */ 1109#if 0 1110# if 0 1111# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1112# undef iswctype 1113# define iswctype rpl_iswctype 1114# endif 1115_GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc)); 1116_GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc)); 1117# else 1118# if !1 1119_GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc)); 1120# endif 1121_GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc)); 1122# endif 1123# if __GLIBC__ >= 2 1124_GL_CXXALIASWARN (iswctype); 1125# endif 1126#elif defined GNULIB_POSIXCHECK 1127# undef iswctype 1128# if HAVE_RAW_DECL_ISWCTYPE 1129_GL_WARN_ON_USE (iswctype, "iswctype is unportable - " 1130 "use gnulib module iswctype for portability"); 1131# endif 1132#endif 1133 1134#if 0 || defined __MINGW32__ 1135_GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc)); 1136_GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc)); 1137#else 1138_GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc)); 1139_GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc)); 1140#endif 1141#if __GLIBC__ >= 2 1142_GL_CXXALIASWARN (towlower); 1143_GL_CXXALIASWARN (towupper); 1144#endif 1145 1146#if !1 1147# if !GNULIB_defined_wctrans_t 1148typedef void * wctrans_t; 1149# define GNULIB_defined_wctrans_t 1 1150# endif 1151#endif 1152 1153/* Get a descriptor for a wide character case conversion. */ 1154#if 0 1155# if !1 1156_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name)); 1157# endif 1158_GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name)); 1159# if __GLIBC__ >= 2 1160_GL_CXXALIASWARN (wctrans); 1161# endif 1162#elif defined GNULIB_POSIXCHECK 1163# undef wctrans 1164# if HAVE_RAW_DECL_WCTRANS 1165_GL_WARN_ON_USE (wctrans, "wctrans is unportable - " 1166 "use gnulib module wctrans for portability"); 1167# endif 1168#endif 1169 1170/* Perform a given case conversion on a wide character. 1171 The argument WC must be either a wchar_t value or WEOF. 1172 The argument DESC must have been returned by the wctrans() function. */ 1173#if 0 1174# if !1 1175_GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); 1176# endif 1177_GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); 1178# if __GLIBC__ >= 2 1179_GL_CXXALIASWARN (towctrans); 1180# endif 1181#elif defined GNULIB_POSIXCHECK 1182# undef towctrans 1183# if HAVE_RAW_DECL_TOWCTRANS 1184_GL_WARN_ON_USE (towctrans, "towctrans is unportable - " 1185 "use gnulib module towctrans for portability"); 1186# endif 1187#endif 1188 1189_GL_INLINE_HEADER_END 1190 1191#endif /* _GL_WCTYPE_H */ 1192#endif /* _GL_WCTYPE_H */ 1193#endif 1194