1 #if !defined    (_TYPESIZE_H)
2 #define _TYPESIZE_H
3 
4 //
5 //  typesize.h                         written by tom schlangen
6 //  ----------                         modified by TJW
7 //                                     modified by SMS
8 //
9 //  this is an attempt to somewhat reduce problems by unifying
10 //  compiler dependend type sizes.
11 //
12 //  the basic set/list of unified types required to be present
13 //  for each compiler is:
14 //
15 //  --------+-----------------+-------+-----------------------
16 //  name    | description     | bytes | range
17 //  --------+-----------------+-------+-----------------------
18 //  CHAR    | signed char     | 1     | -128..127
19 //  UCHAR   | unsigned char   | 1     | 0..255
20 //  INT16   | signed word     | 2     | -32768..32767
21 //  UINT16  | unsigned word   | 2     | 0..65535
22 //  INT32   | signed dword    | 4     | -2147483648..2147483647
23 //  UINT32  | unsigned dword  | 4     | 0..4294967295
24 //  INT64   | signed qword    | 8     | -2^63..(2^63 - 1)
25 //  UINT64  | unsigned qword  | 8     | 0..(2^64 - 1)
26 //  --------+-----------------+-------+-----------------------
27 //
28 //  besides that, there are some further general purpose types
29 //  with guaranteed (either by ANSI C or by us) sizes/ranges.
30 //  these should be used with care, since beneath their
31 //  guaranteed size they are strictly compiler specific. so if
32 //  you use them, make sure you do so only within the
33 //  guaranteed range. also take care not to use them in byte-
34 //  aligned (`packed') structures, since the size of the re-
35 //  resulting structures may vary from compiler to compiler,
36 //  which may cause hazzard on in certain cases.
37 //
38 //  --------+-------------------------------------------------
39 //  name    | description
40 //  --------+-------------------------------------------------
41 //  INT     | general purpose compiler specific `signed int'.
42 //          | ANSI C guarantees at least 2 bytes,
43 //          | range -32768..32767 for this type.
44 //  UINT    | general purpose compiler specific `unsigned int',
45 //          | we guarantee at least 2 bytes,
46 //          | range 0..65535 for this type.
47 //  LONG    | general purpose compiler specific `signed long'.
48 //          | ANSI C * guarantees at least 4 bytes,
49 //          | range -2147483648..2147483647 for this type.
50 //  ULONG   | general purpose compiler specific `unsigned long'.
51 //          | we guarantee at least 4 bytes,
52 //          | range 0..4294967295 for this type.
53 //  --------+-------------------------------------------------
54 //
55 //  the following definition blocks are in alphabetical order
56 //  of the various compilers identification defines. please add
57 //  the definitions for your compiler, if not already present.
58 //
59 
60 #ifdef __OS2__
61 #define INCL_DOSPROCESS
62 #define INCL_DOSERRORS
63 #include <os2.h>
64 #endif
65 
66 #if defined ( __NT__ )
67 #define WIN32_LEAN_AND_MEAN
68 #define NOMSG
69 #define NOGDI
70 #include <windows.h>
71 #endif
72 
73 #ifdef __cplusplus
74 extern "C" {
75 #endif
76 
77 //  the EMX/GNU 32bit compilers
78 
79 #if defined(__EMX__)
80 #ifndef __OS2_H__       // os2.h defines it already
81 typedef          char       CHAR;               // 1 byte
82 typedef unsigned char      UCHAR;               // 1 byte
83 #endif
84 typedef          short      INT16;              // 2 byte
85 typedef unsigned short     UINT16;              // 2 byte
86 typedef          int        INT32;              // 4 byte
87 typedef unsigned int       UINT32;              // 4 byte
88 // --------------------------------------------------------------------------
89 #ifndef __OS2_H__       // os2.h defines it already
90 typedef          int        INT;                // 4 byte
91 typedef unsigned int       UINT;                // 4 byte
92 typedef          long       LONG;               // 4 byte
93 typedef unsigned long      ULONG;               // 4 byte
94 typedef          void       VOID;
95 #endif
96 #endif                                          // #if defined(__EMX__)
97 
98 #if (defined(__linux__) && !defined(__alpha)) || defined(__FreeBSD__) || defined(__DJGPP__) ||defined(__MINGW32__)
99 typedef          char       CHAR;               // 1 byte
100 typedef unsigned char      UCHAR;               // 1 byte
101 typedef          short      INT16;              // 2 byte
102 typedef unsigned short     UINT16;              // 2 byte
103 typedef          int        INT32;              // 4 byte
104 typedef unsigned int       UINT32;              // 4 byte
105 typedef          long long int INT64;           // 8 byte
106 typedef unsigned long long int UINT64;          // 8 byte
107 // --------------------------------------------------------------------------
108 typedef          int        INT;                // 4 byte
109 typedef unsigned int       UINT;                // 4 byte
110 typedef          long       LONG;               // 4 byte
111 typedef unsigned long      ULONG;               // 4 byte
112 typedef          void       VOID;
113 #endif
114 
115 /* Alpha AXP running Digital Unix (and possibly also Linux/Alpha?)
116    This is a 64 bit architecture */
117 #if defined(__alpha)
118 typedef          char       CHAR;               // 1 byte
119 typedef unsigned char      UCHAR;               // 1 byte
120 typedef          short      INT16;              // 2 byte
121 typedef unsigned short     UINT16;              // 2 byte
122 typedef          int        INT32;              // 4 byte
123 typedef unsigned int       UINT32;              // 4 byte
124 typedef          long       INT64;              // 8 byte
125 typedef unsigned long      UINT64;              // 8 byte
126 // --------------------------------------------------------------------------
127 typedef          int        INT;                // 4 byte
128 typedef unsigned int       UINT;                // 4 byte
129 typedef          long      LONG;                // 8 byte
130 typedef unsigned long      ULONG;               // 8 byte
131 typedef          void       VOID;
132 #endif
133 
134 
135 /* AIX using xlc or gcc. Unfortunately, the _AIX constant is also defined
136    on 64 bit RS/6000 machines. As I do not have such a thing available,
137    I do not know how to discern it from a 32 bit one, so the following will
138    probably not work there. */
139 
140 #if defined(_AIX)
141 typedef          char       CHAR;               // 1 byte
142 typedef unsigned char      UCHAR;               // 1 byte
143 typedef          short      INT16;              // 2 byte
144 typedef unsigned short     UINT16;              // 2 byte
145 typedef          int        INT32;              // 4 byte
146 typedef unsigned int       UINT32;              // 4 byte
147 // --------------------------------------------------------------------------
148 typedef          int        INT;                // 4 byte
149 typedef unsigned int       UINT;                // 4 byte
150 typedef          long       LONG;               // 4 byte
151 typedef unsigned long      ULONG;               // 4 byte
152 typedef          void       VOID;
153 #endif
154 
155 #if defined(__sun__)
156 typedef          char       CHAR;               // 1 byte
157 typedef unsigned char      UCHAR;               // 1 byte
158 typedef          short      INT16;              // 2 byte
159 typedef unsigned short     UINT16;              // 2 byte
160 typedef          int        INT32;              // 4 byte
161 typedef unsigned int       UINT32;              // 4 byte
162 // --------------------------------------------------------------------------
163 typedef          int        INT;                // 4 byte
164 typedef unsigned int       UINT;                // 4 byte
165 typedef          long       LONG;               // 4 byte
166 typedef unsigned long      ULONG;               // 4 byte
167 typedef          void       VOID;
168 #endif
169 
170 // the Borland compiler family - valid for DOS, OS/2 and Win32 versions
171 
172 #if defined(__BORLANDC__)
173 #ifndef __OS2_H__
174 typedef signed   char       CHAR;               // 1 byte
175 typedef unsigned char      UCHAR;               // 1 byte
176 #endif
177 typedef signed   short      INT16;              // 2 byte
178 typedef unsigned short     UINT16;              // 2 byte
179 typedef signed   long       INT32;              // 4 byte
180 typedef unsigned long      UINT32;              // 4 byte
181 // --------------------------------------------------------------------------
182 #ifndef __OS2_H__
183 typedef signed   int        INT;                // 2/4 byte
184 typedef unsigned int       UINT;                // 2/4 byte
185 typedef signed   long       LONG;               // 4 byte
186 typedef unsigned long      ULONG;               // 4 byte
187 #if !defined(NT) && !defined(__NT__) && !defined(WINNT)
188 typedef          void       VOID;
189 #endif
190 #endif
191 #endif                                          // #if defined(__BORLANDC__)
192 
193 
194 //  the IBM 32bit CSet/VAC++ compilers
195 
196 #if defined(__IBMC__) || defined(__IBMCPP__)
197 #ifndef __OS2_H__       // os2.h defines it already
198 typedef          char       CHAR;               // 1 byte
199 typedef unsigned char      UCHAR;               // 1 byte
200 #endif
201 typedef          short      INT16;              // 2 byte
202 typedef unsigned short     UINT16;              // 2 byte
203 typedef          int        INT32;              // 4 byte
204 typedef unsigned int       UINT32;              // 4 byte
205 // --------------------------------------------------------------------------
206 #ifndef __OS2_H__       // os2.h defines it already
207 typedef          int        INT;                // 4 byte
208 typedef unsigned int       UINT;                // 4 byte
209 typedef          long       LONG;               // 4 byte
210 typedef unsigned long      ULONG;               // 4 byte
211 typedef          void       VOID;
212 #endif
213 #endif                                          // #if defined(__IBMC(PP)__)
214 
215 //  the uSoft 16bit compiler family for DOS
216 
217 #if defined(_MSC_VER)
218 typedef          char       CHAR;               // 1 byte
219 typedef unsigned char      UCHAR;               // 1 byte
220 typedef          int       INT16;               // 2 byte
221 typedef unsigned int       UINT16;              // 2 byte
222 typedef          long       INT32;              // 4 byte
223 typedef unsigned long      UINT32;              // 4 byte
224 // --------------------------------------------------------------------------
225 typedef          int        INT;                // 2 byte
226 typedef unsigned int       UINT;                // 2 byte
227 typedef          long       LONG;               // 4 byte
228 typedef unsigned long      ULONG;               // 4 byte
229 typedef          void       VOID;
230 #endif                                          // #if defined(_MSC_VER)
231 
232 //  the Watcom 16/32bit compilers
233 
234 #if defined(__WATCOMC__)
235 #if !defined(__OS2_H__) && !defined(__NT__)  // os2.h and windows.h defines it already
236 typedef signed   char       CHAR;               // 1 byte
237 typedef unsigned char      UCHAR;               // 1 byte
238 #endif
239 typedef signed   short int  INT16;              // 2 byte
240 typedef unsigned short int UINT16;              // 2 byte
241 typedef signed   long  int  INT32;              // 4 byte
242 typedef unsigned long  int UINT32;              // 4 byte
243 // --------------------------------------------------------------------------
244 #if !defined(__OS2_H__) && !defined(__NT__)  // os2.h and windows.h defines it already
245 typedef signed   int        INT;                // 2/4 byte
246 typedef unsigned int       UINT;                // 2/4 byte
247 typedef signed   long       LONG;               // 4 byte
248 typedef unsigned long      ULONG;               // 4 byte
249 typedef          void       VOID;
250 #endif
251 #endif                                          // #if defined(__WATCOMC__)
252 
253 #ifdef __cplusplus
254 }
255 #endif
256 
257 #endif                                          // #if !defined(_TYPESIZE_H)
258 
259