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