// // Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu> // Creation Date: Sat May 23 21:08:48 PDT 1998 // Last Modified: Mon Dec 4 13:29:26 PST 2000 (new Humdrum Record defines) // Filename: ...museinfo/examples/all/hparser.cpp // Web Address: http://sig.sapp.org/examples/museinfo/humdrum/hparser.cpp // Syntax: C++; museinfo // // Description: Basic Humdrum Parser. // #include "humdrum.h" int main(int argc, char** argv) { if (argc != 2) { cout << "Usage: " << argv[0] << " input-kern-file" << endl; exit(1); } HumdrumFile input(argv[1]); for (int i=0; i<input.getNumLines(); i++) { switch (input[i].getType()) { case E_humrec_none: cout << "Line = blank" << endl; break; case E_humrec_empty: cout << "Line = empty" << endl; break; case E_humrec_global_comment: cout << "Line = global comment" << endl; break; case E_humrec_bibliography: cout << "Line = bibliographic record" << endl; break; case E_humrec_data_comment: cout << "Line = local comment" << endl; break; case E_humrec_data_kern_measure: cout << "Line = measure" << endl; break; case E_humrec_interpretation: cout << "Line = Interpretation" << endl; break; case E_humrec_data: cout << "Line = DATA" << endl; break; default: cout << "Line = UNKNOWN" << endl; break; } } return 0; } // md5sum: 9e65b45e2ef5858d82198778c1e8ea58 hparser.cpp [20050403]