|
|
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: ! 41: /* Define malloc() and string functions */ ! 42: #ifdef MODERN ! 43: # include <string.h> ! 44: #else /* !MODERN */ ! 45: voidp *malloc(); ! 46: voidp *calloc(); ! 47: char *getenv(); ! 48: long atol(); ! 49: char *strcpy(); ! 50: char *strcat(); ! 51: char *strchr(); ! 52: char *strrchr(); ! 53: # ifndef ZMEM ! 54: char *memset(); ! 55: char *memcpy(); ! 56: # endif /* !ZMEM */ ! 57: #endif /* ?MODERN */ ! 58: ! 59: /* Define fseek() commands */ ! 60: #ifndef SEEK_SET ! 61: # define SEEK_SET 0 ! 62: #endif /* !SEEK_SET */ ! 63: ! 64: #ifndef SEEK_CUR ! 65: # define SEEK_CUR 1 ! 66: #endif /* !SEEK_CUR */ ! 67: ! 68: #ifndef SEEK_END ! 69: # define SEEK_END 2 ! 70: #endif /* !SEEK_END */ ! 71: ! 72: /* For setting stdout to binary */ ! 73: #ifdef MSDOS ! 74: # include <io.h> ! 75: # include <fcntl.h> ! 76: #endif /* MSDOS */ ! 77: ! 78: /* Types centralized here for easy modification */ ! 79: #define local static /* More meaningful outside functions */ ! 80: typedef unsigned char uch; /* unsigned 8-bit value */ ! 81: typedef unsigned short ush; /* unsigned 16-bit value */ ! 82: typedef unsigned long ulg; /* unsigned 32-bit value */ ! 83: ! 84: ! 85: /* Error return codes and PERR macro */ ! 86: #include "ziperr.h" ! 87: ! 88: /* Internal attributes */ ! 89: #define UNKNOWN -1 ! 90: #define BINARY 0 ! 91: #define ASCII 1 ! 92: ! 93: /* Public globals */ ! 94: #define BEST -1 /* Use best method (deflation or store) */ ! 95: #define STORE 0 /* Store method */ ! 96: #define DEFLATE 8 /* Deflation method*/ ! 97: extern int method; /* Restriction on compression method */ ! 98: extern int level; /* Compression level */ ! 99: ! 100: /* Diagnostic functions */ ! 101: #ifdef DEBUG ! 102: extern char verbose; /* PGP -l flag */ ! 103: # ifdef MSDOS ! 104: # undef stderr ! 105: # define stderr stdout ! 106: # endif ! 107: # define diag(where) fprintf(stderr, "zip diagnostic: %s\n", where) ! 108: # define Assert(cond,msg) {if(!(cond)) error(msg);} ! 109: # define Trace(x) fprintf x ! 110: # define Tracev(x) {if (verbose) fprintf x ;} ! 111: # define Tracevv(x) {if (verbose>1) fprintf x ;} ! 112: # define Tracec(c,x) {if (verbose && (c)) fprintf x ;} ! 113: # define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} ! 114: #else ! 115: # define diag(where) ! 116: # define Assert(cond,msg) ! 117: # define Trace(x) ! 118: # define Tracev(x) ! 119: # define Tracevv(x) ! 120: # define Tracec(c,x) ! 121: # define Tracecv(c,x) ! 122: #endif ! 123: ! 124: ! 125: /* Public function prototypes */ ! 126: ! 127: /* in zip.c, zipcloak.c, or zipsplit.c */ ! 128: void err OF((int c, char *h)); ! 129: void error OF((char *h)); ! 130: ! 131: /* in zipup.c */ ! 132: int zipup OF((FILE *inFile, FILE *outFile)); ! 133: int read_buf OF((char far *buf, unsigned size)); ! 134: ! 135: # define zfwrite fwrite /* ??? far */ ! 136: # define zputc putc ! 137: ! 138: /* in deflate.c */ ! 139: void lm_init OF((int pack_level, ush *flags)); ! 140: ulg deflate OF((void)); ! 141: ! 142: /* in trees.c */ ! 143: void ct_init OF((ush *attr, int *method)); ! 144: int ct_tally OF((int dist, int lc)); ! 145: ulg flush_block OF((char *buf, ulg stored_len, int eof)); ! 146: ! 147: /* in bits.c */ ! 148: void bi_init OF((FILE *zipfile)); ! 149: void send_bits OF((int value, int length)); ! 150: unsigned bi_reverse OF((unsigned value, int length)); ! 151: void bi_windup OF((void)); ! 152: void copy_block OF((char far *buf, unsigned len, int header)); ! 153: ! 154: ! 155: /* end of zip.h */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.