#ident "$Id: lzs.h,v 1.2 1996/04/30 19:59:11 gary Exp $"
/*****************************************************************************
 * Copyright (c) 1988-95 Digi International Inc., All Rights Reserved
 * 
 * This  software  contains  proprietary  and  confidential   information   of
 * Digi International  Inc.   By  accepting  transfer  of this copy, Recipient
 * agrees to retain this software in  confidence,  to  prevent  disclosure  to
 * others,  and  to make no  use of this software other than that for which it
 * was delivered.  This is an unpublished copyright work  Digi   International
 * Inc.    Except   as   permitted   by  federal  law,  17 USC 117, copying is
 * strictly prohibited.
 * 
 * Digi  International  Inc.  CONFIDENTIAL  -   (Digi    International    Inc.
 * Confidential  when   combined   with   the   aggregated  modules  for  this
 * product) OBJECT CODE ONLY SOURCE MATERIALS
 * 
 * (C) COPYRIGHT Digi International Inc. 1995
 * 
 * All Rights Reserved
 * 
 * US   Government   Users   Restricted   Rights   -   Use,   duplication   or
 * disclosure  restricted by GSA ADP Schedule Contract with Digi International
 * Inc.
 * 
 *****************************************************************************/

/*----------------------------------------------------------------------*/
/* LZS221-C Version 4.0							*/
/*----------------------------------------------------------------------*/
/* LZS.H  -  Function prototypes and constants for LZS221-C		*/
/*		Data Compression Software - a STAC(R) LZS(TM) algorithm	*/
/*									*/
/*  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!	*/
/*  !!                                                              !!	*/
/*  !!  NOTE:                                                       !!	*/
/*  !!  The contents of this document constitute                    !!	*/
/*  !!           CONFIDENTIAL INFORMATION                           !!	*/
/*  !!  		(C) Stac Electronics 1994.                  !!	*/
/*  !!					                            !!	*/
/*  !!      Including one or more U.S. Patents:			    !!	*/
/*  !!		No. 4701745, 5016009, 5126739 and 5146221 and       !!	*/
/*  !!                  other pending patents.              	    !!  */
/*  !!                                                              !!	*/
/*  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!	*/
/*									*/
/*----------------------------------------------------------------------*/
/*									*/
/* Copyright 1988-94 Stac Electronics, Carlsbad, California.		*/
/* All rights reserved.  This code is Stac confidential property, and	*/
/* the algorithms and methods used herein may not be disclosed to any	*/
/* party without express written consent from Stac Electronics.		*/
/*									*/
/*----------------------------------------------------------------------*/
/*	All Stac product names are trademarks or registered trademarks	*/
/*	of Stac Electronics.						*/
/*----------------------------------------------------------------------*/

#ifndef _Lzs_h
#define _Lzs_h

/*----------------------------------------------------------------------*/
/*                                                              	*/
/*   The following variable types must have the following sizes:	*/
/*	unsigned char  =  8 bits					*/
/*       unsigned short = 16 bits					*/
/*       unsigned long  = 32 bits					*/
/*									*/
/*----------------------------------------------------------------------*/

/*----------------------------------------------------------------------*/
/* Symbolic Constants - see PRS-0026 Revision 40 data sheet for details */
/*----------------------------------------------------------------------*/

#define LZS_DEST_EXHAUSTED	2
#define LZS_DEST_FLUSH 		2
#define LZS_DEST_MIN 		16U
#define LZS_END_MARKER 		4
#define LZS_FLUSHED 		4
#define LZS_INVALID 		0
#define LZS_MAX_OVERRUN 	16U
#define LZS_PERFORMANCE_MODE_0 	0
#define LZS_PERFORMANCE_MODE_1 	8
#define LZS_PERFORMANCE_MODE_2 	16
#define LZS_SAVE_HISTORY 	4
#define LZS_SOURCE_EXHAUSTED 	1U
#define LZS_SOURCE_FLUSH 	1
#define LZS_UNCOMPRESSED 	2

/*----------------------------------------------------------------------*/
/* Other constants							*/
/*----------------------------------------------------------------------*/
#define LZS_LITTLE_END		1
#define LZS_BIG_END		2


/*----------------------------------------------------------------------*/
/* Compile Time Options - See data sheet for details			*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* LZS_FAR								*/
/*	This constant must always be defined.  It defaults to a blank.	*/
/*	Add your definition to the end of the line, if required.	*/
/*	Ex: #define LZR_FAR __far					*/
/*----------------------------------------------------------------------*/
#if !defined (LZS_FAR)
#define LZS_FAR
#endif

/*----------------------------------------------------------------------*/
/* LZS_SMALL_BUFFERS							*/
/*	If desired, add the definition after the #if statement.		*/
/*	Ex: #define LZS_SMALL_BUFFERS					*/
/*----------------------------------------------------------------------*/
#if !defined (LZS_SMALL_BUFFERS)
#endif

/*----------------------------------------------------------------------*/
/* LZS_FAST								*/
/*	If desired, add the definition after the #if statement.		*/
/*	Ex: #define LZS_FAST						*/
/*----------------------------------------------------------------------*/
#if !defined (LZS_FAST)
#define LZS_FAST
#endif

/*----------------------------------------------------------------------*/
/* LZS_BYTE_ORDER							*/
/*	This constant must always be defined.  It defaults to 		*/
/*	LZS_LITTLE_END.  Change this to LZS_BIG_END if required.	*/
/*	Ex: #define LZS_BYTE_ORDER LZS_BIG_END				*/
/*----------------------------------------------------------------------*/
#ifdef SOH
#define LZS_BYTE_ORDER	LZS_LITTLE_END
#else
#if !defined (LZS_BYTE_ORDER)
#if POWERPC
#define LZS_BYTE_ORDER	LZS_BIG_END
#else
#define LZS_BYTE_ORDER	LZS_LITTLE_END
#endif
#endif
#endif

/*----------------------------------------------------------------------*/
/* LZS_ALIGNED								*/
/*	If desired, add the definition after the #if statement.		*/
/*	Ex: #define LZS_ALIGNED						*/
/*----------------------------------------------------------------------*/
#if !defined (LZS_ALIGNED)
#endif


/*----------------------------------------------------------------------*/
/* Function Prototypes - see data sheet for details.			*/
/*----------------------------------------------------------------------*/

unsigned short LZS_FAR LZS_SizeOfCompressionHistory(void);

void LZS_FAR LZS_InitCompressionHistory(void LZS_FAR * history);

unsigned short LZS_FAR LZS_Compress(
	unsigned char LZS_FAR * LZS_FAR *source,
	unsigned char LZS_FAR * LZS_FAR *dest,
	unsigned long LZS_FAR           *sourceCnt,
	unsigned long LZS_FAR           *destCnt,
	void 	      LZS_FAR           *history,
	unsigned short                   flags,
	unsigned short                   performance
);

unsigned short LZS_FAR LZS_SizeOfDecompressionHistory(void);

void LZS_FAR LZS_InitDecompressionHistory(void LZS_FAR * history);

unsigned short LZS_FAR LZS_Decompress(
	unsigned char LZS_FAR * LZS_FAR *source,
	unsigned char LZS_FAR * LZS_FAR *dest,
	unsigned long LZS_FAR           *sourceCnt,
	unsigned long LZS_FAR           *destCnt,
	void 	      LZS_FAR           *history,
	unsigned short                   flags
);

#endif

/*------------------------- end of LZS.H -------------------------------*/
