[comp.unix.microport] Patches to compress v4.0, for System V/AT

root@qetzal.UUCP (Admin) (12/18/87)

[Submitted courtesy of John Rupley, reachable at arizona!rupley!local]

Attached below are changes for compress.c (version 4.0 -- 
comp.sources.unix posting, volume2), that allow compilation under 
Microport SysV/AT. Note that you need to pull over the compress 4.0 
original distribution from your friendly archive site, if you do not 
already have it.

The patches for Xenix, posted in comp.sources.unix (volume6), do not 
work for the Microport 80286 environment, which lacks huge model 
compilation. (I am sure they do the job for Xenix on an 80286, so if 
you are running Xenix, the following should be for amusement only.)

As usual, the points to watch for in the port are the widths of int 
and long and char * on an 80286 machine. 

If one is satisfied with 12-bit compress/uncompress, the original 
distribution source code is fine.  However, comp.sources archive sites, 
if they compress files, appear to do so at 16 bit, and similarly, 
mainframes that use compress should be expected to default to 16-bit.


John Rupley
 uucp: ..{ihnp4 | hao!noao}!arizona!rupley!local
 internet: rupley!local@megaron.arizona.edu
 telex: 9103508679(JARJAR)
 (H) 30 Calle Belleza, Tucson AZ 85716 - (602) 325-4533
 (O) Dept. Biochemistry, Univ. Arizona, Tucson AZ 85721 - (602) 621-3929


+++++++++++++++DIFF OUTPUT -- TEXT FILE -- NOT FOR USE WITH PATCH++++++++

output for:	diff  modified_file  (vs)  compress.c_version_4.0

4,31d3
< 
< /* Changes in --  Compress - data compression program 
<  *
<  * modifications for:
<  * 	Microport sysV/AT -- 80286 system without huge model compilation
<  * 	compile with:	cc -Ml -DUPORT_16 (for 16-bit compress)
<  *		or	cc -Ml -DUPORT (for <= 13-bit)
<  *		or 	a corresponding #define in this source
<  *
<  * changes made in following version of source code distribtution:
<  *   rcs_ident[] = "$Header: compress.c,v 4.0 85/07/30 12:50:00 joe Release $";
<  * on:
<  *   87/12/05
<  * by:
<  *   John Rupley    ..{ihnp4 | hao!noao}!arizona!rupley!local
<  */
< 
< #define UPORT_16
< 
< #ifdef UPORT
< #define BITS 13
< #endif
< 
< #ifdef UPORT_16
< #define BITS 16
< #define XENIX_16
< #define	min(a,b)	(((long )a>(long )b) ? (long )b : (long )a)
< #else
33d4
< #endif
103d73
< 
105c75
< # define HSIZE	69001L		/* 95% occupancy */
---
> # define HSIZE	69001		/* 95% occupancy */
108c78
< # define HSIZE	35023L		/* 94% occupancy */
---
> # define HSIZE	35023		/* 94% occupancy */
111c81
< # define HSIZE	18013L		/* 91% occupancy */
---
> # define HSIZE	18013		/* 91% occupancy */
114c84
< # define HSIZE	9001L		/* 91% occupancy */
---
> # define HSIZE	9001		/* 91% occupancy */
117c87
< # define HSIZE	5003L		/* 80% occupancy */
---
> # define HSIZE	5003		/* 80% occupancy */
296c266
< code_int maxmaxcode = 1L << BITS;	/* should NEVER generate this code */
---
> code_int maxmaxcode = 1 << BITS;	/* should NEVER generate this code */
298c268
< # define MAXCODE(n_bits)	(1L << (n_bits) - 1)
---
> # define MAXCODE(n_bits)	(1 << (n_bits) - 1)
300c270
< # define MAXCODE(n_bits)	((1L << (n_bits)) - 1L)
---
> # define MAXCODE(n_bits)	((1 << (n_bits)) - 1)
312c282
< count_int htab8[HSIZE-65536L];
---
> count_int htab8[HSIZE-65536];
316,318d285
< #ifdef UPORT_16
< #define htabof(i)	(htab[((long )i) >> 13][((long )i) & 0x1fff])
< #else
320,321d286
< #endif
< 
330,332d294
< #ifdef UPORT_16
< #define codetabof(i)	(codetab[((long )i) >> 14][((long )i) & 0x3fff])
< #else
334d295
< #endif
356,358d316
< #ifdef UPORT_16
< # define tab_suffixof(i)	((char_type *)htab[((long )i)>>15])[((long )i) & 0x7fff]
< #else
360d317
< #endif
566c523
<     maxmaxcode = 1L << maxbits;
---
>     maxmaxcode = 1 << maxbits;
594c551
< 		    maxmaxcode = 1L << maxbits;
---
> 		    maxmaxcode = 1 << maxbits;
623c580
< 		if ( fsize < (1l << 12) )
---
> 		if ( fsize < (1 << 12) )
625c582
< 		else if ( fsize < (1L << 13) )
---
> 		else if ( fsize < (1 << 13) )
627c584
< 		else if ( fsize < (1L << 14) )
---
> 		else if ( fsize < (1 << 14) )
629c586
< 		else if ( fsize < (1L << 15) )
---
> 		else if ( fsize < (1 << 15) )
712c669
< 		maxmaxcode = 1L << maxbits;
---
> 		maxmaxcode = 1 << maxbits;
1223c1180
< code_int sorttab[1L<<BITS];	/* sorted pointers into htab */
---
> code_int sorttab[1<<BITS];	/* sorted pointers into htab */
1227,1230d1183
< #ifdef UPORT_16
<     long i, first;
<     long ent;
< #else
1233d1185
< #endif
1253c1205
< 		for(ent=htabof(sorttab[i]) & ((1L<<maxbits)-1);
---
> 		for(ent=htabof(sorttab[i]) & ((1<<maxbits)-1);
1255c1207
< 		    ent=htabof(sorttab[ent]) & ((1L<<maxbits)-1)) {
---
> 		    ent=htabof(sorttab[ent]) & ((1<<maxbits)-1)) {
1511d1462
< 	fprintf(stderr, "\tModified for Microport SysV/AT, 12/05/87\n");
1523,1526d1473
< #ifdef UPORT_16
< 	fprintf(stderr, "UPORT_16, ");
< #endif
< #else

++++++++++++++++++++++++END OF DIFF OUTPUT+++++++++++++++++++++++++

-- 
//////////////////286 Moderator -- comp.unix.microport\\\\\\\\\\\\\\\\\
Email to microport@uwspan for info on the newsgroup comp.unix.microport.
otherwise mail to microport@uwspan with a Subject containing one of:
386 286 Bug Source Merge or "Send Buglist" (rutgers!uwvax!uwspan!microport)