1 /** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the w64 mingw-runtime package. 4 * No warranty is given; refer to the file DISCLAIMER within this package. 5 */ 6 #ifndef _INC_CTYPE 7 #define _INC_CTYPE 8 9 #include <corecrt.h> 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 #ifndef WEOF 16 #define WEOF (wint_t)(0xFFFF) 17 #endif 18 19 #ifndef _CRT_CTYPEDATA_DEFINED 20 # define _CRT_CTYPEDATA_DEFINED 21 # ifndef _CTYPE_DISABLE_MACROS 22 # ifndef __PCTYPE_FUNC 23 # ifdef _DLL 24 # define __PCTYPE_FUNC __pctype_func() 25 # else 26 # define __PCTYPE_FUNC _pctype 27 # endif 28 # endif /* !__PCTYPE_FUNC */ 29 _CRTIMP const unsigned short * __cdecl __pctype_func(void); 30 # ifndef _M_CEE_PURE 31 _CRTDATA(extern const unsigned short *_pctype); 32 # else 33 # define _pctype (__pctype_func()) 34 # endif /* !_M_CEE_PURE */ 35 # endif /* !_CTYPE_DISABLE_MACROS */ 36 #endif /* !_CRT_CTYPEDATA_DEFINED */ 37 38 #ifndef _CRT_WCTYPEDATA_DEFINED 39 #define _CRT_WCTYPEDATA_DEFINED 40 # ifndef _CTYPE_DISABLE_MACROS 41 _CRTDATA(extern const unsigned short _wctype[]); 42 _CRTIMP const wctype_t * __cdecl __pwctype_func(void); 43 # ifndef _M_CEE_PURE 44 _CRTDATA(extern const wctype_t *_pwctype); 45 # else 46 # define _pwctype (__pwctype_func()) 47 # endif /* !_M_CEE_PURE */ 48 # endif /* !_CTYPE_DISABLE_MACROS */ 49 #endif /* !_CRT_WCTYPEDATA_DEFINED */ 50 51 /* CRT stuff */ 52 #if 1 53 extern const unsigned char __newclmap[]; 54 extern const unsigned char __newcumap[]; 55 extern pthreadlocinfo __ptlocinfo; 56 extern pthreadmbcinfo __ptmbcinfo; 57 extern int __globallocalestatus; 58 extern int __locale_changed; 59 extern struct threadlocaleinfostruct __initiallocinfo; 60 extern _locale_tstruct __initiallocalestructinfo; 61 pthreadlocinfo __cdecl __updatetlocinfo(void); 62 pthreadmbcinfo __cdecl __updatetmbcinfo(void); 63 #endif 64 65 #define _UPPER 0x1 66 #define _LOWER 0x2 67 #define _DIGIT 0x4 68 #define _SPACE 0x8 69 70 #define _PUNCT 0x10 71 #define _CONTROL 0x20 72 #define _BLANK 0x40 73 #define _HEX 0x80 74 75 #define _LEADBYTE 0x8000 76 #define _ALPHA (0x0100|_UPPER|_LOWER) 77 78 #ifndef _CTYPE_DEFINED 79 #define _CTYPE_DEFINED 80 81 _Check_return_ 82 _CRTIMP 83 int 84 __cdecl 85 _isctype( 86 _In_ int _C, 87 _In_ int _Type); 88 89 _Check_return_ 90 _CRTIMP 91 int 92 __cdecl 93 _isctype_l( 94 _In_ int _C, 95 _In_ int _Type, 96 _In_opt_ _locale_t _Locale); 97 98 _Check_return_ 99 _CRTIMP 100 int 101 __cdecl 102 isalpha( 103 _In_ int _C); 104 105 _Check_return_ 106 _CRTIMP 107 int 108 __cdecl 109 _isalpha_l( 110 _In_ int _C, 111 _In_opt_ _locale_t _Locale); 112 113 _Check_return_ 114 _CRTIMP 115 int 116 __cdecl 117 isupper( 118 _In_ int _C); 119 120 _Check_return_ 121 _CRTIMP 122 int 123 __cdecl 124 _isupper_l( 125 _In_ int _C, 126 _In_opt_ _locale_t _Locale); 127 128 _Check_return_ 129 _CRTIMP 130 int 131 __cdecl 132 islower( 133 _In_ int _C); 134 135 _Check_return_ 136 _CRTIMP 137 int 138 __cdecl 139 _islower_l( 140 _In_ int _C, 141 _In_opt_ _locale_t _Locale); 142 143 _Check_return_ 144 _CRTIMP 145 int 146 __cdecl 147 isdigit( 148 _In_ int _C); 149 150 _Check_return_ 151 _CRTIMP 152 int 153 __cdecl 154 _isdigit_l( 155 _In_ int _C, 156 _In_opt_ _locale_t _Locale); 157 158 _Check_return_ 159 _CRTIMP 160 int 161 __cdecl 162 isxdigit( 163 _In_ int _C); 164 165 _Check_return_ 166 _CRTIMP 167 int 168 __cdecl 169 _isxdigit_l( 170 _In_ int _C, 171 _In_opt_ _locale_t _Locale); 172 173 _Check_return_ 174 _CRTIMP 175 int 176 __cdecl 177 isspace( 178 _In_ int _C); 179 180 _Check_return_ 181 _CRTIMP 182 int 183 __cdecl 184 _isspace_l( 185 _In_ int _C, 186 _In_opt_ _locale_t _Locale); 187 188 _Check_return_ 189 _CRTIMP 190 int 191 __cdecl 192 ispunct( 193 _In_ int _C); 194 195 _Check_return_ 196 _CRTIMP 197 int 198 __cdecl 199 _ispunct_l( 200 _In_ int _C, 201 _In_opt_ _locale_t _Locale); 202 203 _Check_return_ 204 _CRTIMP 205 int 206 __cdecl 207 isalnum( 208 _In_ int _C); 209 210 _Check_return_ 211 _CRTIMP 212 int 213 __cdecl 214 _isalnum_l( 215 _In_ int _C, 216 _In_opt_ _locale_t _Locale); 217 218 _Check_return_ 219 _CRTIMP 220 int 221 __cdecl 222 isprint( 223 _In_ int _C); 224 225 _Check_return_ 226 _CRTIMP 227 int 228 __cdecl 229 _isprint_l( 230 _In_ int _C, 231 _In_opt_ _locale_t _Locale); 232 233 _Check_return_ 234 _CRTIMP 235 int 236 __cdecl 237 isgraph( 238 _In_ int _C); 239 240 _Check_return_ 241 _CRTIMP 242 int 243 __cdecl 244 _isgraph_l( 245 _In_ int _C, 246 _In_opt_ _locale_t _Locale); 247 248 _Check_return_ 249 _CRTIMP 250 int 251 __cdecl 252 iscntrl( 253 _In_ int _C); 254 255 _Check_return_ 256 _CRTIMP 257 int 258 __cdecl 259 _iscntrl_l( 260 _In_ int _C, 261 _In_opt_ _locale_t _Locale); 262 263 _Check_return_ 264 _CRTIMP 265 int 266 __cdecl 267 toupper( 268 _In_ int _C); 269 270 _Check_return_ 271 _CRTIMP 272 int 273 __cdecl 274 tolower( 275 _In_ int _C); 276 277 _Check_return_ 278 _CRTIMP 279 int 280 __cdecl 281 _tolower( 282 _In_ int _C); 283 284 _Check_return_ 285 _CRTIMP 286 int 287 __cdecl 288 _tolower_l( 289 _In_ int _C, 290 _In_opt_ _locale_t _Locale); 291 292 _Check_return_ 293 _CRTIMP 294 int 295 __cdecl 296 _toupper( 297 _In_ int _C); 298 299 _Check_return_ 300 _CRTIMP 301 int 302 __cdecl 303 _toupper_l( 304 _In_ int _C, 305 _In_opt_ _locale_t _Locale); 306 307 _Check_return_ 308 _CRTIMP 309 int 310 __cdecl 311 __isascii( 312 _In_ int _C); 313 314 _Check_return_ 315 _CRTIMP 316 int 317 __cdecl 318 __toascii( 319 _In_ int _C); 320 321 _Check_return_ 322 _CRTIMP 323 int 324 __cdecl 325 __iscsymf( 326 _In_ int _C); 327 328 _Check_return_ 329 _CRTIMP 330 int 331 __cdecl 332 __iscsym( 333 _In_ int _C); 334 335 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) 336 int __cdecl isblank(int _C); 337 #endif 338 339 #endif /* !_CTYPE_DEFINED */ 340 341 #ifndef _WCTYPE_DEFINED 342 #define _WCTYPE_DEFINED 343 344 _Check_return_ 345 _CRTIMP 346 int 347 __cdecl 348 iswalpha( 349 _In_ wint_t _C); 350 351 _Check_return_ 352 _CRTIMP 353 int 354 __cdecl 355 _iswalpha_l( 356 _In_ wint_t _C, 357 _In_opt_ _locale_t _Locale); 358 359 _Check_return_ 360 _CRTIMP 361 int 362 __cdecl 363 iswupper( 364 _In_ wint_t _C); 365 366 _Check_return_ 367 _CRTIMP 368 int 369 __cdecl 370 _iswupper_l( 371 _In_ wint_t _C, 372 _In_opt_ _locale_t _Locale); 373 374 _Check_return_ 375 _CRTIMP 376 int 377 __cdecl 378 iswlower( 379 _In_ wint_t _C); 380 381 _Check_return_ 382 _CRTIMP 383 int 384 __cdecl 385 _iswlower_l( 386 _In_ wint_t _C, 387 _In_opt_ _locale_t _Locale); 388 389 _Check_return_ 390 _CRTIMP 391 int 392 __cdecl 393 iswdigit( 394 _In_ wint_t _C); 395 396 _Check_return_ 397 _CRTIMP 398 int 399 __cdecl 400 _iswdigit_l( 401 _In_ wint_t _C, 402 _In_opt_ _locale_t _Locale); 403 404 _Check_return_ 405 _CRTIMP 406 int 407 __cdecl 408 iswxdigit( 409 _In_ wint_t _C); 410 411 _Check_return_ 412 _CRTIMP 413 int 414 __cdecl 415 _iswxdigit_l( 416 _In_ wint_t _C, 417 _In_opt_ _locale_t _Locale); 418 419 _Check_return_ 420 _CRTIMP 421 int 422 __cdecl 423 iswspace( 424 _In_ wint_t _C); 425 426 _Check_return_ 427 _CRTIMP 428 int 429 __cdecl 430 _iswspace_l( 431 _In_ wint_t _C, 432 _In_opt_ _locale_t _Locale); 433 434 _Check_return_ 435 _CRTIMP 436 int 437 __cdecl 438 iswpunct( 439 _In_ wint_t _C); 440 441 _Check_return_ 442 _CRTIMP 443 int 444 __cdecl 445 _iswpunct_l( 446 _In_ wint_t _C, 447 _In_opt_ _locale_t _Locale); 448 449 _Check_return_ 450 _CRTIMP 451 int 452 __cdecl 453 iswalnum( 454 _In_ wint_t _C); 455 456 _Check_return_ 457 _CRTIMP 458 int 459 __cdecl 460 _iswalnum_l( 461 _In_ wint_t _C, 462 _In_opt_ _locale_t _Locale); 463 464 _Check_return_ 465 _CRTIMP 466 int 467 __cdecl 468 iswprint( 469 _In_ wint_t _C); 470 471 _Check_return_ 472 _CRTIMP 473 int 474 __cdecl 475 _iswprint_l( 476 _In_ wint_t _C, 477 _In_opt_ _locale_t _Locale); 478 479 _Check_return_ 480 _CRTIMP 481 int 482 __cdecl 483 iswgraph( 484 _In_ wint_t _C); 485 486 _Check_return_ 487 _CRTIMP 488 int 489 __cdecl 490 _iswgraph_l( 491 _In_ wint_t _C, 492 _In_opt_ _locale_t _Locale); 493 494 _Check_return_ 495 _CRTIMP 496 int 497 __cdecl 498 iswcntrl( 499 _In_ wint_t _C); 500 501 _Check_return_ 502 _CRTIMP 503 int 504 __cdecl 505 _iswcntrl_l( 506 _In_ wint_t _C, 507 _In_opt_ _locale_t _Locale); 508 509 _Check_return_ 510 _CRTIMP 511 int 512 __cdecl 513 iswascii( 514 _In_ wint_t _C); 515 516 _Check_return_ 517 _CRTIMP 518 int 519 __cdecl 520 isleadbyte( 521 _In_ int _C); 522 523 _Check_return_ 524 _CRTIMP 525 int 526 __cdecl 527 _isleadbyte_l( 528 _In_ int _C, 529 _In_opt_ _locale_t _Locale); 530 531 _Check_return_ 532 _CRTIMP 533 wint_t 534 __cdecl 535 towupper( 536 _In_ wint_t _C); 537 538 _Check_return_ 539 _CRTIMP 540 wint_t 541 __cdecl 542 _towupper_l( 543 _In_ wint_t _C, 544 _In_opt_ _locale_t _Locale); 545 546 _Check_return_ 547 _CRTIMP 548 wint_t 549 __cdecl 550 towlower( 551 _In_ wint_t _C); 552 553 _Check_return_ 554 _CRTIMP 555 wint_t 556 __cdecl 557 _towlower_l( 558 _In_ wint_t _C, 559 _In_opt_ _locale_t _Locale); 560 561 _Check_return_ 562 _CRTIMP 563 int 564 __cdecl 565 iswctype( 566 _In_ wint_t _C, 567 _In_ wctype_t _Type); 568 569 _Check_return_ 570 _CRTIMP 571 int 572 __cdecl 573 _iswctype_l( 574 _In_ wint_t _C, 575 _In_ wctype_t _Type, 576 _In_opt_ _locale_t _Locale); 577 578 _Check_return_ 579 _CRTIMP 580 int 581 __cdecl 582 __iswcsymf( 583 _In_ wint_t _C); 584 585 _Check_return_ 586 _CRTIMP 587 int 588 __cdecl 589 _iswcsymf_l( 590 _In_ wint_t _C, 591 _In_opt_ _locale_t _Locale); 592 593 _Check_return_ 594 _CRTIMP 595 int 596 __cdecl 597 __iswcsym( 598 _In_ wint_t _C); 599 600 _Check_return_ 601 _CRTIMP 602 int 603 __cdecl 604 _iswcsym_l( 605 _In_ wint_t _C, 606 _In_opt_ _locale_t _Locale); 607 608 _CRTIMP 609 int 610 __cdecl 611 is_wctype( 612 _In_ wint_t _C, 613 _In_ wctype_t _Type); 614 615 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) 616 int __cdecl iswblank(wint_t _C); 617 #endif 618 619 #endif /* _WCTYPE_DEFINED */ 620 621 #ifndef _CTYPE_DISABLE_MACROS 622 623 #ifndef MB_CUR_MAX 624 #define MB_CUR_MAX ___mb_cur_max_func() 625 #ifndef __mb_cur_max 626 #ifdef _MSVCRT_ 627 extern int __mb_cur_max; 628 #else 629 #define __mb_cur_max (*_imp____mb_cur_max) 630 extern int *_imp____mb_cur_max; 631 #endif 632 #endif 633 #ifdef _MSVCRT_ 634 #define ___mb_cur_max_func() (__mb_cur_max) 635 #else 636 #define ___mb_cur_max_func() (*_imp____mb_cur_max) 637 #endif 638 #endif 639 640 #define __chvalidchk(a,b) (__PCTYPE_FUNC[(a)] & (b)) 641 #define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->pctype[_Char] & (_Flag)) 642 #define _ischartype_l(_Char,_Flag,_Locale) (((_Locale)!=NULL && (((_locale_t)(_Locale))->locinfo->mb_cur_max) > 1) ? _isctype_l(_Char,(_Flag),_Locale) : _chvalidchk_l(_Char,_Flag,_Locale)) 643 #define _isalpha_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA,_Locale) 644 #define _isupper_l(_Char,_Locale) _ischartype_l(_Char,_UPPER,_Locale) 645 #define _islower_l(_Char,_Locale) _ischartype_l(_Char,_LOWER,_Locale) 646 #define _isdigit_l(_Char,_Locale) _ischartype_l(_Char,_DIGIT,_Locale) 647 #define _isxdigit_l(_Char,_Locale) _ischartype_l(_Char,_HEX,_Locale) 648 #define _isspace_l(_Char,_Locale) _ischartype_l(_Char,_SPACE,_Locale) 649 #define _ispunct_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT,_Locale) 650 #define _isalnum_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA|_DIGIT,_Locale) 651 #define _isprint_l(_Char,_Locale) _ischartype_l(_Char,_BLANK|_PUNCT|_ALPHA|_DIGIT,_Locale) 652 #define _isgraph_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT|_ALPHA|_DIGIT,_Locale) 653 #define _iscntrl_l(_Char,_Locale) _ischartype_l(_Char,_CONTROL,_Locale) 654 #define _tolower(_Char) ((_Char)-'A'+'a') 655 #define _toupper(_Char) ((_Char)-'a'+'A') 656 #define __isascii(_Char) ((unsigned)(_Char) < 0x80) 657 #define __toascii(_Char) ((_Char) & 0x7f) 658 659 #ifndef _WCTYPE_INLINE_DEFINED 660 #define _WCTYPE_INLINE_DEFINED 661 662 #undef _CRT_WCTYPE_NOINLINE 663 #ifndef __cplusplus 664 #define iswalpha(_c) (iswctype(_c,_ALPHA)) 665 #define iswupper(_c) (iswctype(_c,_UPPER)) 666 #define iswlower(_c) (iswctype(_c,_LOWER)) 667 #define iswdigit(_c) (iswctype(_c,_DIGIT)) 668 #define iswxdigit(_c) (iswctype(_c,_HEX)) 669 #define iswspace(_c) (iswctype(_c,_SPACE)) 670 #define iswpunct(_c) (iswctype(_c,_PUNCT)) 671 #define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) 672 #define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) 673 #define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) 674 #define iswcntrl(_c) (iswctype(_c,_CONTROL)) 675 #define iswascii(_c) ((unsigned)(_c) < 0x80) 676 #define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) 677 #define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) 678 #define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p)) 679 #define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p)) 680 #define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p)) 681 #define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p)) 682 #define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p)) 683 #define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p)) 684 #define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) 685 #define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) 686 #define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) 687 #endif 688 #endif 689 690 #define __iscsymf(_c) (isalpha(_c) || ((_c)=='_')) 691 #define __iscsym(_c) (isalnum(_c) || ((_c)=='_')) 692 #define __iswcsymf(_c) (iswalpha(_c) || ((_c)=='_')) 693 #define __iswcsym(_c) (iswalnum(_c) || ((_c)=='_')) 694 #define _iscsymf_l(_c,_p) (_isalpha_l(_c,_p) || ((_c)=='_')) 695 #define _iscsym_l(_c,_p) (_isalnum_l(_c,_p) || ((_c)=='_')) 696 #define _iswcsymf_l(_c,_p) (_iswalpha_l(_c,_p) || ((_c)=='_')) 697 #define _iswcsym_l(_c,_p) (_iswalnum_l(_c,_p) || ((_c)=='_')) 698 #endif 699 700 #ifndef NO_OLDNAMES 701 702 #ifndef _CTYPE_DEFINED 703 704 _Check_return_ 705 _CRTIMP 706 _CRT_NONSTDC_DEPRECATE(__isascii) 707 _CRTIMP 708 int 709 __cdecl 710 isascii( 711 _In_ int _C); 712 713 _Check_return_ 714 _CRTIMP 715 _CRT_NONSTDC_DEPRECATE(__toascii) 716 _CRTIMP 717 int 718 __cdecl 719 toascii( 720 _In_ int _C); 721 722 _Check_return_ 723 _CRTIMP 724 _CRT_NONSTDC_DEPRECATE(__iscsymf) 725 _CRTIMP 726 int 727 __cdecl 728 iscsymf( 729 _In_ int _C); 730 731 _Check_return_ 732 _CRTIMP 733 _CRT_NONSTDC_DEPRECATE(__iscsym) 734 _CRTIMP 735 int 736 __cdecl 737 iscsym( 738 _In_ int _C); 739 740 #else /* _CTYPE_DEFINED */ 741 742 #define isascii __isascii 743 #define toascii __toascii 744 #define iscsymf __iscsymf 745 #define iscsym __iscsym 746 747 #endif /* _CTYPE_DEFINED */ 748 749 #endif /* NO_OLDNAMES */ 750 751 #ifdef __cplusplus 752 } 753 #endif 754 755 #endif /* !_INC_CTYPE */ 756