1 #ifndef LIBCORE_COMPILER_H
2 #define LIBCORE_COMPILER_H
4 ** $VER: compiler.h 37.15 (14.8.97)
6 ** Compiler independent register (and SAS/C extensions) handling
8 ** (C) Copyright 1997 Andreas R. Kleinert
9 ** All Rights Reserved.
11 /* This might define __AROS__ */
13 # include <exec/types.h>
16 /* Basically, Amiga C compilers must reach the goal to be
17 as SAS/C compatible as possible. But on the other hand,
18 when porting AmigaOS to other platforms, one perhaps
19 can't expect GCC becoming fully SAS/C compatible...
21 There are two ways to make your sources portable:
23 - using non ANSI SAS/C statements and making these
24 "available" to the other compilers (re- or undefining)
25 - using replacements for SAS/C statements and smartly
26 redefining these for any compiler
28 The last mentioned is the most elegant, but may require to
29 rewrite your source codes, so this compiler include file
30 basically does offer both.
32 For some compilers, this may have been done fromout project or
33 makefiles for the first method (e.g. StormC) to ensure compileablity.
35 Basically, you should include this header file BEFORE any other stuff.
38 /* ********************************************************************* */
39 /* Method 1: redefining SAS/C keywords */
41 /* Sorry, this method does not work with register definitions for the current
42 gcc version (V2.7.2.1), as it expects register attributes after the parameter
43 description. (This is announced to be fixed with gcc V2.8.0).
44 Moreover the __asm keyword has another meaning with GCC.
45 Therefore ASM must be used. */
47 #ifdef __MAXON__ // ignore this switches of SAS/Storm
56 /* for SAS/C we don't need this, for StormC this is done in the
57 makefile or projectfile */
60 /* ********************************************************************* */
63 /* ********************************************************************* */
64 /* Method 2: defining our own keywords */
68 # define REG(r) register __ ## r
70 # define SAVEDS __saveds
72 # define REGARGS __regargs
73 # define STDARGS __stdargs
74 # define ALIGNED __aligned
79 # define REG(r) register __ ## r
90 # define REG(r) register __ ## r
92 # define SAVEDS __saveds
101 # ifndef __AROS__ /* No AROS ? */
104 # define GNUCREG(r) __asm( ## r)
105 # define SAVEDS __saveds
107 # define REGARGS __regargs
108 # define STDARGS __stdargs
109 # define ALIGNED __aligned
111 # else /* __AROS__ */
121 # endif /* __AROS__ */
123 # else /* any other compiler, to be added here */
133 # endif /* __GNUC__ */
134 # endif /* __STORM__ */
135 # endif /* __MAXON__ */
139 # include <aros/libcall.h>
158 # define _AROS_LHA(t,n,r) REG(r) t n GNUCREG (# r)
159 # define AROS_LHA(t,n,r) _AROS_LHA(t,n,r)
161 # define AROS_LH0(rettype,name,libBaseType,libBase,offset,libName) \
162 rettype SAVEDS ASM name (\
163 AROS_LHA(libBaseType,libBase,A6) \
166 # define AROS_LH1(rettype,name,a1,libBaseType,libBase,offset,libName) \
167 rettype SAVEDS ASM name (\
169 AROS_LHA(libBaseType,libBase,A6) \
172 # define AROS_LH2(rettype,name,a1,a2,libBaseType,libBase,offset,libName) \
173 rettype SAVEDS ASM name (\
176 AROS_LHA(libBaseType,libBase,A6) \
179 # define AROS_LH3(rettype,name,a1,a2,a3,libBaseType,libBase,offset,libName) \
180 rettype SAVEDS ASM name (\
184 AROS_LHA(libBaseType,libBase,A6) \
187 # define AROS_LP3 AROS_LH3
189 # define AROS_SLIB_ENTRY(n,s) n
195 /* ********************************************************************* */
196 #endif /* LIBCORE_COMPILER_H */