|
|
1.1.1.2 root 1: /*
2:
3: Copyright (C) 1990,1991 Mark Adler, Richard B. Wales, and Jean-loup Gailly.
4: Permission is granted to any individual or institution to use, copy, or
5: redistribute this software so long as all of the original files are included
6: unmodified, that it is not sold for profit, and that this copyright notice
7: is retained.
8:
9: */
10:
11: /*
12: * zip.h by Mark Adler.
13: */
14:
15:
16: /* Set up portability */
17: #include "ztailor.h"
18:
19: #define MIN_MATCH 3
20: #define MAX_MATCH 258
21: /* The minimum and maximum match lengths */
22:
23: #ifndef WSIZE
24: # define WSIZE 8192 /* for PGP only use 8192 */
25: #endif
26: /* Maximum window size = 32K. If you are really short of memory, compile
27: * with a smaller WSIZE but this reduces the compression ratio for files
28: * of size > WSIZE.
29: */
30:
31: #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
32: /* Minimum amount of lookahead, except at the end of the input file.
33: * See deflate.c for comments about the MIN_MATCH+1.
34: */
35:
36: #define MAX_DIST (WSIZE-MIN_LOOKAHEAD)
37: /* In order to simplify the code, particularly on 16 bit machines, match
38: * distances are limited to MAX_DIST instead of WSIZE.
39: */
40:
1.1.1.3 ! root 41: #include <string.h>
1.1.1.2 root 42:
43: /* Define fseek() commands */
44: #ifndef SEEK_SET
45: # define SEEK_SET 0
46: #endif /* !SEEK_SET */
47:
48: #ifndef SEEK_CUR
49: # define SEEK_CUR 1
50: #endif /* !SEEK_CUR */
51:
52: #ifndef SEEK_END
53: # define SEEK_END 2
54: #endif /* !SEEK_END */
55:
56: /* For setting stdout to binary */
57: #ifdef MSDOS
58: # include <io.h>
59: # include <fcntl.h>
60: #endif /* MSDOS */
61:
62: /* Types centralized here for easy modification */
63: #define local static /* More meaningful outside functions */
64: typedef unsigned char uch; /* unsigned 8-bit value */
65: typedef unsigned short ush; /* unsigned 16-bit value */
66: typedef unsigned long ulg; /* unsigned 32-bit value */
67:
68:
69: /* Error return codes and PERR macro */
70: #include "ziperr.h"
71:
72: /* Internal attributes */
73: #define UNKNOWN -1
74: #define BINARY 0
75: #define ASCII 1
76:
77: /* Public globals */
78: #define BEST -1 /* Use best method (deflation or store) */
79: #define STORE 0 /* Store method */
80: #define DEFLATE 8 /* Deflation method*/
81: extern int method; /* Restriction on compression method */
82: extern int level; /* Compression level */
83:
84: /* Diagnostic functions */
85: #ifdef DEBUG
86: extern char verbose; /* PGP -l flag */
87: # ifdef MSDOS
88: # undef stderr
89: # define stderr stdout
90: # endif
91: # define diag(where) fprintf(stderr, "zip diagnostic: %s\n", where)
92: # define Assert(cond,msg) {if(!(cond)) error(msg);}
93: # define Trace(x) fprintf x
94: # define Tracev(x) {if (verbose) fprintf x ;}
95: # define Tracevv(x) {if (verbose>1) fprintf x ;}
96: # define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
97: # define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
98: #else
99: # define diag(where)
100: # define Assert(cond,msg)
101: # define Trace(x)
102: # define Tracev(x)
103: # define Tracevv(x)
104: # define Tracec(c,x)
105: # define Tracecv(c,x)
106: #endif
107:
108:
109: /* Public function prototypes */
110:
111: /* in zip.c, zipcloak.c, or zipsplit.c */
112: void err OF((int c, char *h));
113: void error OF((char *h));
114:
115: /* in zipup.c */
116: int zipup OF((FILE *inFile, FILE *outFile));
117: int read_buf OF((char far *buf, unsigned size));
118:
119: # define zfwrite fwrite /* ??? far */
120: # define zputc putc
121:
122: /* in deflate.c */
123: void lm_init OF((int pack_level, ush *flags));
124: ulg deflate OF((void));
125:
126: /* in trees.c */
1.1.1.3 ! root 127: void ct_init OF((ush *attr, int *Method));
1.1.1.2 root 128: int ct_tally OF((int dist, int lc));
129: ulg flush_block OF((char *buf, ulg stored_len, int eof));
130:
131: /* in bits.c */
132: void bi_init OF((FILE *zipfile));
133: void send_bits OF((int value, int length));
134: unsigned bi_reverse OF((unsigned value, int length));
135: void bi_windup OF((void));
136: void copy_block OF((char far *buf, unsigned len, int header));
137:
138:
139: /* end of zip.h */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.