home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / ZOO21E.EXE / AR.H < prev    next >
C/C++ Source or Header  |  1991-07-11  |  3KB  |  129 lines

  1. /*$Source: /usr/home/dhesi/zoo/RCS/ar.h,v $*/
  2. /*$Id: ar.h,v 1.17 91/07/09 01:39:50 dhesi Exp $*/
  3. /***********************************************************
  4.     ar.h
  5.  
  6. Adapted from "ar" archiver written by Haruhiko Okumura.
  7. ***********************************************************/
  8.  
  9. #include <stdio.h>
  10.  
  11. #ifdef ANSI_HDRS
  12. # include <limits.h>
  13. #endif
  14.  
  15. /* uchar should be 8 bits or more */
  16. /* typedef unsigned char  uchar;   -- already in zoo.h */
  17.  
  18. typedef unsigned int   uint;    /* 16 bits or more */
  19. typedef unsigned short ushort;  /* 16 bits or more */
  20. typedef unsigned long  ulong;   /* 32 bits or more */
  21.  
  22. /* T_UINT16 must be #defined in options.h to be
  23. a 16-bit unsigned integer type */
  24.  
  25. #ifndef T_UINT16
  26. # include "T_UINT16 not defined"
  27. #endif
  28.  
  29. typedef T_UINT16          t_uint16;    /* exactly 16 bits */
  30.  
  31. #ifndef SEEK_SET
  32. # define SEEK_SET 0
  33. #endif
  34. #ifndef SEEK_CUR
  35. # define SEEK_CUR 1
  36. #endif
  37. #ifndef SEEK_END
  38. # define SEEK_END 2
  39. #endif
  40. #ifndef EXIT_SUCCESS
  41. # define EXIT_SUCCESS 0
  42. #endif
  43. #ifndef EXIT_FAILURE
  44. # define EXIT_FAILURE 1
  45. #endif
  46.  
  47. /* ar.c */
  48.  
  49. extern int unpackable;
  50. extern ulong origsize, compsize;
  51.  
  52. /* all the prototypes follow here for all files */
  53.  
  54. /* standard library functions */
  55. #ifndef ANSI_HDRS
  56.  extern void exit();
  57.  extern long ftell();
  58.  extern int fseek();
  59.  extern int strlen();
  60.  extern char *strchr();
  61.  extern char *strpbrk();
  62.  extern int strcmp();
  63.  extern char *strcpy();
  64.  extern int memcmp();
  65.  extern VOIDPTR malloc();
  66.  extern VOIDPTR memcpy();
  67. #endif /* ANSI_HDRS */
  68.  
  69. /* AR.C */
  70. int get_line PARMS((char *s , int n ));
  71. void exitfunc PARMS((int code));
  72. void dlog PARMS((char *fmt, ...));
  73. void d1log PARMS((char *fmt, ...));
  74. void outcf PARMS((FILE *stream, char *buf, int n));
  75. void c1log PARMS((char *buf, int n));
  76.  
  77. /* DECODE.C */
  78. void decode_start PARMS((void ));
  79. int decode PARMS((uint count , uchar buffer []));
  80.  
  81. /* ENCODE.C */
  82. void encode PARMS((FILE *, FILE *));
  83.  
  84. /* HUF.C */
  85. void output PARMS((uint c , uint p ));
  86. void huf_encode_start PARMS((void ));
  87. void huf_encode_end PARMS((void ));
  88. uint decode_c PARMS((void ));
  89. uint decode_p PARMS((void ));
  90. void huf_decode_start PARMS((void ));
  91.  
  92. /* IO.C */
  93. void make_crctable PARMS((void ));
  94. void fillbuf PARMS((int n ));
  95. uint getbits PARMS((int n ));
  96. void putbits PARMS((int n , uint x ));
  97. int fread_crc PARMS((uchar *p , int n , FILE *f ));
  98. void fwrite_crc PARMS((uchar *p , int n , FILE *f ));
  99. void init_getbits PARMS((void ));
  100. void init_putbits PARMS((void ));
  101.  
  102. /* MAKETBL.C */
  103. void make_table
  104.     PARMS((int nchar, uchar bitlen[], int tablebits, ushort table[]));
  105.  
  106. /* MAKETREE.C */
  107. int make_tree
  108.     PARMS((int nparm, ushort freqparm [], uchar lenparm [], ushort codeparm []));
  109.  
  110. /* delete */
  111.  
  112. #ifdef NEED_MEMMOVE
  113. # define MOVE_LEFT move_left
  114.   void move_left();
  115. #else
  116. # define MOVE_LEFT memmove
  117.  extern VOIDPTR memmove();
  118. #endif
  119.  
  120. #if 0
  121. /* global crc variable stuff for use by various routines */
  122. extern t_uint16 crc;
  123. #define INIT_CRC  0  /* CCITT: 0xFFFF */
  124. #endif
  125.  
  126. /* for lzh modules and also for ar.c to use in defining buffer size */
  127. #define DICBIT    13    /* 12(-lh4-) or 13(-lh5-) */
  128. #define DICSIZ ((unsigned) 1 << DICBIT)
  129.