Mixed tabs/spaces to spaces.
[AROS.git] / rom / isapnp / CompilerSpecific.h
blob9653f3c1995131bb3ed283ef08bd8dfa04c8ecef
1 #include <exec/types.h>
3 #ifdef __AROS__
4 #include <aros/debug.h>
5 #else
6 #define bug KPrintF
7 #endif
9 #ifndef COMPILERSPECIFIC_H
10 #define COMPILERSPECIFIC_H
12 ** $VER: CompilerSpecific.h 2.3 lcs (9.1.99)
14 ** Copyright (C) 1997 Bernardo Innocenti. All rights reserved.
16 ** Compiler specific definitions is here. You can add support
17 ** for other compilers in this header. Please return any changes
18 ** you make to me, so I can add them to my personal copy of this file.
20 ** Here is a short description of the macros defined below:
22 ** LIBCALL
23 ** Shared library entry point, with register args
25 ** HOOKCALL
26 ** Hook or boopsi dispatcher entry point with arguments
27 ** passed in registers
29 ** INLINE
30 ** Please put function body inline to the calling code
32 ** STDARGS
33 ** Function uses standard C conventions for arguments
35 ** ASMCALL
36 ** Function takes arguments in the specified 68K registers
38 ** REGCALL
39 ** Function takes arguments in registers choosen by the compiler
41 ** CONSTCALL
42 ** Function does not modify any global variable
44 ** FORMATCALL(archetype,string_index,first_to_check)
45 ** Function uses printf or scanf-like formatting
47 ** SAVEDS
48 ** Function needs to reload context for small data model
50 ** INTERRUPT
51 ** Function will be called from within an interrupt
53 ** NORETURN
54 ** Function does never return
56 ** ALIGNED
57 ** Variable must be aligned to longword boundaries
59 ** CHIP
60 ** Variable must be stored in CHIP RAM
62 ** REG(reg,arg)
63 ** Put argument <arg> in 68K register <reg>
65 ** min(a,b)
66 ** Return the minimum between <a> and <b>
68 ** max(a,b)
69 ** Return the maximum between <a> and <b>
71 ** abs(a)
72 ** Return the absolute value of <a>
74 ** _COMPILED_WITH
75 ** A string containing the name of the compiler
78 #ifdef __SASC
79 /* SAS/C 6.58 or better */
81 #define INLINE static __inline
82 #define STDARGS __stdargs
83 #define ASMCALL __asm
84 #define REGCALL __regcall
85 #define CONSTCALL /* unsupported */
86 #define FORMATCALL /* unsupported */
87 #define SAVEDS __saveds
88 #define INTERRUPT __interrupt
89 #define NORETURN /* unsupported */
90 #define ALIGNED __aligned
91 #define CHIP __chip
92 #define REG(reg,arg) register __##reg arg
93 #define _COMPILED_WITH "SAS/C"
95 /* For min(), max() and abs() */
96 #define USE_BUILTIN_MATH
97 #include <string.h>
98 #else
99 #ifdef __GNUC__
100 /* GeekGadgets GCC 2.7.2.1 or better */
102 #define INLINE static inline
103 #define STDARGS __attribute__((stkparm))
104 #define ASMCALL /* nothing */
105 #define REGCALL /* nothing */
106 #define CONSTCALL __attribute__((const))
107 #define FORMATCALL(a,s,f) __attribute__((format(a,s,f)))
108 #define SAVEDS __attribute__((saveds))
109 #define INTERRUPT __attribute__((interrupt))
110 #define NORETURN __attribute__((noreturn))
111 #define ALIGNED __attribute__((aligned(4)))
112 #define CHIP __attribute__((chip))
113 #ifdef m68000
114 #define REG(reg,arg) arg __asm(#reg)
115 #else
116 #define REG(reg,arg) arg
117 #endif
118 #define _COMPILED_WITH "GCC"
120 #ifndef min
121 #define min(a,b) (((a)<(b))?(a):(b))
122 #endif
123 #ifndef max
124 #define max(a,b) (((a)>(b))?(a):(b))
125 #endif
126 #ifndef __AROS__
127 #ifndef abs
128 #define abs(a) (((a)>0)?(a):-(a))
129 #endif
130 #endif
132 #if 0
133 /* GCC produces code which calls these two functions
134 * to initialize and copy structures and arrays.
136 static inline void __attribute__((stkparm)) bzero (char *buf, int len)
137 { while (len--) *buf++ = 0; }
139 static inline void __attribute__((stkparm)) bcopy (char *src, char *dest, int len)
140 { while (len--) *dest++ = *src++; }
141 #endif
143 #else
144 #ifdef __STORM__
145 /* StormC 2.00.23 or better */
146 #define INLINE __inline
147 #define STDARGS /* nothing */
148 #define ASMCALL /* nothing */
149 #define REGCALL register
150 #define CONSTCALL /* unsupported */
151 #define FORMATCALL /* unsupported */
152 #define SAVEDS __saveds
153 #define INTERRUPT __interrupt
154 #define NORETURN /* unsupported */
155 #define ALIGNED /* unsupported */
156 #define CHIP __chip
157 #define REG(reg,arg) register __##reg arg
158 #define _COMPILED_WITH "StormC"
160 #define min(a,b) (((a)<(b))?(a):(b))
161 #define max(a,b) (((a)>(b))?(a):(b))
162 #define abs(a) (((a)>0)?(a):-(a))
164 #define _INLINE_INCLUDES
165 #include <string.h>
166 #else
167 #ifdef __MAXON__
168 /* Maxon C/C++ */
170 #define INLINE static inline
171 #define STDARGS /* ? */
172 #define ASMCALL /* ? */
173 #define REGCALL /* ? */
174 #define CONSTCALL /* unsupported */
175 #define FORMATCALL /* unsupported */
176 #define SAVEDS __saveds
177 #define INTERRUPT __interrupt
178 #define NORETURN /* unsupported */
179 #define ALIGNED __aligned
180 #define REG(reg,arg) register __##reg arg
181 #define _COMPILED_WITH "Maxon C"
183 /* For min(), max() and abs() */
184 #define USE_BUILTIN_MATH
185 #include <string.h>
187 #error Maxon C compiler support is untested. Please check all the above definitions
188 #else
189 #ifdef _DCC
190 /* DICE C */
192 #define INLINE static __inline
193 #define STDARGS __stdargs
194 #define ASMCALL /* nothing */
195 #define REGCALL /* ? */
196 #define CONSTCALL /* unsupported */
197 #define FORMATCALL /* unsupported */
198 #define SAVEDS __geta4
199 #define INTERRUPT /* unsupported */
200 #define NORETURN /* unsupported */
201 #define ALIGNED __aligned
202 #define REG(reg,arg) __##reg arg
203 #define _COMPILED_WITH "DICE"
205 #ifndef min
206 #define min(a,b) (((a)<(b))?(a):(b))
207 #endif
208 #ifndef max
209 #define max(a,b) (((a)>(b))?(a):(b))
210 #endif
211 #ifndef abs
212 #define abs(a) (((a)>0)?(a):-(a))
213 #endif
215 #error DICE compiler support is untested. Please check all the above definitions
216 #else
217 #ifdef AZTEC_C
218 /* Aztec/Manx C */
220 #define INLINE static
221 #define STDARGS /* ? */
222 #define ASMCALL /* ? */
223 #define REGCALL /* ? */
224 #define CONSTCALL /* unsupported */
225 #define FORMATCALL /* unsupported */
226 #define SAVEDS __geta4
227 #define INTERRUPT /* unsupported */
228 #define NORETURN /* unsupported */
229 #define ALIGNED __aligned
230 #define REG(reg,arg) __##reg arg
231 #define _COMPILED_WITH "Manx C"
233 #ifndef min
234 #define min(a,b) (((a)<(b))?(a):(b))
235 #endif
236 #ifndef max
237 #define max(a,b) (((a)>(b))?(a):(b))
238 #endif
239 #ifndef abs
240 #define abs(a) (((a)>0)?(a):-(a))
241 #endif
243 #error Aztec/Manx C compiler support is untested. Please check all the above definitions
244 #else
245 #error Please add compiler specific definitions for your compiler
246 #endif
247 #endif
248 #endif
249 #endif
250 #endif
251 #endif
254 /* Special function attributes */
256 #define LIBCALL ASMCALL SAVEDS
257 #define HOOKCALL ASMCALL SAVEDS
260 /* AROS Compatibility: IPTR is a type which can store a pointer
261 * as well as a long integer.
263 #ifndef AROS_INTPTR_TYPE
264 #define AROS_INTPTR_TYPE long
265 typedef unsigned AROS_INTPTR_TYPE IPTR;
266 typedef signed AROS_INTPTR_TYPE SIPTR;
267 #endif /* AROS_INTPTR_TYPE */
271 #endif /* !COMPILERSPECIFIC_H */