xref: /reactos/sdk/include/c++/stlport/stl/c_locale.h (revision c2c66aff)
1 /*
2  * Copyright (c) 1999
3  * Silicon Graphics Computer Systems, Inc.
4  *
5  * Copyright (c) 1999
6  * Boris Fomitchev
7  *
8  * This material is provided "as is", with absolutely no warranty expressed
9  * or implied. Any use is at your own risk.
10  *
11  * Permission to use or copy this software for any purpose is hereby granted
12  * without fee, provided the above notices are retained on all copies.
13  * Permission to modify the code and to distribute modified code is granted,
14  * provided the above notices are retained, and a notice that the code was
15  * modified is included with the above copyright notice.
16  *
17  */
18 
19 #ifndef _STLP_C_LOCALE_H
20 #define _STLP_C_LOCALE_H
21 
22 /*
23  * Implementation dependent definitions.
24  * Beware: This header is not a purely internal header, it is also included
25  * from the outside world when building the STLport library. So this header
26  * should not reference internal headers (stlport/stl/_*.h) directly.
27  */
28 #if defined (__sgi)
29 #  if defined (ROOT_65) /* IRIX 6.5.x */
30 #    include <sgidefs.h>
31 #    include <standards.h>
32 #    include <wchar.h>
33 #    include <ctype.h>
34 #  else /* IRIX pre-6.5 */
35 #    include <sgidefs.h>
36 #    include <standards.h>
37 #    if !defined(_SIZE_T) && !defined(_SIZE_T_)
38 #      define _SIZE_T
39 #      if (_MIPS_SZLONG == 32)
40 typedef unsigned int size_t;
41 #      endif
42 #      if (_MIPS_SZLONG == 64)
43 typedef unsigned long size_t;
44 #      endif
45 #    endif
46 #    if !defined (_WCHAR_T)
47 #      define _WCHAR_T
48 #      if (_MIPS_SZLONG == 32)
49 typedef long wchar_t;
50 #      endif
51 #      if (_MIPS_SZLONG == 64)
52 typedef __int32_t wchar_t;
53 #      endif
54 #    endif /* _WCHAR_T */
55 #    if !defined (_WINT_T)
56 #      define _WINT_T
57 #      if (_MIPS_SZLONG == 32)
58 typedef long wint_t;
59 #      endif
60 #      if (_MIPS_SZLONG == 64)
61 typedef __int32_t wint_t;
62 #      endif
63 #    endif /* _WINT_T */
64 #    if !defined (_MBSTATE_T)
65 #      define _MBSTATE_T
66 /* _MSC_VER check is here for historical reason and seems wrong as it is the macro defined
67  * by Microsoft compilers to give their version. But we are in a SGI platform section so it
68  * is weird. However _MSC_VER might also be a SGI compiler macro so we keep it this way.*/
69 #      if defined (_MSC_VER)
70 typedef int mbstate_t;
71 #      else
72 typedef char mbstate_t;
73 #      endif
74 #    endif /* _MBSTATE_T */
75 #  endif /* ROOT65 */
76 #elif defined (_STLP_USE_GLIBC)
77 #  include <ctype.h>
78 #endif
79 
80 /*
81  * GENERAL FRAMEWORK
82  */
83 
84 /*
85  * Opaque types, implementation (if there is one) depends
86  * on platform localisation API.
87  */
88 struct _Locale_ctype;
89 struct _Locale_codecvt;
90 struct _Locale_numeric;
91 struct _Locale_time;
92 struct _Locale_collate;
93 struct _Locale_monetary;
94 struct _Locale_messages;
95 
96 /*
97   Bitmask macros.
98 */
99 
100 /*
101  * For narrow characters, we expose the lookup table interface.
102  */
103 
104 #if defined (_STLP_USE_GLIBC)
105 /* This section uses macros defined in the gnu libc ctype.h header */
106 #  define _Locale_CNTRL  _IScntrl
107 #  define _Locale_UPPER  _ISupper
108 #  define _Locale_LOWER  _ISlower
109 #  define _Locale_DIGIT  _ISdigit
110 #  define _Locale_XDIGIT _ISxdigit
111 #  define _Locale_PUNCT  _ISpunct
112 #  define _Locale_SPACE  _ISspace
113 #  define _Locale_PRINT  _ISprint
114 #  define _Locale_ALPHA  _ISalpha
115 #else
116 /* Default values based on C++ Standard 22.2.1.
117  * Under Windows the localisation implementation take care of mapping its
118  * mask values to those internal values. For other platforms without real
119  * localization support we are free to use the most suitable values.*/
120 #  define _Locale_SPACE  0x0001
121 #  define _Locale_PRINT  0x0002
122 #  define _Locale_CNTRL  0x0004
123 #  define _Locale_UPPER  0x0008
124 #  define _Locale_LOWER  0x0010
125 #  define _Locale_ALPHA  0x0020
126 #  define _Locale_DIGIT  0x0040
127 #  define _Locale_PUNCT  0x0080
128 #  define _Locale_XDIGIT 0x0100
129 #endif
130 
131 #endif /* _STLP_C_LOCALE_H */
132