Home | History | Annotate | Line # | Download | only in doc
README revision 1.1
      1  1.1  cgd 
      2  1.1  cgd 	@(#)README	5.3 (Berkeley) 9/17/85
      3  1.1  cgd 
      4  1.1  cgd Compress version 4.0 improvements over 3.0:
      5  1.1  cgd 	o compress() speedup (10-50%) by changing division hash to xor
      6  1.1  cgd 	o decompress() speedup (5-10%)
      7  1.1  cgd 	o Memory requirements reduced (3-30%)
      8  1.1  cgd 	o Stack requirements reduced to less than 4kb
      9  1.1  cgd 	o Removed 'Big+Fast' compress code (FBITS) because of compress speedup
     10  1.1  cgd     	o Portability mods for Z8000 and PC/XT (but not zeus 3.2)
     11  1.1  cgd 	o Default to 'quiet' mode
     12  1.1  cgd 	o Unification of 'force' flags
     13  1.1  cgd 	o Manual page overhaul
     14  1.1  cgd 	o Portability enhancement for M_XENIX
     15  1.1  cgd 	o Removed text on #else and #endif
     16  1.1  cgd 	o Added "-V" switch to print version and options
     17  1.1  cgd 	o Added #defines for SIGNED_COMPARE_SLOW
     18  1.1  cgd 	o Added Makefile and "usermem" program
     19  1.1  cgd 	o Removed all floating point computations
     20  1.1  cgd 	o New programs: [deleted]
     21  1.1  cgd 
     22  1.1  cgd The "usermem" script attempts to determine the maximum process size.  Some
     23  1.1  cgd editing of the script may be necessary (see the comments).  [It should work
     24  1.1  cgd fine on 4.3 bsd.] If you can't get it to work at all, just create file
     25  1.1  cgd "USERMEM" containing the maximum process size in decimal.
     26  1.1  cgd 
     27  1.1  cgd The following preprocessor symbols control the compilation of "compress.c":
     28  1.1  cgd 
     29  1.1  cgd 	o USERMEM		Maximum process memory on the system
     30  1.1  cgd 	o SACREDMEM		Amount to reserve for other proceses
     31  1.1  cgd 	o SIGNED_COMPARE_SLOW	Unsigned compare instructions are faster
     32  1.1  cgd 	o NO_UCHAR		Don't use "unsigned char" types
     33  1.1  cgd 	o BITS			Overrules default set by USERMEM-SACREDMEM
     34  1.1  cgd 	o vax			Generate inline assembler
     35  1.1  cgd 	o interdata		Defines SIGNED_COMPARE_SLOW
     36  1.1  cgd 	o M_XENIX		Makes arrays < 65536 bytes each
     37  1.1  cgd 	o pdp11			BITS=12, NO_UCHAR
     38  1.1  cgd 	o z8000			BITS=12
     39  1.1  cgd 	o pcxt			BITS=12
     40  1.1  cgd 	o BSD4_2		Allow long filenames ( > 14 characters) &
     41  1.1  cgd 				Call setlinebuf(stderr)
     42  1.1  cgd 
     43  1.1  cgd The difference "usermem-sacredmem" determines the maximum BITS that can be
     44  1.1  cgd specified with the "-b" flag.
     45  1.1  cgd 
     46  1.1  cgd memory: at least		BITS
     47  1.1  cgd ------  -- -----                ----
     48  1.1  cgd      433,484			 16
     49  1.1  cgd      229,600			 15
     50  1.1  cgd      127,536			 14
     51  1.1  cgd       73,464			 13
     52  1.1  cgd            0			 12
     53  1.1  cgd 
     54  1.1  cgd The default is BITS=16.
     55  1.1  cgd 
     56  1.1  cgd The maximum bits can be overrulled by specifying "-DBITS=bits" at
     57  1.1  cgd compilation time.
     58  1.1  cgd 
     59  1.1  cgd WARNING: files compressed on a large machine with more bits than allowed by 
     60  1.1  cgd a version of compress on a smaller machine cannot be decompressed!  Use the
     61  1.1  cgd "-b12" flag to generate a file on a large machine that can be uncompressed 
     62  1.1  cgd on a 16-bit machine.
     63  1.1  cgd 
     64  1.1  cgd The output of compress 4.0 is fully compatible with that of compress 3.0.
     65  1.1  cgd In other words, the output of compress 4.0 may be fed into uncompress 3.0 or
     66  1.1  cgd the output of compress 3.0 may be fed into uncompress 4.0.
     67  1.1  cgd 
     68  1.1  cgd The output of compress 4.0 not compatible with that of
     69  1.1  cgd compress 2.0.  However, compress 4.0 still accepts the output of
     70  1.1  cgd compress 2.0.  To generate output that is compatible with compress
     71  1.1  cgd 2.0, use the undocumented "-C" flag.
     72  1.1  cgd 
     73  1.1  cgd 	-from mod.sources, submitted by vax135!petsd!joe (Joe Orost), 8/1/85
     74  1.1  cgd --------------------------------
     75  1.1  cgd 
     76  1.1  cgd Enclosed is compress version 3.0 with the following changes:
     77  1.1  cgd 
     78  1.1  cgd 1.	"Block" compression is performed.  After the BITS run out, the
     79  1.1  cgd 	compression ratio is checked every so often.  If it is decreasing,
     80  1.1  cgd 	the table is cleared and a new set of substrings are generated.
     81  1.1  cgd 
     82  1.1  cgd 	This makes the output of compress 3.0 not compatible with that of
     83  1.1  cgd 	compress 2.0.  However, compress 3.0 still accepts the output of
     84  1.1  cgd 	compress 2.0.  To generate output that is compatible with compress
     85  1.1  cgd 	2.0, use the undocumented "-C" flag.
     86  1.1  cgd 
     87  1.1  cgd 2.	A quiet "-q" flag has been added for use by the news system.
     88  1.1  cgd 
     89  1.1  cgd 3.	The character chaining has been deleted and the program now uses
     90  1.1  cgd 	hashing.  This improves the speed of the program, especially
     91  1.1  cgd 	during decompression.  Other speed improvements have been made,
     92  1.1  cgd 	such as using putc() instead of fwrite().
     93  1.1  cgd 
     94  1.1  cgd 4.	A large table is used on large machines when a relatively small
     95  1.1  cgd 	number of bits is specified.  This saves much time when compressing
     96  1.1  cgd 	for a 16-bit machine on a 32-bit virtual machine.  Note that the
     97  1.1  cgd 	speed improvement only occurs when the input file is > 30000
     98  1.1  cgd 	characters, and the -b BITS is less than or equal to the cutoff
     99  1.1  cgd 	described below.
    100  1.1  cgd 
    101  1.1  cgd Most of these changes were made by James A. Woods (ames!jaw).  Thank you
    102  1.1  cgd James!
    103  1.1  cgd 
    104  1.1  cgd To compile compress:
    105  1.1  cgd 
    106  1.1  cgd 	cc -O -DUSERMEM=usermem -o compress compress.c
    107  1.1  cgd 
    108  1.1  cgd Where "usermem" is the amount of physical user memory available (in bytes).  
    109  1.1  cgd If any physical memory is to be reserved for other processes, put in 
    110  1.1  cgd "-DSACREDMEM sacredmem", where "sacredmem" is the amount to be reserved.
    111  1.1  cgd 
    112  1.1  cgd The difference "usermem-sacredmem" determines the maximum BITS that can be
    113  1.1  cgd specified, and the cutoff bits where the large+fast table is used.
    114  1.1  cgd 
    115  1.1  cgd memory: at least		BITS		cutoff
    116  1.1  cgd ------  -- -----                ----            ------
    117  1.1  cgd    4,718,592 			 16		  13
    118  1.1  cgd    2,621,440 			 16		  12
    119  1.1  cgd    1,572,864			 16		  11
    120  1.1  cgd    1,048,576			 16		  10
    121  1.1  cgd      631,808			 16               --
    122  1.1  cgd      329,728			 15               --
    123  1.1  cgd      178,176			 14		  --
    124  1.1  cgd       99,328			 13		  --
    125  1.1  cgd            0			 12		  --
    126  1.1  cgd 
    127  1.1  cgd The default memory size is 750,000 which gives a maximum BITS=16 and no
    128  1.1  cgd large+fast table.
    129  1.1  cgd 
    130  1.1  cgd The maximum bits can be overruled by specifying "-DBITS=bits" at
    131  1.1  cgd compilation time.
    132  1.1  cgd 
    133  1.1  cgd If your machine doesn't support unsigned characters, define "NO_UCHAR" 
    134  1.1  cgd when compiling.
    135  1.1  cgd 
    136  1.1  cgd If your machine has "int" as 16-bits, define "SHORT_INT" when compiling.
    137  1.1  cgd 
    138  1.1  cgd After compilation, move "compress" to a standard executable location, such 
    139  1.1  cgd as /usr/local.  Then:
    140  1.1  cgd 	cd /usr/local
    141  1.1  cgd 	ln compress uncompress
    142  1.1  cgd 	ln compress zcat
    143  1.1  cgd 
    144  1.1  cgd On machines that have a fixed stack size (such as Perkin-Elmer), set the
    145  1.1  cgd stack to at least 12kb.  ("setstack compress 12" on Perkin-Elmer).
    146  1.1  cgd 
    147  1.1  cgd Next, install the manual (compress.l).
    148  1.1  cgd 	cp compress.l /usr/man/manl
    149  1.1  cgd 	cd /usr/man/manl
    150  1.1  cgd 	ln compress.l uncompress.l
    151  1.1  cgd 	ln compress.l zcat.l
    152  1.1  cgd 
    153  1.1  cgd 		- or -
    154  1.1  cgd 
    155  1.1  cgd 	cp compress.l /usr/man/man1/compress.1
    156  1.1  cgd 	cd /usr/man/man1
    157  1.1  cgd 	ln compress.1 uncompress.1
    158  1.1  cgd 	ln compress.1 zcat.1
    159  1.1  cgd 
    160  1.1  cgd 					regards,
    161  1.1  cgd 					petsd!joe
    162  1.1  cgd 
    163  1.1  cgd Here is a note from the net:
    164  1.1  cgd 
    165  1.1  cgd >From hplabs!pesnta!amd!turtlevax!ken Sat Jan  5 03:35:20 1985
    166  1.1  cgd Path: ames!hplabs!pesnta!amd!turtlevax!ken
    167  1.1  cgd From: ken (a] turtlevax.UUCP (Ken Turkowski)
    168  1.1  cgd Newsgroups: net.sources
    169  1.1  cgd Subject: Re: Compress release 3.0 : sample Makefile
    170  1.1  cgd Organization: CADLINC, Inc. @ Menlo Park, CA
    171  1.1  cgd 
    172  1.1  cgd In the compress 3.0 source recently posted to mod.sources, there is a
    173  1.1  cgd #define variable which can be set for optimum performance on a machine
    174  1.1  cgd with a large amount of memory.  A program (usermem) to calculate the
    175  1.1  cgd useable amount of physical user memory is enclosed, as well as a sample
    176  1.1  cgd 4.2bsd Vax Makefile for compress.
    177  1.1  cgd 
    178  1.1  cgd Here is the README file from the previous version of compress (2.0):
    179  1.1  cgd 
    180  1.1  cgd >Enclosed is compress.c version 2.0 with the following bugs fixed:
    181  1.1  cgd >
    182  1.1  cgd >1.	The packed files produced by compress are different on different
    183  1.1  cgd >	machines and dependent on the vax sysgen option.
    184  1.1  cgd >		The bug was in the different byte/bit ordering on the
    185  1.1  cgd >		various machines.  This has been fixed.
    186  1.1  cgd >
    187  1.1  cgd >		This version is NOT compatible with the original vax posting
    188  1.1  cgd >		unless the '-DCOMPATIBLE' option is specified to the C
    189  1.1  cgd >		compiler.  The original posting has a bug which I fixed, 
    190  1.1  cgd >		causing incompatible files.  I recommend you NOT to use this
    191  1.1  cgd >		option unless you already have a lot of packed files from
    192  1.1  cgd >		the original posting by thomas.
    193  1.1  cgd >2.	The exit status is not well defined (on some machines) causing the
    194  1.1  cgd >	scripts to fail.
    195  1.1  cgd >		The exit status is now 0,1 or 2 and is documented in
    196  1.1  cgd >		compress.l.
    197  1.1  cgd >3.	The function getopt() is not available in all C libraries.
    198  1.1  cgd >		The function getopt() is no longer referenced by the
    199  1.1  cgd >		program.
    200  1.1  cgd >4.	Error status is not being checked on the fwrite() and fflush() calls.
    201  1.1  cgd >		Fixed.
    202  1.1  cgd >
    203  1.1  cgd >The following enhancements have been made:
    204  1.1  cgd >
    205  1.1  cgd >1.	Added facilities of "compact" into the compress program.  "Pack",
    206  1.1  cgd >	"Unpack", and "Pcat" are no longer required (no longer supplied).
    207  1.1  cgd >2.	Installed work around for C compiler bug with "-O".
    208  1.1  cgd >3.	Added a magic number header (\037\235).  Put the bits specified
    209  1.1  cgd >	in the file.
    210  1.1  cgd >4.	Added "-f" flag to force overwrite of output file.
    211  1.1  cgd >5.	Added "-c" flag and "zcat" program.  'ln compress zcat' after you
    212  1.1  cgd >	compile.
    213  1.1  cgd >6.	The 'uncompress' script has been deleted; simply 
    214  1.1  cgd >	'ln compress uncompress' after you compile and it will work.
    215  1.1  cgd >7.	Removed extra bit masking for machines that support unsigned
    216  1.1  cgd >	characters.  If your machine doesn't support unsigned characters,
    217  1.1  cgd >	define "NO_UCHAR" when compiling.
    218  1.1  cgd >
    219  1.1  cgd >Compile "compress.c" with "-O -o compress" flags.  Move "compress" to a
    220  1.1  cgd >standard executable location, such as /usr/local.  Then:
    221  1.1  cgd >	cd /usr/local
    222  1.1  cgd >	ln compress uncompress
    223  1.1  cgd >	ln compress zcat
    224  1.1  cgd >
    225  1.1  cgd >On machines that have a fixed stack size (such as Perkin-Elmer), set the
    226  1.1  cgd >stack to at least 12kb.  ("setstack compress 12" on Perkin-Elmer).
    227  1.1  cgd >
    228  1.1  cgd >Next, install the manual (compress.l).
    229  1.1  cgd >	cp compress.l /usr/man/manl		- or -
    230  1.1  cgd >	cp compress.l /usr/man/man1/compress.1
    231  1.1  cgd >
    232  1.1  cgd >Here is the README that I sent with my first posting:
    233  1.1  cgd >
    234  1.1  cgd >>Enclosed is a modified version of compress.c, along with scripts to make it
    235  1.1  cgd >>run identically to pack(1), unpack(1), an pcat(1).  Here is what I
    236  1.1  cgd >>(petsd!joe) and a colleague (petsd!peora!srd) did:
    237  1.1  cgd >>
    238  1.1  cgd >>1. Removed VAX dependencies.
    239  1.1  cgd >>2. Changed the struct to separate arrays; saves mucho memory.
    240  1.1  cgd >>3. Did comparisons in unsigned, where possible.  (Faster on Perkin-Elmer.)
    241  1.1  cgd >>4. Sorted the character next chain and changed the search to stop
    242  1.1  cgd >>prematurely.  This saves a lot on the execution time when compressing.
    243  1.1  cgd >>
    244  1.1  cgd >>This version is totally compatible with the original version.  Even though
    245  1.1  cgd >>lint(1) -p has no complaints about compress.c, it won't run on a 16-bit
    246  1.1  cgd >>machine, due to the size of the arrays.
    247  1.1  cgd >>
    248  1.1  cgd >>Here is the README file from the original author:
    249  1.1  cgd >> 
    250  1.1  cgd >>>Well, with all this discussion about file compression (for news batching
    251  1.1  cgd >>>in particular) going around, I decided to implement the text compression
    252  1.1  cgd >>>algorithm described in the June Computer magazine.  The author claimed
    253  1.1  cgd >>>blinding speed and good compression ratios.  It's certainly faster than
    254  1.1  cgd >>>compact (but, then, what wouldn't be), but it's also the same speed as
    255  1.1  cgd >>>pack, and gets better compression than both of them.  On 350K bytes of
    256  1.1  cgd >>>unix-wizards, compact took about 8 minutes of CPU, pack took about 80
    257  1.1  cgd >>>seconds, and compress (herein) also took 80 seconds.  But, compact and
    258  1.1  cgd >>>pack got about 30% compression, whereas compress got over 50%.  So, I
    259  1.1  cgd >>>decided I had something, and that others might be interested, too.
    260  1.1  cgd >>>
    261  1.1  cgd >>>As is probably true of compact and pack (although I haven't checked),
    262  1.1  cgd >>>the byte order within a word is probably relevant here, but as long as
    263  1.1  cgd >>>you stay on a single machine type, you should be ok.  (Can anybody
    264  1.1  cgd >>>elucidate on this?)  There are a couple of asm's in the code (extv and
    265  1.1  cgd >>>insv instructions), so anyone porting it to another machine will have to
    266  1.1  cgd >>>deal with this anyway (and could probably make it compatible with Vax
    267  1.1  cgd >>>byte order at the same time).  Anyway, I've linted the code (both with
    268  1.1  cgd >>>and without -p), so it should run elsewhere.  Note the longs in the
    269  1.1  cgd >>>code, you can take these out if you reduce BITS to <= 15.
    270  1.1  cgd >>>
    271  1.1  cgd >>>Have fun, and as always, if you make good enhancements, or bug fixes,
    272  1.1  cgd >>>I'd like to see them.
    273  1.1  cgd >>>
    274  1.1  cgd >>>=Spencer (thomas@utah-20, {harpo,hplabs,arizona}!utah-cs!thomas)
    275  1.1  cgd >>
    276  1.1  cgd >>					regards,
    277  1.1  cgd >>					joe
    278  1.1  cgd >>
    279  1.1  cgd >>--
    280  1.1  cgd >>Full-Name:  Joseph M. Orost
    281  1.1  cgd >>UUCP:       ..!{decvax,ucbvax,ihnp4}!vax135!petsd!joe
    282  1.1  cgd >>US Mail:    MS 313; Perkin-Elmer; 106 Apple St; Tinton Falls, NJ 07724
    283  1.1  cgd >>Phone:      (201) 870-5844
    284