big refactoring step 1, expect more bugs

This commit is contained in:
tth
2021-03-09 11:55:48 +01:00
parent 7ada60d113
commit b9d963dfa2
14 changed files with 179 additions and 100 deletions

View File

@@ -12,7 +12,7 @@
int verbosity;
/* ------------------------------------------------------------------------- */
/* --------------------------------------------------------------------- */
int export_as_machinable(FloatImg *src, char *fname, int steps, int flags)
{
FILE *fp;
@@ -44,7 +44,7 @@ for (y=0; y<src->height; y+=steps) {
return 0;
}
/* ------------------------------------------------------------------------- */
/* --------------------------------------------------------------------- */
static int normalize(FloatImg *pimg, float vmax)
{
float mmv[6], maxi, coef;
@@ -79,7 +79,7 @@ for (idx=0; idx<sz; idx++) {
return 0;
}
/* ------------------------------------------------------------------------- */
/* --------------------------------------------------------------------- */
int convertir_fimg_en_machinable(char *srcname, char *dstname,
int steps, float norm)
{
@@ -125,18 +125,18 @@ fimg_destroy(&fimg);
return 0;
}
/* ------------------------------------------------------------------------- */
/* --------------------------------------------------------------------- */
void help(int k)
{
puts("usage:\n\tfimg2text [options] foo.fimg > bar.csv");
puts("options:");
puts("\t-v\tincrease verbosity");
puts("\t-n 3.14\tnormalize picture");
puts("\t-s N\nsteps on x & y");
puts("\t-v\t\tincrease verbosity");
puts("\t-n 3.14\t\tnormalize picture");
puts("\t-s N\t\tsteps on x & y");
if (verbosity) fimg_print_version(1);
exit(0);
}
/* ------------------------------------------------------------------------- */
/* --------------------------------------------------------------------- */
int main(int argc, char *argv[])
{
@@ -154,7 +154,7 @@ while ((opt = getopt(argc, argv, "hn:s:v")) != -1) {
}
if (1 != argc-optind) {
fprintf(stderr, "error: %s need one filename\n", argv[0]);
fprintf(stderr, "error: %s need one intput filename\n", argv[0]);
exit(1);
}
@@ -165,5 +165,5 @@ if (foo) {
return 0;
}
/* ------------------------------------------------------------------------- */
/* --------------------------------------------------------------------- */