ccollect:0.6.2->0.7.0
[nslu2-linux/optware.git] / sources / wpa-supplicant / typedefs.h
blob0d4d5819d74fffd8382416f3e51997283def9b3a
1 /*
2 * Copyright 2004, Broadcom Corporation
3 * All Rights Reserved.
4 *
5 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
6 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
8 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
9 * $Id$
12 #ifndef _TYPEDEFS_H_
13 #define _TYPEDEFS_H_
16 /* Define 'SITE_TYPEDEFS' in the compile to include a site specific
17 * typedef file "site_typedefs.h".
19 * If 'SITE_TYPEDEFS' is not defined, then the "Inferred Typedefs"
20 * section of this file makes inferences about the compile environment
21 * based on defined symbols and possibly compiler pragmas.
23 * Following these two sections is the "Default Typedefs"
24 * section. This section is only prcessed if 'USE_TYPEDEF_DEFAULTS' is
25 * defined. This section has a default set of typedefs and a few
26 * proprocessor symbols (TRUE, FALSE, NULL, ...).
29 #ifdef SITE_TYPEDEFS
31 /*******************************************************************************
32 * Site Specific Typedefs
33 *******************************************************************************/
35 #include "site_typedefs.h"
37 #else
39 /*******************************************************************************
40 * Inferred Typedefs
41 *******************************************************************************/
43 /* Infer the compile environment based on preprocessor symbols and pramas.
44 * Override type definitions as needed, and include configuration dependent
45 * header files to define types.
48 #ifdef __cplusplus
50 #define TYPEDEF_BOOL
51 #ifndef FALSE
52 #define FALSE false
53 #endif
54 #ifndef TRUE
55 #define TRUE true
56 #endif
58 #else /* ! __cplusplus */
60 #if defined(_WIN32)
62 #define TYPEDEF_BOOL
63 typedef unsigned char bool; /* consistent w/BOOL */
65 #endif /* _WIN32 */
67 #endif /* ! __cplusplus */
69 /* use the Windows ULONG_PTR type when compiling for 64 bit */
70 #if defined(_WIN64)
71 #include <basetsd.h>
72 #define TYPEDEF_UINTPTR
73 typedef ULONG_PTR uintptr;
74 #endif
76 #ifdef _MSC_VER /* Microsoft C */
77 #define TYPEDEF_INT64
78 #define TYPEDEF_UINT64
79 typedef signed __int64 int64;
80 typedef unsigned __int64 uint64;
81 #endif
83 #if defined(MACOSX) && defined(KERNEL)
84 #define TYPEDEF_BOOL
85 #endif
88 #if defined(linux)
89 #define TYPEDEF_UINT
90 #define TYPEDEF_USHORT
91 #define TYPEDEF_ULONG
92 #endif
94 #if !defined(linux) && !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) && !defined(_HNDRTE_) && !defined(_MINOSL_)
95 #define TYPEDEF_UINT
96 #define TYPEDEF_USHORT
97 #endif
100 /* Do not support the (u)int64 types with strict ansi for GNU C */
101 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
102 #define TYPEDEF_INT64
103 #define TYPEDEF_UINT64
104 #endif
106 /* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
107 * for singned or unsigned */
108 #if defined(__ICL)
110 #define TYPEDEF_INT64
112 #if defined(__STDC__)
113 #define TYPEDEF_UINT64
114 #endif
116 #endif /* __ICL */
119 #if !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) && !defined(_HNDRTE_) && !defined(_MINOSL_)
121 /* pick up ushort & uint from standard types.h */
122 #if defined(linux) && defined(__KERNEL__)
124 #include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */
126 #else
128 #include <sys/types.h>
130 #endif
132 #endif /* !_WIN32 && !PMON && !_CFE_ && !_HNDRTE_ && !_MINOSL_ */
134 #if defined(MACOSX) && defined(KERNEL)
135 #include <IOKit/IOTypes.h>
136 #endif
139 /* use the default typedefs in the next section of this file */
140 #define USE_TYPEDEF_DEFAULTS
142 #endif /* SITE_TYPEDEFS */
145 /*******************************************************************************
146 * Default Typedefs
147 *******************************************************************************/
149 #ifdef USE_TYPEDEF_DEFAULTS
150 #undef USE_TYPEDEF_DEFAULTS
152 #ifndef TYPEDEF_BOOL
153 typedef /*@abstract@*/ unsigned char bool;
154 #endif
156 /*----------------------- define uchar, ushort, uint, ulong ------------------*/
158 #ifndef TYPEDEF_UCHAR
159 typedef unsigned char uchar;
160 #endif
162 #ifndef TYPEDEF_USHORT
163 typedef unsigned short ushort;
164 #endif
166 #ifndef TYPEDEF_UINT
167 typedef unsigned int uint;
168 #endif
170 #ifndef TYPEDEF_ULONG
171 typedef unsigned long ulong;
172 #endif
174 /*----------------------- define [u]int8/16/32/64, uintptr --------------------*/
176 #ifndef TYPEDEF_UINT8
177 typedef unsigned char uint8;
178 #endif
180 #ifndef TYPEDEF_UINT16
181 typedef unsigned short uint16;
182 #endif
184 #ifndef TYPEDEF_UINT32
185 typedef unsigned int uint32;
186 #endif
188 #ifndef TYPEDEF_UINT64
189 typedef unsigned long long uint64;
190 #endif
192 #ifndef TYPEDEF_UINTPTR
193 typedef unsigned int uintptr;
194 #endif
196 #ifndef TYPEDEF_INT8
197 typedef signed char int8;
198 #endif
200 #ifndef TYPEDEF_INT16
201 typedef signed short int16;
202 #endif
204 #ifndef TYPEDEF_INT32
205 typedef signed int int32;
206 #endif
208 #ifndef TYPEDEF_INT64
209 typedef signed long long int64;
210 #endif
212 /*----------------------- define float32/64, float_t -----------------------*/
214 #ifndef TYPEDEF_FLOAT32
215 typedef float float32;
216 #endif
218 #ifndef TYPEDEF_FLOAT64
219 typedef double float64;
220 #endif
223 * abstracted floating point type allows for compile time selection of
224 * single or double precision arithmetic. Compiling with -DFLOAT32
225 * selects single precision; the default is double precision.
228 #ifndef TYPEDEF_FLOAT_T
230 #if defined(FLOAT32)
231 typedef float32 float_t;
232 #else /* default to double precision floating point */
233 typedef float64 float_t;
234 #endif
236 #endif /* TYPEDEF_FLOAT_T */
238 /*----------------------- define macro values -----------------------------*/
240 #ifndef FALSE
241 #define FALSE 0
242 #endif
244 #ifndef TRUE
245 #define TRUE 1
246 #endif
248 #ifndef NULL
249 #define NULL 0
250 #endif
252 #ifndef OFF
253 #define OFF 0
254 #endif
256 #ifndef ON
257 #define ON 1
258 #endif
260 #define AUTO (-1)
262 /* Reclaiming text and data :
263 The following macros specify special linker sections that can be reclaimed
264 after a system is considered 'up'.
266 #if defined(__GNUC__) && defined(BCMRECLAIM)
267 extern bool bcmreclaimed;
268 #define BCMINITDATA(_data) __attribute__ ((__section__ (".dataini." #_data))) _data##_ini
269 #define BCMINITFN(_fn) __attribute__ ((__section__ (".textini." #_fn))) _fn##_ini
270 #define BCMINIT(_id) _id##_ini
271 #else
272 #define BCMINITDATA(_data) _data
273 #define BCMINITFN(_fn) _fn
274 #define BCMINIT(_id) _id
275 #define bcmreclaimed 0
276 #endif
278 /*----------------------- define PTRSZ, INLINE ----------------------------*/
280 #ifndef PTRSZ
281 #define PTRSZ sizeof (char*)
282 #endif
284 #ifndef INLINE
286 #ifdef _MSC_VER
288 #define INLINE __inline
290 #elif __GNUC__
292 #define INLINE __inline__
294 #else
296 #define INLINE
298 #endif /* _MSC_VER */
300 #endif /* INLINE */
302 #undef TYPEDEF_BOOL
303 #undef TYPEDEF_UCHAR
304 #undef TYPEDEF_USHORT
305 #undef TYPEDEF_UINT
306 #undef TYPEDEF_ULONG
307 #undef TYPEDEF_UINT8
308 #undef TYPEDEF_UINT16
309 #undef TYPEDEF_UINT32
310 #undef TYPEDEF_UINT64
311 #undef TYPEDEF_UINTPTR
312 #undef TYPEDEF_INT8
313 #undef TYPEDEF_INT16
314 #undef TYPEDEF_INT32
315 #undef TYPEDEF_INT64
316 #undef TYPEDEF_FLOAT32
317 #undef TYPEDEF_FLOAT64
318 #undef TYPEDEF_FLOAT_T
320 #endif /* USE_TYPEDEF_DEFAULTS */
322 #endif /* _TYPEDEFS_H_ */