
/* lin.h (see xpk.h/xpksub.h) */


/* ERROR MESSAGES */

#define XPKERR_OK	    0
#define XPKERR_IOERRIN	   -3
#define XPKERR_CHECKSUM    -5
#define XPKERR_NOMEM	   -7
#define XPKERR_NEEDPASSWD  -13
#define XPKERR_CORRUPTPKD  -14
#define XPKERR_MISSINGLIB  -15
#define XPKERR_EXPANSION   -17
#define XPKERR_ABORTED	   -19
#define XPKERR_PACKED	   -22
#define XPKERR_NOTPACKED   -23
#define XPKERR_NOINFO	   -28




/* Defines for Flags */
#define XPKIF_PK_CHUNK	  0x00000001
#define XPKIF_PREREADHDR  0x00000800
#define XPKIF_NEEDPASSWD  0x00004000


typedef struct XpkMode {
	struct XpkMode *Next;	 /* Next descriptor		*/
	ULONG	Upto;		 /* Mode (0-100)                */
	ULONG	Flags;		 /*				*/
	ULONG	PackMemory;	 /* Memory used by sub-library	*/
	ULONG	UnpackMemory;	 /*	     - || -		*/
	ULONG	PackSpeed;	 /* KB/sec on AMIGA 3000	*/
	ULONG	UnpackSpeed;	 /*	     - || -		*/
	UWORD	Ratio;		 /* Ratio in 0.1%		*/
	UWORD	ChunkSize;	 /* Chunk size in KB		*/
	BYTE	Description[10]; /* Short description		*/
} XMINFO;






/* XpkSub */


typedef struct XpkInfo {
	UWORD	XpkInfoVersion;
	UWORD	LibVersion;
	UWORD	MasterVersion;
	UWORD	ModesVersion;
	STRPTR	Name;
	STRPTR	LongName;
	STRPTR	Description;
	LONG	ID;
	LONG	Flags;
	LONG	MaxPkInChunk;
	LONG	MinPkInChunk;
	LONG	DefPkInChunk;
	STRPTR	PackMsg;
	STRPTR	UnpackMsg;
	STRPTR	PackedMsg;
	STRPTR	UnpackedMsg;
	UWORD	DefMode;
	UWORD	Pad;
	struct XpkMode *ModeDesc;
	ULONG	Reserved[6];
} XINFO;


typedef struct XpkSubParams {
	APTR	InBuf;	   /* The input data		   */
	LONG	InLen;	   /* The number of bytes to pack  */
	APTR	OutBuf;    /* The output buffer 	   */
	LONG	OutBufLen; /* The length of the output buf */
	LONG	OutLen;    /* Number of bytes written	   */
	LONG	Flags;	   /* Flags for master/sub comm.   */
	LONG	Number;    /* The number of this chunk	   */
	LONG	Mode;	   /* The packing mode to use	   */
	APTR	Password;  /* The password to use	   */
	LONG	Arg[4];    /* Reserved; don't use          */
	LONG	Sub[4];    /* Sublib private data	   */
} XPARAMS;






/* lib-functions */

XINFO *XpksPackerInfo (void);
long XpksPackChunk  (XPARAMS *);
void XpksPackFree   (XPARAMS *);
long XpksPackReset  (XPARAMS *);
long XpksUnpackChunk(XPARAMS *);
void XpksUnpackFree (XPARAMS *);

#ifdef AZTEC_C
#pragma amicall(XpkSubBase,0x1e,XpksPackerInfo())
#pragma amicall(XpkSubBase,0x24,XpksPackChunk(a0))
#pragma amicall(XpkSubBase,0x2a,XpksPackFree(a0))
#pragma amicall(XpkSubBase,0x30,XpksPackReset(a0))
#pragma amicall(XpkSubBase,0x36,XpksUnpackChunk(a0))
#pragma amicall(XpkSubBase,0x3c,XpksUnpackFree(a0))
#else
#pragma libcall XpkSubBase XpksPackerInfo  1E	0
#pragma libcall XpkSubBase XpksPackChunk   24 801
#pragma libcall XpkSubBase XpksPackFree    2A 801
#pragma libcall XpkSubBase XpksPackReset   30 801
#pragma libcall XpkSubBase XpksUnpackChunk 36 801
#pragma libcall XpkSubBase XpksUnpackFree  3C 801
#endif


