X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tools%2Fif-2.cpp;h=dfea498540fc2f028aa11b05ce2ed8d00babe943;hb=e483a54b157b3e866be1f4fd798a4f73f53ed1e1;hp=525330ea568fcf0813da766d724ba2ad412a21b4;hpb=1fd4f7cc977b9f1499716de10d15656bd50f4816;p=ctsim.git diff --git a/tools/if-2.cpp b/tools/if-2.cpp index 525330e..dfea498 100644 --- a/tools/if-2.cpp +++ b/tools/if-2.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: if-2.cpp,v 1.1 2000/07/13 07:01:35 kevin Exp $ +** $Id: if-2.cpp,v 1.5 2000/08/03 09:57:29 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -45,6 +45,8 @@ static struct option my_options[] = {0, 0, 0, 0} }; +static const char* g_szIdStr = "$Id: if-2.cpp,v 1.5 2000/08/03 09:57:29 kevin Exp $"; + void if2_usage (const char *program) { @@ -79,7 +81,7 @@ if2_main (int argc, char *const argv[]) int opt_sub = 0; int opt_mul = 0; int opt_comp = 0; - int opt_outputFile = 0; + bool opt_outputFile = false; int opt_rowPlot = -1; int opt_columnPlot = -1; Timer timerProgram; @@ -94,26 +96,28 @@ if2_main (int argc, char *const argv[]) switch (c) { case O_ADD: opt_add = 1; - opt_outputFile = 1; + opt_outputFile = true; break; case O_SUB : opt_sub = 1; - opt_outputFile = 1; + opt_outputFile = true; break; case O_MUL: opt_mul = 1; - opt_outputFile = 1; + opt_outputFile = true; break; case O_ROW_PLOT: opt_rowPlot = strtol(optarg, &endptr, 10); if (endptr != optarg + strlen(optarg)) { if2_usage(argv[0]); } + break; case O_COLUMN_PLOT: opt_columnPlot = strtol(optarg, &endptr, 10); if (endptr != optarg + strlen(optarg)) { if2_usage(argv[0]); } + break; case O_COMP: opt_comp = 1; break; @@ -122,7 +126,7 @@ if2_main (int argc, char *const argv[]) break; case O_VERSION: #ifdef VERSION - cout << "Version " << VERSION << endl; + cout << "Version " << VERSION << endl << g_szIdStr << endl; #else cout << "Unknown version number" << endl; #endif @@ -228,22 +232,21 @@ if2_main (int argc, char *const argv[]) for (int i = 0; i < nx; i++) plot_xaxis[i] = i; #if HAVE_SGP -#if 0 -#else - ezset ("clear."); - ezset ("xticks major 5."); - ezset ("xlabel Column"); - ezset ("ylabel Pixel"); - ezset ("curves 2"); - ezset ("box."); - ezset ("grid."); - ezplot (v1[opt_columnPlot], plot_xaxis, im_in1.ny()); - ezplot (v2[opt_columnPlot], plot_xaxis, im_in2.ny()); -#endif - char str[256]; + SGPDriver driver ("Column Plot"); + SGP sgp (driver); + EZPlot ezplot (sgp); + ezplot.ezset ("clear."); + ezplot.ezset ("xticks major 5."); + ezplot.ezset ("xlabel Column"); + ezplot.ezset ("title Column Plot"); + ezplot.ezset ("ylabel Pixel"); + ezplot.ezset ("box."); + ezplot.ezset ("grid."); + ezplot.addCurve (plot_xaxis, v1[opt_columnPlot], im_in1.ny()); + ezplot.addCurve (plot_xaxis, v2[opt_columnPlot], im_in2.ny()); + ezplot.plot(); cout << "Press enter to continue" << flush; - fgets(str, sizeof(str), stdin); - sgp2_close (sgp2_get_active_win()); + cio_kb_getc(); #endif } @@ -258,27 +261,26 @@ if2_main (int argc, char *const argv[]) for (int i = 0; i < ny; i++) plot_xaxis[i] = i; for (int i = 0; i < nx; i++) - v1Row[i] = v1[opt_rowPlot][i]; + v1Row[i] = v1[i][opt_rowPlot]; for (int i = 0; i < nx2; i++) - v2Row[i] = v2[opt_rowPlot][i]; + v2Row[i] = v2[i][opt_rowPlot]; #if HAVE_SGP -#if 0 -#else - ezset ("clear."); - ezset ("xticks major 5."); - ezset ("xlabel Column"); - ezset ("ylabel Pixel"); - ezset ("curves 2"); - ezset ("box."); - ezset ("grid."); - ezplot (v1Row, plot_xaxis, im_in1.nx()); - ezplot (v2Row, plot_xaxis, im_in2.nx()); -#endif - char str[256]; + SGPDriver driver ("Row Plot"); + SGP sgp (driver); + EZPlot ezplot (sgp); + ezplot.ezset ("clear."); + ezplot.ezset ("xticks major 5."); + ezplot.ezset ("title Row Plot"); + ezplot.ezset ("xlabel Row"); + ezplot.ezset ("ylabel Pixel"); + ezplot.ezset ("box."); + ezplot.ezset ("grid."); + ezplot.addCurve (plot_xaxis, v1Row, im_in1.nx()); + ezplot.addCurve (plot_xaxis, v2Row, im_in2.nx()); + ezplot.plot(); cout << "Press enter to continue" << flush; - fgets(str, sizeof(str), stdin); - sgp2_close (sgp2_get_active_win()); + cio_kb_getc(); #endif }