#ifndef LIBRARIES_COMPRESS_H
#define LIBRARIES_COMPRESS_H

#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif

#define CS_Tags		TAG_USER+'CI'	// Magic value

/* Tags for CompInfo() */
#define CS_ProgramName	(CS_Tags+1)	// Name of program/implementation
#define CS_MakerName	(CS_Tags+2)	// Name of author
#define CS_AlgoName	(CS_Tags+3)	// Name of compression algorithm
#define CS_CompSpeed	(CS_Tags+4)	// Approximate compression speed (CPS)
#define CS_DecompSpeed	(CS_Tags+5)	// Approximate decompression speed
#define CS_AsyncComp	(CS_Tags+6)	// Asynchronous compression supported
#define CS_AsyncDecomp	(CS_Tags+7)	// Asynchronous decompression supported
#define CS_BlockComp	(CS_Tags+8)	// Multiblock compression supported
#define CS_BlockDecomp	(CS_Tags+9)	// Multiblock decompression supported

/* Tags for Compress() and Decompress() */
#define CS_InputBuffer	(CS_Tags+1)	// Pointer to data to compress (required)
#define CS_InputSize	(CS_Tags+2)	// Size of input data (required)
#define CS_OutputBuffer	(CS_Tags+3)	// Pointer to output buffer (required)
#define CS_IOHook	(CS_Tags+4)	// Hook for blocked data I/O (alternate)
#define CS_AsyncMsg	(CS_Tags+5)	// Message to reply when call finished

/* Algorithm-specific definitions */
#define CS_LZMaxBits	(CS_Tags+100)	// Max bits of compression for LZ algorithms

/* Message passed to programs through the IOHook */
struct CompressIOMsg
 {
   long Command;			// Defined below
   void *BlockPtr;			// Next data block (filled by caller)
   long BlockSize;			// Size of data block (filled by caller)
 };
#define CIOMC_NEXTSOURCE	1	// Get next block of source
#define CIOMC_NEXTDEST		2	// Get next destination block

/* Error codes returned by Compress() and Decompress() */
#define CSERR_NOMEMORY		-1	// Not enough memory
#define CSERR_INCOMPATIBLE	-2	// Wrong algorithm
#define CSERR_NOCOMPRESSION	-3	// Would get 0% or worse compression
#define CSERR_CORRUPT		-4	// Corrupt compressed input data
#define CSERR_NOHARDWARE	-5	// Required hardware missing
#define CSERR_HARDFAIL		-6	// Hardware failure
#define CSERR_BADPARAMS		-7	// Bad parameters to comp/decomp call

#endif
