added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / workbench / classes / zune / betterstring / includes / SDI_compiler.h
blob81cd8dd57052dfc5f611b9afe366627beb688986
1 #ifndef SDI_COMPILER_H
2 #define SDI_COMPILER_H
4 /* Includeheader
6 Name: SDI_compiler.h
7 Versionstring: $VER: SDI_compiler.h 1.21 (28.02.2005)
8 Author: SDI & Jens Langner
9 Distribution: PD
10 Description: defines to hide compiler stuff
12 1.1 25.06.98 : created from data made by Gunter Nikl
13 1.2 17.11.99 : added VBCC
14 1.3 29.02.00 : fixed VBCC REG define
15 1.4 30.03.00 : fixed SAVEDS for VBCC
16 1.5 29.07.00 : added #undef statements (needed e.g. for AmiTCP together
17 with vbcc)
18 1.6 19.05.01 : added STACKEXT and Dice stuff
19 1.7 16.06.01 : added MorphOS specials and VARARGS68K
20 1.8 21.09.02 : added MorphOS register stuff
21 1.9 26.09.02 : added OFFSET macro. Thanks Frank Wille for suggestion
22 1.10 18.10.02 : reverted to old MorphOS-method for GCC
23 1.11 09.11.02 : added REGARGS define to MorphOS section
24 1.12 18.01.04 : some adaptions for AmigaOS4 compatibility
25 1.13 17.02.04 : changed ASM macros to be a simple define and added
26 INTERRUPT, CHIP and FAR
27 1.14 02.03.04 : added UNUSED which can be used to specify a function parameter
28 or variable as "unused" which will not cause any compiler warning.
29 1.15 02.03.04 : added special INLINE define for gcc > 3.0 version
30 1.17 07.03.04 : changed INLINE definition of gcc <= 2.95.3 to be static aswell.
31 1.18 21.06.04 : added USED and USED_VAR attribute to allow placing a
32 __attribute__((used)) to a function and a variable, taking care of
33 different compiler versions.
34 1.19 04.07.04 : register specification for variables is not supported on MorphOS,
35 so we modified the REG() macro accordingly.
36 1.20 28.02.05 : correct INLINE for VBCC.
37 1.21 28.02.05 : cleanup __GCC__ case.
41 ** This is PD (Public Domain). This means you can do with it whatever you want
42 ** without any restrictions. I only ask you to tell me improvements, so I may
43 ** fix the main line of this files as well.
45 ** To keep confusion level low: When changing this file, please note it in
46 ** above history list and indicate that the change was not made by myself
47 ** (e.g. add your name or nick name).
49 ** Jens Langner <Jens.Langner@light-speed.de> and
50 ** Dirk Stöcker <stoecker@epost.de>
53 #undef ASM
54 #undef REG
55 #undef LREG
56 #undef CONST
57 #undef SAVEDS
58 #undef INLINE
59 #undef REGARGS
60 #undef STDARGS
61 #undef OFFSET
62 #undef INTERRUPT
63 #undef CHIP
64 #undef FAR
65 #undef UNUSED
66 #undef USED
67 #undef USED_VAR
69 /* first "exceptions" */
71 #if defined(__MAXON__)
72 #define STDARGS
73 #define STACKEXT
74 #define REGARGS
75 #define SAVEDS
76 #define INLINE inline
77 #elif defined(__VBCC__)
78 #define STDARGS
79 #define STACKEXT
80 #define REGARGS
81 #if (__STDC__ == 1L) && (__STDC_VERSION__ >= 199901L)
82 #define INLINE inline
83 #else
84 #define INLINE static
85 #endif
86 #define OFFSET(p,m) __offsetof(struct p,m)
87 #if defined(__MORPHOS__)
88 #define REG(reg,arg) __reg(MOS__##reg) arg
90 /* NOTE: This assumes "quick native mode" when compiling libraries. */
91 #define MOS__a0 "r24"
92 #define MOS__a1 "r25"
93 #define MOS__a2 "r26"
94 #define MOS__a3 "r27"
95 #define MOS__a4 "r28"
96 #define MOS__a5 "r29"
97 #define MOS__a6 "r30"
98 /* #define MOS__a7 "r31" */
99 #define MOS__d0 "r16"
100 #define MOS__d1 "r17"
101 #define MOS__d2 "r18"
102 #define MOS__d3 "r19"
103 #define MOS__d4 "r20"
104 #define MOS__d5 "r21"
105 #define MOS__d6 "r22"
106 #define MOS__d7 "r23"
108 #else
109 #define REG(reg,arg) __reg(#reg) arg
110 #endif
111 #elif defined(__STORM__)
112 #define STDARGS
113 #define STACKEXT
114 #define REGARGS
115 #define INLINE inline
116 #elif defined(__SASC)
117 #define ASM __asm
118 #elif defined(__GNUC__)
119 #define UNUSED __attribute__((unused)) /* for functions, variables and types */
120 #define USED __attribute__((used)) /* for functions only! */
121 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
122 #define USED_VAR USED /* for variables only! */
123 #define INLINE static __inline __attribute__((always_inline))
124 #endif
125 /* we have to distinguish between AmigaOS4 and MorphOS */
126 #if defined(__PPC__) || defined(__AROS__)
127 #define REG(reg,arg) arg
128 #define SAVEDS
129 #define STDARGS
130 #define REGARGS
131 #define STACKEXT
132 #if defined(__MORPHOS__)
133 #define VARARGS68K __attribute__((varargs68k))
134 #endif
135 #define INTERRUPT
136 #define CHIP
137 #else
138 #define REG(reg,arg) arg __asm(#reg)
139 #define LREG(reg,arg) register REG(reg,arg)
140 #endif
141 #define FAR
142 #elif defined(_DCC)
143 #define REG(reg,arg) __##reg arg
144 #define STACKEXT __stkcheck
145 #define STDARGS __stkargs
146 #define INLINE static
147 #endif
149 /* then "common" ones */
151 #if !defined(ASM)
152 #define ASM
153 #endif
154 #if !defined(REG)
155 #define REG(reg,arg) register __##reg arg
156 #endif
157 #if !defined(LREG)
158 #define LREG(reg,arg) register arg
159 #endif
160 #if !defined(CONST)
161 #define CONST const
162 #endif
163 #if !defined(SAVEDS)
164 #define SAVEDS __saveds
165 #endif
166 #if !defined(INLINE)
167 #define INLINE static __inline
168 #endif
169 #if !defined(REGARGS)
170 #define REGARGS __regargs
171 #endif
172 #if !defined(STDARGS)
173 #define STDARGS __stdargs
174 #endif
175 #if !defined(STACKEXT)
176 #define STACKEXT __stackext
177 #endif
178 #if !defined(VARARGS68K)
179 #define VARARGS68K
180 #endif
181 #if !defined(OFFSET)
182 #define OFFSET(structName, structEntry) \
183 ((char *)(&(((struct structName *)0)->structEntry))-(char *)0)
184 #endif
185 #if !defined(INTERRUPT)
186 #define INTERRUPT __interrupt
187 #endif
188 #if !defined(CHIP)
189 #define CHIP __chip
190 #endif
191 #if !defined(FAR)
192 #define FAR __far
193 #endif
194 #if !defined(UNUSED)
195 #define UNUSED
196 #endif
197 #if !defined(USED)
198 #define USED
199 #endif
200 #if !defined(USED_VAR)
201 #define USED_VAR
202 #endif
203 #endif /* SDI_COMPILER_H */