2 ** $VER: compiler.h 37.31 (18.3.98)
4 ** Compiler independent register (and SAS/C extensions) handling
6 ** (C) Copyright 1997-98 Andreas R. Kleinert
7 ** All Rights Reserved.
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. */
21 # define SEGLISTPTR APTR
24 # define SEGLISTPTR BPTR
27 typedef struct SegList
* SEGLISTPTR
;
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 */
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
71 #ifdef __GNUC__ // ignore this switches of SAS/Storm
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")
109 /* for SAS/C we don't need this, for StormC this is done in the
110 makefile or projectfile */
113 /* ********************************************************************* */
116 /* ********************************************************************* */
117 /* Method 2: defining our own keywords */
121 # define REG(r) register __ ## r
123 # define SAVEDS __saveds
125 # define REGARGS __regargs
126 # define STDARGS __stdargs
127 # define ALIGNED __aligned
132 # define REG(r) register __ ## r
143 # define REG(r) register __ ## r
145 # define SAVEDS __saveds
167 # define GNUCREG(r) __asm( #r )
168 # define SAVEDS __saveds
170 # define REGARGS __regargs
171 # define STDARGS __stdargs
172 # define ALIGNED __aligned
177 /* VBCC ignore this switch */
199 # else /* any other compiler, to be added here */
211 # endif /* __GNUC__ */
212 # endif /* __STORM__ */
213 # endif /* __MAXON__ */
216 /* ********************************************************************* */
218 #endif /* COMPILER_H */