Print this page
2964 need POSIX 2008 locale object support
Reviewed by: Robert Mustacchi <rm@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/iso/stdlib_iso.h
+++ new/usr/src/head/iso/stdlib_iso.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 +/*
27 + * Copyright 2013 Garrett D'Amore <garrett@damore.org>
28 + */
26 29
27 30 /* Copyright (c) 1988 AT&T */
28 31 /* All Rights Reserved */
29 32
30 33
31 34 /*
32 35 * An application should not include this header directly. Instead it
33 36 * should be included only through the inclusion of other Sun headers.
34 37 *
35 38 * The contents of this header is limited to identifiers specified in the
36 39 * C Standard. Any new identifiers specified in future amendments to the
37 40 * C Standard must be placed in this header. If these new identifiers
38 41 * are required to also be in the C++ Standard "std" namespace, then for
39 42 * anything other than macro definitions, corresponding "using" directives
40 43 * must also be added to <locale.h>.
41 44 */
42 45
↓ open down ↓ |
7 lines elided |
↑ open up ↑ |
43 46 #ifndef _ISO_STDLIB_ISO_H
44 47 #define _ISO_STDLIB_ISO_H
45 48
46 49 #include <sys/feature_tests.h>
47 50
48 51 #ifdef __cplusplus
49 52 extern "C" {
50 53 #endif
51 54
52 55 #if defined(__STDC__)
53 -extern unsigned char __ctype[];
54 -#define MB_CUR_MAX __ctype[520]
56 +unsigned char __mb_cur_max(void);
55 57 #else
56 -extern unsigned char _ctype[];
57 -#define MB_CUR_MAX _ctype[520]
58 +unsigned char __mb_cur_max();
58 59 #endif
60 +#ifndef MB_CUR_MAX
61 +#define MB_CUR_MAX (__mb_cur_max())
62 +#endif
59 63
60 64 #if __cplusplus >= 199711L
61 65 namespace std {
62 66 #endif
63 67
64 68 typedef struct {
65 69 int quot;
66 70 int rem;
67 71 } div_t;
68 72
69 73 typedef struct {
70 74 long quot;
71 75 long rem;
72 76 } ldiv_t;
73 77
74 78 #if !defined(_SIZE_T) || __cplusplus >= 199711L
75 79 #define _SIZE_T
76 80 #if defined(_LP64) || defined(_I32LPx)
77 81 typedef unsigned long size_t; /* size of something in bytes */
78 82 #else
79 83 typedef unsigned int size_t; /* (historical version) */
80 84 #endif
81 85 #endif /* !_SIZE_T */
82 86
83 87 #ifndef NULL
84 88 #if defined(_LP64)
85 89 #define NULL 0L
86 90 #else
87 91 #define NULL 0
88 92 #endif
89 93 #endif
90 94
91 95 #define EXIT_FAILURE 1
92 96 #define EXIT_SUCCESS 0
93 97 #define RAND_MAX 32767
94 98
95 99 /*
96 100 * wchar_t is a built-in type in standard C++ and as such is not
97 101 * defined here when using standard C++. However, the GNU compiler
98 102 * fixincludes utility nonetheless creates its own version of this
99 103 * header for use by gcc and g++. In that version it adds a redundant
100 104 * guard for __cplusplus. To avoid the creation of a gcc/g++ specific
101 105 * header we need to include the following magic comment:
102 106 *
103 107 * we must use the C++ compiler's type
104 108 *
105 109 * The above comment should not be removed or changed until GNU
106 110 * gcc/fixinc/inclhack.def is updated to bypass this header.
107 111 */
108 112 #if !defined(__cplusplus) || (__cplusplus < 199711L && !defined(__GNUG__))
109 113 #ifndef _WCHAR_T
110 114 #define _WCHAR_T
111 115 #if defined(_LP64)
112 116 typedef int wchar_t;
113 117 #else
114 118 typedef long wchar_t;
115 119 #endif
116 120 #endif /* !_WCHAR_T */
117 121 #endif /* !defined(__cplusplus) ... */
118 122
119 123 #if defined(__STDC__)
120 124
121 125 extern void abort(void) __NORETURN;
122 126 extern int abs(int);
123 127 extern int atexit(void (*)(void));
124 128 extern double atof(const char *);
125 129 extern int atoi(const char *);
126 130 extern long int atol(const char *);
127 131 extern void *bsearch(const void *, const void *, size_t, size_t,
128 132 int (*)(const void *, const void *));
129 133 #if __cplusplus >= 199711L && defined(__SUNPRO_CC)
130 134 extern "C++" {
131 135 void *bsearch(const void *, const void *, size_t, size_t,
132 136 int (*)(const void *, const void *));
133 137 }
134 138 #endif /* __cplusplus >= 199711L && defined(__SUNPRO_CC) */
135 139 extern void *calloc(size_t, size_t);
136 140 extern div_t div(int, int);
137 141 extern void exit(int)
138 142 __NORETURN;
139 143 extern void free(void *);
140 144 extern char *getenv(const char *);
141 145 extern long int labs(long);
142 146 extern ldiv_t ldiv(long, long);
143 147 extern void *malloc(size_t);
144 148 extern int mblen(const char *, size_t);
145 149 extern size_t mbstowcs(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
146 150 size_t);
147 151 extern int mbtowc(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
148 152 extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
149 153 #if __cplusplus >= 199711L && defined(__SUNPRO_CC)
150 154 extern "C++" {
151 155 void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
152 156 }
153 157 #endif /* __cplusplus >= 199711L && defined(__SUNPRO_CC) */
154 158 extern int rand(void);
155 159 extern void *realloc(void *, size_t);
156 160 extern void srand(unsigned int);
157 161 extern double strtod(const char *_RESTRICT_KYWD, char **_RESTRICT_KYWD);
158 162 extern long int strtol(const char *_RESTRICT_KYWD, char **_RESTRICT_KYWD, int);
159 163 extern unsigned long int strtoul(const char *_RESTRICT_KYWD,
160 164 char **_RESTRICT_KYWD, int);
161 165 extern int system(const char *);
162 166 extern int wctomb(char *, wchar_t);
163 167 extern size_t wcstombs(char *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
164 168 size_t);
165 169
166 170 #if __cplusplus >= 199711L
167 171 extern "C++" {
168 172 inline long abs(long _l) { return labs(_l); }
169 173 inline ldiv_t div(long _l1, long _l2) { return ldiv(_l1, _l2); }
170 174 }
171 175 #endif /* __cplusplus */
172 176
173 177 #else /* not __STDC__ */
174 178
175 179 extern void abort();
176 180 extern int abs();
177 181 extern int atexit();
178 182 extern double atof();
179 183 extern int atoi();
180 184 extern long int atol();
181 185 extern void *bsearch();
182 186 extern void *calloc();
183 187 extern div_t div();
184 188 extern void exit();
185 189 extern void free();
186 190 extern char *getenv();
187 191 extern long int labs();
188 192 extern ldiv_t ldiv();
189 193 extern void *malloc();
190 194 extern int mblen();
191 195 extern size_t mbstowcs();
192 196 extern int mbtowc();
193 197 extern void qsort();
194 198 extern int rand();
195 199 extern void *realloc();
196 200 extern void srand();
197 201 extern double strtod();
198 202 extern long int strtol();
199 203 extern unsigned long strtoul();
200 204 extern int system();
201 205 extern int wctomb();
202 206 extern size_t wcstombs();
203 207
204 208 #endif /* __STDC__ */
205 209
206 210 #if __cplusplus >= 199711L
207 211 }
208 212 #endif /* end of namespace std */
209 213
210 214 #ifdef __cplusplus
211 215 }
212 216 #endif
213 217
214 218 #endif /* _ISO_STDLIB_ISO_H */
↓ open down ↓ |
146 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX