Import the current wip animation datatype and subclasses. further development will...
[AROS.git] / workbench / classes / datatypes / gifanim / classbase.h
blob59e66f93e475ba135addea5fe5c92cef23fe62b3
2 #ifndef CLASSBASE_H
3 #define CLASSBASE_H 1
5 /*
6 **
7 ** $VER: classbase.h 2.3 (24.5.98)
8 ** gifanim.datatype 2.3
9 **
10 ** Header file for DataTypes class
12 ** Written 1997/1998 by Roland 'Gizzy' Mainz
13 ** Original example source from David N. Junod
17 /* use SAS/C build-in functions */
18 #ifdef __SASC
19 #define USE_BUILTIN_MATH 1
20 #endif /* __SASC */
22 /* amiga includes */
23 #include <exec/types.h>
24 #include <exec/ports.h>
25 #include <exec/memory.h>
26 #include <exec/lists.h>
27 #include <exec/semaphores.h>
28 #include <exec/execbase.h>
29 #include <dos/dos.h>
30 #include <dos/dosextens.h>
31 #include <dos/stdio.h>
32 #include <dos/rdargs.h>
33 #include <dos/dostags.h>
34 #include <graphics/gfx.h>
35 #include <graphics/text.h>
36 #include <graphics/scale.h>
37 #include <cybergraphx/cybergraphics.h>
38 #include <intuition/classes.h> /* must be $Id: classes.h,v 40.0 94/02/15 17:46:35 davidj Exp Locker: davidj $ */
39 #include <intuition/classusr.h>
40 #include <intuition/cghooks.h>
41 #include <intuition/icclass.h>
42 #include <intuition/gadgetclass.h>
43 #include <datatypes/datatypes.h>
44 #include <datatypes/datatypesclass.h>
45 #include <datatypes/animationclass.h>
46 #include <datatypes/animationclassext.h> /* animation.datatype V41 extensions */
48 /* amiga prototypes */
49 #ifdef __SASC
50 #include <clib/macros.h>
51 #include <clib/exec_protos.h>
52 #include <clib/utility_protos.h>
53 #include <clib/dos_protos.h>
54 #include <clib/graphics_protos.h>
55 #include <clib/cybergraphics_protos.h>
56 #include <clib/intuition_protos.h>
57 #include <clib/datatypes_protos.h>
58 #include <clib/dtclass_protos.h>
60 #ifdef PARAMETERS_STACK
61 #include <clib/alib_protos.h>
62 #include <clib/alib_stdio_protos.h>
63 #endif /* PARAMETERS_STACK */
65 /* amiga pragmas */
66 #include <pragmas/exec_pragmas.h>
67 #include <pragmas/utility_pragmas.h>
68 #include <pragmas/dos_pragmas.h>
69 #include <pragmas/graphics_pragmas.h>
70 #include <pragmas/cybergraphics_pragmas.h>
71 #include <pragmas/intuition_pragmas.h>
72 #include <pragmas/datatypes_pragmas.h>
73 #include <pragmas/dtclass_pragmas.h>
74 #include <pragmas/alib_pragmas.h> /* amiga.lib stubs (tagcall pragmas) */
75 #else
76 #include <proto/exec.h>
77 #include <proto/utility.h>
78 #include <proto/dos.h>
79 #include <proto/graphics.h>
80 #include <proto/cybergraphics.h>
81 #include <proto/intuition.h>
82 #include <proto/datatypes.h>
83 #include <proto/dtclass.h>
85 #include <clib/alib_protos.h>
86 #endif
88 /* ANSI includes */
89 #include <string.h>
91 /*****************************************************************************/
93 struct ClassBase
95 struct ClassLibrary cb_Lib;
96 #if !defined(__AROS__)
97 struct ExecBase *cb_SysBase;
98 struct Library *cb_UtilityBase;
99 struct Library *cb_DOSBase;
100 struct Library *cb_GfxBase;
101 struct Library *cb_CyberGfxBase;
102 struct Library *cb_IntuitionBase;
103 struct Library *cb_DataTypesBase;
104 struct Library *cb_SuperClassBase;
105 BPTR cb_SegList;
106 #endif
107 struct SignalSemaphore cb_Lock; /* Access lock */
110 /*****************************************************************************/
112 #ifdef __SASC
113 /* SASC specific defines */
114 #define DISPATCHERFLAGS __saveds __asm
115 #define ASM __asm
116 #define REGD0 register __d0
117 /* ... */
118 #define REGA0 register __a0
119 #define REGA1 register __a1
120 #define REGA2 register __a2
121 /* ... */
122 #define REGA6 register __a6
123 #else
124 #ifdef __GNUC__
125 #define DISPATCHERFLAGS
126 #define ASM
127 #define REGD0
128 #define REGA0
129 #define REGA1
130 #define REGA2
131 #define REGA6
132 #define __stdargs
133 #else
134 #error unsupported compiler
135 #endif
136 #endif /* __SASC */
138 /*****************************************************************************/
140 #if !defined(__AROS__)
141 #define SysBase (cb -> cb_SysBase)
142 #define UtilityBase (cb -> cb_UtilityBase)
143 #define DOSBase (cb -> cb_DOSBase)
144 #define GfxBase (cb -> cb_GfxBase)
145 #define CyberGfxBase (cb -> cb_CyberGfxBase)
146 #define IntuitionBase (cb -> cb_IntuitionBase)
147 #define DataTypesBase (cb -> cb_DataTypesBase)
148 #endif
150 /*****************************************************************************/
152 #if defined(__AROS__)
153 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
154 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
155 #endif
157 /* integer division, rounded */
158 #define INTDIVR( x, y ) (((x) + ((y) / 2)) / (y))
160 /* Align memory on 4 byte boundary */
161 #define ALIGN_LONG( mem ) ((APTR)((((IPTR)(mem)) + 3UL) & ~3UL))
163 /* Align memory on 16 byte boundary */
164 #define ALIGN_QUADLONG( mem ) ((APTR)((((IPTR)(mem)) + 15UL) & ~15UL))
166 /* Following ptr */
167 #define MEMORY_FOLLOWING( ptr ) ((void *)((ptr) + 1))
169 /* Memory after n bytes */
170 #define MEMORY_N_FOLLOWING( ptr, n ) ((void *)(((UBYTE *)ptr) + n ))
172 /* Memory after n bytes, longword aligned (Don't forget the 4 bytes in size for rounding !!) */
173 #define MEMORY_NAL_FOLLOWING( ptr, n ) (ALIGN_LONG( ((void *)(((UBYTE *)ptr) + n )) ))
175 /* casts */
176 #define V( x ) ((VOID *)(x))
177 #define G( o ) ((struct Gadget *)(o))
178 #define EXTG( o ) ((struct ExtGadget *)(o))
180 /* Exclude tag item */
181 #define XTAG( expr, tagid ) ((Tag)((expr)?(tagid):(TAG_IGNORE)))
183 /* Get data from pointer only if it is NOT NULL (and cast data to ULONG) */
184 #define XPTRDATA( x ) ((ULONG)((x)?(*(x)):(0UL)))
186 /* Boolean conversion */
187 #define MAKEBOOL( x ) ((BOOL)((x) != NULL))
189 /*****************************************************************************/
190 /* CyberGFX related stuff */
192 /* This one is missing in the CyberGFX includes (thanks to Niels Froehling for this) */
193 #ifndef BMB_SPECIALFMT
194 #define BMB_SPECIALFMT (7UL)
195 #define BMF_SPECIALFMT (1UL << BMB_SPECIALFMT)
196 #endif /* BMB_SPECIALFMT */
198 #if !defined(SHIFT_PIXFMT)
199 #define SHIFT_PIXFMT( fmt ) (((ULONG)(fmt)) << 24UL)
200 #endif
202 #define CYBERGFXNAME "cybergraphics.library"
203 #define CYBERGFXVERSION (40UL)
205 /*****************************************************************************/
207 #ifdef __SASC
208 #ifndef PARAMETERS_STACK
209 #define PARAMETERS_STACK 1
210 #define CLIB_ALIB_PROTOS_H
211 __stdargs void NewList( struct List *list );
212 __stdargs ULONG DoMethodA( Object *obj, Msg message );
213 __stdargs ULONG DoMethod( Object *obj, unsigned long MethodID, ... );
214 __stdargs ULONG DoSuperMethodA( struct IClass *cl, Object *obj, Msg message );
215 __stdargs ULONG DoSuperMethod( struct IClass *cl, Object *obj, unsigned long MethodID, ... );
216 __stdargs ULONG CoerceMethodA( struct IClass *cl, Object *obj, Msg message );
217 __stdargs ULONG CoerceMethod( struct IClass *cl, Object *obj, unsigned long MethodID, ... );
218 __stdargs ULONG SetSuperAttrs( struct IClass *cl, Object *obj, unsigned long Tag1, ... );
219 #endif /* !PARAMETERS_STACK */
220 #endif
222 /*****************************************************************************/
224 #include "class_iprotos.h"
226 #endif /* !CLASSBASE_H */