// // Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu> // Creation Date: Wed Oct 18 12:10:32 PDT 2000 // Last Modified: Wed Oct 18 12:10:35 PDT 2000 // Filename: ...sig/examples/all/eicheck.cpp // Web Address: http://sig.sapp.org/examples/museinfo/humdrum/eicheck.cpp // Syntax: C++; museinfo // // Description: Identifies exclusive interpretation spine memberships. // #include "humdrum.h" #ifndef OLDCPP #include <iostream> #else #include <iostream.h> #endif // function declarations void checkOptions(Options& opts, int argc, char* argv[]); void example(void); void printEIAnalysis(HumdrumFile& infile); void usage(const char* command); // global variables Options options; // database for command-line arguments /////////////////////////////////////////////////////////////////////////// int main(int argc, char* argv[]) { HumdrumFile infile; // process the command-line options checkOptions(options, argc, argv); // figure out the number of input files to process int numinputs = options.getArgCount(); for (int i=0; i<numinputs || i==0; i++) { infile.clear(); // if no command-line arguments read data file from standard input if (numinputs < 1) { infile.read(cin); } else { infile.read(options.getArg(i+1)); } printEIAnalysis(infile); } return 0; } /////////////////////////////////////////////////////////////////////////// ////////////////////////////// // // checkOptions -- validate and process command-line options. // void checkOptions(Options& opts, int argc, char* argv[]) { opts.define("debug=b"); // determine bad input line num opts.define("author=b"); // author of program opts.define("version=b"); // compilation info opts.define("example=b"); // example usages 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, October 2000" << endl; exit(0); } else if (opts.getBoolean("version")) { cout << argv[0] << ", version: 15 October 2000" << endl; cout << "compiled: " << __DATE__ << endl; cout << MUSEINFO_VERSION << 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 quality program // void example(void) { cout << " \n" "# example usage of the spinetrace program. \n" " spinetrace chor217.krn \n" " \n" << endl; } ////////////////////////////// // // printEIAnalysis -- // void printEIAnalysis(HumdrumFile& infile) { int linecount = infile.getNumLines(); int linecount2 = 0; int i; int j; for (i=0; i<linecount; i++) { if (infile[i].getType() != E_humrec_data) { cout << infile[i] << '\n'; } else { linecount2 = infile.getSpineCount(i); for (j=0; j<linecount2; j++) { cout << infile[i].getExInterp(j) + 2; if (j < linecount2 - 1) { cout << '\t'; } } cout << '\n'; } } } ////////////////////////////// // // usage -- gives the usage statement for the meter program // void usage(const char* command) { cout << " \n" "Displays the exclusive interpretation spine memberships. \n" " \n" "Usage: " << command << " [input1 [input2 ...]]\n" " \n" "Options: \n" " --options = list of all options, aliases and default values \n" " \n" << endl; } // md5sum: 2caf4af2acce5c25ad9e0fab6e2be37d eicheck.cpp [20050403]