Don't call InvertPixelArray with negative width and/or height.
[tangerine.git] / workbench / libs / muimaster / support_amigaos.h
blob64045acb38e17f710e7cc665a3768a7842d35711
1 /*
2 Copyright © 2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #ifndef _MUIMASTER_SUPPORT_AMIGAOS_H_
7 #define _MUIMASTER_SUPPORT_AMIGAOS_H_
9 #ifdef EXEC_TYPES_H
10 #include <exec/types.h>
11 #endif
13 #ifndef INTUITION_CLASSES_H
14 #include <intuition/classes.h>
15 #endif
17 #ifndef AMIGA_COMILER_H
18 #include <amiga_compiler.h>
19 #endif
21 #ifndef PROTO_UTILITY_H
22 #include <proto/utility.h>
23 #endif
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 1
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
55 #include <dos.h>
57 #ifndef PI
58 #define PI 3.1415
59 #endif
61 #ifndef M_PI
62 #define M_PI PI
63 #endif
65 char *StrDup(const char *x);
66 size_t strlcat(char *buf, const char *src, size_t len);
67 Object *DoSuperNewTagList(struct IClass *cl, Object *obj,void *dummy, struct TagItem *tags);
68 Object *VARARGS68K DoSuperNewTags(struct IClass *cl, Object *obj, void *dummy, ...);
69 int VARARGS68K SPrintf(char *buf, const char *fmt, ...);
71 #define snprintf SNPrintf /* PRIV */
72 #define sprintf SPrintf /* PRIV */
74 /*** HookEntry for OS4 (is only a dummy) ************************************/
75 #ifdef __amigaos4__
76 ASM ULONG HookEntry(REG(a0, struct Hook *hook),REG(a2, APTR obj), REG(a1, APTR msg));
77 #endif
79 /*** OS4 Exec Interface support *********************************************/
80 #ifdef __amigaos4__
81 #define EXEC_INTERFACE_DECLARE(x) x
82 #define EXEC_INTERFACE_GET_MAIN(interface,libbase) (interface = (void*)GetInterface(libbase,"main",1,NULL))
83 #define EXEC_INTERFACE_DROP(interface) DropInterface((struct Interface*)interface)
84 #define EXEC_INTERFACE_ASSIGN(a,b) (a = b)
85 #else
86 #define EXEC_INTERFACE_DECLARE(x)
87 #define EXEC_INTERFACE_GET_MAIN(interface,libbase) 1
88 #define EXEC_INTERFACE_DROP(interface)
89 #define EXEC_INTERFACE_ASSIGN(a,b)
90 #endif
92 /*** AROS Exec extensions ***************************************************/
93 #ifndef __amigaos4__
94 APTR AllocVecPooled(APTR pool, ULONG size);
95 VOID FreeVecPooled(APTR pool, APTR memory);
96 #endif
98 /*** AROS Intuition extensions **********************************************/
99 #define DeinitRastPort(rp)
100 #define CloneRastPort(rp) (rp)
101 #define FreeRastPort(rp)
103 /*** Miscellanous compiler supprot ******************************************/
104 #ifndef SAVEDS
105 # ifdef __MAXON__
106 # define __asm
107 # define __inline
108 # define SAVEDS
109 # define const
110 # else
111 # define SAVEDS __saveds
112 # endif
113 #endif
115 #define __stackparm
117 /*** Miscellanous AROS macros ***********************************************/
118 #define AROS_LIBFUNC_INIT
119 #define AROS_LIBBASE_EXT_DECL(a, b) extern a b;
120 #define AROS_LIBFUNC_EXIT
121 #define AROS_ASMSYMNAME(a) a
123 #define LC_BUILDNAME(x) x
124 #define LIBBASETYPEPTR struct Library *
126 /*** AROS types *************************************************************/
127 #ifndef __AROS_TYPES_DEFINED__
128 # define __AROS_TYPES_DEFINED__
129 typedef unsigned long IPTR;
130 typedef long STACKLONG;
131 typedef unsigned long STACKULONG;
132 typedef void (*VOID_FUNC)();
133 #endif /* __AROS_TYPES_DEFINED__ */
135 /*** AROS list macros *******************************************************/
136 #define ForeachNode(l,n) \
137 for \
139 n=(void *)(((struct List *)(l))->lh_Head); \
140 ((struct Node *)(n))->ln_Succ; \
141 n=(void *)(((struct Node *)(n))->ln_Succ) \
144 /*** AROS register definitions **********************************************/
145 #define __REG_D0 __d0
146 #define __REG_D1 __d1
147 #define __REG_D2 __d2
148 #define __REG_D3 __d3
149 #define __REG_D4 __d4
150 #define __REG_D5 __d5
151 #define __REG_D6 __d6
152 #define __REG_D7 __d7
153 #define __REG_A0 __a0
154 #define __REG_A1 __a1
155 #define __REG_A2 __a2
156 #define __REG_A3 __a3
157 #define __REG_A4 __a4
158 #define __REG_A5 __a5
159 #define __REG_A6 __a6
160 #define __REG_A7 __a7
162 /*** AROS library function macros *******************************************/
163 #define AROS_LH0(rt, fn, bt, bn, lvo, p) \
164 ASM rt LIB_##fn (void)
165 #define AROS_LH1(rt, fn, a1, bt, bn, lvo, p) \
166 ASM rt LIB_##fn (a1)
167 #define AROS_LH2(rt, fn, a1, a2, bt, bn, lvo, p) \
168 ASM rt LIB_##fn (a1, a2)
169 #define AROS_LH3(rt, fn, a1, a2, a3, bt, bn, lvo, p) \
170 ASM rt LIB_##fn (a1, a2, a3)
171 #define AROS_LH4(rt, fn, a1, a2, a3, a4, bt, bn, lvo, p) \
172 ASM rt LIB_##fn (a1, a2, a3, a4)
173 #define AROS_LH5(rt, fn, a1, a2, a3, a4, a5, bt, bn, lvo, p) \
174 ASM rt LIB_##fn (a1, a2, a3, a4, a5)
175 #define AROS_LH6(rt, fn, a1, a2, a3, a4, a5, a6, bt, bn, lvo, p) \
176 ASM rt LIB_##fn (a1, a2, a3, a4, a5, a6)
177 #define AROS_LH7(rt, fn, a1, a2, a3, a4, a5, a6, a7, bt, bn, lvo, p) \
178 ASM rt LIB_##fn (a1, a2, a3, a4, a5, a6, a7)
179 #define AROS_LH8(rt, fn, a1, a2, a3, a4, a5, a6, a7, a8, bt, bn, lvo, p) \
180 ASM rt LIB_##fn (a1, a2, a3, a4, a5, a6, a7, a8)
182 #ifdef __SASC
183 # define AROS_LHA(type, name, reg) register __REG_##reg type name
184 #else
185 # define AROS_LHA(type, name, reg) type name
186 #endif
188 /*** AROS user function macros **********************************************/
189 #define AROS_USERFUNC_INIT
190 #define AROS_USERFUNC_EXIT
192 #define AROS_UFH0(rt, fn) \
193 ASM rt fn (void)
194 #define AROS_UFH1(rt, fn, a1) \
195 ASM rt fn (a1)
196 #define AROS_UFH2(rt, fn, a1, a2) \
197 ASM rt fn (a1, a2)
198 #define AROS_UFH3(rt, fn, a1, a2, a3) \
199 ASM rt fn (a1, a2, a3)
200 #define AROS_UFH4(rt, fn, a1, a2, a3, a4) \
201 ASM rt fn (a1, a2, a3, a4)
202 #define AROS_UFH5(rt, fn, a1, a2, a3, a4, a5) \
203 ASM rt fn (a1, a2, a3, a4, a5)
204 #define AROS_UFH6(rt, fn, a1, a2, a3, a4, a5, a6) \
205 ASM rt fn (a1, a2, a3, a4, a5, a6)
206 #define AROS_UFH7(rt, fn, a1, a2, a3, a4, a5, a6, a7) \
207 ASM rt fn (a1, a2, a3, a4, a5, a6, a7)
208 #define AROS_UFH8(rt, fn, a1, a2, a3, a4, a5, a6, a7, a8) \
209 ASM rt fn (a1, a2, a3, a4, a5, a6, a7, a8)
211 #define AROS_UFH0S(rt, fn) \
212 ASM static rt fn (void)
213 #define AROS_UFH1S(rt, fn, a1) \
214 ASM static rt fn (a1)
215 #define AROS_UFH2S(rt, fn, a1, a2) \
216 ASM static rt fn (a1, a2)
217 #define AROS_UFH3S(rt, fn, a1, a2, a3) \
218 ASM static rt fn (a1, a2, a3)
219 #define AROS_UFH4S(rt, fn, a1, a2, a3, a4) \
220 ASM static rt fn (a1, a2, a3, a4)
221 #define AROS_UFH5S(rt, fn, a1, a2, a3, a4, a5) \
222 ASM static rt fn (a1, a2, a3, a4, a5)
223 #define AROS_UFH6S(rt, fn, a1, a2, a3, a4, a5, a6) \
224 ASM static rt fn (a1, a2, a3, a4, a5, a6)
225 #define AROS_UFH7S(rt, fn, a1, a2, a3, a4, a5, a6, a7) \
226 ASM static rt fn (a1, a2, a3, a4, a5, a6, a7)
227 #define AROS_UFH8S(rt, fn, a1, a2, a3, a4, a5, a6, a7, a8) \
228 ASM static rt fn (a1, a2, a3, a4, a5, a6, a7, a8)
230 #ifdef __SASC
231 # define AROS_UFHA(type, name, reg) register __REG_##reg type name
232 #else
233 # define AROS_UFHA(type, name, reg) type name
234 #endif
236 #define AROS_UFP0 AROS_UFH0
237 #define AROS_UFP1 AROS_UFH1
238 #define AROS_UFP2 AROS_UFH2
239 #define AROS_UFP3 AROS_UFH3
240 #define AROS_UFP4 AROS_UFH4
241 #define AROS_UFP5 AROS_UFH5
242 #define AROS_UFP6 AROS_UFH6
243 #define AROS_UFP7 AROS_UFH7
244 #define AROS_UFP8 AROS_UFH8
246 #define AROS_UFPA AROS_UFHA
249 With the following define a typical dispatcher will looks like this:
250 BOOPSI_DISPATCHER(IPTR,IconWindow_Dispatcher,cl,obj,msg)
252 #define BOOPSI_DISPATCHER(rettype,name,cl,obj,msg) \
253 AROS_UFH3(SAVEDS rettype, name,\
254 AROS_UFHA(Class *, cl, A0),\
255 AROS_UFHA(Object *, obj, A2),\
256 AROS_UFHA(Msg , msg, A1)) {AROS_USERFUNC_INIT
257 #define BOOPSI_DISPATCHER_END AROS_USERFUNC_EXIT}
258 #define BOOPSI_DISPATCHER_PROTO(rettype,name,cl,obj,msg) \
259 AROS_UFP3(SAVEDS rettype, name,\
260 AROS_UFPA(Class *, cl, A0),\
261 AROS_UFPA(Object *, obj, A2),\
262 AROS_UFPA(Msg , msg, A1))
265 #endif /* _MUIMASTER_SUPPORT_AMIGAOS_H_ */