home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / programm / programi / gcc_9112.lzh / include20 / inline / utility.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-15  |  10.1 KB  |  436 lines

  1. #include <inline/stub.h>
  2. #ifndef BASE_EXT_DECL
  3. #define BASE_EXT_DECL extern struct UtilityBase * UtilityBase;
  4. #endif
  5. #ifndef BASE_PAR_DECL
  6. #define BASE_PAR_DECL
  7. #define BASE_PAR_DECL0 void
  8. #endif
  9. #ifndef BASE_NAME
  10. #define BASE_NAME UtilityBase
  11. #endif
  12. __inline static struct TagItem* FindTagItem(BASE_PAR_DECL Tag tagVal, struct TagItem* tagList)
  13. {
  14.     BASE_EXT_DECL
  15.     register struct TagItem* res __asm("d0");
  16.     register void *a6 __asm ("a6");
  17.     register Tag d0 __asm("d0");
  18.     register struct TagItem* a0 __asm("a0");
  19.  
  20.     a6 = BASE_NAME;
  21.     d0 = tagVal;
  22.     a0 = tagList;
  23.     __asm volatile ("
  24.     jsr a6@(-0x1e)"
  25.     : "=g" (res)
  26.     : "g" (a6), "g" (d0), "g" (a0)
  27.     : "d0", "d1", "a0", "a1");
  28.     return res;
  29. }
  30. __inline static ULONG GetTagData(BASE_PAR_DECL Tag tagVal, long unsigned int defaultVal, struct TagItem* tagList)
  31. {
  32.     BASE_EXT_DECL
  33.     register ULONG res __asm("d0");
  34.     register void *a6 __asm ("a6");
  35.     register Tag d0 __asm("d0");
  36.     register long unsigned int d1 __asm("d1");
  37.     register struct TagItem* a0 __asm("a0");
  38.  
  39.     a6 = BASE_NAME;
  40.     d0 = tagVal;
  41.     d1 = defaultVal;
  42.     a0 = tagList;
  43.     __asm volatile ("
  44.     jsr a6@(-0x24)"
  45.     : "=g" (res)
  46.     : "g" (a6), "g" (d0), "g" (d1), "g" (a0)
  47.     : "d0", "d1", "a0", "a1");
  48.     return res;
  49. }
  50. __inline static ULONG PackBoolTags(BASE_PAR_DECL long unsigned int initialFlags, struct TagItem* tagList, struct TagItem* boolMap)
  51. {
  52.     BASE_EXT_DECL
  53.     register ULONG res __asm("d0");
  54.     register void *a6 __asm ("a6");
  55.     register long unsigned int d0 __asm("d0");
  56.     register struct TagItem* a0 __asm("a0");
  57.     register struct TagItem* a1 __asm("a1");
  58.  
  59.     a6 = BASE_NAME;
  60.     d0 = initialFlags;
  61.     a0 = tagList;
  62.     a1 = boolMap;
  63.     __asm volatile ("
  64.     jsr a6@(-0x2a)"
  65.     : "=g" (res)
  66.     : "g" (a6), "g" (d0), "g" (a0), "g" (a1)
  67.     : "d0", "d1", "a0", "a1");
  68.     return res;
  69. }
  70. __inline static struct TagItem* NextTagItem(BASE_PAR_DECL struct TagItem** tagListPtr)
  71. {
  72.     BASE_EXT_DECL
  73.     register struct TagItem* res __asm("d0");
  74.     register void *a6 __asm ("a6");
  75.     register struct TagItem** a0 __asm("a0");
  76.  
  77.     a6 = BASE_NAME;
  78.     a0 = tagListPtr;
  79.     __asm volatile ("
  80.     jsr a6@(-0x30)"
  81.     : "=g" (res)
  82.     : "g" (a6), "g" (a0)
  83.     : "d0", "d1", "a0", "a1");
  84.     return res;
  85. }
  86. __inline static void FilterTagChanges(BASE_PAR_DECL struct TagItem* newTagList, struct TagItem* oldTagList, long int apply)
  87. {
  88.     BASE_EXT_DECL
  89.     register void *a6 __asm ("a6");
  90.     register struct TagItem* a0 __asm("a0");
  91.     register struct TagItem* a1 __asm("a1");
  92.     register long int d0 __asm("d0");
  93.  
  94.     a6 = BASE_NAME;
  95.     a0 = newTagList;
  96.     a1 = oldTagList;
  97.     d0 = apply;
  98.     __asm volatile ("
  99.     jsr a6@(-0x36)"
  100.     : /* no output */
  101.     : "g" (a6), "g" (a0), "g" (a1), "g" (d0)
  102.     : "d0", "d1", "a0", "a1");
  103. }
  104. __inline static void MapTags(BASE_PAR_DECL struct TagItem* tagList, struct TagItem* mapList, long int includeMiss)
  105. {
  106.     BASE_EXT_DECL
  107.     register void *a6 __asm ("a6");
  108.     register struct TagItem* a0 __asm("a0");
  109.     register struct TagItem* a1 __asm("a1");
  110.     register long int d0 __asm("d0");
  111.  
  112.     a6 = BASE_NAME;
  113.     a0 = tagList;
  114.     a1 = mapList;
  115.     d0 = includeMiss;
  116.     __asm volatile ("
  117.     jsr a6@(-0x3c)"
  118.     : /* no output */
  119.     : "g" (a6), "g" (a0), "g" (a1), "g" (d0)
  120.     : "d0", "d1", "a0", "a1");
  121. }
  122. __inline static struct TagItem* AllocateTagItems(BASE_PAR_DECL long unsigned int numItems)
  123. {
  124.     BASE_EXT_DECL
  125.     register struct TagItem* res __asm("d0");
  126.     register void *a6 __asm ("a6");
  127.     register long unsigned int d0 __asm("d0");
  128.  
  129.     a6 = BASE_NAME;
  130.     d0 = numItems;
  131.     __asm volatile ("
  132.     jsr a6@(-0x42)"
  133.     : "=g" (res)
  134.     : "g" (a6), "g" (d0)
  135.     : "d0", "d1", "a0", "a1");
  136.     return res;
  137. }
  138. __inline static struct TagItem* CloneTagItems(BASE_PAR_DECL struct TagItem* tagList)
  139. {
  140.     BASE_EXT_DECL
  141.     register struct TagItem* res __asm("d0");
  142.     register void *a6 __asm ("a6");
  143.     register struct TagItem* a0 __asm("a0");
  144.  
  145.     a6 = BASE_NAME;
  146.     a0 = tagList;
  147.     __asm volatile ("
  148.     jsr a6@(-0x48)"
  149.     : "=g" (res)
  150.     : "g" (a6), "g" (a0)
  151.     : "d0", "d1", "a0", "a1");
  152.     return res;
  153. }
  154. __inline static void FreeTagItems(BASE_PAR_DECL struct TagItem* tagList)
  155. {
  156.     BASE_EXT_DECL
  157.     register void *a6 __asm ("a6");
  158.     register struct TagItem* a0 __asm("a0");
  159.  
  160.     a6 = BASE_NAME;
  161.     a0 = tagList;
  162.     __asm volatile ("
  163.     jsr a6@(-0x4e)"
  164.     : /* no output */
  165.     : "g" (a6), "g" (a0)
  166.     : "d0", "d1", "a0", "a1");
  167. }
  168. __inline static void RefreshTagItemClones(BASE_PAR_DECL struct TagItem* cloneList, struct TagItem* origList)
  169. {
  170.     BASE_EXT_DECL
  171.     register void *a6 __asm ("a6");
  172.     register struct TagItem* a0 __asm("a0");
  173.     register struct TagItem* a1 __asm("a1");
  174.  
  175.     a6 = BASE_NAME;
  176.     a0 = cloneList;
  177.     a1 = origList;
  178.     __asm volatile ("
  179.     jsr a6@(-0x54)"
  180.     : /* no output */
  181.     : "g" (a6), "g" (a0), "g" (a1)
  182.     : "d0", "d1", "a0", "a1");
  183. }
  184. __inline static BOOL TagInArray(BASE_PAR_DECL Tag tagVal, Tag* tagArray)
  185. {
  186.     BASE_EXT_DECL
  187.     register BOOL res __asm("d0");
  188.     register void *a6 __asm ("a6");
  189.     register Tag d0 __asm("d0");
  190.     register Tag* a0 __asm("a0");
  191.  
  192.     a6 = BASE_NAME;
  193.     d0 = tagVal;
  194.     a0 = tagArray;
  195.     __asm volatile ("
  196.     jsr a6@(-0x5a)"
  197.     : "=g" (res)
  198.     : "g" (a6), "g" (d0), "g" (a0)
  199.     : "d0", "d1", "a0", "a1");
  200.     return res;
  201. }
  202. __inline static LONG FilterTagItems(BASE_PAR_DECL struct TagItem* tagList, Tag* filterArray, long int logic)
  203. {
  204.     BASE_EXT_DECL
  205.     register LONG res __asm("d0");
  206.     register void *a6 __asm ("a6");
  207.     register struct TagItem* a0 __asm("a0");
  208.     register Tag* a1 __asm("a1");
  209.     register long int d0 __asm("d0");
  210.  
  211.     a6 = BASE_NAME;
  212.     a0 = tagList;
  213.     a1 = filterArray;
  214.     d0 = logic;
  215.     __asm volatile ("
  216.     jsr a6@(-0x60)"
  217.     : "=g" (res)
  218.     : "g" (a6), "g" (a0), "g" (a1), "g" (d0)
  219.     : "d0", "d1", "a0", "a1");
  220.     return res;
  221. }
  222. __inline static ULONG CallHookPkt(BASE_PAR_DECL struct Hook* hook, APTR object, APTR paramPacket)
  223. {
  224.     BASE_EXT_DECL
  225.     register ULONG res __asm("d0");
  226.     register void *a6 __asm ("a6");
  227.     register struct Hook* a0 __asm("a0");
  228.     register APTR a2 __asm("a2");
  229.     register APTR a1 __asm("a1");
  230.  
  231.     a6 = BASE_NAME;
  232.     a0 = hook;
  233.     a2 = object;
  234.     a1 = paramPacket;
  235.     __asm volatile ("
  236.     jsr a6@(-0x66)"
  237.     : "=g" (res)
  238.     : "g" (a6), "g" (a0), "g" (a2), "g" (a1)
  239.     : "d0", "d1", "a0", "a1", "a2");
  240.     return res;
  241. }
  242. __inline static void Amiga2Date(BASE_PAR_DECL long unsigned int amigaTime, struct ClockData* date)
  243. {
  244.     BASE_EXT_DECL
  245.     register void *a6 __asm ("a6");
  246.     register long unsigned int d0 __asm("d0");
  247.     register struct ClockData* a0 __asm("a0");
  248.  
  249.     a6 = BASE_NAME;
  250.     d0 = amigaTime;
  251.     a0 = date;
  252.     __asm volatile ("
  253.     jsr a6@(-0x78)"
  254.     : /* no output */
  255.     : "g" (a6), "g" (d0), "g" (a0)
  256.     : "d0", "d1", "a0", "a1");
  257. }
  258. __inline static ULONG Date2Amiga(BASE_PAR_DECL struct ClockData* date)
  259. {
  260.     BASE_EXT_DECL
  261.     register ULONG res __asm("d0");
  262.     register void *a6 __asm ("a6");
  263.     register struct ClockData* a0 __asm("a0");
  264.  
  265.     a6 = BASE_NAME;
  266.     a0 = date;
  267.     __asm volatile ("
  268.     jsr a6@(-0x7e)"
  269.     : "=g" (res)
  270.     : "g" (a6), "g" (a0)
  271.     : "d0", "d1", "a0", "a1");
  272.     return res;
  273. }
  274. __inline static ULONG CheckDate(BASE_PAR_DECL struct ClockData* date)
  275. {
  276.     BASE_EXT_DECL
  277.     register ULONG res __asm("d0");
  278.     register void *a6 __asm ("a6");
  279.     register struct ClockData* a0 __asm("a0");
  280.  
  281.     a6 = BASE_NAME;
  282.     a0 = date;
  283.     __asm volatile ("
  284.     jsr a6@(-0x84)"
  285.     : "=g" (res)
  286.     : "g" (a6), "g" (a0)
  287.     : "d0", "d1", "a0", "a1");
  288.     return res;
  289. }
  290. __inline static LONG SMult32(BASE_PAR_DECL long int factor1, long int factor2)
  291. {
  292.     BASE_EXT_DECL
  293.     register LONG res __asm("d0");
  294.     register void *a6 __asm ("a6");
  295.     register long int d0 __asm("d0");
  296.     register long int d1 __asm("d1");
  297.  
  298.     a6 = BASE_NAME;
  299.     d0 = factor1;
  300.     d1 = factor2;
  301.     __asm volatile ("
  302.     jsr a6@(-0x8a)"
  303.     : "=g" (res)
  304.     : "g" (a6), "g" (d0), "g" (d1)
  305.     : "d0", "d1", "a0", "a1");
  306.     return res;
  307. }
  308. __inline static ULONG UMult32(BASE_PAR_DECL long unsigned int factor1, long unsigned int factor2)
  309. {
  310.     BASE_EXT_DECL
  311.     register ULONG res __asm("d0");
  312.     register void *a6 __asm ("a6");
  313.     register long unsigned int d0 __asm("d0");
  314.     register long unsigned int d1 __asm("d1");
  315.  
  316.     a6 = BASE_NAME;
  317.     d0 = factor1;
  318.     d1 = factor2;
  319.     __asm volatile ("
  320.     jsr a6@(-0x90)"
  321.     : "=g" (res)
  322.     : "g" (a6), "g" (d0), "g" (d1)
  323.     : "d0", "d1", "a0", "a1");
  324.     return res;
  325. }
  326. __inline static LONG SDivMod32(BASE_PAR_DECL long int dividend, long int divisor)
  327. {
  328.     BASE_EXT_DECL
  329.     register LONG res __asm("d0");
  330.     register void *a6 __asm ("a6");
  331.     register long int d0 __asm("d0");
  332.     register long int d1 __asm("d1");
  333.  
  334.     a6 = BASE_NAME;
  335.     d0 = dividend;
  336.     d1 = divisor;
  337.     __asm volatile ("
  338.     jsr a6@(-0x96)"
  339.     : "=g" (res)
  340.     : "g" (a6), "g" (d0), "g" (d1)
  341.     : "d0", "d1", "a0", "a1");
  342.     return res;
  343. }
  344. __inline static ULONG UDivMod32(BASE_PAR_DECL long unsigned int dividend, long unsigned int divisor)
  345. {
  346.     BASE_EXT_DECL
  347.     register ULONG res __asm("d0");
  348.     register void *a6 __asm ("a6");
  349.     register long unsigned int d0 __asm("d0");
  350.     register long unsigned int d1 __asm("d1");
  351.  
  352.     a6 = BASE_NAME;
  353.     d0 = dividend;
  354.     d1 = divisor;
  355.     __asm volatile ("
  356.     jsr a6@(-0x9c)"
  357.     : "=g" (res)
  358.     : "g" (a6), "g" (d0), "g" (d1)
  359.     : "d0", "d1", "a0", "a1");
  360.     return res;
  361. }
  362. __inline static LONG Stricmp(BASE_PAR_DECL UBYTE* string1, UBYTE* string2)
  363. {
  364.     BASE_EXT_DECL
  365.     register LONG res __asm("d0");
  366.     register void *a6 __asm ("a6");
  367.     register UBYTE* a0 __asm("a0");
  368.     register UBYTE* a1 __asm("a1");
  369.  
  370.     a6 = BASE_NAME;
  371.     a0 = string1;
  372.     a1 = string2;
  373.     __asm volatile ("
  374.     jsr a6@(-0xa2)"
  375.     : "=g" (res)
  376.     : "g" (a6), "g" (a0), "g" (a1)
  377.     : "d0", "d1", "a0", "a1");
  378.     return res;
  379. }
  380. __inline static LONG Strnicmp(BASE_PAR_DECL UBYTE* string1, UBYTE* string2, long int length)
  381. {
  382.     BASE_EXT_DECL
  383.     register LONG res __asm("d0");
  384.     register void *a6 __asm ("a6");
  385.     register UBYTE* a0 __asm("a0");
  386.     register UBYTE* a1 __asm("a1");
  387.     register long int d0 __asm("d0");
  388.  
  389.     a6 = BASE_NAME;
  390.     a0 = string1;
  391.     a1 = string2;
  392.     d0 = length;
  393.     __asm volatile ("
  394.     jsr a6@(-0xa8)"
  395.     : "=g" (res)
  396.     : "g" (a6), "g" (a0), "g" (a1), "g" (d0)
  397.     : "d0", "d1", "a0", "a1");
  398.     return res;
  399. }
  400. __inline static UBYTE ToUpper(BASE_PAR_DECL long unsigned int character)
  401. {
  402.     BASE_EXT_DECL
  403.     register UBYTE res __asm("d0");
  404.     register void *a6 __asm ("a6");
  405.     register long unsigned int d0 __asm("d0");
  406.  
  407.     a6 = BASE_NAME;
  408.     d0 = character;
  409.     __asm volatile ("
  410.     jsr a6@(-0xae)"
  411.     : "=g" (res)
  412.     : "g" (a6), "g" (d0)
  413.     : "d0", "d1", "a0", "a1");
  414.     return res;
  415. }
  416. __inline static UBYTE ToLower(BASE_PAR_DECL long unsigned int character)
  417. {
  418.     BASE_EXT_DECL
  419.     register UBYTE res __asm("d0");
  420.     register void *a6 __asm ("a6");
  421.     register long unsigned int d0 __asm("d0");
  422.  
  423.     a6 = BASE_NAME;
  424.     d0 = character;
  425.     __asm volatile ("
  426.     jsr a6@(-0xb4)"
  427.     : "=g" (res)
  428.     : "g" (a6), "g" (d0)
  429.     : "d0", "d1", "a0", "a1");
  430.     return res;
  431. }
  432. #undef BASE_EXT_DECL
  433. #undef BASE_PAR_DECL
  434. #undef BASE_PAR_DECL0
  435. #undef BASE_NAME
  436.