home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Graphics / PPT / include / pptplugin.h < prev   
C/C++ Source or Header  |  1999-11-28  |  8KB  |  275 lines

  1. /*
  2.     PROJECT: ppt
  3.     MODULE:  pptplugin.h
  4.  
  5.     This header file should contain all necessary definitions and includes
  6.     for different compilers for writing PPT plugins.
  7.  
  8.     At the moment I support only SAS/C. Feel free to send
  9.     me patches if you get it to work with other compilers.
  10.  
  11.     $Id: pptplugin.h,v 6.1 1999/11/28 18:48:54 jj Exp jj $
  12.  
  13. */
  14.  
  15. #ifndef PPT_PPTPLUGIN_H
  16. #define PPT_PPTPLUGIN_H
  17.  
  18. /*----------------------------------------------------------------------*/
  19. /*
  20.  *   Compiler specific definitions.  Please put here whatever you
  21.  *   need for the definitions for your compiler.
  22.  */
  23.  
  24. /* DICE */
  25. #if defined(_DCC)
  26. #define SAVEDS      __geta4
  27. #define ASM
  28. #define REG(x)      __ ## x
  29. #define GREG(x)
  30. #define FAR         __far
  31. #define ALIGNED
  32. #define REGARGS     __regargs
  33. #define STDARGS     __stdargs
  34. #define PUTREG(x,a)
  35. #define GETREG(x)
  36. #define INLINE
  37. #else
  38.  
  39. /* SAS/C */
  40. # if defined(__SASC)
  41. # define SAVEDS     __saveds
  42. # define ASM        __asm
  43. # define REG(x)     register __ ## x
  44. # define GREG(x)
  45. # define FAR        __far
  46. # define ALIGNED    __aligned
  47. # define REGARGS    __regargs
  48. # define STDARGS    __stdargs
  49. # define PUTREG(x,a) putreg(x,a)
  50. # define GETREG(x)   getreg(x)
  51. # define INLINE     __inline
  52. # define GETDS()    getreg(REG_A4)
  53. # define PUTDS(x)   putreg(REG_A4,x)
  54. # else
  55.  
  56. /* GCC */
  57. #  if defined(__GNUC__)
  58.  
  59. #   define SAVEDS   __saveds
  60. #   define ASM
  61. #   define REG(x)   register
  62. #   define GREG(x)  __asm( #x )
  63. #   define FAR
  64. #   define ALIGNED  __aligned
  65. #   define REGARGS  __regargs
  66. #   define STDARGS  __stdargs
  67. #   define PUTREG(x,a) /* These require definitions. */
  68. #   define GETREG(x)
  69. #   define GETDS()  __getds()
  70. #   define PUTDS(x) __putds(x)
  71. #   define INLINE   __inline
  72.     /* add symbol a to list b (type c (22=text 24=data 26=bss)) */
  73. #   define ADD2LIST(a,b,c) asm(".stabs \"_" #b "\"," #c ",0,0,_" #a )
  74.  
  75. #   undef  __USEOLDEXEC__
  76. #   define __NOLIBBASE__
  77.  
  78. static unsigned long __inline __getds()
  79. {
  80.     unsigned long result;
  81.     asm("movel a4,%0" : "=d" (result) );
  82.     return result;
  83. }
  84.  
  85. static void __inline __putds(unsigned long x)
  86. {
  87.     asm("movel %0,a4" :: "d" (x) );
  88. }
  89.  
  90. #  else
  91. #   error This compiler not yet supported
  92. #  endif /* __GNUC__ */
  93. # endif /* __SASC */
  94. #endif /* _DCC */
  95.  
  96. /*----------------------------------------------------------------------*/
  97. /*
  98.  *  Debugging definitions.  These are mainly for my own use, but you
  99.  *  might find them useful.
  100.  *
  101.  *  Using SLOW_DEBUG_MODE causes some restrictions on what you might
  102.  *  want to use D(x) macro for, and it also assumes you have an automatic
  103.  *  library opener in your compiler, since it requires dos.library.
  104.  */
  105.  
  106. #ifdef DEBUG_MODE
  107.  
  108. # ifdef SLOW_DEBUG_MODE
  109. #  define D(x)  { x; Delay(50); }
  110. # else
  111. #  define D(x)    x;
  112. # endif
  113.  
  114. #define bug     PDebug
  115. #else
  116. #define D(x)
  117. #define bug     a_function_that_does_not_exist
  118. #endif
  119.  
  120. /*----------------------------------------------------------------------*/
  121. /*
  122.  *  Start of include files.  Here, you should include whatever you think
  123.  *  is necessary for your compiler.
  124.  */
  125.  
  126. #include <exec/types.h>
  127.  
  128. #ifndef UTILITY_TAGITEM_H
  129. #include <utility/tagitem.h>
  130. #endif
  131.  
  132. #include <libraries/bgui.h>
  133. #include <libraries/bgui_macros.h>
  134.  
  135. #include <clib/alib_protos.h>
  136.  
  137. #include <proto/exec.h>
  138. #include <proto/intuition.h>
  139. #include <proto/utility.h>
  140. #include <proto/dos.h>
  141. #include <proto/bgui.h>
  142.  
  143. #if defined(__GNUC__)
  144.  
  145. #include <inline/exec.h>
  146. #include <inline/intuition.h>
  147. #include <inline/utility.h>
  148. #include <inline/dos.h>
  149.  
  150. # if !defined(_INLINE_BGUI_H)
  151. #  include <inline/bgui.h>
  152. # endif
  153. #endif
  154.  
  155. #if defined(__SASC)
  156. #include <dos.h>
  157. #endif
  158.  
  159. /*
  160.  *   These are required, however. Make sure that these are in your include path!
  161.  */
  162.  
  163. #include <ppt.h>
  164. #include <proto/pptsupp.h>
  165. #include <proto/iomod.h>
  166. #include <proto/effect.h>
  167.  
  168. /*
  169.  *   Just some extra, again.
  170.  */
  171.  
  172. #include <stdio.h>
  173. #include <stdarg.h>
  174.  
  175. /*----------------------------------------------------------------------*/
  176. /*
  177.  *  Declarations - just add your own compiler definitions here.  In
  178.  *  theory, if the above declarations are correct, they should work
  179.  *  with pretty much every compiler.  However, you might want to
  180.  *  consider to do something with LIBINIT and LIBCLEANUP (called
  181.  *  during LibOpen() and LibClose() respectively).
  182.  */
  183.  
  184. #if defined(__GNUC__)
  185. #define LIBINIT \
  186.     int SAVEDS __UserLibInit( struct Library *EffectBase )
  187.  
  188. #define LIBCLEANUP \
  189.     VOID SAVEDS __UserLibCleanup( VOID )
  190.  
  191. #else
  192. #define LIBINIT \
  193.     int SAVEDS ASM __UserLibInit( REG(a6) struct Library *EffectBase )
  194.  
  195. #define LIBCLEANUP \
  196.     VOID SAVEDS ASM __UserLibCleanup( REG(a6) struct Library *EffectBase )
  197. #endif
  198.  
  199. #define EFFECTINQUIRE(a,p,e) \
  200.     ULONG SAVEDS ASM LIBEffectInquire( REG(d0) ULONG a GREG(d0), \
  201.                                        REG(a3) struct PPTBase *p GREG(a3), \
  202.                                        REG(a6) struct Library *e GREG(a6))
  203.  
  204. #define EFFECTEXEC(f,t,p,e) \
  205.     FRAME * SAVEDS ASM LIBEffectExec( REG(a0) FRAME *f GREG(a0), \
  206.                                       REG(a1) struct TagItem *t GREG(a1), \
  207.                                       REG(a3) struct PPTBase *p GREG(a3), \
  208.                                       REG(a6) struct Library *e GREG(a6) )
  209.  
  210. #define EFFECTGETARGS(f,t,p,e) \
  211.     PERROR SAVEDS ASM LIBEffectGetArgs( REG(a0) FRAME *f GREG(a0), \
  212.                                         REG(a1) struct TagItem *t GREG(a1), \
  213.                                         REG(a3) struct PPTBase *p GREG(a3), \
  214.                                         REG(a6) struct Library *e GREG(a6) )
  215.  
  216. #define IOINQUIRE(a,p,i) \
  217.     ULONG SAVEDS ASM LIBIOInquire( REG(d0) ULONG a GREG(d0), \
  218.                                    REG(a3) struct PPTBase *p GREG(a3), \
  219.                                    REG(a6) struct Library *i GREG(a6))
  220.  
  221. #define IOLOAD(fh,frame,tags,p,i) \
  222.     PERROR SAVEDS ASM LIBIOLoad( REG(d0) BPTR fh GREG(d0), \
  223.                                  REG(a0) FRAME *frame GREG(a0), \
  224.                                  REG(a1) struct TagItem *tags GREG(a1), \
  225.                                  REG(a3) struct PPTBase *p GREG(a3), \
  226.                                  REG(a6) struct Library *i GREG(a6))
  227.  
  228. #define IOSAVE(fh,format,frame,tags,p,i) \
  229.     PERROR SAVEDS ASM LIBIOSave( REG(d0) BPTR fh GREG(d0), \
  230.                                  REG(d1) ULONG format GREG(d1), \
  231.                                  REG(a0) FRAME *frame GREG(a0), \
  232.                                  REG(a1) struct TagItem *tags GREG(a1), \
  233.                                  REG(a3) struct PPTBase *p GREG(a3), \
  234.                                  REG(a6) struct Library *i GREG(a6))
  235.  
  236. #define IOCHECK(fh,len,buf,p,i) \
  237.     BOOL SAVEDS ASM LIBIOCheck( REG(d0) BPTR fh GREG(d0), \
  238.                                 REG(d1) LONG len GREG(d1), \
  239.                                 REG(a0) UBYTE *buf GREG(a0), \
  240.                                 REG(a3) struct PPTBase *p GREG(a3), \
  241.                                 REG(a6) struct Library *i GREG(a6))
  242.  
  243. #define IOGETARGS(format,frame,tags,p,i) \
  244.     PERROR SAVEDS ASM LIBIOGetArgs( REG(d1) ULONG format GREG(d1), \
  245.                                     REG(a0) FRAME *frame GREG(a0), \
  246.                                     REG(a1) struct TagItem *tags GREG(a1), \
  247.                                     REG(a3) struct PPTBase *p GREG(a3), \
  248.                                     REG(a6) struct Library *i GREG(a6))
  249.  
  250.  
  251. /*---------------------------------------------------------------------*/
  252. /*
  253.  *   Need to recreate some bgui macros to use my own tag routines. Don't worry,
  254.  *   you might not need these.
  255.  */
  256.  
  257. #if defined(REDEFINE_BGUI)
  258. #undef  HGroupObject
  259. #define HGroupObject          MyNewObject( PPTBase, BGUI_GROUP_GADGET
  260. #undef  VGroupObject
  261. #define VGroupObject          MyNewObject( PPTBase, BGUI_GROUP_GADGET, GROUP_Style, GRSTYLE_VERTICAL
  262. #undef  ButtonObject
  263. #define ButtonObject          MyNewObject( PPTBase, BGUI_BUTTON_GADGET
  264. #undef  CheckBoxObject
  265. #define CheckBoxObject        MyNewObject( PPTBase, BGUI_CHECKBOX_GADGET
  266. #undef  WindowObject
  267. #define WindowObject          MyNewObject( PPTBase, BGUI_WINDOW_OBJECT
  268. #undef  SeperatorObject
  269. #define SeperatorObject       MyNewObject( PPTBase, BGUI_SEPERATOR_GADGET
  270. #undef  WindowOpen
  271. #define WindowOpen(wobj)      (struct Window *)DoMethod( wobj, WM_OPEN )
  272. #endif
  273.  
  274. #endif /* PPT_PPTPLUGIN_H */
  275.