1 /*****************************************************************************/ 2 /* */ 3 /* MACHINE.H */ 4 /* */ 5 /* (C) 1993-97 Ullrich von Bassewitz */ 6 /* Wacholderweg 14 */ 7 /* D-70597 Stuttgart */ 8 /* EMail: uz@ibb.schwaben.com */ 9 /* */ 10 /*****************************************************************************/ 11 12 13 14 // 15 // $Id$ 16 // 17 // $Log$ 18 // 19 // 20 21 22 23 #ifndef _MACHINE_H 24 #define _MACHINE_H 25 26 27 28 /*****************************************************************************/ 29 /* DOS */ 30 /*****************************************************************************/ 31 32 33 34 #ifdef DOS 35 36 // Endianess 37 #define CPU_LITTLE_ENDIAN 38 39 // File system supports drives 40 #define FILESYS_HAS_DRIVES 41 42 // data types 43 typedef int i16; // int with 16 bits 44 typedef unsigned u16; // unsigned with 16 bits 45 typedef long i32; // int with 32 bits 46 typedef unsigned long u32; // unsigned int with 32 bits 47 48 #endif 49 50 51 52 /*****************************************************************************/ 53 /* DOS programs using a 32 bit extender */ 54 /*****************************************************************************/ 55 56 57 58 #ifdef DOS32 59 60 // Endianess 61 #define CPU_LITTLE_ENDIAN 62 63 // File system supports drives 64 #define FILESYS_HAS_DRIVES 65 66 // data types 67 typedef short int i16; // int with 16 bits 68 typedef unsigned short u16; // unsigned with 16 bits 69 typedef int i32; // int with 32 bits 70 typedef unsigned u32; // unsigned int with 32 bits 71 72 #endif 73 74 75 76 /*****************************************************************************/ 77 /* OS/2 */ 78 /*****************************************************************************/ 79 80 81 82 #ifdef OS2 83 84 // Endianess 85 #define CPU_LITTLE_ENDIAN 86 87 // File system supports drives 88 #define FILESYS_HAS_DRIVES 89 90 // data types 91 typedef short int i16; // int with 16 bits 92 typedef unsigned short u16; // unsigned with 16 bits 93 typedef int i32; // int with 32 bits 94 typedef unsigned u32; // unsigned int with 32 bits 95 96 #endif 97 98 99 100 /*****************************************************************************/ 101 /* WINDOWS 95/NT */ 102 /*****************************************************************************/ 103 104 105 106 #ifdef NT 107 108 // Endianess 109 #define CPU_LITTLE_ENDIAN 110 111 // File system supports drives 112 #define FILESYS_HAS_DRIVES 113 114 // data types 115 typedef short int i16; // int with 16 bits 116 typedef unsigned short u16; // unsigned with 16 bits 117 typedef int i32; // int with 32 bits 118 typedef unsigned u32; // unsigned int with 32 bits 119 120 #endif 121 122 123 124 /*****************************************************************************/ 125 /* Novell Netware */ 126 /*****************************************************************************/ 127 128 129 130 #ifdef NETWARE 131 132 // Endianess 133 #define CPU_LITTLE_ENDIAN 134 135 // File system supports volumes 136 #define FILESYS_HAS_VOLUMES 137 138 // data types 139 typedef short int i16; // int with 16 bits 140 typedef unsigned short u16; // unsigned with 16 bits 141 typedef int i32; // int with 32 bits 142 typedef unsigned u32; // unsigned int with 32 bits 143 144 #endif 145 146 147 148 /*****************************************************************************/ 149 /* SVR4 (Unixware, etc.) */ 150 /*****************************************************************************/ 151 152 153 154 #ifdef SVR4 155 156 // Uncomment one of the following 157 #define CPU_LITTLE_ENDIAN 158 // #define CPU_BIG_ENDIAN 159 160 // If your machine has no usleep, uncomment the following 161 // #define DONT_HAS_USLEEP 162 163 // data types 164 typedef short int i16; // int with 16 bits 165 typedef unsigned short u16; // unsigned with 16 bits 166 typedef int i32; // int with 32 bits 167 typedef unsigned u32; // unsigned int with 32 bits 168 169 #endif 170 171 172 173 /*****************************************************************************/ 174 /* Generic Unix - make your own entry after porting */ 175 /*****************************************************************************/ 176 177 178 179 #ifdef GENERIC_UNIX 180 181 // Uncomment one of the following 182 #define CPU_LITTLE_ENDIAN 183 // #define CPU_BIG_ENDIAN 184 185 // If your machine has no usleep, uncomment the following 186 // #define DONT_HAS_USLEEP 187 188 // data types 189 typedef short int i16; // int with 16 bits 190 typedef unsigned short u16; // unsigned with 16 bits 191 typedef int i32; // int with 32 bits 192 typedef unsigned u32; // unsigned int with 32 bits 193 194 #endif 195 196 197 198 /*****************************************************************************/ 199 /* Linux */ 200 /*****************************************************************************/ 201 202 203 204 #ifdef LINUX 205 206 // Endianess. The following code is not very clean as it accesses a reserved 207 // implementation identifier, but there is no other way to determine byte 208 // order under Linux (known to me). 209 #include <bytesex.h> 210 #if __BYTE_ORDER == 1234 211 # define CPU_LITTLE_ENDIAN 212 #elif __BYTE_ORDER = 4321 213 # define CPU_BIG_ENDIAN 214 #elif 215 # error Byte order not defined! 216 #endif 217 218 // data types 219 typedef short int i16; // int with 16 bits 220 typedef unsigned short u16; // unsigned with 16 bits 221 typedef int i32; // int with 32 bits 222 typedef unsigned u32; // unsigned int with 32 bits 223 224 #endif 225 226 227 228 /*****************************************************************************/ 229 /* FreeBSD */ 230 /*****************************************************************************/ 231 232 233 234 #ifdef FREEBSD 235 236 #include <machine/endian.h> 237 #if (BYTE_ORDER == LITTLE_ENDIAN) 238 # define CPU_LITTLE_ENDIAN 239 #elif (BYTE_ORDER == BIG_ENDIAN) 240 # define CPU_BIG_ENDIAN 241 #else 242 # error Byte order not defined! 243 #endif 244 245 // data types 246 typedef short int i16; // int with 16 bits 247 typedef unsigned short u16; // unsigned with 16 bits 248 typedef int i32; // int with 32 bits 249 typedef unsigned u32; // unsigned int with 32 bits 250 251 #endif 252 253 254 255 /*****************************************************************************/ 256 /* HP/UX */ 257 /*****************************************************************************/ 258 259 260 261 #ifdef HPUX 262 263 #include <machine/param.h> 264 #ifdef _BIG_ENDIAN 265 # define CPU_BIG_ENDIAN 266 #else 267 # define CPU_LITTLE_ENDIAN 268 #endif 269 270 // data types 271 typedef short int i16; // int with 16 bits 272 typedef unsigned short u16; // unsigned with 16 bits 273 typedef int i32; // int with 32 bits 274 typedef unsigned u32; // unsigned int with 32 bits 275 276 #endif 277 278 279 280 /*****************************************************************************/ 281 /* NetBSD (Amiga) */ 282 /*****************************************************************************/ 283 284 285 286 #ifdef NETBSD 287 288 #include <machine/endian.h> 289 #if (BYTE_ORDER == LITTLE_ENDIAN) 290 # define CPU_LITTLE_ENDIAN 291 #elif (BYTE_ORDER == BIG_ENDIAN) 292 # define CPU_BIG_ENDIAN 293 #elif 294 # error Byte order not defined! 295 #endif 296 297 // data types 298 typedef short int i16; // int with 16 bits 299 typedef unsigned short u16; // unsigned with 16 bits 300 typedef int i32; // int with 32 bits 301 typedef unsigned u32; // unsigned int with 32 bits 302 303 #endif 304 305 306 307 /*****************************************************************************/ 308 /* Solaris */ 309 /*****************************************************************************/ 310 311 312 313 #ifdef SOLARIS 314 315 #include <sys/endian.h> 316 #ifdef _BIG_ENDIAN 317 # define CPU_BIG_ENDIAN 318 #else 319 # define CPU_LITTLE_ENDIAN 320 #endif 321 322 // data types 323 typedef short int i16; // int with 16 bits 324 typedef unsigned short u16; // unsigned with 16 bits 325 typedef int i32; // int with 32 bits 326 typedef unsigned int u32; // unsigned int with 32 bits 327 328 #endif 329 330 331 332 /*****************************************************************************/ 333 /* Some other defines that simplify things */ 334 /*****************************************************************************/ 335 336 337 338 #if defined (DOS) || defined (DOS32) || defined (OS2) || defined(NT) 339 #define DOSLIKE_OS 340 #elif !defined(NETWARE) 341 #define UNIXLIKE_OS 342 #endif 343 344 345 346 // End of MACHINE.H 347 348 #endif 349 350 351 352