]> icculus.org git repositories - btb/d2x.git/blob - include/pstypes.h
get rid of redundant type
[btb/d2x.git] / include / pstypes.h
1 /* $Id: pstypes.h,v 1.33 2005-01-25 21:20:29 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  */
20
21 #ifndef _TYPES_H
22 #define _TYPES_H
23
24 //define a signed byte
25 typedef signed char sbyte;
26
27 //define unsigned types;
28 typedef unsigned char ubyte;
29 #if defined(_WIN32) || defined(macintosh)
30 typedef unsigned short ushort;
31 typedef unsigned int uint;
32 #endif
33
34 #if defined(_WIN32) || defined(__sun__) // platforms missing (u_)int??_t
35 # include <SDL_types.h>
36 #elif defined(macintosh) // misses (u_)int??_t and does not like SDL_types.h
37 # include <MacTypes.h>
38  typedef SInt16 int16_t;
39  typedef SInt32 int32_t;
40  typedef SInt64 int64_t;
41  typedef UInt16 u_int16_t;
42  typedef UInt32 u_int32_t;
43  typedef UInt64 u_int64_t;
44 #endif // macintosh
45 #if defined(_WIN32) // platforms missing int??_t
46  typedef Sint16 int16_t;
47  typedef Sint32 int32_t;
48  typedef Sint64 int64_t;
49 #endif // defined(_WIN32)
50 #if defined(_WIN32) || defined(__sun__) // platforms missing u_int??_t
51  typedef Uint16 u_int16_t;
52  typedef Uint32 u_int32_t;
53  typedef Uint64 u_int64_t;
54 #endif // defined(_WIN32) || defined(__sun__)
55
56 #ifdef _MSC_VER
57 # include <stdlib.h> // this is where min and max are defined
58 #endif
59 #ifndef min
60 #define min(a,b) (((a)>(b))?(b):(a))
61 #endif
62 #ifndef max
63 #define max(a,b) (((a)<(b))?(b):(a))
64 #endif
65
66 #ifdef _WIN32
67 # ifndef __MINGW32__
68 #  define PATH_MAX _MAX_PATH
69 # endif
70 # define FNAME_MAX 256
71 #elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
72 # include <sys/types.h>
73 # ifndef PATH_MAX
74 #  define PATH_MAX 1024
75 # endif
76 # define FNAME_MAX 256
77 #elif defined __DJGPP__
78 # include <sys/types.h>
79 # define FNAME_MAX 9    // excluding extension
80 #elif defined(macintosh)
81 # define PATH_MAX 256
82 # define FNAME_MAX 32
83 #endif
84
85 #ifndef __cplusplus
86 //define a boolean
87 typedef ubyte bool;
88 #endif
89
90 #ifndef NULL
91 #define NULL 0
92 #endif
93
94 // the following stuff has nothing to do with types but needed everywhere,
95 // and since this file is included everywhere, it's here.
96 #ifdef __GNUC__
97 # define __pack__ __attribute__((packed))
98 #elif defined(_MSC_VER)
99 # pragma pack(push, packing)
100 # pragma pack(1)
101 # define __pack__
102 #elif defined(macintosh)
103 # pragma options align=packed
104 # define __pack__
105 #else
106 # error d2x will not work without packed structures
107 #endif
108
109 #ifdef _MSC_VER
110 # define inline __inline
111 #endif
112
113 #ifndef PACKAGE_STRING
114 # define PACKAGE_STRING "d2x"
115 #endif
116
117 #endif //_TYPES_H
118