home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
misc
/
volume17
/
freeze
/
patch01
< prev
next >
Wrap
Internet Message Format
|
1991-03-30
|
14KB
From: leo@s514.ipmce.su (Leonid A. Broukhis)
Newsgroups: comp.sources.misc
Subject: v17i074: freeze - Freeze/Melt compression package, Patch01
Message-ID: <1991Mar29.041629.17264@sparky.IMD.Sterling.COM>
Date: 29 Mar 91 04:16:29 GMT
Approved: kent@sparky.imd.sterling.com
X-Checksum-Snefru: 94bae9a7 0123dfe4 90e98f78 ff66c59c
Submitted-by: Leonid A. Broukhis <leo@s514.ipmce.su>
Posting-number: Volume 17, Issue 74
Archive-name: freeze/patch01
Patch-To: freeze: Volume 17, Issue 67-68
Some bug fixes (endianness dependency), improvements:
freeze ... +numlist .... is now allowed. Numlist is 8 numbers
(as in /etc/default/freeze) seperated by commas, for example
freeze +0,1,1,1,4,10,27,18 ....
*** ../distribution/encode.c Wed Mar 27 20:44:42 1991
--- encode.c Wed Mar 27 16:18:27 1991
***************
*** 2,14 ****
#include "lz.h"
- extern hash_t prev[];
- #ifdef __XENIX__
- extern u_short *next[];
- #else
- extern u_short next[];
- #endif
-
/*
* freeze stdin to stdout
*/
--- 2,7 ----
*** ../distribution/freeze.1 Wed Mar 27 20:44:43 1991
--- freeze.1 Wed Mar 27 21:21:32 1991
***************
*** 93,104 ****
.I melt
(all files are unpacked and written to stdout).
.PP
! Type is a token preceded by a '+', which defines the type
of following files in the command string. An explicite definition
of the file's type can give up to 2% of additional compression.
The list of types is stored in file
.IR /etc/default/freeze .
! Types may be abbreviated while not ambigious.
.PP
.I Freeze
uses the Lempel-Ziv algorithm on the first pass and the dynamic
--- 93,108 ----
.I melt
(all files are unpacked and written to stdout).
.PP
! .I Type
! is a token preceded by a '+', which defines the type
of following files in the command string. An explicite definition
of the file's type can give up to 2% of additional compression.
The list of types is stored in file
.IR /etc/default/freeze .
! Types may be abbreviated while not ambigious. You can also determine
! values for the static Huffman table by using a list of 8 numbers
! separated by commas instead of
! .I type.
.PP
.I Freeze
uses the Lempel-Ziv algorithm on the first pass and the dynamic
***************
*** 146,159 ****
.SH "SEE ALSO"
compact(1), pack(1), compress(1)
.SH "DIAGNOSTICS"
- Usage: freeze [-cdfvV] [file ...]
- .in +8
- Invalid options were specified on the command line.
- .in -8
Unknown flag:
.I "\'x\';"
.in +8
! Invalid flags were specified on the command line.
.in -8
.IR file :
not in frozen format
--- 150,160 ----
.SH "SEE ALSO"
compact(1), pack(1), compress(1)
.SH "DIAGNOSTICS"
Unknown flag:
.I "\'x\';"
+ Usage: freeze [-cdfvV] [file|+type ...]
.in +8
! Invalid options were specified on the command line.
.in -8
.IR file :
not in frozen format
***************
*** 224,229 ****
--- 225,243 ----
.in +8
This message indicates a successful switching to
position table for mentioned file type.
+ .in -8
+ "
+ .I xxx
+ " - no such file type
+ .in +8
+ or
+ .in -8
+ .I xxx
+ - a list of 8 numbers expected
+ .in +8
+ This message means the given file type does not exist or
+ the given string contains a comma, but is not a valid list
+ of values for static Huffman table.
.in -8
melt: corrupt input
.in +8
*** ../distribution/freeze.c Wed Mar 27 20:44:45 1991
--- freeze.c Thu Mar 28 14:31:19 1991
***************
*** 1,6 ****
--- 1,7 ----
#include "freeze.h"
#include "lz.h"
#include "huf.h"
+ #include "patchlevel.h"
/*
* Freeze - data freezing program
***************
*** 22,27 ****
--- 23,30 ----
* Improved hash function (with tuning of hash-table)
* Version 2.1: Noticeable speedup: Insert_Node and Get_Next_Match
* are now separated.
+ * Version 2.2: Tunable static Huffman table for position information,
+ * this info may be given in the command string now.
*/
#ifdef COMPAT
***************
*** 30,36 ****
uchar magic_header[] = { "\037\237" }; /* 1F 9F = freeze 1.X + 1 */
#endif
! static char ident[] = "@(#) freeze.c 2.1 Alpha 3/21/91 leo@s514.ipmce.su";
#define ARGVAL() (*++(*argv) || (--argc && *++argv))
--- 33,39 ----
uchar magic_header[] = { "\037\237" }; /* 1F 9F = freeze 1.X + 1 */
#endif
! static char ident[] = "@(#) freeze.c 2.2.%d Alpha 3/27/91 leo@s514.ipmce.su\n";
#define ARGVAL() (*++(*argv) || (--argc && *++argv))
***************
*** 684,690 ****
version()
{
! fprintf(stderr, "%s\n", ident);
fprintf(stderr, "Options: ");
#ifdef DEBUG
fprintf(stderr, "DEBUG, ");
--- 687,693 ----
version()
{
! fprintf(stderr, ident, PATCHLEVEL);
fprintf(stderr, "Options: ");
#ifdef DEBUG
fprintf(stderr, "DEBUG, ");
***************
*** 717,748 ****
{
extern char * defread();
register char *s = defread(type), *t;
! static short v[8];
! int i;
if(!s) {
! if(!quiet)
! fprintf(stderr, "\"%s\" - no such file type\n", type);
! exit(1);
! }
!
! if(!(t = rindex(s, '='))) {
! if(!quiet)
! fprintf(stderr, "\"%s\" - invalid entry\n", type);
! exit(1);
}
! t++;
! if(sscanf(t, "%d %d %d %d %d %d %d %d",
! v, v+1, v+2, v+3, v+4, v+5, v+6, v+7) != 8) {
if(!quiet)
! fprintf(stderr, "\"%s\" - invalid entry\n", type);
exit(1);
}
for(i = 0; i < 8; i++)
Table[i+1] = v[i];
if(!quiet) {
! t = s;
! while(*s != '=' && *s != ' ' && *s != '\t') s++;
! *s = '\0';
fprintf(stderr, "Using \"%s%s\" type\n", type, t);
}
}
--- 720,761 ----
{
extern char * defread();
register char *s = defread(type), *t;
! static int v[8];
! int i, is_list = 0;
if(!s) {
! /* try to consider 'type' as a list of values: n1,n2, ... */
! if(rindex(type, ','))
! is_list = 1;
! else {
! if (!quiet)
! fprintf(stderr, "\"%s\" - no such file type\n", type);
! exit(1);
! }
! if(sscanf(type, "%d,%d,%d,%d,%d,%d,%d,%d",
! v, v+1, v+2, v+3, v+4, v+5, v+6, v+7) != 8) {
! if (!quiet)
! fprintf(stderr,
! "%s - a list of 8 numbers expected\n", type);
! exit(1);
! }
}
! if(!is_list && (!(t = rindex(s, '=')) ||
! sscanf(++t, "%d %d %d %d %d %d %d %d",
! v, v+1, v+2, v+3, v+4, v+5, v+6, v+7) != 8)) {
if(!quiet)
! fprintf(stderr,
! "\"%s\" - invalid entry\n", type);
exit(1);
}
for(i = 0; i < 8; i++)
Table[i+1] = v[i];
if(!quiet) {
! if(!is_list) {
! t = s;
! while(*s != '=' && *s != ' ' && *s != '\t') s++;
! *s = '\0';
! } else
! t = "";
fprintf(stderr, "Using \"%s%s\" type\n", type, t);
}
}
*** ../distribution/freeze.h Wed Mar 27 20:45:03 1991
--- freeze.h Wed Mar 27 15:03:06 1991
***************
*** 1,12 ****
#include <stdio.h>
- /* for GCC */
-
#ifdef SUN4
#include <sys/stdtypes.h>
#else
typedef int mode_t; /* for GCC */
# ifndef getc
# define getc(p) (--(p)->_cnt < 0 ? _filbuf(p) : (int) *(p)->_ptr++)
# endif
--- 1,12 ----
#include <stdio.h>
#ifdef SUN4
#include <sys/stdtypes.h>
#else
+ #if !defined(ultrix) && defined(__GNUC__)
typedef int mode_t; /* for GCC */
+ #endif
# ifndef getc
# define getc(p) (--(p)->_cnt < 0 ? _filbuf(p) : (int) *(p)->_ptr++)
# endif
***************
*** 13,20 ****
--- 13,22 ----
# ifndef putc
# define putc(x, p) (--(p)->_cnt < 0 ? _flsbuf((unsigned char) (x), (p)) : (int) (*(p)->_ptr++ = (unsigned char) (x)))
# endif
+ #ifndef BSD4_2
typedef unsigned short u_short;
#endif
+ #endif
/* end (for GCC) */
***************
*** 96,103 ****
extern int exit_stat;
- extern short new_flg;
-
#ifdef DEBUG
extern short debug;
extern short verbose;
--- 98,103 ----
***************
*** 113,119 ****
GetByte(), GetNBits();
#ifdef COMPAT
! extern short DecodeCOld(), DecodePOld();
#endif
#if defined(BSD42) && !defined(BSD4_2)
--- 113,119 ----
GetByte(), GetNBits();
#ifdef COMPAT
! extern short DecodeCOld(), DecodePOld(), new_flg;
#endif
#if defined(BSD42) && !defined(BSD4_2)
*** ../distribution/lz.c Wed Mar 27 20:45:04 1991
--- lz.c Wed Mar 27 15:03:06 1991
***************
*** 7,14 ****
/* */
/*----------------------------------------------------------------------*/
- #define NIL N /* term of tree */
-
uchar text_buf[N + _F - 1];
u_short match_position, match_length;
--- 7,12 ----
***************
*** 18,35 ****
*/
hash_t prev[N + 1];
#ifndef __XENIX__
! u_short next[array_size];
#else
#if parts == 2
u_short next0[32768], next1[8193];
! #elif parts == 3
u_short next0[32768], next1[32768], next2[8193];
! #elif parts == 5
u_short next0[32768], next1[32768], next2[32768], next3[32768], next4[8193];
! #else
u_short next0[32768], next1[32768], next2[32768], next3[32768], next4[32768],
next5[32768], next6[32768], next7[32768], next8[8193];
#endif
u_short *next[parts] = {
--- 16,42 ----
*/
hash_t prev[N + 1];
+
#ifndef __XENIX__
! u_short
! #ifdef __TURBOC__
! huge
! #endif
! next[array_size];
#else
#if parts == 2
u_short next0[32768], next1[8193];
! #else
! # if parts == 3
u_short next0[32768], next1[32768], next2[8193];
! # else
! # if parts == 5
u_short next0[32768], next1[32768], next2[32768], next3[32768], next4[8193];
! # else
u_short next0[32768], next1[32768], next2[32768], next3[32768], next4[32768],
next5[32768], next6[32768], next7[32768], next8[8193];
+ # endif
+ # endif
#endif
u_short *next[parts] = {
***************
*** 46,52 ****
#endif
};
#endif
-
#ifdef GATHER_STAT
long node_steps, node_matches;
--- 53,58 ----
*** ../distribution/lz.h Wed Mar 27 20:45:04 1991
--- lz.h Thu Mar 28 14:11:37 1991
***************
*** 32,42 ****
--- 32,64 ----
#define array_size (N + 1 + (1 << BITS))
+ extern hash_t prev[];
+
#ifndef __XENIX__
#define nextof(i) next[i]
+ extern u_short
+ #ifdef __TURBOC__
+ huge
+ #endif
+ next[];
#else
#define parts (array_size/32768 + 1)
#define nextof(i) next[(i) >> 15][(i) & 0x7fff]
+ #if parts == 2
+ extern u_short next0[], next1[];
+ #else
+ # if parts == 3
+ extern u_short next0[], next1[], next2[];
+ # else
+ # if parts == 5
+ extern u_short next0[], next1[], next2[], next3[], next4[];
+ # else
+ extern u_short next0[], next1[], next2[], next3[], next4[],
+ next5[], next6[], next7[], next8[];
+ # endif
+ # endif
+ #endif
+ extern u_short *next[];
#endif
/* To eliminate function-call overhead */
*** ../distribution/makefile Wed Mar 27 20:45:05 1991
--- makefile Thu Mar 28 16:27:15 1991
***************
*** 1,4 ****
--- 1,5 ----
DEST = /usr/local/bin
+ MANDEST = /usr/local/man/cat1
EXTHDRS =
HDRS = freeze.h\
lz.h\
***************
*** 25,30 ****
--- 26,35 ----
PROGRAM = freeze
+ CATMAN = freeze.man
+
+ MAN = freeze.1
+
SRCS = bitio.c\
debug.c\
decode.c\
***************
*** 34,40 ****
huf.c\
lz.c
! all: $(PROGRAM) statist freeze.man
lint: $(SRCS)
lint $(LINTFLAGS) $(SRCS) $(LIBS)
--- 39,45 ----
huf.c\
lz.c
! all: $(PROGRAM) statist $(CATMAN)
lint: $(SRCS)
lint $(LINTFLAGS) $(SRCS) $(LIBS)
***************
*** 47,59 ****
clean:; rm -f *.o *.b .,* core a.out $(PROGRAM) statist
! install: $(PROGRAM)
install -s -c $(PROGRAM) $(DEST)
! ln -f $(DEST)/freeze $(DEST)/melt
! ln -f $(DEST)/freeze $(DEST)/fcat
! freeze.man: freeze.1
! nroff -man < freeze.1 > freeze.man
###
bitio.o: freeze.h huf.h
--- 52,72 ----
clean:; rm -f *.o *.b .,* core a.out $(PROGRAM) statist
! install: $(DEST)/$(PROGRAM) $(MANDEST)/$(MAN)
!
! $(DEST)/$(PROGRAM): $(PROGRAM)
install -s -c $(PROGRAM) $(DEST)
! ln -f $(DEST)/$(PROGRAM) $(DEST)/melt
! ln -f $(DEST)/$(PROGRAM) $(DEST)/fcat
!
! $(MANDEST)/$(MAN): $(CATMAN)
! cp $(CATMAN) $(MANDEST)/$(MAN)
! chmod +r $(MANDEST)/$(MAN)
! ln -f $(MANDEST)/$(MAN) $(MANDEST)/melt.1
! ln -f $(MANDEST)/$(MAN) $(MANDEST)/fcat.1
! $(CATMAN): $(MAN)
! nroff -man < $(MAN) > $(CATMAN)
###
bitio.o: freeze.h huf.h
***************
*** 62,65 ****
encode.o: freeze.h lz.h
freeze.o: freeze.h lz.h huf.h
huf.o: freeze.h huf.h
! lz.o: freeze.h
--- 75,78 ----
encode.o: freeze.h lz.h
freeze.o: freeze.h lz.h huf.h
huf.o: freeze.h huf.h
! lz.o: freeze.h lz.h
*** ../distribution/patchlevel.h Thu Mar 28 14:36:11 1991
--- patchlevel.h Thu Mar 28 14:29:31 1991
***************
*** 0 ****
--- 1 ----
+ #define PATCHLEVEL 1
*** ../distribution/statist.c Wed Mar 27 20:44:46 1991
--- statist.c Thu Mar 28 13:54:48 1991
***************
*** 16,22 ****
hash_t prev[N + 1];
#ifndef __XENIX__
! u_short next[array_size];
#else
#if parts == 2
u_short next0[32768], next1[8193];
--- 16,26 ----
hash_t prev[N + 1];
#ifndef __XENIX__
! u_short
! #ifdef __TURBOC__
! huge
! #endif
! next[array_size];
#else
#if parts == 2
u_short next0[32768], next1[8193];
--
Leonid A. Broukhis | 89-1-95 Liberty St. | "BROUKHIS" is Hebrew for
7+095 494.6241 (h) | Moscow 123481 USSR | "BENEDICTAE"
7+095 132.9475 (o) | (leo@s514.ipmce.su) | {Licet omnia qualibet dicas}
exit 0 # Just in case...
--
Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD UUCP: uunet!sparky!kent
Phone: (402) 291-8300 FAX: (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.