main () { load_file (IN_FILE); code_file (); save_file (OUT_FILE); free_mem (); }
void decoder_force(const char * aName,std::string & aNew) { bool aOk = code_file(aName,false,&aNew); if (! aOk) { std::cout << "For name " << aName << "\n"; ELISE_ASSERT(false,"cannot decode"); } }
void coder_force(const char * aName) { bool aOk = code_file(aName,true); if (! aOk) { std::cout << "For name " << aName << "\n"; ELISE_ASSERT(false,"cannot code"); } }
int main(void){ FILE *in = fopen( "010_test.in", "r" ); FILE *stttc_file = fopen( "010_test.statistic", "w+" ); FILE *HT_file = fopen( "010_test.huffman-tree", "w+" ); FILE *HC_file = fopen( "010_test.huffman-code", "w+" ); FILE *out = fopen( "010_test.out", "w" ); int symbol_total = statistic( in, stttc_file ); HuffmanTree tree = generate_HT( stttc_file, symbol_total, HT_file ); HuffmanCode code = generate_HC( tree, symbol_total, HC_file ); code_file( in, code, out ); fclose( in ); fclose( stttc_file ); fclose( HT_file ); fclose( HC_file ); fclose( out ); free( tree ); free( code ); return 0; }
void act(const ElResParseDir & res) { if (res.is_dir()) return; code_file(res.name(),_coder); }