/*TITLE decoding main module */ /****keyword-flag*** "%v %f %n" */ /* "9 12-May-92,18:01:12 DECODE1.C" */ #include #include #include "model.h" FILE *infile; FILE *outfile; main(int argc, char *argv[]) { unsigned oldch; unsigned ch; unsigned symbol; if (argc < 3) { printf("Usage: decode compressed original.\n"); exit(1); } infile = fopen(argv[1],"rb"); outfile = fopen(argv[2],"wb"); setvbuf(infile,NULL,_IOFBF,8000); setvbuf(outfile,NULL,_IOFBF,8000); start_model(); start_inputing_bits(); start_decoding(); oldch = 0; for (;;) { symbol = decode_symbol(oldch); if (symbol == EOF_SYMBOL) break; ch = symbol_translation[symbol]; fputc(ch,outfile); update_model(symbol,oldch); oldch = ch; } return(0); }