//
// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
// Creation Date: Sat Oct 18 10:35:47 PDT 2003
// Last Modified: Sat Oct 18 10:35:51 PDT 2003
// Filename: ...sig/examples/all/plot2xfig.cpp
// Web Address: http://sig.sapp.org/examples/museinfo/humdrum/plot2xfig.cpp
// Syntax: C++; museinfo
//
// Description: Convert plot data into xfig format.
//
#include "PlotFigure.h"
#include "Options.h"
#include <string.h>
#include <math.h>
// function declarations
void checkOptions(Options& opts, int argc, char* argv[]);
void example(void);
void usage(const char* command);
// global variables
Options options; // database for command-line arguments
///////////////////////////////////////////////////////////////////////////
int main(int argc, char* argv[]) {
// process the command-line options
checkOptions(options, argc, argv);
PlotFigure plot;
plot.read(options.getArg(1));
plot.printXfig(cout);
return 0;
}
///////////////////////////////////////////////////////////////////////////
//////////////////////////////
//
// checkOptions -- validate and process command-line options.
//
void checkOptions(Options& opts, int argc, char* argv[]) {
opts.define("author=b", "author of the program");
opts.define("version=b", "compilation information");
opts.define("example=b", "example usage");
opts.define("h|help=b", "short description");
opts.process(argc, argv);
// handle basic options:
if (opts.getBoolean("author")) {
cout << "Written by Craig Stuart Sapp, "
<< "craig@ccrma.stanford.edu, Oct 2003" << endl;
exit(0);
} else if (opts.getBoolean("version")) {
cout << argv[0] << ", version: Oct 2003" << endl;
cout << "compiled: " << __DATE__ << endl;
exit(0);
} else if (opts.getBoolean("help")) {
usage(opts.getCommand());
exit(0);
} else if (opts.getBoolean("example")) {
example();
exit(0);
}
}
//////////////////////////////
//
// example -- example usage of the program
//
void example(void) {
cout <<
" \n"
<< endl;
}
//////////////////////////////
//
// usage -- gives the usage statement for the quality program
//
void usage(const char* command) {
cout <<
" \n"
<< endl;
}
// md5sum: d9776fc75d9c9ca96ca5f25a740ba8f7 plot2xfig.cpp [20050403]