forked from tTh/FloatImg
cleanup
This commit is contained in:
parent
30de864c4d
commit
7cb660c8c7
42
funcs/t.c
42
funcs/t.c
|
@ -61,6 +61,16 @@ while (pcmd->name) {
|
|||
return -1;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
void list_tests(void)
|
||||
{
|
||||
Command *pcmd = commands;
|
||||
while (pcmd->name) {
|
||||
printf("%s\n", pcmd->name);
|
||||
pcmd++;
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
void help(int k)
|
||||
{
|
||||
Command *pcmd;
|
||||
|
@ -68,7 +78,9 @@ Command *pcmd;
|
|||
fprintf(stderr, "usage:\n\t./t [options] command [filename]\n");
|
||||
|
||||
fprintf(stderr, "options:\n");
|
||||
fprintf(stderr, "\t-o outfile\n");
|
||||
fprintf(stderr, "\t-k 1.414\tset float value\n");
|
||||
fprintf(stderr, "\t-l\t\tlist tests\n");
|
||||
fprintf(stderr, "\t-o \t\toutfile\n");
|
||||
|
||||
fprintf(stderr, "commands:\n");
|
||||
pcmd = commands;
|
||||
|
@ -94,10 +106,12 @@ outfile = "out.pnm";
|
|||
command = "none";
|
||||
filename = "in.fimg";
|
||||
|
||||
while ((opt = getopt(argc, argv, "hk:o:p:v")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "hk:lo:p:v")) != -1) {
|
||||
// fprintf(stderr, "opt = %c\n", opt);
|
||||
switch(opt) {
|
||||
case 'h': help(0); break;
|
||||
case 'k': global_fvalue = atof(optarg); break;
|
||||
case 'l': list_tests(); break;
|
||||
case 'o': outfile = optarg; break;
|
||||
case 'v': verbosity++; break;
|
||||
}
|
||||
|
@ -141,19 +155,21 @@ switch(opt) {
|
|||
foo = essai_mire(filename, 0);
|
||||
break;
|
||||
case Wfits:
|
||||
foo = essai_ecriture_fits(filename);
|
||||
foo = essai_ecriture_fits("out.fits");
|
||||
break;
|
||||
case Wpng:
|
||||
foo = essai_ecriture_png(filename);
|
||||
foo = essai_ecriture_png("out.png");
|
||||
break;
|
||||
case Wtiff:
|
||||
foo = essai_ecriture_tiff(filename);
|
||||
foo = essai_ecriture_tiff("out.tiff");
|
||||
break;
|
||||
case Histo:
|
||||
foo = essai_histogramme(filename, 98765);
|
||||
break;
|
||||
case Hsv:
|
||||
foo = fimg_essai_hsv(filename);
|
||||
// not ready for primtime
|
||||
// foo = fimg_essai_hsv(filename);
|
||||
foo = 0;
|
||||
break;
|
||||
case Classif:
|
||||
foo = essai_classif(filename, outfile, global_fvalue);
|
||||
|
@ -168,23 +184,29 @@ switch(opt) {
|
|||
foo = essai_displacement(filename, outfile);
|
||||
break;
|
||||
case ReadPNG:
|
||||
foo = essai_lecture_png(filename, outfile, 0);
|
||||
// not ready for primetime
|
||||
// foo = essai_lecture_png("in.png", outfile, 0);
|
||||
foo = 0;
|
||||
break;
|
||||
case Plasmas:
|
||||
foo = essai_plasma(filename, outfile, 1, global_fvalue);
|
||||
fprintf(stderr, "we are all plasmafields\n");
|
||||
break;
|
||||
case Rotate:
|
||||
fprintf(stderr, "rotate not implemented (%d)\n", rand());
|
||||
foo = 0;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s : bad command\n", command);
|
||||
fprintf(stderr, "'%s' is a bad command\n", command);
|
||||
exit(1);
|
||||
|
||||
}
|
||||
|
||||
if (foo) {
|
||||
fprintf(stderr, "Essai ====> %d\n", foo);
|
||||
fprintf(stderr, "******* Essai --> %d\n", foo);
|
||||
}
|
||||
|
||||
fprintf(stderr, "+++++ end of %s pid %d\n", command, getpid());
|
||||
fprintf(stderr, "++++++++++++ end of '%s' pid %d\n", command, getpid());
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
|
|
@ -231,7 +231,7 @@ if (foo) {
|
|||
return foo;
|
||||
}
|
||||
|
||||
return -7;
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* essai de fichiers FITS (astronomie) */
|
||||
|
@ -278,7 +278,7 @@ fprintf(stderr, "equalize compute --> %d\n", foo);
|
|||
|
||||
fimg_destroy(&src);
|
||||
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int essai_rotate(char *infile)
|
||||
|
@ -510,6 +510,7 @@ if (foo) {
|
|||
return -6;
|
||||
}
|
||||
|
||||
fimg_destroy(&fimg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -588,16 +589,26 @@ int foo;
|
|||
|
||||
fimg_create(&fimg, 640, 480, FIMG_TYPE_RGB);
|
||||
|
||||
foo = fimg_hdeg_a(&fimg, (double)3.141592654);
|
||||
#define V ((double)3.141592654)
|
||||
|
||||
foo = fimg_hdeg_a(&fimg, V);
|
||||
fprintf(stderr, "make h deg -> %d\n", foo);
|
||||
foo = fimg_save_as_pnm(&fimg, "hdeg.pnm", 0);
|
||||
fprintf(stderr, "%s: save as pnm -> %d\n", __func__, foo);
|
||||
|
||||
foo = fimg_vdeg_a(&fimg, (double)3.141592654);
|
||||
|
||||
foo = fimg_vdeg_a(&fimg, V);
|
||||
fprintf(stderr, "make h deg -> %d\n", foo);
|
||||
foo = fimg_save_as_pnm(&fimg, "vdeg.pnm", 0);
|
||||
foo = fimg_save_as_pnm(&fimg, "vdeg_a.pnm", 0);
|
||||
fprintf(stderr, "%s: save as pnm -> %d\n", __func__, foo);
|
||||
|
||||
foo = fimg_vdeg_a(&fimg, -V);
|
||||
fprintf(stderr, "make h deg -> %d\n", foo);
|
||||
foo = fimg_save_as_pnm(&fimg, "vdeg_b.pnm", 0);
|
||||
fprintf(stderr, "%s: save as pnm -> %d\n", __func__, foo);
|
||||
|
||||
#undef V
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
@ -636,12 +647,14 @@ fimg_draw_something(&fimg);
|
|||
|
||||
if (verbosity) {
|
||||
foo = fimg_save_as_pnm(&fimg, "quux.pnm", 0);
|
||||
fprintf(stderr, "%s: save as pnm -> %d\n", __func__, foo);
|
||||
fprintf(stderr, "%s: saved as pnm -> %d\n", __func__, foo);
|
||||
}
|
||||
|
||||
foo = fimg_save_as_png(&fimg, fname, 0);
|
||||
fprintf(stderr, "save as png -> %d\n", foo);
|
||||
|
||||
fimg_destroy(&fimg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
|
Loading…
Reference in New Issue