home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / OLS / Os2 / LHA2P205 / LHA2P205.LZH / lha2-2.05pre / source.lzh / src / slidehuf.h < prev    next >
C/C++ Source or Header  |  1995-10-15  |  3KB  |  123 lines

  1. /*
  2.  * slidehuf.h
  3.  *   Copyright (C) 1988-1992, Haruyasu YOSHIZAKI
  4.  *   Copyright (C) 1991-1995, Satoshi HIRAMATSU (OS/2 HPFS version)
  5.  *
  6.  * $Log$
  7.  */
  8.  
  9.  
  10. #ifndef __INCLUDED_SLIDEHUF_H
  11. #define __INCLUDED_SLIDEHUF_H
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15.  
  16.  
  17. struct encode_option
  18. {
  19.   void (*output)();
  20.   void (*encode_start)();
  21.   void (*encode_end)();
  22. };
  23. struct decode_option
  24. {
  25.   ushort (*decode_c)();
  26.   ushort (*decode_p)();
  27.   void (*decode_start)();
  28. };
  29.  
  30.  
  31. /* from slide.c */
  32. #define MAX_DICBIT 13 
  33. #define MAX_DICSIZ (1U << MAX_DICBIT)
  34. #define MATCHBIT   8        /* bits for MAXMATCH - THRESHOLD */
  35. #define MAXMATCH 256        /* formerly F (not more than UCHAR_MAX + 1) */
  36. #define THRESHOLD  3        /* choose optimal value */
  37.  
  38. extern int unpackable;
  39. extern ulong origsize, compsize;
  40. extern ushort dicbit;
  41. extern ushort maxmatch;
  42. extern ulong count;
  43. extern ushort loc;
  44.  
  45.  
  46. /* from huf.c */
  47. /* alphabet = {0, 1, 2, ..., NC - 1} */
  48. #define NC (UCHAR_MAX + MAXMATCH + 2 - THRESHOLD)
  49. #define CBIT 9            /* $\lfloor \log_2 NC \rfloor + 1$ */
  50. #define USHRT_BIT 16        /* (CHAR_BIT * sizeof(ushort)) */
  51.  
  52. extern ushort left[], right[];
  53. extern uchar c_len[], pt_len[];
  54. extern ushort c_freq[], c_table[], c_code[],
  55.   p_freq[], pt_table[], pt_code[], t_freq[];
  56.  
  57. void output_st1(ushort, ushort);
  58. void *alloc_buf(void);
  59. void encode_start_st1(void);
  60. void decode_start_st1(void);
  61. void encode_end_st1(void);
  62. ushort decode_c_st1(void);
  63. ushort decode_p_st1(void);
  64.  
  65.  
  66. /* from shuf.c */
  67. void decode_start_st0(void);
  68. void encode_p_st0(unsigned short);
  69. void encode_start_fix(void);
  70. void decode_start_fix(void);
  71. ushort decode_c_st0(void);
  72. ushort decode_p_st0(void);
  73.  
  74.  
  75. /* from dhuf.c */
  76. extern uint n_max;
  77.  
  78. void start_c_dyn(void);
  79. void decode_start_dyn(void);
  80. ushort decode_c_dyn(void);
  81. ushort decode_p_dyn(void);
  82. void output_dyn(int, unsigned int);
  83. void encode_end_dyn(void);
  84.  
  85.  
  86. /* from larc.c */
  87. ushort decode_c_lzs(void);
  88. ushort decode_p_lzs(void);
  89. ushort decode_c_lz5(void);
  90. ushort decode_p_lz5(void);
  91. void decode_start_lzs(void);
  92. void decode_start_lz5(void);
  93.  
  94.  
  95. /* from maketbl.c */
  96. void make_table(short, uchar *, short, ushort *);
  97.  
  98.  
  99. /* from maketree.c */
  100. void make_code(short, uchar *, ushort *);
  101. short make_tree(short, ushort *, uchar *, ushort *);
  102.  
  103.  
  104. /* from crcio.c */
  105. extern FILE *infile, *outfile;
  106. extern ushort bitbuf;
  107. extern int dispflg;
  108.  
  109. void fillbuf(uchar);
  110. ushort getbits(uchar);
  111. void putcode(uchar, ushort);
  112. void putbits(uchar, ushort);
  113. int fread_crc(uchar *, int, FILE *, hword *);
  114. void fwrite_crc(uchar *, int, FILE *, hword *);
  115. void init_getbits(void);
  116. void init_putbits(void);
  117.  
  118.  
  119. #ifdef __cplusplus
  120. }
  121. #endif
  122. #endif /* __INCLUDED_SLIDEHUF_H */
  123.