c_locale.h

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  */
00026 #ifdef __cplusplus
00027 #  include <stl/_config.h>
00028 #endif
00029 
00030 #if defined(__sgi) 
00031 # if defined(ROOT_65) /* IRIX 6.5.x */
00032 #  include <sgidefs.h>
00033 #  include <standards.h>
00034 #  include <wchar.h>
00035 #  include <ctype.h>
00036 
00037 # else
00038                   /* IRIX pre-6.5 */
00039 #  include <sgidefs.h>
00040 #  include <standards.h>
00041 
00042 #  if !defined(_SIZE_T) && !defined(_SIZE_T_)
00043 #   define _SIZE_T
00044 #    if (_MIPS_SZLONG == 32)
00045 typedef unsigned int    size_t;
00046 #    endif
00047 #    if (_MIPS_SZLONG == 64)
00048 typedef unsigned long   size_t;
00049 #    endif
00050 #   endif
00051 
00052 #   ifndef _WCHAR_T
00053 #    define _WCHAR_T
00054 #     if (_MIPS_SZLONG == 32)
00055 typedef long wchar_t;
00056 #     endif
00057 #     if (_MIPS_SZLONG == 64)
00058 typedef __int32_t wchar_t;
00059 #     endif
00060 #    endif /* _WCHAR_T */
00061 
00062 #    ifndef _WINT_T
00063 #     define _WINT_T
00064 #     if (_MIPS_SZLONG == 32)
00065         typedef long    wint_t;
00066 #     endif
00067 #     if (_MIPS_SZLONG == 64)
00068         typedef __int32_t wint_t;
00069 #     endif
00070 #    endif /* _WINT_T */
00071 
00072 #    ifndef _MBSTATE_T
00073 #    define _MBSTATE_T
00074 #    if defined (_MSC_VER) && !defined (__SYMBIAN32__)
00075                 typedef int             mbstate_t;
00076 #    else
00077         typedef char    mbstate_t;
00078 #    endif
00079 #    endif /* _MBSTATE_T */
00080 
00081 #   endif /* ROOT65 */ 
00082 
00083 #  else /* __sgi */
00084 
00085 # ifdef __cplusplus
00086 # ifndef _STLP_CSTDDEF
00087 #  include <cstddef>
00088 # endif
00089 # ifndef _STLP_CWCHAR
00090 #  include <cwchar>
00091 # endif
00092 # ifndef _STLP_CCTYPE
00093 #  include <cctype>
00094 # endif
00095 # else
00096 #  include <stddef.h>
00097 #  include <wchar.h>
00098 #  include <ctype.h>
00099 # endif
00100 
00101 #endif /* __sgi */
00102 
00103 /*
00104  * GENERAL FRAMEWORK
00105  */
00106 
00107 struct _Locale_ctype;
00108 struct _Locale_numeric;
00109 struct _Locale_time;
00110 struct _Locale_collate;
00111 struct _Locale_monetary;
00112 struct _Locale_messages;
00113 
00114 /*
00115   Bitmask macros.  
00116 */
00117 
00118 /*
00119  * For narrow characters, we expose the lookup table interface.
00120  */
00121 
00122 /* Internal bitmask macros, os-specific. */
00123 
00124 #if defined(__sgi)              /* IRIX */
00125 
00126 #define _Locale_S      0x00000008      /* Spacing character */
00127 #define _Locale_A      0x00004000      /* Alphabetical characters only */
00128 #define _Locale_B      0x00000040      /* Obsolete: was space char only */
00129 #define _Locale_PR     0x00008000      /* Printable characters only */
00130 #define _Locale_G      0x40000000      /* Graphic characters only */
00131 #define _Locale_BL     0x80000000      /* The blank character class */
00132 
00133 /* Public bitmask macros, must be defined for every OS. These values, of
00134  * course, are specific to IRIX. */
00135 
00136 #define _Locale_CNTRL  0x00000020      /* Control character */
00137 #define _Locale_UPPER  0x00000001      /* Upper case */
00138 #define _Locale_LOWER  0x00000002      /* Lower case */
00139 #define _Locale_DIGIT  0x00000004      /* Numeral (digit) */
00140 #define _Locale_XDIGIT 0x00000080      /* heXadecimal digit */
00141 #define _Locale_PUNCT  0x00000010      /* Punctuation */
00142 #define _Locale_SPACE  (_Locale_S | _Locale_BL)
00143 #define _Locale_PRINT  (_Locale_PUNCT | _Locale_UPPER | _Locale_LOWER | \
00144                         _Locale_DIGIT | _Locale_A | _Locale_XDIGIT | \
00145                         _Locale_PR)
00146 #define _Locale_ALPHA  _Locale_A
00147 
00148 /*
00149 * All of these except for graph and blank are from the C standard;
00150 * graph and blank are XPG4.  (graph in XPG4 doesn't mean quite the
00151 * same thing as graph in the C++ library)
00152 */
00153 
00154 #endif /* IRIX */
00155 
00156 
00157 #if defined( __Lynx__ )
00158  /* azov: On Lynx isalpha defined as (_U | _L), which gives us a mask 
00159   * unusable in ctype_table. So we have to redefine it and use hard-coded 
00160   * numbers (to avoid potential clashes if system headers change).
00161   *
00162   * P.S. Actually, I see no reason in using platform-specific masks - 
00163   * having just one set of masks for all platforms should work just as
00164   * well - we only use them internally and they don't have to be equal 
00165   * to whatever defined in local ctype.h
00166   *
00167   */ 
00168 #   define _Locale_CNTRL  040     /* _C, Control character */
00169 #   define _Locale_UPPER  01      /* _U, Upper case */
00170 #   define _Locale_LOWER  02      /* _L, Lower case */
00171 #   define _Locale_DIGIT  04      /* _N, Numeral (digit) */
00172 #   define _Locale_XDIGIT 0200    /* _X, heXadecimal digit */
00173 #   define _Locale_PUNCT  020     /* _P, Punctuation */
00174 #   define _Locale_SPACE  010     /* _S, Spacing */
00175 #   define _Locale_ALPHA  040000  /* none, Alphanumerical */
00176 #   define _Locale_PRINT  (_Locale_PUNCT | _Locale_UPPER | _Locale_LOWER | \
00177                            _Locale_DIGIT | _Locale_ALPHA | _Locale_XDIGIT |\
00178                            _Locale_SPACE ) /* Printable */
00179 # endif /* __Lynx__ */
00180 
00181 #if (defined(__GNUC__) && !defined (__SYMBIAN32__)) || defined (__BORLANDC__) || defined (__COMO__) || defined (__SYMBIAN32__)
00182 
00183 # if defined (__CYGWIN__) || defined (__SYMBIAN32__)
00184 
00185 #  define _Locale_CNTRL  040
00186 #  define _Locale_UPPER  02
00187 #  define _Locale_LOWER  01
00188 #  define _Locale_DIGIT  04
00189 #  define _Locale_XDIGIT ( 0100 | _Locale_DIGIT )
00190 #  define _Locale_PUNCT  020
00191 #  define _Locale_SPACE  010
00192 #  define _Locale_ALPHA  (_Locale_UPPER | _Locale_LOWER)
00193 #  define _Locale_PRINT  (_Locale_ALPHA | _Locale_DIGIT | _Locale_PUNCT | 0200 )
00194 
00195 # elif defined (__FreeBSD__)
00196 
00197 # define _Locale_CNTRL _CTYPE_C
00198 # define _Locale_UPPER _CTYPE_U
00199 # define _Locale_LOWER _CTYPE_L
00200 # define _Locale_DIGIT _CTYPE_D
00201 # define _Locale_XDIGIT _CTYPE_X
00202 # define _Locale_PUNCT _CTYPE_P
00203 # define _Locale_SPACE _CTYPE_S
00204 # define _Locale_PRINT _CTYPE_R
00205 # define _Locale_ALPHA _CTYPE_A
00206 
00207 # elif defined (__NetBSD__)
00208  
00209 # define _Locale_CNTRL _C
00210 # define _Locale_UPPER _U
00211 # define _Locale_LOWER _L
00212 # define _Locale_DIGIT _N
00213 # define _Locale_XDIGIT (_N|_X)
00214 # define _Locale_PUNCT _P
00215 # define _Locale_SPACE _S
00216 # define _Locale_PRINT (_P|_U|_L|_N|_B)
00217 # define _Locale_ALPHA (_U|_L)
00218 
00219 # elif defined(_STLP_USE_GLIBC) /* linux, using the gnu compiler */
00220 
00221 /* This section uses macros defined in the gnu libc ctype.h header */
00222 
00223 #  define _Locale_CNTRL  _IScntrl
00224 #  define _Locale_UPPER  _ISupper
00225 #  define _Locale_LOWER  _ISlower
00226 #  define _Locale_DIGIT  _ISdigit
00227 #  define _Locale_XDIGIT _ISxdigit
00228 #  define _Locale_PUNCT  _ISpunct
00229 #  define _Locale_SPACE  _ISspace
00230 #  define _Locale_PRINT  _ISprint
00231 #  define _Locale_ALPHA  _ISalpha
00232 
00233 #  endif /* GLIBC */
00234 
00235 #endif /* gnu */
00236 
00237 #if ( defined(__sun) && defined (__SVR4) ) \
00238     || (defined (__digital__) && defined (__unix__)) \
00239     || defined(_AIX)
00240 /* fbp : condition from AT&T code*/
00241 #if !(defined(__XPG4_CHAR_CLASS__) || defined(_XPG4_2) || \
00242     (defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4))) && ! defined (_ISCNTRL)
00243   /* fbp : on 2.5.1, the defines are different ;( */
00244   // # if ( defined (__sun) && defined (__SVR4) && ! defined (_ISCNTRL) )
00245 #   define _ISCNTRL _C
00246 #   define _ISUPPER _U
00247 #   define _ISLOWER _L
00248 #   define _ISDIGIT _N
00249 #   define _ISXDIGIT _X
00250 #   define _ISPUNCT _P
00251 #   define _ISSPACE _S
00252 #   define _ISPRINT (_P | _U | _L | _N | _B)
00253 #   define _ISALPHA (_U | _L)
00254 #  endif 
00255 
00256 #  define _Locale_CNTRL  _ISCNTRL
00257 #  define _Locale_UPPER  _ISUPPER
00258 #  define _Locale_LOWER  _ISLOWER
00259 #  define _Locale_DIGIT  _ISDIGIT
00260 #  define _Locale_XDIGIT _ISXDIGIT
00261 #  define _Locale_PUNCT  _ISPUNCT
00262 #  define _Locale_SPACE  _ISSPACE
00263 #  define _Locale_PRINT  _ISPRINT
00264 #  define _Locale_ALPHA  _ISALPHA
00265 #elif defined (__MWERKS__)
00266 #  define _Locale_CNTRL  __control_char
00267 #  define _Locale_UPPER  __upper_case
00268 #  define _Locale_LOWER  __lower_case
00269 #  define _Locale_DIGIT  __digit
00270 #  define _Locale_XDIGIT __hex_digit
00271 #  define _Locale_PUNCT  __punctuation
00272 #  define _Locale_SPACE  __space_char
00273 #  define _Locale_PRINT  __printable
00274 #  define _Locale_ALPHA  __alphanumeric
00275 #elif defined (__BORLANDC__)
00276 #  define _Locale_CNTRL  _IS_CTL
00277 #  define _Locale_UPPER  _IS_UPP
00278 #  define _Locale_LOWER  _IS_LOW
00279 #  define _Locale_DIGIT  _IS_DIG
00280 #  define _Locale_XDIGIT _IS_HEX
00281 #  define _Locale_PUNCT  _IS_PUN
00282 #  define _Locale_SPACE  _IS_SP
00283 #  define _Locale_PRINT  (_IS_SP|_IS_PUN|_IS_UPP|_IS_LOW|_IS_DIG)
00284 #  define _Locale_ALPHA  _IS_ALPHA
00285 #elif (defined (_MSC_VER)  && !defined (__SYMBIAN32__)) || defined (__MINGW32__)
00286 #  define _Locale_CNTRL  _CONTROL
00287 #  define _Locale_UPPER  _UPPER
00288 #  define _Locale_LOWER  _LOWER
00289 #  define _Locale_DIGIT  _DIGIT
00290 #  define _Locale_XDIGIT _HEX
00291 #  define _Locale_PUNCT  _PUNCT
00292 #  define _Locale_SPACE  _SPACE
00293 #  define _Locale_PRINT  (_ALPHA | _DIGIT | _BLANK | _PUNCT)
00294 // is this one has to be so complex ?  
00295 #  define _Locale_ALPHA  ( _ALPHA & ~ (_UPPER | _LOWER )) 
00296 #elif defined(__MRC__) || defined(__SC__)               //*TY 02/24/2000 - added support for MPW
00297 #  define _Locale_CNTRL  _CTL
00298 #  define _Locale_UPPER  _UPP
00299 #  define _Locale_LOWER  _LOW
00300 #  define _Locale_DIGIT  _DIG
00301 #  define _Locale_XDIGIT _HEX
00302 #  define _Locale_PUNCT  _PUN
00303 #  define _Locale_SPACE  _BLA
00304 #  define _Locale_PRINT  (_UPP | _LOW | _DIG | _PUN | _BLA)
00305 #  define _Locale_ALPHA  (_UPP | _LOW)
00306 #elif defined(__MLCCPP__)
00307 #  define _Locale_CNTRL    1
00308 #  define _Locale_UPPER    2
00309 #  define _Locale_LOWER    4
00310 #  define _Locale_DIGIT    8
00311 #  define _Locale_XDIGIT  16
00312 #  define _Locale_PUNCT   32
00313 #  define _Locale_SPACE   64
00314 #  define _Locale_PRINT  128
00315 #  define _Locale_ALPHA  256
00316 
00317 # elif defined (__GNUC__) && defined (__APPLE__) && !defined (__SYMBIAN32__)
00318  
00319 # define _Locale_CNTRL _C
00320 # define _Locale_UPPER _U
00321 # define _Locale_LOWER _L
00322 # define _Locale_DIGIT _D
00323 # define _Locale_XDIGIT _X
00324 # define _Locale_PUNCT _P
00325 # define _Locale_SPACE _S
00326 # define _Locale_PRINT _R
00327 # define _Locale_ALPHA _A
00328 
00329 # elif defined (__hpux) || defined (__osf__)
00330  
00331 #   if defined(__HP_aCC) && !defined(_INCLUDE_HPUX_SOURCE)
00332 #     define _ISALPHA      0x001
00333 #     define _ISALNUM      0x002
00334 #     define _ISBLANK      0x004
00335 #     define _ISCNTRL      0x008
00336 #     define _ISDIGIT      0x010
00337 #     define _ISGRAPH      0x020
00338 #     define _ISLOWER      0x040
00339 #     define _ISPRINT      0x080
00340 #     define _ISPUNCT      0x100
00341 #     define _ISSPACE      0x200
00342 #     define _ISUPPER      0x400
00343 #     define _ISXDIGIT     0x800
00344 #  endif
00345 #  define _Locale_CNTRL  _ISCNTRL
00346 #  define _Locale_UPPER  _ISUPPER
00347 #  define _Locale_LOWER  _ISLOWER
00348 #  define _Locale_DIGIT  _ISDIGIT
00349 #  define _Locale_XDIGIT _ISXDIGIT
00350 #  define _Locale_PUNCT  _ISPUNCT
00351 #  define _Locale_SPACE  _ISSPACE
00352 #  define _Locale_PRINT  _ISPRINT
00353 #  define _Locale_ALPHA  _ISALPHA
00354 # elif defined (__MVS__) || defined(__OS400__)
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 (__QNXNTO__)  || defined (__WATCOMC__)
00365 # define _Locale_CNTRL _CNTRL
00366 # define _Locale_UPPER _UPPER
00367 # define _Locale_LOWER _LOWER
00368 # define _Locale_DIGIT _DIGIT
00369 # define _Locale_XDIGIT _XDIGT
00370 # define _Locale_PUNCT _PUNCT
00371 # define _Locale_SPACE _SPACE
00372 # define _Locale_PRINT _PRINT
00373 # define _Locale_ALPHA (_UPPER | _LOWER)
00374 #elif defined (__DJGPP)
00375 #  define _Locale_CNTRL  __dj_ISCNTRL
00376 #  define _Locale_UPPER  __dj_ISUPPER
00377 #  define _Locale_LOWER  __dj_ISLOWER
00378 #  define _Locale_DIGIT  __dj_ISDIGIT
00379 #  define _Locale_XDIGIT __dj_ISXDIGIT
00380 #  define _Locale_PUNCT  __dj_ISPUNCT
00381 #  define _Locale_SPACE  __dj_ISSPACE
00382 #  define _Locale_PRINT  __dj_ISPRINT
00383 #  define _Locale_ALPHA  __dj_ISALPHA
00384 #elif defined (_STLP_SCO_OPENSERVER)
00385 #  define _Locale_CNTRL _C
00386 #  define _Locale_UPPER _U
00387 #  define _Locale_LOWER _L
00388 #  define _Locale_DIGIT _N
00389 #  define _Locale_XDIGIT _X
00390 #  define _Locale_PUNCT _P
00391 #  define _Locale_SPACE _S
00392 #  define _Locale_PRINT _R
00393 #  define _Locale_ALPHA _A
00394 #endif
00395 
00396 # endif /* _STLP_C_LOCALE_H */

Generated on Mon Jun 5 10:20:45 2006 for Intelligence.kdevelop by  doxygen 1.4.6