String demangleAndSimplify(const String & mangled, int isDataMember, int entryType) { String buildingResult; const char *m = mangled; //int mlen = mangled.length(); String saveMangled = mangled; // dem may modify the string //const char *d = demangle_withlen(m, mlen); char buf[MAXDBUF]; char sbuf[MAXDBUF]; DEM dm; int putbackUnder = 0; if (*m == '_' && hasextra_(entryType) && !isDataMember) { putbackUnder = 1; } if( dem((char*)m, &dm, sbuf) < 0 || //Error dm.type == DEM_PTBL || dm.type == DEM_STI || dm.type == DEM_STD ) { buildingResult = saveMangled; beVerbose(saveMangled, saveMangled, entryType, isDataMember); return buildingResult; } dem_print( &dm, buf ); postProcess(isDataMember, saveMangled, buildingResult, buf); //postProcess may decide to use the mangled name even if the name is // demangleable, for instance, after-first instance of overloading // function name using -d option if( ( buildingResult != saveMangled ) && ( putbackUnder == 1 ) ) buildingResult = "_" + buildingResult; // convert the non C function name char in function name to a // C string if( prepareDebug ) translate( buildingResult ); beVerbose(saveMangled, buildingResult, entryType, isDataMember); return buildingResult; }
Static void musicParagraph(void) { struct LOC_musicParagraph V; voice_index0 j, nvoice; Char lyrassign[256]; Char STR1[256]; Char STR2[256]; Char STR3[256], STR4[256], STR5[256]; voice_index0 FORLIM; short FORLIM1; paragraphSetup(&nvoice); if (nvoice == 0) { nonMusic(); return; } if (nvoice > nvoices) { if (nvoice == 0) error("No voices! Did you remember to to supply a Style?", !print); sprintf(STR4, "Paragraph has %s voices but Style allows only %s", toString(STR1, nvoice), toString(STR2, nvoices)); error(STR4, !print); return; } if (first_paragraph) includeStartString(); if (pmx_preamble_done && (!final_paragraph || nvoice > 0)) { sprintf(STR5, "%c Paragraph %s line %s bar %s", comment, toString(STR1, paragraph_no), toString(STR2, orig_line_no[0]), toString(STR3, bar_no)); putLine(STR5); } testParagraph(); rememberDurations(); if (beVerbose()) describeParagraph(); /* ---- Knowing the score, we can start setting music ---------------- */ if (!pmx_preamble_done) { doPMXpreamble(); sprintf(STR3, "%c Paragraph %s line %s bar ", comment, toString(STR1, paragraph_no), toString(STR2, orig_line_no[0])); put(STR3, putspace); if (pickup > 0) putLine("0"); else putLine("1"); } putPMXlines(&V); if (must_restyle) restyle(); if (some_vocal && (nvoice > 0 || !final_paragraph)) { FORLIM = ninstr; for (j = 1; j <= FORLIM; j++) { assignLyrics(j, lyrassign); if (*lyrassign != '\0') { sprintf(STR2, "\\\\%s\\", lyrassign); putLine(STR2); } } } if (must_respace) respace(); if (meternum == 0) putMeter(meterChange(STR2, beatsPerLine(), meterdenom, true), &V); if (nleft > 0) nbars++; if (nbars == 0 && *multi_bar_rest != '\0') processMBR(&V); else { FORLIM1 = nbars; for (bar_of_line = 1; bar_of_line <= FORLIM1; bar_of_line++) processOneBar(&V); } restoreDurations(); }
void testParagraph(void) { voice_index0 voice; voice_index0 leader = 0, nv = 0; paragraph_index0 mus; short extra, l, nbar; voice_index0 FORLIM; Char STR2[256]; Char STR4[256]; nbars = 0; pickup = 0; nleft = 0; if (top > bottom) return; pickup = 0; *multi_bar_rest = '\0'; FORLIM = bottom; for (voice = top; voice <= FORLIM; voice++) { mus = musicLineNo(voice); if (mus > 0) { /** -------------- Voice is present ---- */ nv++; line_no = orig_line_no[mus-1]; scanMusic(voice, &l); if (*multi_bar_rest != '\0' && nv > 1) error("Multi-bar rest allows only one voice", print); if (!pmx_preamble_done) { if (voice == top) pickup = l; else if (pickup != l) error3(voice, "The same pickup must appear in all voices"); } nbar = numberOfBars(voice); extra = ExtraLength(voice); if (*multi_bar_rest != '\0' && (nbar > 0 || extra > 0)) error3(voice, "Multi-bar rest allows no other rests or notes"); if (nbar > nbars || nbar == nbars && extra > nleft) { nbars = nbar; nleft = extra; leader = voice; } if (!final_paragraph && meternum > 0 && extra > 0) { printf("Line has %s\n", describe(STR2, nbar, extra)); error(" Line does not end at complete bar", print); } if (pmx_preamble_done && l > 0 && meternum > 0) { printf("l=%d meternum=%d\n", l, meternum); error3(voice, "Short bar with no meter change"); } } } if (!pmx_preamble_done) { xmtrnum0 = (double)pickup / one_beat; /* Don't want an integer result */ if (beVerbose()) printf("Pickup = %d/64\n", pickup); } if (leader <= 0) return; FORLIM = bottom; for (voice = top; voice <= FORLIM; voice++) { if (musicLineNo(voice) > 0) { if (voice != leader) { mus = musicLineNo(voice); line_no = orig_line_no[mus-1]; if (numberOfBars(voice) != numberOfBars(leader) || ExtraLength(voice) != ExtraLength(leader)) { printf("Following line has %s\n", describe(STR4, numberOfBars(voice), ExtraLength(voice))); puts(musicLine(STR4, voice)); printf("Longest line has %s\n", describe(STR2, numberOfBars(leader), ExtraLength(leader))); puts(musicLine(STR2, leader)); error("Line duration anomaly", print); } } } } }