Skip to content

Commit

Permalink
Merge pull request #90 from WolfgangDrescher/myank
Browse files Browse the repository at this point in the history
[myank] Keep *part and *staff interpretations
  • Loading branch information
craigsapp authored Dec 19, 2023
2 parents 53be6a9 + 2e6cfd2 commit a9992f5
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 6 deletions.
56 changes: 53 additions & 3 deletions min/humlib.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Programmer: Craig Stuart Sapp <[email protected]>
// Creation Date: Sat Aug 8 12:24:49 PDT 2015
// Last Modified: Tue Dec 12 11:01:04 PST 2023
// Last Modified: Di 19 Dez 2023 10:33:13 CET
// Filename: min/humlib.cpp
// URL: https://github.com/craigsapp/humlib/blob/master/min/humlib.cpp
// Syntax: C++11
Expand Down Expand Up @@ -105903,12 +105903,62 @@ void Tool_myank::printStarting(HumdrumFile& infile) {
if (!m_hideStarting) {
m_humdrum_text << infile[i] << "\n";
} else {
if (infile[i].rfind("!!!RDF", 0) == 0) {
if (infile[i].rfind("!!!RDF", 0) == 0 || infile[i].rfind("!!!system-decoration", 0) == 0) {
m_humdrum_text << infile[i] << "\n";
}
}
}

// keep *part interpretations
bool hasPart = false;
for (i=exi+1; i<infile.getLineCount(); i++) {
hasPart = false;
for (j=0; j<infile[i].getFieldCount(); j++) {
if (infile.token(i, j)->compare(0, 5, "*part") == 0) {
hasPart = true;
break;
}
}
if (hasPart) {
for (j=0; j<infile[i].getFieldCount(); j++) {
if (infile.token(i, j)->compare(0, 5, "*part") == 0) {
m_humdrum_text << infile.token(i, j);
} else {
m_humdrum_text << "*";
}
if (j < infile[i].getFieldCount() - 1) {
m_humdrum_text << "\t";
}
}
m_humdrum_text << "\n";
}
}

// keep *staff interpretations
bool hasStaff = false;
for (i=exi+1; i<infile.getLineCount(); i++) {
hasStaff = false;
for (j=0; j<infile[i].getFieldCount(); j++) {
if (infile.token(i, j)->compare(0, 6, "*staff") == 0) {
hasStaff = true;
break;
}
}
if (hasStaff) {
for (j=0; j<infile[i].getFieldCount(); j++) {
if (infile.token(i, j)->compare(0, 6, "*staff") == 0) {
m_humdrum_text << infile.token(i, j);
} else {
m_humdrum_text << "*";
}
if (j < infile[i].getFieldCount() - 1) {
m_humdrum_text << "\t";
}
}
m_humdrum_text << "\n";
}
}

int hasI = 0;

if (m_instrumentQ) {
Expand Down Expand Up @@ -105999,7 +106049,7 @@ void Tool_myank::printEnding(HumdrumFile& infile, int lastline, int adjlin) {
if (startline >= 0) {
for (i=startline; i<infile.getLineCount(); i++) {
if (m_hideEnding && (i > ending)) {
if (infile[i].rfind("!!!RDF", 0) == 0) {
if (infile[i].rfind("!!!RDF", 0) == 0 || infile[i].rfind("!!!system-decoration", 0) == 0) {
m_humdrum_text << infile[i] << "\n";
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion min/humlib.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Programmer: Craig Stuart Sapp <[email protected]>
// Creation Date: Sat Aug 8 12:24:49 PDT 2015
// Last Modified: Tue Dec 12 11:01:04 PST 2023
// Last Modified: Di 19 Dez 2023 10:33:13 CET
// Filename: min/humlib.h
// URL: https://github.com/craigsapp/humlib/blob/master/min/humlib.h
// Syntax: C++11
Expand Down
54 changes: 52 additions & 2 deletions src/tool-myank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1712,12 +1712,62 @@ void Tool_myank::printStarting(HumdrumFile& infile) {
if (!m_hideStarting) {
m_humdrum_text << infile[i] << "\n";
} else {
if (infile[i].rfind("!!!RDF", 0) == 0) {
if (infile[i].rfind("!!!RDF", 0) == 0 || infile[i].rfind("!!!system-decoration", 0) == 0) {
m_humdrum_text << infile[i] << "\n";
}
}
}

// keep *part interpretations
bool hasPart = false;
for (i=exi+1; i<infile.getLineCount(); i++) {
hasPart = false;
for (j=0; j<infile[i].getFieldCount(); j++) {
if (infile.token(i, j)->compare(0, 5, "*part") == 0) {
hasPart = true;
break;
}
}
if (hasPart) {
for (j=0; j<infile[i].getFieldCount(); j++) {
if (infile.token(i, j)->compare(0, 5, "*part") == 0) {
m_humdrum_text << infile.token(i, j);
} else {
m_humdrum_text << "*";
}
if (j < infile[i].getFieldCount() - 1) {
m_humdrum_text << "\t";
}
}
m_humdrum_text << "\n";
}
}

// keep *staff interpretations
bool hasStaff = false;
for (i=exi+1; i<infile.getLineCount(); i++) {
hasStaff = false;
for (j=0; j<infile[i].getFieldCount(); j++) {
if (infile.token(i, j)->compare(0, 6, "*staff") == 0) {
hasStaff = true;
break;
}
}
if (hasStaff) {
for (j=0; j<infile[i].getFieldCount(); j++) {
if (infile.token(i, j)->compare(0, 6, "*staff") == 0) {
m_humdrum_text << infile.token(i, j);
} else {
m_humdrum_text << "*";
}
if (j < infile[i].getFieldCount() - 1) {
m_humdrum_text << "\t";
}
}
m_humdrum_text << "\n";
}
}

int hasI = 0;

if (m_instrumentQ) {
Expand Down Expand Up @@ -1808,7 +1858,7 @@ void Tool_myank::printEnding(HumdrumFile& infile, int lastline, int adjlin) {
if (startline >= 0) {
for (i=startline; i<infile.getLineCount(); i++) {
if (m_hideEnding && (i > ending)) {
if (infile[i].rfind("!!!RDF", 0) == 0) {
if (infile[i].rfind("!!!RDF", 0) == 0 || infile[i].rfind("!!!system-decoration", 0) == 0) {
m_humdrum_text << infile[i] << "\n";
}
} else {
Expand Down

0 comments on commit a9992f5

Please sign in to comment.