April 2024 | ||||||
Mo | Tu | We | Th | Fr | Sa | Su |
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 |
001: /* Copyright (C) 1996-2002,2005,2007-2009,2010 Free Software Foundation, Inc. 002: This file is part of the GNU C Library. 003: 004: The GNU C Library is free software; you can redistribute it and/or 005: modify it under the terms of the GNU Lesser General Public 006: License as published by the Free Software Foundation; either 007: version 2.1 of the License, or (at your option) any later version. 008: 009: The GNU C Library is distributed in the hope that it will be useful, 010: but WITHOUT ANY WARRANTY; without even the implied warranty of 011: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012: Lesser General Public License for more details. 013: 014: You should have received a copy of the GNU Lesser General Public 015: License along with the GNU C Library; if not, write to the Free 016: Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 017: 02111-1307 USA. */ 018: 019: /* 020: * ISO C99 Standard: 7.25 021: * Wide character classification and mapping utilities <wctype.h> 022: */ 023: 024: #ifndef _WCTYPE_H 025: 026: #include <features.h> 027: #include <bits/types.h> 028: 029: #ifndef __need_iswxxx 030: # define _WCTYPE_H 1 031: 032: /* Get wint_t from <wchar.h>. */ 033: # define __need_wint_t 034: # include <wchar.h> 035: 036: /* Constant expression of type `wint_t' whose value does not correspond 037: to any member of the extended character set. */ 038: # ifndef WEOF 039: # define WEOF (0xffffffffu) 040: # endif 041: #endif 042: #undef __need_iswxxx 043: 044: 045: /* The following part is also used in the <wcsmbs.h> header when compiled 046: in the Unix98 compatibility mode. */ 047: #ifndef __iswxxx_defined 048: # define __iswxxx_defined 1 049: 050: __BEGIN_NAMESPACE_C99 051: /* Scalar type that can hold values which represent locale-specific 052: character classifications. */ 053: typedef unsigned long int wctype_t; 054: __END_NAMESPACE_C99 055: 056: # ifndef _ISwbit 057: /* The characteristics are stored always in network byte order (big 058: endian). We define the bit value interpretations here dependent on the 059: machine's byte order. */ 060: 061: # include <endian.h> 062: # if __BYTE_ORDER == __BIG_ENDIAN 063: # define _ISwbit(bit) (1 << (bit)) 064: # else /* __BYTE_ORDER == __LITTLE_ENDIAN */ 065: # define _ISwbit(bit) \ 066: ((bit) < 8 ? (int) ((1UL << (bit)) << 24) \ 067: : ((bit) < 16 ? (int) ((1UL << (bit)) << 8) \ 068: : ((bit) < 24 ? (int) ((1UL << (bit)) >> 8) \ 069: : (int) ((1UL << (bit)) >> 24)))) 070: # endif 071: 072: enum 073: { 074: __ISwupper = 0, /* UPPERCASE. */ 075: __ISwlower = 1, /* lowercase. */ 076: __ISwalpha = 2, /* Alphabetic. */ 077: __ISwdigit = 3, /* Numeric. */ 078: __ISwxdigit = 4, /* Hexadecimal numeric. */ 079: __ISwspace = 5, /* Whitespace. */ 080: __ISwprint = 6, /* Printing. */ 081: __ISwgraph = 7, /* Graphical. */ 082: __ISwblank = 8, /* Blank (usually SPC and TAB). */ 083: __ISwcntrl = 9, /* Control character. */ 084: __ISwpunct = 10, /* Punctuation. */ 085: __ISwalnum = 11, /* Alphanumeric. */ 086: 087: _ISwupper = _ISwbit (__ISwupper), /* UPPERCASE. */ 088: _ISwlower = _ISwbit (__ISwlower), /* lowercase. */ 089: _ISwalpha = _ISwbit (__ISwalpha), /* Alphabetic. */ 090: _ISwdigit = _ISwbit (__ISwdigit), /* Numeric. */ 091: _ISwxdigit = _ISwbit (__ISwxdigit), /* Hexadecimal numeric. */ 092: _ISwspace = _ISwbit (__ISwspace), /* Whitespace. */ 093: _ISwprint = _ISwbit (__ISwprint), /* Printing. */ 094: _ISwgraph = _ISwbit (__ISwgraph), /* Graphical. */ 095: _ISwblank = _ISwbit (__ISwblank), /* Blank (usually SPC and TAB). */ 096: _ISwcntrl = _ISwbit (__ISwcntrl), /* Control character. */ 097: _ISwpunct = _ISwbit (__ISwpunct), /* Punctuation. */ 098: _ISwalnum = _ISwbit (__ISwalnum) /* Alphanumeric. */ 099: }; 100: # endif /* Not _ISwbit */ 101: 102: 103: __BEGIN_DECLS 104: 105: __BEGIN_NAMESPACE_C99 106: /* 107: * Wide-character classification functions: 7.15.2.1. 108: */ 109: 110: /* Test for any wide character for which `iswalpha' or `iswdigit' is 111: true. */ 112: extern int iswalnum (wint_t __wc) __THROW; 113: 114: /* Test for any wide character for which `iswupper' or 'iswlower' is 115: true, or any wide character that is one of a locale-specific set of 116: wide-characters for which none of `iswcntrl', `iswdigit', 117: `iswpunct', or `iswspace' is true. */ 118: extern int iswalpha (wint_t __wc) __THROW; 119: 120: /* Test for any control wide character. */ 121: extern int iswcntrl (wint_t __wc) __THROW; 122: 123: /* Test for any wide character that corresponds to a decimal-digit 124: character. */ 125: extern int iswdigit (wint_t __wc) __THROW; 126: 127: /* Test for any wide character for which `iswprint' is true and 128: `iswspace' is false. */ 129: extern int iswgraph (wint_t __wc) __THROW; 130: 131: /* Test for any wide character that corresponds to a lowercase letter 132: or is one of a locale-specific set of wide characters for which 133: none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ 134: extern int iswlower (wint_t __wc) __THROW; 135: 136: /* Test for any printing wide character. */ 137: extern int iswprint (wint_t __wc) __THROW; 138: 139: /* Test for any printing wide character that is one of a 140: locale-specific et of wide characters for which neither `iswspace' 141: nor `iswalnum' is true. */ 142: extern int iswpunct (wint_t __wc) __THROW; 143: 144: /* Test for any wide character that corresponds to a locale-specific 145: set of wide characters for which none of `iswalnum', `iswgraph', or 146: `iswpunct' is true. */ 147: extern int iswspace (wint_t __wc) __THROW; 148: 149: /* Test for any wide character that corresponds to an uppercase letter 150: or is one of a locale-specific set of wide character for which none 151: of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ 152: extern int iswupper (wint_t __wc) __THROW; 153: 154: /* Test for any wide character that corresponds to a hexadecimal-digit 155: character equivalent to that performed be the functions described 156: in the previous subclause. */ 157: extern int iswxdigit (wint_t __wc) __THROW; 158: 159: /* Test for any wide character that corresponds to a standard blank 160: wide character or a locale-specific set of wide characters for 161: which `iswalnum' is false. */ 162: # ifdef __USE_ISOC99 163: extern int iswblank (wint_t __wc) __THROW; 164: # endif 165: 166: /* 167: * Extensible wide-character classification functions: 7.15.2.2. 168: */ 169: 170: /* Construct value that describes a class of wide characters identified 171: by the string argument PROPERTY. */ 172: extern wctype_t wctype (__const char *__property) __THROW; 173: 174: /* Determine whether the wide-character WC has the property described by 175: DESC. */ 176: extern int iswctype (wint_t __wc, wctype_t __desc) __THROW; 177: __END_NAMESPACE_C99 178: 179: 180: /* 181: * Wide-character case-mapping functions: 7.15.3.1. 182: */ 183: 184: __BEGIN_NAMESPACE_C99 185: /* Scalar type that can hold values which represent locale-specific 186: character mappings. */ 187: typedef __const __int32_t *wctrans_t; 188: __END_NAMESPACE_C99 189: #ifdef __USE_GNU 190: __USING_NAMESPACE_C99(wctrans_t) 191: #endif 192: 193: __BEGIN_NAMESPACE_C99 194: /* Converts an uppercase letter to the corresponding lowercase letter. */ 195: extern wint_t towlower (wint_t __wc) __THROW; 196: 197: /* Converts an lowercase letter to the corresponding uppercase letter. */ 198: extern wint_t towupper (wint_t __wc) __THROW; 199: __END_NAMESPACE_C99 200: 201: __END_DECLS 202: 203: #endif /* need iswxxx. */ 204: 205: 206: /* The remaining definitions and declarations must not appear in the 207: <wchar.h> header. */ 208: #ifdef _WCTYPE_H 209: 210: /* 211: * Extensible wide-character mapping functions: 7.15.3.2. 212: */ 213: 214: __BEGIN_DECLS 215: 216: __BEGIN_NAMESPACE_C99 217: /* Construct value that describes a mapping between wide characters 218: identified by the string argument PROPERTY. */ 219: extern wctrans_t wctrans (__const char *__property) __THROW; 220: 221: /* Map the wide character WC using the mapping described by DESC. */ 222: extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW; 223: __END_NAMESPACE_C99 224: 225: # ifdef __USE_XOPEN2K8 226: /* Declare the interface to extended locale model. */ 227: # include <xlocale.h> 228: 229: /* Test for any wide character for which `iswalpha' or `iswdigit' is 230: true. */ 231: extern int iswalnum_l (wint_t __wc, __locale_t __locale) __THROW; 232: 233: /* Test for any wide character for which `iswupper' or 'iswlower' is 234: true, or any wide character that is one of a locale-specific set of 235: wide-characters for which none of `iswcntrl', `iswdigit', 236: `iswpunct', or `iswspace' is true. */ 237: extern int iswalpha_l (wint_t __wc, __locale_t __locale) __THROW; 238: 239: /* Test for any control wide character. */ 240: extern int iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW; 241: 242: /* Test for any wide character that corresponds to a decimal-digit 243: character. */ 244: extern int iswdigit_l (wint_t __wc, __locale_t __locale) __THROW; 245: 246: /* Test for any wide character for which `iswprint' is true and 247: `iswspace' is false. */ 248: extern int iswgraph_l (wint_t __wc, __locale_t __locale) __THROW; 249: 250: /* Test for any wide character that corresponds to a lowercase letter 251: or is one of a locale-specific set of wide characters for which 252: none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ 253: extern int iswlower_l (wint_t __wc, __locale_t __locale) __THROW; 254: 255: /* Test for any printing wide character. */ 256: extern int iswprint_l (wint_t __wc, __locale_t __locale) __THROW; 257: 258: /* Test for any printing wide character that is one of a 259: locale-specific et of wide characters for which neither `iswspace' 260: nor `iswalnum' is true. */ 261: extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW; 262: 263: /* Test for any wide character that corresponds to a locale-specific 264: set of wide characters for which none of `iswalnum', `iswgraph', or 265: `iswpunct' is true. */ 266: extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW; 267: 268: /* Test for any wide character that corresponds to an uppercase letter 269: or is one of a locale-specific set of wide character for which none 270: of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ 271: extern int iswupper_l (wint_t __wc, __locale_t __locale) __THROW; 272: 273: /* Test for any wide character that corresponds to a hexadecimal-digit 274: character equivalent to that performed be the functions described 275: in the previous subclause. */ 276: extern int iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW; 277: 278: /* Test for any wide character that corresponds to a standard blank 279: wide character or a locale-specific set of wide characters for 280: which `iswalnum' is false. */ 281: extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW; 282: 283: /* Construct value that describes a class of wide characters identified 284: by the string argument PROPERTY. */ 285: extern wctype_t wctype_l (__const char *__property, __locale_t __locale) 286: __THROW; 287: 288: /* Determine whether the wide-character WC has the property described by 289: DESC. */ 290: extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale) 291: __THROW; 292: 293: 294: /* 295: * Wide-character case-mapping functions. 296: */ 297: 298: /* Converts an uppercase letter to the corresponding lowercase letter. */ 299: extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW; 300: 301: /* Converts an lowercase letter to the corresponding uppercase letter. */ 302: extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW; 303: 304: /* Construct value that describes a mapping between wide characters 305: identified by the string argument PROPERTY. */ 306: extern wctrans_t wctrans_l (__const char *__property, __locale_t __locale) 307: __THROW; 308: 309: /* Map the wide character WC using the mapping described by DESC. */ 310: extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc, 311: __locale_t __locale) __THROW; 312: 313: # endif /* Use POSIX 2008. */ 314: 315: __END_DECLS 316: 317: #endif /* __WCTYPE_H defined. */ 318: 319: #endif /* wctype.h */ 320: