home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ckc072.zip / ckdcomp.hlp < prev    next >
Text File  |  1988-08-16  |  18KB  |  439 lines

  1. Compress version 4.0 improvements:
  2.     o compress() speedup (10-50%) by changing division hash to xor
  3.     o decompress() speedup (5-10%)
  4.     o Memory requirements reduced (3-30%)
  5.     o Stack requirements reduced to less than 4kb
  6.     o Removed 'Big+Fast' compress code (FBITS) because of compress speedup
  7.         o Portability mods for Z8000 and PC/XT (but not zeus 3.2)
  8.     o Default to 'quiet' mode
  9.     o Unification of 'force' flags
  10.     o Manual page overhaul
  11.     o Portability enhancement for M_XENIX
  12.     o Removed text on #else and #endif
  13.     o Added "-V" switch to print version and options
  14.     o Added #defines for SIGNED_COMPARE_SLOW
  15.     o Added Makefile and "usermem" program
  16.     o Removed all floating point computations
  17.     o New programs:
  18.         compressdir - compress all files on a directory
  19.         uncompressdir - uncompress all files on a directory
  20.         zcmp - cmp compressed files
  21.         zdiff - diff compressed files
  22.       The following are with thanks to philabs!per:
  23.         btoa - convert binary to ascii for mailing
  24.         atob - convert ascii to binary with checksum
  25.         tarmail - tar, compress, btoa, and mail files
  26.         untarmail - restore "tarmail" files
  27.  
  28.         WARNING: These last few programs are not compatible 
  29.         with the original ones from the net.  The encoding
  30.         has changed.  See btoa.c for more info.
  31.  
  32. The "usermem" script attempts to determine the maximum process size.  Some
  33. editing of the script may be necessary (see the comments).  If you can't get
  34. it to work at all, just create file "USERMEM" containing the maximum process
  35. size in decimal.
  36.  
  37. The following preprocessor symbols control the compilation of "compress.c":
  38.  
  39.     o USERMEM        Maximum process memory on the system
  40.     o SACREDMEM        Amount to reserve for other proceses
  41.     o SIGNED_COMPARE_SLOW    Unsigned compare instructions are faster
  42.     o NO_UCHAR        Don't use "unsigned char" types
  43.     o BITS            Overrules default set by USERMEM-SACREDMEM
  44.     o vax            Generate inline assembler
  45.     o interdata        Defines SIGNED_COMPARE_SLOW
  46.     o M_XENIX        Makes arrays < 65536 bytes each
  47.     o pdp11            BITS=12, NO_UCHAR
  48.     o z8000            BITS=12
  49.     o pcxt            BITS=12
  50.     o BSD4_2        Allow long filenames ( > 14 characters) &
  51.                 Call setlinebuf(stderr)
  52.  
  53. The difference "usermem-sacredmem" determines the maximum BITS that can be
  54. specified with the "-b" flag.
  55.  
  56. memory: at least        BITS
  57. ------  -- -----                ----
  58.      433,484             16
  59.      229,600             15
  60.      127,536             14
  61.       73,464             13
  62.            0             12
  63.  
  64. The default is BITS=16.
  65.  
  66. The maximum bits can be overrulled by specifying "-DBITS=bits" at
  67. compilation time.
  68.  
  69. WARNING: files compressed on a large machine with more bits than allowed by 
  70. a version of compress on a smaller machine cannot be decompressed!  Use the
  71. "-b12" flag to generate a file on a large machine that can be uncompressed 
  72. on a 16-bit machine.
  73.  
  74. The output of compress 4.0 is fully compatible with that of compress 3.0.
  75. In other words, the output of compress 4.0 may be fed into uncompress 3.0 or
  76. the output of compress 3.0 may be fed into uncompress 4.0.
  77.  
  78. The output of compress 4.0 not compatable with that of
  79. compress 2.0.  However, compress 4.0 still accepts the output of
  80. compress 2.0.  To generate output that is compatable with compress
  81. 2.0, use the undocumented "-C" flag.
  82.  
  83. Check the Makefile, then "make".
  84. # "When in danger, or when in doubt,
  85.    Run in circles, scream and shout."  -- Uncle Schuapp
  86.  
  87.      compress.c, after being stable for some months, is about to
  88. transmogrify before BSD 4.3 release.  Changes reflect:
  89.  
  90.      (a) mods for portability to a wider class of machines
  91.      (PC XT, Z8000, Cray, etc.)
  92.  
  93.      (b) a 5-10% speedup to 'uncompress'.
  94.  
  95.      (c) several minor bug fixes and option flag changes, largely
  96.      invisible to users.  one recently-repaired gaffe, discussed below,
  97.      acknowledges the possibility of corrupted files under
  98.      (presumably) rare conditions.
  99.  
  100.      (d) a more succinct manual page.
  101.  
  102.      (e) NO file format change.
  103.      
  104. The compress special-interest group is now testing the new version,
  105. to be distributed also with 2.10.3 news.
  106.  
  107.      Now for the only hard bug we've seen with the RCS 3.0 release.
  108. This only affects files compressed sub-optimally on large machines
  109. via a multi-file command line, e.g. with
  110.  
  111.     compress -b12 file1 file2
  112.  
  113. Ignore this matter unless all the conditions below are met.
  114.  
  115.      (a) You have a 32-bit machine with over 2.5 megabytes of user space.
  116.      PDP 11s and most 68K boxes need not apply.
  117.  
  118.      (b) compress.c RCS 3.0 was compiled with -DUSERMEM set.
  119.  
  120.          (This may be hard to determine, because the shell script
  121.      to aid with this, distributed after RCS 3.0 was posted (along
  122.      with readnews 2.10.2), may fail on systems with protected /dev/kmem.
  123.      If this is the case, you have another reason NOT to worry.)
  124.  
  125.      (c) Users may have had motive to compress multiple files
  126.      using a single command using the non-default -b flag.
  127.  
  128.      -b was made visible largely for compatible file xfer
  129.      from 32-bit machines to 16-bit ones because of differences
  130.      in the algorithm.  However assuming (a) + (b), it also may
  131.      elicit a 20% (or so) speedup for files at the expense of
  132.      compression rate -- since the applications for this are
  133.      rather specialized, this is not recommended, and in fact the
  134.      flag may be hidden from the general user in this form come
  135.      the next distribution.
  136.  
  137. Candidates for corrupt files may be found using:
  138.  
  139.     find / -name '*.Z' -print |
  140.     while
  141.         read x
  142.     do        # test 3rd byte of magic number against 16
  143.         dd if=$x ibs=1 obs=1 skip=2 count=1 2>/dev/null | \
  144.             od | grep -v -s '20$' \
  145.             || echo $x
  146.     done
  147.  
  148. (that's a Bourne/McCarthy "OR" cmd before the echo), or with the 'find' line
  149. replaced by the swifter
  150.  
  151.     find .Z
  152.  
  153. if you run the Ames fast file finder.  Any files listed may just be ones
  154. uploaded from a smaller machine (safe), or ones safely compressed
  155. suboptimally with a larger -b which doesn't trigger the USERMEM code
  156. (oh, nevermind).  Anyhow, the true bad news test is:
  157.  
  158.     compress -c -d file > /dev/null
  159.  
  160. and if this core dumps, I hope you have a backup tape with a pure file.
  161. Yes, you're right, few things are worse than a bug in a data compressor,
  162. but I really doubt you'll find files like this.  News compression is
  163. immune, by the way, since the standard 'cbatch' script uses stdin rather
  164. than multiple files.
  165.  
  166.      After all this, the immediate bug fix and preventive tonic is to
  167. re-compile compress.c with the unadorned
  168.  
  169.     cc -O compress.c -o /usr/bin/compress
  170.  
  171. Send mail to me if you're desparate for a real bug fix, or, better yet,
  172. wait for the new release.
  173.  
  174.      --James A. Woods   {dual,ihnp4}!ames!jaw     or, jaw@riacs
  175.  
  176.  
  177.  
  178. This is a partial re-release of compress version 4.0, first released
  179. on disk #6.  I had reports of problems with that released version,
  180. and at the time, was not using it myself.
  181.  
  182. However, I now regularly compress files on several unix hosts before
  183. downloading to the amiga (and vice versa) so this version of compress
  184. has had more testing and I am far more confident in it working correctly.
  185.  
  186. Except for the manual page, I have only included files that have changed,
  187. refer to disk #6 for the rest of the released files.
  188.  
  189. There are several versions of the compress executable, each with an
  190. extension of the form ".bxx", where "xx" is the maximum number of
  191. "bits" that compress is capable of handling.  The larger the number of
  192. "bits", the more memory required to execute compress.  Note that most
  193. Unix versions of compress use 16 for bits by default and thus produce
  194. compressed files that cannot be decompressed on a standard 512K amiga.
  195. To be safe, when compressing files on a Unix system, give compress
  196. a -b15 arg, or even -b14.
  197.  
  198. One last note.  This version will compile under Manx 3.30E but crashes
  199. the machine when run.  I have not yet bothered to track down the bug
  200. and fix it, so the executables are all Lattice (3.10) executables.
  201.  
  202. LATE NEWS FLASH -- I have just experienced some problems with large binary
  203. files compressed on a Sun and downloaded to the Amiga.  Decompressing 
  204. sometimes yields files that are 10 or 20 times bigger.  A 30K compressed
  205. file was expanded to over 600K.  Compress is efficient, but not THAT
  206. efficient!  Groan.  And just when I thought we were home free.  I am not
  207. certain that it is a problem with compress, but beware...
  208.  
  209. -Fred
  210. 25-Dec-86    (Merry Christmas!!)
  211. Enclosed is compress version 3.0 with the following changes:
  212.  
  213. 1.    "Block" compression is performed.  After the BITS run out, the
  214.     compression ratio is checked every so often.  If it is decreasing,
  215.     the table is cleared and a new set of substrings are generated.
  216.  
  217.     This makes the output of compress 3.0 not compatable with that of
  218.     compress 2.0.  However, compress 3.0 still accepts the output of
  219.     compress 2.0.  To generate output that is compatable with compress
  220.     2.0, use the undocumented "-C" flag.
  221.  
  222. 2.    A quiet "-q" flag has been added for use by the news system.
  223.  
  224. 3.    The character chaining has been deleted and the program now uses
  225.     hashing.  This improves the speed of the program, especially
  226.     during decompression.  Other speed improvements have been made,
  227.     such as using putc() instead of fwrite().
  228.  
  229. 4.    A large table is used on large machines when a relatively small
  230.     number of bits is specified.  This saves much time when compressing
  231.     for a 16-bit machine on a 32-bit virtual machine.  Note that the
  232.     speed improvement only occurs when the input file is > 30000
  233.     characters, and the -b BITS is less than or equal to the cutoff
  234.     described below.
  235.  
  236. Most of these changes were made by James A. Woods (ames!jaw).  Thank you
  237. James!
  238.  
  239. Version 3.0 has been beta tested on many machines.
  240.  
  241. To compile compress:
  242.  
  243.     cc -O -DUSERMEM=usermem -o compress compress.c
  244.  
  245. Where "usermem" is the amount of physical user memory available (in bytes).  
  246. If any physical memory is to be reserved for other processes, put in 
  247. "-DSACREDMEM sacredmem", where "sacredmem" is the amount to be reserved.
  248.  
  249. The difference "usermem-sacredmem" determines the maximum BITS that can be
  250. specified, and the cutoff bits where the large+fast table is used.
  251.  
  252. memory: at least        BITS        cutoff
  253. ------  -- -----                ----            ------
  254.    4,718,592              16          13
  255.    2,621,440              16          12
  256.    1,572,864             16          11
  257.    1,048,576             16          10
  258.      631,808             16               --
  259.      329,728             15               --
  260.      178,176             14          --
  261.       99,328             13          --
  262.            0             12          --
  263.  
  264. The default memory size is 750,000 which gives a maximum BITS=16 and no
  265. large+fast table.
  266.  
  267. The maximum bits can be overrulled by specifying "-DBITS=bits" at
  268. compilation time.
  269.  
  270. If your machine doesn't support unsigned characters, define "NO_UCHAR" 
  271. when compiling.
  272.  
  273. If your machine has "int" as 16-bits, define "SHORT_INT" when compiling.
  274.  
  275. After compilation, move "compress" to a standard executable location, such 
  276. as /usr/local.  Then:
  277.     cd /usr/local
  278.     ln compress uncompress
  279.     ln compress zcat
  280.  
  281. On machines that have a fixed stack size (such as Perkin-Elmer), set the
  282. stack to at least 12kb.  ("setstack compress 12" on Perkin-Elmer).
  283.  
  284. Next, install the manual (compress.l).
  285.     cp compress.l /usr/man/manl
  286.     cd /usr/man/manl
  287.     ln compress.l uncompress.l
  288.     ln compress.l zcat.l
  289.  
  290.         - or -
  291.  
  292.     cp compress.l /usr/man/man1/compress.1
  293.     cd /usr/man/man1
  294.     ln compress.1 uncompress.1
  295.     ln compress.1 zcat.1
  296.  
  297. The zmore shell script and manual page are for use on systems that have a
  298. "more(1)" program.  Install the shell script and the manual page in a "bin"
  299. and "man" directory, respectively.  If your system doesn't have the
  300. "more(1)" program, just skip "zmore".
  301.  
  302.                     regards,
  303.                     petsd!joe
  304.  
  305. Here is the README file from the previous version of compress (2.0):
  306.  
  307. >Enclosed is compress.c version 2.0 with the following bugs fixed:
  308. >
  309. >1.    The packed files produced by compress are different on different
  310. >    machines and dependent on the vax sysgen option.
  311. >        The bug was in the different byte/bit ordering on the
  312. >        various machines.  This has been fixed.
  313. >
  314. >        This version is NOT compatible with the original vax posting
  315. >        unless the '-DCOMPATIBLE' option is specified to the C
  316. >        compiler.  The original posting has a bug which I fixed, 
  317. >        causing incompatible files.  I recommend you NOT to use this
  318. >        option unless you already have a lot of packed files from
  319. >        the original posting by thomas.
  320. >2.    The exit status is not well defined (on some machines) causing the
  321. >    scripts to fail.
  322. >        The exit status is now 0,1 or 2 and is documented in
  323. >        compress.l.
  324. >3.    The function getopt() is not available in all C libraries.
  325. >        The function getopt() is no longer referenced by the
  326. >        program.
  327. >4.    Error status is not being checked on the fwrite() and fflush() calls.
  328. >        Fixed.
  329. >
  330. >The following enhancements have been made:
  331. >
  332. >1.    Added facilities of "compact" into the compress program.  "Pack",
  333. >    "Unpack", and "Pcat" are no longer required (no longer supplied).
  334. >2.    Installed work around for C compiler bug with "-O".
  335. >3.    Added a magic number header (\037\235).  Put the bits specified
  336. >    in the file.
  337. >4.    Added "-f" flag to force overwrite of output file.
  338. >5.    Added "-c" flag and "zcat" program.  'ln compress zcat' after you
  339. >    compile.
  340. >6.    The 'uncompress' script has been deleted; simply 
  341. >    'ln compress uncompress' after you compile and it will work.
  342. >7.    Removed extra bit masking for machines that support unsigned
  343. >    characters.  If your machine doesn't support unsigned characters,
  344. >    define "NO_UCHAR" when compiling.
  345. >
  346. >Compile "compress.c" with "-O -o compress" flags.  Move "compress" to a
  347. >standard executable location, such as /usr/local.  Then:
  348. >    cd /usr/local
  349. >    ln compress uncompress
  350. >    ln compress zcat
  351. >
  352. >On machines that have a fixed stack size (such as Perkin-Elmer), set the
  353. >stack to at least 12kb.  ("setstack compress 12" on Perkin-Elmer).
  354. >
  355. >Next, install the manual (compress.l).
  356. >    cp compress.l /usr/man/manl        - or -
  357. >    cp compress.l /usr/man/man1/compress.1
  358. >
  359. >Here is the README that I sent with my first posting:
  360. >
  361. >>Enclosed is a modified version of compress.c, along with scripts to make it
  362. >>run identically to pack(1), unpack(1), an pcat(1).  Here is what I
  363. >>(petsd!joe) and a colleague (petsd!peora!srd) did:
  364. >>
  365. >>1. Removed VAX dependencies.
  366. >>2. Changed the struct to separate arrays; saves mucho memory.
  367. >>3. Did comparisons in unsigned, where possible.  (Faster on Perkin-Elmer.)
  368. >>4. Sorted the character next chain and changed the search to stop
  369. >>prematurely.  This saves a lot on the execution time when compressing.
  370. >>
  371. >>This version is totally compatible with the original version.  Even though
  372. >>lint(1) -p has no complaints about compress.c, it won't run on a 16-bit
  373. >>machine, due to the size of the arrays.
  374. >>
  375. >>Here is the README file from the original author:
  376. >> 
  377. >>>Well, with all this discussion about file compression (for news batching
  378. >>>in particular) going around, I decided to implement the text compression
  379. >>>algorithm described in the June Computer magazine.  The author claimed
  380. >>>blinding speed and good compression ratios.  It's certainly faster than
  381. >>>compact (but, then, what wouldn't be), but it's also the same speed as
  382. >>>pack, and gets better compression than both of them.  On 350K bytes of
  383. >>>unix-wizards, compact took about 8 minutes of CPU, pack took about 80
  384. >>>seconds, and compress (herein) also took 80 seconds.  But, compact and
  385. >>>pack got about 30% compression, whereas compress got over 50%.  So, I
  386. >>>decided I had something, and that others might be interested, too.
  387. >>>
  388. >>>As is probably true of compact and pack (although I haven't checked),
  389. >>>the byte order within a word is probably relevant here, but as long as
  390. >>>you stay on a single machine type, you should be ok.  (Can anybody
  391. >>>elucidate on this?)  There are a couple of asm's in the code (extv and
  392. >>>insv instructions), so anyone porting it to another machine will have to
  393. >>>deal with this anyway (and could probably make it compatible with Vax
  394. >>>byte order at the same time).  Anyway, I've linted the code (both with
  395. >>>and without -p), so it should run elsewhere.  Note the longs in the
  396. >>>code, you can take these out if you reduce BITS to <= 15.
  397. >>>
  398. >>>Have fun, and as always, if you make good enhancements, or bug fixes,
  399. >>>I'd like to see them.
  400. >>>
  401. >>>=Spencer (thomas@utah-20, {harpo,hplabs,arizona}!utah-cs!thomas)
  402. >>
  403. >>                    regards,
  404. >>                    joe
  405. >>
  406. >>--
  407. >>Full-Name:  Joseph M. Orost
  408. >>UUCP:       ..!{decvax,ucbvax,ihnp4}!vax135!petsd!joe
  409. >>US Mail:    MS 313; Perkin-Elmer; 106 Apple St; Tinton Falls, NJ 07724
  410. >>Phone:      (201) 870-5844
  411. This is the latest available version of compress from mod.sources on
  412. usenet.  It's basic functionality, except for unix specific actions,
  413. is unchanged.  To compress a file "foo.c" on the AMIGA:
  414.  
  415.     compress foo.c
  416.  
  417. which will make a new compressed file "foo.c.Z".  To uncompress the
  418. file:
  419.  
  420.     compress -d foo.c
  421.  
  422. which will create a new "foo.c" from the compressed "foo.c.Z".
  423.  
  424. Note that this program has not been extensively tested yet on the
  425. AMIGA, so be careful compressing files and then removing the only
  426. original uncompressed files without having a backup.
  427.  
  428. Also note that many of the files here are not applicable to the Amiga,
  429. but are included for completeness.  You may wish to someday transfer this
  430. to a Unix system, even use it on a future Amiga running Unix.
  431.  
  432. One last thing, this distribution also contains the programs "btoa" and
  433. "atob", which can be used to tranform Amiga binary files into ascii files
  434. for transmission over links that do not support 8-bit transfers, then
  435. conversion back to binary files.
  436.  
  437. -Fred Fish
  438.  14-Jan-86
  439.