1 /*---------------------------------------------------------------------------*
2   Project:  Dolphin OS Emulator on Microsoft Windows
3   File:     types.h
4 
5   Copyright 1998, 1999 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Log: types.h,v $
14   Revision 1.1.1.1  2005/12/29 06:53:27  hiratsu
15   Initial import.
16 
17   Revision 1.1.1.1  2005/05/12 02:41:07  yasuh-to
18   Ported from dolphin source tree.
19 
20 
21     8     2001/12/14 17:45 Shiki
22     Removed an extra token at end of #endif directive.
23 
24     7    2001/06/11 7:52p Tian
25     Integrated SN changes
26 
27     6     2001/03/05 7:41p Hashida
28     Changed !(EMU) -> !(EMU) && !(WIN32)
29 
30     5     2000/11/01 4:08p Shiki
31     Fixed EPPC -> !EMU.
32 
33     4     2000/11/01 3:19p Shiki
34     Removed #include "ansi_prefix.PPCEABI.bare.h"
35 
36     3     2000/10/27 10:21a Tian
37     Added SN
38 
39     2     2000/03/13 3:20p Shiki
40     Removed M_NUMBEROF().
41 
42     17    1999/10/25 1:57p Shiki
43     Enabled ATTRIBUTE_ALIGN macro for EPPC build.
44 
45     16    1999/10/13 2:10p Yasu
46     Added vf32 and vf64
47 
48     15    1999/09/16 11:28a Tian
49     Restored #ifndef BOOL.
50 
51     14    1999/09/15 6:13p Shiki
52     Revised not to define ATTRIBUTE_ALIGN both for EPPC and MACOS.
53 
54     13    1999/09/15 10:36a Hashida
55     Changed #ifndef BOOL to #ifndef X86
56 
57     12    1999/08/20 5:53p Shiki
58     Added volatile integer types.
59 
60     11    1999/07/07 10:40a Tian
61     Added X86 typedefs for GCC builds.
62 
63     10    1999/06/10 1:43p Tianli01
64     Added ATTRIBUTE_ALIGN for static variable alignment
65 
66     9     1999/06/04 3:03p Tianli01
67     Added DOLPHIN_ALIGNMENT
68 
69     8     1999/05/28 10:47a Mikepc
70 
71     7     1999/05/26 8:59a Shiki
72     Fixed #include <MacTypes.h>.
73 
74     6     1999/05/25 5:29p Shiki
75     Added the following lines:
76     #ifndef MACOS
77     #include <MacTypes.h>
78     #endif
79 
80     5     1999/05/11 4:42p Shiki
81     Refreshed include tree.
82 
83     3     1999/05/05 7:53p Shiki
84     Changed Ptr from void* to char*.
85 
86     2     1999/05/05 7:15p Tianli01
87     Ifdef-ed the EABI prefix header
88 
89     1     1999/04/30 12:49p Tianli01
90 
91     4     1999/04/20 5:58p Shiki
92     a) Revised the definitions of NULL and BOOL macro.
93     b) Prevent the definition of the Ptr type for MacOS.
94 
95     3     1999/03/26 2:04p Tianli01
96     Added BOOL/NULL only if undefined for PPC
97 
98     2     1999/03/09 1:25p Tianli01
99 
100     1     1999/03/09 11:37a Tianli01
101     Temporary floating point update.
102 
103     2     1999/03/04 2:18p Tianli01
104     testing
105 
106     1     1999/03/04 2:18p Tianli01
107     Initial check-in for testing
108 
109     1     1998/12/15 10:05p Shiki
110 
111   Change History:
112     1998/12/10  Shiki Okasaka   Revised to reflect the coding guidelines
113     1998/12/04  Shiki Okasaka   Created
114 
115   $NoKeywords: $
116  *---------------------------------------------------------------------------*/
117 
118 #ifndef __TYPES_H__
119 #define __TYPES_H__
120 
121 #ifdef MACOS
122 #include <MacTypes.h>
123 #endif
124 
125 #ifdef  __MWERKS__          // For MetroWerks compiler
126 typedef signed char         s8;
127 typedef signed short        s16;
128 typedef signed long         s32;
129 typedef signed long long    s64;
130 typedef unsigned char       u8;
131 typedef unsigned short      u16;
132 typedef unsigned long       u32;
133 typedef unsigned long long  u64;
134 #else       // __MWERKS__
135 #ifdef X86  // GCC
136 typedef unsigned long long  u64;
137 typedef   signed long long  s64;
138 typedef unsigned int        u32;
139 typedef   signed int        s32;
140 typedef unsigned short      u16;
141 typedef   signed short      s16;
142 typedef unsigned char       u8;
143 typedef   signed char       s8;
144 #else
145 #ifdef __SN__               // For SN
146 typedef   signed char       s8;
147 typedef   signed short      s16;
148 typedef   signed long       s32;
149 typedef   signed long long  s64;
150 typedef unsigned char       u8;
151 typedef unsigned short      u16;
152 typedef unsigned long       u32;
153 typedef unsigned long long  u64;
154 #else // __SN__
155 // win32 style
156 typedef __int8              s8;
157 typedef __int16             s16;
158 typedef __int32             s32;
159 typedef __int64             s64;
160 typedef unsigned __int8     u8;
161 typedef unsigned __int16    u16;
162 typedef unsigned __int32    u32;
163 typedef unsigned __int64    u64;
164 #endif      // __SN__
165 #endif      // X86
166 #endif      // __MWERKS__
167 
168 typedef volatile u8         vu8;
169 typedef volatile u16        vu16;
170 typedef volatile u32        vu32;
171 typedef volatile u64        vu64;
172 typedef volatile s8         vs8;
173 typedef volatile s16        vs16;
174 typedef volatile s32        vs32;
175 typedef volatile s64        vs64;
176 
177 typedef float               f32;
178 typedef double              f64;
179 typedef volatile f32        vf32;
180 typedef volatile f64        vf64;
181 
182 #ifndef MACOS
183 typedef char*               Ptr;
184 #endif
185 
186 #ifndef BOOL
187 typedef int                 BOOL;
188 #endif  // BOOL
189 
190 #ifndef TRUE
191 // Any non zero value is considered TRUE
192 #define TRUE                1
193 #endif  // TRUE
194 
195 #ifndef FALSE
196 #define FALSE               0
197 #endif  // FALSE
198 
199 #ifndef NULL
200 #ifdef  __cplusplus
201 #define NULL                0
202 #else   // __cplusplus
203 #define NULL                ((void *)0)
204 #endif  // __cplusplus
205 #endif  // NULL
206 
207 #define DOLPHIN_ALIGNMENT 32
208 
209 // Use the following pragma wherever specific alignment is required for
210 // static variables.
211 #if !defined(EMU) && !defined(WIN32)
212 #define ATTRIBUTE_ALIGN(num) __attribute__ ((aligned (num)))
213 #else
214 #define ATTRIBUTE_ALIGN(num)
215 #endif  // EMU
216 
217 // SN-Phil: AT ADDRESS MACRO
218 // Use the following pragma wherever a fixed address is required for
219 // static variables.
220 #ifdef __SN__
221 #define AT_ADDRESS(xyz) __attribute__((address((xyz))))
222 #else
223 #define AT_ADDRESS(xyz) : (xyz)
224 #endif // __SN__
225 
226 
227 #endif  // __TYPES_H__
228