home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 2 / FFMCD02.bin / useful / os-include / inline / gadtools.h < prev    next >
C/C++ Source or Header  |  1992-12-28  |  10KB  |  307 lines

  1. #ifndef _INLINE_GADTOOLS_H
  2. #define _INLINE_GADTOOLS_H
  3.  
  4. #include <sys/cdefs.h>
  5. #include <inline/stubs.h>
  6.  
  7. __BEGIN_DECLS
  8.  
  9. #ifndef BASE_EXT_DECL
  10. #define BASE_EXT_DECL extern struct Library*  GadToolsBase;
  11. #endif
  12. #ifndef BASE_PAR_DECL
  13. #define BASE_PAR_DECL
  14. #define BASE_PAR_DECL0 void
  15. #endif
  16. #ifndef BASE_NAME
  17. #define BASE_NAME GadToolsBase
  18. #endif
  19.  
  20. static __inline struct Gadget *
  21. CreateContext (BASE_PAR_DECL struct Gadget **glistptr)
  22. {
  23.   BASE_EXT_DECL
  24.   register struct Gadget * _res  __asm("d0");
  25.   register struct Library* a6 __asm("a6") = BASE_NAME;
  26.   register struct Gadget **a0 __asm("a0") = glistptr;
  27.   __asm __volatile ("jsr a6@(-0x72)"
  28.   : "=r" (_res)
  29.   : "r" (a6), "r" (a0)
  30.   : "a0","a1","d0","d1", "memory");
  31.   return _res;
  32. }
  33. static __inline struct Gadget *
  34. CreateGadgetA (BASE_PAR_DECL unsigned long kind,struct Gadget *gad,struct NewGadget *ng,struct TagItem *taglist)
  35. {
  36.   BASE_EXT_DECL
  37.   register struct Gadget * _res  __asm("d0");
  38.   register struct Library* a6 __asm("a6") = BASE_NAME;
  39.   register unsigned long d0 __asm("d0") = kind;
  40.   register struct Gadget *a0 __asm("a0") = gad;
  41.   register struct NewGadget *a1 __asm("a1") = ng;
  42.   register struct TagItem *a2 __asm("a2") = taglist;
  43.   __asm __volatile ("jsr a6@(-0x1e)"
  44.   : "=r" (_res)
  45.   : "r" (a6), "r" (d0), "r" (a0), "r" (a1), "r" (a2)
  46.   : "a0","a1","a2","d0","d1", "memory");
  47.   return _res;
  48. }
  49. #ifndef NO_INLINE_STDARG
  50. #define CreateGadget(a0, a1, a2, tags...) \
  51.   ({ struct TagItem _tags[] = { tags }; CreateGadgetA ((a0), (a1), (a2), _tags); })
  52. #endif /* not NO_INLINE_STDARG */
  53. static __inline struct Menu *
  54. CreateMenusA (BASE_PAR_DECL struct NewMenu *newmenu,struct TagItem *taglist)
  55. {
  56.   BASE_EXT_DECL
  57.   register struct Menu * _res  __asm("d0");
  58.   register struct Library* a6 __asm("a6") = BASE_NAME;
  59.   register struct NewMenu *a0 __asm("a0") = newmenu;
  60.   register struct TagItem *a1 __asm("a1") = taglist;
  61.   __asm __volatile ("jsr a6@(-0x30)"
  62.   : "=r" (_res)
  63.   : "r" (a6), "r" (a0), "r" (a1)
  64.   : "a0","a1","d0","d1", "memory");
  65.   return _res;
  66. }
  67. #ifndef NO_INLINE_STDARG
  68. #define CreateMenus(a0, tags...) \
  69.   ({ struct TagItem _tags[] = { tags }; CreateMenusA ((a0), _tags); })
  70. #endif /* not NO_INLINE_STDARG */
  71. static __inline void 
  72. DrawBevelBoxA (BASE_PAR_DECL struct RastPort *rport,long left,long top,long width,long height,struct TagItem *taglist)
  73. {
  74.   BASE_EXT_DECL
  75.   register struct Library* a6 __asm("a6") = BASE_NAME;
  76.   register struct RastPort *a0 __asm("a0") = rport;
  77.   register long d0 __asm("d0") = left;
  78.   register long d1 __asm("d1") = top;
  79.   register long d2 __asm("d2") = width;
  80.   register long d3 __asm("d3") = height;
  81.   register struct TagItem *a1 __asm("a1") = taglist;
  82.   __asm __volatile ("jsr a6@(-0x78)"
  83.   : /* no output */
  84.   : "r" (a6), "r" (a0), "r" (d0), "r" (d1), "r" (d2), "r" (d3), "r" (a1)
  85.   : "a0","a1","d0","d1","d2","d3", "memory");
  86. }
  87. #ifndef NO_INLINE_STDARG
  88. #define DrawBevelBox(a0, a1, a2, a3, a4, tags...) \
  89.   ({ struct TagItem _tags[] = { tags }; DrawBevelBoxA ((a0), (a1), (a2), (a3), (a4), _tags); })
  90. #endif /* not NO_INLINE_STDARG */
  91. static __inline void 
  92. FreeGadgets (BASE_PAR_DECL struct Gadget *gad)
  93. {
  94.   BASE_EXT_DECL
  95.   register struct Library* a6 __asm("a6") = BASE_NAME;
  96.   register struct Gadget *a0 __asm("a0") = gad;
  97.   __asm __volatile ("jsr a6@(-0x24)"
  98.   : /* no output */
  99.   : "r" (a6), "r" (a0)
  100.   : "a0","a1","d0","d1", "memory");
  101. }
  102. static __inline void 
  103. FreeMenus (BASE_PAR_DECL struct Menu *menu)
  104. {
  105.   BASE_EXT_DECL
  106.   register struct Library* a6 __asm("a6") = BASE_NAME;
  107.   register struct Menu *a0 __asm("a0") = menu;
  108.   __asm __volatile ("jsr a6@(-0x36)"
  109.   : /* no output */
  110.   : "r" (a6), "r" (a0)
  111.   : "a0","a1","d0","d1", "memory");
  112. }
  113. static __inline void 
  114. FreeVisualInfo (BASE_PAR_DECL APTR vi)
  115. {
  116.   BASE_EXT_DECL
  117.   register struct Library* a6 __asm("a6") = BASE_NAME;
  118.   register APTR a0 __asm("a0") = vi;
  119.   __asm __volatile ("jsr a6@(-0x84)"
  120.   : /* no output */
  121.   : "r" (a6), "r" (a0)
  122.   : "a0","a1","d0","d1", "memory");
  123. }
  124. static __inline void 
  125. GT_BeginRefresh (BASE_PAR_DECL struct Window *win)
  126. {
  127.   BASE_EXT_DECL
  128.   register struct Library* a6 __asm("a6") = BASE_NAME;
  129.   register struct Window *a0 __asm("a0") = win;
  130.   __asm __volatile ("jsr a6@(-0x5a)"
  131.   : /* no output */
  132.   : "r" (a6), "r" (a0)
  133.   : "a0","a1","d0","d1", "memory");
  134. }
  135. static __inline void 
  136. GT_EndRefresh (BASE_PAR_DECL struct Window *win,long complete)
  137. {
  138.   BASE_EXT_DECL
  139.   register struct Library* a6 __asm("a6") = BASE_NAME;
  140.   register struct Window *a0 __asm("a0") = win;
  141.   register long d0 __asm("d0") = complete;
  142.   __asm __volatile ("jsr a6@(-0x60)"
  143.   : /* no output */
  144.   : "r" (a6), "r" (a0), "r" (d0)
  145.   : "a0","a1","d0","d1", "memory");
  146. }
  147. static __inline struct IntuiMessage *
  148. GT_FilterIMsg (BASE_PAR_DECL struct IntuiMessage *imsg)
  149. {
  150.   BASE_EXT_DECL
  151.   register struct IntuiMessage * _res  __asm("d0");
  152.   register struct Library* a6 __asm("a6") = BASE_NAME;
  153.   register struct IntuiMessage *a1 __asm("a1") = imsg;
  154.   __asm __volatile ("jsr a6@(-0x66)"
  155.   : "=r" (_res)
  156.   : "r" (a6), "r" (a1)
  157.   : "a0","a1","d0","d1", "memory");
  158.   return _res;
  159. }
  160. static __inline LONG 
  161. GT_GetGadgetAttrsA (BASE_PAR_DECL struct Gadget *gad,struct Window *win,struct Requester *req,struct TagItem *taglist)
  162. {
  163.   BASE_EXT_DECL
  164.   register LONG  _res  __asm("d0");
  165.   register struct Library* a6 __asm("a6") = BASE_NAME;
  166.   register struct Gadget *a0 __asm("a0") = gad;
  167.   register struct Window *a1 __asm("a1") = win;
  168.   register struct Requester *a2 __asm("a2") = req;
  169.   register struct TagItem *a3 __asm("a3") = taglist;
  170.   __asm __volatile ("jsr a6@(-0xae)"
  171.   : "=r" (_res)
  172.   : "r" (a6), "r" (a0), "r" (a1), "r" (a2), "r" (a3)
  173.   : "a0","a1","a2","a3","d0","d1", "memory");
  174.   return _res;
  175. }
  176. static __inline struct IntuiMessage *
  177. GT_GetIMsg (BASE_PAR_DECL struct MsgPort *iport)
  178. {
  179.   BASE_EXT_DECL
  180.   register struct IntuiMessage * _res  __asm("d0");
  181.   register struct Library* a6 __asm("a6") = BASE_NAME;
  182.   register struct MsgPort *a0 __asm("a0") = iport;
  183.   __asm __volatile ("jsr a6@(-0x48)"
  184.   : "=r" (_res)
  185.   : "r" (a6), "r" (a0)
  186.   : "a0","a1","d0","d1", "memory");
  187.   return _res;
  188. }
  189. static __inline struct IntuiMessage *
  190. GT_PostFilterIMsg (BASE_PAR_DECL struct IntuiMessage *imsg)
  191. {
  192.   BASE_EXT_DECL
  193.   register struct IntuiMessage * _res  __asm("d0");
  194.   register struct Library* a6 __asm("a6") = BASE_NAME;
  195.   register struct IntuiMessage *a1 __asm("a1") = imsg;
  196.   __asm __volatile ("jsr a6@(-0x6c)"
  197.   : "=r" (_res)
  198.   : "r" (a6), "r" (a1)
  199.   : "a0","a1","d0","d1", "memory");
  200.   return _res;
  201. }
  202. static __inline void 
  203. GT_RefreshWindow (BASE_PAR_DECL struct Window *win,struct Requester *req)
  204. {
  205.   BASE_EXT_DECL
  206.   register struct Library* a6 __asm("a6") = BASE_NAME;
  207.   register struct Window *a0 __asm("a0") = win;
  208.   register struct Requester *a1 __asm("a1") = req;
  209.   __asm __volatile ("jsr a6@(-0x54)"
  210.   : /* no output */
  211.   : "r" (a6), "r" (a0), "r" (a1)
  212.   : "a0","a1","d0","d1", "memory");
  213. }
  214. static __inline void 
  215. GT_ReplyIMsg (BASE_PAR_DECL struct IntuiMessage *imsg)
  216. {
  217.   BASE_EXT_DECL
  218.   register struct Library* a6 __asm("a6") = BASE_NAME;
  219.   register struct IntuiMessage *a1 __asm("a1") = imsg;
  220.   __asm __volatile ("jsr a6@(-0x4e)"
  221.   : /* no output */
  222.   : "r" (a6), "r" (a1)
  223.   : "a0","a1","d0","d1", "memory");
  224. }
  225. static __inline void 
  226. GT_SetGadgetAttrsA (BASE_PAR_DECL struct Gadget *gad,struct Window *win,struct Requester *req,struct TagItem *taglist)
  227. {
  228.   BASE_EXT_DECL
  229.   register struct Library* a6 __asm("a6") = BASE_NAME;
  230.   register struct Gadget *a0 __asm("a0") = gad;
  231.   register struct Window *a1 __asm("a1") = win;
  232.   register struct Requester *a2 __asm("a2") = req;
  233.   register struct TagItem *a3 __asm("a3") = taglist;
  234.   __asm __volatile ("jsr a6@(-0x2a)"
  235.   : /* no output */
  236.   : "r" (a6), "r" (a0), "r" (a1), "r" (a2), "r" (a3)
  237.   : "a0","a1","a2","a3","d0","d1", "memory");
  238. }
  239. #ifndef NO_INLINE_STDARG
  240. #define GT_SetGadgetAttrs(a0, a1, a2, tags...) \
  241.   ({ struct TagItem _tags[] = { tags }; GT_SetGadgetAttrsA ((a0), (a1), (a2), _tags); })
  242. #endif /* not NO_INLINE_STDARG */
  243. static __inline APTR 
  244. GetVisualInfoA (BASE_PAR_DECL struct Screen *screen,struct TagItem *taglist)
  245. {
  246.   BASE_EXT_DECL
  247.   register APTR  _res  __asm("d0");
  248.   register struct Library* a6 __asm("a6") = BASE_NAME;
  249.   register struct Screen *a0 __asm("a0")