home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 2 / MECOMP-CD-II.iso / amiga / datatypes / gifanim_datatype / classbase.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-24  |  5.9 KB  |  191 lines

  1.  
  2. #ifndef CLASSBASE_H
  3. #define CLASSBASE_H 1
  4.  
  5. /*
  6. **
  7. **  $VER: classbase.h 2.3 (24.5.98)
  8. **  gifanim.datatype 2.3
  9. **
  10. **  Header file for DataTypes class
  11. **
  12. **  Written 1997/1998 by Roland 'Gizzy' Mainz
  13. **  Original example source from David N. Junod
  14. **
  15. */
  16.  
  17. /* use SAS/C build-in functions */
  18. #ifdef __SASC
  19. #define USE_BUILTIN_MATH 1
  20. #endif /* __SASC */
  21.  
  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 <cybergraphics/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 */
  47.  
  48. /* amiga prototypes */
  49. #include <clib/macros.h>
  50. #include <clib/exec_protos.h>
  51. #include <clib/utility_protos.h>
  52. #include <clib/dos_protos.h>
  53. #include <clib/graphics_protos.h>
  54. #include <clib/cybergraphics_protos.h>
  55. #include <clib/intuition_protos.h>
  56. #include <clib/datatypes_protos.h>
  57. #include <clib/dtclass_protos.h>
  58. #ifdef PARAMETERS_STACK
  59. #include <clib/alib_protos.h>
  60. #include <clib/alib_stdio_protos.h>
  61. #endif /* PARAMETERS_STACK */
  62.  
  63. /* amiga pragmas */
  64. #include <pragmas/exec_pragmas.h>
  65. #include <pragmas/utility_pragmas.h>
  66. #include <pragmas/dos_pragmas.h>
  67. #include <pragmas/graphics_pragmas.h>
  68. #include <pragmas/cybergraphics_pragmas.h>
  69. #include <pragmas/intuition_pragmas.h>
  70. #include <pragmas/datatypes_pragmas.h>
  71. #include <pragmas/dtclass_pragmas.h>
  72. #include <pragmas/alib_pragmas.h> /* amiga.lib stubs (tagcall pragmas) */
  73.  
  74. /* ANSI includes */
  75. #include <string.h>
  76.  
  77. /*****************************************************************************/
  78.  
  79. struct ClassBase
  80. {
  81.     struct ClassLibrary     cb_Lib;
  82.     struct ExecBase        *cb_SysBase;
  83.     struct Library         *cb_UtilityBase;
  84.     struct Library         *cb_DOSBase;
  85.     struct Library         *cb_GfxBase;
  86.     struct Library         *cb_CyberGfxBase;
  87.     struct Library         *cb_IntuitionBase;
  88.     struct Library         *cb_DataTypesBase;
  89.     struct Library         *cb_SuperClassBase;
  90.     BPTR                    cb_SegList;
  91.     struct SignalSemaphore  cb_Lock;           /* Access lock */
  92. };
  93.  
  94. /*****************************************************************************/
  95.  
  96. #ifdef __SASC
  97. /* SASC specific defines */
  98. #define DISPATCHERFLAGS __saveds __asm
  99. #define ASM             __asm
  100. #define REGD0 register  __d0
  101. /* ... */
  102. #define REGA0 register  __a0
  103. #define REGA1 register  __a1
  104. #define REGA2 register  __a2
  105. /* ... */
  106. #define REGA6 register  __a6
  107. #else
  108. #error unsupported compiler
  109. #endif /* __SASC */
  110.  
  111. /*****************************************************************************/
  112.  
  113. #define SysBase        (cb -> cb_SysBase)
  114. #define UtilityBase    (cb -> cb_UtilityBase)
  115. #define DOSBase        (cb -> cb_DOSBase)
  116. #define GfxBase        (cb -> cb_GfxBase)
  117. #define CyberGfxBase   (cb -> cb_CyberGfxBase)
  118. #define IntuitionBase  (cb -> cb_IntuitionBase)
  119. #define DataTypesBase  (cb -> cb_DataTypesBase)
  120.  
  121. /*****************************************************************************/
  122.  
  123. /* integer division, rounded */
  124. #define INTDIVR( x, y ) (((x) + ((y) / 2)) / (y))
  125.  
  126. /* Align memory on 4 byte boundary */
  127. #define ALIGN_LONG( mem ) ((APTR)((((ULONG)(mem)) + 3UL) & ~3UL))
  128.  
  129. /* Align memory on 16 byte boundary */
  130. #define ALIGN_QUADLONG( mem ) ((APTR)((((ULONG)(mem)) + 15UL) & ~15UL))
  131.  
  132. /* Following ptr */
  133. #define MEMORY_FOLLOWING( ptr )     ((void *)((ptr) + 1))
  134.  
  135. /* Memory after n bytes */
  136. #define MEMORY_N_FOLLOWING( ptr, n ) ((void *)(((UBYTE *)ptr) + n ))
  137.  
  138. /* Memory after n bytes, longword aligned (Don't forget the 4 bytes in size for rounding !!) */
  139. #define MEMORY_NAL_FOLLOWING( ptr, n ) (ALIGN_LONG( ((void *)(((UBYTE *)ptr) + n )) ))
  140.  
  141. /* casts */
  142. #define V( x )    ((VOID *)(x))
  143. #define G( o )    ((struct Gadget *)(o))
  144. #define EXTG( o ) ((struct ExtGadget *)(o))
  145.  
  146. /* Exclude tag item */
  147. #define XTAG( expr, tagid ) ((Tag)((expr)?(tagid):(TAG_IGNORE)))
  148.  
  149. /* Get data from pointer only if it is NOT NULL (and cast data to ULONG) */
  150. #define XPTRDATA( x ) ((ULONG)((x)?(*(x)):(0UL)))
  151.  
  152. /* Boolean conversion */
  153. #define MAKEBOOL( x ) ((BOOL)((x) != NULL))
  154.  
  155. /*****************************************************************************/
  156. /* CyberGFX related stuff */
  157.  
  158. /* This one is missing in the CyberGFX includes (thanks to Niels Froehling for this) */
  159. #ifndef BMB_SPECIALFMT
  160. #define BMB_SPECIALFMT (7UL)
  161. #define BMF_SPECIALFMT (1UL << BMB_SPECIALFMT)
  162. #endif /* BMB_SPECIALFMT */
  163.  
  164. #define SHIFT_PIXFMT( fmt ) (((ULONG)(fmt)) << 24UL)
  165.  
  166. #define CYBERGFXNAME     "cybergraphics.library"
  167. #define CYBERGFXVERSION  (40UL)
  168.  
  169. /*****************************************************************************/
  170.  
  171. #ifndef PARAMETERS_STACK
  172. #define PARAMETERS_STACK 1
  173. #define  CLIB_ALIB_PROTOS_H
  174. __stdargs void  NewList( struct List *list );
  175. __stdargs ULONG DoMethodA( Object *obj, Msg message );
  176. __stdargs ULONG DoMethod( Object *obj, unsigned long MethodID, ... );
  177. __stdargs ULONG DoSuperMethodA( struct IClass *cl, Object *obj, Msg message );
  178. __stdargs ULONG DoSuperMethod( struct IClass *cl, Object *obj, unsigned long MethodID, ... );
  179. __stdargs ULONG CoerceMethodA( struct IClass *cl, Object *obj, Msg message );
  180. __stdargs ULONG CoerceMethod( struct IClass *cl, Object *obj, unsigned long MethodID, ... );
  181. __stdargs ULONG SetSuperAttrs( struct IClass *cl, Object *obj, unsigned long Tag1, ... );
  182. #endif /* !PARAMETERS_STACK */
  183.  
  184. /*****************************************************************************/
  185.  
  186. #include "class_iprotos.h"
  187.  
  188. #endif /* !CLASSBASE_H */
  189.  
  190.  
  191.