Date : Tue, 15 Jul 1986 01:32:11 GMT
From : Ross Alford <alford%ecsvax.uucp@BRL.ARPA>
Subject: l-z-w crunch and uncrunch
Just to give you something to exercise your new uuencode and uudecode
programs on (see earlier messages for source and object, contact me
if they don't arrive soon), here are two VERY nice utilities for
CP/M. They compress and expand files using the L-Z-W algorithm, and
typically achieve ratios of 50% or better (crunched/uncrunched) on
text, even WordStar text, which the usual sq/usq pair does fairly
poorly on due to use of high-bit-set ASCII (I suppose). I do
not have the source for these. It is available on RCP/M Royal Oak
at 313-759-6569. I have used these successfully on a Kaypro 4-83,
an Apple running 56k Microsoft CP/M, and a NEC8401 laptop. These
little programs are amazing. I wish I had downloaded the source
myself. If anyone has it, I'm sure a posting would be appreciated.
I apologize to the author for lack of acknowledgment, but the .doc
file included here is unaltered from that in the original .lbr.
Ross Alford
...mcnc!ecsvax!alford
This .LBR file contains Revs 1.2 of CRUNCH and UNCRunch.
These programs are 100% upward and downward compatible with prev-
ious releases.
These are data compression utilities. They are completely
analogous to the popular SQueeze and UNSQUEEZE programs, but use
a form of compression known as Lempel-Ziv [-Welch] rather than
Huffman encoding. CRUNCH creates the compressed file from the
original, while UNCR recreates the original from the compressed.
They may be used on any type of file, but compression ratio re-
sults vary according to data type.
Usage: CRUNCH [d:] <filename> [d:]
where the first "d:" is an optional source drive spec for
<filename> and the second "d:" is an optional destination drive
spec for the resulting compressed file. If either "d:" is omit-
ted, the corresponding input or output will be to the currently
logged drive. The output filename will be the same as the input
filename with the middle letter of the extension changed to "Z".
If a file with this name already exists, it will be overwritten.
If the extension of the original file was blank, the extension of
the resulting file will be "ZZZ". Ambiguous filenames
("wildcards") ARE fully supported.
Additionally, the command line above can be followed by a
date or other information inside a pair of square brackets. For
obvious reasons, this is difficult to show clearly on the command
usage line, so hopefully this sentence will suffice. The "stamp"
information is recorded in the header of the crunched file and
reproduced at the console when uncrunching. It has no effect on
the resulting uncrunched file. The stamp may any typeable char-
acters other than "]", and may be any length that will fit on the
command line. A practical limit of 40 characters will be repro-
duced at the console when uncrunching.
The cruncher outputs a running display to the console of the
form:
nnnn/mmmm pp%
where "nnnn" is #of input records read, "mmmm" is #of output
records created, and pp% is the current compression ratio
nnnn/mmmm. When complete, the final line additionally contains
the input and output file sizes converted to "k". These values
are kilobytes (recs/8) upward rounded to the next integral value.
This cruncher will flag the unusual situations where the result-
ing file is larger than the original (ie compression ratio >
100%). When this occurs, the user will be prompted as to whether
he wants to keep the "crunched" file.
Usage: UNCR [d:] <filename> [d:]
where the first "d:" is an optional source drive spec for
<filename> and the second "d:" is an optional destination drive
spec for the resulting uncompressed file. If either "d:" is omit-
ted, the corresponding input or output will be to the currently
logged drive. The output filename will be automatically created
to be the same as the name of the file that was originally comp-
ressed. In general (ie assuming the compressed file has not been
renamed) this is the same as the input filename with the middle
letter of the extension converted from "Z" to an appropriate
character. If a file with this name already exists, it will be
overwritten. Ambiguous filenames ("wildcards") ARE fully suppor-
ted. Note however, that "*.*" will be converted to "*.?Z?".
This is a convenience feature to allow quickly uncrunching all
files with the appropriate extension.
In operation, the uncruncher displays information to the con-
sole analogous to the cruncher. In this case the percent figure
is the "expansion" ratio (still output file size / input file
size).
begin 600 CRUNCH.COM
MPV,!0V]P>7)I9VAT("AC*2!3=&5V96X@1W)E96YB97)G(#8O,38O.#8@(#(P
M,2TV-S M.#<R-"X@36%Y(&)E(')E<')O9'5C960@9F]R(&YO;BUP<F]F:70@
M=7-E(&]N;'DN/G^'ZF\!$94(PZX&[7,+"3$ $CH' -:=, 81@PC#S 81(P3-
MHP;-^P,Z; R )(17 #-(@0A (K- 0<B" DH,Q& _QDX,R$ BB($"<U$"!%<
M ,U3!A,J! GE(P$+ .VPX1$0 !DB! D17 .#\V!!CP@#!%0",/,!A%T",/,
M!A$ DLU3!A,A7 #-U ;9(0 2$0 B 0 V3IF /Y:(!$1-P3-HP;-.P8@H\VT
M!L//!B%= $+ .VP.@F2_B ^6B &,@F2,@N2,@J2S;4%S;0&S9<$/G;-E 4^
M_LV4!2%<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