]> icculus.org git repositories - btb/d2x.git/blob - include/pstypes.h
remove rcs tags
[btb/d2x.git] / include / pstypes.h
1 /*
2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13
14 /*
15  *
16  * Common types for use in Miner
17  *
18  */
19
20 #ifndef _TYPES_H
21 #define _TYPES_H
22
23 //define a signed byte
24 typedef signed char sbyte;
25
26 //define unsigned types;
27 typedef unsigned char ubyte;
28 #if defined(_WIN32) || defined(macintosh)
29 typedef unsigned short ushort;
30 typedef unsigned int uint;
31 #endif
32
33 #if defined(_WIN32) || defined(__sun__) // platforms missing (u)int??_t
34 # include <SDL_types.h>
35 #elif defined(macintosh) // misses (u)int??_t and does not like SDL_types.h
36 # include <MacTypes.h>
37  typedef SInt16 int16_t;
38  typedef SInt32 int32_t;
39  typedef SInt64 int64_t;
40  typedef UInt16 uint16_t;
41  typedef UInt32 uint32_t;
42  typedef UInt64 uint64_t;
43 #endif // macintosh
44 #if defined(_WIN32) // platforms missing int??_t
45  typedef Sint16 int16_t;
46  typedef Sint32 int32_t;
47  typedef Sint64 int64_t;
48 #endif // defined(_WIN32)
49 #if defined(_WIN32) || defined(__sun__) // platforms missing uint??_t
50  typedef Uint16 uint16_t;
51  typedef Uint32 uint32_t;
52  typedef Uint64 uint64_t;
53 #endif // defined(_WIN32) || defined(__sun__)
54
55 #ifdef _MSC_VER
56 # include <stdlib.h> // this is where min and max are defined
57 #endif
58 #ifndef min
59 #define min(a,b) (((a)>(b))?(b):(a))
60 #endif
61 #ifndef max
62 #define max(a,b) (((a)<(b))?(b):(a))
63 #endif
64
65 #ifdef _WIN32
66 # ifndef __MINGW32__
67 #  define PATH_MAX _MAX_PATH
68 # endif
69 # define FNAME_MAX 256
70 #elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
71 # include <sys/types.h>
72 # ifndef PATH_MAX
73 #  define PATH_MAX 1024
74 # endif
75 # define FNAME_MAX 256
76 #elif defined __DJGPP__
77 # include <sys/types.h>
78 # define FNAME_MAX 9    // excluding extension
79 #elif defined(macintosh)
80 # define PATH_MAX 256
81 # define FNAME_MAX 32
82 #endif
83
84 #ifndef __cplusplus
85 //define a boolean
86 typedef ubyte bool;
87 #endif
88
89 #ifndef NULL
90 #define NULL 0
91 #endif
92
93 // the following stuff has nothing to do with types but needed everywhere,
94 // and since this file is included everywhere, it's here.
95 #ifdef __GNUC__
96 # define __pack__ __attribute__((packed))
97 #elif defined(_MSC_VER)
98 # pragma pack(push, packing)
99 # pragma pack(1)
100 # define __pack__
101 #elif defined(macintosh)
102 # pragma options align=packed
103 # define __pack__
104 #else
105 # error d2x will not work without packed structures
106 #endif
107
108 #ifdef _MSC_VER
109 # define inline __inline
110 #endif
111
112 #ifndef PACKAGE_STRING
113 # define PACKAGE_STRING "d2x"
114 #endif
115
116 #endif //_TYPES_H
117