2 Copyright © 2003, The AROS Development Team. All rights reserved.
6 #ifndef _MUIMASTER_SUPPORT_AMIGAOS_H_
7 #define _MUIMASTER_SUPPORT_AMIGAOS_H_
10 #include <exec/types.h>
13 #ifndef INTUITION_CLASSES_H
14 #include <intuition/classes.h>
17 #ifndef AMIGA_COMILER_H
18 #include <amiga_compiler.h>
21 #ifndef PROTO_UTILITY_H
22 #include <proto/utility.h>
25 /* These are the identity function under AmigaOS */
26 #define AROS_LONG2BE(x) (x)
27 #define AROS_BE2LONG(x) (x)
29 #define IMSPEC_EXTERNAL_PREFIX "MUI:Images/"
31 /* Define all classes as built in...should be moved out to config.h like file */
32 #define ZUNE_BUILTIN_ABOUTMUI 1
33 #define ZUNE_BUILTIN_BALANCE 1
34 #define ZUNE_BUILTIN_BOOPSI 1
35 #define ZUNE_BUILTIN_COLORADJUST 1
36 #define ZUNE_BUILTIN_COLORFIELD 1
37 #define ZUNE_BUILTIN_FRAMEADJUST 1
38 #define ZUNE_BUILTIN_FRAMEDISPLAY 1
39 #define ZUNE_BUILTIN_GAUGE 1
40 #define ZUNE_BUILTIN_ICONLISTVIEW 0
41 #define ZUNE_BUILTIN_IMAGEADJUST 1
42 #define ZUNE_BUILTIN_IMAGEDISPLAY 1
43 #define ZUNE_BUILTIN_PENADJUST 1
44 #define ZUNE_BUILTIN_PENDISPLAY 1
45 #define ZUNE_BUILTIN_POPASL 1
46 #define ZUNE_BUILTIN_POPFRAME 1
47 #define ZUNE_BUILTIN_POPIMAGE 1
48 #define ZUNE_BUILTIN_POPPEN 1
49 #define ZUNE_BUILTIN_RADIO 1
50 #define ZUNE_BUILTIN_SCALE 1
51 #define ZUNE_BUILTIN_SCROLLGROUP 1
52 #define ZUNE_BUILTIN_SETTINGSGROUP 1
53 #define ZUNE_BUILTIN_VIRTGROUP 1
67 #define AROS_STACKSIZE 65536
69 char *StrDup(const char *x
);
70 #ifdef __SASC /* PRIV */
71 size_t strlcat(char *buf
, const char *src
, size_t len
); /* PRIV */
73 Object
*DoSuperNewTagList(struct IClass
*cl
, Object
*obj
,void *dummy
, struct TagItem
*tags
);
74 Object
*VARARGS68K
DoSuperNewTags(struct IClass
*cl
, Object
*obj
, void *dummy
, ...);
75 int VARARGS68K
SPrintf(char *buf
, const char *fmt
, ...);
77 #ifdef __SASC /* PRIV */
78 #define snprintf SNPrintf /* PRIV */
79 #define sprintf SPrintf /* PRIV */
82 #ifdef __amigaos4__ /* PRIV */
83 #ifndef WritePixelArrayAlpha /* PRIV */
84 #define WritePixelArrayAlpha(srcRect, SrcX, SrcY, SrcMod, RastPort, DestX, DestY, SizeX, SizeY, globalAlpha) ICyberGfx->WritePixelArrayAlpha(srcRect, SrcX, SrcY, SrcMod, RastPort, DestX, DestY, SizeX, SizeY, globalAlpha) /* PRIV */
89 /*** HookEntry for OS4 (is only a dummy) ************************************/
91 ASM ULONG
HookEntry(REG(a0
, struct Hook
*hook
),REG(a2
, APTR obj
), REG(a1
, APTR msg
));
94 /*** OS4 Exec Interface support *********************************************/
96 #define EXEC_INTERFACE_DECLARE(x) x
97 #define EXEC_INTERFACE_GET_MAIN(interface,libbase) (interface = (void*)GetInterface(libbase,"main",1,NULL))
98 #define EXEC_INTERFACE_DROP(interface) DropInterface((struct Interface*)interface)
99 #define EXEC_INTERFACE_ASSIGN(a,b) (a = b)
101 #define EXEC_INTERFACE_DECLARE(x)
102 #define EXEC_INTERFACE_GET_MAIN(interface,libbase) 1
103 #define EXEC_INTERFACE_DROP(interface)
104 #define EXEC_INTERFACE_ASSIGN(a,b)
107 /*** AROS Exec extensions ***************************************************/
109 APTR
AllocVecPooled(APTR pool
, ULONG size
);
110 VOID
FreeVecPooled(APTR pool
, APTR memory
);
113 /*** AROS Intuition extensions **********************************************/
114 #define DeinitRastPort(rp)
115 #define CloneRastPort(rp) (rp)
116 #define FreeRastPort(rp)
118 /*** Miscellanous compiler supprot ******************************************/
126 # define SAVEDS __saveds
132 /*** Miscellanous AROS macros ***********************************************/
133 #define AROS_LIBFUNC_INIT
134 #define AROS_LIBBASE_EXT_DECL(a, b) extern a b;
135 #define AROS_LIBFUNC_EXIT
136 #define AROS_ASMSYMNAME(a) a
138 #define LC_BUILDNAME(x) x
139 #define LIBBASETYPEPTR struct Library *
141 /*** AROS types *************************************************************/
142 #ifndef __AROS_TYPES_DEFINED__
143 # define __AROS_TYPES_DEFINED__
144 typedef unsigned long IPTR
;
145 typedef long STACKLONG
;
146 typedef unsigned long STACKULONG
;
147 typedef void (*VOID_FUNC
)();
149 #endif /* __AROS_TYPES_DEFINED__ */
151 /*** AROS list macros *******************************************************/
152 #define ForeachNode(l,n) \
155 n=(void *)(((struct List *)(l))->lh_Head); \
156 ((struct Node *)(n))->ln_Succ; \
157 n=(void *)(((struct Node *)(n))->ln_Succ) \
160 /*** AROS register definitions **********************************************/
161 #define __REG_D0 __d0
162 #define __REG_D1 __d1
163 #define __REG_D2 __d2
164 #define __REG_D3 __d3
165 #define __REG_D4 __d4
166 #define __REG_D5 __d5
167 #define __REG_D6 __d6
168 #define __REG_D7 __d7
169 #define __REG_A0 __a0
170 #define __REG_A1 __a1
171 #define __REG_A2 __a2
172 #define __REG_A3 __a3
173 #define __REG_A4 __a4
174 #define __REG_A5 __a5
175 #define __REG_A6 __a6
176 #define __REG_A7 __a7
178 /*** AROS library function macros *******************************************/
179 #define AROS_LH0(rt, fn, bt, bn, lvo, p) \
180 ASM rt LIB_##fn (void)
181 #define AROS_LH1(rt, fn, a1, bt, bn, lvo, p) \
183 #define AROS_LH2(rt, fn, a1, a2, bt, bn, lvo, p) \
184 ASM rt LIB_##fn (a1, a2)
185 #define AROS_LH3(rt, fn, a1, a2, a3, bt, bn, lvo, p) \
186 ASM rt LIB_##fn (a1, a2, a3)
187 #define AROS_LH4(rt, fn, a1, a2, a3, a4, bt, bn, lvo, p) \
188 ASM rt LIB_##fn (a1, a2, a3, a4)
189 #define AROS_LH5(rt, fn, a1, a2, a3, a4, a5, bt, bn, lvo, p) \
190 ASM rt LIB_##fn (a1, a2, a3, a4, a5)
191 #define AROS_LH6(rt, fn, a1, a2, a3, a4, a5, a6, bt, bn, lvo, p) \
192 ASM rt LIB_##fn (a1, a2, a3, a4, a5, a6)
193 #define AROS_LH7(rt, fn, a1, a2, a3, a4, a5, a6, a7, bt, bn, lvo, p) \
194 ASM rt LIB_##fn (a1, a2, a3, a4, a5, a6, a7)
195 #define AROS_LH8(rt, fn, a1, a2, a3, a4, a5, a6, a7, a8, bt, bn, lvo, p) \
196 ASM rt LIB_##fn (a1, a2, a3, a4, a5, a6, a7, a8)
199 # define AROS_LHA(type, name, reg) register __REG_##reg type name
201 # define AROS_LHA(type, name, reg) type name
204 /*** AROS user function macros **********************************************/
205 #define AROS_USERFUNC_INIT
206 #define AROS_USERFUNC_EXIT
208 #define AROS_UFH0(rt, fn) \
210 #define AROS_UFH1(rt, fn, a1) \
212 #define AROS_UFH2(rt, fn, a1, a2) \
214 #define AROS_UFH3(rt, fn, a1, a2, a3) \
215 ASM rt fn (a1, a2, a3)
216 #define AROS_UFH4(rt, fn, a1, a2, a3, a4) \
217 ASM rt fn (a1, a2, a3, a4)
218 #define AROS_UFH5(rt, fn, a1, a2, a3, a4, a5) \
219 ASM rt fn (a1, a2, a3, a4, a5)
220 #define AROS_UFH6(rt, fn, a1, a2, a3, a4, a5, a6) \
221 ASM rt fn (a1, a2, a3, a4, a5, a6)
222 #define AROS_UFH7(rt, fn, a1, a2, a3, a4, a5, a6, a7) \
223 ASM rt fn (a1, a2, a3, a4, a5, a6, a7)
224 #define AROS_UFH8(rt, fn, a1, a2, a3, a4, a5, a6, a7, a8) \
225 ASM rt fn (a1, a2, a3, a4, a5, a6, a7, a8)
227 #define AROS_UFH0S(rt, fn) \
228 ASM static rt fn (void)
229 #define AROS_UFH1S(rt, fn, a1) \
230 ASM static rt fn (a1)
231 #define AROS_UFH2S(rt, fn, a1, a2) \
232 ASM static rt fn (a1, a2)
233 #define AROS_UFH3S(rt, fn, a1, a2, a3) \
234 ASM static rt fn (a1, a2, a3)
235 #define AROS_UFH4S(rt, fn, a1, a2, a3, a4) \
236 ASM static rt fn (a1, a2, a3, a4)
237 #define AROS_UFH5S(rt, fn, a1, a2, a3, a4, a5) \
238 ASM static rt fn (a1, a2, a3, a4, a5)
239 #define AROS_UFH6S(rt, fn, a1, a2, a3, a4, a5, a6) \
240 ASM static rt fn (a1, a2, a3, a4, a5, a6)
241 #define AROS_UFH7S(rt, fn, a1, a2, a3, a4, a5, a6, a7) \
242 ASM static rt fn (a1, a2, a3, a4, a5, a6, a7)
243 #define AROS_UFH8S(rt, fn, a1, a2, a3, a4, a5, a6, a7, a8) \
244 ASM static rt fn (a1, a2, a3, a4, a5, a6, a7, a8)
247 # define AROS_UFHA(type, name, reg) register __REG_##reg type name
249 # define AROS_UFHA(type, name, reg) type name
252 #define AROS_UFP0 AROS_UFH0
253 #define AROS_UFP1 AROS_UFH1
254 #define AROS_UFP2 AROS_UFH2
255 #define AROS_UFP3 AROS_UFH3
256 #define AROS_UFP4 AROS_UFH4
257 #define AROS_UFP5 AROS_UFH5
258 #define AROS_UFP6 AROS_UFH6
259 #define AROS_UFP7 AROS_UFH7
260 #define AROS_UFP8 AROS_UFH8
262 #define AROS_UFPA AROS_UFHA
265 With the following define a typical dispatcher will looks like this:
266 BOOPSI_DISPATCHER(IPTR,IconWindow_Dispatcher,cl,obj,msg)
268 #define BOOPSI_DISPATCHER(rettype,name,cl,obj,msg) \
269 AROS_UFH3(SAVEDS rettype, name,\
270 AROS_UFHA(Class *, cl, A0),\
271 AROS_UFHA(Object *, obj, A2),\
272 AROS_UFHA(Msg , msg, A1)) {AROS_USERFUNC_INIT
273 #define BOOPSI_DISPATCHER_END AROS_USERFUNC_EXIT}
274 #define BOOPSI_DISPATCHER_PROTO(rettype,name,cl,obj,msg) \
275 AROS_UFP3(SAVEDS rettype, name,\
276 AROS_UFPA(Class *, cl, A0),\
277 AROS_UFPA(Object *, obj, A2),\
278 AROS_UFPA(Msg , msg, A1))
281 #endif /* _MUIMASTER_SUPPORT_AMIGAOS_H_ */