I want to suggets some changes in this program.
It shouldd work as a client to the "server", a library, which provides routines to en/decode image/s.
Main CLI (Command Line Interface) would be a simple program that would only deal with reading/writing files and processing arguments and processing images would be done by library, (more or less as it is in nhw-encoder) preferably in memory, and cli-client would only call necessary routines.
Check BALZ source and crush, and libcrush to see what I mean.
First - command line interface: use input and output instaead of automatic naming.
$ nhw-dec <file.nhw> <file.bmp>
You don't know what user wants and don't want to be smarter than them. They know what they do.
decode_image() and parse_file to use string instead od argv**.
decode_image(): instead of decode_image(image_buffer *im,decode_state *os,char *file_name) it should rather go like this: decode_image(decode_state *os, image_buffer *im) and there would be write_image(decode_state *os, image_buffer *im, char* file_name)
Process image in memory, and share state/context structure beteen functions. Have designated functions to read/write from file to/from memory rather than doing hundreds of disk reads/writes (with fread/fwrite). For reference check crush and libcrush linked above.
I want to suggets some changes in this program.
It shouldd work as a client to the "server", a library, which provides routines to en/decode image/s.
Main CLI (Command Line Interface) would be a simple program that would only deal with reading/writing files and processing arguments and processing images would be done by library, (more or less as it is in nhw-encoder) preferably in memory, and cli-client would only call necessary routines.
Check BALZ source and crush, and libcrush to see what I mean.
First - command line interface: use input and output instaead of automatic naming.
You don't know what user wants and don't want to be smarter than them. They know what they do.
decode_image()andparse_fileto use string instead odargv**.decode_image(): instead ofdecode_image(image_buffer *im,decode_state *os,char *file_name)it should rather go like this:decode_image(decode_state *os, image_buffer *im)and there would bewrite_image(decode_state *os, image_buffer *im, char* file_name)Process image in memory, and share state/context structure beteen functions. Have designated functions to read/write from file to/from memory rather than doing hundreds of disk reads/writes (with fread/fwrite). For reference check crush and libcrush linked above.