Unit LZSS16

Classes

Functions

LZDecode - Encode
LZDone - #X LZDone

LZInit
LZEncode - #X LZUnsquash

DeleteNode
LZInit - #Z-

Decode
LZSquash - #X LZUnsquash

LZDone
LZUnSquash - #X LZDone

LZSquash

Types

PBinaryTree
PLeftMomTree
PLZRWBuffer
PLZTextBuf
PRightTree
TBinaryTree
TLeftMomTree
TLZRWBuffer
TLZSSWord
TLZTextBuf
TReadProc
TRightTree
TWriteProc

Constants

BinaryTree
F
InBufP
InBufPtr
InBufSize
IsLZInitialized
Log2TLZSSWord
LZRWBufSize
LZSSMemRequired
N
Nul
OutBufP
OutBufPtr
Threshold

Variables

CodeBuf
Height
LastLen
LZReadProc
LZWriteProc
MatchLen
MatchPos


Functions


procedure LZDecode;

Encode

procedure LZDone;

#X LZDone

LZInit


procedure LZEncode;

#X LZUnsquash

DeleteNode


function LZInit : boolean;

#Z-

Decode


procedure LZSquash(ReadProc : TReadProc; WriteProc : TWriteProc);

#X LZUnsquash

LZDone


procedure LZUnSquash(ReadProc : TReadProc; WriteProc : TWriteProc);

#X LZDone

LZSquash


Types


PBinaryTree = ^TBinaryTree

PLeftMomTree = ^TLeftMomTree

PLZRWBuffer = ^TLZRWBuffer
This is declaration for custom write function. It should write Count bytes into WriteBuf, returning the number of actual bytes written. } {#Z+
PLZTextBuf = ^TLZTextBuf
file buffers
PRightTree = ^TRightTree

TBinaryTree = record
TextBuf : TLZTextBuf;
Left : TLeftMomTree;
Right : TRightTree;
Mom : TLeftMomTree
end;

TLeftMomTree = array[0..N] of TLZSSWord;

TLZRWBuffer = array[0..LZRWBufSize - 1] of Byte;

TLZSSWord = word
#Z+} { This unit is ready for use with Dj. Murdoch's ScanHelp utility which will make a Borland .TPH file for it ????? } {#Z-
TLZTextBuf = array[0..N + F - 2] of Byte;

TReadProc = function(var ReadBuf): TLZSSWord
#X LZUnsquash
TRightTree = array[0..N + 256] of TLZSSWord;

TWriteProc = function(var WriteBuf;
                            Count: TLZSSWord): TLZSSWord
#X LZUnsquash

Constants

BinaryTree = nil

#Z+

F = 18

Bigger N -> Better compression on big files only.

InBufP = nil

InBufPtr = LZRWBufSize

InBufSize = LZRWBufSize

IsLZInitialized = false

Log2TLZSSWord = 1

LZRWBufSize = 32000{8192}

LZSSMemRequired = SizeOf(TLZRWBuffer)*2 + SizeOf(TBinaryTree)

N = 4096

Read buffer size } {#Z+

Nul = N * SizeOf(TLZSSWord)

OutBufP = nil

OutBufPtr = 0

Threshold = 2


Variables

CodeBuf : array[0..16] of Byte

Height : TLZSSWord

LastLen : TLZSSWord

LZReadProc : TReadProc

LZWriteProc : TWriteProc

MatchLen : TLZSSWord

MatchPos : TLZSSWord