add casts to zune macros to silence some warnings
[tangerine.git] / workbench / libs / popupmenu / compiler.h
blobcdfaba1e29bfdb90457dc68fb4e80de5a05004ae
1 /*
2 ** $VER: compiler.h 37.31 (18.3.98)
3 **
4 ** Compiler independent register (and SAS/C extensions) handling
5 **
6 ** (C) Copyright 1997-98 Andreas R. Kleinert
7 ** All Rights Reserved.
8 */
10 #ifndef COMPILER_H
11 #define COMPILER_H
13 /* ============================================================
14 There have been problems how to define the seglist pointer
15 under AROS, AmigaOS or elsewhere in a unique (and still
16 working!) way. It seems to make sense to use a new, global
17 type definition for it. This is done here. */
19 #ifndef _AROS
20 # ifdef VBCC
21 # define SEGLISTPTR APTR
22 # else /* !VBCC */
23 # include <dos/dos.h>
24 # define SEGLISTPTR BPTR
25 # endif /* VBCC */
26 #else /* !_AROS */
27 typedef struct SegList * SEGLISTPTR;
28 #endif /* _AROS */
30 /* ============================================================ */
32 /* Basically, Amiga C compilers must try to reach the goal to be
33 as SAS/C compatible as possible. But on the other hand,
34 when porting AmigaOS to other platforms, one perhaps
35 can't expect GCC becoming fully SAS/C compatible...
37 There are two ways to make your sources portable:
39 - using non ANSI SAS/C statements and making these
40 "available" to the other compilers (re- or undefining)
41 - using replacements for SAS/C statements and smartly
42 redefining these for any compiler
44 The last mentioned is the most elegant, but may require to
45 rewrite your source codes, so this compiler include file
46 basically does offer both.
48 For some compilers, this may have been done fromout project or
49 makefiles for the first method (e.g. StormC) to ensure compileablity.
51 Basically, you should include this header file BEFORE any other stuff.
54 /* ********************************************************************* */
55 /* Method 1: redefining SAS/C keywords */
56 /* */
57 /* Sorry, this method does not work with register definitions for the current
58 gcc version (V2.7.2.1), as it expects register attributes after the parameter
59 description. (This is announced to be fixed with gcc V2.8.0).
60 Moreover the __asm keyword has another meaning with GCC.
61 Therefore ASM must be used. */
63 #ifdef __MAXON__ // ignore this switches of SAS/Storm
64 #define __aligned
65 #define __asm
66 #define __regargs
67 #define __saveds
68 #define __stdargs
69 #endif
71 #ifdef __GNUC__ // ignore this switches of SAS/Storm
72 #define __d0
73 #define __d1
74 #define __d2
75 #define __d3
76 #define __d4
77 #define __d5
78 #define __d6
79 #define __d7
80 #define __a0
81 #define __a1
82 #define __a2
83 #define __a3
84 #define __a4
85 #define __a5
86 #define __a6
87 #define __a7
88 #endif
90 #ifdef VBCC
91 #define __d0 __reg("d0")
92 #define __d1 __reg("d1")
93 #define __d2 __reg("d2")
94 #define __d3 __reg("d3")
95 #define __d4 __reg("d4")
96 #define __d5 __reg("d5")
97 #define __d6 __reg("d6")
98 #define __d7 __reg("d7")
99 #define __a0 __reg("a0")
100 #define __a1 __reg("a1")
101 #define __a2 __reg("a2")
102 #define __a3 __reg("a3")
103 #define __a4 __reg("a4")
104 #define __a5 __reg("a5")
105 #define __a6 __reg("a6")
106 #define __a7 __reg("a7")
107 #endif
109 /* for SAS/C we don't need this, for StormC this is done in the
110 makefile or projectfile */
112 /* */
113 /* ********************************************************************* */
116 /* ********************************************************************* */
117 /* Method 2: defining our own keywords */
118 /* */
119 #ifdef __SASC
121 # define REG(r) register __ ## r
122 # define GNUCREG(r)
123 # define SAVEDS __saveds
124 # define ASM __asm
125 # define REGARGS __regargs
126 # define STDARGS __stdargs
127 # define ALIGNED __aligned
129 #else
130 # ifdef __MAXON__
132 # define REG(r) register __ ## r
133 # define GNUCREG(r)
134 # define SAVEDS
135 # define ASM
136 # define REGARGS
137 # define STDARGS
138 # define ALIGNED
140 # else
141 # ifdef __STORM__
143 # define REG(r) register __ ## r
144 # define GNUCREG(r)
145 # define SAVEDS __saveds
146 # define ASM
147 # define REGARGS
148 # define STDARGS
149 # define ALIGNED
151 # else
152 # ifdef __GNUC__
154 # ifdef __AROS__
155 # define REG(r)
156 # define GNUCREG(r)
157 # define SAVEDS
158 # define ASM
159 # define REGARGS
160 # define STDARGS
161 # define ALIGNED
162 # define register
163 # define __saveds
164 # define __asm
165 # define chip
166 # else
167 # define REG(r)
168 # define GNUCREG(r) __asm( #r )
169 # define SAVEDS __saveds
170 # define ASM
171 # define REGARGS __regargs
172 # define STDARGS __stdargs
173 # define ALIGNED __aligned
174 # endif
176 # else
177 # ifdef VBCC
178 /* VBCC ignore this switch */
179 # define __aligned
180 # define __asm
181 # define __regargs
182 # define __saveds
183 # define __stdargs
184 # define __register
185 # define GNUCREG(r)
186 # define REG(r)
187 # define SAVEDS
188 # define ASM
189 # define REGARGS
190 # define STDARGS
191 # define ALIGNED
193 # else
194 # ifdef _DCC
195 # define __aligned
196 # define __stdargs
197 # define GNUCREG(r)
198 # define ASM
200 # else /* any other compiler, to be added here */
202 # define REG(r)
203 # define GNUCREG(r)
204 # define SAVEDS
205 # define ASM
206 # define REGARGS
207 # define STDARGS
208 # define ALIGNED
210 # endif /* _DCC */
211 # endif /* VBCC */
212 # endif /* __GNUC__ */
213 # endif /* __STORM__ */
214 # endif /* __MAXON__ */
215 #endif /* __SASC */
216 /* */
217 /* ********************************************************************* */
219 #endif /* COMPILER_H */