home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / c / gcc233.lha / os-include / inline / wb.h < prev   
C/C++ Source or Header  |  1992-12-29  |  5KB  |  145 lines

  1. #ifndef _INLINE_WB_H
  2. #define _INLINE_WB_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*  WorkbenchBase;
  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 WorkbenchBase
  18. #endif
  19.  
  20. static __inline struct AppIcon *
  21. AddAppIconA (BASE_PAR_DECL unsigned long id,unsigned long userdata,UBYTE *text,struct MsgPort *msgport,struct FileLock *lock,struct DiskObject *diskobj,struct TagItem *taglist)
  22. {
  23.   BASE_EXT_DECL
  24.   register struct AppIcon * _res  __asm("d0");
  25.   register struct Library* a6 __asm("a6") = BASE_NAME;
  26.   register unsigned long d0 __asm("d0") = id;
  27.   register unsigned long d1 __asm("d1") = userdata;
  28.   register UBYTE *a0 __asm("a0") = text;
  29.   register struct MsgPort *a1 __asm("a1") = msgport;
  30.   register struct FileLock *a2 __asm("a2") = lock;
  31.   register struct DiskObject *a3 __asm("a3") = diskobj;
  32.   register struct TagItem *a4 __asm("d7") = taglist;
  33.   __asm __volatile ("exg d7,a4; jsr a6@(-0x3c); exg d7,a4"
  34.   : "=r" (_res)
  35.   : "r" (a6), "r" (d0), "r" (d1), "r" (a0), "r" (a1), "r" (a2), "r" (a3), "r" (a4)
  36.   : "a0","a1","a2","a3","d0","d1","d7", "memory");
  37.   return _res;
  38. }
  39. #ifndef NO_INLINE_STDARG
  40. #define AddAppIcon(a0, a1, a2, a3, a4, a5, tags...) \
  41.   ({ struct TagItem _tags[] = { tags }; AddAppIconA ((a0), (a1), (a2), (a3), (a4), (a5), _tags); })
  42. #endif /* not NO_INLINE_STDARG */
  43. static __inline struct AppMenuItem *
  44. AddAppMenuItemA (BASE_PAR_DECL unsigned long id,unsigned long userdata,UBYTE *text,struct MsgPort *msgport,struct TagItem *taglist)
  45. {
  46.   BASE_EXT_DECL
  47.   register struct AppMenuItem * _res  __asm("d0");
  48.   register struct Library* a6 __asm("a6") = BASE_NAME;
  49.   register unsigned long d0 __asm("d0") = id;
  50.   register unsigned long d1 __asm("d1") = userdata;
  51.   register UBYTE *a0 __asm("a0") = text;
  52.   register struct MsgPort *a1 __asm("a1") = msgport;
  53.   register struct TagItem *a2 __asm("a2") = taglist;
  54.   __asm __volatile ("jsr a6@(-0x48)"
  55.   : "=r" (_res)
  56.   : "r" (a6), "r" (d0), "r" (d1), "r" (a0), "r" (a1), "r" (a2)
  57.   : "a0","a1","a2","d0","d1", "memory");
  58.   return _res;
  59. }
  60. #ifndef NO_INLINE_STDARG
  61. #define AddAppMenuItem(a0, a1, a2, a3, tags...) \
  62.   ({ struct TagItem _tags[] = { tags }; AddAppMenuItemA ((a0), (a1), (a2), (a3), _tags); })
  63. #endif /* not NO_INLINE_STDARG */
  64. static __inline struct AppWindow *
  65. AddAppWindowA (BASE_PAR_DECL unsigned long id,unsigned long userdata,struct Window *window,struct MsgPort *msgport,struct TagItem *taglist)
  66. {
  67.   BASE_EXT_DECL
  68.   register struct AppWindow * _res  __asm("d0");
  69.   register struct Library* a6 __asm("a6") = BASE_NAME;
  70.   register unsigned long d0 __asm("d0") = id;
  71.   register unsigned long d1 __asm("d1") = userdata;
  72.   register struct Window *a0 __asm("a0") = window;
  73.   register struct MsgPort *a1 __asm("a1") = msgport;
  74.   register struct TagItem *a2 __asm("a2") = taglist;
  75.   __asm __volatile ("jsr a6@(-0x30)"
  76.   : "=r" (_res)
  77.   : "r" (a6), "r" (d0), "r" (d1), "r" (a0), "r" (a1), "r" (a2)
  78.   : "a0","a1","a2","d0","d1", "memory");
  79.   return _res;
  80. }
  81. #ifndef NO_INLINE_STDARG
  82. #define AddAppWindow(a0, a1, a2, a3, tags...) \
  83.   ({ struct TagItem _tags[] = { tags }; AddAppWindowA ((a0), (a1), (a2), (a3), _tags); })
  84. #endif /* not NO_INLINE_STDARG */
  85. static __inline BOOL 
  86. RemoveAppIcon (BASE_PAR_DECL struct AppIcon *appIcon)
  87. {
  88.   BASE_EXT_DECL
  89.   register BOOL  _res  __asm("d0");
  90.   register struct Library* a6 __asm("a6") = BASE_NAME;
  91.   register struct AppIcon *a0 __asm("a0") = appIcon;
  92.   __asm __volatile ("jsr a6@(-0x42)"
  93.   : "=r" (_res)
  94.   : "r" (a6), "r" (a0)
  95.   : "a0","a1","d0","d1", "memory");
  96.   return _res;
  97. }
  98. static __inline BOOL 
  99. RemoveAppMenuItem (BASE_PAR_DECL struct AppMenuItem *appMenuItem)
  100. {
  101.   BASE_EXT_DECL
  102.   register BOOL  _res  __asm("d0");
  103.   register struct Library* a6 __asm("a6") = BASE_NAME;
  104.   register struct AppMenuItem *a0 __asm("a0") = appMenuItem;
  105.   __asm __volatile ("jsr a6@(-0x4e)"
  106.   : "=r" (_res)
  107.   : "r" (a6), "r" (a0)
  108.   : "a0","a1","d0","d1", "memory");
  109.   return _res;
  110. }
  111. static __inline BOOL 
  112. RemoveAppWindow (BASE_PAR_DECL struct AppWindow *appWindow)
  113. {
  114.   BASE_EXT_DECL
  115.   register BOOL  _res  __asm("d0");
  116.   register struct Library* a6 __asm("a6") = BASE_NAME;
  117.   register struct AppWindow *a0 __asm("a0") = appWindow;
  118.   __asm __volatile ("jsr a6@(-0x36)"
  119.   : "=r" (_res)
  120.   : "r" (a6), "r" (a0)
  121.   : "a0","a1","d0","d1", "memory");
  122.   return _res;
  123. }
  124. static __inline void 
  125. WBInfo (BASE_PAR_DECL BPTR lock,STRPTR name,struct Screen *screen)
  126. {
  127.   BASE_EXT_DECL
  128.   register struct Library* a6 __asm("a6") = BASE_NAME;
  129.   register BPTR a0 __asm("a0") = lock;
  130.   register STRPTR a1 __asm("a1") = name;
  131.   register struct Screen *a2 __asm("a2") = screen;
  132.   __asm __volatile ("jsr a6@(-0x5a)"
  133.   : /* no output */
  134.   : "r" (a6), "r" (a0), "r" (a1), "r" (a2)
  135.   : "a0","a1","a2","d0","d1", "memory");
  136. }
  137. #undef BASE_EXT_DECL
  138. #undef BASE_PAR_DECL
  139. #undef BASE_PAR_DECL0
  140. #undef BASE_NAME
  141.  
  142. __END_DECLS
  143.  
  144. #endif /* _INLINE_WB_H */
  145.