home *** CD-ROM | disk | FTP | other *** search
- #ifndef _INLINE_INTOIDS_H
- #define _INLINE_INTOIDS_H 1
-
- /******************************************************************************
- * $Header: Big:Programming/C/Intoids/Library/RCS/Intoids_inline.h,v 1.3 1997/02/12 17:09:53 AGMS Exp $
- *
- * GNU C inline function call glue for intoids.library users.
- *
- * Look in Intoids.c for documentation (autodocs generated from there), e-mail
- * addresses and credits. See Libraries/Intoids.h for datatypes.
- *
- * Intoids.library - An Amiga runtime shared code library for efficiently
- * handling large and small integer values using pointer sized data fields.
- *
- * Modifications for storing smaller integers in 32 bit values and conversion
- * to an Amiga library copyright © 1996 by Alexander G. M. Smith.
- * Original long integer code copyright © 1988 Free Software Foundation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
- #ifndef _CDEFS_H_
- #include <sys/cdefs.h> /* For __BEGIN_DECLS, so it works from C++ */
- #endif
- #ifndef _INLINE_STUBS_H_
- #include <inline/stubs.h> /* Defines an empty struct Library etc. */
- #endif
-
- __BEGIN_DECLS
-
- #ifndef BASE_EXT_DECL
- #define BASE_EXT_DECL
- #define BASE_EXT_DECL0 extern struct Library *IntoidsBase;
- #endif
- #ifndef BASE_PAR_DECL
- #define BASE_PAR_DECL
- #define BASE_PAR_DECL0 void
- #endif
- #ifndef BASE_NAME
- #define BASE_NAME IntoidsBase
- #endif
-
- BASE_EXT_DECL0
-
- /* Note that these functions are in alphabetical order,
- for easier maintenance. */
-
- extern __inline Intoid
- AbsoluteIntoid (BASE_PAR_DECL Intoid IntegerA, Intoid RecycleMe)
- {
- BASE_EXT_DECL
- register Intoid _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid d0 __asm("d0") = IntegerA;
- register Intoid d1 __asm("d1") = RecycleMe;
- __asm __volatile ("jsr a6@(-0x60)"
- : "=r" (_res)
- : "r" (a6), "r" (d0), "r" (d1)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline Intoid
- AddIntoids (BASE_PAR_DECL Intoid IntegerA, Intoid IntegerB, Intoid RecycleMe)
- {
- BASE_EXT_DECL
- register Intoid _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid d0 __asm("d0") = IntegerA;
- register Intoid d1 __asm("d1") = IntegerB;
- register Intoid a0 __asm("a0") = RecycleMe;
- __asm __volatile ("jsr a6@(-0x66)"
- : "=r" (_res)
- : "r" (a6), "r" (d0), "r" (d1), "r" (a0)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline Intoid
- AsciiToIntoid (BASE_PAR_DECL STRPTR Buffer, char ** NextCharacterPntrPntr, UWORD Base, Intoid RecycleMe)
- {
- BASE_EXT_DECL
- register Intoid _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register STRPTR a0 __asm("a0") = Buffer;
- register char ** a1 __asm("a1") = NextCharacterPntrPntr;
- register UWORD d0 __asm("d0") = Base;
- register Intoid d1 __asm("d1") = RecycleMe;
- __asm __volatile ("jsr a6@(-0x4e)"
- : "=r" (_res)
- : "r" (a6), "r" (a0), "r" (a1), "r" (d0), "r" (d1)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline LONG
- CompareIntoidMagnitudes (BASE_PAR_DECL Intoid IntegerA, Intoid IntegerB)
- {
- BASE_EXT_DECL
- register LONG _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid d0 __asm("d0") = IntegerA;
- register Intoid d1 __asm("d1") = IntegerB;
- __asm __volatile ("jsr a6@(-0x78)"
- : "=r" (_res)
- : "r" (a6), "r" (d0), "r" (d1)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline LONG
- CompareIntoids (BASE_PAR_DECL Intoid IntegerA, Intoid IntegerB)
- {
- BASE_EXT_DECL
- register LONG _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid d0 __asm("d0") = IntegerA;
- register Intoid d1 __asm("d1") = IntegerB;
- __asm __volatile ("jsr a6@(-0x72)"
- : "=r" (_res)
- : "r" (a6), "r" (d0), "r" (d1)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline Intoid
- CopyIntoid (BASE_PAR_DECL Intoid IntegerA, Intoid RecycleMe)
- {
- BASE_EXT_DECL
- register Intoid _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid d0 __asm("d0") = IntegerA;
- register Intoid d1 __asm("d1") = RecycleMe;
- __asm __volatile ("jsr a6@(-0x54)"
- : "=r" (_res)
- : "r" (a6), "r" (d0), "r" (d1)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline Intoid
- DivideIntoids (BASE_PAR_DECL Intoid IntegerA, Intoid IntegerB, Intoid RecycleMe)
- {
- BASE_EXT_DECL
- register Intoid _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid d0 __asm("d0") = IntegerA;
- register Intoid d1 __asm("d1") = IntegerB;
- register Intoid a0 __asm("a0") = RecycleMe;
- __asm __volatile ("jsr a6@(-0x84)"
- : "=r" (_res)
- : "r" (a6), "r" (d0), "r" (d1), "r" (a0)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline VOID
- FreeIntoid (BASE_PAR_DECL Intoid RecycleMe)
- {
- BASE_EXT_DECL
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid a0 __asm("a0") = RecycleMe;
- __asm __volatile ("jsr a6@(-0x1e)"
- : /* No Output */
- : "r" (a6), "r" (a0)
- : "d0", "d1", "a0", "a1", "memory");
- }
-
- extern __inline STRPTR
- GetIntoidsMessage (BASE_PAR_DECL IntoidStringNumbers StringNumber)
- {
- BASE_EXT_DECL
- register STRPTR _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register IntoidStringNumbers d0 __asm("d0") = StringNumber;
- __asm __volatile ("jsr a6@(-0x2a)"
- : "=r" (_res)
- : "r" (a6), "r" (d0)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline STRPTR
- GetLastIntoidErrorMessage (BASE_PAR_DECL0)
- {
- BASE_EXT_DECL
- register STRPTR _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- __asm __volatile ("jsr a6@(-0x24)"
- : "=r" (_res)
- : "r" (a6)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline BOOL
- IntoidFitsInLong (BASE_PAR_DECL Intoid IntegerA)
- {
- BASE_EXT_DECL
- register BOOL _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid d0 __asm("d0") = IntegerA;
- __asm __volatile ("jsr a6@(-0x36)"
- : "=r" (_res)
- : "r" (a6), "r" (d0)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline LONG
- IntoidToAscii (BASE_PAR_DECL Intoid IntegerA, STRPTR Buffer, LONG BufferLength, UWORD Base)
- {
- BASE_EXT_DECL
- register LONG _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid a0 __asm("a0") = IntegerA;
- register STRPTR a1 __asm("a1") = Buffer;
- register LONG d0 __asm("d0") = BufferLength;
- register UWORD d1 __asm("d1") = Base;
- __asm __volatile ("jsr a6@(-0x48)"
- : "=r" (_res)
- : "r" (a6), "r" (a0), "r" (a1), "r" (d0), "r" (d1)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline LONG
- IntoidToLong (BASE_PAR_DECL Intoid IntegerA)
- {
- BASE_EXT_DECL
- register LONG _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid d0 __asm("d0") = IntegerA;
- __asm __volatile ("jsr a6@(-0x3c)"
- : "=r" (_res)
- : "r" (a6), "r" (d0)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline BOOL
- IntoidToPortableIntViaBuffer (BASE_PAR_DECL Intoid AnIntoid, ULONG * BytesWrittenPntr, APTR Buffer, ULONG BufferSize)
- {
- BASE_EXT_DECL
- register BOOL _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid d0 __asm("d0") = AnIntoid;
- register ULONG * a0 __asm("a0") = BytesWrittenPntr;
- register APTR a1 __asm("a1") = Buffer;
- register ULONG d1 __asm("d1") = BufferSize;
- __asm __volatile ("jsr a6@(-0xa8)"
- : "=r" (_res)
- : "r" (a6), "r" (d0), "r" (a0), "r" (a1), "r" (d1)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline BOOL
- IntoidToPortableIntViaCallBack (BASE_PAR_DECL Intoid AnIntoid, ULONG * BytesWrittenPntr, PortIntCallBackPntr CallBack, APTR UserPntr)
- {
- BASE_EXT_DECL
- register BOOL _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid d0 __asm("d0") = AnIntoid;
- register ULONG * a0 __asm("a0") = BytesWrittenPntr;
- register PortIntCallBackPntr d1 __asm("d1") = CallBack;
- register APTR a1 __asm("a1") = UserPntr;
- __asm __volatile ("jsr a6@(-0xa2)"
- : "=r" (_res)
- : "r" (a6), "r" (d0), "r" (a0), "r" (d1), "r" (a1)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline Intoid
- LongToIntoid (BASE_PAR_DECL LONG LongA, Intoid RecycleMe)
- {
- BASE_EXT_DECL
- register Intoid _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register LONG d0 __asm("d0") = LongA;
- register Intoid a0 __asm("a0") = RecycleMe;
- __asm __volatile ("jsr a6@(-0x42)"
- : "=r" (_res)
- : "r" (a6), "r" (d0), "r" (a0)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline Intoid
- MultiplyIntoids (BASE_PAR_DECL Intoid IntegerA, Intoid IntegerB, Intoid RecycleMe)
- {
- BASE_EXT_DECL
- register Intoid _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid d0 __asm("d0") = IntegerA;
- register Intoid d1 __asm("d1") = IntegerB;
- register Intoid a0 __asm("a0") = RecycleMe;
- __asm __volatile ("jsr a6@(-0x7e)"
- : "=r" (_res)
- : "r" (a6), "r" (d0), "r" (d1), "r" (a0)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline Intoid
- NegateIntoid (BASE_PAR_DECL Intoid IntegerA, Intoid RecycleMe)
- {
- BASE_EXT_DECL
- register Intoid _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid d0 __asm("d0") = IntegerA;
- register Intoid d1 __asm("d1") = RecycleMe;
- __asm __volatile ("jsr a6@(-0x5a)"
- : "=r" (_res)
- : "r" (a6), "r" (d0), "r" (d1)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline ULONG
- PortableIntLengthViaBuffer (BASE_PAR_DECL APTR Buffer, ULONG BufferSize)
- {
- BASE_EXT_DECL
- register ULONG _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register APTR a0 __asm("a0") = Buffer;
- register ULONG d1 __asm("d1") = BufferSize;
- __asm __volatile ("jsr a6@(-0x90)"
- : "=r" (_res)
- : "r" (a6), "r" (a0), "r" (d1)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline ULONG
- PortableIntLengthViaCallBack (BASE_PAR_DECL PortIntCallBackPntr CallBack, APTR UserPntr)
- {
- BASE_EXT_DECL
- register ULONG _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register PortIntCallBackPntr d0 __asm("d0") = CallBack;
- register APTR d1 __asm("d1") = UserPntr;
- __asm __volatile ("jsr a6@(-0x8a)"
- : "=r" (_res)
- : "r" (a6), "r" (d0), "r" (d1)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline ULONG
- PortableIntSizeOfIntoid (BASE_PAR_DECL Intoid AnIntoid)
- {
- BASE_EXT_DECL
- register ULONG _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid a0 __asm("a0") = AnIntoid;
- __asm __volatile ("jsr a6@(-0xae)"
- : "=r" (_res)
- : "r" (a6), "r" (a0)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline Intoid
- PortableIntToIntoidViaBuffer (BASE_PAR_DECL APTR Buffer, ULONG BufferSize, ULONG * AmountReadPntr, Intoid RecycleMe)
- {
- BASE_EXT_DECL
- register Intoid _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register APTR a0 __asm("a0") = Buffer;
- register ULONG d0 __asm("d0") = BufferSize;
- register ULONG * a1 __asm("a1") = AmountReadPntr;
- register Intoid d1 __asm("d1") = RecycleMe;
- __asm __volatile ("jsr a6@(-0x9c)"
- : "=r" (_res)
- : "r" (a6), "r" (a0), "r" (d0), "r" (a1), "r" (d1)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline Intoid
- PortableIntToIntoidViaCallBack (BASE_PAR_DECL PortIntCallBackPntr CallBack, APTR UserPntr, ULONG * AmountReadPntr, Intoid RecycleMe)
- {
- BASE_EXT_DECL
- register Intoid _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register PortIntCallBackPntr a0 __asm("a0") = CallBack;
- register APTR d0 __asm("d0") = UserPntr;
- register ULONG * a1 __asm("a1") = AmountReadPntr;
- register Intoid d1 __asm("d1") = RecycleMe;
- __asm __volatile ("jsr a6@(-0x96)"
- : "=r" (_res)
- : "r" (a6), "r" (a0), "r" (d0), "r" (a1), "r" (d1)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline LONG
- SignOfIntoid (BASE_PAR_DECL Intoid IntegerA)
- {
- BASE_EXT_DECL
- register LONG _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid d0 __asm("d0") = IntegerA;
- __asm __volatile ("jsr a6@(-0x30)"
- : "=r" (_res)
- : "r" (a6), "r" (d0)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- extern __inline Intoid
- SubtractIntoids (BASE_PAR_DECL Intoid IntegerA, Intoid IntegerB, Intoid RecycleMe)
- {
- BASE_EXT_DECL
- register Intoid _res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register Intoid d0 __asm("d0") = IntegerA;
- register Intoid d1 __asm("d1") = IntegerB;
- register Intoid a0 __asm("a0") = RecycleMe;
- __asm __volatile ("jsr a6@(-0x6c)"
- : "=r" (_res)
- : "r" (a6), "r" (d0), "r" (d1), "r" (a0)
- : "d0", "d1", "a0", "a1", "memory");
- return _res;
- }
-
- #undef BASE_EXT_DECL
- #undef BASE_EXT_DECL0
- #undef BASE_PAR_DECL
- #undef BASE_PAR_DECL0
- #undef BASE_NAME
-
- __END_DECLS
-
- #endif /* _INLINE_INTOIDS_H */
-