1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/tools/stlport/stl/c_locale.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,433 @@
1.4 +/*
1.5 + * Copyright (c) 1999
1.6 + * Silicon Graphics Computer Systems, Inc.
1.7 + *
1.8 + * Copyright (c) 1999
1.9 + * Boris Fomitchev
1.10 + *
1.11 + * This material is provided "as is", with absolutely no warranty expressed
1.12 + * or implied. Any use is at your own risk.
1.13 + *
1.14 + * Permission to use or copy this software for any purpose is hereby granted
1.15 + * without fee, provided the above notices are retained on all copies.
1.16 + * Permission to modify the code and to distribute modified code is granted,
1.17 + * provided the above notices are retained, and a notice that the code was
1.18 + * modified is included with the above copyright notice.
1.19 + *
1.20 + */
1.21 +
1.22 +
1.23 +#ifndef _STLP_C_LOCALE_H
1.24 +#define _STLP_C_LOCALE_H
1.25 +
1.26 +/*
1.27 + * Implementation dependent definitions.
1.28 + * Beware: This header is not a purely internal header, it is also included
1.29 + * from the outside world when building the STLport library. So this header
1.30 + * should not reference internal headers (stlport/stl/_*.h) directly.
1.31 + */
1.32 +#if defined (__sgi)
1.33 +# if defined (ROOT_65) /* IRIX 6.5.x */
1.34 +# include <sgidefs.h>
1.35 +# include <standards.h>
1.36 +# include <wchar.h>
1.37 +# include <ctype.h>
1.38 +# else /* IRIX pre-6.5 */
1.39 +# include <sgidefs.h>
1.40 +# include <standards.h>
1.41 +# if !defined(_SIZE_T) && !defined(_SIZE_T_)
1.42 +# define _SIZE_T
1.43 +# if (_MIPS_SZLONG == 32)
1.44 +typedef unsigned int size_t;
1.45 +# endif
1.46 +# if (_MIPS_SZLONG == 64)
1.47 +typedef unsigned long size_t;
1.48 +# endif
1.49 +# endif
1.50 +# if !defined (_WCHAR_T)
1.51 +# define _WCHAR_T
1.52 +# if (_MIPS_SZLONG == 32)
1.53 +typedef long wchar_t;
1.54 +# endif
1.55 +# if (_MIPS_SZLONG == 64)
1.56 +typedef __int32_t wchar_t;
1.57 +# endif
1.58 +# endif /* _WCHAR_T */
1.59 +# if !defined (_WINT_T)
1.60 +# define _WINT_T
1.61 +# if (_MIPS_SZLONG == 32)
1.62 +typedef long wint_t;
1.63 +# endif
1.64 +# if (_MIPS_SZLONG == 64)
1.65 +typedef __int32_t wint_t;
1.66 +# endif
1.67 +# endif /* _WINT_T */
1.68 +# if !defined (_MBSTATE_T)
1.69 +# define _MBSTATE_T
1.70 +/* _MSC_VER check is here for historical reason and seems wrong as it is the macro defined
1.71 + * by Microsoft compilers to give their version and we are currently in a SGI platform scope.
1.72 + * However _MSC_VER might also be a SGI compiler macro so we keep it this way.*/
1.73 +# if defined (_MSC_VER)
1.74 +typedef int mbstate_t;
1.75 +# else
1.76 +typedef char mbstate_t;
1.77 +# endif
1.78 +# endif /* _MBSTATE_T */
1.79 +# endif /* ROOT65 */
1.80 +#else /* __sgi */
1.81 +# include <stddef.h>
1.82 +# include <wchar.h>
1.83 +# include <ctype.h>
1.84 +#endif /* __sgi */
1.85 +
1.86 +/*
1.87 + * GENERAL FRAMEWORK
1.88 + */
1.89 +
1.90 +/*
1.91 + * Opaque types, implementation (if there is one) depends
1.92 + * on platform locale API.
1.93 + */
1.94 +struct _Locale_ctype;
1.95 +struct _Locale_numeric;
1.96 +struct _Locale_time;
1.97 +struct _Locale_collate;
1.98 +struct _Locale_monetary;
1.99 +struct _Locale_messages;
1.100 +struct _Locale_name_hint;
1.101 +
1.102 +/*
1.103 + Bitmask macros.
1.104 +*/
1.105 +
1.106 +/*
1.107 + * For narrow characters, we expose the lookup table interface.
1.108 + */
1.109 +
1.110 +/* Internal bitmask macros, os-specific. */
1.111 +
1.112 +#if defined (__sgi) /* IRIX */
1.113 +
1.114 +# define _Locale_S 0x00000008 /* Spacing character */
1.115 +# define _Locale_A 0x00004000 /* Alphabetical characters only */
1.116 +# define _Locale_B 0x00000040 /* Obsolete: was space char only */
1.117 +# define _Locale_PR 0x00008000 /* Printable characters only */
1.118 +# define _Locale_G 0x40000000 /* Graphic characters only */
1.119 +# define _Locale_BL 0x80000000 /* The blank character class */
1.120 +
1.121 +/* Public bitmask macros, must be defined for every OS. These values, of
1.122 + * course, are specific to IRIX. */
1.123 +
1.124 +# define _Locale_CNTRL 0x00000020 /* Control character */
1.125 +# define _Locale_UPPER 0x00000001 /* Upper case */
1.126 +# define _Locale_LOWER 0x00000002 /* Lower case */
1.127 +# define _Locale_DIGIT 0x00000004 /* Numeral (digit) */
1.128 +# define _Locale_XDIGIT 0x00000080 /* heXadecimal digit */
1.129 +# define _Locale_PUNCT 0x00000010 /* Punctuation */
1.130 +# define _Locale_SPACE (_Locale_S | _Locale_BL)
1.131 +# define _Locale_PRINT (_Locale_PUNCT | _Locale_UPPER | _Locale_LOWER | \
1.132 + _Locale_DIGIT | _Locale_A | _Locale_XDIGIT | \
1.133 + _Locale_PR)
1.134 +# define _Locale_ALPHA _Locale_A
1.135 +
1.136 +/*
1.137 +* All of these except for graph and blank are from the C standard;
1.138 +* graph and blank are XPG4. (graph in XPG4 doesn't mean quite the
1.139 +* same thing as graph in the C++ library)
1.140 +*/
1.141 +
1.142 +#endif /* IRIX */
1.143 +
1.144 +
1.145 +#if defined (__Lynx__)
1.146 + /* azov: On Lynx isalpha defined as (_U | _L), which gives us a mask
1.147 + * unusable in ctype_table. So we have to redefine it and use hard-coded
1.148 + * numbers (to avoid potential clashes if system headers change).
1.149 + *
1.150 + * P.S. Actually, I see no reason in using platform-specific masks -
1.151 + * having just one set of masks for all platforms should work just as
1.152 + * well - we only use them internally and they don't have to be equal
1.153 + * to whatever defined in local ctype.h
1.154 + *
1.155 + */
1.156 +# define _Locale_CNTRL 040 /* _C, Control character */
1.157 +# define _Locale_UPPER 01 /* _U, Upper case */
1.158 +# define _Locale_LOWER 02 /* _L, Lower case */
1.159 +# define _Locale_DIGIT 04 /* _N, Numeral (digit) */
1.160 +# define _Locale_XDIGIT 0200 /* _X, heXadecimal digit */
1.161 +# define _Locale_PUNCT 020 /* _P, Punctuation */
1.162 +# define _Locale_SPACE 010 /* _S, Spacing */
1.163 +# define _Locale_ALPHA 040000 /* none, Alphanumerical */
1.164 +# define _Locale_PRINT (_Locale_PUNCT | _Locale_UPPER | _Locale_LOWER | \
1.165 + _Locale_DIGIT | _Locale_ALPHA | _Locale_XDIGIT |\
1.166 + _Locale_SPACE ) /* Printable */
1.167 +#endif /* __Lynx__ */
1.168 +
1.169 +#if defined (__GNUC__) || defined (__BORLANDC__) || defined (__COMO__)
1.170 +
1.171 +# if defined (__CYGWIN__)
1.172 +
1.173 +# define _Locale_CNTRL 040
1.174 +# define _Locale_UPPER 02
1.175 +# define _Locale_LOWER 01
1.176 +# define _Locale_DIGIT 04
1.177 +# define _Locale_XDIGIT ( 0100 | _Locale_DIGIT )
1.178 +# define _Locale_PUNCT 020
1.179 +# define _Locale_SPACE 010
1.180 +# define _Locale_ALPHA 0200
1.181 +# define _Locale_PRINT (_Locale_ALPHA | _Locale_DIGIT | _Locale_PUNCT | 0400 )
1.182 +
1.183 +# elif defined (__FreeBSD__) || ( defined (__APPLE__) && defined (__GNUC__) && (__GNUC__ > 3) )
1.184 +
1.185 +# define _Locale_CNTRL _CTYPE_C
1.186 +# define _Locale_UPPER _CTYPE_U
1.187 +# define _Locale_LOWER _CTYPE_L
1.188 +# define _Locale_DIGIT _CTYPE_D
1.189 +# define _Locale_XDIGIT _CTYPE_X
1.190 +# define _Locale_PUNCT _CTYPE_P
1.191 +# define _Locale_SPACE _CTYPE_S
1.192 +# define _Locale_PRINT _CTYPE_R
1.193 +# define _Locale_ALPHA _CTYPE_A
1.194 +
1.195 +# elif defined (__NetBSD__) || defined (__OpenBSD__) || defined (__amigaos__)
1.196 +
1.197 +# define _Locale_CNTRL _C
1.198 +# define _Locale_UPPER _U
1.199 +# define _Locale_LOWER _L
1.200 +# define _Locale_DIGIT _N
1.201 +# define _Locale_XDIGIT (_N|_X)
1.202 +# define _Locale_PUNCT _P
1.203 +# define _Locale_SPACE _S
1.204 +# define _Locale_PRINT (_P|_U|_L|_N|_B)
1.205 +# define _Locale_ALPHA (_U|_L)
1.206 +# elif defined (__EMX__) /* OS/2 with emx runtime */
1.207 +# define _Locale_CNTRL _CNTRL
1.208 +# define _Locale_UPPER _UPPER
1.209 +# define _Locale_LOWER _LOWER
1.210 +# define _Locale_DIGIT _DIGIT
1.211 +# define _Locale_XDIGIT _XDIGIT
1.212 +# define _Locale_PUNCT _PUNCT
1.213 +# define _Locale_SPACE _SPACE
1.214 +# define _Locale_PRINT _PRINT
1.215 +# define _Locale_ALPHA (_UPPER|_LOWER)
1.216 +
1.217 +# elif defined (_STLP_USE_GLIBC) /* linux, using the gnu compiler */
1.218 +
1.219 +/* This section uses macros defined in the gnu libc ctype.h header */
1.220 +
1.221 +# define _Locale_CNTRL _IScntrl
1.222 +# define _Locale_UPPER _ISupper
1.223 +# define _Locale_LOWER _ISlower
1.224 +# define _Locale_DIGIT _ISdigit
1.225 +# define _Locale_XDIGIT _ISxdigit
1.226 +# define _Locale_PUNCT _ISpunct
1.227 +# define _Locale_SPACE _ISspace
1.228 +# define _Locale_PRINT _ISprint
1.229 +# define _Locale_ALPHA _ISalpha
1.230 +
1.231 +# endif /* GLIBC */
1.232 +
1.233 +#endif /* gnu */
1.234 +
1.235 +#if (defined (__sun) && defined (__SVR4)) || \
1.236 + (defined (__digital__) && defined (__unix__)) || \
1.237 + defined (_AIX)
1.238 +/* fbp : condition from AT&T code*/
1.239 +# if !(defined (__XPG4_CHAR_CLASS__) || defined (_XPG4_2) || \
1.240 + (defined (_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4))) && ! defined (_ISCNTRL)
1.241 + /* fbp : on 2.5.1, the defines are different ;( */
1.242 + /* # if ( defined (__sun) && defined (__SVR4) && ! defined (_ISCNTRL) ) */
1.243 +# define _ISCNTRL _C
1.244 +# define _ISUPPER _U
1.245 +# define _ISLOWER _L
1.246 +# define _ISDIGIT _N
1.247 +# define _ISXDIGIT _X
1.248 +# define _ISPUNCT _P
1.249 +# define _ISSPACE _S
1.250 +# define _ISPRINT (_P | _U | _L | _N | _B)
1.251 +# define _ISALPHA (_U | _L)
1.252 +# endif
1.253 +
1.254 +# define _Locale_CNTRL _ISCNTRL
1.255 +# define _Locale_UPPER _ISUPPER
1.256 +# define _Locale_LOWER _ISLOWER
1.257 +# define _Locale_DIGIT _ISDIGIT
1.258 +# define _Locale_XDIGIT _ISXDIGIT
1.259 +# define _Locale_PUNCT _ISPUNCT
1.260 +# define _Locale_SPACE _ISSPACE
1.261 +# define _Locale_PRINT _ISPRINT
1.262 +# define _Locale_ALPHA _ISALPHA
1.263 +#elif defined (__MWERKS__) && defined (N_PLAT_NLM)
1.264 +# define _Locale_CNTRL _CNTRL_
1.265 +# define _Locale_UPPER _UPPER_
1.266 +# define _Locale_LOWER _LOWER_
1.267 +# define _Locale_DIGIT _DIGIT_
1.268 +# define _Locale_XDIGIT _XDIGIT_
1.269 +# define _Locale_PUNCT _PUNCT_
1.270 +# define _Locale_SPACE _SPACE_
1.271 +# define _Locale_PRINT (_PUNCT_|_UPPER_|_LOWER_|_DIGIT_|_BLANK_)
1.272 +# define _Locale_ALPHA (_UPPER_|_LOWER_)
1.273 +#elif defined (__MWERKS__)
1.274 +# define _Locale_CNTRL __control_char
1.275 +# define _Locale_UPPER __upper_case
1.276 +# define _Locale_LOWER __lower_case
1.277 +# define _Locale_DIGIT __digit
1.278 +# define _Locale_XDIGIT __hex_digit
1.279 +# define _Locale_PUNCT __punctuation
1.280 +# define _Locale_SPACE __space_char
1.281 +# define _Locale_PRINT __printable
1.282 +# define _Locale_ALPHA __alphanumeric
1.283 +#elif defined (__BORLANDC__)
1.284 +# define _Locale_CNTRL _IS_CTL
1.285 +# define _Locale_UPPER _IS_UPP
1.286 +# define _Locale_LOWER _IS_LOW
1.287 +# define _Locale_DIGIT _IS_DIG
1.288 +# define _Locale_XDIGIT _IS_HEX
1.289 +# define _Locale_PUNCT _IS_PUN
1.290 +# define _Locale_SPACE _IS_SP
1.291 +# define _Locale_PRINT (_IS_SP|_IS_PUN|_IS_UPP|_IS_LOW|_IS_DIG)
1.292 +# define _Locale_ALPHA _IS_ALPHA
1.293 +#elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__)
1.294 +# define _Locale_CNTRL _CONTROL
1.295 +# define _Locale_UPPER _UPPER
1.296 +# define _Locale_LOWER _LOWER
1.297 +# define _Locale_DIGIT _DIGIT
1.298 +# define _Locale_XDIGIT _HEX
1.299 +# define _Locale_PUNCT _PUNCT
1.300 +# define _Locale_SPACE _SPACE
1.301 +# define _Locale_PRINT (_ALPHA | _DIGIT | _BLANK | _PUNCT)
1.302 +# define _Locale_ALPHA ( _ALPHA & ~ (_UPPER | _LOWER ))
1.303 +#elif defined (__DMC__)
1.304 +# define _Locale_CNTRL _CONTROL
1.305 +# define _Locale_UPPER _UPPER
1.306 +# define _Locale_LOWER _LOWER
1.307 +# define _Locale_DIGIT _DIGIT
1.308 +# define _Locale_XDIGIT _HEX
1.309 +# define _Locale_PUNCT _PUNCT
1.310 +# define _Locale_SPACE _SPACE
1.311 +# define _Locale_PRINT (_UPPER | _LOWER | _DIGIT | _PUNCT | _SPACE)
1.312 +# define _Locale_ALPHA _ALPHA & ~(_UPPER | _LOWER)
1.313 +#elif defined (__MRC__) || defined (__SC__) /* *TY 02/24/2000 - added support for MPW */
1.314 +# define _Locale_CNTRL _CTL
1.315 +# define _Locale_UPPER _UPP
1.316 +# define _Locale_LOWER _LOW
1.317 +# define _Locale_DIGIT _DIG
1.318 +# define _Locale_XDIGIT _HEX
1.319 +# define _Locale_PUNCT _PUN
1.320 +# define _Locale_SPACE _BLA
1.321 +# define _Locale_PRINT (_UPP | _LOW | _DIG | _PUN | _BLA)
1.322 +# define _Locale_ALPHA (_UPP | _LOW)
1.323 +#elif defined (__MLCCPP__)
1.324 +# define _Locale_CNTRL 1
1.325 +# define _Locale_UPPER 2
1.326 +# define _Locale_LOWER 4
1.327 +# define _Locale_DIGIT 8
1.328 +# define _Locale_XDIGIT 16
1.329 +# define _Locale_PUNCT 32
1.330 +# define _Locale_SPACE 64
1.331 +# define _Locale_PRINT 128
1.332 +# define _Locale_ALPHA 256
1.333 +#elif defined (__GNUC__) && (__GNUC__ == 3) && defined (__APPLE__)
1.334 +# define _Locale_CNTRL _C
1.335 +# define _Locale_UPPER _U
1.336 +# define _Locale_LOWER _L
1.337 +# define _Locale_DIGIT _D
1.338 +# define _Locale_XDIGIT _X
1.339 +# define _Locale_PUNCT _P
1.340 +# define _Locale_SPACE _S
1.341 +# define _Locale_PRINT _R
1.342 +# define _Locale_ALPHA _A
1.343 +#elif defined (__hpux) || defined (__osf__)
1.344 +# if defined (__HP_aCC) && !defined (_INCLUDE_HPUX_SOURCE)
1.345 +# define _ISALPHA 0x001
1.346 +# define _ISALNUM 0x002
1.347 +# define _ISBLANK 0x004
1.348 +# define _ISCNTRL 0x008
1.349 +# define _ISDIGIT 0x010
1.350 +# define _ISGRAPH 0x020
1.351 +# define _ISLOWER 0x040
1.352 +# define _ISPRINT 0x080
1.353 +# define _ISPUNCT 0x100
1.354 +# define _ISSPACE 0x200
1.355 +# define _ISUPPER 0x400
1.356 +# define _ISXDIGIT 0x800
1.357 +# endif
1.358 +# define _Locale_CNTRL _ISCNTRL
1.359 +# define _Locale_UPPER _ISUPPER
1.360 +# define _Locale_LOWER _ISLOWER
1.361 +# define _Locale_DIGIT _ISDIGIT
1.362 +# define _Locale_XDIGIT _ISXDIGIT
1.363 +# define _Locale_PUNCT _ISPUNCT
1.364 +# define _Locale_SPACE _ISSPACE
1.365 +# define _Locale_PRINT _ISPRINT
1.366 +# define _Locale_ALPHA _ISALPHA
1.367 +#elif defined (__MVS__) || defined (__OS400__)
1.368 +# define _Locale_CNTRL __ISCNTRL
1.369 +# define _Locale_UPPER __ISUPPER
1.370 +# define _Locale_LOWER __ISLOWER
1.371 +# define _Locale_DIGIT __ISDIGIT
1.372 +# define _Locale_XDIGIT __ISXDIGIT
1.373 +# define _Locale_PUNCT __ISPUNCT
1.374 +# define _Locale_SPACE __ISSPACE
1.375 +# define _Locale_PRINT __ISPRINT
1.376 +# define _Locale_ALPHA __ISALPHA
1.377 +#elif defined (__QNXNTO__) || defined (__WATCOMC__)
1.378 +# define _Locale_CNTRL _CNTRL
1.379 +# define _Locale_UPPER _UPPER
1.380 +# define _Locale_LOWER _LOWER
1.381 +# define _Locale_DIGIT _DIGIT
1.382 +# define _Locale_XDIGIT _XDIGT
1.383 +# define _Locale_PUNCT _PUNCT
1.384 +# define _Locale_SPACE _SPACE
1.385 +# define _Locale_PRINT _PRINT
1.386 +# define _Locale_ALPHA (_UPPER | _LOWER)
1.387 +#elif defined (__DJGPP)
1.388 +# define _Locale_CNTRL __dj_ISCNTRL
1.389 +# define _Locale_UPPER __dj_ISUPPER
1.390 +# define _Locale_LOWER __dj_ISLOWER
1.391 +# define _Locale_DIGIT __dj_ISDIGIT
1.392 +# define _Locale_XDIGIT __dj_ISXDIGIT
1.393 +# define _Locale_PUNCT __dj_ISPUNCT
1.394 +# define _Locale_SPACE __dj_ISSPACE
1.395 +# define _Locale_PRINT __dj_ISPRINT
1.396 +# define _Locale_ALPHA __dj_ISALPHA
1.397 +#elif defined (_STLP_SCO_OPENSERVER)
1.398 +# define _Locale_CNTRL _C
1.399 +# define _Locale_UPPER _U
1.400 +# define _Locale_LOWER _L
1.401 +# define _Locale_DIGIT _N
1.402 +# define _Locale_XDIGIT _X
1.403 +# define _Locale_PUNCT _P
1.404 +# define _Locale_SPACE _S
1.405 +# define _Locale_PRINT _R
1.406 +# define _Locale_ALPHA _A
1.407 +#elif defined (__NCR_SVR)
1.408 +# define _Locale_CNTRL _C
1.409 +# define _Locale_UPPER _U
1.410 +# define _Locale_LOWER _L
1.411 +# define _Locale_DIGIT _N
1.412 +# define _Locale_XDIGIT _X
1.413 +# define _Locale_PUNCT _P
1.414 +# define _Locale_SPACE _S
1.415 +# define _Locale_PRINT (_P | _U | _L | _N | _B)
1.416 +# define _Locale_ALPHA (_U | _L)
1.417 +#elif defined (_CRAY)
1.418 +# define _Locale_CNTRL _CNTRL
1.419 +# define _Locale_UPPER _UPPER
1.420 +# define _Locale_LOWER _LOWER
1.421 +# define _Locale_DIGIT _DIGIT
1.422 +# define _Locale_XDIGIT _XDIGIT
1.423 +# define _Locale_PUNCT _PUNCT
1.424 +# define _Locale_SPACE _SPACE
1.425 +# define _Locale_PRINT _PRINT
1.426 +# define _Locale_ALPHA _ALPHA
1.427 +#endif
1.428 +
1.429 +/* We arbitrarily consider _Locale_CNTRL macro to check locale facet numeric
1.430 + * identifier has been defined for the platform/compiler:
1.431 + */
1.432 +#if !defined (_Locale_CNTRL)
1.433 +# error Unable to find your platform locale facets definitions, please grant them.
1.434 +#endif
1.435 +
1.436 +#endif /* _STLP_C_LOCALE_H */