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