1 /***********************************************************
3 ***********************************************************/
9 typedef unsigned char uchar; /* 8 bits or more */
10 typedef unsigned int uint; /* 16 bits or more */
11 typedef unsigned short ushort; /* 16 bits or more */
12 typedef unsigned long ulong; /* 32 bits or more */
43 /* compress parameter */
44 struct lha_method *method;
46 #define INITIALIZE_OPTS(opts) \
48 (opts).nocompress = 0; \
49 (opts).outdir = NULL; \
51 (opts).header_level = 2; \
54 (opts).force_extract = 0; \
55 (opts).archive_to_stdio = 0; \
57 /* default is the -lh5- method */ \
58 (opts).method = &methods[5]; \
62 extern struct lha_opts opts;
63 extern int unpackable;
64 extern ulong origsize, compsize;
68 #define INIT_CRC 0 /* CCITT: 0xFFFF */
69 #define UPDATE_CRC(c) \
70 crc = crctable[(crc ^ (c)) & 0xFF] ^ (crc >> CHAR_BIT)
72 extern FILE *arcfile, *infile, *outfile;
75 #define BITBUFSIZ (CHAR_BIT * sizeof bitbuf)
77 /* encode.c and decode.c */
79 #define MAXDICBIT 16 /* 12(-lh4-) or 13(-lh5-) */
80 #define MAXDICSIZ (1U << MAXDICBIT)
81 #define MATCHBIT 8 /* bits for MAXMATCH - THRESHOLD */
82 #define MAXMATCH 256 /* formerly F (not more than UCHAR_MAX + 1) */
83 #define THRESHOLD 3 /* choose optimal value */
87 #define NC (UCHAR_MAX + MAXMATCH + 2 - THRESHOLD)
88 /* alphabet = {0, 1, 2, ..., NC - 1} */
89 #define CBIT 9 /* $\lfloor \log_2 NC \rfloor + 1$ */
90 #define CODE_BIT 16 /* codeword length */
92 extern ushort left[], right[];
94 #include "prototypes.h"