//
// Programmer:    Craig Stuart Sapp <craig@ccrma.stanford.edu>
// Creation Date: Mon Feb 25 21:15:21 PST 2002
// Last Modified: Mon Feb 25 21:15:24 PST 2002
// Filename:      ...sig/examples/all/staffinfo.cpp
// Web Address:   http://sig.sapp.org/examples/museinfo/score/staffinfo.cpp
// Syntax:        C++; museinfo
//
// Description:   Display staff information for a SCORE page file.
//

#include "ScorePage.h"
#include "Options.h"

#include <string.h>
#include <stdlib.h>


// function declarations:
void printSystemInfo(ScorePage& page);


// interface variables:
Options options;
int     verboseQ = 0;             // used with the -v option
const char* outputfilename = "";  // used with the -o option


//////////////////////////////////////////////////////////////////////////

int main(int argc, char** argv) {
   options.define("v|verbose=b", "display debugging information in output");
   options.process(argc, argv);
   verboseQ = options.getBoolean("verbose");

   if (options.getArgCount() == 0) {
      cout << "Usage: " << argv[0] << " input.mus " << endl;
      exit(1);
   }

   ScorePage scorepage;
   for (int i=1; i<=options.getArgCount(); i++) {
      scorepage.readFile(options.getArg(i), verboseQ);
      printSystemInfo(scorepage);
   }

   return 0;
}


//////////////////////////////////////////////////////////////////////////

///////////////////////////////
//
// printSystemInfo --
//

void printSystemInfo(ScorePage& page) {
   page.analyzeSystems();
   cout << "Number of staves     : " << page.getStaffCount()  << "\n";
   cout << "Maximum staff number : " << page.getMaxStaff()    << "\n";
   cout << "Number of systems    : " << page.getSystemCount() << "\n";
   cout << "Staff Information: " << endl;
   for (int i=page.getMaxStaff(); i>0; i--) {
      cout << "\tStaff: "   << i << "\tsystem: " << page.getSystem(i)
           << "\ttrack: "   << page.getTrack(i) 
           << " \tmaxbar: " << page.getMaxBarlineLength(i) 
           << endl;
   }
}




// md5sum: 92cf73f8d312ed41ec9f214e2004fec4 staffinfo.cpp [20050403]