windows-nt/Source/XPSP1/NT/base/win32/lz32/winlza/lzcommon.h
2020-09-26 16:20:57 +08:00

63 lines
2.1 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
** lzcommon.h - Shared information for LZ modules.
**
** Author: DavidDi
*/
// Constants
/////////////
#define RING_BUF_LEN 4096 // size of ring buffer
#define MAX_RING_BUF_LEN 4224 // size of ring buffer - from LZFile
// struct declaration in lzexpand.h
#define NIL RING_BUF_LEN // flag index used in binary search
// trees
#define BUF_CLEAR_BYTE ((BYTE) ' ') // rgbyteRingBuf[] initializer
#define MAX_LITERAL_LEN 2 // encode string into position and
// length if match length greater than
// this value (== # of bytes required
// to encode position and length)
#define FIRST_MAX_MATCH_LEN 0x10 // ALG_FIRST used this length
#define LZ_MAX_MATCH_LEN (0x10 + MAX_LITERAL_LEN)
#define LZA_MAX_MATCH_LEN 64
// upper limit for match length
// (n.b., assume length field implies
// length += 3)
// Maximum number of bytes LZDecode() and LZADecode() will expand beyond
// position requested.
#define MAX_OVERRUN ((long)pLZI->cbMaxMatchLen)
// Globals
///////////
extern INT iCurMatch, // index of longest match (set by LZInsertNode())
cbCurMatch; // length of longest match (set by LZInsertNode())
extern DWORD uFlags; // LZ decoding description byte
extern INT iCurRingBufPos; // ring buffer offset
// Prototypes
//////////////
// lzcommon.c
extern BOOL LZInitTree(PLZINFO pLZI);
extern VOID LZFreeTree(PLZINFO pLZI);
extern VOID LZInsertNode(INT nodeToInsert, BOOL bDoArithmeticInsert, PLZINFO pLZI);
extern VOID LZDeleteNode(INT nodeToDelete, PLZINFO pLZI);
// lzcomp.c
extern INT LZEncode(INT doshSource, INT doshDest, PLZINFO pLZI);
// lzexp.c
extern INT LZDecode(INT doshSource, INT doshDest, LONG cblExpandedLength,
BOOL bRestartDecoding, BOOL bFirstAlg, PLZINFO pLZI);