home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c019 / 1.ddi / AR001 / AR.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-23  |  1.7 KB  |  67 lines

  1. /***********************************************************
  2.     ar.h
  3. ***********************************************************/
  4. #include <stdio.h>
  5. #include <limits.h>
  6. typedef unsigned char  uchar;   /*  8 bits or more */
  7. typedef unsigned int   uint;    /* 16 - 32 bits or more */
  8. typedef unsigned short ushort;  /* 16 bits or more */
  9. typedef unsigned long  ulong;   /* 32 bits or more */
  10.  
  11. /* ar.c */
  12.  
  13. extern int unpackable;
  14. extern ulong origsize, compsize;
  15.  
  16. /* io.c */
  17.  
  18. extern FILE *arcfile, *infile, *outfile;
  19. extern ushort crc, bitbuf;
  20.  
  21. void error(char *fmt, ...);
  22. void make_crctable(void);
  23. void fillbuf(uchar n);
  24. ushort getbits(uchar n);
  25. /* void putbit(uchar bit); */
  26. void putbits(uchar n, ushort x);
  27. int fread_crc(uchar *p, int n, FILE *f);
  28. void fwrite_crc(uchar *p, int n, FILE *f);
  29. void init_getbits(void);
  30. void init_putbits(void);
  31.  
  32. /* slide.c */
  33.  
  34. #define DICBIT    12    /* 12 or 13 */
  35. #define DICSIZ (1U << DICBIT)
  36. #define MATCHBIT   8    /* bits for MAXMATCH - THRESHOLD */
  37. #define MAXMATCH 256    /* formerly F (not more than UCHAR_MAX + 1) */
  38. #define THRESHOLD  3    /* choose optimal value */
  39.  
  40. void encode(void);
  41. void decode(void);
  42.  
  43. /* huf.c */
  44.  
  45. #define NC (UCHAR_MAX + MAXMATCH + 2 - THRESHOLD)
  46.     /* alphabet = {0, 1, 2, ..., NC - 1} */
  47. #define CBIT 9  /* $\lfloor \log_2 NC \rfloor + 1$ */
  48. #define USHRT_BIT (CHAR_BIT * sizeof(ushort))
  49.  
  50. extern short left[], right[];
  51.  
  52. void encode_start(void);
  53. void decode_start(void);
  54. ushort decode_c(void);
  55. ushort decode_p(void);
  56. void output(ushort c, ushort p);
  57. void encode_end(void);
  58.  
  59. /* maketbl.c */
  60.  
  61. void make_table(short nchar, uchar bitlen[],
  62.                 short tablebits, ushort table[]);
  63.  
  64. /* maketree.c */
  65.  
  66. short make_tree(short nparm, ushort freqparm[], uchar lenparm[]);
  67.