/home/ntakagi/work/STLport-5.1.5/stlport/stl/c_locale.hGo to the documentation of this file.00001 /* 00002 * Copyright (c) 1999 00003 * Silicon Graphics Computer Systems, Inc. 00004 * 00005 * Copyright (c) 1999 00006 * Boris Fomitchev 00007 * 00008 * This material is provided "as is", with absolutely no warranty expressed 00009 * or implied. Any use is at your own risk. 00010 * 00011 * Permission to use or copy this software for any purpose is hereby granted 00012 * without fee, provided the above notices are retained on all copies. 00013 * Permission to modify the code and to distribute modified code is granted, 00014 * provided the above notices are retained, and a notice that the code was 00015 * modified is included with the above copyright notice. 00016 * 00017 */ 00018 00019 00020 #ifndef _STLP_C_LOCALE_H 00021 #define _STLP_C_LOCALE_H 00022 00023 /* 00024 * Implementation dependent definitions. 00025 * Beware: This header is not a purely internal header, it is also included 00026 * from the outside world when building the STLport library. So this header 00027 * should not reference internal headers (stlport/stl/_*.h) directly. 00028 */ 00029 #if defined (__sgi) 00030 # if defined (ROOT_65) /* IRIX 6.5.x */ 00031 # include <sgidefs.h> 00032 # include <standards.h> 00033 # include <wchar.h> 00034 # include <ctype.h> 00035 # else /* IRIX pre-6.5 */ 00036 # include <sgidefs.h> 00037 # include <standards.h> 00038 # if !defined(_SIZE_T) && !defined(_SIZE_T_) 00039 # define _SIZE_T 00040 # if (_MIPS_SZLONG == 32) 00041 typedef unsigned int size_t; 00042 # endif 00043 # if (_MIPS_SZLONG == 64) 00044 typedef unsigned long size_t; 00045 # endif 00046 # endif 00047 # if !defined (_WCHAR_T) 00048 # define _WCHAR_T 00049 # if (_MIPS_SZLONG == 32) 00050 typedef long wchar_t; 00051 # endif 00052 # if (_MIPS_SZLONG == 64) 00053 typedef __int32_t wchar_t; 00054 # endif 00055 # endif /* _WCHAR_T */ 00056 # if !defined (_WINT_T) 00057 # define _WINT_T 00058 # if (_MIPS_SZLONG == 32) 00059 typedef long wint_t; 00060 # endif 00061 # if (_MIPS_SZLONG == 64) 00062 typedef __int32_t wint_t; 00063 # endif 00064 # endif /* _WINT_T */ 00065 # if !defined (_MBSTATE_T) 00066 # define _MBSTATE_T 00067 /* _MSC_VER check is here for historical reason and seems wrong as it is the macro defined 00068 * by Microsoft compilers to give their version and we are currently in a SGI platform scope. 00069 * However _MSC_VER might also be a SGI compiler macro so we keep it this way.*/ 00070 # if defined (_MSC_VER) 00071 typedef int mbstate_t; 00072 # else 00073 typedef char mbstate_t; 00074 # endif 00075 # endif /* _MBSTATE_T */ 00076 # endif /* ROOT65 */ 00077 #else /* __sgi */ 00078 # include <stddef.h> 00079 # include <wchar.h> 00080 # include <ctype.h> 00081 #endif /* __sgi */ 00082 00083 /* 00084 * GENERAL FRAMEWORK 00085 */ 00086 00087 /* 00088 * Opaque types, implementation (if there is one) depends 00089 * on platform locale API. 00090 */ 00091 struct _Locale_ctype; 00092 struct _Locale_numeric; 00093 struct _Locale_time; 00094 struct _Locale_collate; 00095 struct _Locale_monetary; 00096 struct _Locale_messages; 00097 struct _Locale_name_hint; 00098 00099 /* 00100 Bitmask macros. 00101 */ 00102 00103 /* 00104 * For narrow characters, we expose the lookup table interface. 00105 */ 00106 00107 /* Internal bitmask macros, os-specific. */ 00108 00109 #if defined (__sgi) /* IRIX */ 00110 00111 # define _Locale_S 0x00000008 /* Spacing character */ 00112 # define _Locale_A 0x00004000 /* Alphabetical characters only */ 00113 # define _Locale_B 0x00000040 /* Obsolete: was space char only */ 00114 # define _Locale_PR 0x00008000 /* Printable characters only */ 00115 # define _Locale_G 0x40000000 /* Graphic characters only */ 00116 # define _Locale_BL 0x80000000 /* The blank character class */ 00117 00118 /* Public bitmask macros, must be defined for every OS. These values, of 00119 * course, are specific to IRIX. */ 00120 00121 # define _Locale_CNTRL 0x00000020 /* Control character */ 00122 # define _Locale_UPPER 0x00000001 /* Upper case */ 00123 # define _Locale_LOWER 0x00000002 /* Lower case */ 00124 # define _Locale_DIGIT 0x00000004 /* Numeral (digit) */ 00125 # define _Locale_XDIGIT 0x00000080 /* heXadecimal digit */ 00126 # define _Locale_PUNCT 0x00000010 /* Punctuation */ 00127 # define _Locale_SPACE (_Locale_S | _Locale_BL) 00128 # define _Locale_PRINT (_Locale_PUNCT | _Locale_UPPER | _Locale_LOWER | \ 00129 _Locale_DIGIT | _Locale_A | _Locale_XDIGIT | \ 00130 _Locale_PR) 00131 # define _Locale_ALPHA _Locale_A 00132 00133 /* 00134 * All of these except for graph and blank are from the C standard; 00135 * graph and blank are XPG4. (graph in XPG4 doesn't mean quite the 00136 * same thing as graph in the C++ library) 00137 */ 00138 00139 #endif /* IRIX */ 00140 00141 00142 #if defined (__Lynx__) 00143 /* azov: On Lynx isalpha defined as (_U | _L), which gives us a mask 00144 * unusable in ctype_table. So we have to redefine it and use hard-coded 00145 * numbers (to avoid potential clashes if system headers change). 00146 * 00147 * P.S. Actually, I see no reason in using platform-specific masks - 00148 * having just one set of masks for all platforms should work just as 00149 * well - we only use them internally and they don't have to be equal 00150 * to whatever defined in local ctype.h 00151 * 00152 */ 00153 # define _Locale_CNTRL 040 /* _C, Control character */ 00154 # define _Locale_UPPER 01 /* _U, Upper case */ 00155 # define _Locale_LOWER 02 /* _L, Lower case */ 00156 # define _Locale_DIGIT 04 /* _N, Numeral (digit) */ 00157 # define _Locale_XDIGIT 0200 /* _X, heXadecimal digit */ 00158 # define _Locale_PUNCT 020 /* _P, Punctuation */ 00159 # define _Locale_SPACE 010 /* _S, Spacing */ 00160 # define _Locale_ALPHA 040000 /* none, Alphanumerical */ 00161 # define _Locale_PRINT (_Locale_PUNCT | _Locale_UPPER | _Locale_LOWER | \ 00162 _Locale_DIGIT | _Locale_ALPHA | _Locale_XDIGIT |\ 00163 _Locale_SPACE ) /* Printable */ 00164 #endif /* __Lynx__ */ 00165 00166 #if defined (__GNUC__) || defined (__BORLANDC__) || defined (__COMO__) 00167 00168 # if defined (__CYGWIN__) 00169 00170 # define _Locale_CNTRL 040 00171 # define _Locale_UPPER 02 00172 # define _Locale_LOWER 01 00173 # define _Locale_DIGIT 04 00174 # define _Locale_XDIGIT ( 0100 | _Locale_DIGIT ) 00175 # define _Locale_PUNCT 020 00176 # define _Locale_SPACE 010 00177 # define _Locale_ALPHA 0200 00178 # define _Locale_PRINT (_Locale_ALPHA | _Locale_DIGIT | _Locale_PUNCT | 0400 ) 00179 00180 # elif defined (__FreeBSD__) || ( defined (__APPLE__) && defined (__GNUC__) && (__GNUC__ > 3) ) 00181 00182 # define _Locale_CNTRL _CTYPE_C 00183 # define _Locale_UPPER _CTYPE_U 00184 # define _Locale_LOWER _CTYPE_L 00185 # define _Locale_DIGIT _CTYPE_D 00186 # define _Locale_XDIGIT _CTYPE_X 00187 # define _Locale_PUNCT _CTYPE_P 00188 # define _Locale_SPACE _CTYPE_S 00189 # define _Locale_PRINT _CTYPE_R 00190 # define _Locale_ALPHA _CTYPE_A 00191 00192 # elif defined (__NetBSD__) || defined (__OpenBSD__) || defined (__amigaos__) 00193 00194 # define _Locale_CNTRL _C 00195 # define _Locale_UPPER _U 00196 # define _Locale_LOWER _L 00197 # define _Locale_DIGIT _N 00198 # define _Locale_XDIGIT (_N|_X) 00199 # define _Locale_PUNCT _P 00200 # define _Locale_SPACE _S 00201 # define _Locale_PRINT (_P|_U|_L|_N|_B) 00202 # define _Locale_ALPHA (_U|_L) 00203 # elif defined (__EMX__) /* OS/2 with emx runtime */ 00204 # define _Locale_CNTRL _CNTRL 00205 # define _Locale_UPPER _UPPER 00206 # define _Locale_LOWER _LOWER 00207 # define _Locale_DIGIT _DIGIT 00208 # define _Locale_XDIGIT _XDIGIT 00209 # define _Locale_PUNCT _PUNCT 00210 # define _Locale_SPACE _SPACE 00211 # define _Locale_PRINT _PRINT 00212 # define _Locale_ALPHA (_UPPER|_LOWER) 00213 00214 # elif defined (_STLP_USE_GLIBC) /* linux, using the gnu compiler */ 00215 00216 /* This section uses macros defined in the gnu libc ctype.h header */ 00217 00218 # define _Locale_CNTRL _IScntrl 00219 # define _Locale_UPPER _ISupper 00220 # define _Locale_LOWER _ISlower 00221 # define _Locale_DIGIT _ISdigit 00222 # define _Locale_XDIGIT _ISxdigit 00223 # define _Locale_PUNCT _ISpunct 00224 # define _Locale_SPACE _ISspace 00225 # define _Locale_PRINT _ISprint 00226 # define _Locale_ALPHA _ISalpha 00227 00228 # endif /* GLIBC */ 00229 00230 #endif /* gnu */ 00231 00232 #if (defined (__sun) && defined (__SVR4)) || \ 00233 (defined (__digital__) && defined (__unix__)) || \ 00234 defined (_AIX) 00235 /* fbp : condition from AT&T code*/ 00236 # if !(defined (__XPG4_CHAR_CLASS__) || defined (_XPG4_2) || \ 00237 (defined (_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4))) && ! defined (_ISCNTRL) 00238 /* fbp : on 2.5.1, the defines are different ;( */ 00239 /* # if ( defined (__sun) && defined (__SVR4) && ! defined (_ISCNTRL) ) */ 00240 # define _ISCNTRL _C 00241 # define _ISUPPER _U 00242 # define _ISLOWER _L 00243 # define _ISDIGIT _N 00244 # define _ISXDIGIT _X 00245 # define _ISPUNCT _P 00246 # define _ISSPACE _S 00247 # define _ISPRINT (_P | _U | _L | _N | _B) 00248 # define _ISALPHA (_U | _L) 00249 # endif 00250 00251 # define _Locale_CNTRL _ISCNTRL 00252 # define _Locale_UPPER _ISUPPER 00253 # define _Locale_LOWER _ISLOWER 00254 # define _Locale_DIGIT _ISDIGIT 00255 # define _Locale_XDIGIT _ISXDIGIT 00256 # define _Locale_PUNCT _ISPUNCT 00257 # define _Locale_SPACE _ISSPACE 00258 # define _Locale_PRINT _ISPRINT 00259 # define _Locale_ALPHA _ISALPHA 00260 #elif defined (__MWERKS__) && defined (N_PLAT_NLM) 00261 # define _Locale_CNTRL _CNTRL_ 00262 # define _Locale_UPPER _UPPER_ 00263 # define _Locale_LOWER _LOWER_ 00264 # define _Locale_DIGIT _DIGIT_ 00265 # define _Locale_XDIGIT _XDIGIT_ 00266 # define _Locale_PUNCT _PUNCT_ 00267 # define _Locale_SPACE _SPACE_ 00268 # define _Locale_PRINT (_PUNCT_|_UPPER_|_LOWER_|_DIGIT_|_BLANK_) 00269 # define _Locale_ALPHA (_UPPER_|_LOWER_) 00270 #elif defined (__MWERKS__) 00271 # define _Locale_CNTRL __control_char 00272 # define _Locale_UPPER __upper_case 00273 # define _Locale_LOWER __lower_case 00274 # define _Locale_DIGIT __digit 00275 # define _Locale_XDIGIT __hex_digit 00276 # define _Locale_PUNCT __punctuation 00277 # define _Locale_SPACE __space_char 00278 # define _Locale_PRINT __printable 00279 # define _Locale_ALPHA __alphanumeric 00280 #elif defined (__BORLANDC__) 00281 # define _Locale_CNTRL _IS_CTL 00282 # define _Locale_UPPER _IS_UPP 00283 # define _Locale_LOWER _IS_LOW 00284 # define _Locale_DIGIT _IS_DIG 00285 # define _Locale_XDIGIT _IS_HEX 00286 # define _Locale_PUNCT _IS_PUN 00287 # define _Locale_SPACE _IS_SP 00288 # define _Locale_PRINT (_IS_SP|_IS_PUN|_IS_UPP|_IS_LOW|_IS_DIG) 00289 # define _Locale_ALPHA _IS_ALPHA 00290 #elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__) 00291 # define _Locale_CNTRL _CONTROL 00292 # define _Locale_UPPER _UPPER 00293 # define _Locale_LOWER _LOWER 00294 # define _Locale_DIGIT _DIGIT 00295 # define _Locale_XDIGIT _HEX 00296 # define _Locale_PUNCT _PUNCT 00297 # define _Locale_SPACE _SPACE 00298 # define _Locale_PRINT (_ALPHA | _DIGIT | _BLANK | _PUNCT) 00299 # define _Locale_ALPHA ( _ALPHA & ~ (_UPPER | _LOWER )) 00300 #elif defined (__DMC__) 00301 # define _Locale_CNTRL _CONTROL 00302 # define _Locale_UPPER _UPPER 00303 # define _Locale_LOWER _LOWER 00304 # define _Locale_DIGIT _DIGIT 00305 # define _Locale_XDIGIT _HEX 00306 # define _Locale_PUNCT _PUNCT 00307 # define _Locale_SPACE _SPACE 00308 # define _Locale_PRINT (_UPPER | _LOWER | _DIGIT | _PUNCT | _SPACE) 00309 # define _Locale_ALPHA _ALPHA & ~(_UPPER | _LOWER) 00310 #elif defined (__MRC__) || defined (__SC__) /* *TY 02/24/2000 - added support for MPW */ 00311 # define _Locale_CNTRL _CTL 00312 # define _Locale_UPPER _UPP 00313 # define _Locale_LOWER _LOW 00314 # define _Locale_DIGIT _DIG 00315 # define _Locale_XDIGIT _HEX 00316 # define _Locale_PUNCT _PUN 00317 # define _Locale_SPACE _BLA 00318 # define _Locale_PRINT (_UPP | _LOW | _DIG | _PUN | _BLA) 00319 # define _Locale_ALPHA (_UPP | _LOW) 00320 #elif defined (__MLCCPP__) 00321 # define _Locale_CNTRL 1 00322 # define _Locale_UPPER 2 00323 # define _Locale_LOWER 4 00324 # define _Locale_DIGIT 8 00325 # define _Locale_XDIGIT 16 00326 # define _Locale_PUNCT 32 00327 # define _Locale_SPACE 64 00328 # define _Locale_PRINT 128 00329 # define _Locale_ALPHA 256 00330 #elif defined (__GNUC__) && (__GNUC__ == 3) && defined (__APPLE__) 00331 # define _Locale_CNTRL _C 00332 # define _Locale_UPPER _U 00333 # define _Locale_LOWER _L 00334 # define _Locale_DIGIT _D 00335 # define _Locale_XDIGIT _X 00336 # define _Locale_PUNCT _P 00337 # define _Locale_SPACE _S 00338 # define _Locale_PRINT _R 00339 # define _Locale_ALPHA _A 00340 #elif defined (__hpux) || defined (__osf__) 00341 # if defined (__HP_aCC) && !defined (_INCLUDE_HPUX_SOURCE) 00342 # define _ISALPHA 0x001 00343 # define _ISALNUM 0x002 00344 # define _ISBLANK 0x004 00345 # define _ISCNTRL 0x008 00346 # define _ISDIGIT 0x010 00347 # define _ISGRAPH 0x020 00348 # define _ISLOWER 0x040 00349 # define _ISPRINT 0x080 00350 # define _ISPUNCT 0x100 00351 # define _ISSPACE 0x200 00352 # define _ISUPPER 0x400 00353 # define _ISXDIGIT 0x800 00354 # endif 00355 # define _Locale_CNTRL _ISCNTRL 00356 # define _Locale_UPPER _ISUPPER 00357 # define _Locale_LOWER _ISLOWER 00358 # define _Locale_DIGIT _ISDIGIT 00359 # define _Locale_XDIGIT _ISXDIGIT 00360 # define _Locale_PUNCT _ISPUNCT 00361 # define _Locale_SPACE _ISSPACE 00362 # define _Locale_PRINT _ISPRINT 00363 # define _Locale_ALPHA _ISALPHA 00364 #elif defined (__MVS__) || defined (__OS400__) 00365 # define _Locale_CNTRL __ISCNTRL 00366 # define _Locale_UPPER __ISUPPER 00367 # define _Locale_LOWER __ISLOWER 00368 # define _Locale_DIGIT __ISDIGIT 00369 # define _Locale_XDIGIT __ISXDIGIT 00370 # define _Locale_PUNCT __ISPUNCT 00371 # define _Locale_SPACE __ISSPACE 00372 # define _Locale_PRINT __ISPRINT 00373 # define _Locale_ALPHA __ISALPHA 00374 #elif defined (__QNXNTO__) || defined (__WATCOMC__) 00375 # define _Locale_CNTRL _CNTRL 00376 # define _Locale_UPPER _UPPER 00377 # define _Locale_LOWER _LOWER 00378 # define _Locale_DIGIT _DIGIT 00379 # define _Locale_XDIGIT _XDIGT 00380 # define _Locale_PUNCT _PUNCT 00381 # define _Locale_SPACE _SPACE 00382 # define _Locale_PRINT _PRINT 00383 # define _Locale_ALPHA (_UPPER | _LOWER) 00384 #elif defined (__DJGPP) 00385 # define _Locale_CNTRL __dj_ISCNTRL 00386 # define _Locale_UPPER __dj_ISUPPER 00387 # define _Locale_LOWER __dj_ISLOWER 00388 # define _Locale_DIGIT __dj_ISDIGIT 00389 # define _Locale_XDIGIT __dj_ISXDIGIT 00390 # define _Locale_PUNCT __dj_ISPUNCT 00391 # define _Locale_SPACE __dj_ISSPACE 00392 # define _Locale_PRINT __dj_ISPRINT 00393 # define _Locale_ALPHA __dj_ISALPHA 00394 #elif defined (_STLP_SCO_OPENSERVER) 00395 # define _Locale_CNTRL _C 00396 # define _Locale_UPPER _U 00397 # define _Locale_LOWER _L 00398 # define _Locale_DIGIT _N 00399 # define _Locale_XDIGIT _X 00400 # define _Locale_PUNCT _P 00401 # define _Locale_SPACE _S 00402 # define _Locale_PRINT _R 00403 # define _Locale_ALPHA _A 00404 #elif defined (__NCR_SVR) 00405 # define _Locale_CNTRL _C 00406 # define _Locale_UPPER _U 00407 # define _Locale_LOWER _L 00408 # define _Locale_DIGIT _N 00409 # define _Locale_XDIGIT _X 00410 # define _Locale_PUNCT _P 00411 # define _Locale_SPACE _S 00412 # define _Locale_PRINT (_P | _U | _L | _N | _B) 00413 # define _Locale_ALPHA (_U | _L) 00414 #elif defined (_CRAY) 00415 # define _Locale_CNTRL _CNTRL 00416 # define _Locale_UPPER _UPPER 00417 # define _Locale_LOWER _LOWER 00418 # define _Locale_DIGIT _DIGIT 00419 # define _Locale_XDIGIT _XDIGIT 00420 # define _Locale_PUNCT _PUNCT 00421 # define _Locale_SPACE _SPACE 00422 # define _Locale_PRINT _PRINT 00423 # define _Locale_ALPHA _ALPHA 00424 #endif 00425 00426 /* We arbitrarily consider _Locale_CNTRL macro to check locale facet numeric 00427 * identifier has been defined for the platform/compiler: 00428 */ 00429 #if !defined (_Locale_CNTRL) 00430 # error Unable to find your platform locale facets definitions, please grant them. 00431 #endif 00432 00433 #endif /* _STLP_C_LOCALE_H */
Generated on Mon Mar 10 15:32:46 2008 by ![]() |