1 | #ifndef _STDDEF_H |
---|
2 | #ifndef _STDDEF_H_ |
---|
3 | #ifndef _ANSI_STDDEF_H |
---|
4 | #ifndef __STDDEF_H__ |
---|
5 | |
---|
6 | /* Any one of these symbols __need_* means that GNU libc |
---|
7 | wants us just to define one data type. So don't define |
---|
8 | the symbols that indicate this file's entire job has been done. */ |
---|
9 | #if (!defined(__need_wchar_t) && !defined(__need_size_t) \ |
---|
10 | && !defined(__need_ptrdiff_t) && !defined(__need_NULL)) |
---|
11 | #define _STDDEF_H |
---|
12 | #define _STDDEF_H_ |
---|
13 | /* snaroff@next.com says the NeXT needs this. */ |
---|
14 | #define _ANSI_STDDEF_H |
---|
15 | /* Irix 5.1 needs this. */ |
---|
16 | #define __STDDEF_H__ |
---|
17 | #endif |
---|
18 | |
---|
19 | #ifndef __sys_stdtypes_h |
---|
20 | /* This avoids lossage on SunOS but only if stdtypes.h comes first. |
---|
21 | There's no way to win with the other order! Sun lossage. */ |
---|
22 | |
---|
23 | /* On 4.3bsd-net2, make sure ansi.h is included, so we have |
---|
24 | one less case to deal with in the following. */ |
---|
25 | #if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__) |
---|
26 | #include <machine/ansi.h> |
---|
27 | #endif |
---|
28 | |
---|
29 | /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are |
---|
30 | defined if the corresponding type is *not* defined. |
---|
31 | FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */ |
---|
32 | #if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) |
---|
33 | #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_) |
---|
34 | #define _SIZE_T |
---|
35 | #endif |
---|
36 | #if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_) |
---|
37 | #define _PTRDIFF_T |
---|
38 | #endif |
---|
39 | /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_ |
---|
40 | instead of _WCHAR_T_. */ |
---|
41 | #if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_) |
---|
42 | #ifndef _BSD_WCHAR_T_ |
---|
43 | #define _WCHAR_T |
---|
44 | #endif |
---|
45 | #endif |
---|
46 | /* Undef _FOO_T_ if we are supposed to define foo_t. */ |
---|
47 | #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_) |
---|
48 | #undef _PTRDIFF_T_ |
---|
49 | #undef _BSD_PTRDIFF_T_ |
---|
50 | #endif |
---|
51 | #if defined (__need_size_t) || defined (_STDDEF_H_) |
---|
52 | #undef _SIZE_T_ |
---|
53 | #undef _BSD_SIZE_T_ |
---|
54 | #endif |
---|
55 | #if defined (__need_wchar_t) || defined (_STDDEF_H_) |
---|
56 | #undef _WCHAR_T_ |
---|
57 | #undef _BSD_WCHAR_T_ |
---|
58 | #endif |
---|
59 | #endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */ |
---|
60 | |
---|
61 | /* Sequent's header files use _PTRDIFF_T_ in some conflicting way. |
---|
62 | Just ignore it. */ |
---|
63 | #if defined (__sequent__) && defined (_PTRDIFF_T_) |
---|
64 | #undef _PTRDIFF_T_ |
---|
65 | #endif |
---|
66 | |
---|
67 | /* On VxWorks, <type/vxTypesBase.h> may have defined macros like |
---|
68 | _TYPE_size_t which will typedef size_t. fixincludes patched the |
---|
69 | vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is |
---|
70 | not defined, and so that defining this macro defines _GCC_SIZE_T. |
---|
71 | If we find that the macros are still defined at this point, we must |
---|
72 | invoke them so that the type is defined as expected. */ |
---|
73 | #if defined (TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_)) |
---|
74 | _TYPE_ptrdiff_t; |
---|
75 | #undef _TYPE_ptrdiff_t |
---|
76 | #endif |
---|
77 | #if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_)) |
---|
78 | _TYPE_size_t; |
---|
79 | #undef _TYPE_size_t |
---|
80 | #endif |
---|
81 | #if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_)) |
---|
82 | _TYPE_wchar_t; |
---|
83 | #undef _TYPE_wchar_t |
---|
84 | #endif |
---|
85 | |
---|
86 | /* In case nobody has defined these types, but we aren't running under |
---|
87 | GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and |
---|
88 | __WCHAR_TYPE__ have reasonable values. This can happen if the |
---|
89 | parts of GCC is compiled by an older compiler, that actually |
---|
90 | include gstddef.h, such as collect2. */ |
---|
91 | |
---|
92 | /* Signed type of difference of two pointers. */ |
---|
93 | |
---|
94 | /* Define this type if we are doing the whole job, |
---|
95 | or if we want this type in particular. */ |
---|
96 | #if defined (_STDDEF_H) || defined (__need_ptrdiff_t) |
---|
97 | #ifndef _PTRDIFF_T /* in case <sys/types.h> has defined it. */ |
---|
98 | #ifndef _T_PTRDIFF_ |
---|
99 | #ifndef _T_PTRDIFF |
---|
100 | #ifndef __PTRDIFF_T |
---|
101 | #ifndef _PTRDIFF_T_ |
---|
102 | #ifndef _BSD_PTRDIFF_T_ |
---|
103 | #ifndef ___int_ptrdiff_t_h |
---|
104 | #ifndef _GCC_PTRDIFF_T |
---|
105 | #define _PTRDIFF_T |
---|
106 | #define _T_PTRDIFF_ |
---|
107 | #define _T_PTRDIFF |
---|
108 | #define __PTRDIFF_T |
---|
109 | #define _PTRDIFF_T_ |
---|
110 | #define _BSD_PTRDIFF_T_ |
---|
111 | #define ___int_ptrdiff_t_h |
---|
112 | #define _GCC_PTRDIFF_T |
---|
113 | #ifndef __PTRDIFF_TYPE__ |
---|
114 | #define __PTRDIFF_TYPE__ long int |
---|
115 | #endif |
---|
116 | typedef __PTRDIFF_TYPE__ ptrdiff_t; |
---|
117 | #endif /* _GCC_PTRDIFF_T */ |
---|
118 | #endif /* ___int_ptrdiff_t_h */ |
---|
119 | #endif /* _BSD_PTRDIFF_T_ */ |
---|
120 | #endif /* _PTRDIFF_T_ */ |
---|
121 | #endif /* __PTRDIFF_T */ |
---|
122 | #endif /* _T_PTRDIFF */ |
---|
123 | #endif /* _T_PTRDIFF_ */ |
---|
124 | #endif /* _PTRDIFF_T */ |
---|
125 | |
---|
126 | /* If this symbol has done its job, get rid of it. */ |
---|
127 | #undef __need_ptrdiff_t |
---|
128 | |
---|
129 | #endif /* _STDDEF_H or __need_ptrdiff_t. */ |
---|
130 | |
---|
131 | /* Unsigned type of `sizeof' something. */ |
---|
132 | |
---|
133 | /* Define this type if we are doing the whole job, |
---|
134 | or if we want this type in particular. */ |
---|
135 | #if defined (_STDDEF_H) || defined (__need_size_t) |
---|
136 | #ifndef _SIZE_T /* in case <sys/types.h> has defined it. */ |
---|
137 | #ifndef _SYS_SIZE_T_H |
---|
138 | #ifndef _T_SIZE_ |
---|
139 | #ifndef _T_SIZE |
---|
140 | #ifndef __SIZE_T |
---|
141 | #ifndef _SIZE_T_ |
---|
142 | #ifndef _BSD_SIZE_T_ |
---|
143 | #ifndef _SIZE_T_DEFINED_ |
---|
144 | #ifndef _SIZE_T_DEFINED |
---|
145 | #ifndef ___int_size_t_h |
---|
146 | #ifndef _GCC_SIZE_T |
---|
147 | #ifndef _SIZET_ |
---|
148 | #ifndef __size_t |
---|
149 | #define _SIZE_T |
---|
150 | #define _SYS_SIZE_T_H |
---|
151 | #define _T_SIZE_ |
---|
152 | #define _T_SIZE |
---|
153 | #define __SIZE_T |
---|
154 | #define _SIZE_T_ |
---|
155 | #define _BSD_SIZE_T_ |
---|
156 | #define _SIZE_T_DEFINED_ |
---|
157 | #define _SIZE_T_DEFINED |
---|
158 | #define ___int_size_t_h |
---|
159 | #define _GCC_SIZE_T |
---|
160 | #define _SIZET_ |
---|
161 | #define __size_t |
---|
162 | #ifndef __SIZE_TYPE__ |
---|
163 | #define __SIZE_TYPE__ long unsigned int |
---|
164 | #endif |
---|
165 | #if !(defined (__GNUG__) && defined (size_t)) |
---|
166 | typedef __SIZE_TYPE__ size_t; |
---|
167 | #endif /* !(defined (__GNUG__) && defined (size_t)) */ |
---|
168 | #endif /* __size_t */ |
---|
169 | #endif /* _SIZET_ */ |
---|
170 | #endif /* _GCC_SIZE_T */ |
---|
171 | #endif /* ___int_size_t_h */ |
---|
172 | #endif /* _SIZE_T_DEFINED */ |
---|
173 | #endif /* _SIZE_T_DEFINED_ */ |
---|
174 | #endif /* _BSD_SIZE_T_ */ |
---|
175 | #endif /* _SIZE_T_ */ |
---|
176 | #endif /* __SIZE_T */ |
---|
177 | #endif /* _T_SIZE */ |
---|
178 | #endif /* _T_SIZE_ */ |
---|
179 | #endif /* _SYS_SIZE_T_H */ |
---|
180 | #endif /* _SIZE_T */ |
---|
181 | #undef __need_size_t |
---|
182 | #endif /* _STDDEF_H or __need_size_t. */ |
---|
183 | |
---|
184 | |
---|
185 | /* Wide character type. |
---|
186 | Locale-writers should change this as necessary to |
---|
187 | be big enough to hold unique values not between 0 and 127, |
---|
188 | and not (wchar_t) -1, for each defined multibyte character. */ |
---|
189 | |
---|
190 | /* Define this type if we are doing the whole job, |
---|
191 | or if we want this type in particular. */ |
---|
192 | #if defined (_STDDEF_H) || defined (__need_wchar_t) |
---|
193 | #ifndef _WCHAR_T |
---|
194 | #ifndef _T_WCHAR_ |
---|
195 | #ifndef _T_WCHAR |
---|
196 | #ifndef __WCHAR_T |
---|
197 | #ifndef _WCHAR_T_ |
---|
198 | #ifndef _BSD_WCHAR_T_ |
---|
199 | #ifndef _WCHAR_T_DEFINED_ |
---|
200 | #ifndef _WCHAR_T_DEFINED |
---|
201 | #ifndef _WCHAR_T_H |
---|
202 | #ifndef ___int_wchar_t_h |
---|
203 | #ifndef __INT_WCHAR_T_H |
---|
204 | #ifndef _GCC_WCHAR_T |
---|
205 | #define _WCHAR_T |
---|
206 | #define _T_WCHAR_ |
---|
207 | #define _T_WCHAR |
---|
208 | #define __WCHAR_T |
---|
209 | #define _WCHAR_T_ |
---|
210 | #define _BSD_WCHAR_T_ |
---|
211 | #define _WCHAR_T_DEFINED_ |
---|
212 | #define _WCHAR_T_DEFINED |
---|
213 | #define _WCHAR_T_H |
---|
214 | #define ___int_wchar_t_h |
---|
215 | #define __INT_WCHAR_T_H |
---|
216 | #define _GCC_WCHAR_T |
---|
217 | |
---|
218 | /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_ |
---|
219 | instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other |
---|
220 | symbols in the _FOO_T_ family, stays defined even after its |
---|
221 | corresponding type is defined). If we define wchar_t, then we |
---|
222 | must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if |
---|
223 | we undef _WCHAR_T_, then we must also define rune_t, since |
---|
224 | headers like runetype.h assume that if machine/ansi.h is included, |
---|
225 | and _BSD_WCHAR_T_ is not defined, then rune_t is available. |
---|
226 | machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of |
---|
227 | the same type." */ |
---|
228 | #ifdef _BSD_WCHAR_T_ |
---|
229 | #undef _BSD_WCHAR_T_ |
---|
230 | #ifdef _BSD_RUNE_T_ |
---|
231 | #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE) |
---|
232 | typedef _BSD_RUNE_T_ rune_t; |
---|
233 | #endif |
---|
234 | #endif |
---|
235 | #endif |
---|
236 | |
---|
237 | #ifndef __WCHAR_TYPE__ |
---|
238 | #define __WCHAR_TYPE__ int |
---|
239 | #endif |
---|
240 | #ifndef __cplusplus |
---|
241 | typedef __WCHAR_TYPE__ wchar_t; |
---|
242 | #endif |
---|
243 | #endif |
---|
244 | #endif |
---|
245 | #endif |
---|
246 | #endif |
---|
247 | #endif |
---|
248 | #endif |
---|
249 | #endif |
---|
250 | #endif |
---|
251 | #endif |
---|
252 | #endif |
---|
253 | #endif |
---|
254 | #endif |
---|
255 | #undef __need_wchar_t |
---|
256 | #endif /* _STDDEF_H or __need_wchar_t. */ |
---|
257 | |
---|
258 | /* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc. |
---|
259 | are already defined. */ |
---|
260 | #ifdef _ANSI_H_ |
---|
261 | /* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_ |
---|
262 | are probably typos and should be removed before 2.8 is released. */ |
---|
263 | #ifdef _GCC_PTRDIFF_T_ |
---|
264 | #undef _PTRDIFF_T_ |
---|
265 | #undef _BSD_PTRDIFF_T_ |
---|
266 | #endif |
---|
267 | #ifdef _GCC_SIZE_T_ |
---|
268 | #undef _SIZE_T_ |
---|
269 | #undef _BSD_SIZE_T_ |
---|
270 | #endif |
---|
271 | #ifdef _GCC_WCHAR_T_ |
---|
272 | #undef _WCHAR_T_ |
---|
273 | #undef _BSD_WCHAR_T_ |
---|
274 | #endif |
---|
275 | /* The following ones are the real ones. */ |
---|
276 | #ifdef _GCC_PTRDIFF_T |
---|
277 | #undef _PTRDIFF_T_ |
---|
278 | #undef _BSD_PTRDIFF_T_ |
---|
279 | #endif |
---|
280 | #ifdef _GCC_SIZE_T |
---|
281 | #undef _SIZE_T_ |
---|
282 | #undef _BSD_SIZE_T_ |
---|
283 | #endif |
---|
284 | #ifdef _GCC_WCHAR_T |
---|
285 | #undef _WCHAR_T_ |
---|
286 | #undef _BSD_WCHAR_T_ |
---|
287 | #endif |
---|
288 | #endif /* _ANSI_H_ */ |
---|
289 | |
---|
290 | #endif /* __sys_stdtypes_h */ |
---|
291 | |
---|
292 | /* A null pointer constant. */ |
---|
293 | |
---|
294 | #if defined (_STDDEF_H) || defined (__need_NULL) |
---|
295 | #undef NULL /* in case <stdio.h> has defined it. */ |
---|
296 | #define NULL ((void *)0) |
---|
297 | #endif /* NULL not defined and <stddef.h> or need NULL. */ |
---|
298 | #undef __need_NULL |
---|
299 | |
---|
300 | #ifdef _STDDEF_H |
---|
301 | |
---|
302 | /* Offset of member MEMBER in a struct of type TYPE. */ |
---|
303 | |
---|
304 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) |
---|
305 | |
---|
306 | #endif /* _STDDEF_H was defined this time */ |
---|
307 | |
---|
308 | #endif /* __STDDEF_H__ was not defined before */ |
---|
309 | #endif /* _ANSI_STDDEF_H was not defined before */ |
---|
310 | #endif /* _STDDEF_H_ was not defined before */ |
---|
311 | #endif /* _STDDEF_H was not defined before */ |
---|