/*
**	$Filename: xpknuke.h $
**	$Release: 0.9 $
**
**	(C) Copyright 1991 U. Dominik Mueller & Christian Schneider
**	    All Rights Reserved
*/

#ifndef LIBRARIES_XPKSUB_H
#define LIBRARIES_XPKSUB_H

#ifndef LIBRARIES_XPK_H
#include <libraries/xpk.h>
#endif

#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif



/**************************************************************************
 *
 *                     The XpkInfo structure
 *
 */


/* Sublibs return this structure to xpkmaster when asked nicely
 * This is version 1 of XpkInfo.  It's not #define'd because we don't want
 * it changing automatically with recompiles - you've got to actually update
 * your code when it changes. */
typedef struct XpkInfo {
	UWORD   XpkInfoVersion  ; /* Version number of this structure        */
	UWORD   LibVersion      ; /* The version of this sublibrary          */
	UWORD   MasterVersion   ; /* The required master lib version         */
	UWORD   ModesVersion    ; /* Version number of mode descriptors      */
	STRPTR  Name            ; /* Brief name of the packer, 20 char max   */
	STRPTR  LongName        ; /* Full name of the packer   30 char max   */
	STRPTR  Description     ; /* Short packer desc., 70 char max         */
	LONG    ID              ; /* ID the packer goes by (XPK format)      */
	LONG    Flags           ; /* Defined below                           */
	LONG    MaxPkInChunk    ; /* Max input chunk size for packing        */
	LONG    MinPkInChunk    ; /* Min input chunk size for packing        */
	LONG    DefPkInChunk    ; /* Default packing chunk size              */
	STRPTR  PackMsg         ; /* Packing message, present tense          */
	STRPTR  UnpackMsg       ; /* Unpacking message, present tense        */
	STRPTR  PackedMsg       ; /* Packing message, past tense             */
	STRPTR  UnpackedMsg     ; /* Unpacking message, past tense           */
	UWORD   DefMode         ; /* Default mode number                     */
	UWORD   Pad             ; /* for future use                          */
	struct XpkMode *ModeDesc; /* List of individual descriptors          */
	ULONG   Reserved[6]     ; /* Future expansion - set to zero          */

/*	LABEL	xi_SIZEOF */
} XINFO;

/* Defines for XpkInfo.Flags */
#define XPKIF_PK_CHUNK    0x00000001 /* Library supplies chunk packing       */
#define XPKIF_PK_STREAM   0x00000002 /* Library supplies stream packing      */
#define XPKIF_PK_ARCHIVE  0x00000004 /* Library supplies archive packing     */
#define XPKIF_UP_CHUNK    0x00000008 /* Library supplies chunk unpacking     */
#define XPKIF_UP_STREAM   0x00000010 /* Library supplies stream unpacking    */
#define XPKIF_UP_ARCHIVE  0x00000020 /* Library supplies archive unpacking   */
#define XPKIF_HOOKIO      0x00000080 /* Uses full Hook I/O                   */
#define XPKIF_CHECKING    0x00000400 /* Does its own data checking           */
#define XPKIF_PREREADHDR  0x00000800 /* Unpacker pre-reads the next chunkhdr */
#define XPKIF_ENCRYPTION  0x00002000 /* Sub library supports encryption      */
#define XPKIF_NEEDPASSWD  0x00004000 /* Sub library requires encryption      */
#define XPKIF_MODES       0x00008000 /* Sub library has different modes      */
#define XPKIF_LOSSY       0x00010000 /* Sub library does lossy compression   */

/**************************************************************************
 *
 *                     The XpkSubParams structure
 *
 */

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;

#define XSF_STEPDOWN   1  /* May reduce pack eff. to save mem   */
#define XSF_PREVCHUNK  2  /* Previous chunk available on unpack */


#ifndef NO_SUB_PRAGMAS

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

#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

#else

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

#endif

#endif /* XPKSUB_H */
