dtinfo subdirectory DtMmdb
This commit is contained in:
committed by
Jon Trulson
parent
0be684281d
commit
fbd81ef151
@@ -63,8 +63,8 @@ class encoding_unit
|
||||
public:
|
||||
ostring* word;
|
||||
int bits;
|
||||
unsigned int code;
|
||||
unsigned int freq;
|
||||
unsigned int code;
|
||||
htr_node* leaf_htr_node;
|
||||
|
||||
public:
|
||||
|
||||
@@ -109,7 +109,7 @@ void huff::build_tree()
|
||||
heap htr_node_set(htr_eq, htr_ls, cts);
|
||||
|
||||
htr_node* x ;
|
||||
for (int i=0; i<cts; i++ ) {
|
||||
for (unsigned int i=0; i<cts; i++ ) {
|
||||
if ( e_units[i] ) {
|
||||
x = new htr_node(e_units[i]);
|
||||
e_units[i] -> leaf_htr_node = x;
|
||||
@@ -146,7 +146,7 @@ void huff::calculate_code()
|
||||
htr_node* x ;
|
||||
htr_node* parent;
|
||||
|
||||
for (int i=0; i<cts; i++ ) {
|
||||
for (unsigned int i=0; i<cts; i++ ) {
|
||||
|
||||
if ( e_units[i] == 0 )
|
||||
continue;
|
||||
@@ -175,7 +175,7 @@ void huff::calculate_code()
|
||||
x = parent;
|
||||
e_units[i] -> bits++;
|
||||
|
||||
if ( e_units[i] -> bits > BITS_IN(unsigned long) ) {
|
||||
if ( e_units[i] -> bits > (int) BITS_IN(unsigned long) ) {
|
||||
debug(cerr, e_units[i] -> bits);
|
||||
throw(stringException("huffman tree too deep"));
|
||||
}
|
||||
@@ -191,7 +191,7 @@ ostream& huff::print_alphabet(ostream& out)
|
||||
unsigned long total_uncmp = 0;
|
||||
unsigned long int total_cmp = 0;
|
||||
|
||||
for (int i=0; i<cts; i++ ) {
|
||||
for (unsigned int i=0; i<cts; i++ ) {
|
||||
|
||||
if ( e_units[i] == 0 )
|
||||
continue;
|
||||
@@ -400,7 +400,7 @@ io_status huff::cdrOut(buffer& buf)
|
||||
//MESSAGE(cerr, "huff::cdrOut");
|
||||
//debug(cerr, my_oid());
|
||||
static buffer v_out_buf(LBUFSIZ);
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if ( cts > 0 ) {
|
||||
//MESSAGE(cerr, "huff::cdrOut: dict out");
|
||||
@@ -454,7 +454,7 @@ io_status huff::cdrIn(buffer& buf)
|
||||
unsigned int word_freq;
|
||||
//ostring *z = 0;
|
||||
|
||||
for ( int i=0; i<cts; i++ ) {
|
||||
for ( unsigned int i=0; i<cts; i++ ) {
|
||||
|
||||
v_in_buf.get(word_sz);
|
||||
v_in_buf.get(word_buf, int(word_sz));
|
||||
|
||||
@@ -60,11 +60,11 @@
|
||||
class htr_node
|
||||
{
|
||||
public:
|
||||
htr_node* parent;
|
||||
htr_node* left;
|
||||
htr_node* right;
|
||||
unsigned long freq;
|
||||
encoding_unit* eu;
|
||||
unsigned long freq;
|
||||
htr_node* parent;
|
||||
|
||||
public:
|
||||
htr_node(encoding_unit* eu, htr_node* lt = 0, htr_node* rt = 0);
|
||||
@@ -80,10 +80,10 @@ class huff : public compress_agent
|
||||
{
|
||||
|
||||
protected:
|
||||
htr_node* htr_root;
|
||||
encoding_unit** e_units;
|
||||
trie* tri;
|
||||
unsigned int cts ;
|
||||
trie* tri;
|
||||
htr_node* htr_root;
|
||||
|
||||
protected:
|
||||
void build_tree();
|
||||
|
||||
@@ -415,7 +415,9 @@ static int ps_did_buffer_switch_on_eof;
|
||||
static ps_state_type ps_get_previous_state ps_PROTO(( void ));
|
||||
static ps_state_type ps_try_NUL_trans ps_PROTO(( ps_state_type current_state ));
|
||||
static int ps_get_next_buffer ps_PROTO(( void ));
|
||||
#if 0
|
||||
static void psunput ps_PROTO(( ps_CHAR c, ps_CHAR *buf_ptr ));
|
||||
#endif
|
||||
void psrestart ps_PROTO(( FILE *input_file ));
|
||||
void ps_switch_to_buffer ps_PROTO(( ps_BUFFER_STATE new_buffer ));
|
||||
void ps_load_buffer_state ps_PROTO(( void ));
|
||||
@@ -807,6 +809,7 @@ register ps_state_type ps_current_state;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
#ifdef ps_USE_PROTOS
|
||||
static void psunput( ps_CHAR c, register ps_CHAR *ps_bp )
|
||||
#else
|
||||
@@ -850,6 +853,7 @@ register ps_CHAR *ps_bp;
|
||||
*/
|
||||
ps_DO_BEFORE_ACTION; /* set up pstext again */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -421,7 +421,9 @@ static int sgml_did_buffer_switch_on_eof;
|
||||
static sgml_state_type sgml_get_previous_state sgml_PROTO(( void ));
|
||||
static sgml_state_type sgml_try_NUL_trans sgml_PROTO(( sgml_state_type current_state ));
|
||||
static int sgml_get_next_buffer sgml_PROTO(( void ));
|
||||
#if 0
|
||||
static void sgmlunput sgml_PROTO(( sgml_CHAR c, sgml_CHAR *buf_ptr ));
|
||||
#endif
|
||||
void sgmlrestart sgml_PROTO(( FILE *input_file ));
|
||||
void sgml_switch_to_buffer sgml_PROTO(( sgml_BUFFER_STATE new_buffer ));
|
||||
void sgml_load_buffer_state sgml_PROTO(( void ));
|
||||
@@ -818,6 +820,7 @@ register sgml_state_type sgml_current_state;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
#ifdef sgml_USE_PROTOS
|
||||
static void sgmlunput( sgml_CHAR c, register sgml_CHAR *sgml_bp )
|
||||
#else
|
||||
@@ -861,6 +864,7 @@ register sgml_CHAR *sgml_bp;
|
||||
*/
|
||||
sgml_DO_BEFORE_ACTION; /* set up sgmltext again */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -147,7 +147,7 @@ trie::~trie()
|
||||
delete root;
|
||||
delete sorted_freqs;
|
||||
|
||||
for ( int i=0; i<alphabet_sz; i++ )
|
||||
for ( unsigned int i=0; i<alphabet_sz; i++ )
|
||||
delete alphabet[i];
|
||||
|
||||
delete alphabet;
|
||||
@@ -155,7 +155,7 @@ trie::~trie()
|
||||
|
||||
void trie::extend_alphabet()
|
||||
{
|
||||
if ( alphabet_sz >= estimated_sz ) {
|
||||
if ( (int) alphabet_sz >= estimated_sz ) {
|
||||
encoding_unitPtr* new_alphabet = new encoding_unitPtr[2* estimated_sz];
|
||||
|
||||
for ( int k=0; k< estimated_sz; k++ ) {
|
||||
@@ -175,13 +175,10 @@ void trie::add(unsigned char* word, int sz, int fq)
|
||||
// cerr << word[k];
|
||||
//cerr << "\n";
|
||||
|
||||
static int j, level = 0;
|
||||
static int j;
|
||||
static trie_node* x = 0;
|
||||
static trie_node_info* y = 0;
|
||||
|
||||
static char buf[1];
|
||||
static ostring *z;
|
||||
|
||||
if ( root == 0 )
|
||||
root = new trie_node(0);
|
||||
|
||||
|
||||
@@ -117,16 +117,16 @@ class trie
|
||||
{
|
||||
|
||||
protected:
|
||||
trie_node* root;
|
||||
int max_trie_level;
|
||||
int total_nodes;
|
||||
int level_sz[MAX_LEVELS];
|
||||
|
||||
trie_node* root;
|
||||
heap* sorted_freqs;
|
||||
|
||||
int estimated_sz;
|
||||
encoding_unit** alphabet;
|
||||
unsigned int alphabet_sz;
|
||||
int estimated_sz;
|
||||
|
||||
protected:
|
||||
void collect_freqs(trie_node* rt, int level);
|
||||
|
||||
@@ -73,6 +73,7 @@ void zip::compress(const buffer& uncompressed, buffer& compressed)
|
||||
out.close();
|
||||
|
||||
ret = system(form("gzip -c %s > %s", (char*)UNCOMPRESSED,(char*)COMPRESSED));
|
||||
if(ret != 0) throw(systemException(ret));
|
||||
|
||||
fstream in(COMPRESSED, ios::in);
|
||||
|
||||
@@ -107,6 +108,7 @@ void zip::decompress(buffer& compressed, buffer& uncompressed)
|
||||
out.close();
|
||||
|
||||
ret = system(form("gzip -cd %s > %s",(char*)COMPRESSED,(char*)UNCOMPRESSED));
|
||||
if(ret != 0) throw(systemException(ret));
|
||||
|
||||
fstream in(UNCOMPRESSED, ios::in);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user