home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2001 January / VPR0101A.BIN / OLS / TAR32053 / tar32053.exe / SRC / COMPRESS.H < prev    next >
C/C++ Source or Header  |  1999-05-23  |  25KB  |  686 lines

  1. #ifndef __DEFCONF_H
  2. #include "defconf.h"
  3. #endif
  4. /*
  5.    This file was hacked for kmtar PowerUpKit v3.7
  6.                                     at 1995-03-04.
  7.                                     by tantan SGL00213@niftyserve.or.jp 
  8. */
  9. /*@H************************ < COMPRESS HEADER > ***************************/
  10. #define TITLE "$@(#) compress.h,v 4.3d 90/01/18 03:00:00 don Release ^"
  11. /*                                                                          *
  12. *   compress : compress.h <global defines, etc>                             *
  13. *                                                                           *
  14. *   port by  : Donald J. Gloistein                                          *
  15. *                                                                           *
  16. *   Source, Documentation, Object Code:                                     *
  17. *   released to Public Domain.  This code is based on code as documented    *
  18. *   below in release notes.                                                 *
  19. *                                                                           *
  20. *---------------------------  Module Description  --------------------------*
  21. *   THIS HEADER CONTAINS MUCH IMPLEMENTATION INFORMATION AND ASSUMPTIONS    *
  22. *   PLEASE PRINT IT OUT AND READ IT BEFORE COMPILING CODE FOR YOURSELF      *
  23. *                                                                           *
  24. *   This header supports a number of compiler defines and predefines.       *
  25. *   Rather than explain all of them, please print the header and read the   *
  26. *   notes. Also the unix and xenix makefiles are commented for the          *
  27. *   various options. There continues to have a lot of Dos specific info in  *
  28. *   the header. This is to help on 16 bit Msdos machines to get their       *
  29. *   compiler to work properly. I make no appology for that, as this port    *
  30. *   began as a way to implement 16 bit compress on a segmented MsDos machine*
  31. *                                                                           *
  32. *   However, for Unix and Xenix, all you should have to define is -DXENIX   *
  33. *   or -DUNIX and compile. There may be a problem with whether your library *
  34. *   supports alloc() or malloc(), but there is a define for that, also.     *
  35. *                                                                           *
  36. *   This header can be maintained to keep up with the different compilers   *
  37. *   and systems. As distributed in don Release, the files will compile with *
  38. *   no changes under Microsoft version 5.1 C compiler, and Xenix C compiler *
  39. *   which is the Microsoft version 4 ported. If you are going to bind the   *
  40. *   code for use in MsDos and OS/2 machines, then you must uncomment the    *
  41. *   #define BIND in this header. Otherwise, this distribution of source     *
  42. *   detect Msdos and Xenix predefines from the compiler and adjust.         *
  43. *                                                                           *
  44. *--------------------------- Implementation Notes --------------------------*
  45. *                                                                           *
  46. *   compiled with : compress.fns                                            *
  47. *
  48. *   NOTE!!!  Defaults of this code now are completely Unix, even for the    *
  49. *            msdos ports.  That means that the program works as a filter,   *
  50. *            and will just sit there waiting for input from stdin if you    *
  51. *            issue just the command name. You must use -h or -? to get the  *
  52. *            full help screen now. Also, it will unlink (kill) as a default *
  53. *            on successful compression and decompression. That means the    *
  54. *            source file will be erased.                                    *
  55. *            These defaults are changed with the FILTER and KEEPFLAG        *
  56. *            defines.                                                       *
  57. *                                                                           *
  58. *   NOTE!!!  Compiler predefines were taken out of the compress.h header.   *
  59. *            You must either specify them on compile or uncomment the       *
  60. *            compiler define in this header. Compiling without doing these  *
  61. *            will result in a program that does unspecified actions.        *
  62. *   problems:                                                               *
  63. *            The inpath and outpath is a bit kludged. It should work okay.  *
  64. *            Let me know if you have problems, especially under Unix.       *
  65. *                                                                           *
  66. *   CAUTION: The bound version will run on Dos 2.x, but you must use the    *
  67. *            name compress.exe.  If you rename the file, it will not run    *
  68. *            The unbound version will run on Dos 2.x with the name changed  *
  69. *            but due to the dos version, will not detect its own name.      *
  70. *                                                                           *
  71. *   CAUTION: Non MsDos users. You must modify the _MAX_PATH defines for     *
  72. *            your operating system if it is different from the assumed      *
  73. *            standard.                                                      *
  74. *                                                                           *
  75. *   CAUTION: I have used a number of defines to make it possible to compile *
  76. *            properly under a number of bit sizes and adjust for the memory *
  77. *            allocation scheme needed. If you do not use a dos system,      *
  78. *            PLEASE pay attention to the defines for MAXSEG_64K and the one *
  79. *            called SMALLMODEL. The SMALLMODEL define is set in the header  *
  80. *            but if you don't have a compiler that triggers the MAXSEG_64K  *
  81. *            define, you may end up with bad pointers. Becareful.           *
  82. *                                                                           *
  83. *   Header for files using version 4 compress routines define MAIN          *
  84. *   in the file with defining instance of the global variables.             *
  85. *   There are a number of compilers for MsDos and Unix/Xenix.               *
  86. *   So the user must define the actions required.                           *
  87. *                                                                           *
  88. *                                                                           *
  89. *   Defines:  This header file contains most of the system wide defines.    *
  90. *             the purpose for this was to consolodate compiler differences  *
  91. *             into one area that is easily changed.                         *
  92. *                                                                           *
  93. *   define MAXBITS= if you want a different maximum bits. 16 bits will now  *
  94. *   run in about 400K of memory.                                            *
  95. *   define BIND if you are going to use Microsoft bind.exe program on the   *
  96. *   executable.                                                             *
  97. *                                                                           *
  98. *   define MSDOS if you are compiling under MsDos or PcDos and your compiler*
  99. *   does not predefine it.                                                  *
  100. *                                                                           *
  101. *     Initials ---- Name ---------------------------------                  *
  102. *      DjG          Donald J. Gloistein, current port to MsDos 16 bit       *
  103. *                   Plus many others, see rev.hst file for full list        *
  104. *      Dal          Dale A. Schumacher (Sozobon C port)                     *
  105. *      LvR          Lyle V. Rains, many thanks for improved implementation  *
  106. *                   of the compression and decompression routines.          *
  107. *************************************************************************@H*/
  108.  
  109. #ifndef FALSE            /* let's get some sense to this */
  110. #define FALSE 0
  111. #define TRUE !FALSE
  112. #endif
  113.  
  114. #define NDEBUG 1
  115. #ifndef DEBUG           /* some convoluted defines to make the source */
  116. #ifndef NDEBUG          /* on command line use -DNDEBUG to make a     */
  117. #define DEBUG         /* program without the debugging routines     */
  118. #endif
  119. #endif
  120.  
  121. #    define NORMAL      0
  122. #    ifdef GZIP_ERROR
  123. #        if (GZIP_ERROR == NORMAL)
  124. #            define GZIP_ERROR   1   /* force redefine if (ERROR == NORMAL)  */
  125. #        endif
  126. #    else
  127. #        define GZIP_ERROR       1
  128. #    endif
  129.  
  130.                           /* Microsoft C compiler  v 4.0-5.1 */
  131.                           /* MSC is defined in makefile.msc        */
  132. #ifdef MSC
  133.   #ifdef  WIN32
  134.     #define COMPVER "WIN32"
  135.     #define NO_REVSEARCH
  136.     #define CONST const
  137.     #define ALLOCTYPE void
  138.   #else
  139.     #define COMPVER "Msdos"
  140.     #define FAR far        
  141.     #define MAXSEG_64K
  142.     #define NO_REVSEARCH
  143.     #define CONST const
  144.     #define ALLOCTYPE void
  145.     #ifdef M_I86SM
  146.         #define SMALLMODEL        /* compiled in small model */
  147.     #endif
  148.   #endif
  149.     #define setbinary(fp)    setmode(fileno((fp)), O_BINARY)
  150. #endif
  151.  
  152. #ifdef __TURBOC__
  153.     #define MSDOS
  154.     #define MAXSEG_64K
  155.     #define NO_REVSEARCH
  156.     #ifdef __SMALL__
  157.         #define SMALLMODEL
  158.     #endif
  159.     #define CONST const
  160.     #define FAR             far
  161.     #define setbinary(fp)   setmode(fileno((fp)), O_BINARY)
  162. #endif
  163.  
  164. #ifdef LSI_C
  165.     #define MSDOS
  166.     #define MAXSEG_64K
  167.     #define NO_REVSEARCH
  168.     #define SMALLMODEL
  169.     #define CONST const
  170.     #define FAR             far
  171.     #define setbinary(fp)   fsetbin(fp)
  172. #endif
  173.  
  174. /* FILTER  if you want the program to operate as a unix type filter */
  175. /*  if not defined TRUE, then issuing command without parameters will */
  176. /*  print a usage and help information                              */
  177. /*  Use -DFILTER=0 to deactivate filter operation                   */
  178. #ifndef FILTER
  179. #define FILTER  TRUE
  180. #endif
  181.  
  182. /* KEEPFLAG determines the default action on successful completion */
  183. /* Unix convention is FALSE (erase input file)                     */
  184. /* Use -DKEEPFLAG=1 to keep files as default or change here        */
  185. /* if you don't set it before here and you are compiling the debug */
  186. /* version, then files will be kept.                               */
  187.  
  188. #ifndef KEEPFLAG
  189. #ifdef DEBUG
  190. #define KEEPFLAG TRUE
  191. #else
  192. #define KEEPFLAG FALSE
  193. #endif
  194. #endif
  195.  
  196.  
  197. /* Does your compiler support extended prototyping?  */
  198. /* Uncomment the following if your compiler does not.*/
  199. /* support full prototyping, such as:                */
  200. /*      char *emalloc(unsigned,int);                 */
  201. /* if defined it will use the following:             */
  202. /*      char *emalloc();                             */
  203. /* #define NPROTO */
  204.  
  205. /* putting the include files in one location */
  206.  
  207. #include <ctype.h>
  208.  
  209. #include <assert.h>
  210. #include <string.h>
  211.  
  212. #ifndef NOSIGNAL
  213. #include <signal.h>
  214. #endif
  215.  
  216.  
  217. #include <sys/types.h>
  218. #include <sys/stat.h>
  219.  
  220.  
  221. #ifdef MSC
  222. #include <stdlib.h>
  223. #include <io.h>
  224. #include <sys/utime.h>
  225. #include <fcntl.h>
  226. #include <limits.h>
  227. #endif
  228.  
  229. #ifdef __TURBOC__
  230. #include <stdlib.h>
  231. #include <io.h>
  232. #include <fcntl.h>
  233. #include <limits.h>
  234. #endif
  235.  
  236. #ifdef    LSI_C
  237. #include <stdlib.h>
  238. #include <io.h>
  239. #include <fcntl.h>
  240. #include <limits.h>
  241. #include <assert.h>
  242. #include <sys/types.h>
  243. #include <sys/stat.h>
  244. #define NOSIGNAL
  245. #endif
  246.  
  247. #ifndef NOSIGNAL
  248. #ifndef SIGTYPE
  249. #define SIGTYPE void
  250. #endif
  251. #ifndef SIG_ERR
  252. #define SIG_ERR (SIGTYPE(*)())-1
  253. #endif
  254. #endif
  255.  
  256. /* This is for Microsoft C v5.1 to compile and be bound  */
  257. /* for use with os/2.  Also if compiled just for os/2    */
  258. /* The signal function is different between protected    */
  259. /* and real mode.                                        */
  260.  
  261. /* #define BIND */
  262.  
  263.  
  264. /*  The following is defined in MSC 5.1 stdlib.h
  265.     Replace with appropriate values for your system.
  266.     These values are used for MSDos system.
  267. */
  268. #ifndef _MAX_PATH
  269. #define _MAX_PATH  144      /* max. length of full pathname       */
  270. #define _MAX_DRIVE   3      /* max. length of drive component     */
  271. #define _MAX_DIR   130      /* max. length of path component      */
  272. #define _MAX_FNAME   9      /* max. length of file name component */
  273. #define _MAX_EXT     5      /* max. length of extension component */
  274. #endif
  275.  
  276. /* the following tells the system that the maximum segment is 64k */
  277. /* if your compiler is not one of these and has this limitation   */
  278. /* Because of this, this code should compile with minimum porting */
  279. /* in the COMPUSI.UNI module to most unix systems.                */
  280. /* This is also used to keep array indexing to 16 bit integer     */
  281. /* if not predefined in compiler implementation, you must define  */
  282. /* it separately if applicable to your compiler/system            */
  283. /* #define MAXSEG_64K                                             */
  284.  
  285. /* put this in if you are compiling in small code */
  286. /* model and your compiler does not predefine it  */
  287. /* this is for CPU' with 64k segment limitation.  */
  288. /* Use this define for small code, it is used by  */
  289. /* the header to decide on value for NEARHEAP     */
  290. /* #define SMALLMODEL */
  291.  
  292. /* does your system use far pointers ? if you want it enabled keep this */
  293. /* if you have segment limit and compile in larger than 13 bits         */
  294. /* then you will have to use compact or large model if your compiler    */
  295. /* does not support far pointer keyword.                                */
  296.  
  297. #ifndef FAR
  298. #define FAR
  299. #endif
  300.  
  301. /* What type does the alloc() function return, char or void? */
  302.  
  303. #ifndef ALLOCTYPE
  304. #define ALLOCTYPE char
  305. #endif
  306.  
  307. /* If you use compusi.dos and your computer supports the unix */
  308. /* file links and the link code is set properly in the stat() */
  309. /* then define the following:                                 */
  310. /* #define USE_LINKS */
  311.  
  312. /* Does your run time library support the ANSI functions for:*/
  313.  
  314. /* reverse string set search?  strrpbrk() if so:             */
  315. /*#define NO_REVSEARCH*//* dos module uses this function. */
  316.  
  317. /* Does your library include strrchr()? If not define this:  */
  318. /*#define NO_STRRCHR*//* unix/xenix module uses this function*/
  319.  
  320. /* Does your library include strchr()? If not define this:   */
  321. /*#define NO_STRCHR*//* dos module uses this function.       */
  322.  
  323. /* definition for const key word if supported */
  324. #ifndef CONST
  325. #define CONST
  326. #endif
  327.  
  328.  
  329. /*  And now for some typedefs */
  330. typedef unsigned short CODE;
  331. typedef unsigned char UCHAR;
  332. typedef unsigned int  INTCODE;
  333. typedef unsigned int HASH;
  334. typedef int FLAG;
  335.  
  336.   /* 
  337.    * You can define the value of MAXBITS to be anything betweeen MINBITS
  338.    * and MAXMAXBITS.  This is will determine the maximum memory you will
  339.    * use and how the tables will be handled.  I recommend you just leave
  340.    * it at MAXMAXBITS, because you can define DFLTBITS in compiling the
  341.    * module COMPRESS.C to set the default, and you can vary the number
  342.    * of bits at runtime by using the -b switch.
  343.    */
  344.  
  345.    /*
  346.    * The only reason to change MAXBITS is if you absolutely must have
  347.    * faster performance. If you specify 14 bits, the tables will not
  348.    * be split; at 13 bits, you can fit in the MSDOS small memory model
  349.    * and allocate tables in near heap.
  350.    * This value is available to other modules through the variable maxbits.
  351.    */
  352.  
  353. #define INITBITS    9
  354. #define MINBITS     12
  355. #define MAXMAXBITS  16
  356.  
  357. #ifndef MAXBITS
  358. #define MAXBITS    MAXMAXBITS
  359. #endif
  360.  
  361. #if (MAXBITS > MAXMAXBITS)
  362. #undef MAXBITS
  363. #define MAXBITS    MAXMAXBITS
  364. #endif
  365.  
  366. #if (MAXBITS < MINBITS)
  367. #undef MAXBITS
  368. #define MAXBITS  MINBITS
  369. #endif
  370.  
  371.   /* You should define DFLTBITS to be the default compression code
  372.    * bit length you desire on your system.
  373.    * (I define mine in the compiler command line in my Makefile.LvR)
  374.    * (I leave mine alone and keep to the maximum. DjG)
  375.    */
  376.  
  377. #ifndef DFLTBITS
  378. #define DFLTBITS MAXBITS
  379. #endif
  380. #if (DFLTBITS < MINBITS)
  381. #undef DFLTBITS
  382. #define DFLTBITS MINBITS
  383. #endif
  384. #if (DFLTBITS > MAXBITS)
  385. #undef DFLTBITS
  386. #define DFLTBITS MAXBITS
  387. #endif
  388.  
  389. /* THIS IS TO COMPILE A 13 BIT MODEL IN SMALL MEMORY AND NEAR HEAP */
  390. /* AS SET UP IT WILL WORK WITH MICROSOFT C COMPILER                */
  391.  
  392. #if (MAXBITS < 14)
  393. #ifdef SMALLMODEL
  394. #define NEARHEAP TRUE
  395. #undef FAR
  396. #define FAR
  397. #endif
  398. #endif
  399.  
  400. /* correcting for different types of pointer arithmatic */
  401. /* probably won't have to change it                     */
  402. #define NULLPTR(type)   ((type FAR *) NULL)
  403.  
  404.  
  405. /* in making this program portable the following allocation and          */
  406. /* free functions are called, with the following parameters:             */
  407. /*        ALLOCTYPE FAR *emalloc(unsigned int x, int y)                  */
  408. /*                 void  efree(ALLOCTYPE FAR *ptr)                       */
  409. /* you must define the allocation function and the free function         */
  410. /* keep in mind that the casts must be correct for your compiler         */
  411. /* NOTE these are the two functions to change for allocating pointers to */
  412. /* far data space if you are not using Microsoft C v.5.1                 */
  413. /* Consult your compiler manual and find the low level function that     */
  414. /* returns a far pointer when compiled in the small model.               */
  415. /* if your compiler does not support that, you will have to compile with */
  416. /* a model that defaults to far pointers to data (compact or large model)*/
  417. /* HERE ARE SOME SAMPLE PREDEFINED ONES                                  */
  418.  
  419. #ifdef MSC
  420. #include <malloc.h>
  421. #if defined(NEARHEAP) || defined(WIN32)
  422. #define ALLOCATE(x,y)   malloc((size_t)((x)*(y)))
  423. #define FREEIT(ptr)     free((ptr))
  424. #else
  425. #define ALLOCATE(x,y)   _fmalloc((size_t)((x)*(y)))
  426. #define FREEIT(ptr)     _ffree((ptr))
  427. #endif
  428. #endif
  429.  
  430. #ifdef HUGE
  431. #include <malloc.h>
  432. #define ALLOCATE(x,y)   halloc((long)(x),(size_t)(y))
  433. #define FREEIT(ptr)     hfree(ptr)
  434. #endif
  435.  
  436. #ifdef __TURBOC__
  437.     #include <alloc.h>
  438.     #ifdef NEARHEAP
  439.         #define ALLOCATE(x,y)  malloc((unsigned int)((x)*(y)))
  440.         #define FREEIT(x)      free(x)
  441.     #else
  442.         #define ALLOCATE(x,y)  farmalloc((unsigned long)((x)*(y)))
  443.         #define FREEIT(x)    farfree(x)
  444.     #endif
  445. #endif
  446.  
  447. #ifdef LSI_C
  448.     #include <dos.h>
  449.     #define ALLOCATE(x,y)  farmalloc((unsigned long)((x)*(y)))
  450.     #define FREEIT(x)      farfree(x)
  451. #endif
  452.  
  453. #if defined(__GO32__) || TOWNS_GPP || defined(WIN32)
  454.     #define far
  455. #endif
  456.  
  457. /* default allocation function, in segmented addressing, must return */
  458. /* a far pointer or compile with far pointer data as default         */
  459. #ifndef ALLOCATE
  460. #include <malloc.h>
  461. #define ALLOCATE(x,y)   malloc((unsigned int)x*y)
  462. #define FREEIT(ptr)     free((ptr))
  463. #endif
  464.  
  465.  
  466. # ifdef MAXSEG_64K
  467. #   if  MAXBITS > 14
  468. #       define SPLIT_HT   TRUE
  469. #   else
  470. #       define SPLIT_HT   0
  471. #   endif
  472. # else
  473. #   define SPLIT_HT   0
  474. # endif
  475.  
  476. # ifdef MAXSEG_64K
  477. #   if  MAXBITS > 15
  478. #       define SPLIT_PFX   TRUE
  479. #   else
  480. #       define SPLIT_PFX   0
  481. #   endif
  482. # else
  483. #   define SPLIT_PFX   0
  484. # endif
  485.  
  486. #ifndef BUFSIZ
  487. #define BUFSIZ 512
  488. #endif
  489.  
  490. #ifdef NO_SETBUF
  491. #define NO_SETVBUF
  492. #endif
  493.  
  494. #ifdef NO_SETVBUF
  495. #   ifndef NO_SETBUF
  496. #       define setvbuf(fp,buf,mode,size) setbuf((fp),(buf))
  497. #       define ZBUFSIZE BUFSIZ
  498. #       define XBUFSIZE BUFSIZ
  499. #   else
  500. #       define setvbuf(fp,buf,mode,size)
  501. #       define ZBUFSIZE (1)
  502. #       define XBUFSIZE (1)
  503. #   endif
  504. #else
  505. #   ifdef NEARHEAP
  506. #       define XBUFSIZE    (0xC00)
  507. #       define ZBUFSIZE    (0x1800)
  508. #   else
  509. #       define XBUFSIZE    (0x3000)      /* 12k bytes */
  510. #       define ZBUFSIZE    (0x6000)      /* 24k bytes */
  511. #   endif
  512. #endif
  513.  
  514. #define UNUSED      ((CODE)0)   /* Indicates hash table value unused    */
  515. #ifndef CLEAR
  516.  #define CLEAR       ((CODE)256) /* Code requesting table to be cleared  */
  517. #endif
  518. #define FIRSTFREE   ((CODE)257) /* First free code for token encoding */
  519. #define MAXTOKLEN   512         /* Max chars in token; size of buffer   */
  520. #define OK          0           /* Result codes from functions:         */
  521.  
  522.  
  523. #define SIGNAL_ERROR -1         /*   signal function error              */
  524. #define NOMEM       2           /*   Ran out of memory                  */
  525. #define TOKTOOBIG   3           /*   Token longer than MAXTOKLEN chars  */
  526. #define READERR     4           /*   I/O error on input                 */
  527. #define WRITEERR    5           /*   I/O error on output                */
  528. #define INFILEBAD   6           /*   Infile not in compressed format    */
  529. #define CODEBAD     7           /*   Infile contained a bad token code  */
  530. #define TABLEBAD    8           /*   The tables got corrupted (!)       */
  531. #define NOSAVING    9           /*   no saving in file size             */
  532. #define NOTOPENED  10           /*   output file couldn't be opened     */
  533. #define YES         1
  534. #define NO          0
  535.  
  536.  
  537. /*#include "compress.fns"*/
  538. /*  COMPRESS.FNS  global function declarations */
  539. /*  this should be compatible with any type of declaration for external
  540.     functions. See compress.h for explaination */
  541. extern  int  check_error(void);
  542. #ifdef NO_STRRCHR
  543. extern char *strrchr(char *,int);
  544. #endif
  545. #ifdef NO_REVSEARCH
  546. extern char *strrpbrk(char *,char *);
  547. #endif
  548. extern  CODE getcode(void);
  549. extern  void writeerr(void);
  550. extern  ALLOCTYPE FAR *emalloc(unsigned int,int);
  551. extern  void efree(ALLOCTYPE FAR *);
  552. extern  int alloc_tables(INTCODE,HASH);
  553. extern  void init_tables(void );
  554. extern  int nextcode(INTCODE *);
  555.  
  556.  
  557. /* defines opening mode for files */
  558. /* and suffixes for compressed file */
  559.  
  560. #ifdef MSDOS
  561. #define WRITE_FILE_TYPE "wb"
  562. #define READ_FILE_TYPE "rb"
  563. #define SUFFIX "Z"
  564. #else
  565. #define WRITE_FILE_TYPE "w"
  566. #define READ_FILE_TYPE "r"
  567. #define SUFFIX ".Z"
  568. #endif
  569.  
  570. /* The VERBOSE flag defines the default value of the verbose variable */
  571. /* If it's not already defined, we set it to FALSE here since most */
  572. /* systems set the default that way.  -Dal */
  573. #ifndef VERBOSE
  574. #define VERBOSE FALSE
  575. #endif
  576.  
  577. /* Defines for third byte of header */
  578. #define BIT_MASK    0x1f
  579. #define BLOCK_MASK  0x80
  580. /* Masks 0x40 and 0x20 are free.  I think 0x20 should mean that there is
  581.    a fourth header byte (for expansion).
  582. */
  583.  
  584.  
  585. #define CHECK_GAP 10000L     /* ratio check interval */
  586.  
  587. #ifdef MAIN
  588. UCHAR magic_header[] = { 0x1F,0x9D };  /* 1F 9D */
  589.  
  590. char rcs_ident[] = TITLE;
  591.  
  592.  
  593.  
  594. int overwrite = 0;          /* Do not overwrite unless given -f flag */
  595. extern int maxbits;         /* user settable max # bits/code */
  596.  
  597. int exit_stat = 0;
  598. int keep = KEEPFLAG;            /* True = don't kill file */
  599. int keep_error = FALSE;     /* True = keep output file even if error exist */
  600. int is_list = FALSE;            /* flag for file parameters */
  601. char endchar[1];
  602. /*
  603. char xbuf[XBUFSIZE];
  604. char zbuf[ZBUFSIZE];
  605. */
  606. #ifdef MSDOS
  607. char separator[] = "\\";
  608. #else
  609. char separator[] = "/";
  610. #endif
  611. int nomagic = FALSE;  /* Use a 3-byte magic number header, unless old file */
  612. int zcat_flg = FALSE; /* Write output on stdout, suppress messages */
  613. /*int quiet = !VERBOSE;  don't tell me about compression */
  614. /*
  615.  * block compression parameters -- after all codes are used up,
  616.  * and compression rate changes, start over.
  617.  */
  618. int block_compress = BLOCK_MASK;
  619.  
  620. /* force the overwrite */
  621. /*int force = 0;*/
  622.  
  623. #ifdef DEBUG
  624. int verbose = VERBOSE;
  625. int debug = FALSE;
  626. #endif /* DEBUG */
  627.  
  628. #ifndef NOSIGNAL
  629. SIGTYPE (*bgnd_flag)();
  630. #endif
  631.  
  632. int do_decomp = FALSE;
  633.  
  634. #else               /* not defining instance */
  635.  
  636. extern UCHAR magic_header[];
  637. extern char rcs_ident[];
  638. #ifdef MWC
  639. extern long _stksize;
  640. #endif
  641. extern int overwrite;
  642. extern int maxbits;
  643.  
  644.  
  645. extern int exit_stat;
  646. extern int keep;
  647. extern int keep_error;
  648. extern char *prog_name;
  649. extern char inpath[];
  650. extern char outpath[];
  651. extern int is_list;
  652. extern char endchar[];
  653. extern char xbuf[];
  654. extern char zbuf[];
  655. extern char ifname[];
  656. extern char ofname[];
  657. extern char separator[];
  658. extern int nomagic;
  659. extern int zcat_flg;
  660. extern int quiet;
  661. extern int block_compress;
  662. #ifdef COMP40
  663. extern long int ratio;
  664. extern long checkpoint;
  665. #endif
  666. extern int force;
  667.  
  668. #ifdef DEBUG
  669. extern int verbose;
  670. extern int debug;
  671. #endif /* DEBUG */
  672.  
  673. #ifndef NOSIGNAL
  674. extern SIGTYPE (*bgnd_flag)();
  675. #endif
  676. extern int do_decomp;
  677. #endif
  678.  
  679. extern int de_comp(void);
  680. extern void init_comp(void);
  681. extern int v_read(unsigned char *buf,int len);
  682.  
  683. #ifdef DLL
  684. extern void compapi_static_init(void);
  685. #endif
  686.