int main(int argc, char *argv[]) { char *target_filename; char *output_filename; FILE *input, *output; DICT *dict; EDICT *edict; if (argc != 3) { printf("usage: %s target_text_file output_file\n", argv[0]); exit(1); } target_filename = argv[1]; output_filename = argv[2]; input = fopen(target_filename, "r"); output = fopen(output_filename, "wb"); if (input == NULL || output == NULL) { puts("File open error at the beginning."); exit(1); } dict = RunRepair(input); edict = convertDict(dict); EncodeCFG(edict, output); DestructEDict(edict); fclose(input); fclose(output); exit(0); }
int main(int argc, char *argv[]) { char *target_filename; //char output_filename[1024]; char *output_filename; FILE *input, *output; DICT *dict; EDICT *edict; USEDCHARTABLE ut; if (argc != 3) { printf("Usage: %s <input filename> <output filename>\n" "Compresses <input filename> with repair and creates " "<output filename> compressed files\n\n", argv[0]); exit(1); } target_filename = argv[1]; input = fopen(target_filename, "r"); if (input == NULL) { puts("File open error at the beginning."); exit(1); } //strcpy(output_filename, target_filename); //strcat(output_filename, ".rp"); output_filename = argv[2]; output = fopen(output_filename, "wb"); if (output == NULL) { puts("File open error at the beginning."); exit(1); } chartable_init(&ut); dict = RunRepair(input, &ut); edict = convertDict(dict, &ut); EncodeCFG(edict, output, &ut); DestructEDict(edict); fclose(input); fclose(output); exit(0); }
int main(int argc, char *argv[]) { char *target_filename, *output_filename; char cfg_filename[] = "cfg.tmp"; FILE *input, *output, *cfg; EDICT *edict; // analize options if (argc != 3) { printf("usage: %s target_text_file output_enc_file\n", argv[0]); exit(1); } target_filename = argv[1]; output_filename = argv[2]; // Run the algorithm procedure input = fopen(target_filename, "r"); cfg = fopen(cfg_filename, "wb"); if (input == NULL || cfg == NULL) { puts("File open error at the beginning."); exit(1); } GrammarTrans_LCA(input, cfg); fclose(input); fclose(cfg); cfg = fopen(cfg_filename, "rb"); output = fopen(output_filename, "wb"); if (cfg == NULL || output == NULL) { puts("File open error."); exit(1); } edict = ReadCFG(cfg); remove(cfg_filename); EncodeCFG_Naive(edict, output); DestructEDict(edict); exit(0); }
int main(int argc, char *argv[]) { FILE *input, *output; EDICT *dict; if (argc != 3) { printf("usage: %s target_cfg_file output_enc_file\n", argv[0]); exit(1); } input = fopen(argv[1], "rb"); output = fopen(argv[2], "wb"); if (input == NULL || output == NULL) { printf("File open error.\n"); exit(1); } dict = ReadCFG(input); EncodeCFG(dict, output); DestructEDict(dict); fclose(input); fclose(output); exit(0); }