home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga Shareware Floppies / ma76.lha / MAShare76 / Identify / include / inline / identify.h
C/C++ Source or Header  |  1996-09-06  |  3KB  |  108 lines

  1. #ifndef _INLINE_IDENTIFY_H
  2. #define _INLINE_IDENTIFY_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
  11. #define BASE_EXT_DECL0 extern struct Library * IdentifyBase;
  12. #endif
  13. #ifndef BASE_PAR_DECL
  14. #define BASE_PAR_DECL
  15. #define BASE_PAR_DECL0 void
  16. #endif
  17. #ifndef BASE_NAME
  18. #define BASE_NAME IdentifyBase
  19. #endif
  20.  
  21. BASE_EXT_DECL0
  22.  
  23. static __inline LONG
  24. IdAlert (BASE_PAR_DECL ULONG code, struct TagItem *taglist)
  25. {
  26.   BASE_EXT_DECL
  27.   register LONG _res __asm("d0");
  28.   register struct Library *a6 __asm("a6") = BASE_NAME;
  29.   register ULONG d0 __asm("d0") = code;
  30.   register struct TagItem * a0 __asm("a0") = taglist;
  31.   __asm __volatile ("jsr a6@(-42)"
  32.   : "=r" (_res)
  33.   : "r" (a6), "r" (a0), "r" (d0)
  34.   : "a0","a1","d0","d1", "memory");
  35.   return _res;
  36. }
  37. #ifndef NO_INLINE_STDARG
  38. #define IdAlertTags(d0, tags...) \
  39.   ({ struct TagItem _tags[] = { tags }; IdAlert ((d0), _tags); })
  40. #endif /* not NO_INLINE_STDARG */
  41.  
  42. static __inline LONG
  43. IdExpansion (BASE_PAR_DECL struct TagItem *taglist)
  44. {
  45.   BASE_EXT_DECL
  46.   register LONG _res __asm("d0");
  47.   register struct Library *a6 __asm("a6") = BASE_NAME;
  48.   register struct TagItem * a0 __asm("a0") = taglist;
  49.   __asm __volatile ("jsr a6@(-30)"
  50.   : "=r" (_res)
  51.   : "r" (a6), "r" (a0), "r" (d0)
  52.   : "a0","a1","d0","d1", "memory");
  53.   return _res;
  54. }
  55. #ifndef NO_INLINE_STDARG
  56. #define IdExpansionTags(tags...) \
  57.   ({ struct TagItem _tags[] = { tags }; IdExpansion (_tags); })
  58. #endif /* not NO_INLINE_STDARG */
  59.  
  60. static __inline STRPTR
  61. IdHardware (BASE_PAR_DECL ULONG type, struct TagItem *taglist)
  62. {
  63.   BASE_EXT_DECL
  64.   register STRPTR _res __asm("d0");
  65.   register struct Library *a6 __asm("a6") = BASE_NAME;
  66.   register ULONG d0 __asm("d0") = type;
  67.   register struct TagItem * a0 __asm("a0") = taglist;
  68.   __asm __volatile ("jsr a6@(-36)"
  69.   : "=r" (_res)
  70.   : "r" (a6), "r" (a0), "r" (d0)
  71.   : "a0","a1","d0","d1", "memory");
  72.   return _res;
  73. }
  74. #ifndef NO_INLINE_STDARG
  75. #define IdHardwareTags(d0, tags...) \
  76.   ({ struct TagItem _tags[] = { tags }; IdHardware ((d0), _tags); })
  77. #endif /* not NO_INLINE_STDARG */
  78.  
  79. static __inline LONG
  80. IdFunction (BASE_PAR_DECL STRPTR name, LONG offset, struct TagItem *taglist)
  81. {
  82.   BASE_EXT_DECL
  83.   register LONG _res __asm("d0");
  84.   register struct Library *a6 __asm("a6") = BASE_NAME;
  85.   register STRPTR a0 __asm("a0") = name;
  86.   register LONG d0 __asm("d0") = offset;
  87.   register struct TagItem * a1 __asm("a1") = taglist;
  88.   __asm __volatile ("jsr a6@(-48)"
  89.   : "=r" (_res)
  90.   : "r" (a6), "r" (a0), "r" (d0)
  91.   : "a0","a1","d0","d1", "memory");
  92.   return _res;
  93. }
  94. #ifndef NO_INLINE_STDARG
  95. #define IdFunctionTags(a0, d0, tags...) \
  96.   ({ struct TagItem _tags[] = { tags }; IdFunction ((a0), (d0), _tags); })
  97. #endif /* not NO_INLINE_STDARG */
  98.  
  99. #undef BASE_EXT_DECL
  100. #undef BASE_EXT_DECL0
  101. #undef BASE_PAR_DECL
  102. #undef BASE_PAR_DECL0
  103. #undef BASE_NAME
  104.  
  105. __END_DECLS
  106.  
  107. #endif /* _INLINE_IDENTIFY_H */
  108.