int doTickAnalysis(Array<int>& tickanalysis, HumdrumFile& infile) { int i; tickanalysis.setSize(infile.getNumLines()); Array<RationalNumber> pretick(tickanalysis.getSize()); int minrhy = infile.getMinTimeBase(); if (minrhy <= 0.0) { return 1; } RationalNumber value; int monitor = 0; for (i=0; i<infile.getNumLines()-1; i++) { value = ((infile[i+1].getAbsBeatR()-infile[i].getAbsBeatR())/4)*minrhy; pretick[i] = value; if (value.getDenominator() != 1) { monitor = 1; } } if (monitor == 0) { for (i=0; i<pretick.getSize(); i++) { tickanalysis[i] = pretick[i].getNumerator(); } return 1; } for (i=0; i<pretick.getSize(); i++) { // estimate a multiplication of 4 to remove fractional part. tickanalysis[i] = pretick[i].getNumerator() * 4; } return 4; }
void getBarlines(Array<int>& barlines, HumdrumFile& infile) { int i; int zero = 0; int foundstartdata = 0; int founddata = 0; barlines.setSize(infile.getNumLines()); barlines.setSize(0); for (i=0; i<infile.getNumLines(); i++) { if (infile[i].isMeasure()) { if ((barlines.getSize() == 0) && foundstartdata) { // pickup measure, so include start of file. barlines.append(zero); } barlines.append(i); founddata = 0; } else if (infile[i].isData()) { foundstartdata = 1; founddata = 1; } } if (founddata) { // data after last barline, so include last line of file int lastline = infile.getNumLines() - 1; barlines.append(lastline); } }
void fillIstnDatabase(Array<ISTN>& istndatabase, const char* istnfile) { HumdrumFile infile; infile.read(istnfile); int i, j; ISTN entry; istndatabase.setSize(infile.getNumLines()); istndatabase.setSize(0); for (i=0; i<infile.getNumLines(); i++) { if (infile[i].getType() != E_humrec_data) { continue; } entry.clear(); for (j=0; j<infile[i].getFieldCount(); j++) { if (strcmp(infile[i].getExInterp(j), "**theme") == 0) { entry.setFilename(infile[i][j]); } else if (strcmp(infile[i].getExInterp(j), "**istn") == 0) { entry.setIstn(infile[i][j]); } } if (entry.is_valid()) { istndatabase.append(entry); } } istndatabase.allowGrowth(0); }
void extractDurFeatures(HumdrumFile& infile, Array<int>& line, Array<RationalNumber>& data) { line.setSize(infile.getNumLines()); line.setSize(0); data.setSize(infile.getNumLines()); data.setSize(0); int lval; RationalNumber bval; int i; for (i=0; i<infile.getNumLines(); i++) { if (!infile[i].isData()) { continue; } bval = infile[i].getDurationR(); if (zeroQ) { bval = bval - 1; } lval = i; if (Attacks[i] < Attack) { // ignore lines which do not have enough note onsets, // adding duration of current line to last data line // which exceeds the onset threshold test. if (data.getSize() > 0) { data[data.getSize()-1] += bval; } continue; } line.append(lval); data.append(bval); } }
void analyzeTiming(HumdrumFile& infile, vector<double>& timings, vector<double>& tempo) { infile.analyzeRhythm(); timings.resize(infile.getNumLines()); fill(timings.begin(), timings.end(), 0.0); tempo.resize(infile.getNumLines()); fill(tempo.begin(), tempo.end(), dtempo); double currtempo = dtempo; double input = 0.0; int count; int i; for (i=1; i<infile.getNumLines(); i++) { // check for new tempo... if (strncmp(infile[i][0], "*MM", 3) == 0) { count = sscanf(infile[i][0], "*MM%lf", &input); if (count == 1) { currtempo = input; if (i > 0) { tempo[i-1] = currtempo; } tempo[i] = currtempo; } } tempo[i] = currtempo; timings[i] = timings[i-1] + (infile[i].getAbsBeat() - infile[i-1].getAbsBeat()) * 60.0/currtempo; } }
void getDataLineTimings(vector<int>& linetimes, HumdrumFile& infile) { vector<double> timings; vector<double> tempo; analyzeTiming(infile, timings, tempo); linetimes.resize(infile.getNumLines()); fill(linetimes.begin(), linetimes.end(), -5000); int offset = 0; for (int i=0; i<infile.getNumLines(); i++) { switch (infile[i].getType()) { case E_humrec_data: linetimes[i] = (int)((timings[i] + offset + 0.0005) * 1000); break; case E_humrec_global_comment: case E_humrec_bibliography: case E_humrec_none: case E_humrec_empty: case E_humrec_data_comment: case E_humrec_data_measure: case E_humrec_data_interpretation: default: break; } } }
void fillSourceData(Array<Array<char> >& sourcedata, Array<int>& datalines, HumdrumFile& infile, int spine, int nulltest) { sourcedata.setSize(infile.getNumLines()); sourcedata.setSize(0); datalines.setSize(infile.getNumLines()); datalines.setSize(0); int strsize; int i, j; int index; for (i=0; i<infile.getNumLines(); i++) { if (!infile[i].isData()) { continue; } for (j=0; j<infile[i].getFieldCount(); j++) { if (infile[i].getPrimaryTrack(j) != spine) { continue; } if (nulltest && (strcmp(infile[i][j], ".") == 0)) { break; } strsize = strlen(infile[i][j]); index = sourcedata.getSize(); sourcedata.setSize(index + 1); sourcedata[index].setSize(strsize + 1); strcpy(sourcedata[index].getBase(), infile[i][j]); datalines.append(i); break; } } sourcedata.allowGrowth(0); datalines.allowGrowth(0); }
void playdata(HumdrumFile& data, int& linenum, SigTimer& timer) { double duration = 0; // duration of the current line; if (data.getNumLines() == 0) { // ignore empty files. return; } int type = data[linenum].getType(); while (linenum < data.getNumLines() && duration == 0.0) { duration = data[linenum].getDuration(); if (type == E_humrec_data) { processNotes(data[linenum]); } else if (type == E_humrec_interpretation) { if (strncmp(data[linenum][0], "*MM", 3) == 0) { tempo = atoi(&data[linenum][0][3]); } } if (echoTextQ) { printInputLine(data, linenum); } if (duration > 0.0) { timer.setPeriod(60000 / tempo / tempoScale * duration); timer.reset(); } linenum++; if (linenum < data.getNumLines()) { type = data[linenum].getType(); } } }
void analyzeTiming(HumdrumFile& infile, Array<double>& timings, Array<double>& tempo) { infile.analyzeRhythm("4"); timings.setSize(infile.getNumLines()); timings.setAll(0.0); tempo.setSize(infile.getNumLines()); tempo.setAll(dtempo); tempo[0] = dtempo; double currtempo = dtempo; double input = 0.0; int count; int i; for (i=1; i<infile.getNumLines(); i++) { // check for new tempo... if (strncmp(infile[i][0], "*MM", 3) == 0) { count = sscanf(infile[i][0], "*MM%lf", &input); if (count == 1) { currtempo = input; if (i > 0) { tempo[i-1] = currtempo; } tempo[i] = currtempo; } } tempo[i] = currtempo; timings[i] = timings[i-1] + (infile[i].getAbsBeat() - infile[i-1].getAbsBeat()) * 60.0/currtempo; } }
void printMensuration(ostream& out, HumdrumFile& infile, int index) { int i; PerlRegularExpression pre; for (i=index; i<infile.getNumLines(); i++) { if (infile[i].isData()) { break; } if (!infile[i].isGlobalComment()) { continue; } if (pre.search(infile[i][0], "^!!primary-mensuration:\\s*met\\(([^)]+)\\)")) { out << ", \"mensuration\":\"" << pre.getSubmatch(1) << "\""; return; } } for (i=index; i<infile.getNumLines(); i++) { if (infile[i].isData()) { break; } if (!infile[i].isInterpretation()) { continue; } if (pre.search(infile[i][0], "^\\*met\\(([^)]+)\\)")) { out << ", \"mensuration\":\"" << pre.getSubmatch(1) << "\""; return; } } for (i=index-1; i>=0; i--) { if (infile[i].isData()) { break; } if (!infile[i].isGlobalComment()) { continue; } if (pre.search(infile[i][0], "^!!primary-mensuration:\\s*met\\(([^)]+)\\)")) { out << ", \"mensuration\":\"" << pre.getSubmatch(1) << "\""; return; } } for (i=index-1; i>=0; i--) { if (infile[i].isData()) { break; } if (!infile[i].isInterpretation()) { continue; } if (pre.search(infile[i][0], "^\\*met\\(([^)]+)\\)")) { out << ", \"mensuration\":\"" << pre.getSubmatch(1) << "\""; return; } } }
void getPitchesAndTies(HumdrumFile& infile, vector<int>& lines, vector<int>& pitches, vector<int>& tiestates, int index, vector<int>& localindex) { int pitch; int tiestate; lines.reserve(infile.getNumLines()); lines.resize(0); pitches.reserve(infile.getNumLines()); pitches.resize(0); tiestates.reserve(infile.getNumLines()); tiestates.resize(0); localindex.reserve(infile.getNumLines()); localindex.resize(0); int pindex = index; // the primary index for (int i=0; i<infile.getNumLines(); i++) { if (infile[i].getType() != E_humrec_data) { continue; } // find the local index index = pindex; for (int j=0; j<infile[i].getFieldCount(); j++) { if (infile[i].getPrimaryTrack(j) == pindex + 1) { index = j; break; } } if (strcmp(infile[i][index], ".") == 0) { // ignore null tokens. continue; } if (strchr(infile[i][index], 'r') != NULL) { // ignore rests continue; } pitch = Convert::kernToBase40(infile[i][index]); if (strchr(infile[i][index], '[') != NULL) { tiestate = TIESTART; } else if (strchr(infile[i][index], '_') != NULL) { tiestate = TIECONT; } else if (strchr(infile[i][index], ']') != NULL) { tiestate = TIESTOP; } else { tiestate = TIENONE; } lines.push_back(i); pitches.push_back(pitch); tiestates.push_back(tiestate); localindex.push_back(index); } }
void fillMeasureInfo(HumdrumFile& infile, Array<double>& measures) { int i; measures.setSize(infile.getNumLines()); measures.allowGrowth(0); measures.setAll(0.0); double current = 0.0; for (i=0; i<infile.getNumLines(); i++) { if (infile[i].isMeasure()) { sscanf(infile[i][0], "=%lf", ¤t); } measures[i] = current; } }
void createTable(ostream& out, HumdrumFile& infile) { out << "<table " << C0C0 << ">\n"; int i; for (i=0; i<infile.getNumLines(); i++) { if (infile[i].isGlobalComment()) { printGlobalComment(out, infile, i); continue; } if (infile[i].isBibliographic()) { printReferenceRecord(out, infile, i); continue; } if (infile[i].isData()) { printFields(out, infile, i); } if (infile[i].isMeasure()) { printFields(out, infile, i); } if (infile[i].isInterpretation()) { printFields(out, infile, i); } } out << "</table>\n"; if (textareaQ) { out << "<textarea wrap=off rows=10 cols=70>"; out << infile; out << "</textarea>\n"; } }
void printInputLine(HumdrumFile& infile, int line) { if ((line < 0) || (line >= infile.getNumLines())) { return; } HumdrumRecord& record = infile[line]; if (record.isMeasure()) { colormessage(cout, COLOR_BARLINE, colormode, colorQ); tabPrintLine(cout, record, tabsize, COLOR_BARLINE); colormessage(cout, COLOR_INIT, colormode, colorQ); cout << endl; } else if (record.isTandem()) { colormessage(cout, COLOR_TANDEM, colormode, colorQ); tabPrintLine(cout, record, tabsize, COLOR_TANDEM); colormessage(cout, COLOR_INIT, colormode, colorQ); cout << endl; } else if (record.isInterpretation()) { colormessage(cout, COLOR_INTERPRETATION, colormode, colorQ); tabPrintLine(cout, record, tabsize, COLOR_INTERPRETATION); colormessage(cout, COLOR_INIT, colormode, colorQ); cout << endl; } else { int printline = 1; if (noteonlyQ) { printline = !hasLayout(record); } if (printline) { tabPrintLine(cout, record, tabsize); cout << endl; } } }
void getAlternateFactor(HumdrumFile& infile, RationalNumber& factor) { PerlRegularExpression pre; int i; int top; int bot; RationalNumber value; RationalNumber orig(1,1); getOriginalFactor(infile, orig); for (i=0; i<infile.getNumLines(); i++) { if (!infile[i].isBibliographic()) { continue; } if (!pre.search(infile[i][0], "^!!!rscale-alt\\s*:\\s*(\\d+)(/?)(\\d*)", "")) { continue; } top = atoi(pre.getSubmatch(1)); bot = 1; if (strlen(pre.getSubmatch(2)) != 0) { if (strlen(pre.getSubmatch(3)) != 0) { bot = atoi(pre.getSubmatch()); } } if (top == 0) { top = 1; } if (bot == 0) { bot = 1; } value.setValue(top, bot); factor = value * orig; return; } }
void printExclusiveInterpLine(int linenum, HumdrumFile& infile) { int dataline = -1; int i; for (i=0; i<data.getNumLines(); i++) { if (infile[i].hasSpines()) { dataline = i; break; } } if (dataline < 0) { return; } stringstream tempstream; for (i=0; i<infile[dataline].getFieldCount(); i++) { tempstream << infile[dataline].getExInterp(i); if (i < infile[dataline].getFieldCount()-1) { tempstream << "\t"; } } tempstream << "\n"; for (i=0; i<infile[dataline].getFieldCount(); i++) { tempstream << "*-"; if (i < infile[dataline].getFieldCount()-1) { tempstream << "\t"; } } tempstream << ends; HumdrumFile dummyfile; dummyfile.read(tempstream); printInputLine(dummyfile, 0); }
void readWeights(const char* filename) { int i; int j; int key; double value; HumdrumFile wfile; wfile.read(filename); for (i=0; i<wfile.getNumLines(); i++) { if (wfile[i].getType() != E_humrec_data) { continue; } key = -1; value = -1000000.0; for (j=0; j<wfile[i].getFieldCount(); j++) { if (strcmp(wfile[i].getExInterp(j), "**kern") == 0) { key = Convert::kernToMidiNoteNumber(wfile[i][j]) % 12; if (std::islower(wfile[i][j][0])) { key += 12; } } else if (strcmp(wfile[i].getExInterp(j), "**weight") == 0) { sscanf(wfile[i][j], "%lf", &value); } } if ((key >= 0) && (key < 24) && (value != -1000000.0)) { if (key < 12) { majorKeyUser[key] = value; } else { minorKeyUser[key-12] = value; } } } }
void extractPitchSequence(Array<int>& pitches, HumdrumFile& hfile, int track) { pitches.setSize(10000); pitches.setGrowth(10000); pitches.setSize(0); pitches.allowGrowth(); int pitch = 0; int i, j; for (i=0; i<hfile.getNumLines(); i++) { switch (hfile[i].getType()) { case E_humrec_none: case E_humrec_empty: case E_humrec_bibliography: case E_humrec_global_comment: case E_humrec_data_comment: case E_humrec_interpretation: case E_humrec_data_kern_measure: break; case E_humrec_data: for (j=0; j<hfile[i].getFieldCount(); j++) { if (hfile[i].getPrimaryTrack(j) != track) { continue; } if (strcmp(hfile[i][j], ".") == 0) { // ignore null tokens break; } if (strchr(hfile[i][j], '_') != NULL) { // ignore continuing ties break; } if (strchr(hfile[i][j], ']') != NULL) { // ignore ending ties break; } if (strchr(hfile[i][j], 'r') != NULL) { // ignore rests break; } pitch = Convert::kernToBase40(hfile[i][j]); if ((pitch < 0) || (pitch > 10000)) { // ignore rests and other strange things break; } pitches.append(pitch); if (limitQ) { if (pitches.getSize() >= limit) { return; } } break; } break; default: break; } } }
int main(int argc, char** argv) { if (argc > 2) { cout << "Usage: " << argv[0] << " input-file" << endl; exit(1); } HumdrumFile hfile; if (argc == 2) { hfile.read(argv[1]); } else if (argc == 1) { hfile.read(cin); } hfile.analyzeRhythm("4", DEBUG); int measure = 0; cout << "absbeat\tdur\tbeat\tmeasure\t::\tdata\n"; cout << ":::::::::::::::::::::::::::::::::::::::::::::::::::::\n"; for (int i=0; i<hfile.getNumLines(); i++) { if (hfile[i].isMeasure()) { sscanf(hfile[i][0], "=%d", &measure); } cout << hfile.getAbsBeat(i) << '\t' << hfile.getDuration(i) << '\t' << measure << '\t' << hfile.getBeat(i) << "\t::\t" << hfile.getLine(i) << endl; } return 0; }
int isValidFile(HumdrumFile& infile) { int actual; PerlRegularExpression pre; Array<int> ktracks; infile.getTracksByExInterp(ktracks, "**kern"); actual = ktracks.getSize(); int i; int target = -1; for (i=0; i<infile.getNumLines(); i++) { if (pre.search(infile[i][0], "!!+voices\\s*:\\s*(\\d+)")) { target = atoi(pre.getSubmatch(1)); break; } } if (target < 0) { // no !!voices: line, so presum valid return 1; } if (target == actual) { return 1; } else { return 0; } }
void printFileWithCorrections(ostream& out, HumdrumFile& infile, vector<int>& lines, vector<int>& tiecorrections, vector<int>& localindex) { int i; int lindex = 0; for (i=0; i<infile.getNumLines(); i++) { if (infile[i].getType() != E_humrec_data) { out << infile[i] << "\n"; continue; } if (lindex >= (int)lines.size()) { out << infile[i] << "\n"; continue; } if (lines[lindex] == i) { if (tiecorrections[lindex]) { // print a tie correction printTieCorrection(out, infile[i], tiecorrections[lindex], localindex[lindex]); } else { out << infile[i] << "\n"; } lindex++; } else { out << infile[i] << "\n"; } } }
int getIdTags(Array<Array<char> >& idtags, HumdrumFile& infile) { int i, j; idtags.setSize(infile.getMaxTracks()); for (i=0; i<idtags.getSize(); i++) { idtags[i].setSize(128); idtags[i][0] = '\0'; } int foundids = 0; char tag[128] = {0}; for (i=0; i<infile.getNumLines(); i++) { if (infile[i].getType() != E_humrec_data_comment) { continue; } for (j=0; j<infile[i].getFieldCount(); j++) { if (strncmp(infile[i][j], "!ID=", 4) == 0) { strcpy(tag, &(infile[i][j][4])); if (strlen(tag)) { foundids++; strcpy(idtags[infile[i].getPrimaryTrack(j)-1].getBase(), tag); } } } } return foundids; }
void getMaxLayers(vector<int>& maxlayer, vector<vector<int> >& voice, HumdrumFile& infile) { int track; maxlayer.resize(infile.getMaxTracks() + 1); std::fill(maxlayer.begin(), maxlayer.end(), 0); int i, j; for (i=0; i<infile.getNumLines(); i++) { if (!infile[i].isData()) { continue; } for (j=0; j<infile[i].getFieldCount(); j++) { if (!infile[i].isExInterp(j, "**kern")) { continue; } if (strcmp(infile[i][j], ".") == 0) { continue; } if (strchr(infile[i][j], 'r') != NULL) { continue; } track = infile[i].getPrimaryTrack(j); if (voice[i][j] + 1 > maxlayer[track]) { maxlayer[track] = voice[i][j] + 1; } } } }
void getMaxLayers(Array<int>& maxlayer, Array<Array<int> >& voice, HumdrumFile& infile) { int track; maxlayer.setSize(infile.getMaxTracks() + 1); maxlayer.setAll(0); int i, j; for (i=0; i<infile.getNumLines(); i++) { if (!infile[i].isData()) { continue; } for (j=0; j<infile[i].getFieldCount(); j++) { if (!infile[i].isExInterp(j, "**kern")) { continue; } if (strcmp(infile[i][j], ".") == 0) { continue; } if (strchr(infile[i][j], 'r') != NULL) { continue; } track = infile[i].getPrimaryTrack(j); if (voice[i][j] + 1 > maxlayer[track]) { maxlayer[track] = voice[i][j] + 1; } } } }
void printSectionLabel(ostream& out, HumdrumFile& infile, int line) { int i; char buffer[1024] = {0}; for (i=line; i<infile.getNumLines(); i++) { if (infile[i].isData()) { break; } if (!infile[i].isBibliographic()) { continue; } if (strcmp(infile[i].getBibKey(buffer, 1000), "OMD") == 0) { infile[i].getBibValue(buffer, 1000); out << ", \"sectionlabel\":\"" << buffer << "\""; return; } } for (i=line-1; i>=0; i--) { if (infile[i].isData()) { break; } if (!infile[i].isBibliographic()) { continue; } if (strcmp(infile[i].getBibKey(buffer, 1000), "OMD") == 0) { infile[i].getBibValue(buffer, 1000); out << ", \"sectionlabel\":\"" << buffer << "\""; return; } } }
void printKernOutput(HumdrumFile& infile) { int i, j; infile.analyzeRhythm("4"); infile.printNonemptySegmentLabel(cout); for (i=0; i<infile.getNumLines(); i++) { if (!infile[i].isData()) { cout << infile[i].getLine() << "\n"; continue; } for (j=0; j<infile[i].getFieldCount(); j++) { if (!infile[i].isExInterp(j, "**kern")) { if (strcmp(infile[i][j], ".") == 0) { if (parensQ) { cout << "("; } cout << infile.getDotValue(i, j); if (parensQ) { cout << ")"; } } else { cout << infile[i][j]; } } else { // this is **kern data, so create tied notes if note duration // is longer than the current line's duration printKernTokenLineDuration(infile, i, j); } if (j < infile[i].getFieldCount() - 1) { cout << "\t"; } } cout << "\n"; } }
void removeStems(ostream& out, HumdrumFile& infile) { int i, j; PerlRegularExpression pre; string buffer; buffer.resize(1024); for (i=0; i<infile.getNumLines(); i++) { if (!infile[i].isData()) { out << infile[i] << "\n"; continue; } for (j=0; j<infile[i].getFieldCount(); j++) { if (!infile[i].isExInterp(j, "**kern")) { out << infile[i][j]; if (j < infile[i].getFieldCount()-1) { out << "\t"; } continue; } buffer = infile[i][j]; if (removeallQ || overwriteallQ) { pre.sar(buffer, "[\\\\/]x(?!x)", "", "g"); pre.sar(buffer, "[\\\\/](?!x)", "", "g"); } else { pre.sar(buffer, "[\\\\/](?!x)", "", "g"); } out << buffer; if (j < infile[i].getFieldCount()-1) { out << "\t"; } } out << "\n"; } }
void printInitialStaff(ostream& out, HumdrumFile& infile, int spine, int& defaultClef) { int i, j; int track; for (i=0; i<infile.getNumLines(); i++) { if (infile[i].isData()) { break; } for (j=0; j<infile[i].getFieldCount(); j++ ) { track = infile[i].getPrimaryTrack(j); if (track != spine) { continue; } if (strncmp(infile[i][j], "*clef", 5) != 0) { // only checking the first subspine for clef information: break; } if (strcmp(infile[i][j], "*clefG2") == 0) { pline(out, LEVEL, ":staff :treble-staff"); defaultClef = CLEF_TREBLE; } else if (strcmp(infile[i][j], "*clefF4") == 0) { pline(out, LEVEL, ":staff :bass-staff"); defaultClef = CLEF_BASS; } else if (strcmp(infile[i][j], "*clefGv2") == 0) { pline(out, LEVEL, ":staff :tenor-staff"); // vocal-tenor clef? } else if (strcmp(infile[i][j], "*clefC3") == 0) { pline(out, LEVEL, ":staff :alto-staff"); } else if (strcmp(infile[i][j], "*clefX") == 0) { pline(out, LEVEL, ":staff :percussion-staff"); } // only checking the first subspine for clef information: break; } } }
void assignBasicStemDirections(vector<vector<int> >& stemdir, vector<vector<int> >& voice, vector<vector<vector<int> > >& notepos, HumdrumFile& infile) { int i, j; for (i=0; i<infile.getNumLines(); i++) { if (!infile[i].isData()) { continue; } for (j=0; j<infile[i].getFieldCount(); j++) { if (!infile[i].isExInterp(j, "**kern")) { continue; } if (strcmp(infile[i][j], ".") == 0) { continue; } if (strchr(infile[i][j], 'r') != NULL) { continue; } if (removeQ) { removeStem2(infile, i, j); } if (strchr(infile[i][j], '/') != NULL) { stemdir[i][j] = +1; } else if (strchr(infile[i][j], '\\') != NULL) { stemdir[i][j] = -1; } else { stemdir[i][j] = determineChordStem(voice, notepos, infile, i, j); } } } }
void printFileID(HumdrumFile& infile, int index, int count, Array<Array<char> >& primaryids) { Array<Array<char> > idtags; int idtagQ = getIdTags(idtags, infile); if (!idtagQ) { cout << "ERROR: no ID tags found in file: " << endl; cout << infile; exit(1); } int i; for (i=0; i<infile.getNumLines(); i++) { if (infile[i].isInterpretation()) { if ((strcmp(infile[i][0], "*-") == 0) && (index == count - 1)) { cout << infile[i] << "\n"; } else if ((strncmp(infile[i][0], "**", 2) == 0) && (index == 0)) { cout << infile[i] << "\n"; } else { if ((strcmp(infile[i][0], "*-") == 0) && (index != count - 1)) { // print nothing } else if ((strncmp(infile[i][0], "**", 2) == 0) && (index != 0)) { // print nothing } else { printLineID(infile, i, primaryids, idtags); // cout << infile[i] << "\n"; } } } else { printLineID(infile, i, primaryids, idtags); // cout << infile[i] << "\n"; } } }