From 4d32ba27b971b39b253e1dcc15e6755adc60a4d8 Mon Sep 17 00:00:00 2001 From: jacques-menu Date: Wed, 18 Dec 2024 14:54:52 +0100 Subject: [PATCH] v0.9.72-alpha1-step-4 --- MusicFormatsVersionNumber.txt | 2 +- build/CMakeLists.txt | 2 +- include/MusicFormatsVersionDate.h | 2 +- include/MusicFormatsVersionNumber.h | 2 +- include/{mflibrary => mfutilities}/mfAssert.h | 0 include/{mflibrary => mfutilities}/mfBool.h | 0 .../{mflibrary => mfutilities}/mfConstants.h | 9 +- .../{mflibrary => mfutilities}/mfEnumAll.h | 0 .../{mflibrary => mfutilities}/mfExceptions.h | 0 .../mfIndentedTextOutput.h | 0 .../mfInitialization.h | 0 .../mfInputLinesRange.h | 0 .../mfLibraryComponent.h | 0 include/{mflibrary => mfutilities}/mfList.h | 0 .../mfMultiGenerationOah.h | 0 .../mfMusicformatsErrors.h | 0 include/{mflibrary => mfutilities}/mfOnOff.h | 0 .../mfOutputFileOah.h | 0 include/{mflibrary => mfutilities}/mfPair.h | 0 include/{mflibrary => mfutilities}/mfPasses.h | 0 .../mfPreprocessorSettings.h | 0 .../{mflibrary => mfutilities}/mfRational.h | 0 .../mfScoreNotations.h | 2 +- .../{mflibrary => mfutilities}/mfServices.h | 0 include/{mflibrary => mfutilities}/mfStack.h | 0 .../mfStringsHandling.h | 0 .../mfSystemInterface.h | 0 include/{mflibrary => mfutilities}/mfTest.h | 0 include/{mflibrary => mfutilities}/mfTiming.h | 0 .../{mflibrary => mfutilities}/mfTraceOah.h | 0 .../mfWrapperTypes.h | 2 +- .../mfTest.h => include/oah/oahConstants.h | 21 +- include/passes/mxsr2msr/mxsr2msrOah.h | 24 +- .../passes/mxsr2msr/mxsr2msrSkeletonBuilder.h | 14 + .../representations/msr/msrNotesDurations.h | 3 - include/representations/msr/msrOah.h | 4 +- src/MusicFormatsVersionNumber.h | 2 +- .../msdl2braille/msdl2brailleManPageOah.cpp | 2 +- .../msdl2guido/msdl2guidoManPageOah.cpp | 2 +- .../msdl2lilypond/msdl2lilypondManPageOah.cpp | 2 +- .../msdl2musicxml/msdl2musicxmlManPageOah.cpp | 2 +- .../msr2braille/msr2brailleManPageOah.cpp | 2 +- .../msr2guido/msr2guidoManPageOah.cpp | 2 +- .../msr2lilypond/msr2lilypondManPageOah.cpp | 2 +- .../msr2musicxml/msr2musicxmlManPageOah.cpp | 2 +- .../musicxml2brailleManPageOah.cpp | 2 +- .../musicxml2guidoManPageOah.cpp | 2 +- .../musicxml2lilypondManPageOah.cpp | 2 +- .../musicxml2musicxmlManPageOah.cpp | 2 +- src/mflibrary/mfAssert.cpp | 127 - src/mflibrary/mfAssert.h | 49 - src/mflibrary/mfBool.cpp | 228 - src/mflibrary/mfBool.h | 137 - src/mflibrary/mfConstants.cpp | 150 - src/mflibrary/mfConstants.h | 136 - src/mflibrary/mfEnumAll.h | 67 - src/mflibrary/mfExceptions.cpp | 66 - src/mflibrary/mfExceptions.h | 92 - src/mflibrary/mfIndentedTextOutput.cpp | 627 --- src/mflibrary/mfIndentedTextOutput.h | 355 -- src/mflibrary/mfInitialization.cpp | 63 - src/mflibrary/mfInitialization.h | 26 - src/mflibrary/mfInputLinesRange.cpp | 80 - src/mflibrary/mfInputLinesRange.h | 85 - src/mflibrary/mfLibraryComponent.cpp | 213 - src/mflibrary/mfLibraryComponent.h | 38 - src/mflibrary/mfList.cpp | 182 - src/mflibrary/mfList.h | 126 - src/mflibrary/mfMultiGenerationOah.cpp | 778 ---- src/mflibrary/mfMultiGenerationOah.h | 243 -- src/mflibrary/mfMusicformatsErrors.cpp | 48 - src/mflibrary/mfMusicformatsErrors.h | 40 - src/mflibrary/mfOnOff.cpp | 75 - src/mflibrary/mfOnOff.h | 44 - src/mflibrary/mfOutputFileOah.cpp | 293 -- src/mflibrary/mfOutputFileOah.h | 135 - src/mflibrary/mfPair.cpp | 175 - src/mflibrary/mfPair.h | 137 - src/mflibrary/mfPasses.cpp | 314 -- src/mflibrary/mfPasses.h | 141 - src/mflibrary/mfPreprocessorSettings.h | 78 - src/mflibrary/mfRational.cpp | 435 -- src/mflibrary/mfRational.h | 171 - src/mflibrary/mfScoreNotations.cpp | 48 - src/mflibrary/mfScoreNotations.h | 38 - src/mflibrary/mfServices.cpp | 1044 ----- src/mflibrary/mfServices.h | 347 -- src/mflibrary/mfStack.cpp | 175 - src/mflibrary/mfStack.h | 147 - src/mflibrary/mfStringsHandling.cpp | 2233 ---------- src/mflibrary/mfStringsHandling.h | 432 -- src/mflibrary/mfSystemInterface.cpp | 149 - src/mflibrary/mfSystemInterface.h | 63 - src/mflibrary/mfTiming.cpp | 457 -- src/mflibrary/mfTiming.h | 168 - src/mflibrary/mfTraceOah.cpp | 3806 ----------------- src/mflibrary/mfTraceOah.h | 1410 ------ src/mflibrary/mfWrapperTypes.cpp | 105 - src/mflibrary/mfWrapperTypes.h | 471 -- src/oah/oahAtomsCollection.cpp | 1 + src/oah/oahBasicTypes.cpp | 2 + .../mfTest.cpp => oah/oahConstants.h} | 29 +- src/oah/oahElements.cpp | 2 +- src/oah/oahHarmoniesExtraOah.cpp | 3 +- src/oah/oahOah.cpp | 4 +- src/passes/lpsr2lilypond/lpsr2lilypondOah.cpp | 4 +- src/passes/msr2lpsr/msr2lpsrOah.cpp | 5 +- src/passes/msr2msr/msr2msrOah.cpp | 2 +- src/passes/mxsr2msr/mxsr2msrOah.cpp | 64 +- src/passes/mxsr2msr/mxsr2msrOah.h | 24 +- .../mxsr2msr/mxsr2msrSkeletonBuilder.cpp | 566 +-- src/passes/mxsr2msr/mxsr2msrSkeletonBuilder.h | 14 + .../mxsr2msr/mxsr2msrSkeletonPopulator.cpp | 16 +- .../braille/brailleGenerationOah.cpp | 2 +- src/representations/bsr/bsrOah.cpp | 4 +- src/representations/lpsr/lpsrOah.cpp | 174 +- src/representations/msdl/msdlInputOah.cpp | 4 +- src/representations/msr/msrDoubleTremolos.cpp | 1 + .../msr/msrGenerationBasicTypes.cpp | 1 + src/representations/msr/msrMeasures.cpp | 1 + src/representations/msr/msrNotesDurations.cpp | 5 - src/representations/msr/msrNotesDurations.h | 3 - src/representations/msr/msrOah.cpp | 351 +- src/representations/msr/msrOah.h | 4 +- 124 files changed, 840 insertions(+), 17606 deletions(-) rename include/{mflibrary => mfutilities}/mfAssert.h (100%) rename include/{mflibrary => mfutilities}/mfBool.h (100%) rename include/{mflibrary => mfutilities}/mfConstants.h (91%) rename include/{mflibrary => mfutilities}/mfEnumAll.h (100%) rename include/{mflibrary => mfutilities}/mfExceptions.h (100%) rename include/{mflibrary => mfutilities}/mfIndentedTextOutput.h (100%) rename include/{mflibrary => mfutilities}/mfInitialization.h (100%) rename include/{mflibrary => mfutilities}/mfInputLinesRange.h (100%) rename include/{mflibrary => mfutilities}/mfLibraryComponent.h (100%) rename include/{mflibrary => mfutilities}/mfList.h (100%) rename include/{mflibrary => mfutilities}/mfMultiGenerationOah.h (100%) rename include/{mflibrary => mfutilities}/mfMusicformatsErrors.h (100%) rename include/{mflibrary => mfutilities}/mfOnOff.h (100%) rename include/{mflibrary => mfutilities}/mfOutputFileOah.h (100%) rename include/{mflibrary => mfutilities}/mfPair.h (100%) rename include/{mflibrary => mfutilities}/mfPasses.h (100%) rename include/{mflibrary => mfutilities}/mfPreprocessorSettings.h (100%) rename include/{mflibrary => mfutilities}/mfRational.h (100%) rename include/{mflibrary => mfutilities}/mfScoreNotations.h (94%) rename include/{mflibrary => mfutilities}/mfServices.h (100%) rename include/{mflibrary => mfutilities}/mfStack.h (100%) rename include/{mflibrary => mfutilities}/mfStringsHandling.h (100%) rename include/{mflibrary => mfutilities}/mfSystemInterface.h (100%) rename include/{mflibrary => mfutilities}/mfTest.h (100%) rename include/{mflibrary => mfutilities}/mfTiming.h (100%) rename include/{mflibrary => mfutilities}/mfTraceOah.h (100%) rename include/{mflibrary => mfutilities}/mfWrapperTypes.h (99%) rename src/mflibrary/mfTest.h => include/oah/oahConstants.h (59%) delete mode 100644 src/mflibrary/mfAssert.cpp delete mode 100644 src/mflibrary/mfAssert.h delete mode 100644 src/mflibrary/mfBool.cpp delete mode 100644 src/mflibrary/mfBool.h delete mode 100644 src/mflibrary/mfConstants.cpp delete mode 100644 src/mflibrary/mfConstants.h delete mode 100644 src/mflibrary/mfEnumAll.h delete mode 100644 src/mflibrary/mfExceptions.cpp delete mode 100644 src/mflibrary/mfExceptions.h delete mode 100644 src/mflibrary/mfIndentedTextOutput.cpp delete mode 100644 src/mflibrary/mfIndentedTextOutput.h delete mode 100644 src/mflibrary/mfInitialization.cpp delete mode 100644 src/mflibrary/mfInitialization.h delete mode 100644 src/mflibrary/mfInputLinesRange.cpp delete mode 100644 src/mflibrary/mfInputLinesRange.h delete mode 100644 src/mflibrary/mfLibraryComponent.cpp delete mode 100644 src/mflibrary/mfLibraryComponent.h delete mode 100644 src/mflibrary/mfList.cpp delete mode 100644 src/mflibrary/mfList.h delete mode 100644 src/mflibrary/mfMultiGenerationOah.cpp delete mode 100644 src/mflibrary/mfMultiGenerationOah.h delete mode 100644 src/mflibrary/mfMusicformatsErrors.cpp delete mode 100644 src/mflibrary/mfMusicformatsErrors.h delete mode 100644 src/mflibrary/mfOnOff.cpp delete mode 100644 src/mflibrary/mfOnOff.h delete mode 100644 src/mflibrary/mfOutputFileOah.cpp delete mode 100644 src/mflibrary/mfOutputFileOah.h delete mode 100644 src/mflibrary/mfPair.cpp delete mode 100644 src/mflibrary/mfPair.h delete mode 100644 src/mflibrary/mfPasses.cpp delete mode 100644 src/mflibrary/mfPasses.h delete mode 100644 src/mflibrary/mfPreprocessorSettings.h delete mode 100644 src/mflibrary/mfRational.cpp delete mode 100644 src/mflibrary/mfRational.h delete mode 100644 src/mflibrary/mfScoreNotations.cpp delete mode 100644 src/mflibrary/mfScoreNotations.h delete mode 100644 src/mflibrary/mfServices.cpp delete mode 100644 src/mflibrary/mfServices.h delete mode 100644 src/mflibrary/mfStack.cpp delete mode 100644 src/mflibrary/mfStack.h delete mode 100644 src/mflibrary/mfStringsHandling.cpp delete mode 100644 src/mflibrary/mfStringsHandling.h delete mode 100644 src/mflibrary/mfSystemInterface.cpp delete mode 100644 src/mflibrary/mfSystemInterface.h delete mode 100644 src/mflibrary/mfTiming.cpp delete mode 100644 src/mflibrary/mfTiming.h delete mode 100644 src/mflibrary/mfTraceOah.cpp delete mode 100644 src/mflibrary/mfTraceOah.h delete mode 100644 src/mflibrary/mfWrapperTypes.cpp delete mode 100644 src/mflibrary/mfWrapperTypes.h rename src/{mflibrary/mfTest.cpp => oah/oahConstants.h} (57%) diff --git a/MusicFormatsVersionNumber.txt b/MusicFormatsVersionNumber.txt index 48cd0925..823c0cb5 100644 --- a/MusicFormatsVersionNumber.txt +++ b/MusicFormatsVersionNumber.txt @@ -1 +1 @@ -v0.9.72-alpha1-step-3 \ No newline at end of file +v0.9.72-alpha1-step-4 \ No newline at end of file diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 83a801f8..9ed8a3b2 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -199,7 +199,7 @@ message (STATUS "-----> MF_CLI_SAMPLES_DIR: ${MF_CLI_SAMPLES_DIR}") # message (STATUS "-----> MF_CLI_SERVICES_DIR: ${MF_CLI_SERVICES_DIR}") -set (MF_SRC_FOLDERS ${MF_SRC_FOLDERS} mflibrary components languages oah wae manpage services) +set (MF_SRC_FOLDERS ${MF_SRC_FOLDERS} mfutilities components languages oah wae manpage services) set (MF_SRC_FOLDERS ${MF_SRC_FOLDERS} interpreters/stringmatcherinterpreter interpreters/mfslinterpreter interpreters/ischemeinterpreter) diff --git a/include/MusicFormatsVersionDate.h b/include/MusicFormatsVersionDate.h index 196ecf10..e3401cde 100644 --- a/include/MusicFormatsVersionDate.h +++ b/include/MusicFormatsVersionDate.h @@ -1 +1 @@ -#define MUSICFORMATS_VERSION_DATE "December 17, 2024" +#define MUSICFORMATS_VERSION_DATE "December 18, 2024" diff --git a/include/MusicFormatsVersionNumber.h b/include/MusicFormatsVersionNumber.h index 18405c7e..634ef432 100644 --- a/include/MusicFormatsVersionNumber.h +++ b/include/MusicFormatsVersionNumber.h @@ -1 +1 @@ -#define MUSICFORMATS_VERSION_NUMBER "v0.9.72-alpha1-step-2" +#define MUSICFORMATS_VERSION_NUMBER "v0.9.72-alpha1-step-3" diff --git a/include/mflibrary/mfAssert.h b/include/mfutilities/mfAssert.h similarity index 100% rename from include/mflibrary/mfAssert.h rename to include/mfutilities/mfAssert.h diff --git a/include/mflibrary/mfBool.h b/include/mfutilities/mfBool.h similarity index 100% rename from include/mflibrary/mfBool.h rename to include/mfutilities/mfBool.h diff --git a/include/mflibrary/mfConstants.h b/include/mfutilities/mfConstants.h similarity index 91% rename from include/mflibrary/mfConstants.h rename to include/mfutilities/mfConstants.h index 0fd9abbe..6e4c9a4e 100644 --- a/include/mflibrary/mfConstants.h +++ b/include/mfutilities/mfConstants.h @@ -87,7 +87,7 @@ EXP extern std::string mfMeasureNumberAsString (std::string measureNumber); constexpr int K_WHOLE_NOTES_NUMERATOR_UNKNOWN_ = 0; -EXP extern const msrWholeNotes K_WHOLE_NOTES_UNKNOWN____; +EXP extern const msrWholeNotes K_WHOLE_NOTES_UNKNOWN_; EXP extern const std::string kWholeNotePrefix, @@ -122,13 +122,6 @@ EXP extern std::string mfStanzaNumberAsString (std::string stanzaNumber); constexpr int K_MF_NAMES_LIST_MAX_LENGTH = 50; -// OAH layout settings -//______________________________________________________________________________ -constexpr int K_OAH_ELEMENTS_INDENTER_OFFSET = 3; - // indent a bit more for readability - -constexpr int K_OAH_FIELD_WIDTH = 40; - } diff --git a/include/mflibrary/mfEnumAll.h b/include/mfutilities/mfEnumAll.h similarity index 100% rename from include/mflibrary/mfEnumAll.h rename to include/mfutilities/mfEnumAll.h diff --git a/include/mflibrary/mfExceptions.h b/include/mfutilities/mfExceptions.h similarity index 100% rename from include/mflibrary/mfExceptions.h rename to include/mfutilities/mfExceptions.h diff --git a/include/mflibrary/mfIndentedTextOutput.h b/include/mfutilities/mfIndentedTextOutput.h similarity index 100% rename from include/mflibrary/mfIndentedTextOutput.h rename to include/mfutilities/mfIndentedTextOutput.h diff --git a/include/mflibrary/mfInitialization.h b/include/mfutilities/mfInitialization.h similarity index 100% rename from include/mflibrary/mfInitialization.h rename to include/mfutilities/mfInitialization.h diff --git a/include/mflibrary/mfInputLinesRange.h b/include/mfutilities/mfInputLinesRange.h similarity index 100% rename from include/mflibrary/mfInputLinesRange.h rename to include/mfutilities/mfInputLinesRange.h diff --git a/include/mflibrary/mfLibraryComponent.h b/include/mfutilities/mfLibraryComponent.h similarity index 100% rename from include/mflibrary/mfLibraryComponent.h rename to include/mfutilities/mfLibraryComponent.h diff --git a/include/mflibrary/mfList.h b/include/mfutilities/mfList.h similarity index 100% rename from include/mflibrary/mfList.h rename to include/mfutilities/mfList.h diff --git a/include/mflibrary/mfMultiGenerationOah.h b/include/mfutilities/mfMultiGenerationOah.h similarity index 100% rename from include/mflibrary/mfMultiGenerationOah.h rename to include/mfutilities/mfMultiGenerationOah.h diff --git a/include/mflibrary/mfMusicformatsErrors.h b/include/mfutilities/mfMusicformatsErrors.h similarity index 100% rename from include/mflibrary/mfMusicformatsErrors.h rename to include/mfutilities/mfMusicformatsErrors.h diff --git a/include/mflibrary/mfOnOff.h b/include/mfutilities/mfOnOff.h similarity index 100% rename from include/mflibrary/mfOnOff.h rename to include/mfutilities/mfOnOff.h diff --git a/include/mflibrary/mfOutputFileOah.h b/include/mfutilities/mfOutputFileOah.h similarity index 100% rename from include/mflibrary/mfOutputFileOah.h rename to include/mfutilities/mfOutputFileOah.h diff --git a/include/mflibrary/mfPair.h b/include/mfutilities/mfPair.h similarity index 100% rename from include/mflibrary/mfPair.h rename to include/mfutilities/mfPair.h diff --git a/include/mflibrary/mfPasses.h b/include/mfutilities/mfPasses.h similarity index 100% rename from include/mflibrary/mfPasses.h rename to include/mfutilities/mfPasses.h diff --git a/include/mflibrary/mfPreprocessorSettings.h b/include/mfutilities/mfPreprocessorSettings.h similarity index 100% rename from include/mflibrary/mfPreprocessorSettings.h rename to include/mfutilities/mfPreprocessorSettings.h diff --git a/include/mflibrary/mfRational.h b/include/mfutilities/mfRational.h similarity index 100% rename from include/mflibrary/mfRational.h rename to include/mfutilities/mfRational.h diff --git a/include/mflibrary/mfScoreNotations.h b/include/mfutilities/mfScoreNotations.h similarity index 94% rename from include/mflibrary/mfScoreNotations.h rename to include/mfutilities/mfScoreNotations.h index ef7cba85..46fd9ed9 100644 --- a/include/mflibrary/mfScoreNotations.h +++ b/include/mfutilities/mfScoreNotations.h @@ -27,7 +27,7 @@ enum class msrScoreNotationKind { }; std::string msrScoreNotationKindAsString ( - msrScoreNotationKind lilypondScoreNotationKind); + msrScoreNotationKind scoreNotationKind); std::ostream& operator << (std::ostream& os, const msrScoreNotationKind& elt); diff --git a/include/mflibrary/mfServices.h b/include/mfutilities/mfServices.h similarity index 100% rename from include/mflibrary/mfServices.h rename to include/mfutilities/mfServices.h diff --git a/include/mflibrary/mfStack.h b/include/mfutilities/mfStack.h similarity index 100% rename from include/mflibrary/mfStack.h rename to include/mfutilities/mfStack.h diff --git a/include/mflibrary/mfStringsHandling.h b/include/mfutilities/mfStringsHandling.h similarity index 100% rename from include/mflibrary/mfStringsHandling.h rename to include/mfutilities/mfStringsHandling.h diff --git a/include/mflibrary/mfSystemInterface.h b/include/mfutilities/mfSystemInterface.h similarity index 100% rename from include/mflibrary/mfSystemInterface.h rename to include/mfutilities/mfSystemInterface.h diff --git a/include/mflibrary/mfTest.h b/include/mfutilities/mfTest.h similarity index 100% rename from include/mflibrary/mfTest.h rename to include/mfutilities/mfTest.h diff --git a/include/mflibrary/mfTiming.h b/include/mfutilities/mfTiming.h similarity index 100% rename from include/mflibrary/mfTiming.h rename to include/mfutilities/mfTiming.h diff --git a/include/mflibrary/mfTraceOah.h b/include/mfutilities/mfTraceOah.h similarity index 100% rename from include/mflibrary/mfTraceOah.h rename to include/mfutilities/mfTraceOah.h diff --git a/include/mflibrary/mfWrapperTypes.h b/include/mfutilities/mfWrapperTypes.h similarity index 99% rename from include/mflibrary/mfWrapperTypes.h rename to include/mfutilities/mfWrapperTypes.h index 78cc80db..aa8bf512 100644 --- a/include/mflibrary/mfWrapperTypes.h +++ b/include/mfutilities/mfWrapperTypes.h @@ -448,7 +448,7 @@ typedef mfValueWithNeutralValue //______________________________________________________________________________ // whole notes durations typedef mfValueWithNeutralValue - + mfWohleNotes; //______________________________________________________________________________ diff --git a/src/mflibrary/mfTest.h b/include/oah/oahConstants.h similarity index 59% rename from src/mflibrary/mfTest.h rename to include/oah/oahConstants.h index f8fb8a34..6c8b4bbc 100644 --- a/src/mflibrary/mfTest.h +++ b/include/oah/oahConstants.h @@ -9,29 +9,30 @@ https://github.com/jacques-menu/musicformats */ -#ifndef ___mfTest___ -#define ___mfTest___ +#ifndef ___oahConstants___ +#define ___oahConstants___ -#include +#include #include "exports.h" +#include "msrMoments.h" +#include "msrNotesDurations.h" + namespace MusicFormats { //______________________________________________________________________________ -/* - this function is meant for developpers/maintainers - who need to do a quick test of mfMusicFormats' behaviour for their purposes +// OAH layout settings - such code is not supposed to be long-term living -*/ +constexpr int K_OAH_ELEMENTS_INDENTER_OFFSET = 3; + // indent a bit more for readability -EXP void mfTest (std::ostream& os); +constexpr int K_OAH_FIELD_WIDTH = 40; } -#endif // ___mfTest___ +#endif // ___oahConstants___ diff --git a/include/passes/mxsr2msr/mxsr2msrOah.h b/include/passes/mxsr2msr/mxsr2msrOah.h index 8dd52557..d4bb4bf4 100644 --- a/include/passes/mxsr2msr/mxsr2msrOah.h +++ b/include/passes/mxsr2msr/mxsr2msrOah.h @@ -317,7 +317,8 @@ class EXP mxsr2msrOahGroup : public oahGroup getBoldWordsAtom () const { return fBoldWordsAtom; } - const std::set & getItalicWordsSet () const + const std::set & + getItalicWordsSet () const { return fItalicWordsSet; } S_oahStringSetElementAtom getItalicWordsAtom () const @@ -402,7 +403,7 @@ class EXP mxsr2msrOahGroup : public oahGroup getWordsToDecrescAtom () const { return fWordsToDecrescAtom; } -// ties + // ties // -------------------------------------- Bool getIgnoreTies () const @@ -487,7 +488,7 @@ class EXP mxsr2msrOahGroup : public oahGroup Bool getTraceForward () const { return fTraceForward; } - // specific trace JMI move to traceOah + // display // -------------------------------------- void setDisplayMxsr () @@ -495,6 +496,12 @@ class EXP mxsr2msrOahGroup : public oahGroup Bool getDisplayMxsr () const { return fDisplayMxsr; } + S_oahBooleanAtom getDisplayMxsrAtom () const + { return fDisplayMxsrAtom; } + + // specific trace JMI move to traceOah + // -------------------------------------- + void setTraceMxsr () { fTraceMxsr = true; } Bool getTraceMxsr () const @@ -558,6 +565,8 @@ class EXP mxsr2msrOahGroup : public oahGroup // private services // ------------------------------------------------------ + void initializeMxsr2msrDisplayOptions (); + #ifdef MF_TRACE_IS_ENABLED void initializeMxsr2msrTraceOptions (); #endif // MF_TRACE_IS_ENABLED @@ -612,7 +621,7 @@ class EXP mxsr2msrOahGroup : public oahGroup // private fields // ------------------------------------------------------ - // use MXSR events (temporary from v0.9.72) + // use MXSR events // -------------------------------------- Bool fUseMxsrEvents; @@ -860,6 +869,11 @@ class EXP mxsr2msrOahGroup : public oahGroup Bool fCubase; + // display MXSR + // -------------------------------------- + + Bool fDisplayMxsr; + S_oahBooleanAtom fDisplayMxsrAtom; #ifdef MF_TRACE_IS_ENABLED // specific trace @@ -877,8 +891,6 @@ class EXP mxsr2msrOahGroup : public oahGroup // specific trace JMI move to traceOah JMI ??? v0.9.70 // -------------------------------------- - Bool fDisplayMxsr; - Bool fTraceMxsr; // visitors diff --git a/include/passes/mxsr2msr/mxsr2msrSkeletonBuilder.h b/include/passes/mxsr2msr/mxsr2msrSkeletonBuilder.h index ab1aedab..a91a061e 100644 --- a/include/passes/mxsr2msr/mxsr2msrSkeletonBuilder.h +++ b/include/passes/mxsr2msr/mxsr2msrSkeletonBuilder.h @@ -508,6 +508,20 @@ class EXP mxsr2msrSkeletonBuilder : void handleBOFPartGroupsNestingBOFAndScorePartsAllocation ( int inputLineNumber); + void sortfStartedPartGroupsListsVector ( + int inputLineNumber); + + void sortStoppedPartGroupsListsVector ( + int inputLineNumber); + + void handlePartGroupsStartAtIdentity ( + int inputLineNumber, + int identity); + + void handleThePartGroupsStoppedAtIdentity ( + int inputLineNumber, + int identity); + // parts handling // ------------------------------------------------------ diff --git a/include/representations/msr/msrNotesDurations.h b/include/representations/msr/msrNotesDurations.h index e1e89a09..c05d14c7 100644 --- a/include/representations/msr/msrNotesDurations.h +++ b/include/representations/msr/msrNotesDurations.h @@ -214,9 +214,6 @@ EXP msrWholeNotes msrNotesDurationKindAsWholeNotes ( EXP msrNotesDurationKind wholeNotesAsNotesDurationKind (msrWholeNotes wholeNotes); -//______________________________________________________________________________ -EXP extern const msrWholeNotes K_WHOLE_NOTES_UNKNOWN_; - //______________________________________________________________________________ std::string wholeNotesAndDotsNumberPitchAndOctaveAsString ( // JMI v0.9.67 int inputLineNumber, diff --git a/include/representations/msr/msrOah.h b/include/representations/msr/msrOah.h index 14bab9bb..15625744 100644 --- a/include/representations/msr/msrOah.h +++ b/include/representations/msr/msrOah.h @@ -422,12 +422,12 @@ class EXP msrOahGroup : public oahGroup // private services // ------------------------------------------------------ + void initializeMsrDisplayOptions (); + #ifdef MF_TRACE_IS_ENABLED void initializeMsrTraceOah (); #endif // MF_TRACE_IS_ENABLED - void initializeMsrDisplayOptions (); - void initializeMsrLanguagesOptions (); void initializeMsrHeaderOptions (); diff --git a/src/MusicFormatsVersionNumber.h b/src/MusicFormatsVersionNumber.h index 634ef432..4a14ea46 100644 --- a/src/MusicFormatsVersionNumber.h +++ b/src/MusicFormatsVersionNumber.h @@ -1 +1 @@ -#define MUSICFORMATS_VERSION_NUMBER "v0.9.72-alpha1-step-3" +#define MUSICFORMATS_VERSION_NUMBER "v0.9.72-alpha1-step-4" diff --git a/src/converters/msdl2braille/msdl2brailleManPageOah.cpp b/src/converters/msdl2braille/msdl2brailleManPageOah.cpp index c7e3bd4c..1745c164 100644 --- a/src/converters/msdl2braille/msdl2brailleManPageOah.cpp +++ b/src/converters/msdl2braille/msdl2brailleManPageOah.cpp @@ -14,9 +14,9 @@ #include -#include "mfConstants.h" #include "mfPreprocessorSettings.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "msdl2brailleManPageOah.h" diff --git a/src/converters/msdl2guido/msdl2guidoManPageOah.cpp b/src/converters/msdl2guido/msdl2guidoManPageOah.cpp index 713b864c..116354f7 100644 --- a/src/converters/msdl2guido/msdl2guidoManPageOah.cpp +++ b/src/converters/msdl2guido/msdl2guidoManPageOah.cpp @@ -14,9 +14,9 @@ #include -#include "mfConstants.h" #include "mfPreprocessorSettings.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "msdl2guidoManPageOah.h" diff --git a/src/converters/msdl2lilypond/msdl2lilypondManPageOah.cpp b/src/converters/msdl2lilypond/msdl2lilypondManPageOah.cpp index 5d9e1d6f..422ab886 100644 --- a/src/converters/msdl2lilypond/msdl2lilypondManPageOah.cpp +++ b/src/converters/msdl2lilypond/msdl2lilypondManPageOah.cpp @@ -14,9 +14,9 @@ #include -#include "mfConstants.h" #include "mfPreprocessorSettings.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "msdl2lilypondManPageOah.h" diff --git a/src/converters/msdl2musicxml/msdl2musicxmlManPageOah.cpp b/src/converters/msdl2musicxml/msdl2musicxmlManPageOah.cpp index 3cb8b862..40ee9adb 100644 --- a/src/converters/msdl2musicxml/msdl2musicxmlManPageOah.cpp +++ b/src/converters/msdl2musicxml/msdl2musicxmlManPageOah.cpp @@ -14,9 +14,9 @@ #include -#include "mfConstants.h" #include "mfPreprocessorSettings.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "msdl2musicxmlManPageOah.h" diff --git a/src/converters/msr2braille/msr2brailleManPageOah.cpp b/src/converters/msr2braille/msr2brailleManPageOah.cpp index c9818534..c45a31bd 100644 --- a/src/converters/msr2braille/msr2brailleManPageOah.cpp +++ b/src/converters/msr2braille/msr2brailleManPageOah.cpp @@ -14,11 +14,11 @@ #include -#include "mfConstants.h" #include "mfPreprocessorSettings.h" #include "oahOah.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "msr2brailleManPageOah.h" diff --git a/src/converters/msr2guido/msr2guidoManPageOah.cpp b/src/converters/msr2guido/msr2guidoManPageOah.cpp index ccdee13a..e610a205 100644 --- a/src/converters/msr2guido/msr2guidoManPageOah.cpp +++ b/src/converters/msr2guido/msr2guidoManPageOah.cpp @@ -14,9 +14,9 @@ #include -#include "mfConstants.h" #include "mfPreprocessorSettings.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "msr2guidoManPageOah.h" diff --git a/src/converters/msr2lilypond/msr2lilypondManPageOah.cpp b/src/converters/msr2lilypond/msr2lilypondManPageOah.cpp index 3cfe56b7..04d0ea2f 100644 --- a/src/converters/msr2lilypond/msr2lilypondManPageOah.cpp +++ b/src/converters/msr2lilypond/msr2lilypondManPageOah.cpp @@ -14,9 +14,9 @@ #include -#include "mfConstants.h" #include "mfPreprocessorSettings.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "msr2lilypondManPageOah.h" diff --git a/src/converters/msr2musicxml/msr2musicxmlManPageOah.cpp b/src/converters/msr2musicxml/msr2musicxmlManPageOah.cpp index 1335b3bb..16042b69 100644 --- a/src/converters/msr2musicxml/msr2musicxmlManPageOah.cpp +++ b/src/converters/msr2musicxml/msr2musicxmlManPageOah.cpp @@ -14,9 +14,9 @@ #include -#include "mfConstants.h" #include "mfPreprocessorSettings.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "msr2musicxmlManPageOah.h" diff --git a/src/converters/musicxml2braille/musicxml2brailleManPageOah.cpp b/src/converters/musicxml2braille/musicxml2brailleManPageOah.cpp index da523b24..b1a497e5 100644 --- a/src/converters/musicxml2braille/musicxml2brailleManPageOah.cpp +++ b/src/converters/musicxml2braille/musicxml2brailleManPageOah.cpp @@ -14,9 +14,9 @@ #include -#include "mfConstants.h" #include "mfPreprocessorSettings.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "musicxml2brailleManPageOah.h" diff --git a/src/converters/musicxml2guido/musicxml2guidoManPageOah.cpp b/src/converters/musicxml2guido/musicxml2guidoManPageOah.cpp index 4d137770..7277741b 100644 --- a/src/converters/musicxml2guido/musicxml2guidoManPageOah.cpp +++ b/src/converters/musicxml2guido/musicxml2guidoManPageOah.cpp @@ -14,9 +14,9 @@ #include -#include "mfConstants.h" #include "mfPreprocessorSettings.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "musicxml2guidoManPageOah.h" diff --git a/src/converters/musicxml2lilypond/musicxml2lilypondManPageOah.cpp b/src/converters/musicxml2lilypond/musicxml2lilypondManPageOah.cpp index a03c2f9c..20478cf7 100644 --- a/src/converters/musicxml2lilypond/musicxml2lilypondManPageOah.cpp +++ b/src/converters/musicxml2lilypond/musicxml2lilypondManPageOah.cpp @@ -14,11 +14,11 @@ #include -#include "mfConstants.h" #include "mfPreprocessorSettings.h" #include "oahOah.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "musicxml2lilypondManPageOah.h" diff --git a/src/converters/musicxml2musicxml/musicxml2musicxmlManPageOah.cpp b/src/converters/musicxml2musicxml/musicxml2musicxmlManPageOah.cpp index 5c43ecdc..3789b50b 100644 --- a/src/converters/musicxml2musicxml/musicxml2musicxmlManPageOah.cpp +++ b/src/converters/musicxml2musicxml/musicxml2musicxmlManPageOah.cpp @@ -14,9 +14,9 @@ #include -#include "mfConstants.h" #include "mfPreprocessorSettings.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "musicxml2musicxmlManPageOah.h" diff --git a/src/mflibrary/mfAssert.cpp b/src/mflibrary/mfAssert.cpp deleted file mode 100644 index 3a1d370c..00000000 --- a/src/mflibrary/mfAssert.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include "mfPreprocessorSettings.h" - -#include "mfExceptions.h" - -#include "mfAssert.h" -#include "mfIndentedTextOutput.h" -#include "mfServices.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -// assert - -void mfAssert ( - const std::string& sourceCodeFileName, - int sourceCodeLineNumber, - Bool condition, - const std::string& messageIfFalse) -{ - if (! condition) { - gIndenter.resetToZero (); - - gLog << - "#### mfAssert" << - ", " << sourceCodeFileName << ": " << sourceCodeLineNumber << - " -- "; - - if (gServiceRunData) { - gLog << - "measure " << - gServiceRunData->getCurrentMeasureNumber () << - '/' << - gServiceRunData->getScoreMeasuresNumber () << - ", part " << - gServiceRunData->getCurrentPartIDAndName () << - ", staff " << - gServiceRunData->getCurrentStaveNumber () << - ", voice " << - gServiceRunData->getCurrentVoiceNumber () << - " - "; - } - - gLog << - messageIfFalse << - " - quitting." << - std::endl; - -#ifdef MF_ABORT_TO_DEBUG_ERRORS_IS_ENABLED - abort (); -#endif // MF_ABORT_TO_DEBUG_ERRORS_IS_ENABLED - - throw mfAssertException (messageIfFalse); - } -} - -void mfAssertFalse (int identifier) -{ - mfAssert ( - "__FILE__", identifier, - false, - "*** mfAssertFalse ***"); -} - -//______________________________________________________________________________ -// assert with input location -void mfAssertWithInputLocation ( - const std::string& sourceCodeFileName, - int sourceCodeLineNumber, - Bool condition, - const std::string& inputSourceName, - int inputLineNumber, - const std::string& messageIfFalse) -// const std::string measureNumber, -// int scoreMeasuresNumber) -{ - if (! condition) { - gIndenter.resetToZero (); - - gLog << - "#### mfAssert" << - ", " << inputSourceName << ": " << inputLineNumber << - ", " << sourceCodeFileName << ": " << sourceCodeLineNumber << - " -- "; - - if (gServiceRunData) { - gLog << - "measure " << - gServiceRunData->getCurrentMeasureNumber () << - '/' << - gServiceRunData->getScoreMeasuresNumber () << - ", part " << - gServiceRunData->getCurrentPartIDAndName () << - ", staff " << - gServiceRunData->getCurrentStaveNumber () << - ", voice " << - gServiceRunData->getCurrentVoiceNumber () << - " - "; - } - - gLog << - messageIfFalse << - " - quitting." << - std::endl; - -#ifdef MF_ABORT_TO_DEBUG_ERRORS_IS_ENABLED - abort (); -#endif // MF_ABORT_TO_DEBUG_ERRORS_IS_ENABLED - - throw mfAssertException (messageIfFalse); - } -} - - -} diff --git a/src/mflibrary/mfAssert.h b/src/mflibrary/mfAssert.h deleted file mode 100644 index d20a66ae..00000000 --- a/src/mflibrary/mfAssert.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfAssert___ -#define ___mfAssert___ - -#include "exports.h" - -#include "mfBool.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -// assert - -EXP void mfAssert ( - const std::string& sourceCodeFileName, - int sourceCodeLineNumber, - Bool condition, - const std::string& messageIfFalse); - -EXP void mfAssertFalse (int identifier); // for debugging - -//______________________________________________________________________________ -// assert with input location - -EXP void mfAssertWithInputLocation ( - const std::string& sourceCodeFileName, - int sourceCodeLineNumber, - Bool condition, - const std::string& inputSourceName, - int inputLineNumber, - const std::string& messageIfFalse); - - -} - - -#endif // ___mfAssert___ diff --git a/src/mflibrary/mfBool.cpp b/src/mflibrary/mfBool.cpp deleted file mode 100644 index 7377d4db..00000000 --- a/src/mflibrary/mfBool.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include - -#include "mfBool.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -Bool::Bool () -{ - fValue = false; -} - -Bool::Bool (bool value) -{ - fValue = value; -} - -Bool::~Bool () -{} - -Bool::Bool(const Bool& theBool) { -// std::cout << "Bool copy constructor " << std::endl; // JMI CLAR - - // copy the value - fValue = theBool.getValue (); -} - -/* - // Declare prefix and postfix decrement operators. - Point& operator--(); // Prefix decrement operator. - Point operator--(int); // Postfix decrement operator. -*/ - -Bool::Bool (const std::string& theString) -{ - if (theString == "false") { - fValue = false; - } - else if (theString == "true") { - fValue = true; - } - else { - } -} - -Bool& Bool::operator= (const Bool& theBool) -{ - if (this != &theBool) { // JMI costly? - fValue = theBool.getValue (); - } - - return *this; -} - -Bool Bool::operator ! () const -{ - Bool result (! fValue); - - return result; -} - -Bool Bool::operator && (const Bool& otherBool) const -{ - Bool result (fValue && otherBool.fValue); - - return result; -} - -Bool Bool::operator || (const Bool& otherBool) const -{ - Bool result (fValue || otherBool.fValue); - - return result; -} - -Bool Bool::operator ^ (const Bool& otherBool) const -{ - Bool result (fValue ^ otherBool.fValue); - - return result; -} - -EXP Bool operator && (const Bool& leftBool, const bool& theBool) -{ - Bool result (leftBool.getValue () && theBool); - - return result; -} - -EXP Bool operator && (const bool& theBool, const Bool& rightBool) -{ - Bool result (theBool && rightBool.getValue ()); - - return result; -} - -EXP Bool operator || (const Bool& leftBool, const bool& theBool) -{ - - Bool result (leftBool.getValue () || theBool); - - return result; -} - -EXP Bool operator || (const bool& theBool, const Bool& rightBool) -{ - Bool result (theBool || rightBool.getValue ()); - - return result; -} - -EXP Bool operator ^ (const Bool& leftBool, const bool& theBool) -{ - - Bool result (leftBool.getValue () ^ theBool); - - return result; -} - -EXP Bool operator ^ (const bool& theBool, const Bool& rightBool) -{ - Bool result (theBool ^ rightBool.getValue ()); - - return result; -} - -std::string Bool::asString () const -{ - return - fValue - ? "true" - : "false"; -} - -void Bool::print (std::ostream& os) const -{ - os << asString (); -} - -std::ostream& operator << (std::ostream& os, const Bool& theBool) { - theBool.print (os); - return os; -} - -Bool nand (Bool p, Bool q) -{ - return ! (p && q); -} - -Bool nor (Bool p, Bool q) -{ - return ! (p || q); -} - -Bool xorr (Bool p, Bool q) -{ - // see https://en.wikipedia.org/wiki/XOR_gate -// Bool -// inter = -// nand ( -// p, -// q); -// -// return -// nand ( -// nand ( -// p, -// inter), -// nand ( -// q, -// inter) -// ); - - return p ^ q; -} - -Bool implies (Bool p, Bool q) -{ - return q || ! p; -} - -void testBool () -{ - Bool a; - Bool b (true); - - Bool c = a && b; - Bool d = a || b; - - Bool e (true); - - std::cout << - "a: " << a << std::endl << - "b: " << b << std::endl << - "c: " << c << std::endl << - "d: " << d << std::endl << - "e: " << e << std::endl << - std::endl; - - if (b) { - std::cout << nand (d, e); - } - else { - std::cout << nor (d, e); - } - std::cout << std::endl; - - std::cout << - implies (a, a) << - std::endl; -} - - -} - diff --git a/src/mflibrary/mfBool.h b/src/mflibrary/mfBool.h deleted file mode 100644 index 41805a63..00000000 --- a/src/mflibrary/mfBool.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfBool___ -#define ___mfBool___ - -#include -#include - -#include "exports.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -class EXP Bool -/* - this class encapsulates a 'bool' value to guarantee it is initialized -*/ -{ - public: - - // constructors/destructor - // ------------------------------------------------------ - - Bool (); - - Bool (bool value); - - Bool (const std::string& theString); - - virtual ~Bool (); - - // copy constructor - // ------------------------------------------------------ - - Bool (const Bool& theBool); - -public: - - // set and get - // ------------------------------------------------------ - - // set the value - void setValue (bool value) - { fValue = value; } - - // get the value - bool getValue () const - { return fValue; } - - public: - - // public services - // ------------------------------------------------------ - - // explicit conversion - explicit operator bool () const { return fValue; } - - // copy assignment operator - // ------------------------------------------------------ - - Bool& operator = (const Bool& theBool); - -/* - // Declare prefix and postfix decrement operators. - Point& operator--(); // Prefix decrement operator. - Point operator--(int); // Postfix decrement operator. -*/ - - // negation, prefix operator - Bool operator ! () const; - - // dyadic operators - Bool operator && (const Bool& otherBool) const; - Bool operator || (const Bool& otherBool) const; - Bool operator ^ (const Bool& otherBool) const; - - // compare value JMI ??? - Bool operator == (const Bool &otherBool) const - { return fValue == otherBool.fValue; } - Bool operator != (const Bool &otherBool) const - { return fValue != otherBool.fValue; } - - public: - - // print - // ------------------------------------------------------ - - std::string asString () const; - - void print (std::ostream& os) const; - - private: - - // private fields - // ------------------------------------------------------ - - bool fValue; -}; - -//EXP Bool operator&& (const Bool& leftBool, const Bool& rightBool); -EXP Bool operator && (const Bool& leftBool, const bool& theBool); -EXP Bool operator && (const bool& theBool, const Bool& rightBool); - -//EXP Bool operator || (const Bool& leftBool, const Bool& rightBool); -EXP Bool operator || (const Bool& leftBool, const bool& theBool); -EXP Bool operator || (const bool& theBool, const Bool& rightBool); - -//EXP Bool operator ^ (const Bool& leftBool, const Bool& rightBool); -EXP Bool operator ^ (const Bool& leftBool, const bool& theBool); -EXP Bool operator ^ (const bool& theBool, const Bool& rightBool); - -EXP std::ostream& operator << (std::ostream& os, const Bool& theBool); - -EXP Bool nand (Bool p, Bool q); -EXP Bool nor (Bool p, Bool q); -EXP Bool xorr (Bool p, Bool q); - -EXP Bool implies (Bool p, Bool q); - -EXP void testBool (); - - -} - - -#endif // ___mfBool___ diff --git a/src/mflibrary/mfConstants.cpp b/src/mflibrary/mfConstants.cpp deleted file mode 100644 index aafc2b3d..00000000 --- a/src/mflibrary/mfConstants.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include - -#include "mfConstants.h" - - -namespace MusicFormats -{ - -// input line numbers -//______________________________________________________________________________ - -const std::string - kInputLineNumberPrefix ("L_"), - kInputLineNumberNeutralValueString ("*Unknown*"); - -// input locations -//______________________________________________________________________________ - -const std::string - kInputLocationRangePrefix (".."), - kInputLocationNeutralValueString ("*Unknown*"); - -// staff numbers -//______________________________________________________________________________ - -const std::string - kStaffNumberPrefix ("ST_"), - kStaffNumberNeutralValueString ("*Unknown*"); - -std::string mfStaffNumberAsString (int staffNumber) -{ - std::string result; - - if (staffNumber == K_STAFF_NUMBER_UNKNOWN_) { - result = "K_STAFF_NUMBER_UNKNOWN_"; - } - else { - result = std::to_string (staffNumber); - } - - return result; -} - -// voice numbers -//______________________________________________________________________________ - -const std::string - kVoiceNumberPrefix ("V_"), - kVoiceNumberNeutralValueString ("*Unknown*"); - -std::string mfVoiceNumberAsString (int voiceNumber) -{ - std::string result; - - if (voiceNumber == K_VOICE_NUMBER_UNKNOWN_) { - result = "K_VOICE_NUMBER_UNKNOWN_"; - } - else { - result = std::to_string (voiceNumber); - } - - return result; -} - -// measure numbers -//______________________________________________________________________________ - -const std::string K_MEASURE_NUMBER_UNKNOWN_ = - "K_MEASURE_NUMBER_UNKNOWN_"; - -const std::string - kMeasureNumberPrefix ("ST_"), - kMeasureNumberNeutralValueString ("*Unknown*"); - -std::string mfMeasureNumberAsString (std::string measureNumber) -{ - std::string result; - - if (measureNumber == K_MEASURE_NUMBER_UNKNOWN_) { - result = "K_MEASURE_NUMBER_UNKNOWN_"; - } - else { - result = measureNumber; - } - - return result; -} - -//______________________________________________________________________________ -// whole notes durations - -const msrWholeNotes K_WHOLE_NOTES_UNKNOWN____ = - msrWholeNotes (0, 1); - -const std::string - kWholeNotePrefix ("WN_"), - kWholeNoteNeutralValueString ("K_WHOLE_NOTES_UNKNOWN____"); - -// moments -//______________________________________________________________________________ -const msrWholeNotes K_MEASURE_POSITION_UNKNOWN_ = - msrWholeNotes (K_WHOLE_NOTES_NUMERATOR_UNKNOWN_, 1); - -const msrMoment K_MOMENT_UNKNOWN_ = - msrMoment ( - K_MEASURE_POSITION_UNKNOWN_, - K_MEASURE_POSITION_UNKNOWN_); - -const std::string - kMomentPrefix ("WN_"), - kMomentNeutralValueString ("K_MOMENT_UNKNOWN_"); - -// lyrics -//______________________________________________________________________________ - -const std::string - kStanzaNumberPrefix ("ST_"), - kStanzaNumberNeutralValueString ("*Unknown*"); - -EXP extern const std::string - K_STANZA_NUMBER_UNKNOWN_ = "K_STANZA_NUMBER_UNKNOWN_", - K_STANZA_NAME_UNKNOWN_ = "K_STANZA_NAME_UNKNOWN_"; - -std::string mfStanzaNumberAsString (std::string stanzaNumber) -{ - std::string result; - - if (stanzaNumber == K_STANZA_NUMBER_UNKNOWN_) { - result = "K_STANZA_NAME_UNKNOWN_"; - } - else { - result = stanzaNumber; - } - - return result; -} - - -} diff --git a/src/mflibrary/mfConstants.h b/src/mflibrary/mfConstants.h deleted file mode 100644 index 0fd9abbe..00000000 --- a/src/mflibrary/mfConstants.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfConstants___ -#define ___mfConstants___ - -#include - -#include "exports.h" - -#include "msrMoments.h" -#include "msrNotesDurations.h" - - -namespace MusicFormats -{ - -// input line numbers -//______________________________________________________________________________ - -constexpr int K_MF_INPUT_LINE_UNKNOWN_ = 0; - -EXP extern const std::string - kInputLineNumberPrefix, - kInputLineNumberNeutralValueString; - -// input locations -//______________________________________________________________________________ - -EXP extern const std::string - kInputLocationRangePrefix, - kInputLocationNeutralValueString; - -// staff numbers -//______________________________________________________________________________ - -constexpr int K_STAFF_NUMBER_UNKNOWN_ = -99; - -EXP extern const std::string - kStaffNumberPrefix, - kStaffNumberNeutralValueString; - -constexpr int K_PART_HARMONIES_STAFF_NUMBER = 10; - -constexpr int K_PART_FIGURED_BASS_STAFF_NUMBER = 20; - -EXP extern std::string mfStaffNumberAsString (int staffNumber); - -// voice numbers -//______________________________________________________________________________ - -constexpr int K_VOICE_NUMBER_UNKNOWN_ = -96; - -EXP extern const std::string - kVoiceNumberPrefix, - kVoiceNumberNeutralValueString; - -constexpr int K_PART_HARMONIES_VOICE_NUMBER = 11; -constexpr int K_VOICE_HARMONIES_VOICE_BASE_NUMBER = 20; - -constexpr int K_PART_FIGURED_BASS_VOICE_NUMBER = 21; -constexpr int K_VOICE_FIGURED_BASS_VOICE_BASE_NUMBER = 40; - -EXP extern std::string mfVoiceNumberAsString (int voiceNumber); - -// measure numbers -//______________________________________________________________________________ - -EXP extern const std::string K_MEASURE_NUMBER_UNKNOWN_; - -EXP extern const std::string - kMeasureNumberPrefix, - kMeasureNumberNeutralValueString; - -EXP extern std::string mfMeasureNumberAsString (std::string measureNumber); - -// whole notes durations -//______________________________________________________________________________ - -constexpr int K_WHOLE_NOTES_NUMERATOR_UNKNOWN_ = 0; - -EXP extern const msrWholeNotes K_WHOLE_NOTES_UNKNOWN____; - -EXP extern const std::string - kWholeNotePrefix, - kWholeNoteNeutralValueString; - -// moments -//______________________________________________________________________________ - -EXP extern const msrWholeNotes K_MEASURE_POSITION_UNKNOWN_; - -EXP extern const msrMoment K_MOMENT_UNKNOWN_; - -EXP extern const std::string - kMomentPrefix, - kMomentNeutralValueString; - -// lyrics -//______________________________________________________________________________ - -EXP extern const std::string - K_STANZA_NUMBER_UNKNOWN_, - K_STANZA_NAME_UNKNOWN_; - -EXP extern const std::string - kStanzaNumberPrefix, - kStanzaNumberNeutralValueString; - -EXP extern std::string mfStanzaNumberAsString (std::string stanzaNumber); - -// names lists max length -//______________________________________________________________________________ - -constexpr int K_MF_NAMES_LIST_MAX_LENGTH = 50; - -// OAH layout settings -//______________________________________________________________________________ -constexpr int K_OAH_ELEMENTS_INDENTER_OFFSET = 3; - // indent a bit more for readability - -constexpr int K_OAH_FIELD_WIDTH = 40; - - -} - - -#endif // ___mfConstants___ diff --git a/src/mflibrary/mfEnumAll.h b/src/mflibrary/mfEnumAll.h deleted file mode 100644 index 93e28a33..00000000 --- a/src/mflibrary/mfEnumAll.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfEnumAll___ -#define ___mfEnumAll___ - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -/* - https://stackoverflow.com/questions/8498300/allow-for-range-based-for-with-enum-classes -*/ -template< typename T > -class mfEnumAll -{ - public: - - class Iterator - { - public: - - Iterator (int value) - : fIterationIndex (value) - {} - - T operator* (void) const - { return (T) fIterationIndex; } - - void operator++ (void) - { ++fIterationIndex; } - - Bool operator != (Iterator rhs) - { return fIterationIndex != rhs.fIterationIndex; } - - private: - - int fIterationIndex; - }; -}; - -template< typename T > -typename mfEnumAll::Iterator begin (mfEnumAll) -{ - return typename mfEnumAll::Iterator ((int)T::AllFirst); -} - -template< typename T > -typename mfEnumAll::Iterator end (mfEnumAll) -{ - return typename mfEnumAll::Iterator (((int)T::AllLast) + 1); -} - - -} - - -#endif // ___mfEnumAll___ diff --git a/src/mflibrary/mfExceptions.cpp b/src/mflibrary/mfExceptions.cpp deleted file mode 100644 index 1d87a6e4..00000000 --- a/src/mflibrary/mfExceptions.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include - -#include "mfPreprocessorSettings.h" - -#include "mfExceptions.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -EXP void mfDisplayException (std::exception& e, std::ostream& os) -{ -#ifdef MF_CAUGHT_EXCEPTIONS_DISPLAY_IS_ENABLED - os << - "std::exception caught: " << - e.what () << - std::endl; -#endif // MF_CAUGHT_EXCEPTIONS_DISPLAY_IS_ENABLED -} - -//______________________________________________________________________________ -mfException::mfException ( - std::string const& exceptionDescription, - int exceptionNumber, - int exceptionLevel) throw () - : fExceptionDescription ( - "mfException: " + exceptionDescription), - fExceptionNumber (exceptionNumber), - fExceptionLevel (exceptionLevel) -{} - -mfException::~mfException () throw () -{} - - -//______________________________________________________________________________ -mfAssertException::mfAssertException ( - std::string const& exceptionDescription) throw () - : mfException (exceptionDescription) -{} - -S_mfAssertException mfAssertException::create ( - std::string const& exceptionDescription) -{ - mfAssertException* obj = new - mfAssertException ( - exceptionDescription); - assert (obj!=0); - - return obj; -} - - -} diff --git a/src/mflibrary/mfExceptions.h b/src/mflibrary/mfExceptions.h deleted file mode 100644 index a636a5be..00000000 --- a/src/mflibrary/mfExceptions.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfExceptions___ -#define ___mfExceptions___ - -#include -#include - -#include - -#include "exports.h" -#include "smartpointer.h" - - -using namespace MusicXML2; - -namespace MusicFormats -{ - -//______________________________________________________________________________ -EXP void mfDisplayException (std::exception& e, std::ostream& os); - -//______________________________________________________________________________ -class EXP mfException: public std::exception, public smartable -{ - public: - - // constructors/destructor - // ------------------------------------------------------ - - mfException ( - std::string const& exceptionDescription = "", - int exceptionNumber = 0, - int exceptionLevel = 0 - ) throw (); - - virtual ~mfException () throw (); - - public: - - // set and get - // ------------------------------------------------------ - - int getExceptionNumber () const throw () - { return fExceptionNumber; } - - int getExceptionLevel () const throw () - { return fExceptionLevel; } - - public: - - // public services - // ------------------------------------------------------ - - virtual const char* what () const throw () - { return fExceptionDescription.c_str (); } - - private: - - std::string fExceptionDescription; - - int fExceptionNumber; - int fExceptionLevel; -}; -typedef SMARTP S_mfException; - -//______________________________________________________________________________ -class EXP mfAssertException: public mfException -{ - public: - - static SMARTP create ( - std::string const& exceptionDescription); - - mfAssertException ( - std::string const& exceptionDescription) throw (); -}; -typedef SMARTP S_mfAssertException; - - -} - -#endif // ___mfExceptions___ diff --git a/src/mflibrary/mfIndentedTextOutput.cpp b/src/mflibrary/mfIndentedTextOutput.cpp deleted file mode 100644 index 8ec7e725..00000000 --- a/src/mflibrary/mfIndentedTextOutput.cpp +++ /dev/null @@ -1,627 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include // std::setw, std::setprecision, ... - -#include "mfAssert.h" -#include "mfStringsHandling.h" - -#include "mfIndentedTextOutput.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -// uncomment the following definition if indentation debugging is desired -// #define MF_INDENTATION_DEBUGGING_IS_ENABLED - -//______________________________________________________________________________ -#ifdef MF_INDENTATION_DEBUGGING_IS_ENABLED - #include "waeHandlers.h" -#endif // MF_INDENTATION_DEBUGGING_IS_ENABLED - -//______________________________________________________________________________ -mfOutputIndenter::mfOutputIndenter (std::string spacer) -{ - fIndentation = 0; - fSpacer = spacer; -} - -mfOutputIndenter::~mfOutputIndenter () -{} - -/* - Declare prefix and postfix decrement operators. - Point& operator--(); // Prefix decrement operator. - Point operator--(int); // Postfix decrement operator. -*/ - -// increase the indentation by 1, prefix operator -mfOutputIndenter& mfOutputIndenter::operator++ () -{ -#ifdef MF_INDENTATION_DEBUGGING_IS_ENABLED - std::stringstream ss; - - ss << - "% >>>>> Incrementing INDENTER from " << fIndentation; -#endif // MF_INDENTATION_DEBUGGING_IS_ENABLED - - ++fIndentation; - -#ifdef MF_INDENTATION_DEBUGGING_IS_ENABLED - ss << - " to " << fIndentation << - std::endl; - - gLog << - ss.str () << - std::endl << std::endl; -#endif // MF_INDENTATION_DEBUGGING_IS_ENABLED - - return *this; -} - -// decrease the indentation by 1, prefix operator -mfOutputIndenter& mfOutputIndenter::operator-- () -{ -#ifdef MF_INDENTATION_DEBUGGING_IS_ENABLED - std::stringstream ss; - - ss << - "% >>>>> Decrementing INDENTER from " << fIndentation; -#endif // MF_INDENTATION_DEBUGGING_IS_ENABLED - - --fIndentation; - -#ifdef MF_INDENTATION_DEBUGGING_IS_ENABLED - ss << - " to " << fIndentation << - std::endl; - - gLog << - ss.str () << - std::endl << std::endl; -#endif // MF_INDENTATION_DEBUGGING_IS_ENABLED - - if (fIndentation < 0) { - mfAssert ( - __FILE__, __LINE__, - false, - "indentation has become negative at " + std::to_string (fIndentation)); - } - - return *this; -} - -// increase the indentation by 1, postfix operator -mfOutputIndenter mfOutputIndenter::mfOutputIndenter::operator++ (int) -{ -#ifdef MF_INDENTATION_DEBUGGING_IS_ENABLED - std::stringstream ss; - - ss << - "% >>>>> Incrementing INDENTER from " << fIndentation; -#endif // MF_INDENTATION_DEBUGGING_IS_ENABLED - - ++fIndentation; - -#ifdef MF_INDENTATION_DEBUGGING_IS_ENABLED - ss << - " to " << fIndentation << - std::endl; - - gLog << - ss.str () << - std::endl << std::endl; -#endif // MF_INDENTATION_DEBUGGING_IS_ENABLED - - return *this; -} - -// decrease the indentation by 1, postfix operator -mfOutputIndenter mfOutputIndenter::mfOutputIndenter::operator-- (int) -{ -#ifdef MF_INDENTATION_DEBUGGING_IS_ENABLED - std::stringstream ss; - - ss << - "% >>>>> Decrementing INDENTER from " << fIndentation; -#endif // MF_INDENTATION_DEBUGGING_IS_ENABLED - - --fIndentation; - -#ifdef MF_INDENTATION_DEBUGGING_IS_ENABLED - ss << - " to " << fIndentation << - std::endl; - - gLog << - ss.str () << - std::endl << std::endl; -#endif // MF_INDENTATION_DEBUGGING_IS_ENABLED - - if (fIndentation < 0) { - mfAssert ( - __FILE__, __LINE__, - false, - "indentation has become negative at " + std::to_string (fIndentation)); - } - - return *this; -} - -mfOutputIndenter& mfOutputIndenter::increment (int value) -{ -#ifdef MF_INDENTATION_DEBUGGING_IS_ENABLED - std::stringstream ss; - - ss << - "% >>>>> Incrementing INDENTER from " << fIndentation; -#endif // MF_INDENTATION_DEBUGGING_IS_ENABLED - - fIndentation += value; - -#ifdef MF_INDENTATION_DEBUGGING_IS_ENABLED - ss << - " to " << fIndentation << - std::endl; - - gLog << - ss.str () << - std::endl << std::endl; -#endif // MF_INDENTATION_DEBUGGING_IS_ENABLED - - if (false && fIndentation < 0) { - mfAssert ( - __FILE__, __LINE__, - false, - "indentation has become negative at " + std::to_string (fIndentation)); - } - - return *this; -} - -mfOutputIndenter& mfOutputIndenter::decrement (int value) -{ -#ifdef MF_INDENTATION_DEBUGGING_IS_ENABLED - std::stringstream ss; - - ss << - "% >>>>> Decrementing INDENTER from " << fIndentation; -#endif // MF_INDENTATION_DEBUGGING_IS_ENABLED - - fIndentation -= value; - -#ifdef MF_INDENTATION_DEBUGGING_IS_ENABLED - ss << - " to " << fIndentation << - std::endl; - - gLog << - ss.str () << - std::endl << std::endl; -#endif // MF_INDENTATION_DEBUGGING_IS_ENABLED - - if (fIndentation < 0) { - mfAssert ( - __FILE__, __LINE__, - false, - "indentation has become negative at " + std::to_string (fIndentation)); - } - - return *this; -} - -std::string mfOutputIndenter::fetchCurrentOffset () -{ - return - mfReplicateString ( - fSpacer, - fIndentation); -} - -void mfOutputIndenter::indentMultiLineString ( - const std::string& theString, - std::ostream& os) -{ - // add indentation ahead of all lines of theString - - // the std::istringstream to read lines from theString - std::istringstream inputStream (theString); - std::string line; - - // print theString line by line - while (getline (inputStream, line)) { - os << line << std::endl; - } // while -} - -std::string mfOutputIndenter::indentMultiLineStringWithCurrentOffset ( - const std::string& theString) -{ - // add indentation ahead of all lines of theString - - std::stringstream ss; - - // the std::istringstream to read lines from theString - std::istringstream inputStream (theString); - std::string line; - - // append theString line by line - while (getline (inputStream, line)) { - ss << fetchCurrentOffset () << line; - } // while - - return ss.str (); -} - -void mfOutputIndenter::printMultiLineStringInATable ( - const std::string& theString, - const int columnStart, - const int columnWidth, - std::ostream& os) -{ - // the std::istringstream to read lines from theString - std::istringstream inputStream (theString); - std::string line; - - // print theString line by line - int lineCounter = 0; - - while (getline (inputStream, line)) { - ++ lineCounter; - if (lineCounter > 1) { - // this is a multi-line string's line after the first one, - // write spaces before it up to columnStart - os << std::left << - mfReplicateChar (' ', columnStart); - } - -// int -// twoBytesWideCharactersInLine = -// countTwoBytesWideCharactersInString (line); // JMI v0.9.67 -// os << "countTwoBytesWideCharactersInString: " << countTwoBytesWideCharactersInString << std::endl; - - os << std::left << -// std::setw (columnWidth - twoBytesWideCharactersInLine) << - std::setw (columnWidth) << - line; - } // while -} - -void mfOutputIndenter::printSpacers (std::ostream& os) const -{ - int i = fIndentation; - - while (i-- > 0) os << fSpacer; -} - -std::ostream& operator << (std::ostream& os, const mfOutputIndenter& theIndenter) -{ - theIndenter.printSpacers (os); - return os; -} - -//______________________________________________________________________________ -S_mfIndentedOstream mfIndentedOstream::create ( - std::ostream& theOStream, - mfOutputIndenter& theIndenter) -{ - mfIndentedOstream* obj = - new mfIndentedOstream ( - theOStream, - theIndenter); - assert (obj != nullptr); - - return obj; -} - -mfIndentedOstream::mfIndentedOstream ( - std::ostream& theOStream, - mfOutputIndenter& theIndenter) - : std::ostream ( - & fIndentedOStreamBuf), - fIndentedOStreamBuf ( - theOStream, - theIndenter) -{} - -mfIndentedOStreamBuf::mfIndentedOStreamBuf ( - std::ostream& outputStream, - mfOutputIndenter& theIndenter) - : fOutputOStream ( - outputStream), - fOutputIndenter ( - theIndenter) -{} - -//______________________________________________________________________________ -int mfIndentedOStreamBuf::sync () -{ - // When we sync the stream with fOutputOStream: - // 1) output the indentation then the buffer - // 2) reset the buffer - // 3) flush the actual output stream we are using. - - size_t strSize = str ().size (); - - // fetch the last non-space character in the buffer - // caution: the std::endl is present as the last character! - size_t found = str ().find_last_not_of (' ', strSize - 2); - - // this can be uncommented to see low level informations - // fOutputOStream << "% strSize: " << strSize << ", found: " << found << std::endl; - - // output the spacers - fOutputIndenter.printSpacers (fOutputOStream); - - // output the buffer - if (found == strSize - 3) { - // don't output the trailing spaces, but output the end of line - fOutputOStream << str ().substr (0, found + 1) << std::endl; - } - else { - // output the whole buffer - fOutputOStream << str (); - } - - // reset the buffer - str (""); - - // flush the output stream - fOutputOStream.flush (); - - return 0; -} - -//______________________________________________________________________________ -S_mfIndentedStringStream mfIndentedStringStream::create () -{ - mfIndentedStringStream* obj = - new mfIndentedStringStream (); - assert (obj != nullptr); - - return obj; -} - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const char theChar) -{ - iss.getStringstream () << - theChar; - - return iss; -} - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const std::string& theString) -{ - iss.getStringstream () << - gIndenter.indentMultiLineStringWithCurrentOffset ( - theString); - - return iss; -} - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const char* theCString) -{ - iss.getStringstream () << - gIndenter.indentMultiLineStringWithCurrentOffset ( - theCString); - - return iss; -} - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const int& elt) -{ - iss.getStringstream () << - elt; - - return iss; -} - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const unsigned int& elt) -{ - iss.getStringstream () << - elt; - - return iss; -} - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const long int& elt) -{ - iss.getStringstream () << - elt; - - return iss; -} - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const unsigned long int& elt) -{ - iss.getStringstream () << - elt; - - return iss; -} - -#ifdef WIN32 -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const size_t& elt) -{ - iss.getStringstream () << - elt; - - return iss; -} -#endif // WIN32 - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const float& elt) -{ - iss.getStringstream () << - elt; - - return iss; -} - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const mfRational& elt) -{ - iss.getStringstream () << - gIndenter.indentMultiLineStringWithCurrentOffset ( - elt.asString ()); - - return iss; -} - -//______________________________________________________________________________ -// code taken from: -// http://comp.lang.cpp.moderated.narkive.com/fylLGJgp/redirect-output-to-dev-null -template> -struct basic_nullbuf : std::basic_streambuf -{ - typedef std::basic_streambuf base_type; - typedef typename base_type::int_type int_type; - typedef typename base_type::traits_type traits_type; - - virtual int_type overflow (int_type c) { - return traits_type::not_eof (c); - } -}; - -// convenient typedefs -typedef basic_nullbuf nullbuf; -//typedef basic_nullbuf wnullbuf; - -// buffers and streams -nullbuf cnull_obj; -//wnullbuf wcnull_obj; - -std::ostream cnull (& cnull_obj); -//wostream wcnull (& wcnull_obj); - -//______________________________________________________________________________ -// the global hidden indenter for general use -EXP mfOutputIndenter pGlobalOutputIndenter; - -EXP mfOutputIndenter& getGlobalOutputIndenter () -{ - return pGlobalOutputIndenter; -} - -// the hidden global log and output indented streams -S_mfIndentedOstream pGlobalOutputIndentedOstream; - -EXP S_mfIndentedOstream& getGlobalOutputIndentedOstream () -{ - return pGlobalOutputIndentedOstream; -} - -S_mfIndentedOstream pGlobalLogIndentedOstream; - -EXP S_mfIndentedOstream& getGlobalLogIndentedOstream () -{ - return pGlobalLogIndentedOstream; -} - -//______________________________________________________________________________ -void createTheGlobalIndentedOstreams ( - std::ostream& theOutputStream, - std::ostream& theLogStream) -{ - pGlobalOutputIndentedOstream = - mfIndentedOstream::create ( - theOutputStream, - pGlobalOutputIndenter); - - pGlobalLogIndentedOstream = - mfIndentedOstream::create ( - theLogStream, - pGlobalOutputIndenter); -} - - -} - -/* -//______________________________________________________________________________ - testMfIndentedStringstream (); // JMI v0.9.66 - - -void testMfIndentedStringstream () -{ - mfIndentedStringStream iss; - - // populate the mfIndentedStringStream - iss << - "iss 1" << - std::endl; - - ++gIndenter; - iss << - "iss 1.1" << - std::endl << - "iss 1.2" << - std::endl; - --gIndenter; - - iss << - "iss 2" << - std::endl; - - ++gIndenter; - iss << - "iss 2.1" << - std::endl; - - iss << - "iss 2.2" << - std::endl; - { - ++gIndenter; - iss << - "iss 2.2.1" << - std::endl << - "iss 2.2.2" << - std::endl; - --gIndenter; - } - - iss << - "iss 2.3" << - std::endl; - - --gIndenter; - - iss << - "iss 3" << - std::endl; - - - // display the mfIndentedStringStream contents -// gLog << -// "iss.str ():" << -// std::endl; -// -// ++gIndenter; - gLog << - iss.str () << - std::endl; -// --gIndenter; -} - -*/ diff --git a/src/mflibrary/mfIndentedTextOutput.h b/src/mflibrary/mfIndentedTextOutput.h deleted file mode 100644 index b92b404d..00000000 --- a/src/mflibrary/mfIndentedTextOutput.h +++ /dev/null @@ -1,355 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfIndentedTextOutput___ -#define ___mfIndentedTextOutput___ - -#include -#include // for std::stringbuf - -#include "exports.h" -#include "smartpointer.h" - -#include "mfBool.h" -#include "mfRational.h" - - -using namespace MusicXML2; - -namespace MusicFormats -{ - -//______________________________________________________________________________ -class EXP mfOutputIndenter -{ - public: - - // constructors/destructor - // ------------------------------------------------------ - - mfOutputIndenter (std::string spacer = " "); - - virtual ~mfOutputIndenter (); - - public: - - // set and get - // ------------------------------------------------------ - - // spacer - std::string getSpacer () const - { return fSpacer; } - - // indentation - void setIndentation (int indentation) - { fIndentation = indentation; } - int getIndentation () const - { return fIndentation; } - - public: - - // public services - // ------------------------------------------------------ - -/* - // Declare prefix and postfix decrement operators. - Point& operator--(); // Prefix decrement operator. - Point operator--(int); // Postfix decrement operator. -*/ - - // increase the indentation by 1, prefix operator - mfOutputIndenter& operator++ (); - - // decrease the indentation by 1, prefix operator - mfOutputIndenter& operator-- (); - - // increase the indentation by 1, postfix operator - mfOutputIndenter operator++ (int); - // decrease the indentation by 1, postfix operator - mfOutputIndenter operator-- (int); - - mfOutputIndenter& increment (int value = 1); - mfOutputIndenter& decrement (int value = 1); - - // reset the indentation - void resetToZero () - { fIndentation = 0; } - - // compare indentation value - Bool operator == (const int &value) const - { return fIndentation == value; } - Bool operator != (const int &value) const - { return fIndentation != value; } - - // output as much space as specified - void printSpacers (std::ostream& os) const; - - // current offset - std::string fetchCurrentOffset (); - - // indent a multi-line 'R"(...)"' std::string - void indentMultiLineString ( - const std::string& theString, - std::ostream& os); - - std::string indentMultiLineStringWithCurrentOffset ( - const std::string& theString); - - // print a multi-line string in a table with leading spaces - // from the second line on - void printMultiLineStringInATable ( - const std::string& theString, - const int columnStart, - const int columnWidth, - std::ostream& os); - - private: - - // private fields - // ------------------------------------------------------ - - int fIndentation; - std::string fSpacer; -}; - -EXP std::ostream& operator << (std::ostream& os, const mfOutputIndenter& theIndenter); - -//______________________________________________________________________________ -// a stream buffer that prefixes each line -// with the current indentation, i.e. spaces - -/* -std::endl declaration: - - std::endl for std::ostream - std::ostream& std::endl (std::ostream& os); - - basic template - template - basic_ostream& std::endl (basic_ostream& os); - - Insert newline and flush - Inserts a new-line character and flushes the stream. - - Its behavior is equivalent to calling os.put('\n') (or os.put(os.widen('\n')) for character types other than char), and then os.flush(). - --- - -Reference for this class: - https://stackoverflow.com/questions/2212776/overload-handling-of-stdendl -*/ - -class EXP mfIndentedOStreamBuf: public std::stringbuf -{ - public: - - // constructor - mfIndentedOStreamBuf ( - std::ostream& outputStream, - mfOutputIndenter& theIndenter); - - // indentation - mfOutputIndenter& getOutputIndenter () const - { return fOutputIndenter; } - - // flush - void flush () - { fOutputOStream.flush (); } - - virtual int sync (); - - private: - - // private fields - // ------------------------------------------------------ - - std::ostream& fOutputOStream; - mfOutputIndenter& fOutputIndenter; - -}; - -//______________________________________________________________________________ -class EXP mfIndentedOstream: public std::ostream, public smartable -{ -/* -Reference for this class: - https://stackoverflow.com/questions/2212776/overload-handling-of-stdendl - -Usage: - mfIndentedOstream myStream (std::cout); - - myStream << - 1 << 2 << 3 << std::endl << - 5 << 6 << std::endl << - 7 << 8 << std::endl; -*/ - - public: - - // creation - // ------------------------------------------------------ - - static SMARTP create ( - std::ostream& theOStream, - mfOutputIndenter& theIndenter); - - // constructors/destructor - // ------------------------------------------------------ - - mfIndentedOstream ( - std::ostream& theOStream, - mfOutputIndenter& theIndenter); - - virtual ~mfIndentedOstream () {}; - - public: - - // public services - // ------------------------------------------------------ - - // flush - void flush () - { fIndentedOStreamBuf.flush (); } - - // indentation - mfOutputIndenter& getIndenter () const - { return fIndentedOStreamBuf.getOutputIndenter (); } - - void incrIndentation () - { ++ (fIndentedOStreamBuf.getOutputIndenter ()); } - - void decrIndentation () - { -- (fIndentedOStreamBuf.getOutputIndenter ()); } - - private: - - // private fields - // ------------------------------------------------------ - - // mfIndentedOstream just uses an mfIndentedOStreamBuf - mfIndentedOStreamBuf fIndentedOStreamBuf; - -}; -typedef SMARTP S_mfIndentedOstream; - -//______________________________________________________________________________ -class EXP mfIndentedStringStream: public smartable -{ -/* -Reference for this class: - https://cplusplus.com/reference/sstream/stringstream/ - -Usage: - mfIndentedStringStream iss; - - iss << - 1 << 2 << 3 << std::endl << // no std::endl here! - 5 << 6 << std::endl << - 7 << 8 << std::endl; -*/ - - public: - - // creation - // ------------------------------------------------------ - - static SMARTP create (); - - // constructors/destructor - // ------------------------------------------------------ - - mfIndentedStringStream () {} - - virtual ~mfIndentedStringStream () {}; - - public: - - // set and get - // ------------------------------------------------------ - - std::stringstream& getStringstream () - { return fStringstream; } - - public: - - // public services - // ------------------------------------------------------ - - std::string str () const - { return fStringstream.str (); } - - private: - - // private fields - // ------------------------------------------------------ - - std::stringstream fStringstream; -}; -typedef SMARTP S_mfIndentedStringStream; - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const char theChar); - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const std::string& theString); - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const char* theCString); - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const int& elt); - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const unsigned int& elt); - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const long int& elt); - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const unsigned long int& elt); - -#ifdef WIN32 -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const size_t& elt); -#endif // WIN32 - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const float& elt); - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const mfRational& elt); - -//______________________________________________________________________________ -// the hidden global output indenter for general use -EXP mfOutputIndenter& getGlobalOutputIndenter (); - -// useful shortcut macros -#define gIndenter getGlobalOutputIndenter () -#define gTab getGlobalOutputIndenter ().getSpacer () - -// the hidden global log and output indented streams -EXP S_mfIndentedOstream& getGlobalOutputIndentedOstream (); -EXP S_mfIndentedOstream& getGlobalLogIndentedOstream (); - -// useful shortcut macros -#define gOutput *(getGlobalOutputIndentedOstream ()) -#define gLog *(getGlobalLogIndentedOstream ()) - -//______________________________________________________________________________ -EXP extern void createTheGlobalIndentedOstreams ( - std::ostream& theOutputStream, - std::ostream& theLogStream); - - -} - - -#endif // ___mfIndentedTextOutput___ diff --git a/src/mflibrary/mfInitialization.cpp b/src/mflibrary/mfInitialization.cpp deleted file mode 100644 index c16f357d..00000000 --- a/src/mflibrary/mfInitialization.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include "mfInitialization.h" -#include "mfPasses.h" - -#include "languages.h" - -#include "oahEarlyOptions.h" - -#include "waeHandlers.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -void initializeMusicFormats () -{ - - // protect library against multiple initializations - static Bool pPrivateThisMethodHasBeenRun (false); - - if (! pPrivateThisMethodHasBeenRun) { -#ifdef MF_TRACE_IS_ENABLED - if ( - gEarlyOptions.getTraceEarlyOptions () - && - ! gEarlyOptions.getEarlyQuietOption () - ) { - std::stringstream ss; - - ss << - "Initializing MusicFormats"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - // languages handling - // ------------------------------------------------------ - - initializeMusicFormatsLanguages (); - - initializeMusicFormatsPassIDs (); - - pPrivateThisMethodHasBeenRun = true; - } -} - - -} - diff --git a/src/mflibrary/mfInitialization.h b/src/mflibrary/mfInitialization.h deleted file mode 100644 index 5d7ccfba..00000000 --- a/src/mflibrary/mfInitialization.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfInitialization___ -#define ___mfInitialization___ - -namespace MusicFormats -{ - -// initialization -//______________________________________________________________________________ -void initializeMusicFormats (); - - -} - - -#endif // ___mfInitialization___ diff --git a/src/mflibrary/mfInputLinesRange.cpp b/src/mflibrary/mfInputLinesRange.cpp deleted file mode 100644 index eae5a23b..00000000 --- a/src/mflibrary/mfInputLinesRange.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include - -#include "mfInputLinesRange.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -mfInputLinesRange::mfInputLinesRange ( - int inputStartLineNumber, - int inputEndLineNumber) -{ - fInputStartLineNumber = inputStartLineNumber; - fInputEndLineNumber = inputEndLineNumber; -} - -mfInputLinesRange::mfInputLinesRange ( - int inputStartLineNumber) -{ - fInputStartLineNumber = inputStartLineNumber; - fInputEndLineNumber = inputStartLineNumber; -} - -mfInputLinesRange::~mfInputLinesRange () -{} - -std::string mfInputLinesRange::asString () const -{ - std::stringstream ss; - - if (fInputEndLineNumber != fInputStartLineNumber) { - ss << - "lines " << - fInputStartLineNumber << - " .. " << - fInputEndLineNumber; - } - else { - ss << - "line " << fInputStartLineNumber; - } - - return ss.str (); -} - -void mfInputLinesRange::print (std::ostream& os) const -{ - os << - "[mfInputLinesRange " << - fInputStartLineNumber; - - if (fInputEndLineNumber != fInputStartLineNumber) { - os << - ", " << - fInputEndLineNumber; - } - - os << ']'; -} - -std::ostream& operator << (std::ostream& os, const mfInputLinesRange& elt) { - elt.print (os); - return os; -} - - -} - diff --git a/src/mflibrary/mfInputLinesRange.h b/src/mflibrary/mfInputLinesRange.h deleted file mode 100644 index eb03df90..00000000 --- a/src/mflibrary/mfInputLinesRange.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfInputLinesRange___ -#define ___mfInputLinesRange___ - -#include -#include - -#include "exports.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -class EXP mfInputLinesRange -{ - public: - - // constructors/destructor - // ------------------------------------------------------ - - mfInputLinesRange ( - int inputStartLineNumber, - int inputEndLineNumber); - - mfInputLinesRange ( - int inputStartLineNumber); - - virtual ~mfInputLinesRange (); - -public: - - // set and get - // ------------------------------------------------------ - - int getInputStartLineNumber () const - { return fInputStartLineNumber; } - - void setInputStartLineNumber (int value) - { fInputStartLineNumber = value; } - - int getInputEndLineNumber () const - { return fInputEndLineNumber; } - - void setInputEndLineNumber (int value) - { fInputEndLineNumber = value; } - - public: - - // public services - // ------------------------------------------------------ - - - public: - - // print - // ------------------------------------------------------ - - std::string asString () const; - - void print (std::ostream& os) const; - - - private: - - // private fields - // ------------------------------------------------------ - - int fInputStartLineNumber; - int fInputEndLineNumber; -}; - -} - -#endif // ___mfInputLinesRange___ diff --git a/src/mflibrary/mfLibraryComponent.cpp b/src/mflibrary/mfLibraryComponent.cpp deleted file mode 100644 index b207be63..00000000 --- a/src/mflibrary/mfLibraryComponent.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include "../../MusicFormatsVersionNumber.h" - -#include "../../MusicFormatsVersionDate.h" - -#include "mfIndentedTextOutput.h" - -#include "mfcComponents.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -const std::string pMusicFormatsVersionNumber = - MUSICFORMATS_VERSION_NUMBER; - -const std::string pMusicFormatsVersionDate = - MUSICFORMATS_VERSION_DATE; - -EXP extern std::string getGlobalMusicFormatsVersionNumber () -{ - return pMusicFormatsVersionNumber; -} - -EXP extern std::string getGlobalMusicFormatsVersionDate () -{ - return pMusicFormatsVersionDate; -} - -EXP extern std::string getGlobalMusicFormatsVersionNumberAndDate () -{ - std::string result; - - return - pMusicFormatsVersionNumber + - " (" + - pMusicFormatsVersionDate + - ")"; -} - -//______________________________________________________________________________ -S_mfcLibraryComponent createLibraryComponent () -{ - static S_mfcLibraryComponent pLibraryComponent; - - // protect library against multiple initializations - if (! pLibraryComponent) { - -#ifdef MF_TRACE_IS_ENABLED - if (gEarlyOptions.getTraceEarlyOptions ()) { - std::stringstream ss; - - ss << - "Creating the MusicFormats library component" << - ", " << - getGlobalMusicFormatsVersionNumber << - ", " << - getGlobalMusicFormatsVersionDate; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - // create the library's history - pLibraryComponent = - mfcLibraryComponent::create ( - "MusicFormats", - mfcMultiComponentEntropicityKind::kComponentEntropicityYes, - mfcMultiComponentUsedFromTheCLIKind::kComponentUsedFromTheCLIYes); // JMI ??? - - // populate the library's representations list - pLibraryComponent-> - appendRepresentationToMultiComponent ( - createMsrRepresentationComponent ()); - pLibraryComponent-> - appendRepresentationToMultiComponent ( - createLpsrRepresentationComponent ()); - pLibraryComponent-> - appendRepresentationToMultiComponent ( - createBsrRepresentationComponent ()); - pLibraryComponent-> - appendRepresentationToMultiComponent ( - createMxsrRepresentationComponent ()); - - // populate the library's passes list - pLibraryComponent-> - appendPassToMultiComponent ( - createMsr2msrComponent ()); - - pLibraryComponent-> - appendPassToMultiComponent ( - createMsr2lpsrComponent ()); - pLibraryComponent-> - appendPassToMultiComponent ( - createLpsr2lilypondComponent ()); - - pLibraryComponent-> - appendPassToMultiComponent ( - createMsr2bsrComponent ()); - pLibraryComponent-> - appendPassToMultiComponent ( - createBsr2bsrComponent ()); - pLibraryComponent-> - appendPassToMultiComponent ( - createBsr2brailleComponent ()); - - pLibraryComponent-> - appendPassToMultiComponent ( - createMsr2mxsrComponent ()); - - pLibraryComponent-> - appendPassToMultiComponent ( - createMxsr2musicxmlComponent ()); - - pLibraryComponent-> - appendPassToMultiComponent ( - createMxsr2guidoComponent ()); - - // populate the library's converters list - pLibraryComponent-> - appendConverterToMultiComponent ( - createMusicxml2lilypondConverterComponent ()); - - pLibraryComponent-> - appendConverterToMultiComponent ( - createMusicxml2brailleConverterComponent ()); - - pLibraryComponent-> - appendConverterToMultiComponent ( - createMusicxml2musicxmlConverterComponent ()); - - pLibraryComponent-> - appendConverterToMultiComponent ( - createMusicxml2guidoConverterComponent ()); - - - pLibraryComponent-> - appendConverterToMultiComponent ( - createMsdl2lilypondConverterComponent ()); - - pLibraryComponent-> - appendConverterToMultiComponent ( - createMsdl2brailleConverterComponent ()); - - pLibraryComponent-> - appendConverterToMultiComponent ( - createMsdl2musicxmlConverterComponent ()); - - pLibraryComponent-> - appendConverterToMultiComponent ( - createMsdl2guidoConverterComponent ()); - - pLibraryComponent-> - appendConverterToMultiComponent ( - createMsdlConverterConverterComponent ()); - - - pLibraryComponent-> - appendConverterToMultiComponent ( - createMsr2lilypondConverterComponent ()); - - pLibraryComponent-> - appendConverterToMultiComponent ( - createMsr2brailleConverterComponent ()); - - pLibraryComponent-> - appendConverterToMultiComponent ( - createMsr2musicxmlConverterComponent ()); - - pLibraryComponent-> - appendConverterToMultiComponent ( - createMsr2guidoConverterComponent ()); - - // populate the library's own history - pLibraryComponent-> - appendVersionToComponent ( - mfcVersion::create ( - mfcVersionNumber::createFromString ("0.9.50"), - "October 6, 2021", - std::list { - "Start of sequential versions numbering" - } - )); - - pLibraryComponent-> - appendVersionToComponent ( - mfcVersion::create ( - mfcVersionNumber::createFromString ("0.9.70"), - "February 20, 2024", - std::list { - "Many, many changes in the code base" - } - )); - } - - return pLibraryComponent; -} - - -} diff --git a/src/mflibrary/mfLibraryComponent.h b/src/mflibrary/mfLibraryComponent.h deleted file mode 100644 index 3b6cbcee..00000000 --- a/src/mflibrary/mfLibraryComponent.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfLibraryComponent__ -#define ___mfLibraryComponent__ - -#include "exports.h" - -#include "mfcBasicTypes.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ - -EXP extern std::string getGlobalMusicFormatsVersionNumber (); -EXP extern std::string getGlobalMusicFormatsVersionDate (); - -EXP extern std::string getGlobalMusicFormatsVersionNumberAndDate (); - -//______________________________________________________________________________ -S_mfcLibraryComponent EXP createLibraryComponent (); - - -} - - -#endif // ___mfLibraryComponent__ - diff --git a/src/mflibrary/mfList.cpp b/src/mflibrary/mfList.cpp deleted file mode 100644 index 4d550bef..00000000 --- a/src/mflibrary/mfList.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include "smartpointer.h" - -#include "mfIndentedTextOutput.h" -#include "mfStringsHandling.h" - -#include "mfList.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -template -SMARTP> mfList::create () -{ - mfList* obj = new - mfList (); - assert (obj != nullptr); - return obj; -} - -template -SMARTP> mfList::create ( - const ELEMENT_TYPE& element) -{ - mfList* obj = new - mfList ( - element); - assert (obj != nullptr); - return obj; -} - -template -mfList::mfList () -{} - -template -mfList::mfList ( - const ELEMENT_TYPE& element) -{ - fElementsStdList.push_back (element); -} - -template -mfList::~mfList () -{} - -//______________________________________________________________________________ -template -Bool mfList::contains ( - const ELEMENT_TYPE& value) const -{ - Bool result; - - for (ELEMENT_TYPE element : fElementsStdList) { - if (element == value) { - result = true; - break; - } - } // for - - return result; -} - -//______________________________________________________________________________ -template -void mfList::sortByDecreasingIdentity () -{ - fElementsStdList.sort ( - ELEMENT_TYPE::compareElementsByDecreasingIdentity); -} - -//______________________________________________________________________________ -template -void mfList::print (std::ostream& os) const -{ - os << - "[mfList" << - ", fElementListName: " << fElementListName << ':'; - - if (fElementsStdList.size ()) { - os << std::endl; - - ++gIndenter; - - for (ELEMENT_TYPE element : fElementsStdList) { - os << - element->asString () << - std::endl; - } // for - - --gIndenter; - } - - else { - os << - " [EMPTY]" << - std::endl; - } - - os << ']' << std::endl; -} - -template -void mfList::printWithContext ( - const std::string& context, - char evidencer, - std::ostream& os) const -{ - size_t - theElementsStdListSize = - fElementsStdList.size (); - - os << - "[mfList" << - ", fElementListName: \"" << fElementListName << "\"" << - ", " << - mfSingularOrPlural ( - theElementsStdListSize, "element", "elements") << - " -- " << - context << - ':'; - - if (fElementsStdList.size ()) { - os << std::endl; - - ++gIndenter; - - int counter = theElementsStdListSize - 1; - for (ELEMENT_TYPE element : fElementsStdList) { - os << - counter << ": " << evidencer << - std::endl; - - ++gIndenter; - os << - element << - std::endl; - --gIndenter; - - --counter; - } // for - - --gIndenter; - } - - else { - os << - " [EMPTY]" << - std::endl; - } - - os << ']' << std::endl; -} - -template -std::ostream& operator << (std::ostream& os, const mfList& elt) -{ - elt.print (os); - return os; -} - -template -std::ostream& operator << (std::ostream& os, const SMARTP>& elt) -{ - elt->print (os); - return os; -} - - -} diff --git a/src/mflibrary/mfList.h b/src/mflibrary/mfList.h deleted file mode 100644 index 4023364a..00000000 --- a/src/mflibrary/mfList.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfList___ -#define ___mfList___ - -#include - -#include "exports.h" -#include "smartpointer.h" - - -using namespace MusicXML2; - -namespace MusicFormats -{ - -//______________________________________________________________________________ -template -class EXP mfList : public smartable -{ - public: - - // creation - // ------------------------------------------------------ - - static SMARTP create (); - - static SMARTP create (const ELEMENT_TYPE& element); - - // constructors/destructor - // ------------------------------------------------------ - - mfList (); - - mfList (const ELEMENT_TYPE& element); - - virtual ~mfList (); - - public: - - // set and get - // ------------------------------------------------------ - - const std::list & - getElementsStdList () const - { return fElementsStdList;} - - public: - - // public services - // ------------------------------------------------------ - - // basic list stuff - size_t size () const - { return fElementsStdList.size (); } - - ELEMENT_TYPE& front () - { return fElementsStdList.front (); } - - ELEMENT_TYPE& back () - { return fElementsStdList.back (); } - - void pop_front () - { fElementsStdList.pop_front (); } - - void pop_back () - { fElementsStdList.pop_back (); } - - void push_front ( - const ELEMENT_TYPE& element) - { fElementsStdList.push_front (element); } - - void push_back ( - const ELEMENT_TYPE& element) - { fElementsStdList.push_back (element); } - - // specific list stuff - Bool contains ( - const ELEMENT_TYPE& value) const; - - // sort - void sortByDecreasingIdentity(); - - public: - - // print - // ------------------------------------------------------ - - void print (std::ostream& os) const; - - void printWithContext ( - const std::string& context, - char evidencer, - std::ostream& os) const; - - private: - - // private fields - // ------------------------------------------------------ - - std::string fElementListName; - - std::list - fElementsStdList; -}; - -template -EXP std::ostream& operator << (std::ostream& os, const mfList& elt); - -template -EXP std::ostream& operator << (std::ostream& os, const SMARTP>& elt); - - -} - - -#endif // ___mfList___ diff --git a/src/mflibrary/mfMultiGenerationOah.cpp b/src/mflibrary/mfMultiGenerationOah.cpp deleted file mode 100644 index 63afa826..00000000 --- a/src/mflibrary/mfMultiGenerationOah.cpp +++ /dev/null @@ -1,778 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include // setw()), set::precision(), ... - -#include - -#include "visitor.h" -#include "oahWae.h" - -#include "mfConstants.h" -#include "mfPreprocessorSettings.h" - -#include "mfAssert.h" -#include "mfConstants.h" -#include "mfServices.h" -#include "mfStringsHandling.h" - -#include "oahOah.h" - -#include "oahEarlyOptions.h" - -#include "mfConstants.h" - -#include "mfMultiGenerationOah.h" - -#include "waeHandlers.h" - - -namespace MusicFormats -{ - -//_______________________________________________________________________________ -// constants -const std::string K_GENERATED_OUTPUT_KIND_LIlYPOND_NAME = "lilypond"; -const std::string K_GENERATED_OUTPUT_KIND_BRAILLE_NAME = "braille"; -const std::string K_GENERATED_OUTPUT_KIND_MUSICXML_NAME = "musicxml"; -const std::string K_GENERATED_OUTPUT_KIND_GUIDO_NAME = "guido"; -const std::string K_GENERATED_OUTPUT_KIND_MIDI_NAME = "midi"; - -//______________________________________________________________________________ -std::string mfMultiGenerationOutputKindAsString ( - mfMultiGenerationOutputKind multiGenerationOutputKind) -{ - // no CamelCase here, these strings are used in the command line options - std::string result; - - switch (multiGenerationOutputKind) { - case mfMultiGenerationOutputKind::kGeneration_UNKNOWN_: - result = "*kGeneration_UNKNOWN_*"; - break; - case mfMultiGenerationOutputKind::kGenerationLilypond: - result = "LilyPond"; - break; - case mfMultiGenerationOutputKind::kGenerationBraille: - result = "braille"; - break; - case mfMultiGenerationOutputKind::kGenerationMusicXML: - result = "MusicXML"; - break; - case mfMultiGenerationOutputKind::kGenerationGuido: - result = "Guido"; - break; - case mfMultiGenerationOutputKind::kGenerationMidi: - result = "MIDI"; - break; - } // switch - - return result; -} - -std::ostream& operator << (std::ostream& os, const mfMultiGenerationOutputKind& elt) -{ - os << mfMultiGenerationOutputKindAsString (elt); - return os; -} - -EXP mfMultiGenerationOutputKind mfMultiGenerationOutputKindFromString ( - const std::string& theString) -{ - mfMultiGenerationOutputKind - result = - mfMultiGenerationOutputKind::kGeneration_UNKNOWN_; - - if (theString == K_GENERATED_OUTPUT_KIND_LIlYPOND_NAME) { - result = mfMultiGenerationOutputKind::kGenerationLilypond; - } - else if (theString == K_GENERATED_OUTPUT_KIND_BRAILLE_NAME) { - result = mfMultiGenerationOutputKind::kGenerationBraille; - } - else if (theString == K_GENERATED_OUTPUT_KIND_MUSICXML_NAME) { - result = mfMultiGenerationOutputKind::kGenerationMusicXML; - } - else if (theString == K_GENERATED_OUTPUT_KIND_GUIDO_NAME) { - result = mfMultiGenerationOutputKind::kGenerationGuido; - } - else if (theString == K_GENERATED_OUTPUT_KIND_MIDI_NAME) { - result = mfMultiGenerationOutputKind::kGenerationMidi; - } - else { - // theString is no generated output kind - } - - return result; -} - -std::map - gGlobalMultiGenerationOutputKindsMap; - -void initializeMultiGenerationOutputKindsMap () -{ - gGlobalMultiGenerationOutputKindsMap [K_GENERATED_OUTPUT_KIND_LIlYPOND_NAME] = - mfMultiGenerationOutputKind::kGenerationLilypond; - gGlobalMultiGenerationOutputKindsMap [K_GENERATED_OUTPUT_KIND_BRAILLE_NAME] = - mfMultiGenerationOutputKind::kGenerationBraille; - gGlobalMultiGenerationOutputKindsMap [K_GENERATED_OUTPUT_KIND_MUSICXML_NAME] = - mfMultiGenerationOutputKind::kGenerationMusicXML; - gGlobalMultiGenerationOutputKindsMap [K_GENERATED_OUTPUT_KIND_GUIDO_NAME] = - mfMultiGenerationOutputKind::kGenerationGuido; - gGlobalMultiGenerationOutputKindsMap [K_GENERATED_OUTPUT_KIND_MIDI_NAME] = - mfMultiGenerationOutputKind::kGenerationMidi; -} - -std::string availableMultiGenerationOutputKinds (size_t namesListMaxLength) -{ - std::stringstream ss; - - size_t brailleOutputKindsMapSize = - gGlobalMultiGenerationOutputKindsMap.size (); - - if (brailleOutputKindsMapSize) { - size_t nextToLast = - brailleOutputKindsMapSize - 1; - - size_t count = 0; - size_t cumulatedLength = 0; - - for ( - std::map ::const_iterator i = - gGlobalMultiGenerationOutputKindsMap.begin (); - i != gGlobalMultiGenerationOutputKindsMap.end (); - ++i - ) { - std::string theString = (*i).first; - - ++count; - - cumulatedLength += theString.size (); - if (cumulatedLength >= namesListMaxLength) { - ss << std::endl << gIndenter.getSpacer (); - cumulatedLength = 0; - } - - if (count == 1) { - ss << gIndenter.getSpacer (); - } - ss << theString; - - if (count == nextToLast) { - ss << " and "; - } - else if (count != brailleOutputKindsMapSize) { - ss << ", "; - } - } // for - } - - return ss.str (); -} - -//______________________________________________________________________________ -EXP mfMultiGenerationOutputKind fetchGeneratedOutputKindFromRunData () -{ - mfMultiGenerationOutputKind - result = - mfMultiGenerationOutputKind::kGeneration_UNKNOWN_; -// -// // analyze the options -// const std::vector & -// optionsVector = -// gServiceRunData-> -// getOptionsAndArguments ().getOptionsVector (); -// -// if (optionsVector.size ()) { -// for (size_t i = 0; i < optionsVector.size (); ++i) { -// std::string optionName = -// optionsVector [i].getOptionName (); -// std::string optionValue = -// optionsVector [i].getOptionValue (); -// -// std::string optionNameWithoutDash = optionName.substr (1); -// -// // gLog << JMI -// // "optionName: " << optionName << -// // ", optionValue: " << optionValue << -// // ", optionNameWithoutDash: " << optionNameWithoutDash << -// // std::endl; -// -// // is optionNameWithoutDash one of the multi generators output kinds? -// mfMultiGenerationOutputKind -// newMultiGenerationOutputKind = -// mfMultiGenerationOutputKindFromString ( -// optionNameWithoutDash); -// -// if (newMultiGenerationOutputKind != mfMultiGenerationOutputKind::kGeneration_UNKNOWN_) { -// // yes, optionNameWithoutDash is a multi generators output kind -// if (result != mfMultiGenerationOutputKind::kGeneration_UNKNOWN_) { -// std::stringstream ss; -// -// ss << -// "mfMultiGenerationOutputKindAtom generated output kind specified more that once" << -// std::endl; -// -// oahError (ss.str ()); -// } -// else { -// result = newMultiGenerationOutputKind; -// } -// } -// -// else { -// // no, , optionNameWithoutDash is NO multi generators output kind -// } -// } //for -// } -// - gLog << // JMIJMIJMI - "result: " << - mfMultiGenerationOutputKindAsString (result) << - std::endl; - - return result; -} - -//______________________________________________________________________________ -S_mfMultiGenerationOutputKindAtom mfMultiGenerationOutputKindAtom::create ( - const std::string& longName, - const std::string& shortName, - const std::string& description, - const std::string& variableName, - mfMultiGenerationOutputKind& - multiGenerationOutputKindVariable, - mfMultiGenerationOutputKind - multiGenerationOutputKindValue) -{ - mfMultiGenerationOutputKindAtom* obj = new - mfMultiGenerationOutputKindAtom ( - longName, - shortName, - description, - variableName, - multiGenerationOutputKindVariable, - multiGenerationOutputKindValue); - assert (obj != nullptr); - return obj; -} - -mfMultiGenerationOutputKindAtom::mfMultiGenerationOutputKindAtom ( - const std::string& longName, - const std::string& shortName, - const std::string& description, - const std::string& variableName, - mfMultiGenerationOutputKind& - multiGenerationOutputKindVariable, - mfMultiGenerationOutputKind - multiGenerationOutputKindValue) - : oahAtomImplicitlySettingAVariable ( - longName, - shortName, - description, - variableName), - fMultiGenerationOutputKindVariable ( - multiGenerationOutputKindVariable), - fMultiGenerationOutputKindValue ( // this is where the value is supplied - multiGenerationOutputKindValue) -{ - fMultiGenerationOutputKindVariable = - mfMultiGenerationOutputKind::kGeneration_UNKNOWN_; -} - -mfMultiGenerationOutputKindAtom::~mfMultiGenerationOutputKindAtom () -{} - -void mfMultiGenerationOutputKindAtom::setImplicitVariable (std::ostream& os) -{ -#ifdef MF_TRACE_IS_ENABLED - if (gEarlyOptions.getTraceEarlyOptions ()) { - std::stringstream ss; - - ss << - "==> handling atom '" << - fetchNames () << - "; which is of type 'mfMultiGenerationOutputKindAtom'"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - if (fSelected) { - std::stringstream ss; - - ss << - "mfMultiGenerationOutputKindAtom generated output kind" << // JMI ??? - " set more than once" << - std::endl; - - oahError (ss.str ()); - } - else { - fMultiGenerationOutputKindVariable = fMultiGenerationOutputKindValue; - } - - fSelected = true; -} - -void mfMultiGenerationOutputKindAtom::acceptIn (basevisitor* v) -{ -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> mfMultiGenerationOutputKindAtom::acceptIn ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - if (visitor* - p = - dynamic_cast*> (v)) { - S_mfMultiGenerationOutputKindAtom elem = this; - -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> Launching mfMultiGenerationOutputKindAtom::visitStart ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - p->visitStart (elem); - } -} - -void mfMultiGenerationOutputKindAtom::acceptOut (basevisitor* v) -{ -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> mfMultiGenerationOutputKindAtom::acceptOut ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - if (visitor* - p = - dynamic_cast*> (v)) { - S_mfMultiGenerationOutputKindAtom elem = this; - -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> Launching mfMultiGenerationOutputKindAtom::visitEnd ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - p->visitEnd (elem); - } -} - -void mfMultiGenerationOutputKindAtom::browseData (basevisitor* v) -{ -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> mfMultiGenerationOutputKindAtom::browseData ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED -} - -std::string mfMultiGenerationOutputKindAtom::asShortNamedOptionString () const -{ - std::stringstream ss; - - ss << - '-' << fShortName << ' ' << - mfMultiGenerationOutputKindAsString ( - fMultiGenerationOutputKindVariable); - - return ss.str (); -} - -std::string mfMultiGenerationOutputKindAtom::asActualLongNamedOptionString () const -{ - std::stringstream ss; - - ss << - '-' << fLongName << ' ' << - mfMultiGenerationOutputKindAsString ( - fMultiGenerationOutputKindVariable); - - return ss.str (); -} - -void mfMultiGenerationOutputKindAtom::print (std::ostream& os) const -{ - constexpr int fieldWidth = K_OAH_FIELD_WIDTH; - - os << - "MultiGenerationOutputKindAtom:" << - std::endl; - - ++gIndenter; - - printAtomWithVariableEssentials ( - os, fieldWidth); - - os << std::left << - std::setw (fieldWidth) << - "fVariableName" << ": " << - fVariableName << - std::endl << - std::setw (fieldWidth) << - "fMultiGenerationOutputKindVariable" << ": " << - mfMultiGenerationOutputKindAsString ( - fMultiGenerationOutputKindVariable) << - std::endl << - std::setw (fieldWidth) << - "fMultiGenerationOutputKindValue" << ": " << - mfMultiGenerationOutputKindAsString ( - fMultiGenerationOutputKindValue) << - std::endl; - - --gIndenter; -} - -void mfMultiGenerationOutputKindAtom::displayAtomWithVariableOptionsValues ( - std::ostream& os, - int valueFieldWidth) const -{ - os << std::left << - std::setw (valueFieldWidth) << - fVariableName << - ": " << - fMultiGenerationOutputKindVariable; - switch (fEarlyOptionKind) { - case oahEarlyOptionKind::kEarlyOptionNo: - break; - case oahEarlyOptionKind::kEarlyOptionYes: - os << - ", early"; - break; - } // switch - if (fSelected) { - os << ", selected"; - } - os << std::endl; -} - -std::ostream& operator << (std::ostream& os, const S_mfMultiGenerationOutputKindAtom& elt) -{ - if (elt) { - elt->print (os); - } - else { - os << "[NULL]" << std::endl; - } - - return os; -} - -//_______________________________________________________________________________ -S_multiGenerationOahGroup gGlobalMultiGenerationOahGroup; - -S_multiGenerationOahGroup mfMultiGenerationOahGroup::create () -{ - mfMultiGenerationOahGroup* obj = new mfMultiGenerationOahGroup (); - assert (obj != nullptr); - return obj; -} - -mfMultiGenerationOahGroup::mfMultiGenerationOahGroup () - : oahGroup ( - "Multi generator", - "help-multi-generator", "hmg", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole) -{ - initializeMultiGenerationOahGroup (); -} - -mfMultiGenerationOahGroup::~mfMultiGenerationOahGroup () -{} - -void mfMultiGenerationOahGroup::initializeMultiGenerationOahGroup () -{ - initializeMultiGenerationOutputKindsMap (); - - // generator output kind - // -------------------------------------- - - initializeMultiGenerationOutputKindOptions (); -} - -void mfMultiGenerationOahGroup::initializeMultiGenerationOutputKindOptions () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Generated output", - "help-generated-output", "hgc", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // lilypond output - - subGroup-> - appendAtomToSubGroup ( - mfMultiGenerationOutputKindAtom::create ( - K_GENERATED_OUTPUT_KIND_LIlYPOND_NAME, "", -R"(Generate LilyPond code as output (default value).)", - "fMultiGenerationOutputKind", - fMultiGenerationOutputKind, - mfMultiGenerationOutputKind::kGenerationLilypond)); - - // braille output - - subGroup-> - appendAtomToSubGroup ( - mfMultiGenerationOutputKindAtom::create ( - K_GENERATED_OUTPUT_KIND_BRAILLE_NAME, "", -R"(Generate braille code as output.)", - "fMultiGenerationOutputKind", - fMultiGenerationOutputKind, - mfMultiGenerationOutputKind::kGenerationBraille)); - - // musicxml output - - subGroup-> - appendAtomToSubGroup ( - mfMultiGenerationOutputKindAtom::create ( - K_GENERATED_OUTPUT_KIND_MUSICXML_NAME, "", -R"(Generate MusicXML code as output.)", - "fMultiGenerationOutputKind", - fMultiGenerationOutputKind, - mfMultiGenerationOutputKind::kGenerationMusicXML)); - - // guido output - - subGroup-> - appendAtomToSubGroup ( - mfMultiGenerationOutputKindAtom::create ( - K_GENERATED_OUTPUT_KIND_GUIDO_NAME, "", -R"(Generate Guido code as output.)", - "fMultiGenerationOutputKind", - fMultiGenerationOutputKind, - mfMultiGenerationOutputKind::kGenerationGuido)); - - // MIDI output - -// subGroup-> -// appendAtomToSubGroup ( -// mfMultiGenerationOutputKindAtom::create ( -// K_GENERATED_OUTPUT_KIND_MIDI_NAME, "", -// R"(Generate MIDI code as output.)", -// "fMultiGenerationOutputKind", -// fMultiGenerationOutputKind, -// mfMultiGenerationOutputKind::kGenerationMidi)); -} - -//______________________________________________________________________________ -void mfMultiGenerationOahGroup::enforceGroupQuietness () -{ - fMultiGenerationOutputKindAtom = mfMultiGenerationOutputKind::kGeneration_UNKNOWN_; -} - -//______________________________________________________________________________ -void mfMultiGenerationOahGroup::checkGroupOptionsConsistency () -{ - // JMI -} - -//______________________________________________________________________________ -void mfMultiGenerationOahGroup::acceptIn (basevisitor* v) -{ -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> mfMultiGenerationOahGroup::acceptIn ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - if (visitor* - p = - dynamic_cast*> (v)) { - S_multiGenerationOahGroup elem = this; - -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> Launching mfMultiGenerationOahGroup::visitStart ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - p->visitStart (elem); - } -} - -void mfMultiGenerationOahGroup::acceptOut (basevisitor* v) -{ -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> mfMultiGenerationOahGroup::acceptOut ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - if (visitor* - p = - dynamic_cast*> (v)) { - S_multiGenerationOahGroup elem = this; - -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> Launching mfMultiGenerationOahGroup::visitEnd ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - p->visitEnd (elem); - } -} - -void mfMultiGenerationOahGroup::browseData (basevisitor* v) -{ -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> mfMultiGenerationOahGroup::browseData ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED -} - -//______________________________________________________________________________ -void mfMultiGenerationOahGroup::displayMultiGenerationOahValues (int fieldWidth) -{ - gLog << - "The MultiGeneration options are:" << - std::endl; - - ++gIndenter; - - // Output kind - // -------------------------------------- - - gLog << std::left << - std::setw (fieldWidth) << "Multigenerator output kind:" << - std::endl; - - ++gIndenter; - - gLog << - std::setw (fieldWidth) << "fMultiGenerationOutputKind" << ": " << - mfMultiGenerationOutputKindAsString ( - fMultiGenerationOutputKind) << - std::endl; - - --gIndenter; - - --gIndenter; -} - -std::ostream& operator << (std::ostream& os, const S_multiGenerationOahGroup& elt) -{ - if (elt) { - elt->print (os); - } - else { - os << "[NULL]" << std::endl; - } - - return os; -} - -//______________________________________________________________________________ -S_multiGenerationOahGroup createGlobalMultiGenerationOahGroup () -{ -#ifdef MF_TRACE_IS_ENABLED - if (gEarlyOptions.getTraceEarlyOptions ()) { - std::stringstream ss; - - ss << - "Creating multi generator OAH group"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - // protect library against multiple initializations - if (! gGlobalMultiGenerationOahGroup) { - // create the multi generator options group - gGlobalMultiGenerationOahGroup = - mfMultiGenerationOahGroup::create (); - assert (gGlobalMultiGenerationOahGroup != 0); - } - - // return the multi generator OAH group - return gGlobalMultiGenerationOahGroup; -} - - -} diff --git a/src/mflibrary/mfMultiGenerationOah.h b/src/mflibrary/mfMultiGenerationOah.h deleted file mode 100644 index 2db0f1e5..00000000 --- a/src/mflibrary/mfMultiGenerationOah.h +++ /dev/null @@ -1,243 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___multiGeneration___ -#define ___multiGeneration___ - -#include - -#include "oahBasicTypes.h" - -#include "oahAtomsCollection.h" - - -namespace MusicFormats -{ - -//_______________________________________________________________________________ -// constants -EXP extern const std::string K_GENERATED_OUTPUT_KIND_LIlYPOND_NAME; -EXP extern const std::string K_GENERATED_OUTPUT_KIND_BRAILLE_NAME; -EXP extern const std::string K_GENERATED_OUTPUT_KIND_MUSICXML_NAME; -EXP extern const std::string K_GENERATED_OUTPUT_KIND_GUIDO_NAME; -EXP extern const std::string K_GENERATED_OUTPUT_KIND_MIDI_NAME; - -//______________________________________________________________________________ -enum class mfMultiGenerationOutputKind { - kGeneration_UNKNOWN_, - kGenerationLilypond, - kGenerationBraille, - kGenerationMusicXML, - kGenerationGuido, - kGenerationMidi -}; - -EXP extern std::string mfMultiGenerationOutputKindAsString ( - mfMultiGenerationOutputKind multiGenerationOutputKind); - -std::ostream& operator << (std::ostream& os, const mfMultiGenerationOutputKind& elt); - -EXP extern mfMultiGenerationOutputKind mfMultiGenerationOutputKindFromString ( - const std::string& theString); - -extern std::map - gGlobalMultiGenerationOutputKindsMap; - -std::string availableMultiGenerationOutputKinds (size_t namesListMaxLength); - -void initializeMultiGenerationOutputKindsMap (); - -//______________________________________________________________________________ -EXP extern mfMultiGenerationOutputKind fetchGeneratedOutputKindFromRunData (); - -//______________________________________________________________________________ -class EXP mfMultiGenerationOutputKindAtom : public oahAtomImplicitlySettingAVariable -{ - public: - - // creation - // ------------------------------------------------------ - - static SMARTP create ( - const std::string& longName, - const std::string& shortName, - const std::string& description, - const std::string& variableName, - mfMultiGenerationOutputKind& - multiGenerationOutputKindVariable, - mfMultiGenerationOutputKind - multiGenerationOutputKindValue); - - protected: - - // constructors/destructor - // ------------------------------------------------------ - - mfMultiGenerationOutputKindAtom ( - const std::string& longName, - const std::string& shortName, - const std::string& description, - const std::string& variableName, - mfMultiGenerationOutputKind& - multiGenerationOutputKindVariable, - mfMultiGenerationOutputKind - multiGenerationOutputKindValue); - - virtual ~mfMultiGenerationOutputKindAtom (); - - public: - - // set and get - // ------------------------------------------------------ - - mfMultiGenerationOutputKind& - getMultiGenerationOutputKindVariable () const - { return fMultiGenerationOutputKindVariable; } - mfMultiGenerationOutputKind - getMultiGenerationOutputKindValue () const - { return fMultiGenerationOutputKindValue; } - - public: - - // public services - // ------------------------------------------------------ - - void applyValueLessAtom (std::ostream& os) override - { setImplicitVariable (os); } - - void setImplicitVariable (std::ostream& os) override; - - public: - - // visitors - // ------------------------------------------------------ - - void acceptIn (basevisitor* v) override; - void acceptOut (basevisitor* v) override; - - void browseData (basevisitor* v) override; - - public: - - // print - // ------------------------------------------------------ - - std::string asShortNamedOptionString () const override; - std::string asActualLongNamedOptionString () const override; - - void print (std::ostream& os) const override; - - void displayAtomWithVariableOptionsValues ( - std::ostream& os, - int valueFieldWidth) const override; - - private: - - // private fields - // ------------------------------------------------------ - - mfMultiGenerationOutputKind& - fMultiGenerationOutputKindVariable; - mfMultiGenerationOutputKind - fMultiGenerationOutputKindValue; -}; -typedef SMARTP S_mfMultiGenerationOutputKindAtom; -EXP std::ostream& operator << (std::ostream& os, const S_mfMultiGenerationOutputKindAtom& elt); - -//______________________________________________________________________________ -class EXP mfMultiGenerationOahGroup : public oahGroup -{ - public: - - static SMARTP create (); - - public: - - // initialisation - // ------------------------------------------------------ - - void initializeMultiGenerationOahGroup (); - - protected: - - // constructors/destructor - // ------------------------------------------------------ - - mfMultiGenerationOahGroup (); - - virtual ~mfMultiGenerationOahGroup (); - - public: - - // set and get - // ------------------------------------------------------ - - mfMultiGenerationOutputKind - getMultiGenerationOutputKind () const - { return fMultiGenerationOutputKind; } - - public: - - // public services - // ------------------------------------------------------ - - // quiet mode - void enforceGroupQuietness () override; - - // consistency check - void checkGroupOptionsConsistency () override; - - private: - - // private services - // ------------------------------------------------------ - - void initializeMultiGenerationOutputKindOptions (); - - public: - - // visitors - // ------------------------------------------------------ - - void acceptIn (basevisitor* v) override; - void acceptOut (basevisitor* v) override; - - void browseData (basevisitor* v) override; - - public: - - // print - // ------------------------------------------------------ - - void printMultiGenerationOahHelp (); - - void displayMultiGenerationOahValues (int fieldWidth); - - private: - - mfMultiGenerationOutputKind - fMultiGenerationOutputKind; - S_mfMultiGenerationOutputKindAtom - fMultiGenerationOutputKindAtom; -}; -typedef SMARTP S_multiGenerationOahGroup; -EXP std::ostream& operator << (std::ostream& os, const S_multiGenerationOahGroup& elt); - -EXP extern S_multiGenerationOahGroup gGlobalMultiGenerationOahGroup; - -//______________________________________________________________________________ -EXP S_multiGenerationOahGroup createGlobalMultiGenerationOahGroup (); - - -} - - -#endif // ___multiGeneration___ diff --git a/src/mflibrary/mfMusicformatsErrors.cpp b/src/mflibrary/mfMusicformatsErrors.cpp deleted file mode 100644 index 90548a1e..00000000 --- a/src/mflibrary/mfMusicformatsErrors.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include "mfMusicformatsErrors.h" - - -namespace MusicFormats -{ - -EXP std::string mfMusicFormatsErrorAsString ( - mfMusicformatsErrorKind err) -{ - std::string result; - - switch (err) { - case mfMusicformatsErrorKind::kMusicformatsError_NONE: - result = "no error"; - break; - case mfMusicformatsErrorKind::kMusicformatsErrorInvalidFile: - result = "invalid file"; - break; - case mfMusicformatsErrorKind::kMusicformatsErrorInvalidOption: - result = "invalid option"; - break; - case mfMusicformatsErrorKind::kMusicformatsErrorUnsupported: - result = "unsupported"; - break; - } // switch - - return result; -} - -std::ostream& operator << (std::ostream& os, const mfMusicformatsErrorKind& elt) -{ - os << mfMusicFormatsErrorAsString (elt) << std::endl; - return os; -} - - -} diff --git a/src/mflibrary/mfMusicformatsErrors.h b/src/mflibrary/mfMusicformatsErrors.h deleted file mode 100644 index 25acf5b9..00000000 --- a/src/mflibrary/mfMusicformatsErrors.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___musicformatsError___ -#define ___musicformatsError___ - -#include "exports.h" - -#include -#include - - -namespace MusicFormats -{ - -enum class mfMusicformatsErrorKind { - kMusicformatsError_NONE, - kMusicformatsErrorInvalidFile, - kMusicformatsErrorInvalidOption, - kMusicformatsErrorUnsupported -}; - -EXP std::string mfMusicFormatsErrorAsString ( - mfMusicformatsErrorKind err); - -std::ostream& operator << (std::ostream& os, const mfMusicformatsErrorKind& elt); - - -} - - -#endif // ___musicformatsError___ diff --git a/src/mflibrary/mfOnOff.cpp b/src/mflibrary/mfOnOff.cpp deleted file mode 100644 index f50346fe..00000000 --- a/src/mflibrary/mfOnOff.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include "languageInterface.h" - -#include "mfOnOff.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -Bool mfOnOffKindAsBool ( - mfOnOffKind onOffKind) -{ - Bool result; - - switch (onOffKind) { - case mfOnOffKind::kMfOnOffUnknown: - { - mfError ( - __FILE__, __LINE__, - "mfOnOffKind::kMfOnOffUnknown cannot be converted to Bool"); - } - break; - case mfOnOffKind::kMfOnOffOn: - result = true; - break; - case mfOnOffKind::kMfOnOffOff: - result = false; - break; - } // switch - - return result; -} - -std::string mfOnOffKindAsString ( - mfOnOffKind onOffKind) -{ - std::string result; - - // no CamelCase here, these strings are used in the command line options - - switch (onOffKind) { - case mfOnOffKind::kMfOnOffUnknown: - result = "unknown"; - break; - case mfOnOffKind::kMfOnOffOn: - result = "on"; - break; - case mfOnOffKind::kMfOnOffOff: - result = "off"; - break; - } // switch - - return result; -} - -std::ostream& operator << (std::ostream& os, const mfOnOffKind elt) -{ - os << mfOnOffKindAsString (elt); - return os; -} - - -} - diff --git a/src/mflibrary/mfOnOff.h b/src/mflibrary/mfOnOff.h deleted file mode 100644 index 231be782..00000000 --- a/src/mflibrary/mfOnOff.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfOnOff___ -#define ___mfOnOff___ - -#include -#include - -#include "exports.h" - -#include "mfBool.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -enum class mfOnOffKind { - kMfOnOffUnknown, - kMfOnOffOn, kMfOnOffOff -}; - -Bool mfOnOffKindAsBool ( - mfOnOffKind onOffKind); - -std::string mfOnOffKindAsString ( - mfOnOffKind onOffKind); - -std::ostream& operator << (std::ostream& os, const mfOnOffKind elt); - - -} - - -#endif // ___mfOnOff___ diff --git a/src/mflibrary/mfOutputFileOah.cpp b/src/mflibrary/mfOutputFileOah.cpp deleted file mode 100644 index f797dd07..00000000 --- a/src/mflibrary/mfOutputFileOah.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include // std::setw, std::setprecision, ... -#include - -#include "visitor.h" - -#include "mfPreprocessorSettings.h" - -#include "mfStringsHandling.h" - -#include "oahOah.h" - -#include "mfOutputFileOah.h" - -#include "oahEarlyOptions.h" - -#include "oahAtomsCollection.h" - -#include "waeHandlers.h" - - -namespace MusicFormats -{ - -//_______________________________________________________________________________ -S_outputFileOahGroup gGlobalOutputFileOahGroup; - -S_outputFileOahGroup outputFileOahGroup::create () -{ - outputFileOahGroup* obj = new outputFileOahGroup (); - assert (obj != nullptr); - return obj; -} - -outputFileOahGroup::outputFileOahGroup () - : oahGroup ( - "OutputFile", - "help-output-file-group", "hofg", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole) -{ - initializeOutputFileOah (); -} - -outputFileOahGroup::~outputFileOahGroup () -{} - -void outputFileOahGroup::initializeOutputFileOah () -{ - // output file name - // -------------------------------------- - initializeOutputFileNameOptions (); -} - -void outputFileOahGroup::initializeOutputFileNameOptions () -{ -#ifdef MF_TRACE_IS_ENABLED - if (gEarlyOptions.getTraceEarlyOptions ()) { - gLog << std::left << - "Creating insider output file subgroup in \"" << - fGroupHeader << - "\"" << - std::endl; - } -#endif // MF_TRACE_IS_ENABLED - - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Output file", - "help-output-file", "hof", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // output filename - - fOutputFileNameStringAtom = - oahStringAtom::create ( - "output-file-name", "o", -R"(Write output to file FILENAME instead of standard output.)", - "FILENAME", - "fOutputFileName", - fOutputFileName); - - subGroup-> - appendAtomToSubGroup ( - fOutputFileNameStringAtom); - - // auto output filename - - fAutoOutputFileNameAtom = - oahBooleanAtom::create ( - "auto-output-file-name", "aofn", -R"(This option can only be used when writing to a file. -Write the output to a file in the current working directory. -The file name is derived from that of the input file: -any suffix after the '.' is replaced by one suited for the output format, -or such a suffix is adde if no '.' is present.)", - "fAutoOutputFileName", - fAutoOutputFileName); - - subGroup-> - appendAtomToSubGroup ( - fAutoOutputFileNameAtom); -} - -//______________________________________________________________________________ -void outputFileOahGroup::enforceGroupQuietness () -{} - -//______________________________________________________________________________ -void outputFileOahGroup::checkGroupOptionsConsistency () -{ - // JMI -} - -//______________________________________________________________________________ -void outputFileOahGroup::acceptIn (basevisitor* v) -{ -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> outputFileOahGroup::acceptIn ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - if (visitor* - p = - dynamic_cast*> (v)) { - S_outputFileOahGroup elem = this; - -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> Launching outputFileOahGroup::visitStart ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - p->visitStart (elem); - } -} - -void outputFileOahGroup::acceptOut (basevisitor* v) -{ -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> outputFileOahGroup::acceptOut ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - if (visitor* - p = - dynamic_cast*> (v)) { - S_outputFileOahGroup elem = this; - -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> Launching outputFileOahGroup::visitEnd ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - p->visitEnd (elem); - } -} - -void outputFileOahGroup::browseData (basevisitor* v) -{ -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> outputFileOahGroup::browseData ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED -} - -//______________________________________________________________________________ -void outputFileOahGroup::displayOutputFileOahValues (int fieldWidth) -{ - gLog << - "The outputFile options are:" << - std::endl; - - ++gIndenter; - - // output file - // -------------------------------------- - - gLog << std::left << - std::setw (fieldWidth) << "Output file:" << - std::endl; - - ++gIndenter; - - gLog << std::left << - std::setw (fieldWidth) << "fOutputFileName" << ": \"" << - fOutputFileName << - "\"" << - std::endl << - std::setw (fieldWidth) << "fAutoOutputFileName" << ": \"" << - fAutoOutputFileName << - "\"" << - std::endl; - - --gIndenter; - - --gIndenter; -} - -std::ostream& operator << (std::ostream& os, const S_outputFileOahGroup& elt) -{ - if (elt) { - elt->print (os); - } - else { - os << "[NULL]" << std::endl; - } - - return os; -} - -//______________________________________________________________________________ -S_outputFileOahGroup createGlobalOutputFileOahGroup () -{ -#ifdef MF_TRACE_IS_ENABLED - if (gEarlyOptions.getTraceEarlyOptions ()) { - std::stringstream ss; - - ss << - "Creating global outputFile OAH group"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - // protect library against multiple initializations - if (! gGlobalOutputFileOahGroup) { - // create the global outputFile options group - gGlobalOutputFileOahGroup = - outputFileOahGroup::create (); - assert (gGlobalOutputFileOahGroup != 0); - } - - // return the global OAH group - return gGlobalOutputFileOahGroup; -} - - -} diff --git a/src/mflibrary/mfOutputFileOah.h b/src/mflibrary/mfOutputFileOah.h deleted file mode 100644 index 6aadba9c..00000000 --- a/src/mflibrary/mfOutputFileOah.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___outputFileOah___ -#define ___outputFileOah___ - -#include - -#include "exports.h" - -#include "oahBasicTypes.h" -#include "oahAtomsCollection.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -class EXP outputFileOahGroup : public oahGroup -{ - public: - - static SMARTP create (); - - public: - - // initialisation - // ------------------------------------------------------ - - void initializeOutputFileOah (); - - protected: - - // constructors/destructor - // ------------------------------------------------------ - - outputFileOahGroup (); - - virtual ~outputFileOahGroup (); - - public: - - // set and get - // ------------------------------------------------------ - - // output file - // -------------------------------------- - - void setAutoOutputFileName () - { fAutoOutputFileName = true; } - Bool getAutoOutputFileName () const - { return fAutoOutputFileName; } - - const S_oahBooleanAtom& - getAutoOutputFileNameAtom () const - { return fAutoOutputFileNameAtom; } - - void setOutputFileName (std::string value) - { fOutputFileName = value; } - std::string getOutputFileName () const - { return fOutputFileName; } - S_oahStringAtom getOutputFileNameStringAtom () const - { return fOutputFileNameStringAtom; } - - public: - - // public services - // ------------------------------------------------------ - - // quiet mode - void enforceGroupQuietness () override; - - // consistency check - void checkGroupOptionsConsistency () override; - - private: - - // private services - // ------------------------------------------------------ - - void initializeOutputFileNameOptions (); - - public: - - // visitors - // ------------------------------------------------------ - - void acceptIn (basevisitor* v) override; - void acceptOut (basevisitor* v) override; - - void browseData (basevisitor* v) override; - - public: - - // print - // ------------------------------------------------------ - - void printOutputFileOahHelp (); - - void displayOutputFileOahValues (int fieldWidth); - - private: - - // output file - // these private variables are the ones accessible through the atoms - // we store the atoms for the needs of fetchOutputFileNameFromTheOptions() - // -------------------------------------- - - S_oahBooleanAtom fAutoOutputFileNameAtom; - Bool fAutoOutputFileName; - - std::string fOutputFileName; - S_oahStringAtom fOutputFileNameStringAtom; -}; -typedef SMARTP S_outputFileOahGroup; -EXP std::ostream& operator << (std::ostream& os, const S_outputFileOahGroup& elt); - -EXP extern S_outputFileOahGroup gGlobalOutputFileOahGroup; - -//______________________________________________________________________________ -EXP S_outputFileOahGroup createGlobalOutputFileOahGroup (); - - -} - - -#endif // ___outputFileOah___ diff --git a/src/mflibrary/mfPair.cpp b/src/mflibrary/mfPair.cpp deleted file mode 100644 index bde0ff3d..00000000 --- a/src/mflibrary/mfPair.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include "smartpointer.h" - -#include "mfIndentedTextOutput.h" -#include "mfStringsHandling.h" - -#include "mfPair.h" - - -namespace MusicFormats -{ - -// //______________________________________________________________________________ -// template -// SMARTP> mfPair::create () -// { -// mfPair* obj = new -// mfPair (); -// assert (obj != nullptr); -// return obj; -// } -// -// template -// SMARTP> mfPair::create ( -// const FIRST_TYPE, SECOND_TYPE& element) -// { -// mfPair* obj = new -// mfPair ( -// element); -// assert (obj != nullptr); -// return obj; -// } -// -// template -// mfPair::mfPair () -// {} -// -// template -// mfPair::mfPair ( -// const FIRST_TYPE, SECOND_TYPE& element) -// { -// fElementsStdList.push_back (element); -// } -// -// template -// mfPair::~mfPair () -// {} -// -// //______________________________________________________________________________ -// template -// Bool mfPair::contains ( -// const FIRST_TYPE, SECOND_TYPE& value) const -// { -// Bool result; -// -// for (FIRST_TYPE, SECOND_TYPE element : fElementsStdList) { -// if (element == value) { -// result = true; -// break; -// } -// } // for -// -// return result; -// } -// -// //______________________________________________________________________________ -// template -// void mfPair::print (std::ostream& os) const -// { -// os << -// "[mfPair" << -// ", fElementsPairName: " << fElementsPairName << ':'; -// -// if (fElementsStdList.size ()) { -// os << std::endl; -// -// ++gIndenter; -// -// for (FIRST_TYPE, SECOND_TYPE element : fElementsStdList) { -// os << -// element->asString () << -// std::endl; -// } // for -// -// --gIndenter; -// } -// -// else { -// os << -// " [EMPTY]" << -// std::endl; -// } -// -// os << ']' << std::endl; -// } -// -// template -// void mfPair::printWithContext ( -// const std::string& context, -// char evidencer, -// std::ostream& os) const -// { -// size_t -// theElementsStdListSize = -// fElementsStdList.size (); -// -// os << -// "The part groups stack contains " << -// "[mfPair" << -// ", fElementsPairName: \"" << fElementsPairName << "\"" << -// ", " << -// mfSingularOrPlural ( -// theElementsStdListSize, "element", "elements") << -// " -- " << -// context << -// ':'; -// -// if (fElementsStdList.size ()) { -// os << std::endl; -// -// ++gIndenter; -// -// int counter = theElementsStdListSize - 1; -// for (FIRST_TYPE, SECOND_TYPE element : fElementsStdList) { -// os << -// counter << ": " << evidencer << -// std::endl; -// -// ++gIndenter; -// os << -// element << -// std::endl; -// --gIndenter; -// -// --counter; -// } // for -// -// --gIndenter; -// } -// -// else { -// os << -// " [EMPTY]" << -// std::endl; -// } -// -// os << ']' << std::endl; -// } -// -// template -// std::ostream& operator << (std::ostream& os, const mfPair& elt) -// { -// elt.print (os); -// return os; -// } -// -// template -// std::ostream& operator << (std::ostream& os, const SMARTP>& elt) -// { -// elt->print (os); -// return os; -// } - - -} diff --git a/src/mflibrary/mfPair.h b/src/mflibrary/mfPair.h deleted file mode 100644 index 3c36d55b..00000000 --- a/src/mflibrary/mfPair.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfPair___ -#define ___mfPair___ - -#include - -#include "exports.h" -#include "smartpointer.h" - - -using namespace MusicXML2; - -namespace MusicFormats -{ - -// //______________________________________________________________________________ -// template -// class EXP mfPair : public smartable -// /* -// C++ std::stack cannot be traversed, so we use std::list instead -// -// https://www.programiz.com/cpp-programming/typename-templates -// -// https://en.cppreference.com/w/cpp/language/type_alias -// -// Do not put templated functions into the cpp file. -// Since they are not implementations they are not found by the compiler/linker. -// So leave them in the header file. -// -// member reference base type 'int' is not a structure or union -// -// https://stackoverflow.com/questions/580922/identifying-primitive-types-in-templates -// -// https://en.cppreference.com/w/cpp/language/template_specialization -// -// https://www.ibm.com/docs/en/zos/2.4.0?topic=only-explicit-specialization-c -// -// https://dev.to/sandordargo/what-are-type-traits-in-c-18j5 -// */ -// { -// public: -// -// // creation -// // ------------------------------------------------------ -// -// static SMARTP create (); -// -// static SMARTP create ( -// const ELEMENT_TYPE& element); -// -// // constructors/destructor -// // ------------------------------------------------------ -// -// mfPair (); -// -// mfPair (const ELEMENT_TYPE& element); -// -// virtual ~mfPair (); -// -// public: -// -// // set and get -// // ------------------------------------------------------ -// -// const std::list & -// getElementsStdList () const -// { return fElementsStdList;} -// -// public: -// -// // public services -// // ------------------------------------------------------ -// -// // basic list stuff -// size_t size () const -// { return fElementsStdList.size (); } -// -// void push ( -// const ELEMENT_TYPE& element) -// { fElementsStdList.push_front (element); } -// -// ELEMENT_TYPE& top () -// { return fElementsStdList.front (); } -// -// void pop () -// { fElementsStdList.pop_front (); } -// -// // specific stack stuff -// Bool contains ( -// const ELEMENT_TYPE& value) const; -// -// public: -// -// // print -// // ------------------------------------------------------ -// -// void print (std::ostream& os) const; -// -// void printWithContext ( -// const std::string& context, -// char evidencer, -// std::ostream& os) const; -// -// private: -// -// // private services -// // ------------------------------------------------------ -// -// private: -// -// // private fields -// // ------------------------------------------------------ -// -// std::string fElementsPairName; -// -// std::list -// fElementsStdList; -// }; -// -// template -// EXP std::ostream& operator << (std::ostream& os, const mfPair& elt); - - -} - - -#endif // ___mfPair___ diff --git a/src/mflibrary/mfPasses.cpp b/src/mflibrary/mfPasses.cpp deleted file mode 100644 index 76e8fbb9..00000000 --- a/src/mflibrary/mfPasses.cpp +++ /dev/null @@ -1,314 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include - -#include "mfConstants.h" -#include "mfIndentedTextOutput.h" -#include "mfPasses.h" - -#include "oahWae.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -std::map - gGlobalMusicFormatsPassIDKindsMap; - -std::string mfPassIDKindAsString ( - mfPassIDKind passIDKind) -{ - std::string result; - - // these strings are used in the command line options - switch (passIDKind) { - case mfPassIDKind::kMfPassID_UNKNOWN_: - result = "*kMfPassID_UNKNOWN_*"; - break; - - case mfPassIDKind::kMfPassID_ALL: - result = "*kMfPassID_ALL*"; - break; - - case mfPassIDKind::kMfPassID_OptionsAndArgumentsHandling: - result = "Opt & args"; - break; - - case mfPassIDKind::kMfPassID_DisplayPass: - result = "Display"; - break; - - case mfPassIDKind::kMfPassID_1: - result = "1"; - break; - - case mfPassIDKind::kMfPassID_2: - result = "2"; - break; - - case mfPassIDKind::kMfPassID_3: - result = "3"; - break; - - case mfPassIDKind::kMfPassID_4: - result = "4"; - break; - - case mfPassIDKind::kMfPassID_5: - result = "5"; - break; - - case mfPassIDKind::kMfPassID_6: - result = "6"; - break; - - case mfPassIDKind::kMfPassID_7: - result = "7"; - break; - } // switch - - return result; -} - -std::ostream& operator << (std::ostream& os, const mfPassIDKind elt) -{ - os << mfPassIDKindAsString (elt); - return os; -} - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const mfPassIDKind& elt) -{ - iss << mfPassIDKindAsString (elt); - return iss; -} - -mfPassIDKind mfPassIDKindFromString (const std::string& theString) -{ - mfPassIDKind result = - mfPassIDKind::kMfPassID_UNKNOWN_; - - std::map ::const_iterator - it = - gGlobalMusicFormatsPassIDKindsMap.find ( - theString); - - if (it == gGlobalMusicFormatsPassIDKindsMap.end ()) { - // no, passID kind is unknown in the map - std::stringstream ss; - - ss << - "MusicFormats passID kind '" << theString << - "' is unknown" << - std::endl << - "The " << - gGlobalMusicFormatsPassIDKindsMap.size () - 1 << - " known MusicFormats passID kinds are:" << - std::endl; - - ++gIndenter; - - ss << - availableMusicFormatsPassIDKinds (K_MF_NAMES_LIST_MAX_LENGTH); - - --gIndenter; - - oahError (ss.str ()); - } - - result = (*it).second; - - return result; -} - -std::string availableMusicFormatsPassIDKinds (size_t namesListMaxLength) -{ - std::stringstream ss; - - size_t - mfPassIDKindsMapSize = - gGlobalMusicFormatsPassIDKindsMap.size (); - - if (mfPassIDKindsMapSize) { - size_t nextToLast = - mfPassIDKindsMapSize - 1; - - size_t count = 0; - size_t cumulatedLength = 0; - - for ( - std::pair - thePair : - gGlobalMusicFormatsPassIDKindsMap - ) { - std::string theString = thePair.first; - - ++count; - - cumulatedLength += theString.size (); - if (cumulatedLength >= namesListMaxLength) { - ss << std::endl << gIndenter.getSpacer (); - cumulatedLength = 0; - break; - } - - if (count == 1) { - ss << gIndenter.getSpacer (); - } - ss << theString; - - if (count == nextToLast) { - ss << " and "; - } - else if (count != mfPassIDKindsMapSize) { - ss << ", "; - } - } // for - } - - return ss.str (); -} - -void initializeMusicFormatsPassIDKindsMap () -{ - // protect library against multiple initializations - static Bool pPrivateThisMethodHasBeenRun (false); - - if (! pPrivateThisMethodHasBeenRun) { - gGlobalMusicFormatsPassIDKindsMap ["opt&args"] = // JMI v0.9.67 - mfPassIDKind::kMfPassID_OptionsAndArgumentsHandling; - - gGlobalMusicFormatsPassIDKindsMap ["display"] = // JMI v0.9.67 - mfPassIDKind::kMfPassID_DisplayPass; - - gGlobalMusicFormatsPassIDKindsMap ["1"] = - mfPassIDKind::kMfPassID_1; - - gGlobalMusicFormatsPassIDKindsMap ["2"] = - mfPassIDKind::kMfPassID_2; - - gGlobalMusicFormatsPassIDKindsMap ["3"] = - mfPassIDKind::kMfPassID_3; - - gGlobalMusicFormatsPassIDKindsMap ["4"] = - mfPassIDKind::kMfPassID_4; - - gGlobalMusicFormatsPassIDKindsMap ["5"] = - mfPassIDKind::kMfPassID_5; - - gGlobalMusicFormatsPassIDKindsMap ["6"] = - mfPassIDKind::kMfPassID_6; - - gGlobalMusicFormatsPassIDKindsMap ["7"] = - mfPassIDKind::kMfPassID_7; - - pPrivateThisMethodHasBeenRun = true; - } -} - -void initializeMusicFormatsPassIDs () -{ - // protect library against multiple initializations - static Bool pPrivateThisMethodHasBeenRun (false); - - if (! pPrivateThisMethodHasBeenRun) { -#ifdef MF_TRACE_IS_ENABLED - if ( - gEarlyOptions.getTraceEarlyOptions () - && - ! gEarlyOptions.getEarlyQuietOption () - ) { - std::stringstream ss; - - ss << - "Initializing MusicFormats passIDs" << - std::endl; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - // passIDs handling - // ------------------------------------------------------ - - initializeMusicFormatsPassIDKindsMap (); - - pPrivateThisMethodHasBeenRun = true; - } -} - -//______________________________________________________________________________ -S_mfPass mfPass::create ( - mfPassIDKind passIDKind, - std::string passDescription) -{ - mfPass* obj = - new mfPass ( - passIDKind, - passDescription); - assert (obj != nullptr); - return obj; -} - -mfPass::mfPass ( - mfPassIDKind passIDKind, - std::string passDescription) -{ - fPassIDKind = passIDKind; - fPassDescription = passDescription; -} - -mfPass::~mfPass () -{} - -std::string mfPass::asString () const -{ - std::stringstream ss; - - ss << - "fPassIDKind: " << fPassIDKind << - ", fPassDescription: " << fPassDescription; - - return ss.str (); -} - -void mfPass::print (std::ostream& os) const -{ - os << asString (); -} - -std::ostream& operator << (std::ostream& os, const S_mfPass& elt) { - os << elt->asString (); - return os; -} - -//______________________________________________________________________________ -// hidden global PassIDKind variable -mfPassIDKind pGlobalCurrentPassIDKind = - mfPassIDKind::kMfPassID_ALL; // default value for passes trace - -EXP void setGlobalCurrentPassIDKind (mfPassIDKind passIDKind) -{ - pGlobalCurrentPassIDKind = passIDKind; -} - -EXP mfPassIDKind getGlobalCurrentPassIDKind () -{ - return pGlobalCurrentPassIDKind; -} - - -} - diff --git a/src/mflibrary/mfPasses.h b/src/mflibrary/mfPasses.h deleted file mode 100644 index 8808793d..00000000 --- a/src/mflibrary/mfPasses.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfPasses___ -#define ___mfPasses___ - -#include -#include - -#include - -#include "exports.h" -#include "smartpointer.h" - -#include "mfBool.h" -#include "mfIndentedTextOutput.h" - - -using namespace MusicXML2; - -namespace MusicFormats -{ - -//______________________________________________________________________________ -enum class mfPassIDKind { - // a given pass may have different IDs depending on the service - kMfPassID_UNKNOWN_, - - kMfPassID_ALL, // default value for passes trace - - kMfPassID_OptionsAndArgumentsHandling, // options and arguments handling - - kMfPassID_DisplayPass, - - kMfPassID_1, - kMfPassID_2, - kMfPassID_3, - kMfPassID_4, - kMfPassID_5, - kMfPassID_6, - kMfPassID_7 -}; - -std::string mfPassIDKindAsString ( - mfPassIDKind passIDKind); - -std::ostream& operator << (std::ostream& os, const mfPassIDKind elt); - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const mfPassIDKind& elt); - -mfPassIDKind mfPassIDKindFromString ( - const std::string& theString); - -extern std::map - gGlobalMusicFormatsPassIDKindsMap; - -std::string availableMusicFormatsPassIDKinds (size_t namesListMaxLength); - -void initializeMusicFormatsPassIDKindsMap (); - -void initializeMusicFormatsPassIDs (); - -//______________________________________________________________________________ -class EXP mfPass : public smartable -{ - public: - - // constructors/destructor - // ------------------------------------------------------ - - static SMARTP create ( - mfPassIDKind passIDKind, - std::string passDescription); - - mfPass ( - mfPassIDKind passIDKind, - std::string passDescription); - - virtual ~mfPass (); - -public: - - // set and get - // ------------------------------------------------------ - - mfPassIDKind getPassIDKind () const - { return fPassIDKind; } - - std::string getPassDescription () const - { return fPassDescription; } - - public: - - // public services - // ------------------------------------------------------ - - public: - - // print - // ------------------------------------------------------ - - std::string asString () const; - - void print (std::ostream& os) const; - - - private: - - // private fields - // ------------------------------------------------------ - - - mfPassIDKind fPassIDKind; - std::string fPassDescription; -}; -typedef SMARTP S_mfPass; -EXP std::ostream& operator << (std::ostream& os, const S_mfPass& elt); - -//________________________________________________________________________ -// hidden global PassIDKind variable -EXP void setGlobalCurrentPassIDKind (mfPassIDKind passIDKind); - -EXP mfPassIDKind getGlobalCurrentPassIDKind (); - -// a handy shortcut -#define gCurrentPassIDKind getGlobalCurrentPassIDKind () - - -} - - -#endif // ___mfPasses___ diff --git a/src/mflibrary/mfPreprocessorSettings.h b/src/mflibrary/mfPreprocessorSettings.h deleted file mode 100644 index d52849c9..00000000 --- a/src/mflibrary/mfPreprocessorSettings.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfPreprocessorSettings___ -#define ___mfPreprocessorSettings___ - -/* - This file groups several build-time setting that influence - code security and behaviour, as well as speed and a couple of facilities -*/ - -//////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////// -// EXCEPTIONS -//////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////// - -//______________________________________________________________________________ -// uncomment the following definition if no signal catching is desired -#define MF_CATCH_SIGNALS_IS_ENABLED - -//______________________________________________________________________________ -// uncomment the following definition if no exceptions display is desired -#define MF_CAUGHT_EXCEPTIONS_DISPLAY_IS_ENABLED - - -//////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////// -// BEHAVIOUR -//////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////// - -//______________________________________________________________________________ -// comment the following definition if abort on internal errors is desired -// CAUTION: DON'T USE THIS IN PRODUCTION CODE, -// since that could kill a session on a web server, for example -#define MF_ABORT_TO_DEBUG_ERRORS_IS_ENABLED - -//______________________________________________________________________________ -// uncomment the following definition if maintaince runs are desired -#define MF_MAINTAINANCE_RUNS_ARE_ENABLED - - -//////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////// -// SPEED -//////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////// - -//______________________________________________________________________________ -// uncomment the following definition if abort on internal errors is desired -#define MF_SANITY_CHECKS_ARE_ENABLED - - -//////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////// -// TRACE -//////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////// - -//______________________________________________________________________________ -// uncomment the following definition if trace is desired -#define MF_TRACE_IS_ENABLED - -#ifdef MF_TRACE_IS_ENABLED - #include "mfTraceOah.h" -#endif // MF_TRACE_IS_ENABLED - - -#endif // ___mfPreprocessorSettings___ diff --git a/src/mflibrary/mfRational.cpp b/src/mflibrary/mfRational.cpp deleted file mode 100644 index 9665e3a7..00000000 --- a/src/mflibrary/mfRational.cpp +++ /dev/null @@ -1,435 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include -#include -#include -#include -#include // gcd() - -#include "mfPreprocessorSettings.h" - -#include "mfAssert.h" -#include "mfRational.h" -#include "mfServices.h" - -#include "oahEarlyOptions.h" - -#include "msrWae.h" - -#include "waeHandlers.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -mfRational::mfRational ( - long int num, - long int denom) -{ -#ifdef MF_SANITY_CHECKS_ARE_ENABLED - // sanity check -if (false) // JMI v0.9.70 - mfAssert ( - __FILE__, __LINE__, - denom > 0, - "denom '" + std::to_string (denom) + "' is not positive"); -#endif // MF_SANITY_CHECKS_ARE_ENABLED - - fNumerator = num; - fDenominator = denom; - - rationalise (); -} - -mfRational::mfRational(const mfRational& rat) -{ - fNumerator = rat.fNumerator; - fDenominator = rat.fDenominator; -} - -mfRational::mfRational (const std::string &theString) -{ - // decipher theString - std::string regularExpression ( - "([-|+]?[[:digit:]]+)" // numerator - "/" - "([[:digit:]]+)" // denominator - ); - - std::regex e (regularExpression); - std::smatch sm; - - regex_match (theString, sm, e); - - size_t smSize = sm.size (); - - if (smSize == 3) { - // found a well-formed specification, - // need to check its contents - std::string - numerator = sm [1], - denominator = sm [2]; - -#ifdef MF_TRACE_IS_ENABLED - if (false) { - std::stringstream ss; - - ss << - "--> numerator = \"" << numerator << "\", " << - "--> denominator = \"" << denominator << "\""; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - // extract the numerator - { - std::stringstream ss; - ss << numerator; - ss >> fNumerator; - } - - // extract the denominator - { - std::stringstream ss; - ss << denominator; - ss >> fDenominator; - -#ifdef MF_SANITY_CHECKS_ARE_ENABLED - // sanity check - mfAssert ( - __FILE__, __LINE__, - fDenominator > 0, - "fDenominator '" + denominator + "' is not positive"); -#endif // MF_SANITY_CHECKS_ARE_ENABLED - } - } - - else { - std::stringstream ss; - - ss << - "mfRational std::string '" << theString << - "' is ill-formed"; - - msrError ( -// msrWarning ( // JMI - gServiceRunData->getInputSourceName (), - 0, // JMI inputLineNumber, ??? v0.9.66 - __FILE__, __LINE__, - ss.str ()); - } - - rationalise (); -} - -mfRational::~mfRational () -{} - -mfRational mfRational::inverse () const -{ - mfRational - result ( - fDenominator, fNumerator); - - result.rationalise (); - - return result; -} - -mfRational mfRational::opposite () const -{ - mfRational - result ( - -fNumerator, fDenominator); - - result.rationalise (); - - return result; -} - -mfRational mfRational::operator + (const mfRational &rat) const -{ - mfRational - result ( - fNumerator * rat.fDenominator + rat.fNumerator * fDenominator, - fDenominator * rat.fDenominator); - - result.rationalise (); - - return result; -} - -mfRational mfRational::operator - (const mfRational &rat) const -{ - mfRational - result ( - fNumerator * rat.fDenominator - rat.fNumerator * fDenominator, - fDenominator * rat.fDenominator); - - result.rationalise (); - - return result; -} - -mfRational mfRational::operator * (const mfRational &rat) const -{ - mfRational - result ( - fNumerator * rat.fNumerator, - fDenominator * rat.fDenominator); - - result.rationalise (); - - return result; -} - -mfRational mfRational::operator / (const mfRational &rat) const -{ - mfRational - result ( - fNumerator * rat.fDenominator, - fDenominator * rat.fNumerator); - - result.rationalise (); - - return result; -} - -mfRational mfRational::operator * (int num) const -{ - mfRational - result ( - fNumerator * num, - fDenominator); - - result.rationalise (); - - return result; -} - -mfRational mfRational::operator / (int num) const -{ - mfRational - result ( - fNumerator, - fDenominator * num); - - result.rationalise (); - - return result; -} - -mfRational& mfRational::operator += (const mfRational &rat) -{ - if (fDenominator == rat.fDenominator) { - fNumerator += rat.fNumerator; - } - else { - fNumerator = fNumerator * rat.fDenominator + rat.fNumerator * fDenominator; - fDenominator *= rat.fDenominator; - } - - rationalise (); - - return (*this); -} - -mfRational& mfRational::operator -= (const mfRational &rat) -{ - if (fDenominator == rat.fDenominator) { - fNumerator -= rat.fNumerator; - } - else { - fNumerator = fNumerator * rat.fDenominator - rat.fNumerator * fDenominator; - fDenominator *= rat.fDenominator; - } - - rationalise (); - - return (*this); -} - -mfRational& mfRational::operator *= (const mfRational &rat) -{ - fNumerator *= rat.fNumerator; - fDenominator *= rat.fDenominator; - - rationalise (); - - return (*this); -} - -mfRational& mfRational::operator /= (const mfRational &rat) -{ - fNumerator *= rat.fDenominator; - fDenominator *= rat.fNumerator; - - rationalise (); - - return (*this); -} - -mfRational& mfRational::operator = (const mfRational& rat) { - fNumerator = rat.fNumerator; - fDenominator = rat.fDenominator; - - return (*this); -} - -Bool mfRational::operator > (const mfRational &rat) const -{ - // a/b > c/d if and only if a * d > b * c. - return - ((fNumerator * rat.fDenominator) > (fDenominator * rat.fNumerator)); -} - -Bool mfRational::operator < (const mfRational &rat) const -{ - // a/b < c/d if and only if a * d < b * c. - return - ((fNumerator * rat.fDenominator) < (fDenominator * rat.fNumerator)); -} - -Bool mfRational::operator == (const mfRational &rat) const -{ - // a/b < c/d if and only if a * d < b * c. - return - ((fNumerator * rat.fDenominator) == (fDenominator * rat.fNumerator)); -} - -Bool mfRational::operator > (double num) const -{ - return (toDouble() > num); -} -Bool mfRational::operator >= (double num) const -{ - return (toDouble() >= num); -} -Bool mfRational::operator < (double num) const -{ - return (toDouble() < num); -} -Bool mfRational::operator <= (double num) const -{ - return (toDouble() <= num); -} -Bool mfRational::operator == (double num) const -{ - return (toDouble() == num); } - -void mfRational::rationalise () -{ - long int g = std::gcd (fNumerator, fDenominator); - - fNumerator /= g; - fDenominator /= g; - - if (fNumerator == 0) { - fDenominator = 1; - } - else if (fDenominator < 0) { - fNumerator = -fNumerator; - fDenominator = -fDenominator; - } -} - -double mfRational::toDouble () const -{ - return - (fDenominator != 0) ? ((double)fNumerator/(double)fDenominator) : 0; -} - -float mfRational::toFloat () const -{ - return - (fDenominator != 0) ? ((float)fNumerator/(float)fDenominator) : 0; -} - -std::string mfRational::toString () const -{ - std::ostringstream res; - - res << fNumerator << '/' << fDenominator; - - return res.str (); -} - -mfRational::operator std::string () const -{ - return toString (); -} -mfRational::operator double () const -{ - return toDouble (); -} -mfRational::operator float () const -{ - return toFloat (); -} -mfRational::operator int () const -{ - const double x = toDouble (); - - return ((int) floor (x + 0.5f)); -} - -std::string mfRational::asString () const -{ - std::stringstream ss; - - ss << '[' << fNumerator << '/' << fDenominator << ']'; - - return ss.str (); -} - -std::string mfRational::asFractionString () const -{ - std::stringstream ss; - - ss << fNumerator << '/' << fDenominator; - - return ss.str (); -} - -void mfRational::print (std::ostream& os) const -{ - os << "[mfRational " << fNumerator << '/' << fDenominator << ']'; -} - -std::ostream& operator << (std::ostream& os, const mfRational& rat) -{ - rat.print (os); - return os; -} - -void testRational () -{ - mfRational rat1 ("33/55"); - std::cout << "rat1: " << rat1 << std::endl; - - mfRational rat2 (-1, 4); - std::cout << "rat2: " << rat2 << std::endl; - - mfRational rat3 (3, 8); - std::cout << "rat3: " << rat3 << std::endl; - - mfRational res1 = rat2 - rat3; - std::cout << "res1: " << res1 << std::endl; -} - - -} - diff --git a/src/mflibrary/mfRational.h b/src/mflibrary/mfRational.h deleted file mode 100644 index b4ec7599..00000000 --- a/src/mflibrary/mfRational.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfRational___ -#define ___mfRational___ - -#include -#include - -#include "exports.h" - -#include "mfBool.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -class EXP mfRational -/* - a mfRational is a rational number whose denominator is strictly positive - and which is in rationalised form at all times, - directly derived from libmusicxml2's mfRational class -*/ -{ - public: - - // constructors/destructor - // ------------------------------------------------------ - - mfRational ( - long int num = 0, - long int denom = 1); - - mfRational (const mfRational& rat); - - mfRational (const std::string &theString); - - virtual ~mfRational (); - - - public: - - // set and get - // ------------------------------------------------------ - - void setNumerator (long int num) - { fNumerator = num; } - long int getNumerator () const - { return fNumerator; } - - void setDenominator (long int denom) - { fDenominator = denom; } - long int getDenominator () const - { return fDenominator; } - - void set (long int num, long int denom) - { fNumerator = num; fDenominator = denom; } - - public: - - // public services - // ------------------------------------------------------ - - // arithmetic - - mfRational inverse () const; - mfRational opposite () const; - - mfRational operator + (const mfRational &rat) const; - mfRational operator - (const mfRational &rat) const; - //! Useful for notes with dots. - mfRational operator * (const mfRational &rat) const; - mfRational operator / (const mfRational &rat) const; - // (i.e. rat * 3/2 or rat * 7/4) - - mfRational operator * (int num) const; - mfRational operator / (int num) const; - - mfRational& operator += (const mfRational &rat); - mfRational& operator -= (const mfRational &rat); - //! Useful for notes with dots. - mfRational& operator *= (const mfRational &rat); - mfRational& operator /= (const mfRational &rat); - // (i.e. rat * 3/2 or rat * 7/4) - - mfRational& operator *= (long int num) - { fNumerator *= num; return *this; } - mfRational& operator /= (long int num) - { fDenominator *= num; return *this; } - - // assignment - - mfRational& operator = (const mfRational& rat); - - // comparisons - - Bool operator > (const mfRational &rat) const; - Bool operator >= (const mfRational &rat) const - {return !(*this < rat);} - Bool operator < (const mfRational &rat) const; - Bool operator <= (const mfRational &rat) const - {return !(*this > rat);} - - Bool operator == (const mfRational &rat) const; - Bool operator != (const mfRational &rat) const - {return !(*this == rat);} - - Bool operator > (double num) const; - Bool operator >= (double num) const; - Bool operator < (double num) const; - Bool operator <= (double num) const; - Bool operator == (double) const; - - // conversions - - operator std::string () const; - operator double () const; - operator float () const; - operator int () const; - - std::string toString () const; - double toDouble () const; - float toFloat () const; - int toInt () const; - - public: - - // print - // ------------------------------------------------------ - - std::string asString () const; - - std::string asFractionString () const; - - void print (std::ostream& os) const; - - private: - - // private methods - // ------------------------------------------------------ - - // 'rationalise' mfRational values - void rationalise (); - - private: - - // private fields - // ------------------------------------------------------ - - long int fNumerator; - long int fDenominator; -}; -EXP std::ostream& operator << (std::ostream& os, const mfRational& rat); - - -EXP void testRational (); - - -} - - -#endif // ___mfRational___ diff --git a/src/mflibrary/mfScoreNotations.cpp b/src/mflibrary/mfScoreNotations.cpp deleted file mode 100644 index 0d2a896f..00000000 --- a/src/mflibrary/mfScoreNotations.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include -#include - -#include "mfScoreNotations.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -std::string msrScoreNotationKindAsString ( - msrScoreNotationKind lilypondScoreNotationKind) -{ - std::string result; - - switch (lilypondScoreNotationKind) { - case msrScoreNotationKind::kScoreNotationWestern: - result = "kScoreNotationWestern"; - case msrScoreNotationKind::kScoreNotationJianpu: - result = "kScoreNotationWestern"; - case msrScoreNotationKind::kScoreNotationDiatonicAccordion: - result = "kScoreNotationDiatonicAccordion"; - break; - } // switch - - return result; -} - -std::ostream& operator << (std::ostream& os, const msrScoreNotationKind& elt) -{ - os << msrScoreNotationKindAsString (elt); - return os; -} - - -} - diff --git a/src/mflibrary/mfScoreNotations.h b/src/mflibrary/mfScoreNotations.h deleted file mode 100644 index ef7cba85..00000000 --- a/src/mflibrary/mfScoreNotations.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfScoreNotations___ -#define ___mfScoreNotations___ - -#include -#include - -namespace MusicFormats -{ - -// score notation -//______________________________________________________________________________ -enum class msrScoreNotationKind { - kScoreNotationWestern, - kScoreNotationJianpu, - kScoreNotationDiatonicAccordion -}; - -std::string msrScoreNotationKindAsString ( - msrScoreNotationKind lilypondScoreNotationKind); - -std::ostream& operator << (std::ostream& os, const msrScoreNotationKind& elt); - - -} - - -#endif // ___mfScoreNotations___ diff --git a/src/mflibrary/mfServices.cpp b/src/mflibrary/mfServices.cpp deleted file mode 100644 index 24c35e60..00000000 --- a/src/mflibrary/mfServices.cpp +++ /dev/null @@ -1,1044 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include // std::setw, std::setprecision, ... - -#include "mfPreprocessorSettings.h" - -#include "mfConstants.h" -#include "msrMeasureConstants.h" -#include "mfServices.h" -#include "mfStringsHandling.h" - -#include "languages.h" - -#include "oahEarlyOptions.h" - -#include "oahWae.h" - -#include "waeHandlers.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -std::map - gGlobalMusicFormatsServiceKindsMap; - -std::string mfServiceKindAsString ( - mfServiceKind serviceKind) -{ - std::string result; - - // these strings are used in the command line options - switch (serviceKind) { - case mfServiceKind::kMfService_UNKNOWN_: - result = "*kMfService_UNKNOWN_*"; - break; - - case mfServiceKind::kMfService_xml2ly: - result = "kMfService_xml2ly"; - break; - - case mfServiceKind::kMfService_xml2brl: - result = "kMfService_xml2brl"; - break; - - case mfServiceKind::kMfService_xml2xml: - result = "kMfService_xml2xml"; - break; - - case mfServiceKind::kMfService_xml2gmn: - result = "kMfService_xml2gmn"; - break; - - case mfServiceKind::kMfService_stringMatcher: - result = "kMfService_stringMatcher"; - break; - - case mfServiceKind::kMfService_msdl: - result = "kMfService_msdl"; - break; - - case mfServiceKind::kMfService_mfsl: - result = "kMfService_mfsl"; - break; - - case mfServiceKind::kMfService_ischeme: - result = "kMfService_ischeme"; - break; - } // switch - - return result; -} - -std::ostream& operator << (std::ostream& os, const mfServiceKind elt) -{ - os << mfServiceKindAsString (elt); - return os; -} - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const mfServiceKind& elt) -{ - iss << mfServiceKindAsString (elt); - return iss; -} - -mfServiceKind mfServiceKindFromString (const std::string& theString) -{ - mfServiceKind result = - mfServiceKind::kMfService_UNKNOWN_; - - std::map ::const_iterator - it = - gGlobalMusicFormatsServiceKindsMap.find ( - theString); - - if (it == gGlobalMusicFormatsServiceKindsMap.end ()) { - // no, service kind is unknown in the map - std::stringstream ss; - - ss << - "MusicFormats service kind '" << theString << - "' is unknown" << - std::endl << - "The " << - gGlobalMusicFormatsServiceKindsMap.size () - 1 << - " known MusicFormats service kinds are:" << - std::endl; - - ++gIndenter; - - ss << - availableMusicFormatsServiceKinds (K_MF_NAMES_LIST_MAX_LENGTH); - - --gIndenter; - - oahError (ss.str ()); - } - - result = (*it).second; - - return result; -} - -std::string availableMusicFormatsServiceKinds (size_t namesListMaxLength) -{ - std::stringstream ss; - - size_t - mfServiceKindsMapSize = - gGlobalMusicFormatsServiceKindsMap.size (); - - if (mfServiceKindsMapSize) { - size_t nextToLast = - mfServiceKindsMapSize - 1; - - size_t count = 0; - size_t cumulatedLength = 0; - - for ( - std::pair - thePair : - gGlobalMusicFormatsServiceKindsMap - ) { - std::string theString = thePair.first; - - ++count; - - cumulatedLength += theString.size (); - if (cumulatedLength >= namesListMaxLength) { - ss << std::endl << gIndenter.getSpacer (); - cumulatedLength = 0; - break; - } - - if (count == 1) { - ss << gIndenter.getSpacer (); - } - ss << theString; - - if (count == nextToLast) { - ss << " and "; - } - else if (count != mfServiceKindsMapSize) { - ss << ", "; - } - } // for - } - - return ss.str (); -} - -void initializeMusicFormatsServiceKindsMap () -{ - // protect library against multiple initializations - static Bool pPrivateThisMethodHasBeenRun (false); - - if (! pPrivateThisMethodHasBeenRun) { - gGlobalMusicFormatsServiceKindsMap ["xml2ly"] = - mfServiceKind::kMfService_xml2ly; - - gGlobalMusicFormatsServiceKindsMap ["xml2brl"] = - mfServiceKind::kMfService_xml2brl; - - gGlobalMusicFormatsServiceKindsMap ["xml2xml"] = - mfServiceKind::kMfService_xml2xml; - - gGlobalMusicFormatsServiceKindsMap ["xml2gmn"] = - mfServiceKind::kMfService_xml2gmn; - - gGlobalMusicFormatsServiceKindsMap ["filter"] = - mfServiceKind::kMfService_stringMatcher; - - gGlobalMusicFormatsServiceKindsMap ["msdl"] = - mfServiceKind::kMfService_msdl; - - gGlobalMusicFormatsServiceKindsMap ["mfsl"] = - mfServiceKind::kMfService_mfsl; - - gGlobalMusicFormatsServiceKindsMap ["ischeme"] = - mfServiceKind::kMfService_ischeme; - - pPrivateThisMethodHasBeenRun = true; - } -} - -void initializeMusicFormatsServices () -{ - // protect library against multiple initializations - static Bool pPrivateThisMethodHasBeenRun (false); - - if (! pPrivateThisMethodHasBeenRun) { -#ifdef MF_TRACE_IS_ENABLED - if ( - gEarlyOptions.getTraceEarlyOptions () - && - ! gEarlyOptions.getEarlyQuietOption () - ) { - std::stringstream ss; - - ss << - "Initializing MusicFormats services" << - std::endl; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - // services handling - // ------------------------------------------------------ - - initializeMusicFormatsServiceKindsMap (); - - pPrivateThisMethodHasBeenRun = true; - } -} - -//_______________________________________________________________________________ -S_mfService mfService::create ( - const std::string& serviceName) -{ - mfService* obj = new - mfService ( - serviceName); - assert (obj != nullptr); - return obj; -} - -mfService::mfService ( - const std::string& serviceName) -{ - // service name - fServiceName = serviceName; -} - -mfService::~mfService () -{} - -void mfService::fetchPassIDKindList ( - std::list & passIDKindList) const -{ - for (S_mfPass pass : fServicePassesList) { - passIDKindList.push_back ( - pass-> getPassIDKind()); - } // for -} - -size_t mfService::fetchMaxPassIDKindAsStringLength () const -{ - size_t result = 0; - - for (S_mfPass pass : fServicePassesList) { - std::string - passIDKindAsString = - mfPassIDKindAsString ( - pass->getPassIDKind ()); - - size_t - passIDKindAsStringSize = - passIDKindAsString.size (); - - if (passIDKindAsStringSize > result) { - result = passIDKindAsStringSize; - } - } // for - - return result; -} - -void mfService::print (std::ostream& os) const -{ - os << - "[mfService" << - ", fServiceName: " << fServiceName << ":" << - std::endl; - - ++gIndenter; - - // service passIDs - // -------------------------------------- - - const int fieldWidth = fetchMaxPassIDKindAsStringLength (); - - for (S_mfPass pass : fServicePassesList) { - os << std::left << - std::setw (fieldWidth) << - "passIDKind:" << - std::endl; - - ++gIndenter; - os << - gLanguage-> - passIDKindAsString ( - pass->getPassIDKind ()) << - std::endl; - --gIndenter; - - os << - std::setw (fieldWidth) << - "pass " << ": " << - std::endl; - - ++gIndenter; - os << - gIndenter.indentMultiLineStringWithCurrentOffset ( - pass->getPassDescription ()) << - std::endl; - --gIndenter; - } // for - - --gIndenter; - - os << ']' << std::endl; -} - -std::ostream& operator << (std::ostream& os, const S_mfService& elt) -{ - elt->print (os); - return os; -} - -std::string mfService::fetchServicePassDescriptionsAsString () const -{ - mfIndentedStringStream iss; - - iss << - "What " << fServiceName << " does:" << - "\n\n"; - - ++gIndenter; - - iss << - "This multi-pass converter basically performs " << - fServicePassesList.size () << - " passes:" << - '\n'; - - ++gIndenter; - -// constexpr int fieldWidth = 10; - - for (S_mfPass pass : fServicePassesList) { - iss << // JMI std::left << -// std::setw (fieldWidth) << - pass->getPassIDKind () << ": " << - pass->getPassDescription () << - '\n'; - } // for - - --gIndenter; - - iss << - "Other passes are performed according to the options, such as" << - '\n' << - "displaying views of the internal data or printing a summary of the score." - "\n\n" << - - "The activity log and warning/error messages go to standard error." << - '\n'; - - --gIndenter; - - return iss.str (); -} - -void mfService::printServiceForAboutOption (std::ostream& os) const -{ - os << - "What " << fServiceName << " does:" << - std::endl << std::endl; - - ++gIndenter; - - os << - "This multi-pass converter basically performs " << - mfSingularOrPlural ( - fServicePassesList.size (), - "pass", "passes") << - ':' << - std::endl; - - ++gIndenter; - -// constexpr int fieldWidth = 21; - - for (S_mfPass pass : fServicePassesList) { - os << // std::left << -// std::setw (fieldWidth) << - gLanguage-> - passIDKindAsString ( - pass->getPassIDKind ()) << - ":" << - std::endl; - -// ++gIndenter; - os << -// gIndenter.indentMultiLineStringWithCurrentOffset ( -// pass->getPassDescription ()) << - pass->getPassDescription () << - std::endl; -// --gIndenter; - } // for - - --gIndenter; - - os << - std::endl << - "Other passes are performed according to the options, such as" << - std::endl << - "displaying views of the internal data or printing a summary of the score." << - std::endl << std::endl << - - "The activity log and warning/error messages go to standard error." << - std::endl; - - --gIndenter; -} - -//_______________________________________________________________________________ -S_mfServiceRunData mfServiceRunData::create ( - const std::string& serviceName) -{ - mfServiceRunData* obj = new - mfServiceRunData ( - serviceName); - assert (obj != nullptr); - return obj; -} - -// S_mfServiceRunData mfServiceRunData::create ( -// const std::string& serviceName, -// S_oahHandler runOahHandler) -// { -// mfServiceRunData* obj = new -// mfServiceRunData ( -// serviceName, -// runOahHandler); -// assert (obj != nullptr); -// return obj; -// } - -mfServiceRunData::mfServiceRunData ( - const std::string& serviceName) -{ - // service name - fServiceName = serviceName; - -// // OAH handler -// fRunOahHandler = runOahHandler; - - // run date - initializeRunDate (); - - // parts - fCurrentPartIDAndName = "PartIDAndName_???"; - - // staves - fCurrentStaveNumber = K_STAFF_NUMBER_UNKNOWN_; - - // voices - fCurrentVoiceNumber = K_VOICE_NUMBER_UNKNOWN_; - - // measure numbers - fCurrentMeasureNumber = K_MEASURE_NUMBER_UNKNOWN_; - fScoreMeasuresNumber = 0; -} - -// mfServiceRunData::mfServiceRunData ( -// const std::string& serviceName, -// S_oahHandler runOahHandler) -// { -// // service name -// fServiceName = serviceName; -// -// // OAH handler -// fRunOahHandler = runOahHandler; -// -// // run date -// initializeRunDate (); -// } - -mfServiceRunData::~mfServiceRunData () -{} - -void mfServiceRunData::initializeRunDate () -{ - time_t runRawtime; - struct tm* runTimeinfo; - char buffer [80]; - - time (&runRawtime); - runTimeinfo = localtime (&runRawtime); - - strftime (buffer, 80, "%A %F @ %T %Z", runTimeinfo); - fRunDateFull = buffer; - - strftime (buffer, 80, "%Y-%m-%d", runTimeinfo); - fRunDateYYYYMMDD = buffer; -} - -void mfServiceRunData::print (std::ostream& os) const -{ - os << - "The service run data are:" << - std::endl; - - ++gIndenter; - - constexpr int fieldWidth = 21; - - // service name - // -------------------------------------- - - os << std::left << - std::setw (fieldWidth) << "Service name" << ": " << - fServiceName << - std::endl; - -// // OAH handler -// // -------------------------------------- -// -// os << std::left << -// std::setw (fieldWidth) << "OAH handler" << ": " << -// fRunOahHandler->getHandlerHeader () << -// std::endl; - - // input source name - // -------------------------------------- - - os << std::left << - std::setw (fieldWidth) << "fInputSourceName" << ": " << // JMIJMIJMI in oahHandler??? - fInputSourceName << - std::endl; - - // run date - // -------------------------------------- - - os << std::left << - std::setw (fieldWidth) << "Run date:" << - std::endl; - - ++gIndenter; - - os << std::left << - std::setw (fieldWidth) << "fRunDateFull" << ": " << - fRunDateFull << - std::endl << - std::setw (fieldWidth) << "fRunDateYYYYMMDD" << ": " << - fRunDateYYYYMMDD << - std::endl; - - --gIndenter; - - - --gIndenter; -} - -std::ostream& operator << (std::ostream& os, const mfServiceRunData& elt) -{ - elt.print (os); - return os; -} - -//________________________________________________________________________ -// hidden global service variable -std::map pGlobalServicesMap; - -// hidden global service variable -S_mfService pGlobalService; - -EXP void setGlobalService (mfServiceKind serviceKind) -{ - S_mfService - service = - pGlobalServicesMap [serviceKind]; - - pGlobalService = service; -} - -EXP S_mfService getGlobalService () -{ - return pGlobalService; -} - -// hidden global current service run data variable -S_mfServiceRunData pGlobalServiceRunData; - -EXP void setGlobalServiceRunData (S_mfServiceRunData serviceRunData) -{ - pGlobalServiceRunData = serviceRunData; -} - -EXP S_mfServiceRunData getGlobalServiceRunData () -{ - return pGlobalServiceRunData; -} - -//________________________________________________________________________ -EXP void initializeServices () -{ - // xml2ly - // ------------------------------ - - { - std::string serviceName = "xml2ly"; - - S_mfService - xml2lyService = - mfService::create (serviceName); - - // This multi-pass converter basically performs 5 passes: - // Pass 1: reads the contents of MusicXMLFile or stdin ('-') - // and converts it to a MusicXML tree; - // Pass 2a: converts that MusicXML tree into - // a first Music Score Representation (MSR) skeleton; - // Pass 2b: populates the first MSR skeleton from the MusicXML tree - // to get a full MSR; - // Pass 3: converts the first MSR into a second MSR to apply options - // Pass 4: converts the second MSR into a - // LilyPond Score Representation (LPSR); - // Pass 5: converts the LPSR to LilyPond code - // and writes it to standard output. - - xml2lyService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_1, - gLanguage->convertAMusicXMLStreamIntoAnMXSR ())); - - xml2lyService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_2, - gLanguage->convertTheMXSRIntoAnMSRSkeleton ())); - - xml2lyService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_3, - gLanguage->convertTheFirstMSRIntoASecondMSR ())); - - xml2lyService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_4, - gLanguage->convertTheSecondMSRIntoAnLPSR ())); - - xml2lyService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_4, - gLanguage->convertTheFirstMSRIntoAnLPSR ())); // JMI ??? v0.9.70 - - xml2lyService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_5, - gLanguage->convertTheLPSRIntoLilyPondCode ())); - - xml2lyService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_6, - gLanguage->convertTheLPSRIntoLilyPondCode ())); - - pGlobalServicesMap [mfServiceKind::kMfService_xml2ly] = xml2lyService; - - // gLog << "--------------" << std::endl; - // - // gLog << - // "xml2lyService::print ()" << - // std::endl; - // - // ++gIndenter; - // gLog << - // xml2lyService << - // std::endl; - // --gIndenter; - // - // gLog << "--------------" << std::endl; - // - // gLog << - // "xml2lyService::printServiceForAboutOption ()" << - // std::endl; - // - // ++gIndenter; - // xml2lyService-> printServiceForAboutOption (gLog); - // --gIndenter; - // - // gLog << "--------------" << std::endl; - // - // gLog << - // "xml2lyService::fetchServicePassDescriptionsAsString ()" << - // std::endl; - // - // ++gIndenter; - // gLog << - // xml2lyService-> fetchServicePassDescriptionsAsString () << - // std::endl; - // --gIndenter; - // - // gLog << "--------------" << std::endl; - } - - // xml2brl - // ------------------------------ - - { - std::string serviceName = "xml2brl"; - -// Pass 1: reads the contents of MusicXMLFile or stdin ('-') -// and converts it to a MusicXML tree; -// Pass 2a: converts that MusicXML tree into -// a first Music Score Representation (MSR) skeleton; -// Pass 2b: populates the MSR skeleton from the MusicXML tree -// to get a full MSR; -// Pass 3: converts the first MSR into a second MSR, to apply options -// Pass 4: converts the second MSR into -// a first Braille Score Representation (BSR) -// containing one Braille page per MusicXML page; -// Pass 5: converts the first BSR into a second BSR -// with as many Braille pages as needed -// to fit the line and page lengthes; -// Pass 6: converts the BSR to Braille text -// and writes it to standard output. - - S_mfService - xml2brlService = - mfService::create (serviceName); - - xml2brlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_1, - gLanguage->convertAMusicXMLStreamIntoAnMXSR ())); - - xml2brlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_2, - gLanguage->convertTheMXSRIntoAnMSRSkeleton ())); - - xml2brlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_3, - gLanguage->populateTheMSRSkeletonFromMusicXMLData ())); - - xml2brlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_4, - gLanguage->convertTheFirstMSRIntoASecondMSR ())); - - xml2brlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_5, - gLanguage->convertTheSecondMSRIntoAnLPSR ())); - - xml2brlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_6, - gLanguage->convertTheLPSRIntoLilyPondCode ())); - - pGlobalServicesMap [mfServiceKind::kMfService_xml2brl] = xml2brlService; - } - - // xml2xml - // ------------------------------ - - { - std::string serviceName = "xml2xml"; - -// Pass 1: reads the contents of MusicXMLFile or stdin ('-') -// and converts it to a MusicXML tree; -// Pass 2a: converts that MusicXML tree into -// a first Music Score Representation (MSR) skeleton; -// Pass 2b: populates the MSR skeleton from the MusicXML tree -// to get a full MSR; -// Pass 3: converts the first MSR into a second MSR, to apply options; -// Pass 4: converts the second MSR into a second MusicXML tree; -// Pass 5: converts the second MusicXML tree to MusicXML code -// and writes it to standard output. - - S_mfService - xml2xmlService = - mfService::create (serviceName); - - xml2xmlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_1, - gLanguage->convertAMusicXMLStreamIntoAnMXSR ())); - - xml2xmlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_2, - gLanguage->convertTheMXSRIntoAnMSRSkeleton ())); - - xml2xmlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_3, - gLanguage->populateTheMSRSkeletonFromMusicXMLData ())); - - xml2xmlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_4, - gLanguage->convertTheFirstMSRIntoASecondMSR ())); - - xml2xmlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_5, - gLanguage->convertTheSecondMSRIntoAnLPSR ())); - - xml2xmlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_6, - gLanguage->convertTheLPSRIntoLilyPondCode ())); - - pGlobalServicesMap [mfServiceKind::kMfService_xml2xml] = xml2xmlService; - } - - // xml2gmn - // ------------------------------ - - { - std::string serviceName = "xml2gmn"; - - S_mfService - xml2gmnService = - mfService::create (serviceName); - -// Pass 1: reads the contents of MusicXMLFile or stdin ('-') -// and converts it to a first MusicXML tree; -// Pass 2a: converts that MusicXML tree into -// a first Music Score Representation (MSR) skeleton; -// Pass 2b: populates the MSR skeleton from the MusicXML tree -// to get a full MSR; -// Pass 3: converts the first MSR a second MSR, to apply options; -// Pass 4: converts the second MSR into a second MusicXML tree; -// Pass 5: converts the second MusicXML tree to Guido code -// and writes it to standard output. - - xml2gmnService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_1, - gLanguage->convertAMusicXMLStreamIntoAnMXSR ())); - - xml2gmnService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_2, - gLanguage->convertTheMXSRIntoAnMSRSkeleton ())); - - xml2gmnService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_3, - gLanguage->populateTheMSRSkeletonFromMusicXMLData ())); - - xml2gmnService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_4, - gLanguage->convertTheFirstMSRIntoASecondMSR ())); - - xml2gmnService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_5, - gLanguage->convertTheSecondMSRIntoAnLPSR ())); - - xml2gmnService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_6, - gLanguage->convertTheLPSRIntoLilyPondCode ())); - - pGlobalServicesMap [mfServiceKind::kMfService_xml2gmn] = xml2gmnService; - } - - // filter - // ------------------------------ - - { - std::string serviceName = "filter"; - -// What stringMatcherInterpreter does: -// -// This multi-pass converter performs various passes depending on the output generated, -// which should be specified by an option -// -// Other passes are performed according to the options, such as -// displaying views of the internal data or printing a summary of the score. -// -// The activity log and warning/error messages go to standard error. - - S_mfService - filterService = - mfService::create (serviceName); - - filterService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_1, - gLanguage->convertAMusicXMLStreamIntoAnMXSR ())); - - filterService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_2, - gLanguage->convertTheMXSRIntoAnMSRSkeleton ())); - - filterService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_3, - gLanguage->populateTheMSRSkeletonFromMusicXMLData ())); - - filterService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_4, - gLanguage->convertTheFirstMSRIntoASecondMSR ())); - - filterService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_5, - gLanguage->convertTheSecondMSRIntoAnLPSR ())); - - filterService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_6, - gLanguage->convertTheLPSRIntoLilyPondCode ())); - - pGlobalServicesMap [mfServiceKind::kMfService_stringMatcher] = filterService; - } - - // msdl - // ------------------------------ - - { - std::string serviceName = "msdl"; - -// What msdlConverter does: -// -// This multi-pass converter performs various passes depending on the output generated, -// which should be specified by an option -// -// Other passes are performed according to the options, such as -// displaying views of the internal data or printing a summary of the score. -// -// The activity log and warning/error messages go to standard error. - - S_mfService - msdlService = - mfService::create (serviceName); - - msdlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_1, - gLanguage->convertAMusicXMLStreamIntoAnMXSR ())); - - msdlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_2, - gLanguage->convertTheMXSRIntoAnMSRSkeleton ())); - - msdlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_3, - gLanguage->populateTheMSRSkeletonFromMusicXMLData ())); - - msdlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_4, - gLanguage->convertTheFirstMSRIntoASecondMSR ())); - - msdlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_5, - gLanguage->convertTheSecondMSRIntoAnLPSR ())); - - msdlService-> - appendPassToService ( - mfPass::create ( - mfPassIDKind::kMfPassID_6, - gLanguage->convertTheLPSRIntoLilyPondCode ())); - - pGlobalServicesMap [mfServiceKind::kMfService_msdl] = msdlService; - } - - // JMI v0.9.67 mfsl ??? ischeme ??? -} - - -} diff --git a/src/mflibrary/mfServices.h b/src/mflibrary/mfServices.h deleted file mode 100644 index b949fd76..00000000 --- a/src/mflibrary/mfServices.h +++ /dev/null @@ -1,347 +0,0 @@ - /* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfServices___ -#define ___mfServices___ - -#include - -#include "smartpointer.h" -#include "exports.h" - -#include "mfPasses.h" - - -using namespace MusicXML2; - -namespace MusicFormats -{ - -//______________________________________________________________________________ -enum class mfServiceKind { - // a given pass may have different IDs depending on the service - kMfService_UNKNOWN_, - - kMfService_xml2ly, - kMfService_xml2brl, - kMfService_xml2xml, - kMfService_xml2gmn, - - kMfService_stringMatcher, - - kMfService_msdl, - kMfService_mfsl, - - kMfService_ischeme -}; - -std::string mfServiceKindAsString ( - mfServiceKind serviceKind); - -std::ostream& operator << (std::ostream& os, const mfServiceKind elt); - -EXP mfIndentedStringStream& operator << ( - mfIndentedStringStream& iss, const mfServiceKind& elt); - -mfServiceKind mfServiceKindFromString ( - const std::string& theString); - -extern std::map - gGlobalMusicFormatsServiceKindsMap; - -std::string availableMusicFormatsServiceKinds (size_t namesListMaxLength); - -void initializeMusicFormatsServiceKindsMap (); - -void initializeMusicFormatsServices (); - -//______________________________________________________________________________ -class EXP mfService : public smartable -{ - public: - - // creation - // ------------------------------------------------------ - - static SMARTP create ( - const std::string& serviceName); - - public: - - // constructors/destructor - // ------------------------------------------------------ - - mfService ( - const std::string& serviceName); - - virtual ~mfService (); - - public: - - // set and get - // ------------------------------------------------------ - - // service name - std::string getServiceName () const - { return fServiceName; } - - // service pass descriptions - const std::list & - getServicePassesList () const - { return fServicePassesList; } - - public: - - // public services - // ------------------------------------------------------ - - void appendPassToService ( - const S_mfPass& pass) - { - fServicePassesList.push_back (pass); - } - - - void fetchPassIDKindList ( - std::list & passIDKindList) const; - - std::string fetchServicePassDescriptionsAsString () const; - - public: - - // print - // ------------------------------------------------------ - - void print (std::ostream& os) const; - - void printServiceForAboutOption (std::ostream& os) const; - - private: - - // private services - // ------------------------------------------------------ - - size_t fetchMaxPassIDKindAsStringLength () const; - - private: - - // private fields - // ------------------------------------------------------ - - // service name - std::string fServiceName; - - // service pass descriptions - std::list fServicePassesList; - - private: - - // private work fields - // ------------------------------------------------------ - - // JMIJMIJMI -}; -typedef SMARTP S_mfService; -EXP std::ostream& operator << (std::ostream& os, const S_mfService& elt); - -//______________________________________________________________________________ -class EXP mfServiceRunData : public smartable -{ - public: - - // creation - // ------------------------------------------------------ - - static SMARTP create ( - const std::string& serviceName); - -// static SMARTP create ( // JMI -// const std::string& serviceName, -// const S_oahHandler& runOahHandler); - - public: - - // constructors/destructor - // ------------------------------------------------------ - - mfServiceRunData ( - const std::string& serviceName); - -// mfServiceRunData ( -// const std::string& serviceName, -// const S_oahHandler& runOahHandler); - - virtual ~mfServiceRunData (); - - public: - - // set and get - // ------------------------------------------------------ - - // service name - std::string getServiceName () const - { return fServiceName; } - -// // OAH handler -// S_oahHandler getRunOahHandler () const -// { return fRunOahHandler; } - - // input source name - void setInputSourceName (const std::string& name) - { fInputSourceName = name; } - - std::string getInputSourceName () const - { return fInputSourceName; } - - // run date - std::string getRunDateFull () const - { return fRunDateFull; } - - std::string getRunDateYYYYMMDD () const - { return fRunDateYYYYMMDD; } - - // parts - void setCurrentPartIDAndName (const std::string partIDAndName) - { fCurrentPartIDAndName = partIDAndName; } - - const std::string getCurrentPartIDAndName () const - { return fCurrentPartIDAndName; } - - // staves - void setCurrentStaveNumber (int staveNumber) - { fCurrentStaveNumber = staveNumber; } - - int getCurrentStaveNumber () const - { return fCurrentStaveNumber; } - - // voices - void setCurrentVoiceNumber (int voiceNumber) - { fCurrentVoiceNumber = voiceNumber; } - - int getCurrentVoiceNumber () const - { return fCurrentVoiceNumber; } - - // measures - void setCurrentMeasureNumber (const std::string measureNumber) - { fCurrentMeasureNumber = measureNumber; } - - const std::string getCurrentMeasureNumber () const - { return fCurrentMeasureNumber; } - - void setScoreFirstMeasureNumber (const std::string& scoreFirstMeasureNumber) - { fScoreFirstMeasureNumber = scoreFirstMeasureNumber; } - - const std::string& getScoreFirstMeasureNumber () const - { return fScoreFirstMeasureNumber; } - - void setScoreLastMeasureNumber (const std::string& scoreLastMeasureNumber) - { fScoreLastMeasureNumber = scoreLastMeasureNumber; } - - const std::string& getScoreLastMeasureNumber () const - { return fScoreLastMeasureNumber; } - - void setScoreMeasuresNumber (int scoreMeasuresNumber) - { fScoreMeasuresNumber = scoreMeasuresNumber; } - - int getScoreMeasuresNumber () const - { return fScoreMeasuresNumber; } - - public: - - // public services - // ------------------------------------------------------ - - public: - - // print - // ------------------------------------------------------ - - void print (std::ostream& os) const; - - private: - - // private services - // ------------------------------------------------------ - - void initializeRunData (); - - void initializeRunDate (); - - private: - - // private fields - // ------------------------------------------------------ - - // service name - std::string fServiceName; - -// // OAH handler -// S_oahHandler fRunOahHandler; JMI v0.9.67 - - // input source name - std::string fInputSourceName; - - // run date - std::string fRunDateFull; - std::string fRunDateYYYYMMDD; - - // parts - std::string fCurrentPartIDAndName; - - // staves - int fCurrentStaveNumber; - - // voices - int fCurrentVoiceNumber; - - // measures - std::string fCurrentMeasureNumber; - - std::string fScoreFirstMeasureNumber; - std::string fScoreLastMeasureNumber; - - int fScoreMeasuresNumber; - - private: - - // private work fields - // ------------------------------------------------------ - - // JMIJMIJMI v0.9.67 -}; -typedef SMARTP S_mfServiceRunData; -EXP std::ostream& operator << (std::ostream& os, const S_mfServiceRunData& elt); - -//________________________________________________________________________ -// hidden global service variable -EXP void setGlobalService (mfServiceKind serviceKind); - -EXP S_mfService getGlobalService (); - -// a handy shortcut -#define gService getGlobalService () - -// hidden global current service run data variable -EXP void setGlobalServiceRunData (S_mfServiceRunData serviceRunData); - -EXP S_mfServiceRunData getGlobalServiceRunData (); - -// a handy shortcut -#define gServiceRunData getGlobalServiceRunData () - -//________________________________________________________________________ -EXP void initializeServices (); - - -} - - -#endif // ___mfServices___ diff --git a/src/mflibrary/mfStack.cpp b/src/mflibrary/mfStack.cpp deleted file mode 100644 index 648746a1..00000000 --- a/src/mflibrary/mfStack.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include "smartpointer.h" - -#include "mfIndentedTextOutput.h" -#include "mfStringsHandling.h" - -#include "mfStack.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -template -SMARTP> mfStack::create () -{ - mfStack* obj = new - mfStack (); - assert (obj != nullptr); - return obj; -} - -template -SMARTP> mfStack::create ( - const ELEMENT_TYPE& element) -{ - mfStack* obj = new - mfStack ( - element); - assert (obj != nullptr); - return obj; -} - -template -mfStack::mfStack () -{} - -template -mfStack::mfStack ( - const ELEMENT_TYPE& element) -{ - fElementsStdList.push_back (element); -} - -template -mfStack::~mfStack () -{} - -//______________________________________________________________________________ -template -Bool mfStack::contains ( - const ELEMENT_TYPE& value) const -{ - Bool result; - - for (ELEMENT_TYPE element : fElementsStdList) { - if (element == value) { - result = true; - break; - } - } // for - - return result; -} - -//______________________________________________________________________________ -template -void mfStack::print (std::ostream& os) const -{ - os << - "[mfStack" << - ", fElementsStackName: " << fElementsStackName << ':'; - - if (fElementsStdList.size ()) { - os << std::endl; - - ++gIndenter; - - for (ELEMENT_TYPE element : fElementsStdList) { - os << - element->asString () << - std::endl; - } // for - - --gIndenter; - } - - else { - os << - " [EMPTY]" << - std::endl; - } - - os << ']' << std::endl; -} - -template -void mfStack::printWithContext ( - const std::string& context, - char evidencer, - std::ostream& os) const -{ - size_t - theElementsStdListSize = - fElementsStdList.size (); - - os << - "The part groups stack contains " << - "[mfStack" << - ", fElementsStackName: \"" << fElementsStackName << "\"" << - ", " << - mfSingularOrPlural ( - theElementsStdListSize, "element", "elements") << - " -- " << - context << - ':'; - - if (fElementsStdList.size ()) { - os << std::endl; - - ++gIndenter; - - int counter = theElementsStdListSize - 1; - for (ELEMENT_TYPE element : fElementsStdList) { - os << - counter << ": " << evidencer << - std::endl; - - ++gIndenter; - os << - element << - std::endl; - --gIndenter; - - --counter; - } // for - - --gIndenter; - } - - else { - os << - " [EMPTY]" << - std::endl; - } - - os << ']' << std::endl; -} - -template -std::ostream& operator << (std::ostream& os, const mfStack& elt) -{ - elt.print (os); - return os; -} - -template -std::ostream& operator << (std::ostream& os, const SMARTP>& elt) -{ - elt->print (os); - return os; -} - - -} diff --git a/src/mflibrary/mfStack.h b/src/mflibrary/mfStack.h deleted file mode 100644 index 3c61a943..00000000 --- a/src/mflibrary/mfStack.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfStack___ -#define ___mfStack___ - -#include - -#include "exports.h" -#include "smartpointer.h" - - -using namespace MusicXML2; - -namespace MusicFormats -{ - -//______________________________________________________________________________ -template -class EXP mfStack : public smartable -/* - C++ std::stack cannot be traversed, so we use std::list instead - - https://www.programiz.com/cpp-programming/typename-templates - - https://en.cppreference.com/w/cpp/language/type_alias - - Do not put templated functions into the cpp file. - Since they are not implementations they are not found by the compiler/linker. - So leave them in the header file. - - member reference base type 'int' is not a structure or union - - https://stackoverflow.com/questions/580922/identifying-primitive-types-in-templates - - https://en.cppreference.com/w/cpp/language/template_specialization - - https://www.ibm.com/docs/en/zos/2.4.0?topic=only-explicit-specialization-c - - https://dev.to/sandordargo/what-are-type-traits-in-c-18j5 -*/ -{ - public: - - // creation - // ------------------------------------------------------ - - static SMARTP create (); - - static SMARTP create ( - const ELEMENT_TYPE& element); - - // constructors/destructor - // ------------------------------------------------------ - - mfStack (); - - mfStack (const ELEMENT_TYPE& element); - - virtual ~mfStack (); - - public: - - // set and get - // ------------------------------------------------------ - - const std::list & - getElementsStdList () const - { return fElementsStdList;} - - public: - - // public services - // ------------------------------------------------------ - - // basic list stuff - size_t size () const - { return fElementsStdList.size (); } - - void push ( - const ELEMENT_TYPE& element) - { fElementsStdList.push_front (element); } - - ELEMENT_TYPE& top () - { return fElementsStdList.front (); } - - void pop () - { fElementsStdList.pop_front (); } - - // specific stack stuff - Bool contains ( - const ELEMENT_TYPE& value) const; - - public: - - // print - // ------------------------------------------------------ - - void print (std::ostream& os) const; - - void printWithContext ( - const std::string& context, - char evidencer, - std::ostream& os) const; - - private: - - // private services - // ------------------------------------------------------ - - private: - - // private fields - // ------------------------------------------------------ - - std::string fElementsStackName; - - std::list - fElementsStdList; -}; - -template -EXP std::ostream& operator << (std::ostream& os, const mfStack& elt); - -template -EXP std::ostream& operator << (std::ostream& os, const SMARTP>& elt); - - -} - - -// //________________________________________________________________________ -// using namespace std; -// -// template -// pair>::~pair> () {}; - - -#endif // ___mfStack___ diff --git a/src/mflibrary/mfStringsHandling.cpp b/src/mflibrary/mfStringsHandling.cpp deleted file mode 100644 index c47f8e8c..00000000 --- a/src/mflibrary/mfStringsHandling.cpp +++ /dev/null @@ -1,2233 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include // std::setw, std::setprecision, ... -#include // strncat -#include - -#include "mfPreprocessorSettings.h" - -#include - -#include "mfAssert.h" -#include "mfStringsHandling.h" -#include "mfIndentedTextOutput.h" - -#include // for_each, find_if - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -//#define DEBUG_SPLITTING - -// //______________________________________________________________________________ -// mfMultiLineString::mfMultiLineString () -// { -// fValue = false; -// } -// -// mfMultiLineString::mfMultiLineString (bool value) -// { -// fValue = value; -// } -// -// mfMultiLineString::~mfMultiLineString () -// {} -// -// mfMultiLineString::mfMultiLineString(const mfMultiLineString& themfMultiLineString) { -// // std::cout << "mfMultiLineString copy constructor " << std::endl; // JMI CLAR -// -// // copy the value -// fValue = themfMultiLineString.getValue (); -// } -// -// /* -// // Declare prefix and postfix decrement operators. -// Point& operator--(); // Prefix decrement operator. -// Point operator--(int); // Postfix decrement operator. -// */ -// -// mfMultiLineString::mfMultiLineString (const std::string& theString) -// { -// if (theString == "false") { -// fValue = false; -// } -// else if (theString == "true") { -// fValue = true; -// } -// else { -// } -// } -// -// mfMultiLineString& mfMultiLineString::operator= (const mfMultiLineString& themfMultiLineString) -// { -// if (this != &themfMultiLineString) { // JMI costly? -// fValue = themfMultiLineString.getValue (); -// } -// -// return *this; -// } -// -// mfMultiLineString mfMultiLineString::operator! () const -// { -// mfMultiLineString result (! fValue); -// -// return result; -// } -// -// mfMultiLineString mfMultiLineString::operator&&(const mfMultiLineString& othermfMultiLineString) const -// { -// mfMultiLineString result (fValue && othermfMultiLineString.fValue); -// -// return result; -// } -// -// mfMultiLineString mfMultiLineString::operator||(const mfMultiLineString& othermfMultiLineString) const -// { -// mfMultiLineString result (fValue || othermfMultiLineString.fValue); -// -// return result; -// } -// -// EXP mfMultiLineString operator&& (const mfMultiLineString& leftmfMultiLineString, const bool& themfMultiLineString) -// { -// mfMultiLineString result (leftmfMultiLineString.getValue () && themfMultiLineString); -// -// return result; -// } -// -// EXP mfMultiLineString operator&& (const bool& themfMultiLineString, const mfMultiLineString& rightmfMultiLineString) -// { -// mfMultiLineString result (themfMultiLineString && rightmfMultiLineString.getValue ()); -// -// return result; -// } -// -// EXP mfMultiLineString operator|| (const mfMultiLineString& leftmfMultiLineString, const bool& themfMultiLineString) -// { -// -// mfMultiLineString result (leftmfMultiLineString.getValue () || themfMultiLineString); -// -// return result; -// } -// -// EXP mfMultiLineString operator|| (const bool& themfMultiLineString, const mfMultiLineString& rightmfMultiLineString) -// { -// mfMultiLineString result (themfMultiLineString || rightmfMultiLineString.getValue ()); -// -// return result; -// } -// -// std::string mfMultiLineString::asString () const -// { -// return -// fValue -// ? "true" -// : "false"; -// } -// -// void mfMultiLineString::print (std::ostream& os) const -// { -// os << asString (); -// } -// -// std::ostream& operator << (std::ostream& os, const mfMultiLineString& theBool) { -// theBool.print (os); -// return os; -// } - -//______________________________________________________________________________ -std::string mfReplicateChar ( - char theChar, - int times) -{ - std::string result; - - for (int i = 0; i < times; ++i) - result += theChar; - - return result; -} - -std::string mfReplicateString ( - std::string theString, - int times) -{ - std::string result; - - for (int i = 0; i < times; ++i) - result += theString; - - return result; -} - -//______________________________________________________________________________ -/* JMI -std::string replaceSubstringInString ( - std::string theString, - std::string subString, - std::string ersatz) -{ - std::string result = theString; - - size_t found = result.find (subString); - - if (found != std::string::npos) { - result.replace (found, subString.size (), ersatz); - } - - return result; -} -*/ - -//_______________________________________________________________________________ -EXP void mfDisplayArgcAndArgv ( - int argc, - char* argv[], - std::ostream& os) -{ - os << - "The contents of argv is:" << - std::endl; - - ++gIndenter; - - for (int i = 0; i < argc; ++i) { - os << - "argv [" << - std::right << std::setw (2) << - i << - "]: " << argv [i] << - std::endl; - } // for - - --gIndenter; -} - -//______________________________________________________________________________ -void mfDisplayStringsVector ( - const mfStringsVector& stringsVector, - const std::string& title, - std::ostream& os) -{ - os << - title << - " contains " << - mfSingularOrPlural ( - stringsVector.size (), "element", "elements"); - - if (stringsVector.size ()) { - os << ":" << std::endl; - - ++gIndenter; - - int counter = 0; - for (std::string theString : stringsVector) { - os << - std::right << std::setw (2) << counter++ << - ": \"" << - theString << - "\"" << - std::endl; - } //for - - --gIndenter; - } - else { - os << std::endl; - } -} - -//______________________________________________________________________________ -char* mfCharStarCat ( - char* destination, - const char* source, - const size_t destinationSize) -{ - Bool - destinationOverflow = - strlen (source) >= destinationSize - strlen (destination) - 1; - - if (destinationOverflow) { - std::stringstream ss; - - ss << - "mfCharStarCat(): attempt at destination overflow" << - ", destinationSize: [" << destinationSize << - "], destination: [" << destination << - "], strlen (source): [" << strlen (source) << - "], source: [" << source << - "], destinationSize - strlen (destination) - 1: [" << destinationSize - strlen (destination) - 1 << - ']'; - -#ifdef MF_SANITY_CHECKS_ARE_ENABLED - // sanity check - mfAssert ( - __FILE__, __LINE__, - false, - ss.str ()); -#endif // MF_SANITY_CHECKS_ARE_ENABLED - } - - return - strncat ( - destination, - source, - destinationSize - strlen (destination) - 1); -} - -//______________________________________________________________________________ -std::string mfIntToEnglishWord (int n) -{ - if (n == -9) { - assert (false); // JMI - } - - std::stringstream ss; - - if (n < 0) { - ss << "Minus_"; - n = -n; - } - - if (n >= 1000) { - int nDiv1000 = n / 1000; - int nModulo1000 = n % 1000; - - return - mfIntToEnglishWord (nDiv1000) + - "Thousand" + - mfIntToEnglishWord (nModulo1000); - } - - else if (n >= 100) { - //return "LargerThanNinetyNine"; - int nDiv100 = n / 100; - int nModulo100 = n % 100; - - return - mfIntToEnglishWord (nDiv100) + - "HundredAnd" + - mfIntToEnglishWord (nModulo100); - } - - else { - switch (n) { - case 0: - ss << "Zero"; - break; - case 1: - ss << "One"; - break; - case 2: - ss << "Two"; - break; - case 3: - ss << "Three"; - break; - case 4: - ss << "Four"; - break; - case 5: - ss << "Five"; - break; - case 6: - ss << "Six"; - break; - case 7: - ss << "Seven"; - break; - case 8: - ss << "Eight"; - break; - case 9: - ss << "Nine"; - break; - case 10: - ss << "Ten"; - break; - case 11: - ss << "Eleven"; - break; - case 12: - ss << "Twelve"; - break; - case 13: - ss << "Thirteen"; - break; - case 14: - ss << "Fourteen"; - break; - case 15: - ss << "Fifteen"; - break; - case 16: - ss << "Sixteen"; - break; - case 17: - ss << "Seventeen"; - break; - case 18: - ss << "Eighteen"; - break; - case 19: - ss << "Nineteen"; - break; - - default: { - // n >= 20 - int nDiv10 = n / 10; - int nModulo10 = n % 10; - - switch (nDiv10) { - case 2: - ss << "Twenty"; - break; - case 3: - ss << "Thirty"; - break; - case 4: - ss << "Fourty"; - break; - case 5: - ss << "Fifty"; - break; - case 6: - ss << "Sixty"; - break; - case 7: - ss << "Seventy"; - break; - case 8: - ss << "Eighty"; - break; - case 9: - ss << "Ninety"; - break; - } // switch - ss << mfIntToEnglishWord (nModulo10); - } // default - } // switch - } - - return ss.str (); -} - -//______________________________________________________________________________ -std::string mfStringNumbersToEnglishWords (std::string theString) -{ - if (! theString.size ()) { - return "NONE"; - } - - enum workState { - kInitialState, kWorkingOnDigits, kWorkingOnNonDigits }; - - std::vector chunks; - std::vector states; - - workState state = kInitialState; - - for (char theChar : theString) { - if( isdigit (theChar)) { - // digit - if (state != kWorkingOnDigits) { - // create a new chunck for digits - chunks.push_back (""); - states.push_back (kWorkingOnDigits); - state = kWorkingOnDigits; - } - chunks.back().push_back (theChar); - } - else { - // non digit - if (state != kWorkingOnNonDigits) { - // create a new chunck for non digits - chunks.push_back (""); - states.push_back (kWorkingOnNonDigits); - state = kWorkingOnNonDigits; - } - chunks.back().push_back (theChar); - } - } // for - - std::string result = ""; - - for (size_t i = 0; i < chunks.size (); ++i) { - if (states[i] == kWorkingOnDigits) { - int integerValue; - - std::istringstream inputStream (chunks[i]); - - inputStream >> integerValue; - - result += mfIntToEnglishWord (integerValue); - } - else { - result += chunks[i]; - } - } // for - -// gLog << JMI v0.9.68 -// "mfStringNumbersToEnglishWords(): result = " << result << -// std::endl; - - return result; -}; - -//______________________________________________________________________________ -std::string mfInputLineNumbersAsString ( - int inputStartLineNumber, - int inputEndLineNumber) -{ - std::stringstream ss; - - if (inputEndLineNumber == inputStartLineNumber) { - ss << - "line " << inputStartLineNumber; - } - else { - if (inputEndLineNumber == 0) { - ss << - "line " << inputStartLineNumber; - } - else { - ss << - "lines " << inputStartLineNumber << '-' << inputEndLineNumber; - } - } - - return ss.str (); -} - -//______________________________________________________________________________ -int consumeDecimalNumber ( - std::string::const_iterator theStringIterator, - std::string::const_iterator& remainingStringIterator, - Bool debugMode) -{ - std::string::const_iterator cursor = theStringIterator; - int result = 0; - - if (! isdigit (*cursor)) { - gLog << - "consumeDecimalNumber (" << *cursor << - "), " << *cursor << " is no decimal digit!" << - std::endl; - } - - while (isdigit (*cursor)) { - if (debugMode) { - gLog << - "--> consumeDecimalNumber: cursor = |" << - *cursor << - "|" << - std::endl; - } - - result = result*10 + (*cursor-'0'); - - ++cursor; - } // while - - remainingStringIterator = cursor; - - if (debugMode) { - gLog << - "--> consumeDecimalNumber: result: " << result << - ", *remainingStringIterator = |" << *remainingStringIterator << - "|" << - std::endl; - } - - return result; -} - -//______________________________________________________________________________ -std::set mfDecipherNaturalNumbersSetSpecification ( - const std::string& theString, - Bool debugMode) -{ - // A naturalNumbersSetSpecification sample is: "7,15-19,^16-17" - - std::set result; - - if (debugMode) { - gLog << - "--> mfDecipherNaturalNumbersSetSpecification, theString = |" << theString << - "|" << - std::endl; - } - - if (theString.size ()) { - std::string::const_iterator - cursor = theString.begin (); - - while (1) { - if (debugMode) { - gLog << - "--> mfDecipherNaturalNumbersSetSpecification: cursor = |" << - *cursor << "|" << - std::endl; - } - - int negated = 0; - - if (*cursor == '^') { - ++cursor; - negated = 1; - } - - int - intervalStartNumber = - consumeDecimalNumber (cursor, cursor, debugMode), - intervalEndNumber; - - if (*cursor == '-') { - ++cursor; - - if (debugMode) { - gLog << - "--> mfDecipherNaturalNumbersSetSpecification after '-' : cursor = |" << - *cursor << - "|" << - std::endl << std::endl; - } - - intervalEndNumber = - consumeDecimalNumber (cursor, cursor, debugMode); - } - - else { - intervalEndNumber = intervalStartNumber; - } - - if (debugMode) { - gLog << - "--> mfDecipherNaturalNumbersSetSpecification" << - ", intervalStartNumber: " << intervalStartNumber << - ", intervalEndNumber: " << intervalEndNumber << - ": *cursor = |" << *cursor << "|" << - std::endl; - } - - for (int i = intervalStartNumber; i <= intervalEndNumber; ++i) { - if (negated) { - result.erase (i); - } - else { - result.insert (i); - } - } // for - - if (*cursor != ',') { - if (debugMode) { - gLog << - "--> mfDecipherNaturalNumbersSetSpecification, after non ',' : cursor = |" << - *cursor << - "|" << - std::endl << std::endl; - } - break; - } - - ++cursor; - - if (debugMode) { - gLog << - "--> mfDecipherNaturalNumbersSetSpecification after ',' : cursor = |" << - *cursor << - "|" - << std::endl << - std::endl; - } - } // while - - if (* cursor != '\0') { - gLog << - "--> Extraneous characters |" << *cursor << - "| in numbers spec" << - std::endl << std::endl; - } - } - - return result; -} - -//______________________________________________________________________________ -std::string consumeString ( - std::string::const_iterator theStringIterator, - std::string::const_iterator& remainingStringIterator, - Bool debugMode) -{ - std::string result; - -/* JMI v0.9.66 ??? - std::string::const_iterator cursor = theStringIterator; - - while ((*cursor) != ',') { - if (debugMode) { - gLog << - "--> consumeString: cursor = |" << - *cursor << - "|" << - std::endl; - } - - result += (*cursor); - - if (++cursor == theString.end ()) break; - } // while - - remainingStringIterator = cursor; - - if (debugMode) { - gLog << - "--> consumeString: result: " << result << - ", *remainingStringIterator = |" << *remainingStringIterator << - "|" << - std::endl; - } -*/ - - return result; -} - -//______________________________________________________________________________ -std::set mfDecipherStringsSetSpecification ( - const std::string& theString, - Bool debugMode) -{ - // A integersSetSpecification sample is: "FOO,159,haLLo" - - std::set result; - -/* JMI v0.9.66 ??? - if (debugMode) { - gLog << - "--> mfDecipherStringsSetSpecification, theString = |" << theString << - "|" << - std::endl; - } - - std::string::const_iterator - cursor = theString.begin (); - - while (1) { - if (debugMode) { - gLog << - "--> mfDecipherStringsSetSpecification: cursor = |" << - *cursor << "|" << - std::endl; - } - - std::string - currentString = - consumeString (cursor, theString.end (), debugMode); - - if (debugMode) { - gLog << - "--> mfDecipherStringsSetSpecification" << - ", currentString: " << currentString << - ": *cursor = |" << *cursor << "|" << - std::endl; - } - - result.insert (currentString); - - if (*cursor != ',') { - if (debugMode) { - gLog << - "--> mfDecipherStringsSetSpecification, after non ',' : cursor = |" << - *cursor << - "|" << - std::endl << std::endl; - } - break; - } - - if (++cursor == theString.end ()) break; - - if (debugMode) { - gLog << - "--> mfDecipherStringsSetSpecification after ',' : cursor = |" << - *cursor << - "|" - << std::endl << - std::endl; - } - } // while - - if (* cursor != '\0') { - gLog << - "--> Extraneous characters |" << *cursor << - "| in numbers spec" << - std::endl << std::endl; - } - */ - - return result; -} - -//______________________________________________________________________________ -std::list mfExtractNumbersFromString ( - const std::string& theString, // can contain "1, 2, 17" - Bool debugMode) -{ - std::list foundNumbers; - - if (debugMode) { - gLog << - "--> mfExtractNumbersFromString, theString = |" << theString << - "|" << - std::endl; - } - - if (theString.size ()) { - std::string::const_iterator - cursor = theString.begin (); - - while (1) { - if (cursor == theString.end ()) - break; - - if (debugMode) { - gLog << - "--> mfExtractNumbersFromString: cursor = |" << - *cursor << "|" << - std::endl; - } - - if (isdigit (*cursor)) { - // consume a decimal number - int n = 0; - while (isdigit (*cursor)) { - n = n * 10 + (*cursor - '0'); - ++cursor; - } // while - - // append the number to the list - foundNumbers.push_back (n); - } - else { - ++cursor; - } - } // while - } - - return foundNumbers; -} - - -//______________________________________________________________________________ -std::string& mfLeftTrim (std::string& s) -{ - std::function - checkSpace = - [] (int x) { return isspace (x); }; - - s.erase ( - s.begin (), - find_if ( - s.begin (), - s.end (), - std::not_fn (checkSpace) // since C++17 - ) - ); - - return s; -} - -std::string& mfRightTrim (std::string& s) -{ - std::function - checkSpace = - [] (int x) { return isspace (x); }; - - s.erase ( - find_if ( - s.rbegin (), - s.rend (), - std::not_fn (checkSpace) // since C++17 - ).base(), - s.end () - ); - - return s; -} - -//______________________________________________________________________________ -std::pair mfExtractNamesPairFromString ( - const std::string& theString, // can contain "P1 = Bassoon" - char separator, - Bool debugMode) -{ - std::string name1; - std::string name2; - - if (debugMode) { - gLog << - "--> mfExtractNamesPairFromString, theString = |" << theString << - "|" << - std::endl; - } - - if (theString.size ()) { - std::string::const_iterator - cursor = theString.begin (); - - // fetch name1 - while (1) { - if (cursor == theString.end ()) - break; - - if (debugMode) { - gLog << - "--> mfExtractNamesPairFromString: cursor = |" << - *cursor << "|" << - std::endl; - } - - if ((*cursor) == separator) { - // found the separator - break; - } - - // append the character to name1 - name1 += *cursor; - ++cursor; - } // while - - name1 = mfTrimFromBothEnds (name1); - if (! name1.size ()) { - // found an empty name1 - gLog << - "### ERROR: the first name before the " << separator << - " separator is empty in '" << theString << '\'' << - std::endl; - } - - if (cursor == theString.end ()) - gLog << - "### ERROR: the " << separator << - " separator is missing in std::string '" << - theString << '\'' << - std::endl; - else - // overtake the separator - ++cursor; - - // fetch name2 - while (1) { - if (cursor == theString.end ()) - break; - - if (debugMode) { - gLog << - "--> mfExtractNamesPairFromString: cursor = |" << - *cursor << "|" << - std::endl; - } - - if ((*cursor) == '=') { - // found the separator - gLog << - "### ERROR: the " << separator << - " separator occurs more than once in std::string '" << - theString << '\'' << - std::endl; - break; - } - - // append the character to name2 - name2 += *cursor; - ++cursor; - } // while - - name2 = mfTrimFromBothEnds (name2); - if (! name2.size ()) { - // found an empty name2 - gLog << - "### ERROR: the second name after the " << separator << - " separator is empty in '" << theString << '\'' << - std::endl; - } - } - - return std::make_pair (name1, name2); -} - -//______________________________________________________________________________ -std::string mfDoubleQuoteStringIfNonAlpha ( - const std::string& theString) -{ - std::string result; - - Bool stringShouldBeDoubleQuoted (false); - - if (theString.size ()) { - Bool stringContainsNotPrintableCharacters (false); - - for (char theChar : theString) { - // is theChar printable? - if (! isprint (theChar)) { - stringShouldBeDoubleQuoted = true; - } - - // append theChar to result // JMI v0.9.70 - result += theChar; - -// if ( -// (theChar >= 'a' && theChar <= 'z') -// || -// (theChar >= 'A' && theChar <= 'Z') -// ) { -// // theChar is a letter -// result += theChar; -// } -// -// else { -// // theChar is not a letter -// if (theChar == ' ') -// result += ' '; // TEMP JMI -// else if (theChar == '\t') -// result += ' '; // TEMP JMI -// else -// result += theChar; -// -// stringShouldBeDoubleQuoted = true; -// } - } // for - } - - if (stringShouldBeDoubleQuoted) { - return "\"" + result + "\""; - } - else { - return result; - } -} - -//______________________________________________________________________________ -std::string mfQuoteStringIfNonAlpha ( - const std::string& theString) -{ - std::string result; - - Bool stringShouldBeQuoted (false); - - if (theString.size ()) { - for (char theChar : theString) { - if ( - (theChar >= 'a' && theChar <= 'z') - || - (theChar >= 'A' && theChar <= 'Z') - ) { - // theChar is a letter - result += theChar; - } - - else { - // theChar is not a letter - if (theChar == ' ') - result += ' '; // TEMP JMI - else - result += theChar; - - stringShouldBeQuoted = true; - } - } // for - } - - if (stringShouldBeQuoted) { - return "'" + result + '\''; - } - else { - return result; - } -} - -//______________________________________________________________________________ -std::string mfDoubleQuoteStringContentsOnly ( - const std::string& theString) -{ - std::string result; - - if (theString.size ()) { - for (char theChar : theString) { - if (theChar == '"') { - result += "\\\""; - } - else { - result += theChar; - } - } // for - } - - return result; - -// std::ostringstream ss; -// -// ss << std::quoted (theString); -// -// return ss.str(); -} - -//______________________________________________________________________________ -std::string mfDoubleQuoteString ( - const std::string& theString) -{ - return "\"" + mfDoubleQuoteStringContentsOnly (theString) + "\""; -} - -//______________________________________________________________________________ -std::string mfDoubleQuoteStringIfNonWord ( - const std::string& theString) -{ - std::string result; - - Bool stringShouldBeDoubleQuoted (false); - - if (theString.size ()) { - for (char theChar : theString) { - if (! std::isalpha (theChar)) { - stringShouldBeDoubleQuoted = true; - } - - if (theChar == '"') { - result += "\\\""; - } - else { - result += theChar; - } - } // for - } - - if (stringShouldBeDoubleQuoted) { - return "\"" + result + "\""; - } - else { - return result; - } -} - -//______________________________________________________________________________ -std::string mfSingleQuoteStringContentsOnly ( - const std::string& theString) -{ - std::string result; - - if (theString.size ()) { - for (char theChar : theString) { - if (theChar == '\'') { - result += "\\\'"; - } - else { - result += theChar; - } - } // for - } - - return result; -} - -std::string mfSingleQuoteString ( - const std::string& theString) -{ - return "'" + mfSingleQuoteStringContentsOnly (theString) + '\''; -} - -//______________________________________________________________________________ -std::string mfStringToLowerCase ( - const std::string& theString) -{ - std::string result = theString; - - for_each ( - result.begin(), - result.end(), - [] (char& theChar) - { - theChar = ::tolower (theChar); - } - ); // for_each - - return result; -} - -std::string mfStringToUpperCase ( - const std::string& theString) -{ - std::string result = theString; - - for_each ( - result.begin(), - result.end(), - [] (char& theChar) - { - theChar = ::toupper (theChar); - } - ); // for_each - - return result; -} - -//______________________________________________________________________________ -void mfTrimString ( - std::string& theString, - const char* toBeRemoved) -{ - theString.erase ( - 0, - theString.find_first_not_of (toBeRemoved)); - - theString.erase ( - theString.find_last_not_of (toBeRemoved) + 1); -} - -std::string trimSpaces (const std::string& line) // KEEP ??? JMI -{ - const char* WhiteSpace = " \t\v\r\n"; - - size_t start = line.find_first_not_of(WhiteSpace); - size_t end = line.find_last_not_of(WhiteSpace); - - return - start == end ? std::string() : line.substr(start, end - start + 1); -} - -//______________________________________________________________________________ -std::string mfBooleanAsString (Bool value) -{ - return - std::string ( - value - ? "true" - : "false"); -} - -//______________________________________________________________________________ -std::string mfSingularOrPlural ( - int number, - std::string singularName, - std::string pluralName) -{ - std::stringstream ss; - - ss << - number << ' '; - - if (number <= 1) { - ss << - singularName; - } - else { - ss << - pluralName; - } - - return ss.str (); -} - -std::string mfSingularOrPluralWithoutNumber ( - int number, - std::string singularName, - std::string pluralName) -{ - std::stringstream ss; - - if (number <= 1) { - ss << - singularName; - } - else { - ss << - pluralName; - } - - return ss.str (); -} - -//______________________________________________________________________________ -std::string mfEscapeDoubleQuotes (std::string s) -{ - std::string result; - - for_each ( - s.begin (), - s.end (), - mfStringQuoteEscaper (result)); - - // replace occurrences of '\\"' by '\"', - // in case there were already double quotes in std::string - std::string - lookedFor = "\\\\\"", - ersatz = "\\\""; - - for ( ; ; ) { - size_t found = result.find (lookedFor); - - if (found == std::string::npos) - break; - - result.replace (found, lookedFor.size (), ersatz); - } // for - - return result; -} - -//______________________________________________________________________________ -void mfConvertHTMLEntitiesToPlainCharacters (std::string& s) -{ - std::map conversionMap; - - conversionMap ["&"] = "&"; - conversionMap ["\""] = """; - conversionMap ["'"] = "'"; - conversionMap ["<"] = "<"; - conversionMap [">"] = ">"; - - std::map ::const_iterator i; - - for (i = conversionMap.begin (); i != conversionMap.end (); ++i) { - std::string - lookedFor = i->second, - ersatz = i->first; - - // replace all occurrences of lookedFor by ersatz - for ( ; ; ) { - size_t found = s.find (lookedFor); - - if (found == std::string::npos) - break; - - s.replace (found, lookedFor.size (), ersatz); - } // for - - } // for -} - -//______________________________________________________________________________ -void mfSplitStringIntoChunks ( - std::string theString, - std::string theSeparator, - std::list & chunksList) -{ -#ifdef DEBUG_SPLITTING - gLog << - "---> splitting |" << theString << "|" << - std::endl << std::endl; -#endif // DEBUG_SPLITTING - - size_t theStringSize = theString.size (); - - size_t currentPosition = 0; - -#ifdef DEBUG_SPLITTING - std::string remainder = theString; -#endif // DEBUG_SPLITTING - - size_t theSeparatorSize = theSeparator.size (); - - std::map ::const_iterator i; - - while (1) { - size_t found = - theString.find (theSeparator, currentPosition); - - if (found == std::string::npos) { - // fetch the last chunk - // we have a last chunk - // from currentPosition to theStringSize - int chunkLength = theStringSize - currentPosition; - - std::string - chunk = - theString.substr ( - currentPosition, - chunkLength); - - chunksList.push_back ( - chunk); - -#ifdef DEBUG_SPLITTING - gLog << - "theStringSize: " << theStringSize << - std::endl << - "currentPosition: " << currentPosition << - std::endl << - "remainder = |" << remainder << "|" << - std::endl << - "chunkLength: " << chunkLength << - std::endl << - "chunk = \"" << chunk << "\"" << - std::endl << std::endl; -#endif // DEBUG_SPLITTING - - break; - } - - else { - // we have a chunk from currentPosition to found - int chunkLength = found - currentPosition; - - std::string - chunk = - theString.substr ( - currentPosition, - chunkLength); - - // append it to the chunks list - chunksList.push_back ( - chunk); - - // advance the cursor - currentPosition += - chunkLength + theSeparatorSize; - - // there can be an end of line JMI - if (theString [currentPosition] == '\n') - ++currentPosition; - -#ifdef DEBUG_SPLITTING - // set remainder - remainder = - theString.substr ( - currentPosition); - - gLog << - "theStringSize: " << theStringSize << - std::endl << - "currentPosition: " << currentPosition << - std::endl << - "remainder = |" << remainder << "|" << - std::endl << - "found: " << found << - std::endl << - "chunkLength: " << chunkLength << - std::endl << - "chunk = \"" << chunk << "\"" << - std::endl << std::endl; -#endif // DEBUG_SPLITTING - } - } // while -} - -//______________________________________________________________________________ -void mfSplitRegularStringAtEndOfLines ( - std::string theString, - std::list & chunksList) -{ -#ifdef DEBUG_SPLITTING - gLog << - "---> splitting |" << theString << "|" << - std::endl << std::endl; -#endif // DEBUG_SPLITTING - - mfSplitStringIntoChunks ( - theString, - "\n", - chunksList); - - /* JMI - size_t theStringSize = theString.size (); - - size_t currentPosition = 0; - -#ifdef DEBUG_SPLITTING - std::string remainder = theString; -#endif // DEBUG_SPLITTING - - std::string lookedFor = "\n"; - size_t lookedForSize = lookedFor.size (); - - std::map ::const_iterator i; - - while (1) { - size_t found = - theString.find (lookedFor, currentPosition); - - if (found == std::string::npos) { - // fetch the last chunk - // we have a last chunk - // from currentPosition to theStringSize - int chunkLength = theStringSize - currentPosition; - - std::string - chunk = - theString.substr ( - currentPosition, - chunkLength); - - chunksList.push_back ( - chunk); - -#ifdef DEBUG_SPLITTING - gLog << - "theStringSize: " << theStringSize << - std::endl << - "currentPosition: " << currentPosition << - std::endl << - "remainder = |" << remainder << "|" << - std::endl << - "chunkLength: " << chunkLength << - std::endl << - "chunk = \"" << chunk << "\"" << - std::endl << std::endl; -#endif // DEBUG_SPLITTING - - break; - } - - else { - // we have a chunk from currentPosition to found - int chunkLength = found - currentPosition; - - std::string - chunk = - theString.substr ( - currentPosition, - chunkLength); - - // append it to the chunks list - chunksList.push_back ( - chunk); - - // advance the cursor - currentPosition += - chunkLength + lookedForSize; - - // there can be an end of line JMI - if (theString [currentPosition] == '\n') - ++currentPosition; - -#ifdef DEBUG_SPLITTING - // set remainder - remainder = - theString.substr ( - currentPosition); - - gLog << - "theStringSize: " << theStringSize << - std::endl << - "currentPosition: " << currentPosition << - std::endl << - "remainder = |" << remainder << "|" << - std::endl << - "found: " << found << - std::endl << - "chunkLength: " << chunkLength << - std::endl << - "chunk = \"" << chunk << "\"" << - std::endl << std::endl; -#endif // DEBUG_SPLITTING - } - } // while - */ -} - -//______________________________________________________________________________ -void mfSplitHTMLStringContainingEndOfLines ( - std::string theString, - std::list & chunksList) -{ -#ifdef DEBUG_SPLITTING - gLog << - "---> splitting |" << theString << "|" << - std::endl << std::endl; -#endif // DEBUG_SPLITTING - - size_t theStringSize = theString.size (); - - std::map conversionMap; // JMI - - conversionMap ["&"] = "&"; - conversionMap ["\""] = """; - conversionMap ["'"] = "'"; - conversionMap ["<"] = "<"; - conversionMap [">"] = ">"; - - size_t currentPosition = 0; - -#ifdef DEBUG_SPLITTING - std::string remainder = theString; -#endif // DEBUG_SPLITTING - -// JMI std::string lookedFor = " "; - std::string lookedFor = "\n"; - size_t lookedForSize = lookedFor.size (); - - std::map ::const_iterator i; - -/* - for (i = conversionMap.begin (); i != conversionMap.end (); ++i) { - std::string - lookedFor = i->second, - ersatz = i->first; - // replace all occurrences of lookedFor by ersatz - } // for -*/ - - while (1) { - size_t found = - theString.find (lookedFor, currentPosition); - - if (found == std::string::npos) { - // fetch the last chunk - // we have a last chunk - // from currentPosition to theStringSize - int chunkLength = theStringSize - currentPosition; - - std::string - chunk = - theString.substr ( - currentPosition, - chunkLength); - - chunksList.push_back ( - chunk); - -#ifdef DEBUG_SPLITTING - gLog << - "theStringSize: " << theStringSize << - std::endl << - "currentPosition: " << currentPosition << - std::endl << - "remainder = |" << remainder << "|" << - std::endl << - "chunkLength: " << chunkLength << - std::endl << - "chunk = \"" << chunk << "\"" << - std::endl << std::endl; -#endif // DEBUG_SPLITTING - - break; - } - - else { - // we have a chunk from currentPosition to found - int chunkLength = found - currentPosition; - - std::string - chunk = - theString.substr ( - currentPosition, - chunkLength); - - // append it to the chunks list - chunksList.push_back ( - chunk); - - // advance the cursor - currentPosition += - chunkLength + lookedForSize; - - // there can be an end of line JMI - if (theString [currentPosition] == '\n') - ++currentPosition; - -#ifdef DEBUG_SPLITTING - // set remainder - remainder = - theString.substr ( - currentPosition); - - gLog << - "theStringSize: " << theStringSize << - std::endl << - "currentPosition: " << currentPosition << - std::endl << - "remainder = |" << remainder << "|" << - std::endl << - "found: " << found << - std::endl << - "chunkLength: " << chunkLength << - std::endl << - "chunk = \"" << chunk << "\"" << - std::endl << std::endl; -#endif // DEBUG_SPLITTING - } - } // while -} - -//______________________________________________________________________________ -std::string mfBaseName (const std::string& filename) -{ - std::string result; - - size_t filenameSize = filename.size (); - - if (filename.size ()) { - size_t lastSeparatorPosition = filename.find_last_of ("/\\"); - - if (lastSeparatorPosition == std::string::npos) { - result = filename; - } - else { - result = filename.substr ( - lastSeparatorPosition + 1, - filenameSize - lastSeparatorPosition - 1); - } - } - -// if (index + 1 >= len) { -// --len; -// index = filename.substr (0, len).find_last_of ("/\\"); -// -// if (len == 0) { -// return filename; -// } -// -// if (index == 0) { -// return filename.substr (1, len - 1); -// } -// -// if (index == std::string::npos) { -// return filename.substr (0, len); -// } -// -// return filename.substr (index + 1, len - index - 1); -// } -// -// return filename.substr (index + 1, len - index); - - return result; -} - -//______________________________________________________________________________ -std::string mfMakeSingleWordFromString (const std::string& theString) -{ - std::string result; - - if (theString.size ()) { - for (char theChar : theString) { - if (isalnum (theChar)) { - result.push_back (theChar); - } - } // for - } - - return result; -} - -//______________________________________________________________________________ -Bool mfStringIsInStringSet ( - const std::string& theString, - const std::set & stringSet) -{ - Bool result (false); - - if (stringSet.size ()) { - std::set ::const_iterator - it = - stringSet.find ( - theString); - - if (it != stringSet.end ()) { - result = true; - } - } - - return result; -} - -void mfStringSetMinusEquals ( - std::set & dest, - const std::set & source) -{ - for (std::string theString : source) { - size_t - numberOfEraseElements = - dest.erase (theString); - - gLog << - "numberOfEraseElements: " << numberOfEraseElements << - std::endl; - } // for -} - -std::string mfStringSetAsString ( - const std::set & stringSet) -{ - std::stringstream ss; - - // append the set elements if any to ss - size_t stringSetSize = - stringSet.size (); - - if (stringSetSize) { - size_t nextToLast = stringSetSize - 1; - - size_t count = 0; - - for (std::string theString : stringSet) { - ++count; - - ss << "\"" << theString << "\""; - - if (count == nextToLast) { - ss << " and "; - } - else if (count != stringSetSize) { - ss << ", "; - } - } // for - } - - return ss.str (); -} - -std::string mfStringSetAsBracketedString ( - const std::set & stringSet) -{ - std::stringstream ss; - - ss << '[' << mfStringSetAsString (stringSet) << ']'; - - return ss.str (); -} - -void mfDisplayStringSet ( - const std::string& title, - const std::set & stringSet, - std::ostream& os) -{ - // print the title - os << title << ":"; - - // print the set elements if any - size_t stringSetSize = - stringSet.size (); - - if (stringSetSize) { - os << std::endl; - - ++gIndenter; - - size_t nextToLast = - stringSetSize - 1; - - size_t count = 0; - - for ( - std::set ::const_iterator - i = stringSet.begin (), - iEnd = stringSet.end (); - i != iEnd; - ++i - ) { - std::string theString = (*i); - - ++count; - - os << "\"" << theString << "\""; - if (++i == iEnd) break; - - if (count == nextToLast) { - os << " and "; - } - else if (count != stringSetSize) { - os << ", "; - } - } // for - - --gIndenter; - } - else { - os << " empty"; - } - - os << std::endl; -} - -//______________________________________________________________________________ -Bool mfFetchValueFromStringToStringMap ( - const std::string& theKey, - const std::map & stringToStringMap, - std::string& theValue) -{ - Bool result (false); - - if (stringToStringMap.size ()) { - std::map ::const_iterator - it = - stringToStringMap.find ( - theKey); - - if (it != stringToStringMap.end ()) { - theValue = (*it).second; - result = true; - } - } - - return result; -} - -std::string mfStringToStringMapAsString ( - const std::map & stringToStringMap) -{ - std::stringstream ss; - - ss << '['; - - // append the set elements if any - size_t stringToStringMapSize = - stringToStringMap.size (); - - if (stringToStringMapSize) { - size_t nextToLast = - stringToStringMapSize - 1; - - size_t count = 0; - - for ( - std::map ::const_iterator - i = stringToStringMap.begin (), - iEnd = stringToStringMap.end (); - i != iEnd; - ++i - ) { - std::pair thePair = (*i); - - std::string - key = thePair.first, - value = thePair.second; - - ++count; - - ss << "\"" << key << "\": \"" << value << "\""; - - if (++i == iEnd) break; - - if (count == nextToLast) { - ss << " and "; - } - else if (count != stringToStringMapSize) { - ss << ", "; - } - } // for - } - - ss << ']'; - - return ss.str (); -} - -void mfDisplayStringToStringMap ( - const std::string& title, - const std::map & stringToStringMap, - std::ostream& os) -{ - // print the title - os << title << ":"; - - // print the set elements if any - size_t stringToStringMapSize = - stringToStringMap.size (); - - if (stringToStringMapSize) { - os << std::endl; - - ++gIndenter; - - size_t nextToLast = - stringToStringMapSize - 1; - - size_t count = 0; - - for ( - std::map ::const_iterator - i = stringToStringMap.begin (), - iEnd = stringToStringMap.end (); - i != iEnd; - ++i - ) { - std::pair thePair = (*i); - - std::string - key = thePair.first, - value = thePair.second; - - ++count; - - os << "\"" << key << "\": \"" << value << "\""; - - if (++i == iEnd) break; - - if (count == nextToLast) { - os << " and "; - } - else if (count != stringToStringMapSize) { - os << ", "; - } - } // for - - --gIndenter; - } - else { - os << " empty"; - } - - os << std::endl; -} - -//______________________________________________________________________________ -Bool mfKeyIsInStringToStringMultiMap ( - const std::string& theKey, - const std::multimap & stringToStringMultiMap) -{ - const std::multimap ::const_iterator it = - stringToStringMultiMap.find (theKey); - - return - it != stringToStringMultiMap.end (); -} - -Bool mfKeyValuePairIsInStringToStringMultiMap ( - const std::string& theKey, - const std::multimap & stringToStringMultiMap, - const std::string& theValue) -{ - Bool result (false); - - if (stringToStringMultiMap.size ()) { - // find all the elements with key theKey - std::pair < - std::multimap ::const_iterator, - std::multimap ::const_iterator - > - iteratorsRange = - stringToStringMultiMap.equal_range ( - theKey); - - if (iteratorsRange.first != iteratorsRange.second) { - // the range is non-empty, there are elements with key theKey - for ( - std::multimap ::const_iterator it = iteratorsRange.first; - it != iteratorsRange.second; - ++it - ) { - if ((*it).second == theValue) { - result = true; - break; - } - } - } - } - - return result; -} - -std::string mfStringToStringMultiMapAsString ( - const std::multimap & stringToStringMultiMap) -{ - std::stringstream ss; - - ss << '['; - - // append the set elements if any - size_t stringToStringMultiMapSize = - stringToStringMultiMap.size (); - - if (stringToStringMultiMapSize) { - size_t nextToLast = - stringToStringMultiMapSize - 1; - - size_t count = 0; - - for ( - std::multimap ::const_iterator - i = stringToStringMultiMap.begin (), - iEnd = stringToStringMultiMap.end (); - i != iEnd; - ++i - ) { - std::pair thePair = (*i); - - std::string - key = thePair.first, - value = thePair.second; - - ++count; - - ss << "\"" << key << "\": \"" << value << "\""; - - if (++i == iEnd) break; - - if (count == nextToLast) { - ss << " and "; - } - else if (count != stringToStringMultiMapSize) { - ss << ", "; - } - } // for - } - - ss << ']'; - - return ss.str (); -} - -void mfDisplayStringToStringMultiMap ( - const std::string& title, - const std::multimap & stringToStringMultiMap, - std::ostream& os) -{ - // print the title - os << title << ":"; - - // print the set elements if any - size_t stringToStringMultiMapSize = - stringToStringMultiMap.size (); - - if (stringToStringMultiMapSize) { - os << std::endl; - - ++gIndenter; - - size_t nextToLast = - stringToStringMultiMapSize - 1; - - size_t count = 0; - - for ( - std::multimap ::const_iterator - i = stringToStringMultiMap.begin (), - iEnd = stringToStringMultiMap.end (); - i != iEnd; - ++i - ) { - std::pair thePair = (*i); - - std::string - key = thePair.first, - value = thePair.second; - - ++count; - - os << "\"" << key << "\": \"" << value << "\""; - - if (++i == iEnd) break; - - if (count == nextToLast) { - os << " and "; - } - else if (count != stringToStringMultiMapSize) { - os << ", "; - } - } // for - - --gIndenter; - } - else { - os << " empty"; - } - - os << std::endl; -} - -//______________________________________________________________________________ -int countTwoBytesWideCharactersInString (const std::string theString) -{ -/* - If theString contains non-diacritic characters (UTF-8), - that fouls std::setw() which accounts two characters for them - - This is horrible custom code until C++20 std::format is more portable JMI v0.9.66 -*/ - - int result = 0; - - for_each ( - theString.begin(), - theString.end(), - [&result] (const char theChar) // capture result by reference in lambda body - { - if ( - // to be augmented when other 1-byte characters appear later in the code... -// (theChar >= 'a' && theChar <= 'z') -// || -// (theChar >= 'A' && theChar <= 'Z') -// || -// (theChar == ' ') -// || -// (theChar == ',') -// || -// (theChar == ':') -// || -// (theChar == '.') -// || -// (theChar == '-') -// || -// (theChar == '(') -// || -// (theChar == ')') -// || -// (theChar == '[') -// || -// (theChar == ']') -// || -// (theChar == '/') -// || -// (theChar == '\\') -// || -// (theChar == '\'') -// || -// (theChar == '"') - theChar <= 127 // JMI v0.9.67 - ) { - // theChar is 1-byte large - } - - else { - // theChar is 2-bytes large - result += 1; - } - } - ); // for_each - - return result / 2; - // because a 2-byte character's second byte is also seen in the loop above... -} - - -} - -// switch (wchar (theChar)) { JMI v0.9.66 -// case 'à': -// case 'â': -// case 'ä': -// -// case 'é': -// case 'è': -// case 'ê': -// case 'ë': -// -// case 'ì': -// case 'î': -// case 'ï': -// -// case 'ò': -// case 'ô': -// case 'ö': -// -// case 'ù': -// case 'û': -// case 'ü': -// result += 1; -// break; -// -// default: -// ; -// } // switch - diff --git a/src/mflibrary/mfStringsHandling.h b/src/mflibrary/mfStringsHandling.h deleted file mode 100644 index 0b46d163..00000000 --- a/src/mflibrary/mfStringsHandling.h +++ /dev/null @@ -1,432 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfStringsHandling___ -#define ___mfStringsHandling___ - -#include -#include -#include -#include -#include - -#include - -#include "exports.h" - -#include "mfBool.h" - - -namespace MusicFormats -{ - -// //______________________________________________________________________________ -// class EXP mfMultiLineString -// /* -// this class encapsulates a 'bool' value to guarantee it is initialized -// */ -// { -// public: -// -// // constructors/destructor -// // ------------------------------------------------------ -// -// mfMultiLineString (); -// -// mfMultiLineString (bool value); -// -// mfMultiLineString (const std::string& theString); -// -// virtual ~mfMultiLineString (); -// -// // copy constructor -// // ------------------------------------------------------ -// -// mfMultiLineString (const mfMultiLineString& theMultiLineString); -// -// public: -// -// // set and get -// // ------------------------------------------------------ -// -// // set the value -// void setValue (bool value) -// { fValue = value; } -// -// // get the value -// bool getValue () const -// { return fValue; } -// -// public: -// -// // public services -// // ------------------------------------------------------ -// -// // explicit conversion -// explicit operator bool () const { return fValue; } -// -// // copy assignment operator -// // ------------------------------------------------------ -// -// mfMultiLineString& operator= (const mfMultiLineString& themfMultiLineString); -// -// /* -// // Declare prefix and postfix decrement operators. -// Point& operator--(); // Prefix decrement operator. -// Point operator--(int); // Postfix decrement operator. -// */ -// -// // negation, prefix operator -// mfMultiLineString operator! () const; -// -// // dyadic operators -// mfMultiLineString operator&& (const mfMultiLineString& othermfMultiLineString) const; -// mfMultiLineString operator|| (const mfMultiLineString& othermfMultiLineString) const; -// -// // compare value JMI ??? -// mfMultiLineString operator == (const mfMultiLineString &othermfMultiLineString) const -// { return fValue == othermfMultiLineString.fValue; } -// mfMultiLineString operator != (const mfMultiLineString &othermfMultiLineString) const -// { return fValue != othermfMultiLineString.fValue; } -// -// public: -// -// // print -// // ------------------------------------------------------ -// -// std::string asString () const; -// -// void print (std::ostream& os) const; -// -// -// private: -// -// // private fields -// // ------------------------------------------------------ -// -// bool fValue; -// }; -// -// //EXP mfMultiLineString operator&& (const mfMultiLineString& leftmfMultiLineString, const mfMultiLineString& rightmfMultiLineString); -// EXP mfMultiLineString operator&& (const mfMultiLineString& leftmfMultiLineString, const bool& themfMultiLineString); -// EXP mfMultiLineString operator&& (const bool& themfMultiLineString, const mfMultiLineString& rightmfMultiLineString); -// -// //EXP mfMultiLineString operator|| (const mfMultiLineString& leftmfMultiLineString, const mfMultiLineString& rightmfMultiLineString); -// EXP mfMultiLineString operator|| (const mfMultiLineString& leftmfMultiLineString, const bool& themfMultiLineString); -// EXP mfMultiLineString operator|| (const bool& themfMultiLineString, const mfMultiLineString& rightmfMultiLineString); -// -// EXP std::ostream& operator << (std::ostream& os, const mfMultiLineString& themfMultiLineString); - -//______________________________________________________________________________ -struct mfStringQuoteEscaper -{ - /* usage: - std::string dest = ""; - for_each( source.begin (), source.end (), mfStringQuoteEscaper (dest)); - */ - - std::string& target; - - explicit mfStringQuoteEscaper (std::string& t) - : target (t) - {} - - void operator() (char ch) const - { - if( ch == '"') { - // or switch on any character that - // needs escaping like '\' itself - target.push_back ('\\'); - } - target.push_back (ch); - } -}; - -//______________________________________________________________________________ -struct mfStringSpaceRemover -{ - /* usage: - std::string dest = ""; - for_each ( - source.begin (), - source.end (), - mfStringSpaceRemover (dest)); - */ - - std::string& target; - - explicit mfStringSpaceRemover (std::string& t) - : target (t) - {} - - void operator() (char ch) const - { - if (ch != ' ') { - target.push_back (ch); - } - } -}; - -//______________________________________________________________________________ -struct mfStringSpaceReplacer -{ - /* usage: - std::string dest = ""; - for_each ( - source.begin (), - source.end (), - mfStringSpaceReplacer (dest, ersatz)); - */ - - std::string& target; - char ersatz; - - explicit mfStringSpaceReplacer (std::string& t, char ch) - : target (t), ersatz (ch) - {} - - void operator() (char ch) const - { - if (ch == ' ') - target.push_back (ersatz); - else - target.push_back (ch); - } -}; - -//______________________________________________________________________________ -std::string mfReplicateChar ( - char theChar, - int times); - -std::string mfReplicateString ( - std::string theString, - int times); - -//______________________________________________________________________________ -typedef std::vector mfStringsVector; - -void mfDisplayStringsVector ( - const mfStringsVector& stringsVector, - const std::string& title, - std::ostream& os); - -//_______________________________________________________________________________ -EXP void mfDisplayArgcAndArgv ( - int argc, - char* argv[], - std::ostream& os); - -//_______________________________________________________________________________ -/* - A type to pass options and their values if any - as well as arguments to the API functions - - In the std::pair: - - first is the name of the option, such as '-title', or the argument - - second is the value of the option, possibly empty, - and empty for an argument -*/ -typedef std::pair mfStringsPair; - -typedef std::vector mfStringsPairVector; - -// EXP void convertArgcArgvToStringPairVector ( -// int argc, -// char* argv[], -// mfStringsPairVector& stringPairVector); - -EXP void displayStringPairVector ( - const mfStringsPairVector& theOptionAndValueVector, - std::ostream& os); - -//______________________________________________________________________________ -char* mfCharStarCat ( - char* destination, - const char* source, - const size_t destinationSize); - -//______________________________________________________________________________ -std::string mfIntToEnglishWord (int n); - -//______________________________________________________________________________ -std::string mfStringNumbersToEnglishWords (std::string str); - -//______________________________________________________________________________ -std::string mfInputLineNumbersAsString ( - int inputStartLineNumber, - int inputEndLineNumber); - -//______________________________________________________________________________ -std::set mfDecipherNaturalNumbersSetSpecification ( - const std::string& theSpecification, - Bool debugMode = false); - -//______________________________________________________________________________ -std::set mfDecipherStringsSetSpecification ( - std::string theSpecification, - Bool debugMode = false); - -//______________________________________________________________________________ -std::list mfExtractNumbersFromString ( - const std::string& theString, // can contain "1, 2, 17" - Bool debugMode = false); - -//______________________________________________________________________________ -// from http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring -// trim std::string from start -EXP std::string& mfLeftTrim (std::string& s); -// trim std::string from end -EXP std::string& mfRightTrim (std::string& s); - -// trim std::string from both ends -EXP inline std::string& mfTrimFromBothEnds (std::string& s) { - return mfLeftTrim (mfRightTrim (s)); -} - -//______________________________________________________________________________ -std::pair mfExtractNamesPairFromString ( - const std::string& theString, // may contain "P1 = Bassoon" - char separator, - Bool debugMode = false); - -//______________________________________________________________________________ -std::string mfDoubleQuoteStringIfNonAlpha ( - const std::string& theString); - -std::string mfQuoteStringIfNonAlpha ( - const std::string& theString); - -std::string mfDoubleQuoteString ( - const std::string& theString); -std::string mfDoubleQuoteStringContentsOnly ( - const std::string& theString); - -std::string mfDoubleQuoteStringIfNonWord ( - const std::string& theString); - -std::string mfSingleQuoteString ( - const std::string& theString); -std::string mfSingleQuoteStringContentsOnly ( - const std::string& theString); - -std::string mfStringToLowerCase ( - const std::string& theString); - -std::string mfStringToUpperCase ( - const std::string& theString); - -//______________________________________________________________________________ -EXP extern std::string mfBooleanAsString (Bool value); - -//______________________________________________________________________________ -void mfTrimString ( - std::string& theString, - const char* toBeRemoved = " \t\n\r\f\v"); - -//______________________________________________________________________________ -std::string mfSingularOrPlural ( - int number, - std::string singularName, - std::string pluralName); - -std::string mfSingularOrPluralWithoutNumber ( - int number, - std::string singularName, - std::string pluralName); - -//______________________________________________________________________________ -std::string mfEscapeDoubleQuotes (std::string s); - -//______________________________________________________________________________ -void mfConvertHTMLEntitiesToPlainCharacters (std::string& s); - -//______________________________________________________________________________ -void mfSplitStringIntoChunks ( - std::string theString, - std::string theSeparator, - std::list & chunksList); - -void mfSplitRegularStringAtEndOfLines ( - std::string theString, - std::list & chunksList); - -void mfSplitHTMLStringContainingEndOfLines ( // JMI - std::string theString, - std::list & chunksList); - -//______________________________________________________________________________ -std::string mfBaseName (const std::string& filename); - // wait until C++17 for a standard library containing basename()... JMI v0.9.66 - -//______________________________________________________________________________ -std::string mfMakeSingleWordFromString (const std::string& theString); - -//______________________________________________________________________________ -Bool mfStringIsInStringSet ( - const std::string& theString, - const std::set & stringSet); - -void mfStringSetMinusEquals ( - std::set & dest, - const std::set & source); - -std::string mfStringSetAsString ( - const std::set & stringSet); - -std::string mfStringSetAsBracketedString ( - const std::set & stringSet); - -void mfDisplayStringSet ( - const std::string& title, - const std::set & stringSet, - std::ostream& os); - -//______________________________________________________________________________ -Bool mfFetchValueFromStringToStringMap ( - const std::string& theKey, - const std::map & stringToStringMap, - std::string& theValue); - -std::string mfStringToStringMapAsString ( - const std::map & stringToStringMap); - -void mfDisplayStringToStringMap ( - const std::string& title, - const std::map & stringToStringMap, - std::ostream& os); - -//______________________________________________________________________________ -Bool mfKeyIsInStringToStringMultiMap ( - const std::string& theKey, - const std::multimap & stringToStringMultiMap); - -Bool mfKeyValuePairIsInStringToStringMultiMap ( - const std::string& theKey, - const std::multimap & stringToStringMultiMap, - const std::string& theValue); - -std::string mfStringToStringMultiMapAsString ( - const std::multimap & stringToStringMultiMap); - -void mfDisplayStringToStringMultiMap ( - const std::string& title, - const std::multimap & stringToStringMultiMap, - std::ostream& os); - -//______________________________________________________________________________ -int countTwoBytesWideCharactersInString (const std::string theString); - - -} - - -#endif // ___mfStringsHandling___ diff --git a/src/mflibrary/mfSystemInterface.cpp b/src/mflibrary/mfSystemInterface.cpp deleted file mode 100644 index 62ad30c9..00000000 --- a/src/mflibrary/mfSystemInterface.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -// https://stackoverflow.com/questions/5919996/how-to-detect-reliably-mac-os-x-ios-linux-windows-in-c-preprocessor - -#ifdef __APPLE__ - // nothing specific needed here -#endif // __APPLE__ - -#ifdef __gnu_linux__ - #include // strerror_r() -#endif // __gnu_linux__ - -#ifdef WIN32 - // nothing specific needed here -#endif // WIN32 - -#include "mfIndentedTextOutput.h" -#include "mfStringsHandling.h" -#include "mfSystemInterface.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -EXP char* mfStrErrorCString () -{ - constexpr int kBufferSize = 1024; - static char pBuffer [kBufferSize]; - - // OS-specific call -#ifdef __APPLE__ - errno_t - result = - strerror_r (errno, pBuffer, kBufferSize); -#endif // MF_TRACE_IS_ENABLED - -#ifdef __gnu_linux__ - char* - result = - strerror_r (errno, pBuffer, kBufferSize); -#endif // MF_TRACE_IS_ENABLED - -#ifdef WIN32 - int - result = - strerror_s (pBuffer, kBufferSize, errno); -#endif // WIN32 - - // use result just to avoid a compiler warning... - result = result + 0; - - return pBuffer; -} - -//______________________________________________________________________________ -EXP int mfExecuteCommand ( - const std::string& command, - Bool doTrace) -{ - int result = 0; - - if (doTrace) { - gLog << - "Executing command:" << - std::endl; - - ++gIndenter; - - gLog << - command << - std::endl; - - --gIndenter; - } - - const char* commandAsCString = command.c_str (); - -// const char* mode = "r+"; // bi-directional pipe - - // avoid memory overflow by system(), - // truncating command if necessary - - const int - COMMAND_STRING_BUFFER_SIZE = 1024; - char* - commandStringBuffer = - new char [COMMAND_STRING_BUFFER_SIZE]; - - mfCharStarCat ( - commandStringBuffer, - commandAsCString, - COMMAND_STRING_BUFFER_SIZE); - - // execute the command - - result = - system (commandStringBuffer); - -// #if (WIN32) -// -// // system (commandAsCString); // JMI -// -// FILE* -// commandOutputStream = -// _popen (commandAsCString, mode); -// -// if (! commandOutputStream) { -// E_ERROR_SYSTEM ( -// "_popen (%s, %s) failed\n", -// command, -// mode); -// } -// -// #else -// -// system (commandBuffer); -// -// // FILE* -// // commandOutputStream = -// // popen (commandAsCString, mode); -// // -// // if (! commandOutputStream) { -// // gLog << -// // "#### mfExecuteCommand" << -// // ", failed to execute command [" << -// // command << -// // " - quitting." << -// // std::endl; -// // -// // result = pclose (commandOutputStream); -// // } -// -// #endif // MF_TRACE_IS_ENABLED - - return result; -} - - -} diff --git a/src/mflibrary/mfSystemInterface.h b/src/mflibrary/mfSystemInterface.h deleted file mode 100644 index c0531f57..00000000 --- a/src/mflibrary/mfSystemInterface.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfSystemInterface___ -#define ___mfSystemInterface___ - -#include "exports.h" - -#include "mfBool.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -#ifdef WIN32 -/* - isatty() is needed for Flex interactive mode, - but doesn't follow the Standard C rules - for implementation-specific names - - we should thus use _isatty() instead on Windows systems - - - #include - #include - - int main( void ) - { - if( _isatty( _fileno( stdout ) ) ) - printf( "stdout has not been redirected to a file\n" ); - else - printf( "stdout has been redirected to a file\n"); - } -*/ - - #include "io.h" // for _isatty() - - // see https://stackoverflow.com/questions/341817/is-there-a-replacement-for-unistd-h-for-windows-visual-c - #define isatty _isatty -#endif // WIN32 - -//______________________________________________________________________________ -EXP char* mfStrErrorCString (); - -//______________________________________________________________________________ -EXP int mfExecuteCommand ( - const std::string& command, - Bool doTrace); - - -} - - -#endif // ___mfSystemInterface___ diff --git a/src/mflibrary/mfTiming.cpp b/src/mflibrary/mfTiming.cpp deleted file mode 100644 index 24800758..00000000 --- a/src/mflibrary/mfTiming.cpp +++ /dev/null @@ -1,457 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include // std::setw, ... - -#include "mfStringsHandling.h" -#include "mfTiming.h" - -#include "oahEarlyOptions.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -std::string mfTimingItemKindAsString ( - mfTimingItemKind timingItemKind) -{ - std::string result; - - switch (timingItemKind) { - case mfTimingItemKind::kMandatory: - result = "kMandatory"; - break; - case mfTimingItemKind::kOptional: - result = "kOptional"; - break; - } // switch - - return result; -} - -std::ostream& operator << (std::ostream& os, const mfTimingItemKind& elt) -{ - os << mfTimingItemKindAsString (elt); - return os; -} - -//______________________________________________________________________________ -S_mfTimingItem mfTimingItem::createTimingItem ( - const std::string& activity, - const std::string& description, - mfTimingItemKind timingItemKind, - clock_t startClock, - clock_t endClock) -{ - mfTimingItem* obj = new mfTimingItem ( - activity, - description, - timingItemKind, - startClock, - endClock); - assert (obj != nullptr); - return obj; -} - -mfTimingItem::mfTimingItem ( - const std::string& activity, - const std::string& description, - mfTimingItemKind timingItemKind, - clock_t startClock, - clock_t endClock) -{ - fActivity = activity; - fDescription = description; - fTimingItemKind = timingItemKind; - fStartClock = startClock; - fEndClock = endClock; -} - -//______________________________________________________________________________ -mfTimingItemsList::mfTimingItemsList () -{} - -mfTimingItemsList::~mfTimingItemsList () -{} - -void mfTimingItemsList::appendTimingItem ( - mfPassIDKind passIDKind, - const std::string& description, - mfTimingItemKind timingItemKind, - clock_t startClock, - clock_t endClock) -{ - S_mfTimingItem - mfTimingItem = - mfTimingItem::createTimingItem ( - gLanguage->passIDKindAsString (passIDKind), - description, - timingItemKind, - startClock, - endClock); - - fTimingItemsList.push_back (mfTimingItem); -} - -void mfTimingItemsList::doPrint (std::ostream& os) const -{ - // printing the details - - int - activityWidth = 0, - kindWidth = 0, - secondsWidth = 0, - descriptionWidth = 0; - - // compute the timing items columns widths - // ------------------------------------------- - for (S_mfTimingItem theTimingItem : fTimingItemsList) { - // activityWidth - std::string - activity = - theTimingItem->getActivity (); - - // if activity contains non-diacritic characters (UTF-8), - // that fouls std::setw() which accounts two characters for them -// int -// activityTwoBytesWideCharactersInString = -// countTwoBytesWideCharactersInString (activity); - - size_t activitySize = -// activity.size () - activityTwoBytesWideCharactersInString; - activity.size (); - -// gLog << "--> activitySize: " << activitySize << std::endl; -// gLog << "--> activityTwoBytesWideCharactersInString: " << activityTwoBytesWideCharactersInString << std::endl << std::endl; - - if (activitySize > activityWidth) { - activityWidth = activitySize; - } - - // kindWidth - std::string - kind = - mfTimingItemKindAsString ( - theTimingItem->getTimingItemKind ()); - - // if kind contains non-diacritic characters (UTF-8), - // that fouls std::setw() which accounts two characters for them -// int -// kindTwoBytesWideCharactersInString = -// countTwoBytesWideCharactersInString (kind); - - size_t kindSize = -// kind.size () - kindTwoBytesWideCharactersInString; - kind.size (); - -// gLog << "--> kindSize: " << kindSize << std::endl; -// gLog << "--> kindTwoBytesWideCharactersInString: " << kindTwoBytesWideCharactersInString << std::endl << std::endl; - - if (kindSize > kindWidth) { - kindWidth = kindSize; - } - - // descriptionWidth - std::string - description = - theTimingItem->getDescription (); - - // take care of multi-line descriptions - // if description contains non-diacritic characters (UTF-8), - // that fouls std::setw() which accounts two characters for them -// int -// descriptionTwoBytesWideCharactersInString = -// countTwoBytesWideCharactersInString (description); - - size_t descriptionSize = -// description.size () - descriptionTwoBytesWideCharactersInString; - description.size (); - -// gLog << "--> descriptionSize: " << descriptionSize << std::endl; -// gLog << "--> descriptionTwoBytesWideCharactersInString: " << descriptionTwoBytesWideCharactersInString << std::endl << std::endl; - - if (descriptionSize > descriptionWidth) { - descriptionWidth = descriptionSize; - } - } // for - - int - secondsPrecision = secondsWidth - 4; // to leave room for large numbers - -// gLog << "activityWidth: " << activityWidth << std::endl; -// gLog << "descriptionWidth: " << descriptionWidth << std::endl; -// gLog << "kindWidth: " << kindWidth << std::endl; -// gLog << "secondsWidth: " << secondsWidth << std::endl; -// gLog << "secondsPrecision: " << secondsPrecision << std::endl; - - // print the timing items columns headers and separators - // ------------------------------------------- - os << std::left << - std::setw (activityWidth) << - gLanguage->activity () << - ' ' << - std::setw (kindWidth) << - gLanguage->kind () << - ' ' << - std::setw (secondsWidth) << - gLanguage->CPUSeconds () << - ' ' << - std::setw (descriptionWidth) << - gLanguage->description () << - ' ' << - - std::endl << - - std::setw (activityWidth) << - mfReplicateString ("-", activityWidth) << - ' ' << - std::setw (kindWidth) << - mfReplicateString ("-", kindWidth) << - ' ' << - std::setw (secondsWidth) << - mfReplicateString ("-", secondsWidth) << - ' ' << - std::setw (descriptionWidth) << - mfReplicateString ("-", descriptionWidth) << - std::endl; - - // print the timing items - // ------------------------------------------- - clock_t - totalClock = 0, - totalMandatoryClock = 0, - totalOptionalClock = 0; - - for (S_mfTimingItem theTimingItem : fTimingItemsList) { - // print the activity -// switch (theTimingItem->getTimingItemKind ()) { -// case mfTimingItemKind::kMandatory: -// os << std::left << -// std::setw (activityWidth) << -// theTimingItem->getActivity (); -// break; -// case mfTimingItemKind::kOptional: -// os << std::left << -// std::setw (activityWidth) << -// theTimingItem->getActivity (); -// break; -// } // switch - - os << std::left << - std::setw (activityWidth) << - theTimingItem->getActivity (); - - os << ' '; - - // print the kind - switch (theTimingItem->getTimingItemKind ()) { - case mfTimingItemKind::kMandatory: - os << - std::left << - std::setw (kindWidth) << - gLanguage->mandatory () << - mfReplicateChar ( - ' ', - countTwoBytesWideCharactersInString (gLanguage->mandatory ())); - break; - case mfTimingItemKind::kOptional: - os << - std::left << - std::setw (kindWidth) << - gLanguage->optional () << - mfReplicateChar ( - ' ', - countTwoBytesWideCharactersInString (gLanguage->optional ())); - break; - } // switch - - os << ' '; - - // print the time spent - clock_t - timingItemClock = - theTimingItem->getEndClock () - theTimingItem->getStartClock (); - - totalClock += timingItemClock; - - os << - std::left << - std::fixed << - std::setprecision (secondsPrecision) << - std::setw (secondsWidth) << - float (timingItemClock) / CLOCKS_PER_SEC; - - switch (theTimingItem->getTimingItemKind ()) { - case mfTimingItemKind::kMandatory: - totalMandatoryClock += timingItemClock; - break; - case mfTimingItemKind::kOptional: - totalOptionalClock += timingItemClock; - break; - } // switch - - os << ' '; - - // print the description - // take care of multi-line descriptions - std::string - description = - theTimingItem->getDescription (); - - gIndenter.printMultiLineStringInATable ( - description, - activityWidth, - descriptionWidth, - os); - - gLog << std::endl; - -// os << std::left << -// std::setw (descriptionWidth) << -// description; - -// // if description contains non-diacritic characters (UTF-8), -// // that fouls std::setw() which accounts two characters for them -// int -// twoBytesWideCharactersInString = -// countTwoBytesWideCharactersInString (description); -// -// // gLog << "twoBytesWideCharactersInString: " << twoBytesWideCharactersInString << std::endl; -// -// if (twoBytesWideCharactersInString > 0) { -// os << -// mfReplicateChar (' ', twoBytesWideCharactersInString); -// } -// os << -// ' '; - - } // for - os << std::endl; - - // set the total spent times columns widths - int - totalClockWidth = 1, - totalMandatoryClockWidth = 1, - totalOptionalClockWidth = 1, - totalsPrecision = secondsPrecision; - - switch (gEarlyOptions.getEarlyLanguageKind ()) { - case mfLanguageKind::kMusicFormatsLanguage_UNKNOWN_: - break; - case mfLanguageKind::kMusicFormatsLanguageEnglish: - totalClockWidth = 11; - totalMandatoryClockWidth = 9; - totalOptionalClockWidth = 8; - break; - case mfLanguageKind::kMusicFormatsLanguageFrench: - totalClockWidth = 11; - totalMandatoryClockWidth = 11; - totalOptionalClockWidth = 8; - break; - case mfLanguageKind::kMusicFormatsLanguageItalian: - totalClockWidth = 11; - totalMandatoryClockWidth = 11; - totalOptionalClockWidth = 8; - break; - case mfLanguageKind::kMusicFormatsLanguageGerman: - totalClockWidth = 11; - totalMandatoryClockWidth = 11; - totalOptionalClockWidth = 8; - break; - case mfLanguageKind::kMusicFormatsLanguageSpanish: - totalClockWidth = 11; - totalMandatoryClockWidth = 11; - totalOptionalClockWidth = 8; - break; - case mfLanguageKind::kMusicFormatsLanguageDutch: - totalClockWidth = 11; - totalMandatoryClockWidth = 11; - totalOptionalClockWidth = 11; - break; - } // switch - - // print the total spent times - os << std::left << - std::setw (totalClockWidth) << - gLanguage->totalSeconds () << - ' ' << - std::setw (totalMandatoryClockWidth) << - gLanguage->mandatory () << - ' ' << - std::setw (totalOptionalClockWidth) << - gLanguage->optional () << - std::endl << - - std::setw (totalClockWidth) << - mfReplicateString ("-", totalClockWidth) << - ' ' << - std::setw (totalMandatoryClockWidth) << - mfReplicateString ("-", totalMandatoryClockWidth) << - ' ' << - std::setw (totalOptionalClockWidth) << - mfReplicateString ("-", totalOptionalClockWidth) << - std::endl << - - std::fixed << - std::setprecision (totalsPrecision) << - - std::setw (totalClockWidth) << - float (totalClock) / CLOCKS_PER_SEC << - ' ' << - std::setw (totalMandatoryClockWidth) << - float (totalMandatoryClock) / CLOCKS_PER_SEC << - ' ' << - std::setw (totalOptionalClockWidth) << - float (totalOptionalClock) / CLOCKS_PER_SEC << - std::endl; -} - -void mfTimingItemsList::printWithContext ( - const std::string& context, - std::ostream& os) const -{ - os << std::left << - "Timing information for " << - context << - ":" << - std::endl << std::endl; - - doPrint (os); -} - -void mfTimingItemsList::print (std::ostream& os) const -{ - os << std::left << - gLanguage->timingInformation () << - ":" << - std::endl << std::endl; - - doPrint (os); -} - -std::ostream& operator << (std::ostream& os, const mfTimingItemsList& tim) { - tim.print (os); - return os; -} - -//________________________________________________________________________ -// hidden global timing items list variable -EXP mfTimingItemsList pGlobalTimingItemsList; - -EXP mfTimingItemsList& getGlobalTimingItemsList () -{ - return pGlobalTimingItemsList; -} - - -} - diff --git a/src/mflibrary/mfTiming.h b/src/mflibrary/mfTiming.h deleted file mode 100644 index c071e29f..00000000 --- a/src/mflibrary/mfTiming.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfTiming___ -#define ___mfTiming___ - -#include -#include - -#include "exports.h" - -#include "smartpointer.h" - -#include "mfPasses.h" - - -using namespace MusicXML2; - -namespace MusicFormats -{ - -//______________________________________________________________________________ -// data types - -enum class mfTimingItemKind { - kMandatory, kOptional -}; - -std::string mfTimingItemKindAsString ( - mfTimingItemKind timingItemKind); - -std::ostream& operator << (std::ostream& os, const mfTimingItemKind& elt); - -class EXP mfTimingItem : public smartable -{ - public: - - // constructors/destructor - // ------------------------------------------------------ - - static SMARTP createTimingItem ( - const std::string& activity, - const std::string& description, - mfTimingItemKind timingItemKind, - clock_t startClock, - clock_t endClock); - - mfTimingItem ( - const std::string& activity, - const std::string& description, - mfTimingItemKind timingItemKind, - clock_t startClock, - clock_t endClock); - - public: - - // set and get - // ------------------------------------------------------ - - mfTimingItemKind getTimingItemKind () const - { return fTimingItemKind; } - - std::string getActivity () const - { return fActivity; } - std::string getDescription () const - { return fDescription; } - - clock_t getStartClock () const - { return fStartClock; } - clock_t getEndClock () const - { return fEndClock; } - - private: - - // private fields - // ------------------------------------------------------ - - mfTimingItemKind fTimingItemKind; - - std::string fActivity; - std::string fDescription; - - clock_t fStartClock; - clock_t fEndClock; -}; -typedef SMARTP S_mfTimingItem; - -//______________________________________________________________________________ -class EXP mfTimingItemsList -{ - public: - - // constructors/destructor - // ------------------------------------------------------ - - mfTimingItemsList (); - - virtual ~mfTimingItemsList (); - - public: - - // global variable for general use - // ------------------------------------------------------ - -// static mfTimingItemsList -// sGlobalTimingItemsList; - - public: - - // public services - // ------------------------------------------------------ - - // add an item - void appendTimingItem ( - mfPassIDKind passIDKind, - const std::string& description, - mfTimingItemKind timingItemKind, - clock_t startClock, - clock_t endClock); - - public: - - // print - // ------------------------------------------------------ - - void print (std::ostream& os) const; - - void printWithContext ( - const std::string& context, - std::ostream& os) const; - - private: - - // private services - // ------------------------------------------------------ - - void doPrint (std::ostream& os) const; - - private: - - // private fields - // ------------------------------------------------------ - - std::list - fTimingItemsList; -}; -EXP std::ostream& operator << (std::ostream& os, const mfTimingItemsList& tim); - -//________________________________________________________________________ -// hidden global timing items list variable -EXP mfTimingItemsList& getGlobalTimingItemsList (); - -// a handy shortcut -#define gGlobalTimingItemsList getGlobalTimingItemsList () - - -} - - -#endif // ___mfTiming___ diff --git a/src/mflibrary/mfTraceOah.cpp b/src/mflibrary/mfTraceOah.cpp deleted file mode 100644 index f824d615..00000000 --- a/src/mflibrary/mfTraceOah.cpp +++ /dev/null @@ -1,3806 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include "mfPreprocessorSettings.h" - - -#ifdef MF_TRACE_IS_ENABLED // encompasses the remainder of this file - -#include // std::setw, std::setprecision, ... - -#include - -#include "visitor.h" - -#include "mfConstants.h" -#include "mfStringsHandling.h" - -#include "oahAtomsCollection.h" -#include "oahEarlyOptions.h" - -#include "mxsr2msrOah.h" - -#include "waeHandlers.h" - - -namespace MusicFormats -{ - -//_______________________________________________________________________________ -S_traceOahGroup traceOahGroup::create ( - const S_oahHandler& handler) -{ - traceOahGroup* obj = new traceOahGroup ( - handler); - assert (obj != nullptr); - return obj; -} - -traceOahGroup::traceOahGroup ( - const S_oahHandler& handler) - : oahGroup ( - "OAH Trace", - "help-trace", "ht", -R"(There are trace options transversal to the successive passes, -showing what's going on in the various conversion activities. -They're provided as a help to the maintainers, as well as for the curious. -The options in this group can be quite verbose, use them with small input data! -All of them imply '-trace-passes, -tpasses'.)", - oahElementVisibilityKind::kElementVisibilityHeaderOnly) -{ - createTheTracePrefixes (handler); - - initializeTraceOahGroup (); -} - -traceOahGroup::~traceOahGroup () -{} - -void traceOahGroup::createTheTracePrefixes (const S_oahHandler& handler) -{ - if (gEarlyOptions.getTraceEarlyOptions ()) { - std::stringstream ss; - - ss << - "Creating the OAH trace prefixes" << - std::endl; - } - - ++gIndenter; - - // the 'trace' prefixes - // -------------------------------------- - - fShortTracePrefix = - oahPrefix::create ( - "t", "t", - "'-t=abc,wxyz' is equivalent to '-tabc, -twxyz'"); - handler-> - registerPrefixInHandler ( - fShortTracePrefix); - - fLongTracePrefix = - oahPrefix::create ( - "trace", "trace-", - "'-trace=abc,yz' is equivalent to '-trace-abc, -trace-yz'"); - handler-> - registerPrefixInHandler ( - fLongTracePrefix); - -// // the 'display' prefixes -// // -------------------------------------- -// -// fShortDisplayPrefix = -// oahPrefix::create ( -// "t", "t", -// "'-t=abc,wxyz' is equivalent to '-tabc, -twxyz'"); -// handler-> -// registerPrefixInHandler ( -// fShortDisplayPrefix); -// -// fLongDisplayPrefix = -// oahPrefix::create ( -// "trace", "trace-", -// "'-trace=abc,yz' is equivalent to '-trace-abc, -trace-yz'"); -// handler-> -// registerPrefixInHandler ( -// fLongDisplayPrefix); -// - --gIndenter; -} - -void traceOahGroup::initializeMusicXMLPrintLayoutsTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Print layouts", - "help-print-layouts", "hpl", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // MusicXML print layouts - - S_oahTwoBooleansAtom - traceMusicXMLPrintLayoutsAtom = - oahTwoBooleansAtom::create ( - "trace-print-layouts", "tpl", -R"(Print layouts)", - "fTraceMusicXMLPrintLayouts", - fTraceMusicXMLPrintLayouts, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMusicXMLPrintLayoutsAtom); -} - -void traceOahGroup::initializeOtherTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Other", - "help-trace-other", "hto", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the 'other' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - otherMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-other", "tio", - "Trace SHORT_NAME/LONG_NAME in other.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - otherMultiplexBooleansAtom); - - // components - - subGroup-> - appendAtomToSubGroup ( - oahBooleanAtom::create ( - K_TRACE_COMPONENTS_OPTION_LONG_NAME, K_TRACE_COMPONENTS_OPTION_SHORT_NAME, -R"(Write a trace of components handling to standard error.)", - "fEarlyTraceComponentsRef", - gEarlyOptions.getEarlyTraceComponentsRef ())); - - // passes - - fTracePassesBooleanAtom = - oahBooleanAtom::create ( - K_TRACE_PASSES_OPTION_LONG_NAME, K_TRACE_PASSES_OPTION_SHORT_NAME, -R"(Write a trace of the passes to standard error.)", - "fEarlyTracePassesRef", - gEarlyOptions.getEarlyTracePassesRef ()); - - subGroup-> - appendAtomToSubGroup ( - fTracePassesBooleanAtom); - - otherMultiplexBooleansAtom-> - addBooleanAtom ( - fTracePassesBooleanAtom); - - mfPassIDKind - mfPassIDKindDefaultValue = - mfPassIDKind::kMfPassID_ALL; // default value for passes trace - - fTraceOnlyPassIDOahAtom = - passIDOahAtom::create ( - K_TRACE_ONLY_PASS_OPTION_LONG_NAME, K_TRACE_ONLY_PASS_OPTION_SHORT_NAME, - regex_replace ( - regex_replace ( - regex_replace ( -R"(Write a trace of pass PASSID only to standard error. -The NUMBER PASSIDs available are: -PASSID_KINDS. -The default is 'DEFAULT_VALUE'.)", - std::regex ("NUMBER"), - std::to_string (gGlobalMusicFormatsPassIDKindsMap.size ())), - std::regex ("PASSID_KINDS"), - availableMusicFormatsPassIDKinds (K_MF_NAMES_LIST_MAX_LENGTH)), - std::regex ("DEFAULT_VALUE"), - mfPassIDKindAsString ( - mfPassIDKindDefaultValue)), - "PASSID", - "fEarlyTraceOnlyPassRef", - gEarlyOptions.getEarlyTraceOnlyPassRef ()); - - subGroup-> - appendAtomToSubGroup ( - fTraceOnlyPassIDOahAtom); - - // geometry - - S_oahTwoBooleansAtom - traceGeometryBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-geometry", "tgeom", -R"(Geometry)", - "fTraceGeometry", - fTraceGeometry, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceGeometryBooleanAtom); - - otherMultiplexBooleansAtom-> - addBooleanAtom ( - traceGeometryBooleanAtom); - - // identification - - S_oahTwoBooleansAtom - traceIdentificationBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-identification", "tid", -R"(Identification)", - "fTraceIdentification", - fTraceIdentification, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceIdentificationBooleanAtom); - - otherMultiplexBooleansAtom-> - addBooleanAtom ( - traceIdentificationBooleanAtom); - - // '-trace-for-tests, -tft' is hidden... JMI - - S_oahBooleanAtom - traceForTestsOahBooleanAtom = - oahBooleanAtom::create ( - "trace-for-tests", "tft", -R"(Write a trace for tests to standard error.)", - "fTraceForTests", - fTraceForTests); - - traceForTestsOahBooleanAtom-> - setElementVisibilityKind ( - oahElementVisibilityKind::kElementVisibilityHidden); - - subGroup-> - appendAtomToSubGroup ( - traceForTestsOahBooleanAtom); -} - -void traceOahGroup::initializeTranspositionsTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Transpositions", - "help-trace-transpositions", "htt", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // transpositions - - S_oahTwoBooleansAtom - traceTranspositionsAtom = - oahTwoBooleansAtom::create ( - "trace-transpositions", "ttransps", -R"(Transpositions ( in MusicXML, \transposition in LilyPond))", - "fTraceTranspositions", - fTraceTranspositions, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceTranspositionsAtom); - - // octave shifts - - S_oahTwoBooleansAtom - traceOctaveShiftsAtom = - oahTwoBooleansAtom::create ( - "trace-octave-shifts", "toctshifts", -R"(Octave shifts ( in MusicXML, \ottava in LilyPond))", - "fTraceOctaveShifts", - fTraceOctaveShifts, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceOctaveShiftsAtom); -} - -void traceOahGroup::initializeAboveStaffTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Above staff", - "help-trace-above-staff", "htas", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the 'above staff' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - aboveStaffMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-above-staff", "tias", - "Trace SHORT_NAME/LONG_NAME in above staff.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - aboveStaffMultiplexBooleansAtom); - - // rehearsal marks - - S_oahTwoBooleansAtom - traceRehearsalMarksAtom = - oahTwoBooleansAtom::create ( - "trace-rehearsals-marks", "thm", -R"(Rehearsal marks)", - "fTraceRehearsalMarks", - fTraceRehearsalMarks, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceRehearsalMarksAtom); - aboveStaffMultiplexBooleansAtom-> - addBooleanAtom ( - traceRehearsalMarksAtom); - - // segnos - - S_oahTwoBooleansAtom - traceSegnosAtom = - oahTwoBooleansAtom::create ( - "trace-segnos", "tsegnos", -R"(Segnos)", - "fTraceSegnos", - fTraceSegnos, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceSegnosAtom); - aboveStaffMultiplexBooleansAtom-> - addBooleanAtom ( - traceSegnosAtom); - - // dal segnos - - S_oahTwoBooleansAtom - traceDalSegnosAtom = - oahTwoBooleansAtom::create ( - "trace-dal-segnos", "tdalsegnos", -R"(Dal segnos)", - "fTraceDalSegnos", - fTraceDalSegnos, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceDalSegnosAtom); - aboveStaffMultiplexBooleansAtom-> - addBooleanAtom ( - traceDalSegnosAtom); - - // codas - - S_oahTwoBooleansAtom - traceCodasAtom = - oahTwoBooleansAtom::create ( - "trace-codas", "tcodas", -R"(Codas)", - "fTraceCodas", - fTraceCodas, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceCodasAtom); - aboveStaffMultiplexBooleansAtom-> - addBooleanAtom ( - traceCodasAtom); - - // eyeglasses - - S_oahTwoBooleansAtom - traceEyeGlassesAtom = - oahTwoBooleansAtom::create ( - "trace-eyeglasses", "teyes", -R"(Eyeglasses)", - "fTraceEyeGlasses", - fTraceEyeGlasses, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceEyeGlassesAtom); - aboveStaffMultiplexBooleansAtom-> - addBooleanAtom ( - traceEyeGlassesAtom); -} - -void traceOahGroup::initializeBreaksAndBarLinesTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Breaks and barLines", - "help-trace-breaks-and-barlines", "htbab", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the 'breaks and barLines' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - breaksAndBarLinesMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-breaks-and-barlines", "tibab", - "Trace SHORT_NAME/LONG_NAME in breaks and barLines.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - breaksAndBarLinesMultiplexBooleansAtom); - - // line breaks - - S_oahTwoBooleansAtom - traceLineBreaksAtom = - oahTwoBooleansAtom::create ( - "trace-line-breaks", "tlbreaks", -R"(Line breaks)", - "fTraceLineBreaks", - fTraceLineBreaks, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceLineBreaksAtom); - breaksAndBarLinesMultiplexBooleansAtom-> - addBooleanAtom ( - traceLineBreaksAtom); - - // page and line breaks - - S_oahTwoBooleansAtom - tracePageBreaksAtom = - oahTwoBooleansAtom::create ( - "trace-page-breaks", "tpbreaks", -R"(Page breaks)", - "fTracePageBreaks", - fTracePageBreaks, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - tracePageBreaksAtom); - breaksAndBarLinesMultiplexBooleansAtom-> - addBooleanAtom ( - tracePageBreaksAtom); - - // bar lines - - S_oahTwoBooleansAtom - traceBarLinesAtom = - oahTwoBooleansAtom::create ( - "trace-barlines", "tblines", -R"(BarLines)", - "fTraceBarLines", - fTraceBarLines, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceBarLinesAtom); - breaksAndBarLinesMultiplexBooleansAtom-> - addBooleanAtom ( - traceBarLinesAtom); - - // bar lines details - - S_oahThreeBooleansAtom - traceBarLinesDetailsAtom = - oahThreeBooleansAtom::create ( - "trace-barlines-details", "tblinesd", -R"(BarLines details)", - "fTraceBarLinesDetails", - fTraceBarLinesDetails, - traceBarLinesAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceBarLinesDetailsAtom); - breaksAndBarLinesMultiplexBooleansAtom-> - addBooleanAtom ( - traceBarLinesDetailsAtom); - - // bar checks - - S_oahThreeBooleansAtom - traceBarChecksAtom = - oahThreeBooleansAtom::create ( - "trace-bar-checks", "tbc", -R"(Bar checks)", - "fTraceBarChecks", - fTraceBarChecks, - traceBarLinesAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceBarChecksAtom); - breaksAndBarLinesMultiplexBooleansAtom-> - addBooleanAtom ( - traceBarChecksAtom); - - // bar number checks - - S_oahThreeBooleansAtom - traceBarNumberChecksAtom = - oahThreeBooleansAtom::create ( - "trace-bar-number-checks", "tbnc", -R"(Bar number checks)", - "fTraceBarNumberChecks", - fTraceBarNumberChecks, - traceBarLinesAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceBarNumberChecksAtom); - breaksAndBarLinesMultiplexBooleansAtom-> - addBooleanAtom ( - traceBarNumberChecksAtom); -} - -void traceOahGroup::initializeClefsToTemposTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Clefs to tempos", - "help-trace-clefs-to-tempos", "htctt", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the 'clefs to tempo' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - clefsToTemposMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-clefs-to-tempo", "tictt", - "Trace SHORT_NAME/LONG_NAME in clefs to tempo.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - clefsToTemposMultiplexBooleansAtom); - - // clefs - - S_oahTwoBooleansAtom - traceClefsAtom = - oahTwoBooleansAtom::create ( - "trace-clefs", "tclefs", -R"(Clefs)", - "fTraceClefs", - fTraceClefs, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceClefsAtom); - clefsToTemposMultiplexBooleansAtom-> - addBooleanAtom ( - traceClefsAtom); - - // keys - - S_oahTwoBooleansAtom - traceKeysAtom = - oahTwoBooleansAtom::create ( - "trace-keys", "tkeys", -R"(Keys)", - "fTraceKeys", - fTraceKeys, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceKeysAtom); - - S_oahThreeBooleansAtom - traceKeysDetailsAtom = - oahThreeBooleansAtom::create ( - "trace-keys-details", "tkeysd", -R"(Keys details)", - "fTraceKeysDetails", - fTraceKeysDetails, - traceKeysAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceKeysDetailsAtom); - - // time signatures - - S_oahTwoBooleansAtom - traceTimeSignaturesAtom = - oahTwoBooleansAtom::create ( - "trace-time-signatures", "ttimesigs", -R"(Times)", - "fTraceTimeSignatures", - fTraceTimeSignatures, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceTimeSignaturesAtom); - - // create the clef-key-timesignatures macro - - S_oahMacroAtom - clefKeyTimeSignaturesMacroAtom = - oahMacroAtom::create ( - "trace-clef-key-times-signatures", "tclefkeytimesigs", - "To help debugging musicxml2lilypond."); - - subGroup-> - appendAtomToSubGroup ( - clefKeyTimeSignaturesMacroAtom); - - // populate it -#ifdef MF_TRACE_IS_ENABLED - clefKeyTimeSignaturesMacroAtom-> - appendValueLessAtomToMacro ( - traceClefsAtom); -#endif // MF_TRACE_IS_ENABLED - - clefKeyTimeSignaturesMacroAtom-> - appendValueLessAtomToMacro ( - traceKeysAtom); - - clefKeyTimeSignaturesMacroAtom-> - appendValueLessAtomToMacro ( - traceTimeSignaturesAtom); - - // temps -/* JMI v0.9.68 - S_oahDeuxBooleansAtom - traceTempsAtom = - oahDeuxBooleansAtom::create ( - "trace-temps", "ttemps", -R"(Temps)", - traceTimeSignaturesAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceTempsAtom); -*/ - - // tempos - - S_oahTwoBooleansAtom - traceTemposAtom = - oahTwoBooleansAtom::create ( - "trace-tempos", "ttempos", -R"(Tempos)", - "fTraceTempos", - fTraceTempos, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceTemposAtom); - clefsToTemposMultiplexBooleansAtom-> - addBooleanAtom ( - traceTemposAtom); -} - -void traceOahGroup::initializeInterNotesTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Inter-notes", - "help-trace-inter-notes", "htin", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the 'inter notes' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - interNotesMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-inter-notes", "tiin", - "Trace SHORT_NAME/LONG_NAME in inter notes.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - interNotesMultiplexBooleansAtom); - - // ties - - S_oahTwoBooleansAtom - traceTiesAtom = - oahTwoBooleansAtom::create ( - "trace-ties", "tties", -R"(Ties)", - "fTraceTies", - fTraceTies, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceTiesAtom); - interNotesMultiplexBooleansAtom-> - addBooleanAtom ( - traceTiesAtom); - - // glissandos - - S_oahTwoBooleansAtom - traceGlissandosAtom = - oahTwoBooleansAtom::create ( - "trace-glissandos", "tgliss", -R"(Glissandos)", - "fTraceGlissandos", - fTraceGlissandos, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceGlissandosAtom); - interNotesMultiplexBooleansAtom-> - addBooleanAtom ( - traceGlissandosAtom); -} - -void traceOahGroup::initializeSpannersTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Spanners", - "help-trace-spanners", "hts", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the 'spanners' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - spannersMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-spanners", "tis", - "Trace SHORT_NAME/LONG_NAME in spanners.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - spannersMultiplexBooleansAtom); - - // spanners - - S_oahTwoBooleansAtom - traceSpannersAtom = - oahTwoBooleansAtom::create ( - "trace-spanners", "tspans", -R"(Spanners)", - "fTraceSpanners", - fTraceSpanners, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceSpannersAtom); - spannersMultiplexBooleansAtom-> - addBooleanAtom ( - traceSpannersAtom); - - // cresc/decresc - - S_oahTwoBooleansAtom - traceCrescDecrescsAtom = - oahTwoBooleansAtom::create ( - "trace-cresc-decrescs", "tcrescDecrescs", -R"(Cresc/Decrescs)", - "fTraceCrescDecrescs", - fTraceCrescDecrescs, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceCrescDecrescsAtom); - spannersMultiplexBooleansAtom-> - addBooleanAtom ( - traceCrescDecrescsAtom); - - // wedges - - S_oahTwoBooleansAtom - traceWedgesAtom = - oahTwoBooleansAtom::create ( - "trace-wedges", "twedges", -R"(Wedges)", - "fTraceWedges", - fTraceWedges, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceWedgesAtom); - spannersMultiplexBooleansAtom-> - addBooleanAtom ( - traceWedgesAtom); - - // slurs - - S_oahTwoBooleansAtom - traceSlursAtom = - oahTwoBooleansAtom::create ( - "trace-slurs", "tslurs", -R"(Slurs)", - "fTraceSlurs", - fTraceSlurs, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceSlursAtom); - spannersMultiplexBooleansAtom-> - addBooleanAtom ( - traceSlursAtom); - - // slurs details - - S_oahThreeBooleansAtom - traceSlursDetailsAtom = - oahThreeBooleansAtom::create ( - "trace-slurs-details", "tslursd", -R"(Slurs details)", - "fTraceSlursDetails", - fTraceSlursDetails, - traceSlursAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceSlursDetailsAtom); - spannersMultiplexBooleansAtom-> - addBooleanAtom ( - traceSlursDetailsAtom); - - // ligatures - - S_oahTwoBooleansAtom - traceLigaturesAtom = - oahTwoBooleansAtom::create ( - "trace-ligatures", "tligs", -R"(Ligatures)", - "fTraceLigatures", - fTraceLigatures, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceLigaturesAtom); - spannersMultiplexBooleansAtom-> - addBooleanAtom ( - traceLigaturesAtom); -} - -void traceOahGroup::initializeHarmoniesTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Harmonies", - "help-trace-harmonies", "htharms", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - -/* JMI - // the 'harmonies and figured bass elements' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - harmoniesAndFiguredBassesMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "tihafb", "trace-in-harmonies-and-figured-bass", - "Trace SHORT_NAME/LONG_NAME in harmonies and figured bass elements.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - harmoniesAndFiguredBassesMultiplexBooleansAtom); -*/ - - // harmonies - - fTraceHarmoniesBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-harmonies", "tharms", -R"( in MusicXML, \chordmode in LilyPond)", - "fTraceHarmonies", - fTraceHarmonies, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - fTraceHarmoniesBooleanAtom); - - // harmonies details - - S_oahThreeBooleansAtom - traceHarmoniesDetailsAtom = - oahThreeBooleansAtom::create ( - "trace-harmonies-details", "tharmsd", -R"( in MusicXML, \chordmode in LilyPond, with more details)", - "fTraceHarmoniesDetails", - fTraceHarmoniesDetails, - fTraceHarmoniesBooleanAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceHarmoniesDetailsAtom); - - // extra harmonies - - S_oahTwoBooleansAtom - traceExtraHarmoniesAtom = - oahTwoBooleansAtom::create ( - "trace-extra-harmonies", "teharms", -R"( in MusicXML, \chordmode in LilyPond)", - "fTraceExtraHarmonies", - fTraceExtraHarmonies, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceExtraHarmoniesAtom); -} - -void traceOahGroup::initializeFiguredBassesTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Figured bass elements", - "help-trace-figured-bass", "hthfigbass", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // figured bass - - fTraceFiguredBassesBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-figured-basses", "tfigbasses", -R"( in MusicXML, \figuremode in LilyPond)", - "fTraceFiguredBasses", - fTraceFiguredBasses, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - fTraceFiguredBassesBooleanAtom); - - // figured bass elements details - - S_oahThreeBooleansAtom - traceFiguredBasseseAtomDetails = - oahThreeBooleansAtom::create ( - "trace-figured-bass-details", "tfigbassd", -R"( in MusicXML, \figuremode in LilyPond, with more details)", - "fTraceFiguredBassesDetails", - fTraceFiguredBassesDetails, - fTraceFiguredBassesBooleanAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceFiguredBasseseAtomDetails); -} - -void traceOahGroup::initializeCreditsToWordsTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Credits to words", - "help-trace-credits-to-words", "htctw", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the 'credits to words' multiplex booleans atom // JMIJMIJMI - - S_oahCommonPrefixBooleansAtom - creditsToWordsMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-credit-to-words", "tictw", - "Trace SHORT_NAME/LONG_NAME in 'credits to words'.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - creditsToWordsMultiplexBooleansAtom); - - // credits - - S_oahTwoBooleansAtom - traceCreditsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-credits", "tcredits", -R"(Credits)", - "fTraceCredits", - fTraceCredits, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceCreditsBooleanAtom); - creditsToWordsMultiplexBooleansAtom-> - addBooleanAtom ( - traceCreditsBooleanAtom); - - // lyrics - - S_oahTwoBooleansAtom - traceLyricsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-lyrics", "tlyrics", -R"(Lyrics)", - "fTraceLyrics", - fTraceLyrics, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceLyricsBooleanAtom); - creditsToWordsMultiplexBooleansAtom-> - addBooleanAtom ( - traceLyricsBooleanAtom); - - // lyrics details - - S_oahThreeBooleansAtom - traceLyricsDetailsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-lyrics-details", "tlyricsd", -R"(Lyrics in MusicXML, stanzas in MSR)", - "fTraceLyricsDetails", - fTraceLyricsDetails, - traceLyricsBooleanAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceLyricsDetailsBooleanAtom); - creditsToWordsMultiplexBooleansAtom-> - addBooleanAtom ( - traceLyricsDetailsBooleanAtom); - - // words - - S_oahTwoBooleansAtom - traceWordsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-words", "twords", -R"(Words)", - "fTraceWords", - fTraceWords, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceWordsBooleanAtom); - creditsToWordsMultiplexBooleansAtom-> - addBooleanAtom ( - traceWordsBooleanAtom); -} - -void traceOahGroup::initializeMxsrEventsTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "MXSR events", - "help-trace-chords-and-tuplets", "htcat", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // trace MusicXML tree events - - fTraceMxsrEventsAtom = - oahBooleanAtom::create ( - "trace-mxsr-events", "tmxsre", -R"(Write a trace of the MXSR events to standard error.)", - "fTraceMxsrEvents", - fTraceMxsrEvents); - - subGroup-> - appendAtomToSubGroup ( - fTraceMxsrEventsAtom); -} - -void traceOahGroup::initializeGraceNotesTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Grace notes", - "help-trace-grace-notes", "htgn", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - -// // the chords multiplex booleans atom -// -// S_oahCommonPrefixBooleansAtom -// chordsMultiplexBooleansAtom = -// oahCommonPrefixBooleansAtom::create ( -// "trace-in-chords-and-tuplets", "ticat", -// "Trace SHORT_NAME/LONG_NAME in chords and tuplets.", -// "SHORT_NAME", -// "LONG_NAME", -// fShortTracePrefix, -// fLongTracePrefix); -// -// subGroup-> -// appendAtomToSubGroup ( -// chordsMultiplexBooleansAtom); - - // grace notes basics - - S_oahThreeBooleansAtom - traceGraceNotesBasicsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-grace-notes-basics", "tgracesb", -R"(Grace notes basics). -This option implies -trace-mxsr-events, -tmxsre' -and '-trace-passes, -tpasses'.)", - "fTraceGraceNotesBasics", - fTraceGraceNotesBasics, - fTraceMxsrEventsAtom, - fTracePassesBooleanAtom); - subGroup-> - appendAtomToSubGroup ( - traceGraceNotesBasicsBooleanAtom); - - // grace notes - - S_oahTwoBooleansAtom - traceGraceNotesBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-grace-notes", "tgraces", -R"(Grace notes basics. -This option implies '-trace-grace-notes-basics, -tgracesb' --trace-mxsr-events, -tmxsre' -and '-trace-passes, -tpasses'.)", - "fTraceGraceNotes", - fTraceGraceNotes, - traceGraceNotesBasicsBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceGraceNotesBooleanAtom); -} - -void traceOahGroup::initializeChordsTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Chords", - "help-trace-chords", "htc", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the chords multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - chordsMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-chords-and-tuplets", "ticat", - "Trace SHORT_NAME/LONG_NAME in chords and tuplets.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - chordsMultiplexBooleansAtom); - - // chords basics - - S_oahThreeBooleansAtom - traceChordsBasicsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-chords-basics", "tchordsb", -R"(Chords basic trace information. -This option implies '-trace-mxsr-events, tmxsre' -and '-trace-passes, -tpasses'.)", - "fTraceChordsBasics", - fTraceChordsBasics, - fTraceMxsrEventsAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceChordsBasicsBooleanAtom); - - // chords - - S_oahTwoBooleansAtom - traceChordsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-chords", "tchords", -R"(Chords)", - "fTraceChords", - fTraceChords, - traceChordsBasicsBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceChordsBooleanAtom); - chordsMultiplexBooleansAtom-> - addBooleanAtom ( - traceChordsBooleanAtom); - - // chords details - - S_oahTwoBooleansAtom - traceChordsDetailsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-chords-details", "tchordsd", -R"(Chords details. -This option implies '-trace-chords-basics, -tchordsb', -'-trace-mxsr-events, tmxsre' and '-trace-passes, -tpasses'.)", - "fTraceChordsDetails", - fTraceChordsDetails, - traceChordsBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceChordsDetailsBooleanAtom); - chordsMultiplexBooleansAtom-> - addBooleanAtom ( - traceChordsDetailsBooleanAtom); -} - -void traceOahGroup::initializeTupletsTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Tuplets", - "help-trace-tuplets", "htt", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the chords multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - tupletsMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-chords-and-tuplets", "ticat", - "Trace SHORT_NAME/LONG_NAME in chords and tuplets.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - tupletsMultiplexBooleansAtom); - - // tuplets basics - - S_oahThreeBooleansAtom - traceTupletsBasicsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-tuplets-basics", "ttupsb", - R"(Tuplets basic trace information.)", - "fTraceTupletsBasics", - fTraceTupletsBasics, - fTraceMxsrEventsAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceTupletsBasicsBooleanAtom); - - // tuplets - - S_oahTwoBooleansAtom - traceTupletsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-tuplets", "ttups", -R"(Tuplets trace information. -This option implies '-trace-tuplets-basics, -ttupsb'.)", - "fTraceTuplets", - fTraceTuplets, - traceTupletsBasicsBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceTupletsBooleanAtom); - tupletsMultiplexBooleansAtom-> - addBooleanAtom ( - traceTupletsBooleanAtom); - - // tuplets details - - S_oahTwoBooleansAtom - traceTupletsDetailsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-tuplets-details", "ttupsd", -R"(Tuplets detailed information. -This option implies '-trace-tuplets-basics, -ttupsb' and '-trace-tuplets, -ttups'.)", - "fTraceTupletsDetails", - fTraceTupletsDetails, - traceTupletsBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceTupletsDetailsBooleanAtom); - tupletsMultiplexBooleansAtom-> - addBooleanAtom ( - traceTupletsDetailsBooleanAtom); -} - -void traceOahGroup::initializeInstrumentsTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Instruments", - "help-trace-instruments", "hti", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the 'instruments' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - instrumentsMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-instruments", "tiinstr", // JMI v0.9.67 NOT CLEAR - "Trace SHORT_NAME/LONG_NAME in instruments.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - instrumentsMultiplexBooleansAtom); - - // instruments - - S_oahTwoBooleansAtom - traceInstrumentsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-instruments", "tinstr", -R"(Instruments)", - "fTraceInstruments", - fTraceInstruments, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceInstrumentsBooleanAtom); - - // frames - - S_oahTwoBooleansAtom - traceFramesBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-frames", "tframes", -R"( in MusicXML, \fret-diagram in LilyPond)", - "fTraceFrames", - fTraceFrames, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceFramesBooleanAtom); - /* JMI - instrumentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceFramesBooleanAtom); - */ - - // scordaturas - - S_oahTwoBooleansAtom - traceScordaturasBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-scordaturas", "tscords", -R"(Scordaturas)", - "fTraceScordaturas", - fTraceScordaturas, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceScordaturasBooleanAtom); - instrumentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceScordaturasBooleanAtom); - - // slides - - S_oahTwoBooleansAtom - traceSlidesBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-slides", "tslides", -R"(Slides)", - "fTraceSlides", - fTraceSlides, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceSlidesBooleanAtom); - instrumentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceSlidesBooleanAtom); - - // pedals - - S_oahTwoBooleansAtom - tracePedalsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-pedals", "tpedals", -R"(Pedals)", - "fTracePedals", - fTracePedals, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - tracePedalsBooleanAtom); - instrumentsMultiplexBooleansAtom-> - addBooleanAtom ( - tracePedalsBooleanAtom); - - // accordion registrations - - S_oahTwoBooleansAtom - traceAccordionRegistrationsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-accordion-registrations", "taccreg", -R"(Accordion registrations)", - "fTraceAccordionRegistrations", - fTraceAccordionRegistrations, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceAccordionRegistrationsBooleanAtom); - instrumentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceAccordionRegistrationsBooleanAtom); - - // harp pedals - - S_oahTwoBooleansAtom - traceHarpPedalsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-harp-pedals", "thpedals", -R"(Harp pedals)", - "fTraceHarpPedals", - fTraceHarpPedals, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceHarpPedalsBooleanAtom); - instrumentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceHarpPedalsBooleanAtom); - - // harp pedals tuning - - S_oahTwoBooleansAtom - traceHarpPedalsTuningsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-harp-pedals-tunings", "thptuns", -R"(Harp pedals tuning)", - "fTraceHarpPedalsTunings", - fTraceHarpPedalsTunings, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceHarpPedalsTuningsBooleanAtom); - instrumentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceHarpPedalsTuningsBooleanAtom); - - // damps - - S_oahTwoBooleansAtom - traceDampsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-damps", "tdamps", -R"(Damps)", - "fTraceDamps", - fTraceDamps, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceDampsBooleanAtom); - instrumentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceDampsBooleanAtom); - - // dampalls - - S_oahTwoBooleansAtom - traceDampAllsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-dampalls", "tdampalls", -R"(Dampalls)", - "fTraceDampAlls", - fTraceDampAlls, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceDampAllsBooleanAtom); - instrumentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceDampAllsBooleanAtom); - - // MIDI - - S_oahTwoBooleansAtom - traceMidiBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-midi", "tmidi", -R"(MIDI)", - "fTraceMidi", - fTraceMidi, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMidiBooleanAtom); - instrumentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceMidiBooleanAtom); -} - -void traceOahGroup::initializeNotesAttachmentsTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Notes attachments", - "help-trace-notes-attachments", "htna", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the 'notes attachments' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - notesAttachmentsMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-notes-attachments", "tina", - "Trace SHORT_NAME/LONG_NAME in notes attachments.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - notesAttachmentsMultiplexBooleansAtom); - - // stems - - S_oahTwoBooleansAtom - traceStemsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-stems", "tstems", -R"(Stems)", - "fTraceStems", - fTraceStems, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceStemsBooleanAtom); - notesAttachmentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceStemsBooleanAtom); - - // beams - - S_oahTwoBooleansAtom - traceBeamsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-beams", "tbeams", -R"(Beams)", - "fTraceBeams", - fTraceBeams, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceBeamsBooleanAtom); - notesAttachmentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceBeamsBooleanAtom); - - // articulations - - S_oahTwoBooleansAtom - traceArticulationsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-articulations", "tarts", -R"(Articulations)", - "fTraceArticulations", - fTraceArticulations, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceArticulationsBooleanAtom); - notesAttachmentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceArticulationsBooleanAtom); - - // technicals - - S_oahTwoBooleansAtom - traceTechnicalsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-technicals", "ttechs", -R"(Technicals)", - "fTraceTechnicals", - fTraceTechnicals, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceTechnicalsBooleanAtom); - notesAttachmentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceTechnicalsBooleanAtom); - - // ornaments - - S_oahTwoBooleansAtom - traceOrnamentsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-ornaments", "torns", -R"(Ornaments)", - "fTraceOrnaments", - fTraceOrnaments, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceOrnamentsBooleanAtom); - notesAttachmentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceOrnamentsBooleanAtom); - - S_oahThreeBooleansAtom - traceOrnamentsDetailsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-ornaments-details", "tornsd", -R"(Ornaments)", - "fTraceOrnamentsDetails", - fTraceOrnamentsDetails, - traceOrnamentsBooleanAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceOrnamentsDetailsBooleanAtom); - notesAttachmentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceOrnamentsDetailsBooleanAtom); - - // dynamics - - S_oahTwoBooleansAtom - traceDynamicsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-dynamics", "tdyns", -R"(Dynamics)", - "fTraceDynamics", - fTraceDynamics, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceDynamicsBooleanAtom); - notesAttachmentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceDynamicsBooleanAtom); -} - -void traceOahGroup::initializeSegmentsTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Segments", - "help-trace-segments", "htsegs", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the 'segments' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - segmentsMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-segments", "tisam", - "Trace SHORT_NAME/LONG_NAME in segments.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - segmentsMultiplexBooleansAtom); - - // segments - - S_oahTwoBooleansAtom - traceSegmentsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-segments", "tsegs", -R"(Voices segments)", - "fTraceSegments", - fTraceSegments, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceSegmentsBooleanAtom); - segmentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceSegmentsBooleanAtom); - - // segments details - - S_oahThreeBooleansAtom - traceSegmentsDetailsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-segments-details", "tsegsd", -R"(Voices segments details)", - "fTraceSegmentsDetails", - fTraceSegmentsDetails, - traceSegmentsBooleanAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceSegmentsDetailsBooleanAtom); - segmentsMultiplexBooleansAtom-> - addBooleanAtom ( - traceSegmentsDetailsBooleanAtom); -} - -void traceOahGroup::initializeMeasuresTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Measures", - "help-trace-measures", "htmeas", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the 'measures' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - measuresMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-measures", "timeas", - "Trace SHORT_NAME/LONG_NAME in segments.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - measuresMultiplexBooleansAtom); - - // measure numbers - - S_oahTwoBooleansAtom - traceMeasuresNumbersBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-measures-numbers", "tmneasnums", -R"(Measure numberss)", - "fTraceMeasuresNumbers", - fTraceMeasuresNumbers, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMeasuresNumbersBooleanAtom); - measuresMultiplexBooleansAtom-> - addBooleanAtom ( - traceMeasuresNumbersBooleanAtom); - - // measures basics - - S_oahTwoBooleansAtom - traceMeasuresBasicsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-measures-basics", "tmeasb", -R"(Measures basic trace information)", - "fTraceMeasuresBasics", - fTraceMeasuresBasics, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMeasuresBasicsBooleanAtom); - - // measures - - S_oahThreeBooleansAtom - traceMeasuresBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-measures", "tmeas", -R"(Measures. -This option implies '-trace-measures-basics, -tmeasb'.)", - "fTraceMeasures", - fTraceMeasures, - traceMeasuresBasicsBooleanAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMeasuresBooleanAtom); - measuresMultiplexBooleansAtom-> - addBooleanAtom ( - traceMeasuresBooleanAtom); - - // measures details - - S_oahTwoBooleansAtom - traceMeasuresDetailsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-measures-details", "tmeasd", -R"(Measures details. -This option implies '-trace-measures-basics, -tmeasb' and '-trace-measures, -tmeas'.)", - "fTraceMeasuresDetails", - fTraceMeasuresDetails, - traceMeasuresBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMeasuresDetailsBooleanAtom); - measuresMultiplexBooleansAtom-> - addBooleanAtom ( - traceMeasuresDetailsBooleanAtom); - - // only measure - - fTraceOnlyMeasurerNumbeOahAtom = - oahStringAtom::create ( - "trace-only-measure", "tonlymea", -R"(Restrict the production of trace information to measure NUMBER)", - "NUMBER", - "fTraceOnlyMeasure", - fTraceOnlyMeasure); - - subGroup-> - appendAtomToSubGroup ( - fTraceOnlyMeasurerNumbeOahAtom); - - // measure positions - - S_oahTwoBooleansAtom - traceMeasurePositionsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-measure-positions", "tmeapos", -R"(Measure positions)", - "fTraceMeasurePositions", - fTraceMeasurePositions, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMeasurePositionsBooleanAtom); - measuresMultiplexBooleansAtom-> - addBooleanAtom ( - traceMeasurePositionsBooleanAtom); - - S_oahThreeBooleansAtom - traceMeasurePositionsDetailsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-measure-positions-details", "tmeaposd", -R"(Measure positions details)", - "fTraceMeasurePositionsDetails", - fTraceMeasurePositionsDetails, - traceMeasurePositionsBooleanAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMeasurePositionsDetailsBooleanAtom); - - // voice positions - - S_oahTwoBooleansAtom - traceVoicePositionsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-voice-positions", "tvoicespos", -R"(Voice positions)", - "fTraceVoicePositions", - fTraceVoicePositions, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceVoicePositionsBooleanAtom); - measuresMultiplexBooleansAtom-> - addBooleanAtom ( - traceVoicePositionsBooleanAtom); - - // measure moments - - S_oahTwoBooleansAtom - traceMeasureMomentsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-measure-moments", "tmeasmoms", -R"(Measure moments)", - "fTraceMeasureMoments", - fTraceMeasureMoments, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMeasureMomentsBooleanAtom); - measuresMultiplexBooleansAtom-> - addBooleanAtom ( - traceMeasureMomentsBooleanAtom); - - // voice moments - - S_oahTwoBooleansAtom - traceVoiceMomentsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-voice-moments", "tvoicemoms", -R"(Voice moments)", - "fTraceVoiceMoments", - fTraceVoiceMoments, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceVoiceMomentsBooleanAtom); - measuresMultiplexBooleansAtom-> - addBooleanAtom ( - traceVoiceMomentsBooleanAtom); - - // fTraceDetailedMeasureNumbersSet is empty -} - -void traceOahGroup::initializeVoicesFlatViewTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Voices flat view", - "help-trace-voices-flat-view", "htvoicesflatview", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // voices flat view - - S_oahTwoBooleansAtom - traceVoicesFlatViewBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-voices-flat-view", "tvoicesflatview", -R"(Trace the voices flat view gathering activity.)", - "fTraceVoicesFlatView", - fTraceVoicesFlatView, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceVoicesFlatViewBooleanAtom); - - // voices flat view details - - S_oahThreeBooleansAtom - traceVoicesFlatViewDetailsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-voices-flat-view-details", "tvoicesflatviewd", -R"(Trace the voices flat view gathering activity with more details.)", - "fTraceVoicesFlatViewDetails", - fTraceVoicesFlatViewDetails, - traceVoicesFlatViewBooleanAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceVoicesFlatViewDetailsBooleanAtom); -} - -void traceOahGroup::initializeMeasuresSlicesTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Measures slices", - "help-trace-measures-slices", "htmeasslices", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - -/* JMI - // the 'measures slices' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - measuresSlicesMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-measures-slices", "tinmeasslices", // JMI v0.9.70 - "Trace SHORT_NAME/LONG_NAME in segments.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - measuresSlicesMultiplexBooleansAtom); -*/ - - // measures slices - - S_oahTwoBooleansAtom - traceMeasuresSlicesBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-measures-slices", "tmeasslices", -R"(Trace the measures slices gathering activity.)", - "fTraceMeasuresSlices", - fTraceMeasuresSlices, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMeasuresSlicesBooleanAtom); - - // measures slices details - - S_oahThreeBooleansAtom - traceMeasuresSlicesDetailsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-measures-slices-details", "tmeasslicesd", -R"(Trace the measures slices gathering activity details.)", - "fTraceMeasuresSlicesDetails", - fTraceMeasuresSlicesDetails, - traceMeasuresSlicesBooleanAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMeasuresSlicesDetailsBooleanAtom); -} - -void traceOahGroup::initializeBooksToVoicesTraceOah () // RENAME and SPLIT? JMI v0.9.71 -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Score to voices", - "help-trace-score-to-voices", "htstv", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the 'books to voices' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - bookstoVoicesMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-books-to-voices", "tibtv", - "Trace SHORT_NAME/LONG_NAME in books to voices.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - bookstoVoicesMultiplexBooleansAtom); - - // books - - S_oahTwoBooleansAtom - traceBooksBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-books", "tbooks", -R"(Books)", - "fTraceBooks", - fTraceBooks, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceBooksBooleanAtom); - bookstoVoicesMultiplexBooleansAtom-> - addBooleanAtom ( - traceBooksBooleanAtom); - - // scores - - S_oahTwoBooleansAtom - traceScoresBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-scores", "tscores", -R"(Score)", - "fTraceScores", - fTraceScores, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceScoresBooleanAtom); - bookstoVoicesMultiplexBooleansAtom-> - addBooleanAtom ( - traceScoresBooleanAtom); - - // part groups - - S_oahTwoBooleansAtom - tracePartGroupsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-part-groups", "tpartgroups", -R"(Part groups)", - "fTracePartGroups", - fTracePartGroups, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - tracePartGroupsBooleanAtom); - bookstoVoicesMultiplexBooleansAtom-> - addBooleanAtom ( - tracePartGroupsBooleanAtom); - - // part groups details - - S_oahThreeBooleansAtom - tracePartGroupsDetailsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-part-groups-details", "tpartgroupsd", -R"(Part groups with more details. -This option implies '-trace-part-groups, -tpgrps'.)", - "fTracePartGroupsDetails", - fTracePartGroupsDetails, - tracePartGroupsBooleanAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - tracePartGroupsDetailsBooleanAtom); - bookstoVoicesMultiplexBooleansAtom-> - addBooleanAtom ( - tracePartGroupsDetailsBooleanAtom); - - // parts - - S_oahTwoBooleansAtom - tracePartsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-parts", "tparts", -R"(Parts)", - "fTraceParts", - fTraceParts, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - tracePartsBooleanAtom); - bookstoVoicesMultiplexBooleansAtom-> - addBooleanAtom ( - tracePartsBooleanAtom); - - // staves basics - - S_oahTwoBooleansAtom - traceStavesBasicsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-stave-basics", "tstavesb", -R"(Staves basics)", - "fTraceStavesBasics", - fTraceStavesBasics, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceStavesBasicsBooleanAtom); - - // staves - S_oahThreeBooleansAtom - traceStavesBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-staves", "tstaves", -R"(Staves)", - "fTraceStaves", - fTraceStaves, - traceStavesBasicsBooleanAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceStavesBooleanAtom); - bookstoVoicesMultiplexBooleansAtom-> - addBooleanAtom ( - traceStavesBooleanAtom); - - // staff details - - S_oahThreeBooleansAtom - traceStaffDetailsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-staves-details", "tstavesd", -R"(Staff details)", - "fTraceStavesDetails", - fTraceStavesDetails, - traceStavesBooleanAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceStaffDetailsBooleanAtom); - bookstoVoicesMultiplexBooleansAtom-> - addBooleanAtom ( - traceStaffDetailsBooleanAtom); - - // staff changes basics - - S_oahThreeBooleansAtom - traceStaffChangesBasicsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-staff-changes-basics", "tstchangesb", -R"(Staff changes basics. -This options implies '-trace-mxsr-events, -tmxsre' and '-trace-passes, -tpasses'.)", - "fTraceStaffChangesBasics", - fTraceStaffChangesBasics, - fTraceMxsrEventsAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceStaffChangesBasicsBooleanAtom); - - // staff changes - - S_oahTwoBooleansAtom - traceStaffChangesBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-staff-changes", "tstchanges", -R"(Staff changes)", - "fTraceStaffChanges", - fTraceStaffChanges, - traceStaffChangesBasicsBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceStaffChangesBooleanAtom); - bookstoVoicesMultiplexBooleansAtom-> - addBooleanAtom ( - traceStaffChangesBooleanAtom); - - // voices basics - - S_oahTwoBooleansAtom - traceVoicesBasicsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-voices-basics", "tvoicesb", -R"(Voices basics)", - "fTraceVoicesBasics", - fTraceVoicesBasics, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceVoicesBasicsBooleanAtom); - bookstoVoicesMultiplexBooleansAtom-> - addBooleanAtom ( - traceVoicesBasicsBooleanAtom); - - // voices - - S_oahTwoBooleansAtom - traceVoicesBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-voices", "tvoices", -R"(Voices) -This option implies '-trace-voices-basics, -tvoicesb'.)", - "fTraceVoices", - fTraceVoices, - traceVoicesBasicsBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceVoicesBooleanAtom); - bookstoVoicesMultiplexBooleansAtom-> - addBooleanAtom ( - traceVoicesBooleanAtom); - - // voices details - - S_oahTwoBooleansAtom - traceVoicesDetailsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-voices-details", "tvoicesd", -R"(Voices with more details (quite verbose)... -This option implies '-trace-voices-basics, -tvoicesb' and '-trace-voices, -tvoices'.)", - "fTraceVoicesDetails", - fTraceVoicesDetails, - traceVoicesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceVoicesDetailsBooleanAtom); - bookstoVoicesMultiplexBooleansAtom-> - addBooleanAtom ( - traceVoicesDetailsBooleanAtom); -} - -void traceOahGroup::initializeNotesDurationsTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "NotesDurations", - "help-trace-notes-durations", "htnd", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // durations - - S_oahTwoBooleansAtom - traceNotesDurationsBooleanAtom = - oahTwoBooleansAtom::create ( // JMI trace too??? v0.9.67 - "trace-notes-durations", "tndurs", -R"(Notes durations)", - "fTraceNotesDurations", - fTraceNotesDurations, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceNotesDurationsBooleanAtom); -} - -void traceOahGroup::initializeNotesTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Notes", - "help-trace-notes", "htn", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the 'notes' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - notesMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-notes", "tin", - "Trace SHORT_NAME/LONG_NAME in notes.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - notesMultiplexBooleansAtom); - - // notes basics - - S_oahThreeBooleansAtom - traceNotesBasicsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-notes-basics", "tnotesb", -R"(Notes basic trace information)", - "fTraceNotesBasics", - fTraceNotesBasics, - fTraceMxsrEventsAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceNotesBasicsBooleanAtom); - - // notes - - S_oahTwoBooleansAtom - traceNotesBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-notes", "tnotes", -R"(Notes. -This option implies '-trace-notes-basics, -tnotesb'.)", - "fTraceNotes", - fTraceNotes, - traceNotesBasicsBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceNotesBooleanAtom); - notesMultiplexBooleansAtom-> - addBooleanAtom ( - traceNotesBooleanAtom); - - // notes details - - S_oahTwoBooleansAtom - traceNotesDetailsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-notes-details", "tnotesd", -R"(Notes with more details, including divisions handling (quite verbose)... -This option implies '-trace-notes-basics, -tnotesb' and '-trace-notes, -tnotes'.)", - "fTraceNotesDetails", - fTraceNotesDetails, - traceNotesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceNotesDetailsBooleanAtom); - notesMultiplexBooleansAtom-> - addBooleanAtom ( - traceNotesDetailsBooleanAtom); - - // whole notes - - S_oahTwoBooleansAtom - traceWholeNoteDurationsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-whole-notes-durations", "twhndurs", // JMI v0.9.67 SUPERFLOUS with trace-notes-durations ??? -R"(Whole notes computations (quite verbose)...)", - "fTraceWholeNoteDurations", - fTraceWholeNoteDurations, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceWholeNoteDurationsBooleanAtom); - notesMultiplexBooleansAtom-> - addBooleanAtom ( - traceWholeNoteDurationsBooleanAtom); - - // whole notes details - - S_oahThreeBooleansAtom - traceWholeNoteDurationsDetailsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-whole-notes-details", "twhndursd", -R"(Whole notes computations details (event more verbose)...)", - "fTraceWholeNoteDurationsDetails", - fTraceWholeNoteDurationsDetails, - traceWholeNoteDurationsBooleanAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceWholeNoteDurationsDetailsBooleanAtom); - notesMultiplexBooleansAtom-> - addBooleanAtom ( - traceWholeNoteDurationsDetailsBooleanAtom); - - // measures whole notes vectors - - S_oahTwoBooleansAtom - traceMeasuresWholeNotesVectorsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-measures-whole-notes-vectors", "tmeaswhnvects", -R"(Meaures whole notes vectors)", - "fTraceMeasuresWholeNotesVectors", - fTraceMeasuresWholeNotesVectors, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMeasuresWholeNotesVectorsBooleanAtom); - - // rest notes - - S_oahTwoBooleansAtom - traceRestNotesBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-rest-notes", "trn", -R"(Rest notes)", - "fTraceRestNotes", - fTraceRestNotes, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceRestNotesBooleanAtom); - notesMultiplexBooleansAtom-> - addBooleanAtom ( - traceRestNotesBooleanAtom); - - // skip notes - - S_oahTwoBooleansAtom - traceSkipNotesBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-skip-notes", "tskips", -R"(Skip notes)", - "fTraceSkipNotes", - fTraceSkipNotes, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceSkipNotesBooleanAtom); - notesMultiplexBooleansAtom-> - addBooleanAtom ( - traceSkipNotesBooleanAtom); - - // notes octave entry - - S_oahTwoBooleansAtom - traceNotesOctaveEntryBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-notes-octave-entry", "tnoe", -R"(Notes octave entry)", - "fTraceNotesOctaveEntry", - fTraceNotesOctaveEntry, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceNotesOctaveEntryBooleanAtom); - notesMultiplexBooleansAtom-> - addBooleanAtom ( - traceNotesOctaveEntryBooleanAtom); - - // tremolos - - S_oahTwoBooleansAtom - traceTremolosBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-tremolos", "ttrems", -R"(Tremolos)", - "fTraceTremolos", - fTraceTremolos, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceTremolosBooleanAtom); - notesMultiplexBooleansAtom-> - addBooleanAtom ( - traceTremolosBooleanAtom); -} - -void traceOahGroup::initializeOptionsTraceAndDisplayOptions () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Options handling trace", - "help-trace-options-handling", "htoh", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // trace options - - fTraceOahBooleanAtom = - oahBooleanAtom::create ( - K_TRACE_OAH_OPTION_LONG_NAME, K_TRACE_OAH_OPTION_SHORT_NAME, -R"(Write a trace of options and help handling to standard error.)", - "fTraceOah", - fTraceOah); - - subGroup-> - appendAtomToSubGroup ( - fTraceOahBooleanAtom); - - // trace options details - - subGroup-> - appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( - K_TRACE_OAH_DETAILS_OPTION_LONG_NAME, K_TRACE_OAH_DETAILS_OPTION_SHORT_NAME, -R"(Write a trace of options and help handling with more details to standard error.)", - "fTraceOahDetails", - fTraceOahDetails, - fTraceOahBooleanAtom)); - - // fTraceDetailedMeasureNumbersSet is intially empty -} - -void traceOahGroup::initializeRepeatsToSlashesTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "Repeats to slashes", - "help-trace-repeats-to-slashes", "htrts", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // the 'repeats to slashes' multiplex booleans atom - - S_oahCommonPrefixBooleansAtom - repeatsToSlashesMultiplexBooleansAtom = - oahCommonPrefixBooleansAtom::create ( - "trace-in-repeats-to-slashes", "tirts", - "Trace SHORT_NAME/LONG_NAME in repeats to slashes.", - "SHORT_NAME", - "LONG_NAME", - fShortTracePrefix, - fLongTracePrefix); - - subGroup-> - appendAtomToSubGroup ( - repeatsToSlashesMultiplexBooleansAtom); - - // repeats basics - - S_oahTwoBooleansAtom - traceRepeatsBasicsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-repeats-basics", "trepsb", -R"(Repeats basic trace information)", - "fTraceRepeatsBasics", - fTraceRepeatsBasics, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceRepeatsBasicsBooleanAtom); - - // repeats - - S_oahTwoBooleansAtom - traceRepeatsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-repeats", "treps", -R"(Repeats. -This option implies '-trace-tuplets-basics, -ttupsb'.)", - "fTraceRepeats", - fTraceRepeats, - traceRepeatsBasicsBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceRepeatsBooleanAtom); - repeatsToSlashesMultiplexBooleansAtom-> - addBooleanAtom ( - traceRepeatsBooleanAtom); - - // repeats details - - S_oahTwoBooleansAtom - traceRepeatsDetailsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-repeats-details", "trepsd", -R"(Repeats details. -This option implies '-trace-tuplets-basics, -ttupsb' and '-trace-tuplets, -ttups'.)", - "fTraceRepeatsDetails", - fTraceRepeatsDetails, - traceRepeatsBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceRepeatsDetailsBooleanAtom); - repeatsToSlashesMultiplexBooleansAtom-> - addBooleanAtom ( - traceRepeatsDetailsBooleanAtom); - - // measure repeats basics - - S_oahTwoBooleansAtom - traceMeasureRepeatsBasicsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-measure-repeats-basics", "tmrepsb", -R"(Measure repeats basic trace information)", - "fTraceMeasureRepeatsBasics", - fTraceMeasureRepeatsBasics, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMeasureRepeatsBasicsBooleanAtom); - - // measure repeats - - S_oahTwoBooleansAtom - traceMeasureRepeatsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-measures-repeats", "tmeasreps", -R"(Measure repeats. -This option implies '-trace-measure-repeats-basics, -tmrepsb'.)", - "fTraceMeasureRepeats", - fTraceMeasureRepeats, - traceMeasureRepeatsBasicsBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMeasureRepeatsBooleanAtom); - repeatsToSlashesMultiplexBooleansAtom-> - addBooleanAtom ( - traceMeasureRepeatsBooleanAtom); - - // measure repeats details - - S_oahTwoBooleansAtom - traceMeasureRepeatsDetailsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-measures-repeats-details", "tmeasrepsd", -R"(Measure repeats. -This option implies '-trace-tuplets-basics, -ttupsb' and '-trace-tuplets, -ttups'.)", - "fTraceMeasureRepeatsDetails", - fTraceMeasureRepeatsDetails, - traceMeasureRepeatsBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMeasureRepeatsDetailsBooleanAtom); - repeatsToSlashesMultiplexBooleansAtom-> - addBooleanAtom ( - traceMeasureRepeatsDetailsBooleanAtom); - - // multi-measure rests - - S_oahTwoBooleansAtom - traceMultiMeasureRestsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-multi-measure-rests", "tmultmearest", -R"(Multi-measure rests)", - "fTraceMultiMeasureRests", - fTraceMultiMeasureRests, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMultiMeasureRestsBooleanAtom); - repeatsToSlashesMultiplexBooleansAtom-> - addBooleanAtom ( - traceMultiMeasureRestsBooleanAtom); - - S_oahThreeBooleansAtom - traceMultiMeasureRestsDetailsBooleanAtom = - oahThreeBooleansAtom::create ( - "trace-multi-measure-rests-details", "tmfbrd", -R"(Multi-measure rests details)", - "fTraceMultiMeasureRestsDetails", - fTraceMultiMeasureRestsDetails, - traceMultiMeasureRestsBooleanAtom, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceMultiMeasureRestsDetailsBooleanAtom); - repeatsToSlashesMultiplexBooleansAtom-> - addBooleanAtom ( - traceMultiMeasureRestsDetailsBooleanAtom); - - // beats repeats - - S_oahTwoBooleansAtom - traceBeatRepeatsBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-beats-repeats", "tbreps", -R"(Beats repeatss)", - "fTraceBeatRepeats", - fTraceBeatRepeats, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceBeatRepeatsBooleanAtom); - repeatsToSlashesMultiplexBooleansAtom-> - addBooleanAtom ( - traceBeatRepeatsBooleanAtom); - - // slashes - - S_oahTwoBooleansAtom - traceSlashesBooleanAtom = - oahTwoBooleansAtom::create ( - "trace-slashes", "tslashes", -R"(Slashes)", - "fTraceSlashes", - fTraceSlashes, - fTracePassesBooleanAtom); - - subGroup-> - appendAtomToSubGroup ( - traceSlashesBooleanAtom); - repeatsToSlashesMultiplexBooleansAtom-> - addBooleanAtom ( - traceSlashesBooleanAtom); -} - -void traceOahGroup::initializeTraceOahGroup () -{ - // other trace - // FIRST, to initialize passes trace - initializeOtherTraceOah (); - - // options and help trace and display - initializeOptionsTraceAndDisplayOptions (); - - // MXSR events (fTraceMxsrEventsAtom is used by other initializations) - initializeMxsrEventsTraceOah (); - - // score to voices - initializeBooksToVoicesTraceOah (); - - // print layouts - initializeMusicXMLPrintLayoutsTraceOah (); - - // segments - initializeSegmentsTraceOah (); - - // measures - initializeMeasuresTraceOah (); - - // measures slices - initializeMeasuresSlicesTraceOah (); - - // voices flat view - initializeVoicesFlatViewTraceOah (); - - // durations - initializeNotesDurationsTraceOah (); - - // notes - initializeNotesTraceOah (); - - // notes attachments - initializeNotesAttachmentsTraceOah (); - - // repeats to slashes - initializeRepeatsToSlashesTraceOah (); - - // instruments - initializeInstrumentsTraceOah (); - - // grace notes - initializeGraceNotesTraceOah (); - - // chords - initializeChordsTraceOah (); - - // tuplets - initializeTupletsTraceOah (); - - // texts - initializeCreditsToWordsTraceOah (); - - // harmonies - initializeHarmoniesTraceOah (); - - // figured bass elements - initializeFiguredBassesTraceOah (); - - // spanners - initializeSpannersTraceOah (); - - // inter-notes - initializeInterNotesTraceOah (); - - // clefs to tempos - initializeClefsToTemposTraceOah (); - - // breaks - initializeBreaksAndBarLinesTraceOah (); - - // above staff - initializeAboveStaffTraceOah (); - - //transpositions - initializeTranspositionsTraceOah (); -} - -//______________________________________________________________________________ -void traceOahGroup::enforceGroupQuietness () -{} - -//______________________________________________________________________________ -void traceOahGroup::checkGroupOptionsConsistency () -{ - // JMI -} - -//______________________________________________________________________________ -void traceOahGroup::acceptIn (basevisitor* v) -{ -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> traceOahGroup::acceptIn ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - if (visitor* - p = - dynamic_cast*> (v)) { - S_traceOahGroup elem = this; - -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> Launching traceOahGroup::visitStart ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - p->visitStart (elem); - } -} - -void traceOahGroup::acceptOut (basevisitor* v) -{ -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> traceOahGroup::acceptOut ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - if (visitor* - p = - dynamic_cast*> (v)) { - S_traceOahGroup elem = this; - -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> Launching traceOahGroup::visitEnd ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - p->visitEnd (elem); - } -} - -void traceOahGroup::browseData (basevisitor* v) -{ -#ifdef MF_TRACE_IS_ENABLED - if (gOahOahGroup->getTraceOahVisitors ()) { - std::stringstream ss; - - ss << - ".\\\" ==> traceOahGroup::browseData ()"; - - gWaeHandler->waeTraceWithoutInputLocation ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - oahGroup::browseData (v); -} - -//______________________________________________________________________________ -void traceOahGroup::displayAtomWithVariableOptionsValues ( - std::ostream& os, - int valueFieldWidth) const -{} - -void traceOahGroup::displayTraceOahValues (int fieldWidth) -{ - gLog << - "The trace options are:" << - std::endl; - - ++gIndenter; - - gLog << std::left << - std::setw (fieldWidth) << "Trace:" << - std::endl; - - ++gIndenter; - - gLog << std::left << - // options and help display - std::setw (fieldWidth) << "fTraceOah" << ": " << - fTraceOah << - std::endl << - std::setw (fieldWidth) << "fTraceOahDetails" << ": " << - fTraceOahDetails << - std::endl << - - // geometry - std::setw (fieldWidth) << "fTraceGeometry" << ": " << - fTraceGeometry << - std::endl << - - // identification - std::setw (fieldWidth) << "fTraceIdentification" << ": " << - fTraceIdentification << - std::endl << - - // for tests, hidden - std::setw (fieldWidth) << "fTraceForTests" << ": " << - fTraceForTests << - std::endl << - - // credits - std::setw (fieldWidth) << "fTraceCredits" << ": " << - fTraceCredits << - std::endl << - - // books - std::setw (fieldWidth) << "fTraceBooks" << ": " << - fTraceBooks << - std::endl << - - // scores - std::setw (fieldWidth) << "fTraceScores" << ": " << - fTraceScores << - std::endl << - - // part groups - std::setw (fieldWidth) << "fTracePartGroups" << ": " << - fTracePartGroups << - std::endl << - std::setw (fieldWidth) << "fTracePartGroupsDetails" << ": " << - fTracePartGroupsDetails << - std::endl << - - // parts - std::setw (fieldWidth) << "fTraceParts" << ": " << - fTraceParts << - std::endl << - - // staves - std::setw (fieldWidth) << "fTraceStavesBasics" << ": " << - fTraceStavesBasics << - std::endl << - std::setw (fieldWidth) << "fTraceStaves" << ": " << - fTraceStaves << - std::endl << - std::setw (fieldWidth) << "fTraceStavesDetails" << ": " << - fTraceStavesDetails << - std::endl << - - // staff changes - std::setw (fieldWidth) << "fTraceStaffChangesBasics" << ": " << - fTraceStaffChangesBasics << - std::endl << - std::setw (fieldWidth) << "fTraceStaffChanges" << ": " << - fTraceStaffChanges << - std::endl << - - // voices - std::setw (fieldWidth) << "fTraceVoicesBasics" << ": " << - fTraceVoicesBasics << - std::endl << - std::setw (fieldWidth) << "fTraceVoices" << ": " << - fTraceVoices << - std::endl << - std::setw (fieldWidth) << "fTraceVoicesDetails" << ": " << - fTraceVoicesDetails << - std::endl << - - // MusicXML print layouts - std::setw (fieldWidth) << "fTraceMusicXMLPrintLayouts" << ": " << - fTraceMusicXMLPrintLayouts << - std::endl << - - // segments - std::setw (fieldWidth) << "fTraceSegments" << ": " << - fTraceSegments << - std::endl << - std::setw (fieldWidth) << "fTraceSegmentsDetails" << ": " << - fTraceSegmentsDetails << - std::endl << - - // measures - std::setw (fieldWidth) << "fTraceMeasuresNumbers" << ": " << - fTraceMeasuresNumbers << - std::endl << - - std::setw (fieldWidth) << "fTraceMeasuresBasics" << ": " << - fTraceMeasuresBasics << - std::endl << - std::setw (fieldWidth) << "fTraceMeasures" << ": " << - fTraceMeasures << - std::endl << - std::setw (fieldWidth) << "fTraceMeasuresDetails" << ": " << - fTraceMeasuresDetails << - std::endl << - - std::setw (fieldWidth) << "fTraceOnlyMeasure" << ": " << - fTraceOnlyMeasure << - std::endl; - - gLog << std::left << - std::setw (fieldWidth) << "fTraceDetailedMeasureNumbersSet" << ": " << - std::endl; - - if (fTraceDetailedMeasureNumbersSet.size ()) { - std::set ::const_iterator - iBegin = fTraceDetailedMeasureNumbersSet.begin (), - iEnd = fTraceDetailedMeasureNumbersSet.end (), - i = iBegin; - - ++gIndenter; - - for ( ; ; ) { - gLog << "v " << (*i); - if (++i == iEnd) break; - // no std::endl here - } // for - - --gIndenter; - } - else { - gLog << - "[NONE]"; - } - gLog << std::endl; - - gLog << std::left << - std::setw (fieldWidth) << "fTraceMeasurePositions" << ": " << - fTraceMeasurePositions << - std::endl << - std::setw (fieldWidth) << "fTraceMeasurePositionsDetails" << ": " << - fTraceMeasurePositionsDetails << - std::endl << - - std::setw (fieldWidth) << "fTraceVoicePositions" << ": " << - fTraceVoicePositions << - std::endl << - - std::setw (fieldWidth) << "fTraceMeasureMoments" << ": " << - fTraceMeasureMoments << - std::endl << - std::setw (fieldWidth) << "fTraceVoiceMoments" << ": " << - fTraceVoiceMoments << - std::endl << - - std::setw (fieldWidth) << "fTraceVoicesFlatView" << ": " << - fTraceVoicesFlatView << - std::endl << - std::setw (fieldWidth) << "fTraceVoicesFlatViewDetails" << ": " << - fTraceVoicesFlatViewDetails << - std::endl << - - // measures slices - - std::setw (fieldWidth) << "fTraceMeasuresSlices" << ": " << - fTraceMeasuresSlices << - std::endl << - std::setw (fieldWidth) << "fTraceMeasuresSlicesDetails" << ": " << - fTraceMeasuresSlicesDetails << - std::endl << - - // clefs - std::setw (fieldWidth) << "fTraceClefs" << ": " << - fTraceClefs << - std::endl << - - // keys - std::setw (fieldWidth) << "fTraceKeys" << ": " << - fTraceKeys << - std::endl << - std::setw (fieldWidth) << "fTraceKeysDetails" << ": " << - fTraceKeysDetails << - std::endl << - - // time signatures - std::setw (fieldWidth) << "fTraceTimeSignatures" << ": " << - fTraceTimeSignatures << - std::endl << - - // tempos - std::setw (fieldWidth) << "fTraceTempos" << ": " << - fTraceTempos << - std::endl << - - // breaks - std::setw (fieldWidth) << "fTraceLineBreaks" << ": " << - fTraceLineBreaks << - std::endl << - std::setw (fieldWidth) << "fTracePageBreaks" << ": " << - fTracePageBreaks << - std::endl << - - // bar lines - std::setw (fieldWidth) << "fTraceBarLines" << ": " << - fTraceBarLines << - std::endl << - std::setw (fieldWidth) << "fTraceBarLinesDetails" << ": " << - fTraceBarLinesDetails << - std::endl << - - // bar checks - std::setw (fieldWidth) << "fTraceBarChecks" << ": " << - fTraceBarChecks << - std::endl << - - // bar number checks - std::setw (fieldWidth) << "fTraceBarNumberChecks" << ": " << - fTraceBarNumberChecks << - std::endl << - - // transpositions - std::setw (fieldWidth) << "fTraceTranspositions" << ": " << - fTraceTranspositions << - std::endl << - - // octave shifts - std::setw (fieldWidth) << "fTraceOctaveShifts" << ": " << - fTraceOctaveShifts << - std::endl << - - // repeats - std::setw (fieldWidth) << "fTraceRepeatsBasics" << ": " << - fTraceRepeatsBasics << - std::endl << - std::setw (fieldWidth) << "fTraceRepeats" << ": " << - fTraceRepeats << - std::endl << - std::setw (fieldWidth) << "fTraceRepeatsDetails" << ": " << - fTraceRepeatsDetails << - std::endl << - - // measure repeats - std::setw (fieldWidth) << "fTraceMeasureRepeatsBasics" << ": " << - fTraceMeasureRepeatsBasics << - std::endl << - std::setw (fieldWidth) << "fTraceMeasureRepeats" << ": " << - fTraceMeasureRepeats << - std::endl << - std::setw (fieldWidth) << "fTraceMeasureRepeatsDetails" << ": " << - fTraceMeasureRepeatsDetails << - std::endl << - - // multi-measure rests - std::setw (fieldWidth) << "fTraceMultiMeasureRests" << ": " << - fTraceMultiMeasureRests << - std::endl << - std::setw (fieldWidth) << "fTraceMultiMeasureRestsDetails" << ": " << - fTraceMultiMeasureRestsDetails << - std::endl << - - // beats repeats - std::setw (fieldWidth) << "fTraceBeatRepeats" << ": " << - fTraceBeatRepeats << - std::endl << - - // slashes - std::setw (fieldWidth) << "fTraceSlashes" << ": " << - fTraceSlashes << - std::endl << - - // notes durations - std::setw (fieldWidth) << "fTraceNotesDurations" << ": " << - fTraceNotesDurations << - std::endl << - - // notes - std::setw (fieldWidth) << "fTraceNotesBasics" << ": " << - fTraceNotesBasics << - std::endl << - std::setw (fieldWidth) << "fTraceNotes" << ": " << - fTraceNotes << - std::endl << - std::setw (fieldWidth) << "fTraceNotesDetails" << ": " << - fTraceNotesDetails << - std::endl << - - // whole notes durations - std::setw (fieldWidth) << "fTraceWholeNoteDurations" << ": " << - fTraceWholeNoteDurations << - std::endl << - std::setw (fieldWidth) << "fTraceWholeNoteDurationsDetails" << ": " << - fTraceWholeNoteDurationsDetails << - std::endl << - - // measures whole notes vectors - std::setw (fieldWidth) << "fTraceMeasuresWholeNotesVectors" << ": " << - fTraceMeasuresWholeNotesVectors << - std::endl << - - // rest and skip notes - std::setw (fieldWidth) << "fTraceRestNotes" << ": " << - fTraceRestNotes << - std::endl << - std::setw (fieldWidth) << "fTraceSkipNotes" << ": " << - fTraceSkipNotes << - std::endl << - - // notes octave entry - std::setw (fieldWidth) << "fTraceNotesOctaveEntry" << ": " << - fTraceNotesOctaveEntry << - std::endl << - - // grace notes - std::setw (fieldWidth) << "fTraceGraceNotesBasics" << ": " << - fTraceGraceNotesBasics << - std::endl << - std::setw (fieldWidth) << "fTraceGraceNotes" << ": " << - fTraceGraceNotes << - std::endl << - - // tremolos - std::setw (fieldWidth) << "fTraceTremolos" << ": " << - fTraceTremolos << - std::endl << - - // stems - std::setw (fieldWidth) << "fTraceStems" << ": " << - fTraceStems << - std::endl << - - // beams - std::setw (fieldWidth) << "fTraceBeams" << ": " << - fTraceBeams << - std::endl << - - // articulations - std::setw (fieldWidth) << "fTraceArticulations" << ": " << - fTraceArticulations << - std::endl << - - // technicals - std::setw (fieldWidth) << "fTraceTechnicals" << ": " << - fTraceTechnicals << - std::endl << - - // ornaments - std::setw (fieldWidth) << "fTraceOrnaments" << ": " << - fTraceOrnaments << - std::endl << - std::setw (fieldWidth) << "fTraceOrnamentsDetails" << ": " << - fTraceOrnamentsDetails << - std::endl << - - // dynamics - std::setw (fieldWidth) << "fTraceDynamics" << ": " << - fTraceDynamics << - std::endl << - - // spanners - std::setw (fieldWidth) << "fTraceSpanners" << ": " << - fTraceSpanners << - std::endl << - - // cresc/decresc - std::setw (fieldWidth) << "fTraceCrescDecrescs" << ": " << - fTraceCrescDecrescs << - std::endl << - - // wedges - std::setw (fieldWidth) << "fTraceWedges" << ": " << - fTraceWedges << - std::endl << - - // slurs - std::setw (fieldWidth) << "fTraceSlurs" << ": " << - fTraceSlurs << - std::endl << - std::setw (fieldWidth) << "fTraceSlursDetails" << ": " << - fTraceSlursDetails << - std::endl << - - // ligatures - std::setw (fieldWidth) << "fTraceLigatures" << ": " << - fTraceLigatures << - std::endl << - - // lyrics - std::setw (fieldWidth) << "fTraceLyrics" << ": " << - fTraceLyrics << - std::endl << - std::setw (fieldWidth) << "fTraceLyricsDetails" << ": " << - fTraceLyricsDetails << - std::endl << - - // MXML events - std::setw (fieldWidth) << "fTraceMxsrEvents" << ": " << - fTraceMxsrEvents << - std::endl << - - // words - std::setw (fieldWidth) << "fTraceWords" << ": " << - fTraceWords << - std::endl << - - // grace notes - std::setw (fieldWidth) << "fTraceGraceNotesBasics" << ": " << - fTraceGraceNotesBasics << - std::endl << - std::setw (fieldWidth) << "fTraceGraceNotes" << ": " << - fTraceGraceNotes << - std::endl << - - // chords - std::setw (fieldWidth) << "fTraceChordsBasics" << ": " << - fTraceChordsBasics << - std::endl << - std::setw (fieldWidth) << "fTraceChords" << ": " << - fTraceChords << - std::endl << - std::setw (fieldWidth) << "fTraceChordsDetails" << ": " << - fTraceChordsDetails << - std::endl << - - // tuplets - std::setw (fieldWidth) << "fTraceTupletsBasics" << ": " << - fTraceTupletsBasics << - std::endl << - std::setw (fieldWidth) << "fTraceTuplets" << ": " << - fTraceTuplets << - std::endl << - std::setw (fieldWidth) << "fTraceTupletsDetails" << ": " << - fTraceTupletsDetails << - std::endl << - - // ties - std::setw (fieldWidth) << "fTraceTies" << ": " << - fTraceTies << - std::endl << - - // glissandos - std::setw (fieldWidth) << "fTraceGlissandos" << ": " << - fTraceGlissandos << - std::endl << - - // rehearsal marks - std::setw (fieldWidth) << "fTraceRehearsalMarks" << ": " << - fTraceRehearsalMarks << - std::endl << - - // segnos - std::setw (fieldWidth) << "fTraceSegnos" << ": " << - fTraceSegnos << - std::endl << - - // dal segnos - std::setw (fieldWidth) << "fTraceDalSegnos" << ": " << - fTraceDalSegnos << - std::endl << - - // codas - std::setw (fieldWidth) << "fTraceCodas" << ": " << - fTraceCodas << - std::endl << - - // eyeglases - std::setw (fieldWidth) << "fTraceEyeGlasses" << ": " << - fTraceEyeGlasses << - std::endl << - - // harmonies - std::setw (fieldWidth) << "fTraceHarmonies" << ": " << - fTraceHarmonies << - std::endl << - std::setw (fieldWidth) << "fTraceHarmoniesDetails" << ": " << - fTraceHarmoniesDetails << - std::endl << - std::setw (fieldWidth) << "fTraceExtraHarmonies" << ": " << - fTraceExtraHarmonies << - std::endl << - - // figured bass - std::setw (fieldWidth) << "fTraceFiguredBasses" << ": " << - fTraceFiguredBasses << - std::endl << - std::setw (fieldWidth) << "fTraceFiguredBassesDetails" << ": " << - fTraceFiguredBassesDetails << - std::endl << - - // instruments - std::setw (fieldWidth) << "fTraceInstruments" << ": " << - fTraceInstruments << - std::endl << - - // frames - std::setw (fieldWidth) << "fTraceFrames" << ": " << - fTraceFrames << - std::endl << - - // scordaturas - std::setw (fieldWidth) << "fTraceScordaturas" << ": " << - fTraceScordaturas << - std::endl << - - // slides - std::setw (fieldWidth) << "fTraceSlides" << ": " << - fTraceSlides << - std::endl << - - // pedals - std::setw (fieldWidth) << "fTracePedals" << ": " << - fTracePedals << - std::endl << - - // accordion registrations - std::setw (fieldWidth) << "fTraceAccordionRegistrations" << ": " << - fTraceAccordionRegistrations << - std::endl << - - // harp pedals - std::setw (fieldWidth) << "fTraceHarpPedals" << ": " << - fTraceHarpPedals << - std::endl << - std::setw (fieldWidth) << "fTraceHarpPedalsTunings" << ": " << - fTraceHarpPedalsTunings << - std::endl << - - // damps - std::setw (fieldWidth) << "fTraceDamps" << ": " << - fTraceDamps << - std::endl << - std::setw (fieldWidth) << "fTraceDampAlls" << ": " << - fTraceDampAlls << - std::endl << - - -/* JMI - // msrStreams - std::setw (fieldWidth) << "fTraceMsrStreams" << ": " << - fTraceMsrStreams << - std::endl << -*/ - - // midi - std::setw (fieldWidth) << "fTraceMidi" << ": " << - fTraceMidi << - std::endl; - - --gIndenter; - - --gIndenter; -} - -std::ostream& operator << (std::ostream& os, const S_traceOahGroup& elt) -{ - if (elt) { - elt->print (os); - } - else { - os << "[NULL]" << std::endl; - } - - return os; -} - -//________________________________________________________________________ -// hidden global trace OAH variable -EXP S_traceOahGroup pGlobalTraceOahGroup; - -EXP S_traceOahGroup getGlobalTraceOahGroup () -{ - return pGlobalTraceOahGroup; -} - -//______________________________________________________________________________ -S_traceOahGroup createGlobalTraceOahGroup ( - const S_oahHandler& handler) -{ -#ifdef MF_TRACE_IS_ENABLED - if (gEarlyOptions.getTraceEarlyOptions ()) { - std::stringstream ss; - -// ss << - gLog << // JMI ??? v0.9.71 OAH_OAH - "Creating global trace OAH group 1" << - std::endl; - -// gWaeHandler->waeTraceWithoutInputLocation ( -// __FILE__, __LINE__, -// ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - // protect library against multiple initializations - if (! pGlobalTraceOahGroup) { - // create the global OAH group - pGlobalTraceOahGroup = - traceOahGroup::create ( - handler); - assert (pGlobalTraceOahGroup != 0); - } - - // return the global OAH group - return pGlobalTraceOahGroup; -} - - -} - - -#endif // MF_TRACE_IS_ENABLED - - - -/* JMI - // traceDetailedMeasureNumbersSet - // -------------------------------------- - - { - S_oahSubGroup - traceAndDisplaySubGroup = - oahSubGroup::create ( - "Trace and display", - "htd", "help-trace-and-display", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (traceAndDisplaySubGroup); - - // detailed measure numbers set - - // fTraceDetailedMeasureNumbersSet is empty - - traceAndDisplaySubGroup-> - appendAtomToSubGroup ( - oahNaturalNumbersSetElementAtom::create ( - "trace-detailed", "tdetail", -R"('measureNumbersSet' has a form such as '0,2-14,^8-10', -where '^' excludes the corresponding numbers interval -and 0 applies to the '' and anacrusis if present. -The measure numbers should be those of the produced score, -since MusicXML measure numbers are arbitrary strings. -Generate a detailed trace of the activity and print additional -debugging information to standard error for the specified measures.)", - "measureNumbersSet", - "traceDetailedMeasureNumbersSet", - fTraceDetailedMeasureNumbersSet)); - } -*/ - - diff --git a/src/mflibrary/mfTraceOah.h b/src/mflibrary/mfTraceOah.h deleted file mode 100644 index 060d2393..00000000 --- a/src/mflibrary/mfTraceOah.h +++ /dev/null @@ -1,1410 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfTraceOah___ -#define ___mfTraceOah___ - -#ifdef MF_TRACE_IS_ENABLED // encompasses this whole file - - -#include - -#include "exports.h" - -#include "oahAtomsCollection.h" -#include "oahOah.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -class EXP traceOahGroup : public oahGroup -{ - public: - - static SMARTP create ( - const S_oahHandler& handler); - - protected: - - // constructors/destructor - // ------------------------------------------------------ - - traceOahGroup ( - const S_oahHandler& handler); - - virtual ~traceOahGroup (); - - public: - - // initialisation - // ------------------------------------------------------ - - void createTheTracePrefixes ( - const S_oahHandler& handler); - - void initializeTraceOahGroup (); - - void initializeOptionsTraceAndDisplayOptions (); - - void initializeMusicXMLPrintLayoutsTraceOah (); - - void initializeRepeatsToSlashesTraceOah (); - - void initializeNotesDurationsTraceOah (); - - void initializeNotesTraceOah (); - - void initializeNotesAttachmentsTraceOah (); - - void initializeBooksToVoicesTraceOah (); - - void initializeSegmentsTraceOah (); - - void initializeMeasuresTraceOah (); - - void initializeVoicesFlatViewTraceOah (); - - void initializeMeasuresSlicesTraceOah (); - - void initializeInstrumentsTraceOah (); - - void initializeMxsrEventsTraceOah (); - - void initializeGraceNotesTraceOah (); - - void initializeChordsTraceOah (); - - void initializeTupletsTraceOah (); - - void initializeCreditsToWordsTraceOah (); - - void initializeHarmoniesTraceOah (); - - void initializeFiguredBassesTraceOah (); - - void initializeSpannersTraceOah (); - - void initializeInterNotesTraceOah (); - - void initializeClefsToTemposTraceOah (); - - void initializeBreaksAndBarLinesTraceOah (); - - void initializeAboveStaffTraceOah (); - - void initializeTranspositionsTraceOah (); - - void initializeOtherTraceOah (); - - public: - - // set and get - // ------------------------------------------------------ - - // options and help trace - // -------------------------------------- - - S_oahPrefix getShortTracePrefix () const - { return fShortTracePrefix; } - S_oahPrefix getLongTracePrefix () const - { return fLongTracePrefix; } - -// S_oahPrefix getShortDisplayPrefix () const -// { return fShortDisplayPrefix; } -// S_oahPrefix getLongDisplayPrefix () const -// { return fLongDisplayPrefix; } - - void setTraceOah () - { fTraceOah = true; } - Bool getTraceOah () const - { return fTraceOah; } - - const S_oahBooleanAtom& - getTraceOahBooleanAtom () const - { return fTraceOahBooleanAtom; } - -// replaced by getTraceEarlyOptionsDetails() -// Bool getTraceOahDetails () const -// { return fTraceOahDetails; } - - // other - // -------------------------------------- - - // passes - const S_oahBooleanAtom& - getTracePassesBooleanAtom () const - { return fTracePassesBooleanAtom; } - - const S_passIDOahAtom& - getTraceOnlyPassBooleanAtom () const - { return fTraceOnlyPassIDOahAtom; } - - // geometry - void setTraceGeometry () - { fTraceGeometry = true; } - Bool getTraceGeometry () const - { return fTraceGeometry; } - // identification - void setTraceIdentification () - { fTraceIdentification = true; } - Bool getTraceIdentification () const - { return fTraceIdentification; } - // for tests, hidden - void setTraceForTests () - { fTraceForTests = true; } - Bool getTraceForTests () const - { return fTraceForTests; } - - - // books to voices - // -------------------------------------- - - // books - void setTraceBooks () - { fTraceBooks = true; } - Bool getTraceBooks () const - { return fTraceBooks; } - // scores - void setTraceScores () - { fTraceScores = true; } - Bool getTraceScores () const - { return fTraceScores; } - // part groups - void setTracePartGroups () - { fTracePartGroups = true; } - Bool getTracePartGroups () const - { return fTracePartGroups; } - Bool getTracePartGroupsDetails () const - { return fTracePartGroupsDetails; } - // parts - void setTraceParts () - { fTraceParts = true; } - Bool getTraceParts () const - { return fTraceParts; } - // staves - Bool getTraceStavesBasics () const - { return fTraceStavesBasics; } - void setTraceStaves () - { fTraceStaves = true; } - Bool getTraceStaves () const - { return fTraceStaves; } - // staff details - Bool getTraceStavesDetails () const - { return fTraceStavesDetails; } - - // MXSR events (temporary from v0.9.72) - void setTraceMxsrEvents () - { fTraceMxsrEvents = true; } - Bool getTraceMxsrEvents () const - { return fTraceMxsrEvents; } - - S_oahBooleanAtom getTraceMxsrEventsAtom () const - { return fTraceMxsrEventsAtom; } - - // staff changes - void setTraceTraceStaffChangesBasics () - { fTraceStaffChangesBasics = true; } - void setTraceStaffChanges () - { fTraceStaffChanges = true; } - - Bool getTraceStaffChangesBasics () const - { return fTraceStaffChangesBasics; } - Bool getTraceStaffChanges () const - { return fTraceStaffChanges; } - // voices - Bool getTraceVoicesBasics () const - { return fTraceVoicesBasics; } -// void setTraceVoices () -// { fTraceVoices = true; } - Bool getTraceVoices () const - { return fTraceVoices; } - - Bool getTraceVoicesDetails () const - { return fTraceVoicesDetails; } - - - // print layouts - // -------------------------------------- - - Bool getTraceMusicXMLPrintLayouts () const - { return fTraceMusicXMLPrintLayouts; } - - // segments and measures - // -------------------------------------- - - // segments - void setTraceSegments () - { fTraceSegments = true; } - Bool getTraceSegments () const - { return fTraceSegments; } - - Bool getTraceSegmentsDetails () const - { return fTraceSegmentsDetails; } - // measures - Bool getTraceMeasuresNumbers () const - { return fTraceMeasuresNumbers; } - - Bool getTraceMeasuresBasics () const - { return fTraceMeasuresBasics; } - - void setTraceMeasures () - { fTraceMeasures = true; } - Bool getTraceMeasures () const - { return fTraceMeasures; } - - Bool getTraceMeasuresDetails () const - { return fTraceMeasuresDetails; } - - S_oahStringAtom getTraceOnlyMeasurerNumbeOahAtom () const - { return fTraceOnlyMeasurerNumbeOahAtom; } - - std::set getTraceDetailedMeasureNumbersSet () const - { return fTraceDetailedMeasureNumbersSet; } - - // positions - Bool getTraceMeasurePositions () const - { return fTraceMeasurePositions; } - void setTraceMeasurePositions () - { fTraceMeasurePositions = true; } - - Bool getTraceMeasurePositionsDetails () const - { return fTraceMeasurePositionsDetails; } - void setTraceMeasurePositionsDetails () - { fTraceMeasurePositionsDetails = true; } - - Bool getTraceVoicePositions () const - { return fTraceVoicePositions; } - void setTraceVoicePositions () - { fTraceVoicePositions = true; } - - // moments - Bool getTraceMeasureMoments () const - { return fTraceMeasureMoments; } - void setTraceMeasureMoments () - { fTraceMeasureMoments = true; } - - Bool getTraceVoiceMoments () const - { return fTraceVoiceMoments; } - void setTraceVoiceMoments () - { fTraceVoiceMoments = true; } - - // voices flat view - Bool getTraceVoicesFlatView () const - { return fTraceVoicesFlatView; } - - Bool getTraceVoicesFlatViewDetails () const - { return fTraceVoicesFlatViewDetails; } - - // measures slices - Bool getTraceMeasuresSlices () const - { return fTraceMeasuresSlices; } - - Bool getTraceMeasuresSlicesDetails () const - { return fTraceMeasuresSlicesDetails; } - - - // clef, key, time signature - // -------------------------------------- - - Bool getTraceClefKeyTimeSignatureGroups () const - { - return - getTraceClefs () - || - getTraceKeys () - || - getTraceTimeSignatures (); - } - - // clefs - void setTraceClefs () - { fTraceClefs = true; } - Bool getTraceClefs () const - { return fTraceClefs; } - // keys - void setTraceKeys () - { fTraceKeys = true; } - void setTraceKeysDetails () - { fTraceKeysDetails = true; } - - Bool getTraceKeys () const - { return fTraceKeys; } - Bool getTraceKeysDetails () const - { return fTraceKeysDetails; } - // time signatures - void setTraceTimeSignatures () - { fTraceTimeSignatures = true; } - Bool getTraceTimeSignatures () const - { return fTraceTimeSignatures; } - - - // tempos - // -------------------------------------- - - // tempos - void setTraceTempos () - { fTraceTempos = true; } - Bool getTraceTempos () const - { return fTraceTempos; } - - - // breaks and barLines - // -------------------------------------- - - // line breaks - void setTraceLineBreaks () - { fTraceLineBreaks = true; } - Bool getTraceLineBreaks () const - { return fTraceLineBreaks; } - // page and line breaks - void setTracePageBreaks () - { fTracePageBreaks = true; } - Bool getTracePageBreaks () const - { return fTracePageBreaks; } - // bar lines - void setTraceBarLines () - { fTraceBarLines = true; } - Bool getTraceBarLines () const - { return fTraceBarLines; } - // bar lines details - Bool getTraceBarLinesDetails () const - { return fTraceBarLinesDetails; } - - - // bar checks - // -------------------------------------- - - void setTraceBarChecks () - { fTraceBarChecks = true; } - Bool getTraceBarChecks () const - { return fTraceBarChecks; } - - - // bar number checks - // -------------------------------------- - - void setTraceBarNumberChecks () - { fTraceBarNumberChecks = true; } - Bool getTraceBarNumberChecks () const - { return fTraceBarNumberChecks; } - - - // transpositions - // -------------------------------------- - - // transpositions - void setTraceTranspositions () - { fTraceTranspositions = true; } - Bool getTraceTranspositions () const - { return fTraceTranspositions; } - // octave shifts - void setTraceOctaveShifts () - { fTraceOctaveShifts = true; } - Bool getTraceOctaveShifts () const - { return fTraceOctaveShifts; } - - - // repeats to slashes - // -------------------------------------- - - // repeats - Bool getTraceRepeatsBasics () const - { return fTraceRepeatsBasics; } - - void setTraceRepeats () - { fTraceRepeats = true; } - Bool getTraceRepeats () const - { return fTraceRepeats; } - - Bool getTraceRepeatsDetails () const - { return fTraceRepeatsDetails; } - - // measure repeats - Bool getTraceMeasureRepeatsBasics () const - { return fTraceMeasureRepeatsBasics; } - - void setTraceMeasureRepeats () - { fTraceMeasureRepeats = true; } - Bool getTraceMeasureRepeats () const - { return fTraceMeasureRepeats; } - - void setTraceMeasureRepeatsDetails () - { fTraceMeasureRepeatsDetails = true; } - Bool getTraceMeasureRepeatsDetails () const - { return fTraceMeasureRepeatsDetails; } - - // multi-measure rests - void setTraceMultiMeasureRests () - { fTraceMultiMeasureRests = true; } - Bool getTraceMultiMeasureRests () const - { return fTraceMultiMeasureRests; } - - void setTraceMultiMeasureRestsDetails () - { fTraceMultiMeasureRestsDetails = true; } - Bool getTraceMultiMeasureRestsDetails () const - { return fTraceMultiMeasureRestsDetails; } - // beats repeats - void setTraceBeatRepeats () - { fTraceBeatRepeats = true; } - Bool getTraceBeatRepeats () const - { return fTraceBeatRepeats; } - // slashes - void setTraceSlashes () - { fTraceSlashes = true; } - Bool getTraceSlashes () const - { return fTraceSlashes; } - - - // durations - // -------------------------------------- - - void setTraceNotesDurations () - { fTraceNotesDurations = true; } - Bool getTraceNotesDurations () const - { return fTraceNotesDurations; } - - // notes - // -------------------------------------- - - // notes - Bool getTraceNotesBasics () const - { return fTraceNotesBasics; } - - void setTraceNotes () - { fTraceNotes = true; } - Bool getTraceNotes () const - { return fTraceNotes; } - - Bool getTraceNotesDetails () const - { return fTraceNotesDetails; } - - // whole notes - Bool getTraceWholeNoteDurations () const - { return fTraceWholeNoteDurations; } - Bool getTraceWholeNoteDurationsDetails () const - { return fTraceWholeNoteDurationsDetails; } - - // measures whole notes vectors - Bool getTraceMeasuresWholeNotesVectors () const - { return fTraceMeasuresWholeNotesVectors; } - - // skip notes - void setTraceSkipNotes () - { fTraceSkipNotes = true; } - Bool getTraceSkipNotes () const - { return fTraceSkipNotes; } - - // rest notes - void setTraceRestNotes () - { fTraceRestNotes = true; } - Bool getTraceRestNotes () const - { return fTraceRestNotes; } - - // notes octave entry - void setTraceNotesOctaveEntry () - { fTraceNotesOctaveEntry = true; } - Bool getTraceNotesOctaveEntry () const - { return fTraceNotesOctaveEntry; } - - // grace notes - void setTraceGraceNotesBasics () - { fTraceGraceNotesBasics = true; } - Bool getTraceGraceNotesBasics () const - { return fTraceGraceNotesBasics; } - - void setTraceGraceNotes () - { fTraceGraceNotes = true; } - Bool getTraceGraceNotes () const - { return fTraceGraceNotes; } - - // tremolos - void setTraceTremolos () - { fTraceTremolos = true; } - Bool getTraceTremolos () const - { return fTraceTremolos; } - - - // note attachments - // -------------------------------------- - - // stems - void setTraceStems () - { fTraceStems = true; } - Bool getTraceStems () const - { return fTraceStems; } - - // beams - void setTraceBeams () - { fTraceBeams = true; } - Bool getTraceBeams () const - { return fTraceBeams; } - - // articulations - void setTraceArticulations () - { fTraceArticulations = true; } - Bool getTraceArticulations () const - { return fTraceArticulations; } - - // technicals - void setTraceTechnicals () - { fTraceTechnicals = true; } - Bool getTraceTechnicals () const - { return fTraceTechnicals; } - - // ornaments - void setTraceOrnaments () - { fTraceOrnaments = true; } - Bool getTraceOrnaments () const - { return fTraceOrnaments; } - - void setTraceOrnamentsDetails () - { fTraceOrnamentsDetails = true; } - Bool getTraceOrnamentsDetails () const - { return fTraceOrnamentsDetails; } - - // dynamics - void setTraceDynamics () - { fTraceDynamics = true; } - Bool getTraceDynamics () const - { return fTraceDynamics; } - - - // spanners - // -------------------------------------- - - // spanners - void setTraceSpanners () - { fTraceSpanners = true; } - Bool getTraceSpanners () const - { return fTraceSpanners; } - // cresc/decresc - void setTraceCrescDecrescs () - { fTraceCrescDecrescs = true; } - Bool getTraceCrescDecrescs () const - { return fTraceCrescDecrescs; } - // wedges - void setTraceWedges () - { fTraceWedges = true; } - Bool getTraceWedges () const - { return fTraceWedges; } - // slurs - void setTraceSlurs () - { fTraceSlurs = true; } - Bool getTraceSlurs () const - { return fTraceSlurs; } - - Bool getTraceSlursDetails () const - { return fTraceSlursDetails; } - // ligatures - void setTraceLigatures () - { fTraceLigatures = true; } - Bool getTraceLigatures () const - { return fTraceLigatures; } - - - // credits to words - // -------------------------------------- - - // credits - void setTraceCredits () - { fTraceCredits = true; } - Bool getTraceCredits () const - { return fTraceCredits; } - // lyrics - void setTraceLyrics () - { fTraceLyrics = true; } - Bool getTraceLyrics () const - { return fTraceLyrics; } - - Bool getTraceLyricsDetails () const - { return fTraceLyricsDetails; } - // words - void setTraceWords () - { fTraceWords = true; } - Bool getTraceWords () const - { return fTraceWords; } - - - // chords and tuplets - // -------------------------------------- - - // chords - Bool getTraceChordsBasics () const - { return fTraceChordsBasics; } - - void setTraceChords () - { fTraceChords = true; } - Bool getTraceChords () const - { return fTraceChords; } - - Bool getTraceChordsDetails () const - { return fTraceChordsDetails; } - - // tuplets - Bool getTraceTupletsBasics () const - { return fTraceTupletsBasics; } - - void setTraceTuplets () - { fTraceTuplets = true; } - Bool getTraceTuplets () const - { return fTraceTuplets; } - - Bool getTraceTupletsDetails () const - { return fTraceTupletsDetails; } - -// void setDisplayTuplets () -// { fDisplayTuplets = true; } -// Bool getDisplayTuplets () const -// { return fDisplayTuplets; } -// - - // inter-notes - // -------------------------------------- - - // ties - void setTraceTies () - { fTraceTies = true; } - Bool getTraceTies () const - { return fTraceTies; } - - // glissandos - // -------------------------------------- - - void setTraceGlissandos () - { fTraceGlissandos = true; } - Bool getTraceGlissandos () const - { return fTraceGlissandos; } - - // above staff - // -------------------------------------- - - // rehearsal marks - void setTraceRehearsalMarks () - { fTraceRehearsalMarks = true; } - Bool getTraceRehearsalMarks () const - { return fTraceRehearsalMarks; } - - // segnos - void setTraceSegnos () - { fTraceSegnos = true; } - Bool getTraceSegnos () const - { return fTraceSegnos; } - - // dal segnos - void setTraceDalSegnos () - { fTraceDalSegnos = true; } - Bool getTraceDalSegnos () const - { return fTraceDalSegnos; } - - // codas - void setTraceCodas () - { fTraceCodas = true; } - Bool getTraceCodas () const - { return fTraceCodas; } - - // eyeglases - void setTraceEyeGlasses () - { fTraceEyeGlasses = true; } - Bool getTraceEyeGlasses () const - { return fTraceEyeGlasses; } - - // harmonies - // -------------------------------------- - - void setTraceHarmonies () - { fTraceHarmonies = true; } - - Bool getTraceHarmonies () const - { return fTraceHarmonies; } - const S_oahBooleanAtom& - getTraceHarmoniesBooleanAtom () const - { return fTraceHarmoniesBooleanAtom; } - - Bool getTraceHarmoniesDetails () const - { return fTraceHarmoniesDetails; } - - void setTraceExtraHarmonies () - { fTraceExtraHarmonies = true; } - Bool getTraceExtraHarmonies () const - { return fTraceExtraHarmonies; } - - // figured bass elements - // -------------------------------------- - - void setTraceFiguredBasses () - { fTraceFiguredBasses = true; } - - Bool getTraceFiguredBasses () const - { return fTraceFiguredBasses; } - const S_oahBooleanAtom& - getTraceFiguredBassesBooleanAtom () const - { return fTraceFiguredBassesBooleanAtom; } - - void setTraceFiguredBassesDetails () - { fTraceFiguredBassesDetails = true; } - Bool getTraceFiguredBassesDetails () const - { return fTraceFiguredBassesDetails; } - - // instruments - // -------------------------------------- - - // instruments - void setTraceInstruments () - { fTraceInstruments = true; } - Bool getTraceInstruments () const - { return fTraceInstruments; } - - // frames - void setTraceFrames () - { fTraceFrames = true; } - Bool getTraceFrames () const - { return fTraceFrames; } - - // scordaturas - void setTraceScordaturas () - { fTraceScordaturas = true; } - Bool getTraceScordaturas () const - { return fTraceScordaturas; } - - // slides - void setTraceSlides () - { fTraceSlides = true; } - Bool getTraceSlides () const - { return fTraceSlides; } - // pedals - void setTracePedals () - { fTracePedals = true; } - Bool getTracePedals () const - { return fTracePedals; } - - // accordion registrations - void setTraceAccordionRegistrations () - { fTraceAccordionRegistrations = true; } - Bool getTraceAccordionRegistrations () const - { return fTraceAccordionRegistrations; } - - // harp pedals - void setTraceHarpPedals () - { fTraceHarpPedals = true; } - Bool getTraceHarpPedals () const - { return fTraceHarpPedals; } - - // harp pedals tuning - void setTraceHarpPedalsTunings () - { fTraceHarpPedalsTunings = true; } - Bool getTraceHarpPedalsTunings () const - { return fTraceHarpPedalsTunings; } - - // damps - void setTraceDamps () - { fTraceDamps = true; } - Bool getTraceDamps () const - { return fTraceDamps; } - - // dampalls - void setTraceDampAlls () - { fTraceDampAlls = true; } - Bool getTraceDampAlls () const - { return fTraceDampAlls; } - - // midi - void setTraceMidi () - { fTraceMidi = true; } - Bool getTraceMidi () const - { return fTraceMidi; } - -/* JMI - // msrStreams - // -------------------------------------- - Bool getTraceMsrStreams () const - { return fTraceMsrStreams; } - - // layout -*/ - - public: - - // public services - // ------------------------------------------------------ - - // quiet mode - void enforceGroupQuietness () override; - - // consistency check - void checkGroupOptionsConsistency () override; - - public: - - // visitors - // ------------------------------------------------------ - - void acceptIn (basevisitor* v) override; - void acceptOut (basevisitor* v) override; - - void browseData (basevisitor* v) override; - - public: - - // print - // ------------------------------------------------------ - - void printTraceOahHelp (); - - void displayTraceOahValues (int fieldWidth); - - virtual void displayAtomWithVariableOptionsValues ( - std::ostream& os, - int valueFieldWidth) const; - - private: - - // private services - // ------------------------------------------------------ - - private: - - // options and help trace - // -------------------------------------- - - S_oahPrefix fShortTracePrefix; - S_oahPrefix fLongTracePrefix; - -// S_oahPrefix fShortDisplayPrefix; -// S_oahPrefix fLongDisplayPrefix; - - Bool fTraceOah; - // unused, only for the help - // since this option is detected early - S_oahBooleanAtom fTraceOahBooleanAtom; - - Bool fTraceOahDetails; - - // other - // -------------------------------------- - - // passes -// Bool fTracePasses; - S_oahBooleanAtom fTracePassesBooleanAtom; - -// mfPassIDKind fTraceOnlyPassIDKind; - S_passIDOahAtom fTraceOnlyPassIDOahAtom; - - public: - - // scaling - Bool fTraceGeometry; - // identification - Bool fTraceIdentification; // specialize ??? JMI v0.9.66 - // for tests, hidden - Bool fTraceForTests; - - - // credits - // -------------------------------------- - - Bool fTraceCredits; - - - // scores to voices - // -------------------------------------- - - // books - // -------------------------------------- - - Bool fTraceBooks; - - - // scores - // -------------------------------------- - - Bool fTraceScores; - - - // part groups - // -------------------------------------- - - Bool fTracePartGroups; - Bool fTracePartGroupsDetails; - - - // parts - // -------------------------------------- - - Bool fTraceParts; - - - // staves - // -------------------------------------- - - Bool fTraceStavesBasics; - Bool fTraceStaves; - Bool fTraceStavesDetails; - - // MXSR events - // -------------------------------------- - - Bool fTraceMxsrEvents; - S_oahBooleanAtom fTraceMxsrEventsAtom; - - // staff changes - // -------------------------------------- - - Bool fTraceStaffChangesBasics; - Bool fTraceStaffChanges; - - - // voices - // -------------------------------------- - - Bool fTraceVoicesBasics; - Bool fTraceVoices; - Bool fTraceVoicesDetails; - - - // MusicXML print layouts - // -------------------------------------- - - Bool fTraceMusicXMLPrintLayouts; - - // segments - // -------------------------------------- - - Bool fTraceSegments; - Bool fTraceSegmentsDetails; - - // measures - // -------------------------------------- - - Bool fTraceMeasuresNumbers; - - Bool fTraceMeasuresBasics; - Bool fTraceMeasures; - Bool fTraceMeasuresDetails; - - S_oahStringAtom fTraceOnlyMeasurerNumbeOahAtom; - std::string fTraceOnlyMeasure; - - std::set fTraceDetailedMeasureNumbersSet; // JMI v0.9.67 - - - // positions - Bool fTraceMeasurePositions; - Bool fTraceMeasurePositionsDetails; - - Bool fTraceVoicePositions; - - // moments - Bool fTraceMeasureMoments; - Bool fTraceVoiceMoments; - - // voices flat view - // -------------------------------------- - - Bool fTraceVoicesFlatView; - Bool fTraceVoicesFlatViewDetails; - - // measures slices - // -------------------------------------- - - Bool fTraceMeasuresSlices; - Bool fTraceMeasuresSlicesDetails; - - - // clefs - // -------------------------------------- - - Bool fTraceClefs; - - - // keys - // -------------------------------------- - - Bool fTraceKeys; - Bool fTraceKeysDetails; - - - // time signatures - // -------------------------------------- - - Bool fTraceTimeSignatures; - - - // tempos - // -------------------------------------- - - Bool fTraceTempos; - - - // breaks - // -------------------------------------- - - Bool fTraceLineBreaks; - Bool fTracePageBreaks; - - - // bar lines - // -------------------------------------- - - Bool fTraceBarLines; - Bool fTraceBarLinesDetails; - - - // bar checks - // -------------------------------------- - - Bool fTraceBarChecks; - - - // bar number checks - // -------------------------------------- - - Bool fTraceBarNumberChecks; - - - // transpositions - // -------------------------------------- - - Bool fTraceTranspositions; - - // octave shifts - // -------------------------------------- - - Bool fTraceOctaveShifts; - - - // repeats - // -------------------------------------- - - Bool fTraceRepeatsBasics; - Bool fTraceRepeats; - Bool fTraceRepeatsDetails; - - - // measure repeats - // -------------------------------------- - - Bool fTraceMeasureRepeatsBasics; - Bool fTraceMeasureRepeats; - Bool fTraceMeasureRepeatsDetails; - - - // multi-measure rests - // -------------------------------------- - - Bool fTraceMultiMeasureRests; - Bool fTraceMultiMeasureRestsDetails; - - - // beats repeats - // -------------------------------------- - - Bool fTraceBeatRepeats; - - - // slashes - Bool fTraceSlashes; - - - // notes durations - // -------------------------------------- - - Bool fTraceNotesDurations; - - - // notes - // -------------------------------------- - - Bool fTraceNotesBasics; - Bool fTraceNotes; - Bool fTraceNotesDetails; - - - // whole notes durations - // -------------------------------------- - - Bool fTraceWholeNoteDurations; - Bool fTraceWholeNoteDurationsDetails; - - - // measures whole notes vectors - // -------------------------------------- - - Bool fTraceMeasuresWholeNotesVectors; - - - // rest and skip notes - // -------------------------------------- - - Bool fTraceRestNotes; - Bool fTraceSkipNotes; - - - // notes octave entry - // -------------------------------------- - Bool fTraceNotesOctaveEntry; - - - // grace notes - // -------------------------------------- - - Bool fTraceGraceNotesBasics; - Bool fTraceGraceNotes; - - - // tremolos - // -------------------------------------- - - Bool fTraceTremolos; - - - // stems - // -------------------------------------- - Bool fTraceStems; - - - // beams - // -------------------------------------- - Bool fTraceBeams; - - - // articulations - // -------------------------------------- - - Bool fTraceArticulations; - - - // technicals - // -------------------------------------- - - Bool fTraceTechnicals; - - - // ornaments - // -------------------------------------- - - Bool fTraceOrnaments; - Bool fTraceOrnamentsDetails; - - - // dynamics - // -------------------------------------- - - Bool fTraceDynamics; - - - // spanners - // -------------------------------------- - - Bool fTraceSpanners; - - - // cresc/decresc - // -------------------------------------- - - Bool fTraceCrescDecrescs; - - - // wedges - // -------------------------------------- - - Bool fTraceWedges; - - - // slurs - // -------------------------------------- - - Bool fTraceSlurs; - Bool fTraceSlursDetails; - - - // ligatures - // -------------------------------------- - - Bool fTraceLigatures; - - - // lyrics - // -------------------------------------- - - Bool fTraceLyrics; - Bool fTraceLyricsDetails; - - - // words - // -------------------------------------- - - Bool fTraceWords; - - - // chords - // -------------------------------------- - - Bool fTraceChordsBasics; - Bool fTraceChords; - Bool fTraceChordsDetails; - - - // tuplets - // -------------------------------------- - - Bool fTraceTupletsBasics; - Bool fTraceTuplets; - Bool fTraceTupletsDetails; - - - // ties - // -------------------------------------- - - Bool fTraceTies; - - - // glissandos - // -------------------------------------- - - Bool fTraceGlissandos; - - - // rehearsal marks - // -------------------------------------- - - Bool fTraceRehearsalMarks; - - - // segnos - // -------------------------------------- - - Bool fTraceSegnos; - - - // dal segnos - // -------------------------------------- - - Bool fTraceDalSegnos; - - - // codas - // -------------------------------------- - - Bool fTraceCodas; - - - // eyeglases - // -------------------------------------- - - Bool fTraceEyeGlasses; - - // harmonies - // -------------------------------------- - - Bool fTraceHarmonies; - S_oahBooleanAtom fTraceHarmoniesBooleanAtom; - - Bool fTraceHarmoniesDetails; - - Bool fTraceExtraHarmonies; - - // figured bass - // -------------------------------------- - - Bool fTraceFiguredBasses; - S_oahBooleanAtom fTraceFiguredBassesBooleanAtom; - - Bool fTraceFiguredBassesDetails; - - // instruments - // -------------------------------------- - - // instruments - Bool fTraceInstruments; - - - // frames - // -------------------------------------- - - Bool fTraceFrames; - - - // scordaturas - // -------------------------------------- - - Bool fTraceScordaturas; - - - // slides - // -------------------------------------- - - Bool fTraceSlides; - - - // pedals - // -------------------------------------- - - Bool fTracePedals; - - - // accordion registrations - // -------------------------------------- - - Bool fTraceAccordionRegistrations; - - - // harp pedals - // -------------------------------------- - - Bool fTraceHarpPedals; - Bool fTraceHarpPedalsTunings; - - - // damps - // -------------------------------------- - - Bool fTraceDamps; - Bool fTraceDampAlls; - - - // midi - // -------------------------------------- - - Bool fTraceMidi; - - -/* JMI - // msrStreams - // -------------------------------------- - Bool fTraceMsrStreams; - - // layout -*/ -}; -typedef SMARTP S_traceOahGroup; -EXP std::ostream& operator << (std::ostream& os, const S_traceOahGroup& elt); - -//______________________________________________________________________________ -// hidden global trace OAH group variable -EXP S_traceOahGroup getGlobalTraceOahGroup (); - -// a handy shortcut -#define gTraceOahGroup getGlobalTraceOahGroup () - -//______________________________________________________________________________ -EXP S_traceOahGroup createGlobalTraceOahGroup ( - const S_oahHandler& handler); - - -} - - -#endif // MF_TRACE_IS_ENABLED - - -#endif // ___mfTraceOah___ diff --git a/src/mflibrary/mfWrapperTypes.cpp b/src/mflibrary/mfWrapperTypes.cpp deleted file mode 100644 index 9f8c74d2..00000000 --- a/src/mflibrary/mfWrapperTypes.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#include -#include - -#include "mfWrapperTypes.h" - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -void testWrapperTypes () -{ - { - mfInputLineNumber inputLineNumber1 (157); - mfInputLineNumber inputLineNumber2 (200); - - mfInputLocationRange inputLocationRange1 (333, 333); - mfInputLocationRange inputLocationRange2 (110, 132); - - mfVoiceNumber voiceNumber (5); - - // inputLineNumber1 = staffNumber; - // voiceNumber = inputLineNumber2; - - inputLineNumber2 = inputLineNumber1; - - gLog << - "inputLineNumber1: " << inputLineNumber1 << - std::endl << - "inputLocationRange1: " << inputLocationRange1 << - std::endl << - "inputLocationRange2: " << inputLocationRange2 << - std::endl << - "voiceNumber: " << voiceNumber << - std::endl << - "inputLocationRange2.asString (): " << inputLocationRange2.asString () << - std::endl; - } - - gLog << "--------------" << std::endl; - - { - // start the clock - clock_t startClock = clock (); - - constexpr int iterationsNumber = 10000000; - int total = 0; - for (int i = 1; i < iterationsNumber; ++i ) { - total += i; - } // for - - clock_t endClock = clock (); - - // print the time spent - clock_t - timeSpentInClocks = - endClock - startClock; - - gLog << - "Total: " << total << std::endl << - "Time spent with integers: " << timeSpentInClocks << " clocks" << - std::endl; - } - - gLog << "--------------" << std::endl; - - { - // start the clock - clock_t startClock = clock (); - - constexpr int iterationsNumber = 10000000; - int total = 0; - for (int i = 1; i < iterationsNumber; ++i ) { - mfInputLineNumber inputLineNumber (i); - - total += inputLineNumber.getValue (); - } // for - - clock_t endClock = clock (); - - // print the time spent - clock_t - timeSpentInClocks = - endClock - startClock; - - gLog << - "Total: " << total << std::endl << - "Time spent with mfInputLineNumber's: " << timeSpentInClocks << " clocks" << - std::endl; - } -} - - -} diff --git a/src/mflibrary/mfWrapperTypes.h b/src/mflibrary/mfWrapperTypes.h deleted file mode 100644 index 78cc80db..00000000 --- a/src/mflibrary/mfWrapperTypes.h +++ /dev/null @@ -1,471 +0,0 @@ -/* - MusicFormats Library - Copyright (C) Jacques Menu 2016-2024 - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, you can obtain one at http://mozilla.org/MPL/2.0/. - - https://github.com/jacques-menu/musicformats -*/ - -#ifndef ___mfWrapperTypes___ -#define ___mfWrapperTypes___ - -#include -#include -#include - -#include "exports.h" - -#include "mfBool.h" -#include "mfConstants.h" -#include "msrNotesDurations.h" -#include "msrMoments.h" - - - -namespace MusicFormats -{ - -//______________________________________________________________________________ -template -class EXP mfValue -{ - public: - - // constructors/destructor - // ------------------------------------------------------ - - mfValue (T value); - - virtual ~mfValue (); - - public: - - // set and get - // ------------------------------------------------------ - - T getValue () const - { return fValue; } - - std::string getPrintPrefix () const - { return fPrintPrefix; } - - public: - - // operators - // ------------------------------------------------------ - - explicit operator T () const; - - Bool operator == ( - const mfValue & - otherValue) const; - - Bool operator != ( - const mfValue & - otherValue) const; - - // print - // ------------------------------------------------------ - - std::string asString () const; - - void print (std::ostream& os) const; - - private: - - // private fields - // ------------------------------------------------------ - - T fValue; - std::string fPrintPrefix; -}; - -template -EXP std::ostream& operator << ( - std::ostream& os, - const mfValue & - elt); - -template -mfValue ::mfValue (T value) - : fValue (value), - fPrintPrefix (printPrefix) -{} - -template -mfValue ::~mfValue () -{} - -template -mfValue ::operator T () const -{ - return fValue; -} - -template -Bool mfValue ::operator == ( - const mfValue& otherInputLineNumber) const -{ - return fValue == otherInputLineNumber.fValue; -} - -template -Bool mfValue ::operator != ( - const mfValue& otherInputLineNumber) const -{ - return fValue != otherInputLineNumber.fValue; -} - -template -std::string mfValue ::asString () const -{ - std::stringstream ss; - - ss << - fPrintPrefix << fValue; - - return ss.str (); -} - -template -void mfValue ::print (std::ostream& os) const -{ - os << asString (); -} - -template -EXP std::ostream& operator << ( - std::ostream& os, - const mfValue & elt) -{ - elt.print (os); - return os; -} - -//______________________________________________________________________________ -/* -A non-type template-parameter shall have one of the following (optionally cv-qualified) types: - integral or enumeration type, - pointer to object or pointer to function, - lvalue reference to object or lvalue reference to function, - pointer to member, - std::nullptr_t. - -template //pointer to object -void f() -{ - cout << *temp << endl; -} - -template //reference to object -void g() -{ - cout << temp << endl; - temp += "...appended some string"; -} - -std::string s; //must not be local as it must have external linkage! - -int main() { - s = "can assign values locally"; - f<&s>(); - g(); - cout << s << endl; - return 0; -} -*/ - -template -class mfValueWithNeutralValue -{ - public: - - // constructors/destructor - // ------------------------------------------------------ - - mfValueWithNeutralValue (); - - mfValueWithNeutralValue (T value); - - virtual ~mfValueWithNeutralValue (); - - public: - - // set and get - // ------------------------------------------------------ - - T getValue () const - { return fValue; } - - std::string getPrintPrefix () const - { return fPrintPrefix; } - - public: - - // operators - // ------------------------------------------------------ - - explicit operator T () const; - - Bool operator == ( - const mfValueWithNeutralValue & - otherValue) const; - - Bool operator != ( - const mfValueWithNeutralValue & - otherValue) const; - - // print - // ------------------------------------------------------ - - std::string asString () const; - - void print (std::ostream& os) const; - - private: - - // private fields - // ------------------------------------------------------ - - T fValue; - std::string fPrintPrefix; - - T fNeutralValue; - std::string fNeutralValueString; -}; - -template -EXP std::ostream& operator << ( - std::ostream& os, - const mfValueWithNeutralValue & elt); - -template -mfValueWithNeutralValue ::mfValueWithNeutralValue () - : fValue (neutralValue), - fPrintPrefix (printPrefix), - fNeutralValue (neutralValue), - fNeutralValueString (neutralValueString) -{} - -template -mfValueWithNeutralValue ::mfValueWithNeutralValue (T value) - : fValue (value), - fPrintPrefix (printPrefix), - fNeutralValue (neutralValue), - fNeutralValueString (neutralValueString) -{} - -template -mfValueWithNeutralValue ::~mfValueWithNeutralValue () -{} - -template -mfValueWithNeutralValue ::operator T () const -{ - return fValue; -} - -template -Bool mfValueWithNeutralValue ::operator == ( - const mfValueWithNeutralValue& otherInputLineNumber) const -{ - return fValue == otherInputLineNumber.fValue; -} - -template -Bool mfValueWithNeutralValue ::operator != ( - const mfValueWithNeutralValue& otherInputLineNumber) const -{ - return fValue != otherInputLineNumber.fValue; -} - -template -std::string mfValueWithNeutralValue ::asString () const -{ - std::stringstream ss; - - ss << - fPrintPrefix; - - if (fValue == fNeutralValue) { - ss << fNeutralValueString; - } - else { - ss << fValue; - } - - return ss.str (); -} - -template -void mfValueWithNeutralValue ::print (std::ostream& os) const -{ - os << asString (); -} - -template -EXP std::ostream& operator << ( - std::ostream& os, - const mfValueWithNeutralValue & elt) -{ - elt.print (os); - return os; -} - -//______________________________________________________________________________ -template -class mfRange -{ - public: - - // constructors/destructor - // ------------------------------------------------------ - - mfRange ( - T rangeStart, - T rangeEnd); - - virtual ~mfRange (); - - public: - - // set and get - // ------------------------------------------------------ - - T getRangeStart () const - { return fRangeStart; } - - T getRangeEnd () const - { return fRangeStart; } - - std::string getPprintSeparator () const - { return fPprintSeparator; } - - public: - - // print - // ------------------------------------------------------ - - std::string asString () const; - - void print (std::ostream& os) const; - - private: - - // private fields - // ------------------------------------------------------ - - T fRangeStart; - T fRangeEnd; - - std::string fPprintSeparator; -}; - -template -EXP std::ostream& operator << ( - std::ostream& os, - const mfRange & elt); - - -template -mfRange ::mfRange ( - T rangeStart, - T rangeEnd) - : fRangeStart (rangeStart), - fRangeEnd (rangeEnd), - fPprintSeparator (printSeparator) -{} - -template -mfRange ::~mfRange () -{} - -template -std::string mfRange ::asString () const -{ - std::stringstream ss; - - if (fRangeStart == fRangeEnd) { - ss << - fRangeStart; - } - else { - ss << - fRangeStart << fPprintSeparator << fRangeEnd; - } - - return ss.str (); -} - -template -void mfRange ::print (std::ostream& os) const -{ - os << asString (); -} - -template -EXP std::ostream& operator << ( - std::ostream& os, - const mfRange & elt) -{ - elt.print (os); - return os; -} - -//______________________________________________________________________________ -// input line numbers -typedef mfValueWithNeutralValue - - mfInputLineNumber; - -//______________________________________________________________________________ -// input locations -typedef mfRange - - mfInputLocationRange; - -//______________________________________________________________________________ -// staff numbers -typedef mfValueWithNeutralValue - - mfStaffNumber; - -//______________________________________________________________________________ -// voice numbers -typedef mfValueWithNeutralValue - - mfVoiceNumber; - -//______________________________________________________________________________ -// measure numbers -typedef mfValueWithNeutralValue - - mfMeasureNumber; - -//______________________________________________________________________________ -// whole notes durations -typedef mfValueWithNeutralValue - - mfWohleNotes; - -//______________________________________________________________________________ -// moments -typedef mfValueWithNeutralValue - - mfMoment; - -//______________________________________________________________________________ -// lyrics -typedef mfValueWithNeutralValue - - mfStanzaNumber; - -//______________________________________________________________________________ -void testWrapperTypes (); - -} - -#endif // ___mfWrapperTypes___ diff --git a/src/oah/oahAtomsCollection.cpp b/src/oah/oahAtomsCollection.cpp index ebac2c59..3a972b1b 100644 --- a/src/oah/oahAtomsCollection.cpp +++ b/src/oah/oahAtomsCollection.cpp @@ -25,6 +25,7 @@ #include "oahOah.h" #include "oahWae.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "oahAtomsCollection.h" diff --git a/src/oah/oahBasicTypes.cpp b/src/oah/oahBasicTypes.cpp index cee72e39..23e386b3 100644 --- a/src/oah/oahBasicTypes.cpp +++ b/src/oah/oahBasicTypes.cpp @@ -27,6 +27,8 @@ #include "mfTraceOah.h" #include "oahOah.h" + +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "waeOah.h" diff --git a/src/mflibrary/mfTest.cpp b/src/oah/oahConstants.h similarity index 57% rename from src/mflibrary/mfTest.cpp rename to src/oah/oahConstants.h index c66d5c09..6c8b4bbc 100644 --- a/src/mflibrary/mfTest.cpp +++ b/src/oah/oahConstants.h @@ -9,35 +9,30 @@ https://github.com/jacques-menu/musicformats */ -#include "mfTest.h" -#include "mfIndentedTextOutput.h" -#include "mfWrapperTypes.h" +#ifndef ___oahConstants___ +#define ___oahConstants___ -/* - place any include you need here... -*/ +#include +#include "exports.h" -#include "stringMatcherInterface.h" +#include "msrMoments.h" +#include "msrNotesDurations.h" namespace MusicFormats { //______________________________________________________________________________ -void mfTest (std::ostream& os) -{ -/* - place any code you need here... -*/ - - testStringMatcher (os); +// OAH layout settings - gLog << "--------------" << std::endl; +constexpr int K_OAH_ELEMENTS_INDENTER_OFFSET = 3; + // indent a bit more for readability - testWrapperTypes (); -} +constexpr int K_OAH_FIELD_WIDTH = 40; } + +#endif // ___oahConstants___ diff --git a/src/oah/oahElements.cpp b/src/oah/oahElements.cpp index 3147df5a..0d29d4c8 100644 --- a/src/oah/oahElements.cpp +++ b/src/oah/oahElements.cpp @@ -13,12 +13,12 @@ #include "visitor.h" -#include "mfConstants.h" #include "mfPreprocessorSettings.h" #include "mfStringsHandling.h" #include "oahOah.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "oahElements.h" diff --git a/src/oah/oahHarmoniesExtraOah.cpp b/src/oah/oahHarmoniesExtraOah.cpp index 4463b4b2..b11f4f65 100644 --- a/src/oah/oahHarmoniesExtraOah.cpp +++ b/src/oah/oahHarmoniesExtraOah.cpp @@ -16,8 +16,6 @@ #include "visitor.h" -#include "mfConstants.h" - #include "oahWae.h" #include "oahOah.h" @@ -26,6 +24,7 @@ #include "lpsrOah.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "waeHandlers.h" diff --git a/src/oah/oahOah.cpp b/src/oah/oahOah.cpp index 061c5bbc..54b753f2 100644 --- a/src/oah/oahOah.cpp +++ b/src/oah/oahOah.cpp @@ -14,10 +14,10 @@ #include "visitor.h" -#include "mfPreprocessorSettings.h" - #include "mfConstants.h" +#include "mfPreprocessorSettings.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "oahOah.h" diff --git a/src/passes/lpsr2lilypond/lpsr2lilypondOah.cpp b/src/passes/lpsr2lilypond/lpsr2lilypondOah.cpp index 8e82c196..7c9bcb19 100644 --- a/src/passes/lpsr2lilypond/lpsr2lilypondOah.cpp +++ b/src/passes/lpsr2lilypond/lpsr2lilypondOah.cpp @@ -17,9 +17,8 @@ #include "visitor.h" #include "oahWae.h" -#include "mfPreprocessorSettings.h" - #include "mfConstants.h" +#include "mfPreprocessorSettings.h" #include "mfStringsHandling.h" #include "msrPitchesNames.h" @@ -33,6 +32,7 @@ #include "lpsrOah.h" #include "lpsr2lilypondOah.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "waeHandlers.h" diff --git a/src/passes/msr2lpsr/msr2lpsrOah.cpp b/src/passes/msr2lpsr/msr2lpsrOah.cpp index b1af1606..32ed34ee 100644 --- a/src/passes/msr2lpsr/msr2lpsrOah.cpp +++ b/src/passes/msr2lpsr/msr2lpsrOah.cpp @@ -15,18 +15,17 @@ #include "visitor.h" -#include "mfPreprocessorSettings.h" - #include "mfConstants.h" +#include "mfPreprocessorSettings.h" #include "mfStringsHandling.h" #include "oahOah.h" #include "oahWae.h" - #include "msrOah.h" #include "msr2lpsrOah.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "waeHandlers.h" diff --git a/src/passes/msr2msr/msr2msrOah.cpp b/src/passes/msr2msr/msr2msrOah.cpp index fb729cb5..eeb4fe37 100644 --- a/src/passes/msr2msr/msr2msrOah.cpp +++ b/src/passes/msr2msr/msr2msrOah.cpp @@ -16,7 +16,6 @@ #include "visitor.h" #include "oahWae.h" -#include "mfConstants.h" #include "mfPreprocessorSettings.h" #include "mfStringsHandling.h" @@ -25,6 +24,7 @@ #include "msrOah.h" #include "msr2msrOah.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "waeHandlers.h" diff --git a/src/passes/mxsr2msr/mxsr2msrOah.cpp b/src/passes/mxsr2msr/mxsr2msrOah.cpp index a40ca64e..2daba6e7 100644 --- a/src/passes/mxsr2msr/mxsr2msrOah.cpp +++ b/src/passes/mxsr2msr/mxsr2msrOah.cpp @@ -17,14 +17,14 @@ #include "oahWae.h" -#include "mfPreprocessorSettings.h" - #include "mfConstants.h" +#include "mfPreprocessorSettings.h" #include "mfStringsHandling.h" #include "oahOah.h" #include "mxsr2msrOah.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "waeHandlers.h" @@ -525,6 +525,10 @@ void mxsr2msrOahGroup::createTheMxsr2msrPrefixes ( void mxsr2msrOahGroup::initializeMxsr2msrOahGroup () { + // display + // -------------------------------------- + initializeMxsr2msrDisplayOptions (); + #ifdef MF_TRACE_IS_ENABLED // trace // -------------------------------------- @@ -576,6 +580,35 @@ void mxsr2msrOahGroup::initializeMxsr2msrOahGroup () initializeMxsr2msrCombinedOptionsOptions (); } + +void mxsr2msrOahGroup::initializeMxsr2msrDisplayOptions () +{ + S_oahSubGroup + subGroup = + oahSubGroup::create ( + "mxsr2msr Trace", + "help-mxsr-to-oah-trace", "hmxsr2ot", +R"()", + oahElementVisibilityKind::kElementVisibilityWhole, + this); + + appendSubGroupToGroup (subGroup); + + // display MusicXML tree + + fDisplayMxsrAtom = + oahBooleanAtom::create ( + "display-mxsr", "dmxsr", +R"(Write the contents of the MXSR data to standard error.)", + "fDisplayMxsr", + fDisplayMxsr); + + subGroup-> + appendAtomToSubGroup ( + fDisplayMxsrAtom); +} + +#ifdef MF_TRACE_IS_ENABLED void mxsr2msrOahGroup::initializeMxsr2msrTraceOptions () { S_oahSubGroup @@ -589,6 +622,21 @@ R"()", appendSubGroupToGroup (subGroup); + // display MusicXML tree with passes information + + subGroup-> + appendAtomToSubGroup ( + oahTwoBooleansAtom::create ( + "display-mxsr-and-passes", "dmxsrap", +R"(Write the contents of the MXSR data to standard error. +This option implies '-display-mxsr, -dmxsr' +and '-trace-passes, -tpasses'.')", + "fDisplayMxsr", + fDisplayMxsr, + gTraceOahGroup->getTracePassesBooleanAtom ())); + +// fDisplayMxsrAtom); + // the 'MusicXML' multiplex booleans atom S_oahCommonPrefixBooleansAtom @@ -677,17 +725,6 @@ R"(Write a trace of the MusicXML tree activity to standard error.)", "fTraceMxsr", fTraceMxsr)); - // display MusicXML tree - - subGroup-> - appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( - "display-mxsr", "dmxsr", -R"(Write the contents of the MXSR data to standard error.)", - "fDisplayMxsr", - fDisplayMxsr, - gTraceOahGroup->getTracePassesBooleanAtom ())); - // MusicXML tree visiting subGroup-> @@ -698,6 +735,7 @@ R"(Write a trace of the MusicXML tree visiting activity to standard error.)", "fTraceMxsrVisitors", fTraceMxsrVisitors)); } +#endif // MF_TRACE_IS_ENABLED void mxsr2msrOahGroup::initializeMxsr2msrEventsOptions () { diff --git a/src/passes/mxsr2msr/mxsr2msrOah.h b/src/passes/mxsr2msr/mxsr2msrOah.h index 8dd52557..d4bb4bf4 100644 --- a/src/passes/mxsr2msr/mxsr2msrOah.h +++ b/src/passes/mxsr2msr/mxsr2msrOah.h @@ -317,7 +317,8 @@ class EXP mxsr2msrOahGroup : public oahGroup getBoldWordsAtom () const { return fBoldWordsAtom; } - const std::set & getItalicWordsSet () const + const std::set & + getItalicWordsSet () const { return fItalicWordsSet; } S_oahStringSetElementAtom getItalicWordsAtom () const @@ -402,7 +403,7 @@ class EXP mxsr2msrOahGroup : public oahGroup getWordsToDecrescAtom () const { return fWordsToDecrescAtom; } -// ties + // ties // -------------------------------------- Bool getIgnoreTies () const @@ -487,7 +488,7 @@ class EXP mxsr2msrOahGroup : public oahGroup Bool getTraceForward () const { return fTraceForward; } - // specific trace JMI move to traceOah + // display // -------------------------------------- void setDisplayMxsr () @@ -495,6 +496,12 @@ class EXP mxsr2msrOahGroup : public oahGroup Bool getDisplayMxsr () const { return fDisplayMxsr; } + S_oahBooleanAtom getDisplayMxsrAtom () const + { return fDisplayMxsrAtom; } + + // specific trace JMI move to traceOah + // -------------------------------------- + void setTraceMxsr () { fTraceMxsr = true; } Bool getTraceMxsr () const @@ -558,6 +565,8 @@ class EXP mxsr2msrOahGroup : public oahGroup // private services // ------------------------------------------------------ + void initializeMxsr2msrDisplayOptions (); + #ifdef MF_TRACE_IS_ENABLED void initializeMxsr2msrTraceOptions (); #endif // MF_TRACE_IS_ENABLED @@ -612,7 +621,7 @@ class EXP mxsr2msrOahGroup : public oahGroup // private fields // ------------------------------------------------------ - // use MXSR events (temporary from v0.9.72) + // use MXSR events // -------------------------------------- Bool fUseMxsrEvents; @@ -860,6 +869,11 @@ class EXP mxsr2msrOahGroup : public oahGroup Bool fCubase; + // display MXSR + // -------------------------------------- + + Bool fDisplayMxsr; + S_oahBooleanAtom fDisplayMxsrAtom; #ifdef MF_TRACE_IS_ENABLED // specific trace @@ -877,8 +891,6 @@ class EXP mxsr2msrOahGroup : public oahGroup // specific trace JMI move to traceOah JMI ??? v0.9.70 // -------------------------------------- - Bool fDisplayMxsr; - Bool fTraceMxsr; // visitors diff --git a/src/passes/mxsr2msr/mxsr2msrSkeletonBuilder.cpp b/src/passes/mxsr2msr/mxsr2msrSkeletonBuilder.cpp index 2849c8a6..8cf1d6e3 100644 --- a/src/passes/mxsr2msr/mxsr2msrSkeletonBuilder.cpp +++ b/src/passes/mxsr2msr/mxsr2msrSkeletonBuilder.cpp @@ -1224,36 +1224,9 @@ void mxsr2msrSkeletonBuilder::createTheImplicitOuterPartGroupAndAddItToTheMsrSco } //______________________________________________________________________________ -void mxsr2msrSkeletonBuilder::handleBOFPartGroupsNestingBOFAndScorePartsAllocation ( - int inputLineNumber) +void mxsr2msrSkeletonBuilder::sortfStartedPartGroupsListsVector ( + int inputLineNumber) { -#ifdef MF_TRACE_IS_ENABLED - if (gTraceOahGroup->getTracePartGroups ()) { - std::stringstream ss; - - ss << - "handleBOFPartGroupsNestingBOFAndScorePartsAllocation:"; - - gWaeHandler->waeTrace ( - __FILE__, __LINE__, - ss.str ()); - } -#endif // MF_TRACE_IS_ENABLED - - // this is actually a partial sub-pass of pass 2a, - // since we run a second time through the contents of , - // stored in the data structures we've built - -#ifdef MF_TRACE_IS_ENABLED - if (gTraceOahGroup->getTracePartGroups ()) { - displayAllCollectedData ( - inputLineNumber, - "BEFORE handleBOFPartGroupsNestingBOFAndScorePartsAllocation"); - } -#endif // MF_TRACE_IS_ENABLED - - // sort the contents offStartedPartGroupsListsVector - // in decreasing identityorder for ( S_mxsrPartGroupsList thePartGroupList : fStartedPartGroupsListsVector @@ -1269,7 +1242,7 @@ void mxsr2msrSkeletonBuilder::handleBOFPartGroupsNestingBOFAndScorePartsAllocati ", line " << inputLineNumber ; thePartGroupList->printWithContext ( - "handleBOFPartGroupsNestingBOFAndScorePartsAllocation()", + "sortfStartedPartGroupsListsVector()", '>', ss); @@ -1281,9 +1254,11 @@ void mxsr2msrSkeletonBuilder::handleBOFPartGroupsNestingBOFAndScorePartsAllocati thePartGroupList->sortByDecreasingIdentity(); } // for +} - // sort the contents of fStoppedPartGroupsListsVector - // in decreasing identity order +void mxsr2msrSkeletonBuilder::sortStoppedPartGroupsListsVector ( + int inputLineNumber) +{ for (S_mxsrPartGroupsList thePartGroupList : fStoppedPartGroupsListsVector) { // sort thePartGroupList in decreasing identit yorder #ifdef MF_TRACE_IS_ENABLED @@ -1297,7 +1272,7 @@ void mxsr2msrSkeletonBuilder::handleBOFPartGroupsNestingBOFAndScorePartsAllocati ++gIndenter; thePartGroupList->printWithContext ( - "handleBOFPartGroupsNestingBOFAndScorePartsAllocation()", + "sortStoppedPartGroupsListsVector()", '>', ss); --gIndenter; @@ -1310,140 +1285,143 @@ void mxsr2msrSkeletonBuilder::handleBOFPartGroupsNestingBOFAndScorePartsAllocati thePartGroupList->sortByDecreasingIdentity(); } // for +} -#ifdef MF_TRACE_IS_ENABLED - if (gTraceOahGroup->getTracePartGroups ()) { - displayAllCollectedData ( - inputLineNumber, - "AFTER sorting started and stopped MSXR part groups lists"); - } -#endif // MF_TRACE_IS_ENABLED - - // handle each identityin turn in increasing order - for (int identity= 0; identity<= fCurrentPartGroupIdentity; ++identity) { - -// if (identity> 0) { -// // parts actual identitys start at 1 - // append part to current part group, i.e. to the top of the stack - S_msrPart - part = - fPartsVector [identity]; - - // fetch the part group stack top - if (fPartGroupsStack.size () == 0) { - std::stringstream ss; - - ss << - "Cannot append part " << - part->fetchPartCombinedName () << - " to any part group " << - " at identity" << identity<< - ", since the part groups groups stack is empty"<< - ", line " << inputLineNumber; +void mxsr2msrSkeletonBuilder::handlePartGroupsStartAtIdentity ( + int inputLineNumber, + int identity) +{ + if (fStartedPartGroupsListsVector.size ()) { + S_mxsrPartGroupsList + startedMxsrPartGroupsList = + fStartedPartGroupsListsVector [identity]; - musicxmlError ( - gServiceRunData->getInputSourceName (), - inputLineNumber, - __FILE__, __LINE__, - ss.str ()); - } + if (startedMxsrPartGroupsList->size ()) { + ++gIndenter; - // append part to current part group - S_msrPartGroup - currentPartGroup = - fPartGroupsStack.top ()-> - getMsrPartGroup (); + const std::list & + startedPartGroupsStdList = + startedMxsrPartGroupsList->getMxsrPartGroupsStdList (); - currentPartGroup-> - appendPartToPartGroup ( - part); -// } + for (S_mxsrPartGroup partGroup : startedPartGroupsStdList) { + S_msrPartGroup + theMsrPartGroup = + partGroup->getMsrPartGroup (); - // handle the part groups groups stopped at identityidentity - if (fStoppedPartGroupsListsVector.size ()) { - S_mxsrPartGroupsList - stoppedPartGroupsList = - fStoppedPartGroupsListsVector [identity]; + // make it the new current part group +#ifdef MF_TRACE_IS_ENABLED + if (gTraceOahGroup->getTracePartGroups ()) { + std::stringstream ss; - if (stoppedPartGroupsList->size ()) { - ++gIndenter; + ss << + "Pushing part group " << + partGroup->asString () << + " onto the part groups stack" << + ", line " << inputLineNumber; - const std::list & - stoppedPartGroupsStdList = - stoppedPartGroupsList->getMxsrPartGroupsStdList (); + gWaeHandler->waeTrace ( + __FILE__, __LINE__, + ss.str ()); + } +#endif // MF_TRACE_IS_ENABLED - for (S_mxsrPartGroup partGroup : stoppedPartGroupsStdList) { - int stopInputLineNumber = - partGroup->getStopInputLineNumber (); + fPartGroupsStack.push ( + partGroup); + } // for - S_msrPartGroup - theMsrPartGroup = - partGroup->getMsrPartGroup (); + --gIndenter; + } + } +} - // fetch the part group stack top - if (fPartGroupsStack.size () == 0) { - std::stringstream ss; +void mxsr2msrSkeletonBuilder::handleThePartGroupsStoppedAtIdentity ( + int inputLineNumber, + int identity) +{ + if (fStoppedPartGroupsListsVector.size ()) { + S_mxsrPartGroupsList + stoppedPartGroupsList = + fStoppedPartGroupsListsVector [identity]; - ss << - "Cannot 'stop' part group " << - partGroup->fetchMsrPartGroupCombinedName () << - " at identity" << identity<< - ", since the stack is empty"<< - ", line " << inputLineNumber; + if (stoppedPartGroupsList->size ()) { + ++gIndenter; - musicxmlError ( - gServiceRunData->getInputSourceName (), - stopInputLineNumber, - __FILE__, __LINE__, - ss.str ()); - } + const std::list & + stoppedPartGroupsStdList = + stoppedPartGroupsList->getMxsrPartGroupsStdList (); + + for (S_mxsrPartGroup partGroup : stoppedPartGroupsStdList) { + int stopInputLineNumber = + partGroup->getStopInputLineNumber (); + + S_msrPartGroup + theMsrPartGroup = + partGroup->getMsrPartGroup (); + + // fetch the part group stack top + if (fPartGroupsStack.size () == 0) { + std::stringstream ss; + + ss << + "Cannot 'stop' part group " << + partGroup->fetchMsrPartGroupCombinedName () << + " at identity" << identity<< + ", since the stack is empty"<< + ", line " << inputLineNumber; + + musicxmlError ( + gServiceRunData->getInputSourceName (), + stopInputLineNumber, + __FILE__, __LINE__, + ss.str ()); + } - if (fPartGroupsStack.top () == partGroup) { - // pop partGroupToBeStopped from the stack + if (fPartGroupsStack.top () == partGroup) { + // pop partGroupToBeStopped from the stack #ifdef MF_TRACE_IS_ENABLED - if (gTraceOahGroup->getTracePartGroups ()) { - std::stringstream ss; + if (gTraceOahGroup->getTracePartGroups ()) { + std::stringstream ss; - ss << - "Popping part group " << - partGroup-> - fetchMsrPartGroupCombinedName () << - " from the stack" << - ", line " << stopInputLineNumber; + ss << + "Popping part group " << + partGroup-> + fetchMsrPartGroupCombinedName () << + " from the stack" << + ", line " << stopInputLineNumber; - gWaeHandler->waeTrace ( - __FILE__, __LINE__, - ss.str ()); - } + gWaeHandler->waeTrace ( + __FILE__, __LINE__, + ss.str ()); + } #endif // MF_TRACE_IS_ENABLED - fPartGroupsStack.pop (); + fPartGroupsStack.pop (); - // the implicit outer-most part group isn't contained in any other - if (partGroup != fImplicitOuterMostPartGroup) { - // fetch new current part group JMI v0.9.69 - if (fPartGroupsStack.size () == 0) { + // the implicit outer-most part group isn't contained in any other + if (partGroup != fImplicitOuterMostPartGroup) { + // fetch new current part group JMI v0.9.69 + if (fPartGroupsStack.size () == 0) { #ifdef MF_TRACE_IS_ENABLED - if (gTraceOahGroup->getTracePartGroups ()) { - displayAllCollectedData ( - inputLineNumber, - "the implicit outer-most part group isn't contained in any other"); - } + if (gTraceOahGroup->getTracePartGroups ()) { + displayAllCollectedData ( + inputLineNumber, + "the implicit outer-most part group isn't contained in any other"); + } #endif // MF_TRACE_IS_ENABLED - std::stringstream ss; + std::stringstream ss; - ss << - "there is no part group in the stack to contain part group " << - partGroup->asString () << - fCurrentPartID << "\"" ; + ss << + "there is no part group in the stack to contain part group " << + partGroup->asString () << + fCurrentPartID << "\"" ; - mxsr2msrInternalError ( - gServiceRunData->getInputSourceName (), - stopInputLineNumber, - __FILE__, __LINE__, - ss.str ()); - } + mxsr2msrInternalError ( + gServiceRunData->getInputSourceName (), + stopInputLineNumber, + __FILE__, __LINE__, + ss.str ()); + } // S_mxsrPartGroup // newMxsrPartGroupStackTop = @@ -1455,142 +1433,108 @@ void mxsr2msrSkeletonBuilder::handleBOFPartGroupsNestingBOFAndScorePartsAllocati // stopInputLineNumber, // partGroup, // newMxsrPartGroupStackTop); - } - } + } + } - else { + else { #ifdef MF_TRACE_IS_ENABLED - if (gTraceOahGroup->getTracePartGroups ()) { - displayAllCollectedData ( - stopInputLineNumber, - "UPON overlapping part groups"); - } + if (gTraceOahGroup->getTracePartGroups ()) { + displayAllCollectedData ( + stopInputLineNumber, + "UPON overlapping part groups"); + } #endif // MF_TRACE_IS_ENABLED - std::stringstream ss; + std::stringstream ss; - ss << - std::endl << - "There are overlapping part groups, namely: " << - std::endl << - gTab << partGroup->asString () << - std::endl << - "and" << - std::endl << - gTab << fPartGroupsStack.top ()->asString () << - std::endl; + ss << + std::endl << + "There are overlapping part groups, namely: " << + std::endl << + gTab << partGroup->asString () << + std::endl << + "and" << + std::endl << + gTab << fPartGroupsStack.top ()->asString () << + std::endl; /* JMI - // fetch the identitys in the intersection - int - startOne = - partGroup->getPartGroupIdentity (), - startTwo = - fPartGroupsStack.front ()->getPartGroupIdentity (), - stopOne = - partGroup->getStopIdentity(), - stopTwo = - fPartGroupsStack.front ()->getStopIdentity(); - - int firstCommonPosision = startOne; - if (startTwo > startOne) { - firstCommonPosision = startTwo; - } - - int lastCommonPosision = stopOne; - if (stopTwo < stopOne) { - lastCommonPosision = stopTwo; - } - - ss << - std::endl << - "The parts they share are:" << - std::endl; - - ss << - "(identitys range is " << - firstCommonPosision << ".." << lastCommonPosision << - ")" << - std::endl; - - for (int m = firstCommonPosision; m <= lastCommonPosision; ++m) { - S_msrPart - part = - fPartsVector [m]; - - ss << - gTab << - part->fetchPartCombinedName () << - ", line " << part->getInputStartLineNumber () << - std::endl; - } // for + // fetch the identitys in the intersection + int + startOne = + partGroup->getPartGroupIdentity (), + startTwo = + fPartGroupsStack.front ()->getPartGroupIdentity (), + stopOne = + partGroup->getStopIdentity(), + stopTwo = + fPartGroupsStack.front ()->getStopIdentity(); + + int firstCommonPosision = startOne; + if (startTwo > startOne) { + firstCommonPosision = startTwo; + } + + int lastCommonPosision = stopOne; + if (stopTwo < stopOne) { + lastCommonPosision = stopTwo; + } + + ss << + std::endl << + "The parts they share are:" << + std::endl; + + ss << + "(identitys range is " << + firstCommonPosision << ".." << lastCommonPosision << + ")" << + std::endl; + + for (int m = firstCommonPosision; m <= lastCommonPosision; ++m) { + S_msrPart + part = + fPartsVector [m]; + + ss << + gTab << + part->fetchPartCombinedName () << + ", line " << part->getInputStartLineNumber () << + std::endl; + } // for */ - ss << - std::endl << - regex_replace ( +#ifdef MF_TRACE_IS_ENABLED + if (gTraceOahGroup->getTracePartGroups ()) { + ss << + std::endl << + regex_replace ( R"(Please contact the maintainers of MusicFormats (see option '-c, -contact'): - either you found a bug in the EXECUTABLE translator, - or this MusicXML data is the first-ever real-world case - of a score exhibiting overlapping part groups)", - std::regex ("EXECUTABLE"), - gOahOahGroup->getOahOahGroupServiceName ()) << +either you found a bug in the EXECUTABLE translator, +or this MusicXML data is the first-ever real-world case +of a score exhibiting overlapping part groups)", + std::regex ("EXECUTABLE"), + gOahOahGroup->getOahOahGroupServiceName ()) << ", line " << inputLineNumber; - musicxmlError ( - gServiceRunData->getInputSourceName (), - stopInputLineNumber, - __FILE__, __LINE__, - ss.str ()); - } - } // for - - --gIndenter; - } - } - - // handle the part groups started at identityidentity // JMI v0.9.69 - if (fStartedPartGroupsListsVector.size ()) { - S_mxsrPartGroupsList - startedMxsrPartGroupsList = - fStartedPartGroupsListsVector [identity]; - - if (startedMxsrPartGroupsList->size ()) { - ++gIndenter; - - const std::list & - startedPartGroupsStdList = - startedMxsrPartGroupsList->getMxsrPartGroupsStdList (); - - for (S_mxsrPartGroup partGroup : startedPartGroupsStdList) { - S_msrPartGroup - theMsrPartGroup = - partGroup->getMsrPartGroup (); - - // make it the new current part group -#ifdef MF_TRACE_IS_ENABLED - if (gTraceOahGroup->getTracePartGroups ()) { - std::stringstream ss; - - ss << - "Pushing part group " << - partGroup->asString () << - " onto the part groups stack" << - ", line " << inputLineNumber; - - gWaeHandler->waeTrace ( - __FILE__, __LINE__, - ss.str ()); - } + musicxmlError ( + gServiceRunData->getInputSourceName (), + stopInputLineNumber, + __FILE__, __LINE__, + ss.str ()); + } #endif // MF_TRACE_IS_ENABLED + } + } // for - fPartGroupsStack.push ( - partGroup); - } // for + --gIndenter; + } + } - --gIndenter; - } - } + // handle the part groups started at identity // JMI v0.9.69 + handlePartGroupsStartAtIdentity ( + inputLineNumber, + identity); // #ifdef MF_TRACE_IS_ENABLED // if (gTraceOahGroup->getTracePartGroups ()) { @@ -1604,7 +1548,99 @@ R"(Please contact the maintainers of MusicFormats (see option '-c, -contact'): // ss.str ()); // } // #endif // MF_TRACE_IS_ENABLED - } // for +} + +//______________________________________________________________________________ +void mxsr2msrSkeletonBuilder::handleBOFPartGroupsNestingBOFAndScorePartsAllocation ( + int inputLineNumber) +{ +#ifdef MF_TRACE_IS_ENABLED + if (gTraceOahGroup->getTracePartGroups ()) { + std::stringstream ss; + + ss << + "handleBOFPartGroupsNestingBOFAndScorePartsAllocation:"; + + gWaeHandler->waeTrace ( + __FILE__, __LINE__, + ss.str ()); + } +#endif // MF_TRACE_IS_ENABLED + + // this is actually a partial sub-pass of pass 2a, + // since we run a second time through the contents of , + // stored in the data structures we've built + +#ifdef MF_TRACE_IS_ENABLED + if (gTraceOahGroup->getTracePartGroups ()) { + displayAllCollectedData ( + inputLineNumber, + "BEFORE handleBOFPartGroupsNestingBOFAndScorePartsAllocation"); + } +#endif // MF_TRACE_IS_ENABLED + + // sort the contents of fStartedPartGroupsListsVector + // in decreasing identityorder + sortfStartedPartGroupsListsVector ( + inputLineNumber); + + // sort the contents of fStoppedPartGroupsListsVector + // in decreasing identity order + sortStoppedPartGroupsListsVector ( + inputLineNumber); + +#ifdef MF_TRACE_IS_ENABLED + if (gTraceOahGroup->getTracePartGroups ()) { + displayAllCollectedData ( + inputLineNumber, + "AFTER sorting started and stopped MSXR part groups lists"); + } +#endif // MF_TRACE_IS_ENABLED + + // handle each identity in turn in increasing order + for (int identity= 0; identity<= fCurrentPartGroupIdentity; ++identity) { +// if (identity> 0) { JMI v0.9.72 +// // parts actual identitys start at 1 + // append part to current part group, i.e. to the top of the stack + S_msrPart + part = + fPartsVector [identity]; + + // fetch the part group stack top + if (fPartGroupsStack.size () == 0) { + std::stringstream ss; + + ss << + "Cannot append part " << + part->fetchPartCombinedName () << + " to any part group " << + " at identity" << identity<< + ", since the part groups groups stack is empty"<< + ", line " << inputLineNumber; + + musicxmlError ( + gServiceRunData->getInputSourceName (), + inputLineNumber, + __FILE__, __LINE__, + ss.str ()); + } + + // append part to current part group + S_msrPartGroup + currentPartGroup = + fPartGroupsStack.top ()-> + getMsrPartGroup (); + + currentPartGroup-> + appendPartToPartGroup ( + part); +// } + + // handle the part groups groups stopped at identity + handleThePartGroupsStoppedAtIdentity ( + inputLineNumber, + identity); + } #ifdef MF_TRACE_IS_ENABLED if (gTraceOahGroup->getTracePartGroups ()) { diff --git a/src/passes/mxsr2msr/mxsr2msrSkeletonBuilder.h b/src/passes/mxsr2msr/mxsr2msrSkeletonBuilder.h index ab1aedab..a91a061e 100644 --- a/src/passes/mxsr2msr/mxsr2msrSkeletonBuilder.h +++ b/src/passes/mxsr2msr/mxsr2msrSkeletonBuilder.h @@ -508,6 +508,20 @@ class EXP mxsr2msrSkeletonBuilder : void handleBOFPartGroupsNestingBOFAndScorePartsAllocation ( int inputLineNumber); + void sortfStartedPartGroupsListsVector ( + int inputLineNumber); + + void sortStoppedPartGroupsListsVector ( + int inputLineNumber); + + void handlePartGroupsStartAtIdentity ( + int inputLineNumber, + int identity); + + void handleThePartGroupsStoppedAtIdentity ( + int inputLineNumber, + int identity); + // parts handling // ------------------------------------------------------ diff --git a/src/passes/mxsr2msr/mxsr2msrSkeletonPopulator.cpp b/src/passes/mxsr2msr/mxsr2msrSkeletonPopulator.cpp index 0068d970..3f7e12d4 100644 --- a/src/passes/mxsr2msr/mxsr2msrSkeletonPopulator.cpp +++ b/src/passes/mxsr2msr/mxsr2msrSkeletonPopulator.cpp @@ -19,6 +19,8 @@ #include "msrRehearsalMarks.h" #include "msrVoiceStaffChanges.h" +#include "oahOah.h" + #include "waeOah.h" #include "mxsr2msrOah.h" @@ -24244,6 +24246,7 @@ void mxsr2msrSkeletonPopulator::handleStaffChangeTakeOffEventIfAnyBeforeNoteCrea } #endif // MF_TRACE_IS_ENABLED +#ifdef MF_SANITY_CHECKS_ARE_ENABLED int noteSequentialNumber = fCurrentNoteStaffChangeTakeOff-> @@ -24254,7 +24257,6 @@ void mxsr2msrSkeletonPopulator::handleStaffChangeTakeOffEventIfAnyBeforeNoteCrea fCurrentNoteStaffChangeTakeOff-> getEventInputStartLineNumber (); -#ifdef MF_SANITY_CHECKS_ARE_ENABLED // sanity checks if (noteSequentialNumber != fCurrentNoteSequentialNumber) { std::stringstream ss; @@ -24315,11 +24317,6 @@ void mxsr2msrSkeletonPopulator::createStaffChange ( S_mxsrStaffChangeEvent staffChangeTakeOffEvent) { if (staffChangeTakeOffEvent) { - int - noteSequentialNumber = - staffChangeTakeOffEvent-> - getNoteSequentialNumber (); - int eventInputStartLineNumber = staffChangeTakeOffEvent-> @@ -24343,6 +24340,11 @@ void mxsr2msrSkeletonPopulator::createStaffChange ( #ifdef MF_TRACE_IS_ENABLED + int + noteSequentialNumber = + staffChangeTakeOffEvent-> + getNoteSequentialNumber (); + gLog << "There is a staff change createStaffChange():" << std::endl << @@ -24782,6 +24784,7 @@ void mxsr2msrSkeletonPopulator::handleTupletBeginEventsIfAnyAfterNoteCreation () // handling the tuplet begin events for (S_mxsrTupletEvent tupletEvent : tupletBeginsList) { +#ifdef MF_TRACE_IS_ENABLED mxsrTupletEventKind tupletEventKind = tupletEvent->getTupletEventKind (); @@ -24790,7 +24793,6 @@ void mxsr2msrSkeletonPopulator::handleTupletBeginEventsIfAnyAfterNoteCreation () tupletNumber = tupletEvent->getTupletNumber (); -#ifdef MF_TRACE_IS_ENABLED if (gTraceOahGroup->getTraceTupletsBasics ()) { std::stringstream ss; diff --git a/src/representations/braille/brailleGenerationOah.cpp b/src/representations/braille/brailleGenerationOah.cpp index 8aac6581..bed80579 100644 --- a/src/representations/braille/brailleGenerationOah.cpp +++ b/src/representations/braille/brailleGenerationOah.cpp @@ -19,7 +19,6 @@ #include "mfPreprocessorSettings.h" -#include "mfConstants.h" #include "mfOutputFileOah.h" #include "mfStringsHandling.h" @@ -27,6 +26,7 @@ #include "brailleGenerationOah.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "waeHandlers.h" diff --git a/src/representations/bsr/bsrOah.cpp b/src/representations/bsr/bsrOah.cpp index 5cd1f6de..be0adc9c 100644 --- a/src/representations/bsr/bsrOah.cpp +++ b/src/representations/bsr/bsrOah.cpp @@ -18,15 +18,15 @@ #include "oahWae.h" -#include "mfPreprocessorSettings.h" - #include "mfConstants.h" +#include "mfPreprocessorSettings.h" #include "mfStringsHandling.h" #include "oahOah.h" #include "bsrOah.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "waeHandlers.h" diff --git a/src/representations/lpsr/lpsrOah.cpp b/src/representations/lpsr/lpsrOah.cpp index 0c6979d4..8181c647 100644 --- a/src/representations/lpsr/lpsrOah.cpp +++ b/src/representations/lpsr/lpsrOah.cpp @@ -19,9 +19,8 @@ #include "oahWae.h" -#include "mfPreprocessorSettings.h" - #include "mfConstants.h" +#include "mfPreprocessorSettings.h" #include "mfStringsHandling.h" #include "msrPitchesNames.h" @@ -30,6 +29,7 @@ #include "lpsrOah.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "waeHandlers.h" @@ -1303,72 +1303,6 @@ R"(These options control the way LPSR data is handled.)", lpsrOahGroup::~lpsrOahGroup () {} -#ifdef MF_TRACE_IS_ENABLED -void lpsrOahGroup::initializeLpsrTraceOah () -{ - S_oahSubGroup - subGroup = - oahSubGroup::create ( - "LPSR Trace", - "help-lpsr-trace", "hlpsrtrace", -R"()", - oahElementVisibilityKind::kElementVisibilityWhole, - this); - - appendSubGroupToGroup (subGroup); - - // trace lpsr - - subGroup-> - appendAtomToSubGroup ( - oahBooleanAtom::create ( - "trace-lpsr", "tlpsr", -R"(Write a trace of the LPSR graphs visiting activity to standard error.)", - "fTraceLpsr", - fTraceLpsr)); - - // trace lilypond version - - subGroup-> - appendAtomToSubGroup ( - oahBooleanAtom::create ( - "trace-lilypond-version", "tlpv", -R"(Write a trace of the LilyPond version to standard error.)", - "fTraceLilypondVersion", - fTraceLilypondVersion)); - - // trace lpsr visitors - - subGroup-> - appendAtomToSubGroup ( - oahBooleanAtom::create ( - "trace-lpsr-visitors", "tlpsrvis", -R"(Write a trace of the LPSR graphs visiting activity to standard error.)", - "fTraceLpsrVisitors", - fTraceLpsrVisitors)); - - // trace lpsr blocks - - subGroup-> - appendAtomToSubGroup ( - oahBooleanAtom::create ( - "trace-lpsr-blocks", "tlpsrb", -R"(Write a trace of the LPSR blocks to standard error.)", - "fTraceLpsrBlocks", - fTraceLpsrBlocks)); - - // trace scheme functions - - subGroup-> - appendAtomToSubGroup ( - oahBooleanAtom::create ( - "trace-scheme-functions", "tsf", -R"(Write a trace of the activity regarding Scheme functions to standard error.)", - "fTraceSchemeFunctions", - fTraceSchemeFunctions)); -} -#endif // MF_TRACE_IS_ENABLED - void lpsrOahGroup::initializeLpsrDisplayOptions () { S_oahSubGroup @@ -1430,31 +1364,29 @@ This option is an alias for '-dlpsrembedmsr, -dlpsrembedmsr'.)", subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-lpsr-names", "dlpsrnames", R"(Only write a view of the names in the LPSR to standard error. This implies that no LilyPond code is generated.)", "fDisplayLpsrNames", - fDisplayLpsrNames, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayLpsrNames)); // display LPSR summary subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-lpsr-summary", "dlpsrsum", R"(Only write a summary of the LPSR to standard error. This implies that no LilyPond code is generated.)", "fDisplayLpsrSummary", - fDisplayLpsrSummary, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayLpsrSummary)); // display LPSR flat view subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-lpsr-voices-flat-view", "dlpsrvoicesflatview", R"(Only write a voices flat view of the LPSR to standard error. The output looks like: @@ -1462,14 +1394,13 @@ The output looks like: where the number after ':' is the octave number. This implies that no LilyPond code is generated.)", "fDisplayLpsrFlatView", - fDisplayLpsrFlatView, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayLpsrFlatView)); // display LPSR flat view Details subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-lpsr-voices-flat-view-details", "dlpsrvoicesflatviewd", R"(Only write a voices flat view of the LPSR to standard error with more details. @@ -1481,35 +1412,98 @@ The output looks like: where the number after ':' is the octave number. This implies that no LilyPond code is generated.)", "fDisplayLpsrFlatViewDetails", - fDisplayLpsrFlatViewDetails, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayLpsrFlatViewDetails)); // display LPSR slices subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-lpsr-measures-slices", "dlpsrmeasslices", R"(Only write the measures slices of the LPSR to standard error. This implies that no LilyPond code is generated.)", "fDisplayLpsrMeasuresSlices", - fDisplayLpsrMeasuresSlices, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayLpsrMeasuresSlices)); // display LPSR slices details subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-lpsr-measures-slices-details", "dlpsrmeasslicesd", R"(Only write the measures slices of the LPSR to standard error with more details. This implies that no LilyPond code is generated.)", "fDisplayLpsrMeasuresSlicesDetails", - fDisplayLpsrMeasuresSlicesDetails, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayLpsrMeasuresSlicesDetails)); } +#ifdef MF_TRACE_IS_ENABLED +void lpsrOahGroup::initializeLpsrTraceOah () +{ + S_oahSubGroup + subGroup = + oahSubGroup::create ( + "LPSR Trace", + "help-lpsr-trace", "hlpsrtrace", +R"()", + oahElementVisibilityKind::kElementVisibilityWhole, + this); + + appendSubGroupToGroup (subGroup); + + // trace lpsr + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "trace-lpsr", "tlpsr", +R"(Write a trace of the LPSR graphs visiting activity to standard error.)", + "fTraceLpsr", + fTraceLpsr)); + + // trace lilypond version + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "trace-lilypond-version", "tlpv", +R"(Write a trace of the LilyPond version to standard error.)", + "fTraceLilypondVersion", + fTraceLilypondVersion)); + + // trace lpsr visitors + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "trace-lpsr-visitors", "tlpsrvis", +R"(Write a trace of the LPSR graphs visiting activity to standard error.)", + "fTraceLpsrVisitors", + fTraceLpsrVisitors)); + + // trace lpsr blocks + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "trace-lpsr-blocks", "tlpsrb", +R"(Write a trace of the LPSR blocks to standard error.)", + "fTraceLpsrBlocks", + fTraceLpsrBlocks)); + + // trace scheme functions + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "trace-scheme-functions", "tsf", +R"(Write a trace of the activity regarding Scheme functions to standard error.)", + "fTraceSchemeFunctions", + fTraceSchemeFunctions)); +} +#endif // MF_TRACE_IS_ENABLED + void lpsrOahGroup::initializeLpsrPaperOptions () { S_oahSubGroup @@ -2186,16 +2180,16 @@ for instruments in 'a', 'f' and B flat respectively)", void lpsrOahGroup::initializeLpsrOahGroup () { + // display + // -------------------------------------- + initializeLpsrDisplayOptions (); + #ifdef MF_TRACE_IS_ENABLED // trace and display // -------------------------------------- initializeLpsrTraceOah (); #endif // MF_TRACE_IS_ENABLED - // display - // -------------------------------------- - initializeLpsrDisplayOptions (); - // paper // -------------------------------------- initializeLpsrPaperOptions (); diff --git a/src/representations/msdl/msdlInputOah.cpp b/src/representations/msdl/msdlInputOah.cpp index aefe93a8..fc6647c8 100644 --- a/src/representations/msdl/msdlInputOah.cpp +++ b/src/representations/msdl/msdlInputOah.cpp @@ -19,9 +19,8 @@ #include "oahWae.h" -#include "mfPreprocessorSettings.h" - #include "mfConstants.h" +#include "mfPreprocessorSettings.h" #include "mfStringsHandling.h" #include "msrPitchesNames.h" @@ -31,6 +30,7 @@ #include "msdlInputOah.h" #include "msdl2msrOah.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "msdlTokens.h" diff --git a/src/representations/msr/msrDoubleTremolos.cpp b/src/representations/msr/msrDoubleTremolos.cpp index 27d4160a..462d15de 100644 --- a/src/representations/msr/msrDoubleTremolos.cpp +++ b/src/representations/msr/msrDoubleTremolos.cpp @@ -16,6 +16,7 @@ #include "mfPreprocessorSettings.h" #include "mfAssert.h" +#include "mfConstants.h" #include "mfServices.h" #include "mfStringsHandling.h" diff --git a/src/representations/msr/msrGenerationBasicTypes.cpp b/src/representations/msr/msrGenerationBasicTypes.cpp index 2a931e9f..8a5cca0b 100644 --- a/src/representations/msr/msrGenerationBasicTypes.cpp +++ b/src/representations/msr/msrGenerationBasicTypes.cpp @@ -18,6 +18,7 @@ #include "mfConstants.h" #include "mfStringsHandling.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "msrGenerationBasicTypes.h" diff --git a/src/representations/msr/msrMeasures.cpp b/src/representations/msr/msrMeasures.cpp index e766e29a..468b374c 100644 --- a/src/representations/msr/msrMeasures.cpp +++ b/src/representations/msr/msrMeasures.cpp @@ -16,6 +16,7 @@ #include "mfPreprocessorSettings.h" #include "mfAssert.h" +#include "mfConstants.h" #include "mfServices.h" #include "mfStringsHandling.h" diff --git a/src/representations/msr/msrNotesDurations.cpp b/src/representations/msr/msrNotesDurations.cpp index 6671032c..4eefe9cc 100644 --- a/src/representations/msr/msrNotesDurations.cpp +++ b/src/representations/msr/msrNotesDurations.cpp @@ -1920,11 +1920,6 @@ std::string multiMeasureRestsWholeNotesPitchAndOctaveAsString ( return ss.str (); } -//______________________________________________________________________________ -EXP const msrWholeNotes - K_WHOLE_NOTES_UNKNOWN_ ( - K_WHOLE_NOTES_NUMERATOR_UNKNOWN_, 1); - //______________________________________________________________________________ void testWholeNotes () { diff --git a/src/representations/msr/msrNotesDurations.h b/src/representations/msr/msrNotesDurations.h index e1e89a09..c05d14c7 100644 --- a/src/representations/msr/msrNotesDurations.h +++ b/src/representations/msr/msrNotesDurations.h @@ -214,9 +214,6 @@ EXP msrWholeNotes msrNotesDurationKindAsWholeNotes ( EXP msrNotesDurationKind wholeNotesAsNotesDurationKind (msrWholeNotes wholeNotes); -//______________________________________________________________________________ -EXP extern const msrWholeNotes K_WHOLE_NOTES_UNKNOWN_; - //______________________________________________________________________________ std::string wholeNotesAndDotsNumberPitchAndOctaveAsString ( // JMI v0.9.67 int inputLineNumber, diff --git a/src/representations/msr/msrOah.cpp b/src/representations/msr/msrOah.cpp index 64564338..779220d8 100644 --- a/src/representations/msr/msrOah.cpp +++ b/src/representations/msr/msrOah.cpp @@ -18,13 +18,13 @@ #include "visitor.h" #include "oahWae.h" -#include "mfPreprocessorSettings.h" - #include "mfConstants.h" +#include "mfPreprocessorSettings.h" #include "mfStringsHandling.h" #include "oahOah.h" +#include "oahConstants.h" #include "oahEarlyOptions.h" #include "msrOah.h" @@ -748,54 +748,249 @@ R"(These options control the way MSR data is handled.)", msrOahGroup::~msrOahGroup () {} -#ifdef MF_TRACE_IS_ENABLED -void msrOahGroup::initializeMsrTraceOah () +void msrOahGroup::initializeMsrDisplayOptions () { S_oahSubGroup subGroup = oahSubGroup::create ( - "MSR Trace", - "help-msr-trace", "hmsrt", + "Display", + "help-msr-trace-and-display", "hmsrtd", R"()", oahElementVisibilityKind::kElementVisibilityWhole, this); appendSubGroupToGroup (subGroup); - // MSR + // display partgroups subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( - "trace-msr", "tmsr", -R"(Write a trace of the LPSR graphs visiting activity to standard error.)", - "fTraceMsr", - fTraceMsr, - gTraceOahGroup->getTracePassesBooleanAtom ())); + oahBooleanAtom::create ( + "display-part-groups", "dpartgroups", +R"(Write the structure of the part groups to standard error.)", + "fDisplayPartGroups", + fDisplayPartGroups)); - // MSR visitors + // display MSR skeleton subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( - "trace-msr-visitors", "tmsrvis", -R"(Write a trace of the MSR graphs visiting activity to standard error.)", - "fTraceMsrVisitors", - fTraceMsrVisitors, - gTraceOahGroup->getTracePassesBooleanAtom ())); + oahBooleanAtom::create ( + "display-msr1-skeleton", "dmsr1skel", +R"(Write the contents of the first MSR skeleton data to standard error.)", + "fDisplayMsrSkeleton", + fDisplayMsrSkeleton)); + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "display-msr1-skeleton-full", "dmsr1skelfull", +R"(Write the contents of the first MSR skeleton data, full version, to standard error.)", + "fDisplayMsrSkeletonFull", + fDisplayMsrSkeletonFull)); - // MSR durations + // display first MSR + + S_oahBooleanAtom + displayFirstMsrBooleanAtom = + oahBooleanAtom::create ( + "display-msr1", "dmsr1", +R"(Write the contents of the first MSR data to standard error.)", + "fDisplayFirstMsr", + fDisplayFirstMsr); + + subGroup-> + appendAtomToSubGroup ( + displayFirstMsrBooleanAtom); + + S_oahBooleanAtom + displayFirstMsrFullBooleanAtom = + oahBooleanAtom::create ( + "display-msr1-full", "dmsr1full", +R"(Write the contents of the first MSR data, full version, to standard error.)", + "fDisplayFirstMsrFull", + fDisplayFirstMsrFull); + + subGroup-> + appendAtomToSubGroup ( + displayFirstMsrFullBooleanAtom); + + // display first MSR slices + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "display-msr1-measures-slices", "dmsr1measslices", +R"(Write the contents of the first MSR data slices to standard error.)", + "fDisplayFirstMsrMeasuresSlices", + fDisplayFirstMsrMeasuresSlices)); + + // display first MSR slices details subGroup-> appendAtomToSubGroup ( oahBooleanAtom::create ( - "trace-msr-durations", "tmsrd", -R"(Write a trace of the MSR durations handling activity to standard error.)", - "fTraceMsrNotesDurations", - fTraceMsrNotesDurations)); + "display-msr1-measures-slices-details", "dmsr1measslicesd", +R"(Write the contents of the first MSR data slices to standard error.)", + "fDisplayFirstMsrMeasuresSlicesDetails", + fDisplayFirstMsrMeasuresSlicesDetails)); + + // display second MSR + + S_oahBooleanAtom + displaySecondMsrBooleanAtom = + oahBooleanAtom::create ( + "display-msr2", "dmsr2", +R"(Write the contents of the second MSR data to standard error.)", + "fDisplaySecondMsr", + fDisplaySecondMsr); + + subGroup-> + appendAtomToSubGroup ( + displaySecondMsrBooleanAtom); + + // display second MSR full + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "display-msr2-full", "dmsr2full", +R"(Write the contents of the second MSR data, full version, to standard error.)", + "fDisplaySecondMsrFull", + fDisplaySecondMsrFull)); + + // display second MSR slices + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "display-msr2-measures-slices", "dmsr2measslices", +R"(Write the contents of the second MSR data slices to standard error.)", + "fDisplaySecondMsrMeasuresSlices", + fDisplaySecondMsrMeasuresSlices)); + + // display second MSR slices details + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "display-msr2-measures-slices-details", "dmsr2measslicesd", +R"(Write the contents of the second MSR data slices to standard error.)", + "fDisplaySecondMsrMeasuresSlicesDetails", + fDisplaySecondMsrMeasuresSlicesDetails)); + + // display first MSR names + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "display-msr1-names", "dmsr1names", +R"(Only write a view of the names in the first MSR to standard error. +This implies that no LilyPond code is generated.)", + "fDisplayFirstMsrNames", + fDisplayFirstMsrNames)); + + // display second MSR names + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "display-msr2-names", "dmsr2names", +R"(Only write a view of the names in the second MSR to standard error. +This implies that no LilyPond code is generated.)", + "fDisplaySecondMsrNames", + fDisplaySecondMsrNames)); + + // display first MSR summary + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "display-msr1-summary", "dmsr1sum", +R"(Only write a summary of the first MSR to standard error. +This implies that no LilyPond code is generated.)", + "fDisplayFirstMsrSummary", + fDisplayFirstMsrSummary)); + + // display second MSR summary + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "display-msr2-summary", "dmsr2sum", +R"(Only write a summary of the second MSR to standard error. +This implies that no LilyPond code is generated.)", + "fDisplaySecondMsrSummary", + fDisplaySecondMsrSummary)); + + // display first MSR flat view + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "display-msr1-voices-flat-view", "dmsr1voicesflatview", +R"(Only write a voices flat view of the first MSR to standard error. +The output looks like: + s4-unpitched c4-o:5 d4-o:5 e4-o:5 +where the number after ':' is the octave number. +This option implies that no LilyPond code is generated.)", + "fDisplayFirstMsrFlatView", + fDisplayFirstMsrFlatView)); + + // display first MSR flat view details + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "display-msr1-voices-flat-view-details", "dmsr1voicesflatviewd", +R"(Only write a voices flat view of the first MSR to standard error, +with more details. +The output looks like: + @0/1: s4-unpitched, line 52 + @1/4: c4-o:5, line 62 + @1/2: d4-o:5, line 72 + @3/4: e4-o:5, line 82 +where '@' indicates the position in the measure +and the number after ':' is the octave number. +This option implies that no LilyPond code is generated.)", + "fDisplayFirstMsrFlatViewDetails", + fDisplayFirstMsrFlatViewDetails)); + + // display second MSR flat view + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "display-msr2-voices-flat-view", "dmsr2voicesflatview", +R"(Only write a voices flat view of the second MSR to standard error. +The output looks like: + s4-unpitched c4-o:5 d4-o:5 e4-o:5 +where the number after ':' is the octave number. +This option implies that no LilyPond code is generated.)", + "fDisplaySecondMsrFlatView", + fDisplaySecondMsrFlatView)); + + // display second MSR flat view details + + subGroup-> + appendAtomToSubGroup ( + oahBooleanAtom::create ( + "display-msr2-voices-flat-view-details", "dmsr2voicesflatviewd", +R"(Only write a voices flat view of the second MSR to standard error, +with more details. +The output looks like: + @0/1: s4-unpitched, line 52 + @1/4: c4-o:5, line 62 + @1/2: d4-o:5, line 72 + @3/4: e4-o:5, line 82 +where '@' indicates the position in the measure +and the number after ':' is the octave number. +This option implies that no LilyPond code is generated.)", + "fDisplaySecondMsrFlatViewDetails", + fDisplaySecondMsrFlatViewDetails)); } -#endif // MF_TRACE_IS_ENABLED -void msrOahGroup::initializeMsrDisplayOptions () +#ifdef MF_TRACE_IS_ENABLED +void msrOahGroup::initializeMsrTraceOah () { S_oahSubGroup subGroup = oahSubGroup::create ( @@ -811,56 +1006,51 @@ R"()", subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-part-groups", "dpartgroups", R"(Write the structure of the part groups to standard error.)", "fDisplayPartGroups", - fDisplayPartGroups, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayPartGroups)); // display MSR skeleton subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr1-skeleton", "dmsr1skel", R"(Write the contents of the first MSR skeleton data to standard error.)", "fDisplayMsrSkeleton", - fDisplayMsrSkeleton, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayMsrSkeleton)); subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr1-skeleton-full", "dmsr1skelfull", R"(Write the contents of the first MSR skeleton data, full version, to standard error.)", "fDisplayMsrSkeletonFull", - fDisplayMsrSkeletonFull, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayMsrSkeletonFull)); // display first MSR - S_oahTwoBooleansAtom + S_oahBooleanAtom displayFirstMsrBooleanAtom = - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr1", "dmsr1", R"(Write the contents of the first MSR data to standard error.)", "fDisplayFirstMsr", - fDisplayFirstMsr, - gTraceOahGroup->getTracePassesBooleanAtom ()); + fDisplayFirstMsr); subGroup-> appendAtomToSubGroup ( displayFirstMsrBooleanAtom); - S_oahTwoBooleansAtom + S_oahBooleanAtom displayFirstMsrFullBooleanAtom = - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr1-full", "dmsr1full", R"(Write the contents of the first MSR data, full version, to standard error.)", "fDisplayFirstMsrFull", - fDisplayFirstMsrFull, - gTraceOahGroup->getTracePassesBooleanAtom ()); + fDisplayFirstMsrFull); subGroup-> appendAtomToSubGroup ( @@ -870,34 +1060,31 @@ R"(Write the contents of the first MSR data, full version, to standard error.)", subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr1-measures-slices", "dmsr1measslices", R"(Write the contents of the first MSR data slices to standard error.)", "fDisplayFirstMsrMeasuresSlices", - fDisplayFirstMsrMeasuresSlices, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayFirstMsrMeasuresSlices)); // display first MSR slices details subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr1-measures-slices-details", "dmsr1measslicesd", R"(Write the contents of the first MSR data slices to standard error.)", "fDisplayFirstMsrMeasuresSlicesDetails", - fDisplayFirstMsrMeasuresSlicesDetails, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayFirstMsrMeasuresSlicesDetails)); // display second MSR - S_oahTwoBooleansAtom + S_oahBooleanAtom displaySecondMsrBooleanAtom = - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr2", "dmsr2", R"(Write the contents of the second MSR data to standard error.)", "fDisplaySecondMsr", - fDisplaySecondMsr, - gTraceOahGroup->getTracePassesBooleanAtom ()); + fDisplaySecondMsr); subGroup-> appendAtomToSubGroup ( @@ -907,88 +1094,81 @@ R"(Write the contents of the second MSR data to standard error.)", subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr2-full", "dmsr2full", R"(Write the contents of the second MSR data, full version, to standard error.)", "fDisplaySecondMsrFull", - fDisplaySecondMsrFull, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplaySecondMsrFull)); // display second MSR slices subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr2-measures-slices", "dmsr2measslices", R"(Write the contents of the second MSR data slices to standard error.)", "fDisplaySecondMsrMeasuresSlices", - fDisplaySecondMsrMeasuresSlices, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplaySecondMsrMeasuresSlices)); // display second MSR slices details subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr2-measures-slices-details", "dmsr2measslicesd", R"(Write the contents of the second MSR data slices to standard error.)", "fDisplaySecondMsrMeasuresSlicesDetails", - fDisplaySecondMsrMeasuresSlicesDetails, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplaySecondMsrMeasuresSlicesDetails)); // display first MSR names subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr1-names", "dmsr1names", R"(Only write a view of the names in the first MSR to standard error. This implies that no LilyPond code is generated.)", "fDisplayFirstMsrNames", - fDisplayFirstMsrNames, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayFirstMsrNames)); // display second MSR names subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr2-names", "dmsr2names", R"(Only write a view of the names in the second MSR to standard error. This implies that no LilyPond code is generated.)", "fDisplaySecondMsrNames", - fDisplaySecondMsrNames, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplaySecondMsrNames)); // display first MSR summary subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr1-summary", "dmsr1sum", R"(Only write a summary of the first MSR to standard error. This implies that no LilyPond code is generated.)", "fDisplayFirstMsrSummary", - fDisplayFirstMsrSummary, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayFirstMsrSummary)); // display second MSR summary subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr2-summary", "dmsr2sum", R"(Only write a summary of the second MSR to standard error. This implies that no LilyPond code is generated.)", "fDisplaySecondMsrSummary", - fDisplaySecondMsrSummary, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplaySecondMsrSummary)); // display first MSR flat view subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr1-voices-flat-view", "dmsr1voicesflatview", R"(Only write a voices flat view of the first MSR to standard error. The output looks like: @@ -996,14 +1176,13 @@ The output looks like: where the number after ':' is the octave number. This option implies that no LilyPond code is generated.)", "fDisplayFirstMsrFlatView", - fDisplayFirstMsrFlatView, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayFirstMsrFlatView)); // display first MSR flat view details subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr1-voices-flat-view-details", "dmsr1voicesflatviewd", R"(Only write a voices flat view of the first MSR to standard error, with more details. @@ -1016,14 +1195,13 @@ where '@' indicates the position in the measure and the number after ':' is the octave number. This option implies that no LilyPond code is generated.)", "fDisplayFirstMsrFlatViewDetails", - fDisplayFirstMsrFlatViewDetails, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplayFirstMsrFlatViewDetails)); // display second MSR flat view subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr2-voices-flat-view", "dmsr2voicesflatview", R"(Only write a voices flat view of the second MSR to standard error. The output looks like: @@ -1031,14 +1209,13 @@ The output looks like: where the number after ':' is the octave number. This option implies that no LilyPond code is generated.)", "fDisplaySecondMsrFlatView", - fDisplaySecondMsrFlatView, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplaySecondMsrFlatView)); // display second MSR flat view details subGroup-> appendAtomToSubGroup ( - oahTwoBooleansAtom::create ( + oahBooleanAtom::create ( "display-msr2-voices-flat-view-details", "dmsr2voicesflatviewd", R"(Only write a voices flat view of the second MSR to standard error, with more details. @@ -1051,9 +1228,9 @@ where '@' indicates the position in the measure and the number after ':' is the octave number. This option implies that no LilyPond code is generated.)", "fDisplaySecondMsrFlatViewDetails", - fDisplaySecondMsrFlatViewDetails, - gTraceOahGroup->getTracePassesBooleanAtom ())); + fDisplaySecondMsrFlatViewDetails)); } +#endif // MF_TRACE_IS_ENABLED void msrOahGroup::initializeMsrLanguagesOptions () { diff --git a/src/representations/msr/msrOah.h b/src/representations/msr/msrOah.h index 14bab9bb..15625744 100644 --- a/src/representations/msr/msrOah.h +++ b/src/representations/msr/msrOah.h @@ -422,12 +422,12 @@ class EXP msrOahGroup : public oahGroup // private services // ------------------------------------------------------ + void initializeMsrDisplayOptions (); + #ifdef MF_TRACE_IS_ENABLED void initializeMsrTraceOah (); #endif // MF_TRACE_IS_ENABLED - void initializeMsrDisplayOptions (); - void initializeMsrLanguagesOptions (); void initializeMsrHeaderOptions ();