diff options
Diffstat (limited to 'gl/uchar.h')
| -rw-r--r-- | gl/uchar.h | 1456 |
1 files changed, 1456 insertions, 0 deletions
diff --git a/gl/uchar.h b/gl/uchar.h new file mode 100644 index 00000000..abc636c5 --- /dev/null +++ b/gl/uchar.h | |||
| @@ -0,0 +1,1456 @@ | |||
| 1 | /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ | ||
| 2 | /* <uchar.h> substitute - 16-bit and 32-bit wide character types. | ||
| 3 | Copyright (C) 2019-2025 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This file is free software: you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU Lesser General Public License as | ||
| 7 | published by the Free Software Foundation; either version 2.1 of the | ||
| 8 | License, or (at your option) any later version. | ||
| 9 | |||
| 10 | This file 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 Lesser General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU Lesser General Public License | ||
| 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
| 17 | |||
| 18 | /* Written by Bruno Haible <bruno@clisp.org>, 2019. */ | ||
| 19 | |||
| 20 | /* | ||
| 21 | * ISO C 23 <uchar.h> for platforms that lack it. | ||
| 22 | */ | ||
| 23 | |||
| 24 | #ifndef _GL_UCHAR_H | ||
| 25 | |||
| 26 | #if __GNUC__ >= 3 | ||
| 27 | #pragma GCC system_header | ||
| 28 | #endif | ||
| 29 | |||
| 30 | |||
| 31 | /* The include_next requires a split double-inclusion guard. */ | ||
| 32 | #if (defined __cplusplus ? 0 : 1) | ||
| 33 | # if defined __HAIKU__ | ||
| 34 | /* Work around <https://dev.haiku-os.org/ticket/17040>. */ | ||
| 35 | # include <stdint.h> | ||
| 36 | # endif | ||
| 37 | /* On AIX 7.2 with xlclang++, /usr/include/uchar.h produces compilation errors | ||
| 38 | because it contains typedef definitions of char16_t and char32_t, however | ||
| 39 | char16_t and char32_t are keywords in this situation. To work around it, | ||
| 40 | define char16_t and char32_t as macros. */ | ||
| 41 | # if defined __cplusplus && defined _AIX && defined __ibmxl__ && defined __clang__ | ||
| 42 | # define char16_t gl_char16_t | ||
| 43 | # define char32_t gl_char32_t | ||
| 44 | # endif | ||
| 45 | # include_next <uchar.h> | ||
| 46 | #endif | ||
| 47 | |||
| 48 | #ifndef _GL_UCHAR_H | ||
| 49 | #define _GL_UCHAR_H | ||
| 50 | |||
| 51 | /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_BEGIN_C_LINKAGE, | ||
| 52 | _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ | ||
| 53 | #if !_GL_CONFIG_H_INCLUDED | ||
| 54 | #error "Please include config.h first." | ||
| 55 | #endif | ||
| 56 | |||
| 57 | /* Get uint_least16_t, uint_least32_t. */ | ||
| 58 | #include <stdint.h> | ||
| 59 | |||
| 60 | /* Get mbstate_t, size_t. */ | ||
| 61 | #include <wchar.h> | ||
| 62 | |||
| 63 | /* For the inline functions. */ | ||
| 64 | #include <string.h> | ||
| 65 | #include <wctype.h> | ||
| 66 | |||
| 67 | /* The __attribute__ feature is available in gcc versions 2.5 and later. | ||
| 68 | The attribute __pure__ was added in gcc 2.96. */ | ||
| 69 | #ifndef _GL_ATTRIBUTE_PURE | ||
| 70 | # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ | ||
| 71 | # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) | ||
| 72 | # else | ||
| 73 | # define _GL_ATTRIBUTE_PURE /* empty */ | ||
| 74 | # endif | ||
| 75 | #endif | ||
| 76 | |||
| 77 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | ||
| 78 | /* C++ compatible function declaration macros. | ||
| 79 | Copyright (C) 2010-2025 Free Software Foundation, Inc. | ||
| 80 | |||
| 81 | This program is free software: you can redistribute it and/or modify it | ||
| 82 | under the terms of the GNU Lesser General Public License as published | ||
| 83 | by the Free Software Foundation; either version 2 of the License, or | ||
| 84 | (at your option) any later version. | ||
| 85 | |||
| 86 | This program is distributed in the hope that it will be useful, | ||
| 87 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 88 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 89 | Lesser General Public License for more details. | ||
| 90 | |||
| 91 | You should have received a copy of the GNU Lesser General Public License | ||
| 92 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
| 93 | |||
| 94 | #ifndef _GL_CXXDEFS_H | ||
| 95 | #define _GL_CXXDEFS_H | ||
| 96 | |||
| 97 | /* Begin/end the GNULIB_NAMESPACE namespace. */ | ||
| 98 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 99 | # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { | ||
| 100 | # define _GL_END_NAMESPACE } | ||
| 101 | #else | ||
| 102 | # define _GL_BEGIN_NAMESPACE | ||
| 103 | # define _GL_END_NAMESPACE | ||
| 104 | #endif | ||
| 105 | |||
| 106 | /* The three most frequent use cases of these macros are: | ||
| 107 | |||
| 108 | * For providing a substitute for a function that is missing on some | ||
| 109 | platforms, but is declared and works fine on the platforms on which | ||
| 110 | it exists: | ||
| 111 | |||
| 112 | #if @GNULIB_FOO@ | ||
| 113 | # if !@HAVE_FOO@ | ||
| 114 | _GL_FUNCDECL_SYS (foo, ...); | ||
| 115 | # endif | ||
| 116 | _GL_CXXALIAS_SYS (foo, ...); | ||
| 117 | _GL_CXXALIASWARN (foo); | ||
| 118 | #elif defined GNULIB_POSIXCHECK | ||
| 119 | ... | ||
| 120 | #endif | ||
| 121 | |||
| 122 | * For providing a replacement for a function that exists on all platforms, | ||
| 123 | but is broken/insufficient and needs to be replaced on some platforms: | ||
| 124 | |||
| 125 | #if @GNULIB_FOO@ | ||
| 126 | # if @REPLACE_FOO@ | ||
| 127 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 128 | # undef foo | ||
| 129 | # define foo rpl_foo | ||
| 130 | # endif | ||
| 131 | _GL_FUNCDECL_RPL (foo, ...); | ||
| 132 | _GL_CXXALIAS_RPL (foo, ...); | ||
| 133 | # else | ||
| 134 | _GL_CXXALIAS_SYS (foo, ...); | ||
| 135 | # endif | ||
| 136 | _GL_CXXALIASWARN (foo); | ||
| 137 | #elif defined GNULIB_POSIXCHECK | ||
| 138 | ... | ||
| 139 | #endif | ||
| 140 | |||
| 141 | * For providing a replacement for a function that exists on some platforms | ||
| 142 | but is broken/insufficient and needs to be replaced on some of them and | ||
| 143 | is additionally either missing or undeclared on some other platforms: | ||
| 144 | |||
| 145 | #if @GNULIB_FOO@ | ||
| 146 | # if @REPLACE_FOO@ | ||
| 147 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 148 | # undef foo | ||
| 149 | # define foo rpl_foo | ||
| 150 | # endif | ||
| 151 | _GL_FUNCDECL_RPL (foo, ...); | ||
| 152 | _GL_CXXALIAS_RPL (foo, ...); | ||
| 153 | # else | ||
| 154 | # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ | ||
| 155 | _GL_FUNCDECL_SYS (foo, ...); | ||
| 156 | # endif | ||
| 157 | _GL_CXXALIAS_SYS (foo, ...); | ||
| 158 | # endif | ||
| 159 | _GL_CXXALIASWARN (foo); | ||
| 160 | #elif defined GNULIB_POSIXCHECK | ||
| 161 | ... | ||
| 162 | #endif | ||
| 163 | */ | ||
| 164 | |||
| 165 | /* _GL_EXTERN_C declaration; | ||
| 166 | performs the declaration with C linkage. */ | ||
| 167 | #if defined __cplusplus | ||
| 168 | # define _GL_EXTERN_C extern "C" | ||
| 169 | #else | ||
| 170 | # define _GL_EXTERN_C extern | ||
| 171 | #endif | ||
| 172 | |||
| 173 | /* _GL_EXTERN_C_FUNC declaration; | ||
| 174 | performs the declaration of a function with C linkage. */ | ||
| 175 | #if defined __cplusplus | ||
| 176 | # define _GL_EXTERN_C_FUNC extern "C" | ||
| 177 | #else | ||
| 178 | /* In C mode, omit the 'extern' keyword, because attributes in bracket syntax | ||
| 179 | are not allowed between 'extern' and the return type (see gnulib-common.m4). | ||
| 180 | */ | ||
| 181 | # define _GL_EXTERN_C_FUNC | ||
| 182 | #endif | ||
| 183 | |||
| 184 | /* _GL_FUNCDECL_RPL (func, rettype, parameters, [attributes]); | ||
| 185 | declares a replacement function, named rpl_func, with the given prototype, | ||
| 186 | consisting of return type, parameters, and attributes. | ||
| 187 | Although attributes are optional, the comma before them is required | ||
| 188 | for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW, | ||
| 189 | if needed, must be placed after the _GL_FUNCDECL_RPL invocation, | ||
| 190 | at the end of the declaration. | ||
| 191 | Examples: | ||
| 192 | _GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW; | ||
| 193 | _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...), | ||
| 194 | _GL_ARG_NONNULL ((1))); | ||
| 195 | |||
| 196 | Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front | ||
| 197 | of a _GL_FUNCDECL_RPL invocation only in C mode, not in C++ mode. (That's | ||
| 198 | because | ||
| 199 | [[...]] extern "C" <declaration>; | ||
| 200 | is invalid syntax in C++.) | ||
| 201 | */ | ||
| 202 | #define _GL_FUNCDECL_RPL(func,rettype,parameters,...) \ | ||
| 203 | _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters, __VA_ARGS__) | ||
| 204 | #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \ | ||
| 205 | _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters | ||
| 206 | |||
| 207 | /* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to | ||
| 208 | parenthesized func otherwise. Parenthesization is needed in C23 if | ||
| 209 | the function is like strchr and so is a qualifier-generic macro | ||
| 210 | that expands to something more complicated. */ | ||
| 211 | #ifdef __cplusplus | ||
| 212 | # define _GL_FUNCDECL_SYS_NAME(func) func | ||
| 213 | #else | ||
| 214 | # define _GL_FUNCDECL_SYS_NAME(func) (func) | ||
| 215 | #endif | ||
| 216 | |||
| 217 | /* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]); | ||
| 218 | declares the system function, named func, with the given prototype, | ||
| 219 | consisting of return type, parameters, and attributes. | ||
| 220 | Although attributes are optional, the comma before them is required | ||
| 221 | for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW, | ||
| 222 | if needed, must be placed after the _GL_FUNCDECL_RPL invocation, | ||
| 223 | at the end of the declaration. | ||
| 224 | Examples: | ||
| 225 | _GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW; | ||
| 226 | _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD); | ||
| 227 | */ | ||
| 228 | #define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \ | ||
| 229 | _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters | ||
| 230 | |||
| 231 | /* _GL_CXXALIAS_RPL (func, rettype, parameters); | ||
| 232 | declares a C++ alias called GNULIB_NAMESPACE::func | ||
| 233 | that redirects to rpl_func, if GNULIB_NAMESPACE is defined. | ||
| 234 | Example: | ||
| 235 | _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); | ||
| 236 | |||
| 237 | Wrapping rpl_func in an object with an inline conversion operator | ||
| 238 | avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is | ||
| 239 | actually used in the program. */ | ||
| 240 | #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ | ||
| 241 | _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) | ||
| 242 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 243 | # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ | ||
| 244 | namespace GNULIB_NAMESPACE \ | ||
| 245 | { \ | ||
| 246 | static const struct _gl_ ## func ## _wrapper \ | ||
| 247 | { \ | ||
| 248 | typedef rettype (*type) parameters; \ | ||
| 249 | \ | ||
| 250 | inline operator type () const \ | ||
| 251 | { \ | ||
| 252 | return ::rpl_func; \ | ||
| 253 | } \ | ||
| 254 | } func = {}; \ | ||
| 255 | } \ | ||
| 256 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 257 | #else | ||
| 258 | # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ | ||
| 259 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 260 | #endif | ||
| 261 | |||
| 262 | /* _GL_CXXALIAS_MDA (func, rettype, parameters); | ||
| 263 | is to be used when func is a Microsoft deprecated alias, on native Windows. | ||
| 264 | It declares a C++ alias called GNULIB_NAMESPACE::func | ||
| 265 | that redirects to _func, if GNULIB_NAMESPACE is defined. | ||
| 266 | Example: | ||
| 267 | _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); | ||
| 268 | */ | ||
| 269 | #define _GL_CXXALIAS_MDA(func,rettype,parameters) \ | ||
| 270 | _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters) | ||
| 271 | |||
| 272 | /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); | ||
| 273 | is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); | ||
| 274 | except that the C function rpl_func may have a slightly different | ||
| 275 | declaration. A cast is used to silence the "invalid conversion" error | ||
| 276 | that would otherwise occur. */ | ||
| 277 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 278 | # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ | ||
| 279 | namespace GNULIB_NAMESPACE \ | ||
| 280 | { \ | ||
| 281 | static const struct _gl_ ## func ## _wrapper \ | ||
| 282 | { \ | ||
| 283 | typedef rettype (*type) parameters; \ | ||
| 284 | \ | ||
| 285 | inline operator type () const \ | ||
| 286 | { \ | ||
| 287 | return reinterpret_cast<type>(::rpl_func); \ | ||
| 288 | } \ | ||
| 289 | } func = {}; \ | ||
| 290 | } \ | ||
| 291 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 292 | #else | ||
| 293 | # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ | ||
| 294 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 295 | #endif | ||
| 296 | |||
| 297 | /* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters); | ||
| 298 | is like _GL_CXXALIAS_MDA (func, rettype, parameters); | ||
| 299 | except that the C function func may have a slightly different declaration. | ||
| 300 | A cast is used to silence the "invalid conversion" error that would | ||
| 301 | otherwise occur. */ | ||
| 302 | #define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \ | ||
| 303 | _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters) | ||
| 304 | |||
| 305 | /* _GL_CXXALIAS_SYS (func, rettype, parameters); | ||
| 306 | declares a C++ alias called GNULIB_NAMESPACE::func | ||
| 307 | that redirects to the system provided function func, if GNULIB_NAMESPACE | ||
| 308 | is defined. | ||
| 309 | Example: | ||
| 310 | _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); | ||
| 311 | |||
| 312 | Wrapping func in an object with an inline conversion operator | ||
| 313 | avoids a reference to func unless GNULIB_NAMESPACE::func is | ||
| 314 | actually used in the program. */ | ||
| 315 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 316 | # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ | ||
| 317 | namespace GNULIB_NAMESPACE \ | ||
| 318 | { \ | ||
| 319 | static const struct _gl_ ## func ## _wrapper \ | ||
| 320 | { \ | ||
| 321 | typedef rettype (*type) parameters; \ | ||
| 322 | \ | ||
| 323 | inline operator type () const \ | ||
| 324 | { \ | ||
| 325 | return ::func; \ | ||
| 326 | } \ | ||
| 327 | } func = {}; \ | ||
| 328 | } \ | ||
| 329 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 330 | #else | ||
| 331 | # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ | ||
| 332 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 333 | #endif | ||
| 334 | |||
| 335 | /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); | ||
| 336 | is like _GL_CXXALIAS_SYS (func, rettype, parameters); | ||
| 337 | except that the C function func may have a slightly different declaration. | ||
| 338 | A cast is used to silence the "invalid conversion" error that would | ||
| 339 | otherwise occur. */ | ||
| 340 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 341 | # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ | ||
| 342 | namespace GNULIB_NAMESPACE \ | ||
| 343 | { \ | ||
| 344 | static const struct _gl_ ## func ## _wrapper \ | ||
| 345 | { \ | ||
| 346 | typedef rettype (*type) parameters; \ | ||
| 347 | \ | ||
| 348 | inline operator type () const \ | ||
| 349 | { \ | ||
| 350 | return reinterpret_cast<type>(::func); \ | ||
| 351 | } \ | ||
| 352 | } func = {}; \ | ||
| 353 | } \ | ||
| 354 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 355 | #else | ||
| 356 | # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ | ||
| 357 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 358 | #endif | ||
| 359 | |||
| 360 | /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); | ||
| 361 | is like _GL_CXXALIAS_SYS (func, rettype, parameters); | ||
| 362 | except that the C function is picked among a set of overloaded functions, | ||
| 363 | namely the one with rettype2 and parameters2. Two consecutive casts | ||
| 364 | are used to silence the "cannot find a match" and "invalid conversion" | ||
| 365 | errors that would otherwise occur. */ | ||
| 366 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 367 | /* The outer cast must be a reinterpret_cast. | ||
| 368 | The inner cast: When the function is defined as a set of overloaded | ||
| 369 | functions, it works as a static_cast<>, choosing the designated variant. | ||
| 370 | When the function is defined as a single variant, it works as a | ||
| 371 | reinterpret_cast<>. The parenthesized cast syntax works both ways. */ | ||
| 372 | # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ | ||
| 373 | namespace GNULIB_NAMESPACE \ | ||
| 374 | { \ | ||
| 375 | static const struct _gl_ ## func ## _wrapper \ | ||
| 376 | { \ | ||
| 377 | typedef rettype (*type) parameters; \ | ||
| 378 | \ | ||
| 379 | inline operator type () const \ | ||
| 380 | { \ | ||
| 381 | return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ | ||
| 382 | } \ | ||
| 383 | } func = {}; \ | ||
| 384 | } \ | ||
| 385 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 386 | #else | ||
| 387 | # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ | ||
| 388 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 389 | #endif | ||
| 390 | |||
| 391 | /* _GL_CXXALIASWARN (func); | ||
| 392 | causes a warning to be emitted when ::func is used but not when | ||
| 393 | GNULIB_NAMESPACE::func is used. func must be defined without overloaded | ||
| 394 | variants. */ | ||
| 395 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 396 | # define _GL_CXXALIASWARN(func) \ | ||
| 397 | _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) | ||
| 398 | # define _GL_CXXALIASWARN_1(func,namespace) \ | ||
| 399 | _GL_CXXALIASWARN_2 (func, namespace) | ||
| 400 | /* To work around GCC bug <https://gcc.gnu.org/PR43881>, | ||
| 401 | we enable the warning only when not optimizing. */ | ||
| 402 | # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) | ||
| 403 | # define _GL_CXXALIASWARN_2(func,namespace) \ | ||
| 404 | _GL_WARN_ON_USE (func, \ | ||
| 405 | "The symbol ::" #func " refers to the system function. " \ | ||
| 406 | "Use " #namespace "::" #func " instead.") | ||
| 407 | # elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING | ||
| 408 | # define _GL_CXXALIASWARN_2(func,namespace) \ | ||
| 409 | extern __typeof__ (func) func | ||
| 410 | # else | ||
| 411 | # define _GL_CXXALIASWARN_2(func,namespace) \ | ||
| 412 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 413 | # endif | ||
| 414 | #else | ||
| 415 | # define _GL_CXXALIASWARN(func) \ | ||
| 416 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 417 | #endif | ||
| 418 | |||
| 419 | /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); | ||
| 420 | causes a warning to be emitted when the given overloaded variant of ::func | ||
| 421 | is used but not when GNULIB_NAMESPACE::func is used. */ | ||
| 422 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 423 | # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ | ||
| 424 | _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ | ||
| 425 | GNULIB_NAMESPACE) | ||
| 426 | # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ | ||
| 427 | _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) | ||
| 428 | /* To work around GCC bug <https://gcc.gnu.org/PR43881>, | ||
| 429 | we enable the warning only when not optimizing. */ | ||
| 430 | # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) | ||
| 431 | # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ | ||
| 432 | _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \ | ||
| 433 | "The symbol ::" #func " refers to the system function. " \ | ||
| 434 | "Use " #namespace "::" #func " instead.") | ||
| 435 | # else | ||
| 436 | # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ | ||
| 437 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 438 | # endif | ||
| 439 | #else | ||
| 440 | # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ | ||
| 441 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 442 | #endif | ||
| 443 | |||
| 444 | #endif /* _GL_CXXDEFS_H */ | ||
| 445 | |||
| 446 | /* The definition of _GL_ARG_NONNULL is copied here. */ | ||
| 447 | /* A C macro for declaring that specific arguments must not be NULL. | ||
| 448 | Copyright (C) 2009-2025 Free Software Foundation, Inc. | ||
| 449 | |||
| 450 | This program is free software: you can redistribute it and/or modify it | ||
| 451 | under the terms of the GNU Lesser General Public License as published | ||
| 452 | by the Free Software Foundation; either version 2 of the License, or | ||
| 453 | (at your option) any later version. | ||
| 454 | |||
| 455 | This program is distributed in the hope that it will be useful, | ||
| 456 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 457 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 458 | Lesser General Public License for more details. | ||
| 459 | |||
| 460 | You should have received a copy of the GNU Lesser General Public License | ||
| 461 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
| 462 | |||
| 463 | /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools | ||
| 464 | that the values passed as arguments n, ..., m must be non-NULL pointers. | ||
| 465 | n = 1 stands for the first argument, n = 2 for the second argument etc. */ | ||
| 466 | #ifndef _GL_ARG_NONNULL | ||
| 467 | # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ | ||
| 468 | # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) | ||
| 469 | # else | ||
| 470 | # define _GL_ARG_NONNULL(params) | ||
| 471 | # endif | ||
| 472 | #endif | ||
| 473 | |||
| 474 | /* The definition of _GL_WARN_ON_USE is copied here. */ | ||
| 475 | /* A C macro for emitting warnings if a function is used. | ||
| 476 | Copyright (C) 2010-2025 Free Software Foundation, Inc. | ||
| 477 | |||
| 478 | This program is free software: you can redistribute it and/or modify it | ||
| 479 | under the terms of the GNU Lesser General Public License as published | ||
| 480 | by the Free Software Foundation; either version 2 of the License, or | ||
| 481 | (at your option) any later version. | ||
| 482 | |||
| 483 | This program is distributed in the hope that it will be useful, | ||
| 484 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 485 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 486 | Lesser General Public License for more details. | ||
| 487 | |||
| 488 | You should have received a copy of the GNU Lesser General Public License | ||
| 489 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
| 490 | |||
| 491 | /* _GL_WARN_ON_USE (function, "literal string") issues a declaration | ||
| 492 | for FUNCTION which will then trigger a compiler warning containing | ||
| 493 | the text of "literal string" anywhere that function is called, if | ||
| 494 | supported by the compiler. If the compiler does not support this | ||
| 495 | feature, the macro expands to an unused extern declaration. | ||
| 496 | |||
| 497 | _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the | ||
| 498 | attribute used in _GL_WARN_ON_USE. If the compiler does not support | ||
| 499 | this feature, it expands to empty. | ||
| 500 | |||
| 501 | These macros are useful for marking a function as a potential | ||
| 502 | portability trap, with the intent that "literal string" include | ||
| 503 | instructions on the replacement function that should be used | ||
| 504 | instead. | ||
| 505 | _GL_WARN_ON_USE is for functions with 'extern' linkage. | ||
| 506 | _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' | ||
| 507 | linkage. | ||
| 508 | |||
| 509 | _GL_WARN_ON_USE should not be used more than once for a given function | ||
| 510 | in a given compilation unit (because this may generate a warning even | ||
| 511 | if the function is never called). | ||
| 512 | |||
| 513 | However, one of the reasons that a function is a portability trap is | ||
| 514 | if it has the wrong signature. Declaring FUNCTION with a different | ||
| 515 | signature in C is a compilation error, so this macro must use the | ||
| 516 | same type as any existing declaration so that programs that avoid | ||
| 517 | the problematic FUNCTION do not fail to compile merely because they | ||
| 518 | included a header that poisoned the function. But this implies that | ||
| 519 | _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already | ||
| 520 | have a declaration. Use of this macro implies that there must not | ||
| 521 | be any other macro hiding the declaration of FUNCTION; but | ||
| 522 | undefining FUNCTION first is part of the poisoning process anyway | ||
| 523 | (although for symbols that are provided only via a macro, the result | ||
| 524 | is a compilation error rather than a warning containing | ||
| 525 | "literal string"). Also note that in C++, it is only safe to use if | ||
| 526 | FUNCTION has no overloads. | ||
| 527 | |||
| 528 | For an example, it is possible to poison 'getline' by: | ||
| 529 | - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], | ||
| 530 | [getline]) in configure.ac, which potentially defines | ||
| 531 | HAVE_RAW_DECL_GETLINE | ||
| 532 | - adding this code to a header that wraps the system <stdio.h>: | ||
| 533 | #undef getline | ||
| 534 | #if HAVE_RAW_DECL_GETLINE | ||
| 535 | _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" | ||
| 536 | "not universally present; use the gnulib module getline"); | ||
| 537 | #endif | ||
| 538 | |||
| 539 | It is not possible to directly poison global variables. But it is | ||
| 540 | possible to write a wrapper accessor function, and poison that | ||
| 541 | (less common usage, like &environ, will cause a compilation error | ||
| 542 | rather than issue the nice warning, but the end result of informing | ||
| 543 | the developer about their portability problem is still achieved): | ||
| 544 | #if HAVE_RAW_DECL_ENVIRON | ||
| 545 | static char *** | ||
| 546 | rpl_environ (void) { return &environ; } | ||
| 547 | _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); | ||
| 548 | # undef environ | ||
| 549 | # define environ (*rpl_environ ()) | ||
| 550 | #endif | ||
| 551 | or better (avoiding contradictory use of 'static' and 'extern'): | ||
| 552 | #if HAVE_RAW_DECL_ENVIRON | ||
| 553 | static char *** | ||
| 554 | _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") | ||
| 555 | rpl_environ (void) { return &environ; } | ||
| 556 | # undef environ | ||
| 557 | # define environ (*rpl_environ ()) | ||
| 558 | #endif | ||
| 559 | */ | ||
| 560 | #ifndef _GL_WARN_ON_USE | ||
| 561 | |||
| 562 | # if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__ | ||
| 563 | /* A compiler attribute is available in gcc versions 4.3.0 and later. */ | ||
| 564 | # define _GL_WARN_ON_USE(function, message) \ | ||
| 565 | _GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message))) | ||
| 566 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ | ||
| 567 | __attribute__ ((__warning__ (message))) | ||
| 568 | # elif __clang_major__ >= 4 | ||
| 569 | /* Another compiler attribute is available in clang. */ | ||
| 570 | # define _GL_WARN_ON_USE(function, message) \ | ||
| 571 | _GL_WARN_EXTERN_C __typeof__ (function) function \ | ||
| 572 | __attribute__ ((__diagnose_if__ (1, message, "warning"))) | ||
| 573 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ | ||
| 574 | __attribute__ ((__diagnose_if__ (1, message, "warning"))) | ||
| 575 | # elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING | ||
| 576 | /* Verify the existence of the function. */ | ||
| 577 | # define _GL_WARN_ON_USE(function, message) \ | ||
| 578 | _GL_WARN_EXTERN_C __typeof__ (function) function | ||
| 579 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) | ||
| 580 | # else /* Unsupported. */ | ||
| 581 | # define _GL_WARN_ON_USE(function, message) \ | ||
| 582 | _GL_WARN_EXTERN_C int _gl_warn_on_use | ||
| 583 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) | ||
| 584 | # endif | ||
| 585 | #endif | ||
| 586 | |||
| 587 | /* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") | ||
| 588 | is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the | ||
| 589 | function is declared with the given prototype, consisting of return type, | ||
| 590 | parameters, and attributes. | ||
| 591 | This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does | ||
| 592 | not work in this case. */ | ||
| 593 | #ifndef _GL_WARN_ON_USE_CXX | ||
| 594 | # if !defined __cplusplus | ||
| 595 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
| 596 | _GL_WARN_ON_USE (function, msg) | ||
| 597 | # else | ||
| 598 | # if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__ | ||
| 599 | /* A compiler attribute is available in gcc versions 4.3.0 and later. */ | ||
| 600 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
| 601 | extern rettype_gcc function parameters_and_attributes \ | ||
| 602 | __attribute__ ((__warning__ (msg))) | ||
| 603 | # elif __clang_major__ >= 4 | ||
| 604 | /* Another compiler attribute is available in clang. */ | ||
| 605 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
| 606 | extern rettype_clang function parameters_and_attributes \ | ||
| 607 | __attribute__ ((__diagnose_if__ (1, msg, "warning"))) | ||
| 608 | # elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING | ||
| 609 | /* Verify the existence of the function. */ | ||
| 610 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
| 611 | extern rettype_gcc function parameters_and_attributes | ||
| 612 | # else /* Unsupported. */ | ||
| 613 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
| 614 | _GL_WARN_EXTERN_C int _gl_warn_on_use | ||
| 615 | # endif | ||
| 616 | # endif | ||
| 617 | #endif | ||
| 618 | |||
| 619 | /* _GL_WARN_EXTERN_C declaration; | ||
| 620 | performs the declaration with C linkage. */ | ||
| 621 | #ifndef _GL_WARN_EXTERN_C | ||
| 622 | # if defined __cplusplus | ||
| 623 | # define _GL_WARN_EXTERN_C extern "C" | ||
| 624 | # else | ||
| 625 | # define _GL_WARN_EXTERN_C extern | ||
| 626 | # endif | ||
| 627 | #endif | ||
| 628 | |||
| 629 | |||
| 630 | _GL_INLINE_HEADER_BEGIN | ||
| 631 | |||
| 632 | |||
| 633 | #if !(defined __cplusplus ? 0 || 0 : 1) | ||
| 634 | |||
| 635 | /* An 8-bit variant of wchar_t. | ||
| 636 | Note: This type is only mandated by ISO C 23 or newer, and it does | ||
| 637 | denote UTF-8 units. */ | ||
| 638 | typedef unsigned char char8_t; | ||
| 639 | |||
| 640 | #elif 0 | ||
| 641 | |||
| 642 | typedef unsigned char gl_char8_t; | ||
| 643 | # define char8_t gl_char8_t | ||
| 644 | |||
| 645 | #endif | ||
| 646 | |||
| 647 | #if !(defined __cplusplus ? 0 || 0 : 1) | ||
| 648 | |||
| 649 | /* A 16-bit variant of wchar_t. | ||
| 650 | Note: This type is only mandated by ISO C 11 or newer. In ISO C 23 | ||
| 651 | and newer, it denotes UTF-16 units; in older versions of ISO C it did | ||
| 652 | so only on platforms on which __STDC_UTF_16__ was defined. */ | ||
| 653 | typedef uint_least16_t char16_t; | ||
| 654 | |||
| 655 | #elif 0 | ||
| 656 | |||
| 657 | typedef uint_least16_t gl_char16_t; | ||
| 658 | # define char16_t gl_char16_t | ||
| 659 | |||
| 660 | #endif | ||
| 661 | |||
| 662 | #if !(defined __cplusplus ? 0 || 0 : 1) | ||
| 663 | |||
| 664 | /* A 32-bit variant of wchar_t. | ||
| 665 | Note: This type is only mandated by ISO C 11 or newer. In ISO C 23 | ||
| 666 | and newer, it denotes UTF-32 code points; in older versions of ISO C | ||
| 667 | it did so only on platforms on which __STDC_UTF_32__ was defined. | ||
| 668 | In gnulib, we guarantee that it denotes UTF-32 code points if and | ||
| 669 | only if the module 'uchar-h-c23' is in use. */ | ||
| 670 | typedef uint_least32_t char32_t; | ||
| 671 | |||
| 672 | #elif 0 | ||
| 673 | |||
| 674 | typedef uint_least32_t gl_char32_t; | ||
| 675 | # define char32_t gl_char32_t | ||
| 676 | |||
| 677 | #endif | ||
| 678 | |||
| 679 | /* Define if a 'char32_t' can hold more characters than a 'wchar_t'. */ | ||
| 680 | #if 0 /* 32-bit AIX, Cygwin, native Windows */ | ||
| 681 | # define _GL_SMALL_WCHAR_T 1 | ||
| 682 | #endif | ||
| 683 | |||
| 684 | /* Define if 'wchar_t', like 'char32_t', | ||
| 685 | - is a 32-bit type, and | ||
| 686 | - represents Unicode code points. | ||
| 687 | For this test, we can use __STDC_ISO_10646__ (defined by glibc, musl libc, | ||
| 688 | Cygwin) but need to consider _GL_SMALL_WCHAR_T, so as to exclude Cygwin. | ||
| 689 | We cannot use __STDC_UTF_16__ or __STDC_UTF_32__ | ||
| 690 | - because these macros provide info about char16_t and char32_t (not | ||
| 691 | wchar_t!), and | ||
| 692 | - because GCC >= 4.9 defines these macros on all platforms, even on | ||
| 693 | FreeBSD and Solaris. | ||
| 694 | We should better not use __STD_UTF_16__, __STD_UTF_32__ either, because | ||
| 695 | these macros are misspellings, only defined by Android's <uchar.h>. */ | ||
| 696 | #if defined __STDC_ISO_10646__ && !_GL_SMALL_WCHAR_T | ||
| 697 | /* glibc, musl libc */ | ||
| 698 | # define _GL_WCHAR_T_IS_UCS4 1 | ||
| 699 | #endif | ||
| 700 | #if _GL_WCHAR_T_IS_UCS4 | ||
| 701 | static_assert (sizeof (char32_t) == sizeof (wchar_t)); | ||
| 702 | #endif | ||
| 703 | |||
| 704 | |||
| 705 | /* Convert a single-byte character to a 32-bit wide character. */ | ||
| 706 | #if 0 | ||
| 707 | # if _GL_WCHAR_T_IS_UCS4 && !defined IN_BTOC32 | ||
| 708 | _GL_BEGIN_C_LINKAGE | ||
| 709 | _GL_INLINE _GL_ATTRIBUTE_PURE wint_t | ||
| 710 | btoc32 (int c) | ||
| 711 | { | ||
| 712 | return | ||
| 713 | # if 1 && defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 714 | GNULIB_NAMESPACE:: | ||
| 715 | # endif | ||
| 716 | btowc (c); | ||
| 717 | } | ||
| 718 | _GL_END_C_LINKAGE | ||
| 719 | # else | ||
| 720 | _GL_FUNCDECL_SYS (btoc32, wint_t, (int c), _GL_ATTRIBUTE_PURE); | ||
| 721 | # endif | ||
| 722 | _GL_CXXALIAS_SYS (btoc32, wint_t, (int c)); | ||
| 723 | _GL_CXXALIASWARN (btoc32); | ||
| 724 | #endif | ||
| 725 | |||
| 726 | |||
| 727 | /* Test a specific property of a 32-bit wide character. */ | ||
| 728 | #if 1 | ||
| 729 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISALNUM | ||
| 730 | _GL_BEGIN_C_LINKAGE | ||
| 731 | _GL_INLINE int | ||
| 732 | c32isalnum (wint_t wc) | ||
| 733 | { | ||
| 734 | return | ||
| 735 | # if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 736 | GNULIB_NAMESPACE:: | ||
| 737 | # endif | ||
| 738 | iswalnum (wc); | ||
| 739 | } | ||
| 740 | _GL_END_C_LINKAGE | ||
| 741 | # else | ||
| 742 | _GL_FUNCDECL_SYS (c32isalnum, int, (wint_t wc), ); | ||
| 743 | # endif | ||
| 744 | _GL_CXXALIAS_SYS (c32isalnum, int, (wint_t wc)); | ||
| 745 | _GL_CXXALIASWARN (c32isalnum); | ||
| 746 | #endif | ||
| 747 | #if 1 | ||
| 748 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISALPHA | ||
| 749 | _GL_BEGIN_C_LINKAGE | ||
| 750 | _GL_INLINE int | ||
| 751 | c32isalpha (wint_t wc) | ||
| 752 | { | ||
| 753 | return | ||
| 754 | # if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 755 | GNULIB_NAMESPACE:: | ||
| 756 | # endif | ||
| 757 | iswalpha (wc); | ||
| 758 | } | ||
| 759 | _GL_END_C_LINKAGE | ||
| 760 | # else | ||
| 761 | _GL_FUNCDECL_SYS (c32isalpha, int, (wint_t wc), ); | ||
| 762 | # endif | ||
| 763 | _GL_CXXALIAS_SYS (c32isalpha, int, (wint_t wc)); | ||
| 764 | _GL_CXXALIASWARN (c32isalpha); | ||
| 765 | #endif | ||
| 766 | #if 1 | ||
| 767 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISBLANK | ||
| 768 | _GL_BEGIN_C_LINKAGE | ||
| 769 | _GL_INLINE int | ||
| 770 | c32isblank (wint_t wc) | ||
| 771 | { | ||
| 772 | return | ||
| 773 | # if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 774 | GNULIB_NAMESPACE:: | ||
| 775 | # endif | ||
| 776 | iswblank (wc); | ||
| 777 | } | ||
| 778 | _GL_END_C_LINKAGE | ||
| 779 | # else | ||
| 780 | _GL_FUNCDECL_SYS (c32isblank, int, (wint_t wc), ); | ||
| 781 | # endif | ||
| 782 | _GL_CXXALIAS_SYS (c32isblank, int, (wint_t wc)); | ||
| 783 | _GL_CXXALIASWARN (c32isblank); | ||
| 784 | #endif | ||
| 785 | #if 1 | ||
| 786 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISCNTRL | ||
| 787 | _GL_BEGIN_C_LINKAGE | ||
| 788 | _GL_INLINE int | ||
| 789 | c32iscntrl (wint_t wc) | ||
| 790 | { | ||
| 791 | return | ||
| 792 | # if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 793 | GNULIB_NAMESPACE:: | ||
| 794 | # endif | ||
| 795 | iswcntrl (wc); | ||
| 796 | } | ||
| 797 | _GL_END_C_LINKAGE | ||
| 798 | # else | ||
| 799 | _GL_FUNCDECL_SYS (c32iscntrl, int, (wint_t wc), ); | ||
| 800 | # endif | ||
| 801 | _GL_CXXALIAS_SYS (c32iscntrl, int, (wint_t wc)); | ||
| 802 | _GL_CXXALIASWARN (c32iscntrl); | ||
| 803 | #endif | ||
| 804 | #if 1 | ||
| 805 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISDIGIT | ||
| 806 | _GL_BEGIN_C_LINKAGE | ||
| 807 | _GL_INLINE int | ||
| 808 | c32isdigit (wint_t wc) | ||
| 809 | { | ||
| 810 | return | ||
| 811 | # if 1 && defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 812 | GNULIB_NAMESPACE:: | ||
| 813 | # endif | ||
| 814 | iswdigit (wc); | ||
| 815 | } | ||
| 816 | _GL_END_C_LINKAGE | ||
| 817 | # else | ||
| 818 | _GL_FUNCDECL_SYS (c32isdigit, int, (wint_t wc), ); | ||
| 819 | # endif | ||
| 820 | _GL_CXXALIAS_SYS (c32isdigit, int, (wint_t wc)); | ||
| 821 | _GL_CXXALIASWARN (c32isdigit); | ||
| 822 | #endif | ||
| 823 | #if 1 | ||
| 824 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISGRAPH | ||
| 825 | _GL_BEGIN_C_LINKAGE | ||
| 826 | _GL_INLINE int | ||
| 827 | c32isgraph (wint_t wc) | ||
| 828 | { | ||
| 829 | return | ||
| 830 | # if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 831 | GNULIB_NAMESPACE:: | ||
| 832 | # endif | ||
| 833 | iswgraph (wc); | ||
| 834 | } | ||
| 835 | _GL_END_C_LINKAGE | ||
| 836 | # else | ||
| 837 | _GL_FUNCDECL_SYS (c32isgraph, int, (wint_t wc), ); | ||
| 838 | # endif | ||
| 839 | _GL_CXXALIAS_SYS (c32isgraph, int, (wint_t wc)); | ||
| 840 | _GL_CXXALIASWARN (c32isgraph); | ||
| 841 | #endif | ||
| 842 | #if 1 | ||
| 843 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISLOWER | ||
| 844 | _GL_BEGIN_C_LINKAGE | ||
| 845 | _GL_INLINE int | ||
| 846 | c32islower (wint_t wc) | ||
| 847 | { | ||
| 848 | return | ||
| 849 | # if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 850 | GNULIB_NAMESPACE:: | ||
| 851 | # endif | ||
| 852 | iswlower (wc); | ||
| 853 | } | ||
| 854 | _GL_END_C_LINKAGE | ||
| 855 | # else | ||
| 856 | _GL_FUNCDECL_SYS (c32islower, int, (wint_t wc), ); | ||
| 857 | # endif | ||
| 858 | _GL_CXXALIAS_SYS (c32islower, int, (wint_t wc)); | ||
| 859 | _GL_CXXALIASWARN (c32islower); | ||
| 860 | #endif | ||
| 861 | #if 1 | ||
| 862 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISPRINT | ||
| 863 | _GL_BEGIN_C_LINKAGE | ||
| 864 | _GL_INLINE int | ||
| 865 | c32isprint (wint_t wc) | ||
| 866 | { | ||
| 867 | return | ||
| 868 | # if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 869 | GNULIB_NAMESPACE:: | ||
| 870 | # endif | ||
| 871 | iswprint (wc); | ||
| 872 | } | ||
| 873 | _GL_END_C_LINKAGE | ||
| 874 | # else | ||
| 875 | _GL_FUNCDECL_SYS (c32isprint, int, (wint_t wc), ); | ||
| 876 | # endif | ||
| 877 | _GL_CXXALIAS_SYS (c32isprint, int, (wint_t wc)); | ||
| 878 | _GL_CXXALIASWARN (c32isprint); | ||
| 879 | #endif | ||
| 880 | #if 1 | ||
| 881 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISPUNCT | ||
| 882 | _GL_BEGIN_C_LINKAGE | ||
| 883 | _GL_INLINE int | ||
| 884 | c32ispunct (wint_t wc) | ||
| 885 | { | ||
| 886 | return | ||
| 887 | # if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 888 | GNULIB_NAMESPACE:: | ||
| 889 | # endif | ||
| 890 | iswpunct (wc); | ||
| 891 | } | ||
| 892 | _GL_END_C_LINKAGE | ||
| 893 | # else | ||
| 894 | _GL_FUNCDECL_SYS (c32ispunct, int, (wint_t wc), ); | ||
| 895 | # endif | ||
| 896 | _GL_CXXALIAS_SYS (c32ispunct, int, (wint_t wc)); | ||
| 897 | _GL_CXXALIASWARN (c32ispunct); | ||
| 898 | #endif | ||
| 899 | #if 1 | ||
| 900 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISSPACE | ||
| 901 | _GL_BEGIN_C_LINKAGE | ||
| 902 | _GL_INLINE int | ||
| 903 | c32isspace (wint_t wc) | ||
| 904 | { | ||
| 905 | return | ||
| 906 | # if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 907 | GNULIB_NAMESPACE:: | ||
| 908 | # endif | ||
| 909 | iswspace (wc); | ||
| 910 | } | ||
| 911 | _GL_END_C_LINKAGE | ||
| 912 | # else | ||
| 913 | _GL_FUNCDECL_SYS (c32isspace, int, (wint_t wc), ); | ||
| 914 | # endif | ||
| 915 | _GL_CXXALIAS_SYS (c32isspace, int, (wint_t wc)); | ||
| 916 | _GL_CXXALIASWARN (c32isspace); | ||
| 917 | #endif | ||
| 918 | #if 1 | ||
| 919 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISUPPER | ||
| 920 | _GL_BEGIN_C_LINKAGE | ||
| 921 | _GL_INLINE int | ||
| 922 | c32isupper (wint_t wc) | ||
| 923 | { | ||
| 924 | return | ||
| 925 | # if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 926 | GNULIB_NAMESPACE:: | ||
| 927 | # endif | ||
| 928 | iswupper (wc); | ||
| 929 | } | ||
| 930 | _GL_END_C_LINKAGE | ||
| 931 | # else | ||
| 932 | _GL_FUNCDECL_SYS (c32isupper, int, (wint_t wc), ); | ||
| 933 | # endif | ||
| 934 | _GL_CXXALIAS_SYS (c32isupper, int, (wint_t wc)); | ||
| 935 | _GL_CXXALIASWARN (c32isupper); | ||
| 936 | #endif | ||
| 937 | #if 1 | ||
| 938 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISXDIGIT | ||
| 939 | _GL_BEGIN_C_LINKAGE | ||
| 940 | _GL_INLINE int | ||
| 941 | c32isxdigit (wint_t wc) | ||
| 942 | { | ||
| 943 | return | ||
| 944 | # if 1 && defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 945 | GNULIB_NAMESPACE:: | ||
| 946 | # endif | ||
| 947 | iswxdigit (wc); | ||
| 948 | } | ||
| 949 | _GL_END_C_LINKAGE | ||
| 950 | # else | ||
| 951 | _GL_FUNCDECL_SYS (c32isxdigit, int, (wint_t wc), ); | ||
| 952 | # endif | ||
| 953 | _GL_CXXALIAS_SYS (c32isxdigit, int, (wint_t wc)); | ||
| 954 | _GL_CXXALIASWARN (c32isxdigit); | ||
| 955 | #endif | ||
| 956 | |||
| 957 | |||
| 958 | /* Case mapping of a 32-bit wide character. */ | ||
| 959 | #if 1 | ||
| 960 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32TOLOWER | ||
| 961 | _GL_BEGIN_C_LINKAGE | ||
| 962 | _GL_INLINE wint_t | ||
| 963 | c32tolower (wint_t wc) | ||
| 964 | { | ||
| 965 | return | ||
| 966 | # if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 967 | GNULIB_NAMESPACE:: | ||
| 968 | # endif | ||
| 969 | towlower (wc); | ||
| 970 | } | ||
| 971 | _GL_END_C_LINKAGE | ||
| 972 | # else | ||
| 973 | _GL_FUNCDECL_SYS (c32tolower, wint_t, (wint_t wc), ); | ||
| 974 | # endif | ||
| 975 | _GL_CXXALIAS_SYS (c32tolower, wint_t, (wint_t wc)); | ||
| 976 | _GL_CXXALIASWARN (c32tolower); | ||
| 977 | #endif | ||
| 978 | #if 0 | ||
| 979 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32TOUPPER | ||
| 980 | _GL_BEGIN_C_LINKAGE | ||
| 981 | _GL_INLINE wint_t | ||
| 982 | c32toupper (wint_t wc) | ||
| 983 | { | ||
| 984 | return | ||
| 985 | # if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 986 | GNULIB_NAMESPACE:: | ||
| 987 | # endif | ||
| 988 | towupper (wc); | ||
| 989 | } | ||
| 990 | _GL_END_C_LINKAGE | ||
| 991 | # else | ||
| 992 | _GL_FUNCDECL_SYS (c32toupper, wint_t, (wint_t wc), ); | ||
| 993 | # endif | ||
| 994 | _GL_CXXALIAS_SYS (c32toupper, wint_t, (wint_t wc)); | ||
| 995 | _GL_CXXALIASWARN (c32toupper); | ||
| 996 | #endif | ||
| 997 | |||
| 998 | |||
| 999 | /* Number of screen columns needed for a 32-bit wide character. */ | ||
| 1000 | #if 1 | ||
| 1001 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32WIDTH | ||
| 1002 | _GL_BEGIN_C_LINKAGE | ||
| 1003 | _GL_INLINE int | ||
| 1004 | c32width (char32_t wc) | ||
| 1005 | { | ||
| 1006 | return | ||
| 1007 | # if 1 && defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 1008 | GNULIB_NAMESPACE:: | ||
| 1009 | # endif | ||
| 1010 | wcwidth (wc); | ||
| 1011 | } | ||
| 1012 | _GL_END_C_LINKAGE | ||
| 1013 | # else | ||
| 1014 | _GL_FUNCDECL_SYS (c32width, int, (char32_t wc), ); | ||
| 1015 | # endif | ||
| 1016 | _GL_CXXALIAS_SYS (c32width, int, (char32_t wc)); | ||
| 1017 | _GL_CXXALIASWARN (c32width); | ||
| 1018 | #endif | ||
| 1019 | |||
| 1020 | |||
| 1021 | /* Converts a 32-bit wide character to a multibyte character. */ | ||
| 1022 | #if 0 | ||
| 1023 | # if 0 | ||
| 1024 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 1025 | # undef c32rtomb | ||
| 1026 | # define c32rtomb rpl_c32rtomb | ||
| 1027 | # endif | ||
| 1028 | _GL_FUNCDECL_RPL (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps), ); | ||
| 1029 | _GL_CXXALIAS_RPL (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps)); | ||
| 1030 | # else | ||
| 1031 | # if !1 | ||
| 1032 | _GL_FUNCDECL_SYS (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps), ); | ||
| 1033 | # endif | ||
| 1034 | _GL_CXXALIAS_SYS (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps)); | ||
| 1035 | # endif | ||
| 1036 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 | ||
| 1037 | _GL_CXXALIASWARN (c32rtomb); | ||
| 1038 | # endif | ||
| 1039 | #elif defined GNULIB_POSIXCHECK | ||
| 1040 | # if HAVE_RAW_DECL_C32RTOMB | ||
| 1041 | _GL_WARN_ON_USE (c32rtomb, "c32rtomb is not portable - " | ||
| 1042 | "use gnulib module c32rtomb for portability"); | ||
| 1043 | # endif | ||
| 1044 | #endif | ||
| 1045 | |||
| 1046 | |||
| 1047 | /* Convert a 32-bit wide string to a string. */ | ||
| 1048 | #if 0 | ||
| 1049 | # if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32SNRTOMBS | ||
| 1050 | _GL_BEGIN_C_LINKAGE | ||
| 1051 | _GL_INLINE _GL_ARG_NONNULL ((2)) size_t | ||
| 1052 | c32snrtombs (char *dest, const char32_t **srcp, size_t srclen, size_t len, | ||
| 1053 | mbstate_t *ps) | ||
| 1054 | { | ||
| 1055 | return | ||
| 1056 | # if 0 && defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 1057 | GNULIB_NAMESPACE:: | ||
| 1058 | # endif | ||
| 1059 | wcsnrtombs (dest, (const wchar_t **) srcp, srclen, len, ps); | ||
| 1060 | } | ||
| 1061 | _GL_END_C_LINKAGE | ||
| 1062 | # else | ||
| 1063 | _GL_FUNCDECL_SYS (c32snrtombs, size_t, | ||
| 1064 | (char *dest, const char32_t **srcp, size_t srclen, size_t len, | ||
| 1065 | mbstate_t *ps), | ||
| 1066 | _GL_ARG_NONNULL ((2))); | ||
| 1067 | # endif | ||
| 1068 | _GL_CXXALIAS_SYS (c32snrtombs, size_t, | ||
| 1069 | (char *dest, const char32_t **srcp, size_t srclen, size_t len, | ||
| 1070 | mbstate_t *ps)); | ||
| 1071 | _GL_CXXALIASWARN (c32snrtombs); | ||
| 1072 | #endif | ||
| 1073 | |||
| 1074 | |||
| 1075 | /* Convert a 32-bit wide string to a string. */ | ||
| 1076 | #if 0 | ||
| 1077 | # if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32SRTOMBS | ||
| 1078 | _GL_BEGIN_C_LINKAGE | ||
| 1079 | _GL_INLINE _GL_ARG_NONNULL ((2)) size_t | ||
| 1080 | c32srtombs (char *dest, const char32_t **srcp, size_t len, mbstate_t *ps) | ||
| 1081 | { | ||
| 1082 | return | ||
| 1083 | # if 0 && defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 1084 | GNULIB_NAMESPACE:: | ||
| 1085 | # endif | ||
| 1086 | wcsrtombs (dest, (const wchar_t **) srcp, len, ps); | ||
| 1087 | } | ||
| 1088 | _GL_END_C_LINKAGE | ||
| 1089 | # else | ||
| 1090 | _GL_FUNCDECL_SYS (c32srtombs, size_t, | ||
| 1091 | (char *dest, const char32_t **srcp, size_t len, | ||
| 1092 | mbstate_t *ps), | ||
| 1093 | _GL_ARG_NONNULL ((2))); | ||
| 1094 | # endif | ||
| 1095 | _GL_CXXALIAS_SYS (c32srtombs, size_t, | ||
| 1096 | (char *dest, const char32_t **srcp, size_t len, | ||
| 1097 | mbstate_t *ps)); | ||
| 1098 | _GL_CXXALIASWARN (c32srtombs); | ||
| 1099 | #endif | ||
| 1100 | |||
| 1101 | |||
| 1102 | /* Convert a 32-bit wide string to a string. */ | ||
| 1103 | #if 0 | ||
| 1104 | # if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32STOMBS | ||
| 1105 | _GL_BEGIN_C_LINKAGE | ||
| 1106 | _GL_INLINE _GL_ARG_NONNULL ((2)) size_t | ||
| 1107 | c32stombs (char *dest, const char32_t *src, size_t len) | ||
| 1108 | { | ||
| 1109 | mbstate_t state; | ||
| 1110 | |||
| 1111 | mbszero (&state); | ||
| 1112 | return c32srtombs (dest, &src, len, &state); | ||
| 1113 | } | ||
| 1114 | _GL_END_C_LINKAGE | ||
| 1115 | # else | ||
| 1116 | _GL_FUNCDECL_SYS (c32stombs, size_t, | ||
| 1117 | (char *dest, const char32_t *src, size_t len), | ||
| 1118 | _GL_ARG_NONNULL ((2))); | ||
| 1119 | # endif | ||
| 1120 | _GL_CXXALIAS_SYS (c32stombs, size_t, | ||
| 1121 | (char *dest, const char32_t *src, size_t len)); | ||
| 1122 | _GL_CXXALIASWARN (c32stombs); | ||
| 1123 | #endif | ||
| 1124 | |||
| 1125 | |||
| 1126 | /* Number of screen columns needed for a size-bounded 32-bit wide string. */ | ||
| 1127 | #if 0 | ||
| 1128 | # if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32SWIDTH | ||
| 1129 | _GL_BEGIN_C_LINKAGE | ||
| 1130 | _GL_INLINE _GL_ARG_NONNULL ((1)) int | ||
| 1131 | c32swidth (const char32_t *s, size_t n) | ||
| 1132 | { | ||
| 1133 | return | ||
| 1134 | # if 0 && defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 1135 | GNULIB_NAMESPACE:: | ||
| 1136 | # endif | ||
| 1137 | wcswidth ((const wchar_t *) s, n); | ||
| 1138 | } | ||
| 1139 | _GL_END_C_LINKAGE | ||
| 1140 | # else | ||
| 1141 | _GL_FUNCDECL_SYS (c32swidth, int, (const char32_t *s, size_t n), | ||
| 1142 | _GL_ARG_NONNULL ((1))); | ||
| 1143 | # endif | ||
| 1144 | _GL_CXXALIAS_SYS (c32swidth, int, (const char32_t *s, size_t n)); | ||
| 1145 | _GL_CXXALIASWARN (c32swidth); | ||
| 1146 | #endif | ||
| 1147 | |||
| 1148 | |||
| 1149 | /* Converts a 32-bit wide character to unibyte character. | ||
| 1150 | Returns the single-byte representation of WC if it exists, | ||
| 1151 | or EOF otherwise. */ | ||
| 1152 | #if 0 | ||
| 1153 | # if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32TOB | ||
| 1154 | _GL_BEGIN_C_LINKAGE | ||
| 1155 | _GL_INLINE int | ||
| 1156 | c32tob (wint_t wc) | ||
| 1157 | { | ||
| 1158 | return | ||
| 1159 | # if 0 && defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 1160 | GNULIB_NAMESPACE:: | ||
| 1161 | # endif | ||
| 1162 | wctob (wc); | ||
| 1163 | } | ||
| 1164 | _GL_END_C_LINKAGE | ||
| 1165 | # else | ||
| 1166 | _GL_FUNCDECL_SYS (c32tob, int, (wint_t wc), ); | ||
| 1167 | # endif | ||
| 1168 | _GL_CXXALIAS_SYS (c32tob, int, (wint_t wc)); | ||
| 1169 | _GL_CXXALIASWARN (c32tob); | ||
| 1170 | #endif | ||
| 1171 | |||
| 1172 | |||
| 1173 | /* Converts a multibyte character to a 32-bit wide character. */ | ||
| 1174 | #if 1 | ||
| 1175 | # if 1 | ||
| 1176 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 1177 | # undef mbrtoc32 | ||
| 1178 | # define mbrtoc32 rpl_mbrtoc32 | ||
| 1179 | # endif | ||
| 1180 | _GL_FUNCDECL_RPL (mbrtoc32, size_t, | ||
| 1181 | (char32_t *pc, const char *s, size_t n, mbstate_t *ps), ); | ||
| 1182 | _GL_CXXALIAS_RPL (mbrtoc32, size_t, | ||
| 1183 | (char32_t *pc, const char *s, size_t n, mbstate_t *ps)); | ||
| 1184 | # else | ||
| 1185 | # if !1 | ||
| 1186 | _GL_FUNCDECL_SYS (mbrtoc32, size_t, | ||
| 1187 | (char32_t *pc, const char *s, size_t n, mbstate_t *ps), ); | ||
| 1188 | # endif | ||
| 1189 | _GL_CXXALIAS_SYS (mbrtoc32, size_t, | ||
| 1190 | (char32_t *pc, const char *s, size_t n, mbstate_t *ps)); | ||
| 1191 | # endif | ||
| 1192 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 | ||
| 1193 | _GL_CXXALIASWARN (mbrtoc32); | ||
| 1194 | # endif | ||
| 1195 | #elif defined GNULIB_POSIXCHECK | ||
| 1196 | # if HAVE_RAW_DECL_MBRTOC32 | ||
| 1197 | _GL_WARN_ON_USE (mbrtoc32, "mbrtoc32 is not portable - " | ||
| 1198 | "use gnulib module mbrtoc32 for portability"); | ||
| 1199 | # endif | ||
| 1200 | #endif | ||
| 1201 | |||
| 1202 | |||
| 1203 | /* Converts a multibyte character and returns the next 16-bit wide | ||
| 1204 | character. */ | ||
| 1205 | #if 0 | ||
| 1206 | # if 0 | ||
| 1207 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 1208 | # undef mbrtoc16 | ||
| 1209 | # define mbrtoc16 rpl_mbrtoc16 | ||
| 1210 | # endif | ||
| 1211 | _GL_FUNCDECL_RPL (mbrtoc16, size_t, | ||
| 1212 | (char16_t *pc, const char *s, size_t n, mbstate_t *ps), ); | ||
| 1213 | _GL_CXXALIAS_RPL (mbrtoc16, size_t, | ||
| 1214 | (char16_t *pc, const char *s, size_t n, mbstate_t *ps)); | ||
| 1215 | # else | ||
| 1216 | # if !1 | ||
| 1217 | _GL_FUNCDECL_SYS (mbrtoc16, size_t, | ||
| 1218 | (char16_t *pc, const char *s, size_t n, mbstate_t *ps), ); | ||
| 1219 | # endif | ||
| 1220 | _GL_CXXALIAS_SYS (mbrtoc16, size_t, | ||
| 1221 | (char16_t *pc, const char *s, size_t n, mbstate_t *ps)); | ||
| 1222 | # endif | ||
| 1223 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 | ||
| 1224 | _GL_CXXALIASWARN (mbrtoc16); | ||
| 1225 | # endif | ||
| 1226 | #elif defined GNULIB_POSIXCHECK | ||
| 1227 | # if HAVE_RAW_DECL_MBRTOC16 | ||
| 1228 | _GL_WARN_ON_USE (mbrtoc16, "mbrtoc16 is not portable - " | ||
| 1229 | "use gnulib module mbrtoc16 for portability"); | ||
| 1230 | # endif | ||
| 1231 | #endif | ||
| 1232 | |||
| 1233 | |||
| 1234 | /* Convert a string to a 32-bit wide string. */ | ||
| 1235 | #if 0 | ||
| 1236 | # if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSNRTOC32S | ||
| 1237 | _GL_BEGIN_C_LINKAGE | ||
| 1238 | _GL_INLINE _GL_ARG_NONNULL ((2)) size_t | ||
| 1239 | mbsnrtoc32s (char32_t *dest, const char **srcp, size_t srclen, size_t len, | ||
| 1240 | mbstate_t *ps) | ||
| 1241 | { | ||
| 1242 | return | ||
| 1243 | # if 0 && defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 1244 | GNULIB_NAMESPACE:: | ||
| 1245 | # endif | ||
| 1246 | mbsnrtowcs ((wchar_t *) dest, srcp, srclen, len, ps); | ||
| 1247 | } | ||
| 1248 | _GL_END_C_LINKAGE | ||
| 1249 | # else | ||
| 1250 | _GL_FUNCDECL_SYS (mbsnrtoc32s, size_t, | ||
| 1251 | (char32_t *dest, const char **srcp, size_t srclen, size_t len, | ||
| 1252 | mbstate_t *ps), | ||
| 1253 | _GL_ARG_NONNULL ((2))); | ||
| 1254 | # endif | ||
| 1255 | _GL_CXXALIAS_SYS (mbsnrtoc32s, size_t, | ||
| 1256 | (char32_t *dest, const char **srcp, size_t srclen, size_t len, | ||
| 1257 | mbstate_t *ps)); | ||
| 1258 | _GL_CXXALIASWARN (mbsnrtoc32s); | ||
| 1259 | #endif | ||
| 1260 | |||
| 1261 | |||
| 1262 | /* Convert a string to a 32-bit wide string. */ | ||
| 1263 | #if 0 | ||
| 1264 | # if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSRTOC32S | ||
| 1265 | _GL_BEGIN_C_LINKAGE | ||
| 1266 | _GL_INLINE _GL_ARG_NONNULL ((2)) size_t | ||
| 1267 | mbsrtoc32s (char32_t *dest, const char **srcp, size_t len, mbstate_t *ps) | ||
| 1268 | { | ||
| 1269 | return | ||
| 1270 | # if 0 && defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 1271 | GNULIB_NAMESPACE:: | ||
| 1272 | # endif | ||
| 1273 | mbsrtowcs ((wchar_t *) dest, srcp, len, ps); | ||
| 1274 | } | ||
| 1275 | _GL_END_C_LINKAGE | ||
| 1276 | # else | ||
| 1277 | _GL_FUNCDECL_SYS (mbsrtoc32s, size_t, | ||
| 1278 | (char32_t *dest, const char **srcp, size_t len, | ||
| 1279 | mbstate_t *ps), | ||
| 1280 | _GL_ARG_NONNULL ((2))); | ||
| 1281 | # endif | ||
| 1282 | _GL_CXXALIAS_SYS (mbsrtoc32s, size_t, | ||
| 1283 | (char32_t *dest, const char **srcp, size_t len, | ||
| 1284 | mbstate_t *ps)); | ||
| 1285 | _GL_CXXALIASWARN (mbsrtoc32s); | ||
| 1286 | #endif | ||
| 1287 | |||
| 1288 | |||
| 1289 | /* Convert a string to a 32-bit wide string. */ | ||
| 1290 | #if 0 | ||
| 1291 | # if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSTOC32S | ||
| 1292 | _GL_BEGIN_C_LINKAGE | ||
| 1293 | _GL_INLINE _GL_ARG_NONNULL ((2)) size_t | ||
| 1294 | mbstoc32s (char32_t *dest, const char *src, size_t len) | ||
| 1295 | { | ||
| 1296 | mbstate_t state; | ||
| 1297 | |||
| 1298 | mbszero (&state); | ||
| 1299 | return mbsrtoc32s (dest, &src, len, &state); | ||
| 1300 | } | ||
| 1301 | _GL_END_C_LINKAGE | ||
| 1302 | # else | ||
| 1303 | _GL_FUNCDECL_SYS (mbstoc32s, size_t, | ||
| 1304 | (char32_t *dest, const char *src, size_t len), | ||
| 1305 | _GL_ARG_NONNULL ((2))); | ||
| 1306 | # endif | ||
| 1307 | _GL_CXXALIAS_SYS (mbstoc32s, size_t, | ||
| 1308 | (char32_t *dest, const char *src, size_t len)); | ||
| 1309 | _GL_CXXALIASWARN (mbstoc32s); | ||
| 1310 | #endif | ||
| 1311 | |||
| 1312 | |||
| 1313 | #if 0 || 0 | ||
| 1314 | /* A scalar type. Instances of this type, other than (c32_type_test_t) 0, | ||
| 1315 | represent a character property, sometimes also viewed as a "character class". | ||
| 1316 | It can be applied to 32-bit wide characters. It is the counterpart of | ||
| 1317 | type 'wctype_t' for wide characters. | ||
| 1318 | To test whether a given character has a certain property, use the function | ||
| 1319 | 'c32_apply_type_test'. */ | ||
| 1320 | # if _GL_WCHAR_T_IS_UCS4 | ||
| 1321 | typedef wctype_t c32_type_test_t; | ||
| 1322 | # else | ||
| 1323 | typedef /*bool*/int (*c32_type_test_t) (wint_t wc); | ||
| 1324 | # endif | ||
| 1325 | #endif | ||
| 1326 | |||
| 1327 | /* Return a character property with the given name, or (c32_type_test_t) 0 | ||
| 1328 | if the designated property does not exist. | ||
| 1329 | This function is the counterpart of function 'wctype' for wide characters. | ||
| 1330 | */ | ||
| 1331 | #if 0 | ||
| 1332 | # if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_TYPE_TEST | ||
| 1333 | _GL_BEGIN_C_LINKAGE | ||
| 1334 | _GL_INLINE _GL_ARG_NONNULL ((1)) c32_type_test_t | ||
| 1335 | c32_get_type_test (const char *name) | ||
| 1336 | { | ||
| 1337 | return | ||
| 1338 | # if 1 && defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 1339 | GNULIB_NAMESPACE:: | ||
| 1340 | # endif | ||
| 1341 | wctype (name); | ||
| 1342 | } | ||
| 1343 | _GL_END_C_LINKAGE | ||
| 1344 | # else | ||
| 1345 | _GL_FUNCDECL_SYS (c32_get_type_test, c32_type_test_t, (const char *name), | ||
| 1346 | _GL_ARG_NONNULL ((1))); | ||
| 1347 | # endif | ||
| 1348 | _GL_CXXALIAS_SYS (c32_get_type_test, c32_type_test_t, (const char *name)); | ||
| 1349 | _GL_CXXALIASWARN (c32_get_type_test); | ||
| 1350 | #endif | ||
| 1351 | |||
| 1352 | /* Test whether a given 32-bit wide character has the specified character | ||
| 1353 | property. | ||
| 1354 | Return non-zero if true, zero if false or if the argument is WEOF. | ||
| 1355 | This function is the counterpart of function 'iswctype' for wide characters. | ||
| 1356 | */ | ||
| 1357 | #if 0 | ||
| 1358 | # if _GL_WCHAR_T_IS_UCS4 | ||
| 1359 | # if !defined IN_C32_APPLY_TYPE_TEST | ||
| 1360 | _GL_BEGIN_C_LINKAGE | ||
| 1361 | _GL_INLINE int | ||
| 1362 | c32_apply_type_test (wint_t wc, c32_type_test_t property) | ||
| 1363 | { | ||
| 1364 | return | ||
| 1365 | # if 1 && defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 1366 | GNULIB_NAMESPACE:: | ||
| 1367 | # endif | ||
| 1368 | iswctype (wc, property); | ||
| 1369 | } | ||
| 1370 | _GL_END_C_LINKAGE | ||
| 1371 | # else | ||
| 1372 | _GL_FUNCDECL_SYS (c32_apply_type_test, int, | ||
| 1373 | (wint_t wc, c32_type_test_t property), ); | ||
| 1374 | # endif | ||
| 1375 | # else | ||
| 1376 | _GL_FUNCDECL_SYS (c32_apply_type_test, int, | ||
| 1377 | (wint_t wc, c32_type_test_t property), | ||
| 1378 | _GL_ARG_NONNULL ((2))); | ||
| 1379 | # endif | ||
| 1380 | _GL_CXXALIAS_SYS (c32_apply_type_test, int, | ||
| 1381 | (wint_t wc, c32_type_test_t property)); | ||
| 1382 | _GL_CXXALIASWARN (c32_apply_type_test); | ||
| 1383 | #endif | ||
| 1384 | |||
| 1385 | |||
| 1386 | #if 0 || 0 | ||
| 1387 | /* A scalar type. Instances of this type, other than (c32_mapping_t) 0, | ||
| 1388 | represent a character mapping. It can be applied to 32-bit wide characters. | ||
| 1389 | It is the counterpart of type 'wctrans_t' for wide characters. | ||
| 1390 | To apply a certain mapping to a given character, use the function | ||
| 1391 | 'c32_apply_mapping'. */ | ||
| 1392 | # if _GL_WCHAR_T_IS_UCS4 | ||
| 1393 | typedef wctrans_t c32_mapping_t; | ||
| 1394 | # else | ||
| 1395 | typedef wint_t (*c32_mapping_t) (wint_t wc); | ||
| 1396 | # endif | ||
| 1397 | #endif | ||
| 1398 | |||
| 1399 | /* Return a character mapping with the given name, or (c32_mapping_t) 0 | ||
| 1400 | if the designated mapping does not exist. | ||
| 1401 | This function is the counterpart of function 'wctrans' for wide characters. | ||
| 1402 | */ | ||
| 1403 | #if 0 | ||
| 1404 | # if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_MAPPING | ||
| 1405 | _GL_BEGIN_C_LINKAGE | ||
| 1406 | _GL_INLINE _GL_ARG_NONNULL ((1)) c32_mapping_t | ||
| 1407 | c32_get_mapping (const char *name) | ||
| 1408 | { | ||
| 1409 | return | ||
| 1410 | # if 0 && defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 1411 | GNULIB_NAMESPACE:: | ||
| 1412 | # endif | ||
| 1413 | wctrans (name); | ||
| 1414 | } | ||
| 1415 | _GL_END_C_LINKAGE | ||
| 1416 | # else | ||
| 1417 | _GL_FUNCDECL_SYS (c32_get_mapping, c32_mapping_t, (const char *name), | ||
| 1418 | _GL_ARG_NONNULL ((1))); | ||
| 1419 | # endif | ||
| 1420 | _GL_CXXALIAS_SYS (c32_get_mapping, c32_mapping_t, (const char *name)); | ||
| 1421 | _GL_CXXALIASWARN (c32_get_mapping); | ||
| 1422 | #endif | ||
| 1423 | |||
| 1424 | /* Apply the specified character mapping to a given 32-bit wide character. | ||
| 1425 | Return the result of this mapping. Return the WC argument unchanged if it is | ||
| 1426 | WEOF. | ||
| 1427 | This function is the counterpart of function 'towctrans' for wide characters. | ||
| 1428 | */ | ||
| 1429 | #if 0 | ||
| 1430 | # if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_APPLY_MAPPING | ||
| 1431 | _GL_BEGIN_C_LINKAGE | ||
| 1432 | _GL_INLINE _GL_ARG_NONNULL ((2)) wint_t | ||
| 1433 | c32_apply_mapping (wint_t wc, c32_mapping_t mapping) | ||
| 1434 | { | ||
| 1435 | return | ||
| 1436 | # if 0 && defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 1437 | GNULIB_NAMESPACE:: | ||
| 1438 | # endif | ||
| 1439 | towctrans (wc, mapping); | ||
| 1440 | } | ||
| 1441 | _GL_END_C_LINKAGE | ||
| 1442 | # else | ||
| 1443 | _GL_FUNCDECL_SYS (c32_apply_mapping, wint_t, | ||
| 1444 | (wint_t wc, c32_mapping_t mapping), | ||
| 1445 | _GL_ARG_NONNULL ((2))); | ||
| 1446 | # endif | ||
| 1447 | _GL_CXXALIAS_SYS (c32_apply_mapping, wint_t, | ||
| 1448 | (wint_t wc, c32_mapping_t mapping)); | ||
| 1449 | _GL_CXXALIASWARN (c32_apply_mapping); | ||
| 1450 | #endif | ||
| 1451 | |||
| 1452 | |||
| 1453 | _GL_INLINE_HEADER_END | ||
| 1454 | |||
| 1455 | #endif /* _GL_UCHAR_H */ | ||
| 1456 | #endif /* _GL_UCHAR_H */ | ||
