#ifndef _INLINE_XADMASTER_H
#define _INLINE_XADMASTER_H

#ifndef __INLINE_MACROS_H
#include <inline/macros.h>
#endif

#ifndef XADMASTER_BASE_NAME
#define XADMASTER_BASE_NAME xadMasterBase
#endif

#define xadAllocObjectA(type, tags) \
	LP2(0x1E, APTR, xadAllocObjectA, LONG, type, d0, struct TagItem *, tags, a0, \
	, XADMASTER_BASE_NAME)

#ifndef NO_INLINE_STDARG
#define xadAllocObject(type, tags...) \
	({ULONG _tags[] = {tags}; xadAllocObjectA((type), (struct TagItem *) _tags);})
#endif

#define xadFreeObjectA(object, tags) \
	LP2NR(0x24, xadFreeObjectA, APTR, object, a0, struct TagItem *, tags, a1, \
	, XADMASTER_BASE_NAME)

#ifndef NO_INLINE_STDARG
#define xadFreeObject(object, tags...) \
	({ULONG _tags[] = {tags}; xadFreeObjectA((object), (struct TagItem *) _tags);})
#endif

#define xadRecogFileA(size, memory, tags) \
	LP3(0x2A, struct xadClient *, xadRecogFileA, ULONG, size, d0, APTR, memory, a0, struct TagItem *, tags, a1, \
	, XADMASTER_BASE_NAME)

#ifndef NO_INLINE_STDARG
#define xadRecogFile(size, memory, tags...) \
	({ULONG _tags[] = {tags}; xadRecogFileA((size), (memory), (struct TagItem *) _tags);})
#endif

#define xadGetInfoA(ai, tags) \
	LP2(0x30, LONG, xadGetInfoA, struct xadArchiveInfo *, ai, a0, struct TagItem *, tags, a1, \
	, XADMASTER_BASE_NAME)

#ifndef NO_INLINE_STDARG
#define xadGetInfo(ai, tags...) \
	({ULONG _tags[] = {tags}; xadGetInfoA((ai), (struct TagItem *) _tags);})
#endif

#define xadFreeInfo(ai) \
	LP1NR(0x36, xadFreeInfo, struct xadArchiveInfo *, ai, a0, \
	, XADMASTER_BASE_NAME)

#define xadFileUnArcA(ai, tags) \
	LP2(0x3C, LONG, xadFileUnArcA, struct xadArchiveInfo *, ai, a0, struct TagItem *, tags, a1, \
	, XADMASTER_BASE_NAME)

#ifndef NO_INLINE_STDARG
#define xadFileUnArc(ai, tags...) \
	({ULONG _tags[] = {tags}; xadFileUnArcA((ai), (struct TagItem *) _tags);})
#endif

#define xadDiskUnArcA(ai, tags) \
	LP2(0x42, LONG, xadDiskUnArcA, struct xadArchiveInfo *, ai, a0, struct TagItem *, tags, a1, \
	, XADMASTER_BASE_NAME)

#ifndef NO_INLINE_STDARG
#define xadDiskUnArc(ai, tags...) \
	({ULONG _tags[] = {tags}; xadDiskUnArcA((ai), (struct TagItem *) _tags);})
#endif

#define xadGetErrorText(errnum) \
	LP1(0x48, STRPTR, xadGetErrorText, ULONG, errnum, d0, \
	, XADMASTER_BASE_NAME)

#define xadGetClientInfo() \
	LP0(0x4E, struct xadClient *, xadGetClientInfo, \
	, XADMASTER_BASE_NAME)

#define xadHookAccess(command, data, buffer, ai) \
	LP4(0x54, LONG, xadHookAccess, ULONG, command, d0, LONG, data, d1, APTR, buffer, a0, struct xadArchiveInfo *, ai, a1, \
	, XADMASTER_BASE_NAME)

#define xadConvertDatesA(tags) \
	LP1(0x5A, LONG, xadConvertDatesA, struct TagItem *, tags, a0, \
	, XADMASTER_BASE_NAME)

#ifndef NO_INLINE_STDARG
#define xadConvertDates(tags...) \
	({ULONG _tags[] = {tags}; xadConvertDatesA((struct TagItem *) _tags);})
#endif

#define xadCalcCRC16(id, init, size, buffer) \
	LP4(0x60, UWORD, xadCalcCRC16, UWORD, id, d0, UWORD, init, d1, ULONG, size, d2, STRPTR, buffer, a0, \
	, XADMASTER_BASE_NAME)

#define xadCalcCRC32(id, init, size, buffer) \
	LP4(0x66, ULONG, xadCalcCRC32, ULONG, id, d0, ULONG, init, d1, ULONG, size, d2, STRPTR, buffer, a0, \
	, XADMASTER_BASE_NAME)

#endif /*  _INLINE_XADMASTER_H  */
