home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / ARCHIVERS / lha208src.lzh / LHA / SRC / slidehuf.h < prev    next >
Text File  |  1994-02-14  |  4KB  |  159 lines

  1. /*
  2.  * slidehuf.h -- part of LHa for UNIX
  3.  *
  4.  *    modified: Dec. 5, 1991, Masaru Oki.
  5.  */
  6.  
  7. #ifndef NULL
  8. #include <stdio.h>
  9. #endif
  10.  
  11. #ifndef _ERRNO
  12. #include <errno.h>
  13. #endif
  14.  
  15. #if defined(__STDC__)
  16.  
  17. #include <limits.h>
  18.  
  19. #else
  20.  
  21. #ifndef CHAR_BIT
  22. #define CHAR_BIT  8
  23. #endif
  24. #ifndef UCHAR_MAX
  25. #define UCHAR_MAX ((1<<(sizeof(unsigned char)*8))-1)
  26. #endif
  27. #ifndef USHRT_MAX
  28. #define USHRT_MAX ((1<<(sizeof(unsigned short)*8))-1)
  29. #endif
  30. #ifndef SHRT_MAX
  31. #define SHRT_MAX ((1<<(sizeof(short)*8-1))-1)
  32. #endif
  33. #ifndef SHRT_MIN
  34. #define SHRT_MIN (SHRT_MAX-USHRT_MAX)
  35. #endif
  36. #ifndef UINT_MAX
  37. #define UINT_MAX ((1<<(sizeof(unsigned int)*8))-1)
  38. #endif
  39. #endif /* not __STDC__ */
  40.  
  41. /* #include "errmes.h" */
  42. /* Your C-Compiler has no 'void' (from lharc.h) */
  43. #ifdef NO_VOID
  44. #define void
  45. #endif
  46.  
  47. struct encode_option {
  48. #ifndef NO_VOID
  49.     void (*output)();
  50.     void (*encode_start)();
  51.     void (*encode_end)();
  52. #else
  53.     int (*output)();
  54.     int (*encode_start)();
  55.     int (*encode_end)();
  56. #endif
  57. };
  58.  
  59. struct decode_option {
  60.     unsigned short (*decode_c)();
  61.     unsigned short (*decode_p)();
  62. #ifndef NO_VOID
  63.     void (*decode_start)();
  64. #else
  65.     int (*decode_start)();
  66. #endif
  67. };
  68.  
  69. /* from slide.c */
  70. #define MAX_DICBIT 13 
  71. #define MAX_DICSIZ (1 << MAX_DICBIT)
  72. #define MATCHBIT   8    /* bits for MAXMATCH - THRESHOLD */
  73. #define MAXMATCH 256    /* formerly F (not more than UCHAR_MAX + 1) */
  74. #define THRESHOLD  3    /* choose optimal value */
  75.  
  76. extern int errno;
  77. extern int unpackable;
  78. extern unsigned long origsize, compsize;
  79. extern unsigned short dicbit;
  80. extern unsigned short maxmatch;
  81. extern unsigned long count;
  82. extern unsigned short loc;
  83. extern unsigned char *text;
  84.  
  85. /* from huf.c */
  86. #define NC (UCHAR_MAX + MAXMATCH + 2 - THRESHOLD)
  87.             /* alphabet = {0, 1, 2, ..., NC - 1} */
  88. #define CBIT 9  /* $\lfloor \log_2 NC \rfloor + 1$ */
  89. #define USHRT_BIT 16    /* (CHAR_BIT * sizeof(ushort)) */
  90.  
  91. extern unsigned short    left[], right[];
  92. extern unsigned char    c_len[], pt_len[];
  93. extern unsigned short    c_freq[], c_table[], c_code[],
  94.                         p_freq[], pt_table[], pt_code[],
  95.                         t_freq[];
  96.  
  97. void output_st1();
  98. unsigned char *alloc_buf();
  99. void encode_start_st1();
  100. void encode_end_st1();
  101. unsigned short decode_c_st1();
  102. unsigned short decode_p_st1();
  103. void decode_start_st1();
  104.  
  105. /* from shuf.c */
  106. void decode_start_st0();
  107. void encode_p_st0(/*unsigned short j*/);
  108. void encode_start_fix();
  109. void decode_start_fix();
  110. unsigned short decode_c_st0();
  111. unsigned short decode_p_st0();
  112.  
  113. /* from dhuf.c */
  114. extern unsigned int n_max;
  115.  
  116. void start_c_dyn();
  117. void decode_start_dyn();
  118. unsigned short decode_c_dyn();
  119. unsigned short decode_p_dyn();
  120. void output_dyn(/*int code, unsigned int pos*/);
  121. void encode_end_dyn();
  122.  
  123. /* from larc.c */
  124. unsigned short decode_c_lzs();
  125. unsigned short decode_p_lzs();
  126. unsigned short decode_c_lz5();
  127. unsigned short decode_p_lz5();
  128. void decode_start_lzs();
  129. void decode_start_lz5();
  130.  
  131. /* from maketbl.c */
  132. /* void make_table(short nchar, uchar bitlen[],
  133.                    short tablebits, ushort table[]); */
  134. void make_table(/*int nchar, uchar bitlen[],int tablebits, ushort table[]*/);
  135.  
  136. /* from maketree.c */
  137. /* void make_code(short n, uchar len[], ushort code[]);
  138. short make_tree(short nparm, ushort freqparm[], 
  139.                 uchar lenparm[], ushort codeparam[]); */
  140. void make_code(/*int n, uchar len[], ushort code[]*/);
  141. short make_tree(/*int nparm, ushort freqparm[],
  142.                 uchar lenparm[], ushort codeparam[]*/);
  143.  
  144. /* from crcio.c */
  145. extern FILE *infile, *outfile;
  146. extern unsigned short crc, bitbuf;
  147. extern int dispflg;
  148.  
  149. void make_crctable();
  150. unsigned short calccrc(/*uchar *p, uint n*/);
  151. void fillbuf(/*uchar n*/);
  152. unsigned short getbits(/*uchar n*/);
  153. void putcode(/*uchar n, ushort x*/);
  154. void putbits(/*uchar n, ushort x*/);
  155. int fread_crc(/*uchar *p, int n, FILE *f*/);
  156. void fwrite_crc(/*uchar *p, int n, FILE *f*/);
  157. void init_getbits();
  158. void init_putbits();
  159.