1 /****************************************************************************/
2 /* ハフマン符号クラス */
3 /****************************************************************************/
4 #ifndef _HUF_H
5 #define _HUF_H
7 #include <windows.h>
8 #include <stdio.h>
9 #include <limits.h>
10 #include "lhazdef.h"
11 #include "lha_macro.h"
13 class MYFILE;
15 class HUFFMAN {
17 public:
18  enum HUF_ERROR {
20  };
21  enum METHOD {
34  };
35  //
36  struct DECODE {
40  };
41  struct ENCODE {
42  void (HUFFMAN::*Output)(int, uint);
44  void (HUFFMAN::*End)(void);
45  };
46  //
47  HUFFMAN(METHOD method, uchar* t, MYFILE& infile, MYFILE& outfile, int dicbit, LONGLONG origsize, LONGLONG compsize, bool* unpackable);
50  LONGLONG GetCompsize(void) { return Compsize; };
52 private:
53  static const int N1;
54  static const int LENFIELD;
55  static const int BUFBITS;
56  static const int EXTRABITS;
57  //
58  static DECODE Decodes[9];
59  static ENCODE Encodes[2];
60  //
62  MYFILE& Infile;
63  MYFILE& Outfile;
64  int Dicbit;
65  LONGLONG Origsize;
66  LONGLONG Compsize;
67  bool* UnPackable;
68  //
69  HUFFMAN& operator=(const HUFFMAN&);
70  //
71  ushort decode_c_dyn(void);
72  ushort decode_c_st0(void);
73  ushort decode_c_st1(void);
74  ushort decode_c_lzs(void);
75  ushort decode_c_lz5(void);
76  ushort decode_p_dyn(void);
77  ushort decode_p_st0(void);
78  ushort decode_p_st1(void);
79  ushort decode_p_lzs(void);
80  ushort decode_p_lz5(void);
81  void decode_start_fix(void);
82  void decode_start_dyn(void);
83  void decode_start_st0(void);
84  void decode_start_st1(void);
85  void decode_start_lzs(void);
86  void decode_start_lz5(void);
87  void fillbuf(uchar);
89  void init_getbits(void);
90  void read_pt_len(short nn, short nbit, short i_special);
91  void read_c_len(void);
92  void read_tree_c(void);
93  void read_tree_p(void);
94  void putcode(uchar n, ushort x);
95  void putbits(uchar n, ushort x);
96  void encode_c_dyn(int c);
97  void output_dyn(int code, unsigned int pos);
98  void encode_end_dyn(void);
99  void write_pt_len(short n, short nbit, short i_special);
100  void write_c_len(void);
101  void send_block(void);
102  void output_st1(int c, uint p);
103  void encode_end_st1(void);
104  void encode_c(short c);
105  void encode_p(ushort p);
106  void encode_p_st0(ushort j);
107  void encode_start_fix(void);
108  void ready_made(int method);
109  void encode_start_st1(void);
110  void start_p_dyn(void);
112 };
114 #endif
static const int BUFBITS
Definition: chuf.h:55
Definition: chuf.h:27
void decode_start_lzs(void)
Definition: larc.cpp:38
Definition: chuf.h:33
void encode_p_st0(ushort j)
Definition: shuf.cpp:47
ushort decode_p_st0(void)
Definition: shuf.cpp:167
if the work is an executable linked with the with the complete machine readable work that uses the as object code and or source so that the user can modify the Library and then relink to produce a modified executable containing the modified rather than copying library functions into the if the user installs as long as the modified version is interface compatible with the version that the work was made with c Accompany the work with a written valid for at least three to give the same user the materials specified in for a charge no more than the cost of performing this distribution d If distribution of the work is made by offering access to copy from a designated offer equivalent access to copy the above specified materials from the same place e Verify that the user has already received a copy of these materials or that you have already sent this user a copy For an the required form of the work that uses the Library must include any data and utility programs needed for reproducing the executable from it as a special the materials to be distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system Such a contradiction means you cannot use both them and the Library together in an executable that you distribute You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities not covered by this and distribute such a combined provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise and provided that you do these two uncombined with any other library facilities This must be distributed under the terms of the Sections above b Give prominent notice with the combined library of the fact that part of it is a work based on the and explaining where to find the accompanying uncombined form of the same work You may not link or distribute the Library except as expressly provided under this License Any attempt otherwise to link or distribute the Library is void
Definition: copying.txt:323
unsigned int uint
Definition: lhazdef.h:6
void(HUFFMAN::* Start)(void)
Definition: chuf.h:39
Definition: chuf.h:15
void output_st1(int c, uint p)
Definition: huf.cpp:206
ushort(HUFFMAN::* P)(void)
Definition: chuf.h:38
Definition: chuf.h:26
Definition: chuf.h:29
void init_getbits(void)
Definition: crcio.cpp:163
void encode_c_dyn(int c)
Definition: dhuf.cpp:232
ushort decode_p_lz5(void)
Definition: larc.cpp:69
Definition: chuf.h:22
ushort decode_c_lz5(void)
Definition: larc.cpp:44
void encode_end_st1(void)
Definition: huf.cpp:269
ushort decode_p_lzs(void)
Definition: larc.cpp:32
ushort(HUFFMAN::* C)(void)
Definition: chuf.h:37
void fillbuf(uchar)
Definition: crcio.cpp:95
void encode_end_dyn(void)
Definition: dhuf.cpp:313
and that you are informed that you can do these things To protect your we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it For if you distribute copies of the whether gratis or for a you must give the recipients all the rights that we gave you You must make sure that receive or can get the source code If you link other code with the you must provide complete object files to the so that they can relink them with the library after making changes to the library and recompiling it And you must show them these terms so they know their rights We protect your rights with a two step method
Definition: copying.txt:35
HUFFMAN & operator=(const HUFFMAN &)
unsigned short ushort
Definition: lhazdef.h:5
Definition: chuf.h:21
Definition: chuf.h:66
void encode_c(short c)
Definition: huf.cpp:135
Definition: chuf.h:31
void write_pt_len(short n, short nbit, short i_special)
Definition: huf.cpp:72
MYFILE & Infile
Definition: chuf.h:62
the intent is to exercise the right to control the distribution of derivative or collective works based on the Library In mere aggregation of another work not based on the Library with the you must alter all the notices that refer to this so that they refer to the ordinary GNU General Public instead of to this it is irreversible for that so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy This option is useful when you wish to copy part of the code of the Library into a program that is not a library You may copy and distribute the which must be distributed under the terms of Sections and above on a medium customarily used for software interchange If distribution of object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code
Definition: copying.txt:235
Definition: chuf.h:65
void decode_start_st0(void)
Definition: shuf.cpp:38
static const int LENFIELD
Definition: chuf.h:54
LONGLONG GetCompsize(void)
Definition: chuf.h:50
ushort decode_c_st1(void)
Definition: huf.cpp:363
uchar * Text
Definition: chuf.h:61
void decode_start_dyn(void)
Definition: dhuf.cpp:86
void encode_start_fix(void)
Definition: shuf.cpp:78
HUFFMAN(METHOD method, uchar *t, MYFILE &infile, MYFILE &outfile, int dicbit, LONGLONG origsize, LONGLONG compsize, bool *unpackable)
Definition: chuf.cpp:23
void write_c_len(void)
Definition: huf.cpp:96
MYFILE & Outfile
Definition: chuf.h:63
void read_pt_len(short nn, short nbit, short i_special)
Definition: huf.cpp:280
ushort decode_c_dyn(void)
Definition: dhuf.cpp:254
static const int EXTRABITS
Definition: chuf.h:56
Definition: chuf.h:23
Definition: chuf.h:49
ushort getbits(uchar)
Definition: crcio.cpp:113
void encode_p(ushort p)
Definition: huf.cpp:141
Definition: chuf.h:18
Definition: chuf.h:32
void decode_start_st1(void)
Definition: huf.cpp:422
void encode_start_st1(void)
Definition: huf.cpp:250
void send_block(void)
Definition: huf.cpp:156
static ENCODE Encodes[2]
Definition: chuf.h:59
Definition: chuf.h:28
void putbits(uchar n, ushort x)
Definition: crcio.cpp:142
Definition: chuf.h:30
void decode_start_lz5(void)
Definition: larc.cpp:75
ushort decode_c_lzs(void)
Definition: larc.cpp:21
void decode_start_fix(void)
Definition: shuf.cpp:124
int Dicbit
Definition: chuf.h:64
Definition: chuf.h:24
Definition: chuf.h:25
ushort decode_p_st1(void)
Definition: huf.cpp:394
void ready_made(int method)
Definition: shuf.cpp:56
void read_tree_c(void)
Definition: shuf.cpp:89
ushort decode_p_dyn(void)
Definition: dhuf.cpp:278
Definition: chuf.h:36
void read_c_len(void)
Definition: huf.cpp:322
Definition: chuf.h:48
static const int N1
Definition: chuf.h:50
Definition: chuf.h:19
void start_p_dyn(void)
Definition: dhuf.cpp:73
ushort decode_c_st0(void)
Definition: shuf.cpp:136
unsigned char uchar
Definition: lhazdef.h:4
void putcode(uchar n, ushort x)
Definition: crcio.cpp:122
Definition: chuf.h:41
bool * UnPackable
Definition: chuf.h:67
static DECODE Decodes[9]
Definition: chuf.h:58
void output_dyn(int code, unsigned int pos)
Definition: dhuf.cpp:306
void read_tree_p(void)
Definition: shuf.cpp:109