123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- #ifndef cmcompress__h_
- #define cmcompress__h_
- #include <stdio.h>
- #ifdef __cplusplus
- extern "C"
- {
- #endif
-
- #ifndef SACREDMEM
- #define SACREDMEM 0
- #endif
- #ifndef USERMEM
- # define USERMEM 450000
- #endif
- #ifdef pdp11
- # define BITS 12
- # define NO_UCHAR
- # undef USERMEM
- #endif
- #ifdef USERMEM
- # if USERMEM >= (433484+SACREDMEM)
- # define PBITS 16
- # else
- # if USERMEM >= (229600+SACREDMEM)
- # define PBITS 15
- # else
- # if USERMEM >= (127536+SACREDMEM)
- # define PBITS 14
- # else
- # if USERMEM >= (73464+SACREDMEM)
- # define PBITS 13
- # else
- # define PBITS 12
- # endif
- # endif
- # endif
- # endif
- # undef USERMEM
- #endif
- #ifdef PBITS
- # ifndef BITS
- # define BITS PBITS
- # endif
- #endif
- #if BITS == 16
- # define HSIZE 69001
- #endif
- #if BITS == 15
- # define HSIZE 35023
- #endif
- #if BITS == 14
- # define HSIZE 18013
- #endif
- #if BITS == 13
- # define HSIZE 9001
- #endif
- #if BITS <= 12
- # define HSIZE 5003
- #endif
-
- #if BITS > 15
- typedef long int code_int;
- #else
- typedef int code_int;
- #endif
- #ifdef SIGNED_COMPARE_SLOW
- typedef unsigned long int count_int;
- typedef unsigned short int count_short;
- #else
- typedef long int count_int;
- #endif
- #ifdef NO_UCHAR
- typedef char char_type;
- #else
- typedef unsigned char char_type;
- #endif
- struct cmcompress_stream
- {
- int n_bits;
- int maxbits;
- code_int maxcode;
- code_int maxmaxcode;
- count_int htab [HSIZE];
- unsigned short codetab [HSIZE];
- code_int hsize;
- code_int free_ent;
- int nomagic;
-
- int block_compress;
- int clear_flg;
- long int ratio;
- count_int checkpoint;
- #ifdef DEBUG
- int debug;
- int verbose;
- #endif
-
- int offset;
- long int in_count;
- long int bytes_out;
- long int out_count;
-
- code_int ent;
- code_int hsize_reg;
- int hshift;
- long fcode;
- int first_pass;
-
- int (*input_stream)(void*);
- int (*output_stream)(void*, const char*,int);
- void* client_data;
- };
- int cmcompress_compress_initialize(struct cmcompress_stream* cdata);
- int cmcompress_compress_start(struct cmcompress_stream* cdata);
- int cmcompress_compress(struct cmcompress_stream* cdata, void* buff, size_t n);
- int cmcompress_compress_finalize(struct cmcompress_stream* cdata);
- #ifdef __cplusplus
- }
- #endif
- #endif
|