1 /*
2   MusicXML Library
3   Copyright (C) Grame 2006-2013
4 
5   This Source Code Form is subject to the terms of the Mozilla Public
6   License, v. 2.0. If a copy of the MPL was not distributed with this
7   file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9   Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
10   research@grame.fr
11 */
12 
13 #include <climits>      // INT_MIN, INT_MAX
14 #include <iomanip>      // setw, setprecision, ...
15 
16 #include <regex>
17 
18 #include "msrMidi.h"
19 
20 #include "utilities.h"
21 
22 #include "setTraceOahIfDesired.h"
23 #ifdef TRACE_OAH
24   #include "traceOah.h"
25 #endif
26 
27 #include "generalOah.h"
28 #include "lpsrOah.h"
29 #include "lilypondOah.h"
30 
31 
32 using namespace std;
33 
34 namespace MusicXML2
35 {
36 
37 //______________________________________________________________________________
create(string shortName,string longName,string description,string valueSpecification,string variableName,lpsrScoreOutputKind & lilypondScoreOutputKindVariable)38 S_lilypondScoreOutputKindAtom lilypondScoreOutputKindAtom::create (
39   string               shortName,
40   string               longName,
41   string               description,
42   string               valueSpecification,
43   string               variableName,
44   lpsrScoreOutputKind& lilypondScoreOutputKindVariable)
45 {
46   lilypondScoreOutputKindAtom* o = new
47     lilypondScoreOutputKindAtom (
48       shortName,
49       longName,
50       description,
51       valueSpecification,
52       variableName,
53       lilypondScoreOutputKindVariable);
54   assert(o!=0);
55   return o;
56 }
57 
lilypondScoreOutputKindAtom(string shortName,string longName,string description,string valueSpecification,string variableName,lpsrScoreOutputKind & lilypondScoreOutputKindVariable)58 lilypondScoreOutputKindAtom::lilypondScoreOutputKindAtom (
59   string               shortName,
60   string               longName,
61   string               description,
62   string               valueSpecification,
63   string               variableName,
64   lpsrScoreOutputKind& lilypondScoreOutputKindVariable)
65   : oahValuedAtom (
66       shortName,
67       longName,
68       description,
69       valueSpecification,
70       variableName),
71     fLpsrScoreOutputKindVariable (
72       lilypondScoreOutputKindVariable)
73 {}
74 
~lilypondScoreOutputKindAtom()75 lilypondScoreOutputKindAtom::~lilypondScoreOutputKindAtom ()
76 {}
77 
handleOptionUnderName(string optionName,ostream & os)78 S_oahValuedAtom lilypondScoreOutputKindAtom::handleOptionUnderName (
79   string   optionName,
80   ostream& os)
81 {
82 #ifdef TRACE_OAH
83   if (gTraceOah->fTraceOah) {
84     gLogOstream <<
85       "==> option '" << optionName << "' is a lilypondScoreOutputKindAtom" <<
86       endl;
87   }
88 #endif
89 
90   // an option value is needed
91   return this;
92 }
93 
handleValue(string theString,ostream & os)94 void lilypondScoreOutputKindAtom::handleValue (
95   string   theString,
96   ostream& os)
97 {
98 #ifdef TRACE_OAH
99   if (gTraceOah->fTraceOah) {
100     os <<
101       "==> oahAtom is of type 'lilypondScoreOutputKindAtom'" <<
102       endl;
103   }
104 #endif
105 }
106 
acceptIn(basevisitor * v)107 void lilypondScoreOutputKindAtom::acceptIn (basevisitor* v)
108 {
109 #ifdef TRACE_OAH
110   if (gOahOah->fTraceOahVisitors) {
111     gLogOstream <<
112       ".\\\" ==> lilypondScoreOutputKindAtom::acceptIn ()" <<
113       endl;
114   }
115 #endif
116 
117   if (visitor<S_lilypondScoreOutputKindAtom>*
118     p =
119       dynamic_cast<visitor<S_lilypondScoreOutputKindAtom>*> (v)) {
120         S_lilypondScoreOutputKindAtom elem = this;
121 
122 #ifdef TRACE_OAH
123         if (gOahOah->fTraceOahVisitors) {
124           gLogOstream <<
125             ".\\\" ==> Launching lilypondScoreOutputKindAtom::visitStart ()" <<
126             endl;
127         }
128 #endif
129         p->visitStart (elem);
130   }
131 }
132 
acceptOut(basevisitor * v)133 void lilypondScoreOutputKindAtom::acceptOut (basevisitor* v)
134 {
135 #ifdef TRACE_OAH
136   if (gOahOah->fTraceOahVisitors) {
137     gLogOstream <<
138       ".\\\" ==> lilypondScoreOutputKindAtom::acceptOut ()" <<
139       endl;
140   }
141 #endif
142 
143   if (visitor<S_lilypondScoreOutputKindAtom>*
144     p =
145       dynamic_cast<visitor<S_lilypondScoreOutputKindAtom>*> (v)) {
146         S_lilypondScoreOutputKindAtom elem = this;
147 
148 #ifdef TRACE_OAH
149         if (gOahOah->fTraceOahVisitors) {
150           gLogOstream <<
151             ".\\\" ==> Launching lilypondScoreOutputKindAtom::visitEnd ()" <<
152             endl;
153         }
154 #endif
155         p->visitEnd (elem);
156   }
157 }
158 
browseData(basevisitor * v)159 void lilypondScoreOutputKindAtom::browseData (basevisitor* v)
160 {
161 #ifdef TRACE_OAH
162   if (gOahOah->fTraceOahVisitors) {
163     gLogOstream <<
164       ".\\\" ==> lilypondScoreOutputKindAtom::browseData ()" <<
165       endl;
166   }
167 #endif
168 }
169 
asShortNamedOptionString() const170 string lilypondScoreOutputKindAtom::asShortNamedOptionString () const
171 {
172   stringstream s;
173 
174   s <<
175     "-" << fShortName << " " <<
176     lpsrScoreOutputKindAsString (fLpsrScoreOutputKindVariable);
177 
178   return s.str ();
179 }
180 
asActualLongNamedOptionString() const181 string lilypondScoreOutputKindAtom::asActualLongNamedOptionString () const
182 {
183   stringstream s;
184 
185   s <<
186     "-" << fLongName << " " <<
187     lpsrScoreOutputKindAsString (fLpsrScoreOutputKindVariable);
188 
189   return s.str ();
190 }
191 
print(ostream & os) const192 void lilypondScoreOutputKindAtom::print (ostream& os) const
193 {
194   const int fieldWidth = K_OAH_FIELD_WIDTH;
195 
196   os <<
197     "OptionsScoreOutputKindAtom:" <<
198     endl;
199 
200   gIndenter++;
201 
202   printValuedAtomEssentials (
203     os, fieldWidth);
204 
205   os << left <<
206     setw (fieldWidth) <<
207     "fVariableName" << " : " <<
208     fVariableName <<
209     endl <<
210     setw (fieldWidth) <<
211     "fLpsrScoreOutputKindVariable" << " : \"" <<
212     lpsrScoreOutputKindAsString (
213       fLpsrScoreOutputKindVariable) <<
214     "\"" <<
215     endl;
216 
217   gIndenter--;
218 }
219 
printAtomOptionsValues(ostream & os,int valueFieldWidth) const220 void lilypondScoreOutputKindAtom::printAtomOptionsValues (
221   ostream& os,
222   int      valueFieldWidth) const
223 {
224   os << left <<
225     setw (valueFieldWidth) <<
226     fVariableName <<
227     " : \"" <<
228     lpsrScoreOutputKindAsString (
229       fLpsrScoreOutputKindVariable) <<
230     "\"" <<
231     endl;
232 }
233 
operator <<(ostream & os,const S_lilypondScoreOutputKindAtom & elt)234 ostream& operator<< (ostream& os, const S_lilypondScoreOutputKindAtom& elt)
235 {
236   elt->print (os);
237   return os;
238 }
239 
240 //______________________________________________________________________________
create(string shortName,string longName,string description,string variableName,lpsrOctaveEntryKind & lpsrOctaveEntryKindVariable)241 S_lilypondAbsoluteOctaveEntryAtom lilypondAbsoluteOctaveEntryAtom::create (
242   string               shortName,
243   string               longName,
244   string               description,
245   string               variableName,
246   lpsrOctaveEntryKind& lpsrOctaveEntryKindVariable)
247 {
248   lilypondAbsoluteOctaveEntryAtom* o = new
249     lilypondAbsoluteOctaveEntryAtom (
250       shortName,
251       longName,
252       description,
253       variableName,
254       lpsrOctaveEntryKindVariable);
255   assert(o!=0);
256   return o;
257 }
258 
lilypondAbsoluteOctaveEntryAtom(string shortName,string longName,string description,string variableName,lpsrOctaveEntryKind & lpsrOctaveEntryKindVariable)259 lilypondAbsoluteOctaveEntryAtom::lilypondAbsoluteOctaveEntryAtom (
260   string               shortName,
261   string               longName,
262   string               description,
263   string               variableName,
264   lpsrOctaveEntryKind& lpsrOctaveEntryKindVariable)
265   : oahAtomWithVariableName (
266       shortName,
267       longName,
268       description,
269       variableName),
270     fLpsrOctaveEntryKindVariable (
271       lpsrOctaveEntryKindVariable)
272 {}
273 
~lilypondAbsoluteOctaveEntryAtom()274 lilypondAbsoluteOctaveEntryAtom::~lilypondAbsoluteOctaveEntryAtom ()
275 {}
276 
handleOptionUnderName(string optionName,ostream & os)277 S_oahValuedAtom lilypondAbsoluteOctaveEntryAtom::handleOptionUnderName (
278   string   optionName,
279   ostream& os)
280 {
281 #ifdef TRACE_OAH
282   if (gTraceOah->fTraceOah) {
283     gLogOstream <<
284       "==> option '" << optionName << "' is a lilypondAbsoluteOctaveEntryAtom" <<
285       endl;
286   }
287 #endif
288 
289   // set octave entry kind at once
290   fLpsrOctaveEntryKindVariable = kOctaveEntryAbsolute;
291 
292   // no option value is needed
293   return nullptr;
294 }
295 
acceptIn(basevisitor * v)296 void lilypondAbsoluteOctaveEntryAtom::acceptIn (basevisitor* v)
297 {
298 #ifdef TRACE_OAH
299   if (gOahOah->fTraceOahVisitors) {
300     gLogOstream <<
301       ".\\\" ==> lilypondAbsoluteOctaveEntryAtom::acceptIn ()" <<
302       endl;
303   }
304 #endif
305 
306   if (visitor<S_lilypondAbsoluteOctaveEntryAtom>*
307     p =
308       dynamic_cast<visitor<S_lilypondAbsoluteOctaveEntryAtom>*> (v)) {
309         S_lilypondAbsoluteOctaveEntryAtom elem = this;
310 
311 #ifdef TRACE_OAH
312         if (gOahOah->fTraceOahVisitors) {
313           gLogOstream <<
314             ".\\\" ==> Launching lilypondAbsoluteOctaveEntryAtom::visitStart ()" <<
315             endl;
316         }
317 #endif
318         p->visitStart (elem);
319   }
320 }
321 
acceptOut(basevisitor * v)322 void lilypondAbsoluteOctaveEntryAtom::acceptOut (basevisitor* v)
323 {
324 #ifdef TRACE_OAH
325   if (gOahOah->fTraceOahVisitors) {
326     gLogOstream <<
327       ".\\\" ==> lilypondAbsoluteOctaveEntryAtom::acceptOut ()" <<
328       endl;
329   }
330 #endif
331 
332   if (visitor<S_lilypondAbsoluteOctaveEntryAtom>*
333     p =
334       dynamic_cast<visitor<S_lilypondAbsoluteOctaveEntryAtom>*> (v)) {
335         S_lilypondAbsoluteOctaveEntryAtom elem = this;
336 
337 #ifdef TRACE_OAH
338         if (gOahOah->fTraceOahVisitors) {
339           gLogOstream <<
340             ".\\\" ==> Launching lilypondAbsoluteOctaveEntryAtom::visitEnd ()" <<
341             endl;
342         }
343 #endif
344         p->visitEnd (elem);
345   }
346 }
347 
browseData(basevisitor * v)348 void lilypondAbsoluteOctaveEntryAtom::browseData (basevisitor* v)
349 {
350 #ifdef TRACE_OAH
351   if (gOahOah->fTraceOahVisitors) {
352     gLogOstream <<
353       ".\\\" ==> lilypondAbsoluteOctaveEntryAtom::browseData ()" <<
354       endl;
355   }
356 #endif
357 }
358 
print(ostream & os) const359 void lilypondAbsoluteOctaveEntryAtom::print (ostream& os) const
360 {
361   const int fieldWidth = K_OAH_FIELD_WIDTH;
362 
363   os <<
364     "lilypondAbsoluteOctaveEntryAtom:" <<
365     endl;
366 
367   gIndenter++;
368 
369   oahElement::printOptionEssentials (
370     os, fieldWidth);
371 
372   gIndenter++;
373   os <<
374     gIndenter.indentMultiLineString (
375       fDescription) <<
376     endl;
377   gIndenter--;
378 
379   gIndenter--;
380 }
381 
printAtomOptionsValues(ostream & os,int valueFieldWidth) const382 void lilypondAbsoluteOctaveEntryAtom::printAtomOptionsValues (
383   ostream& os,
384   int      valueFieldWidth) const
385 {
386   os << left <<
387     setw (valueFieldWidth) <<
388     fVariableName <<
389     " : " <<
390     "- no value here -" <<
391     endl;
392 }
393 
394 //______________________________________________________________________________
create(string shortName,string longName,string description,string valueSpecification,string variableName,lpsrOctaveEntryKind & lpsrOctaveEntryKindVariable,S_msrSemiTonesPitchAndOctave & lilypondRelativeOctaveEntryVariable)395 S_lilypondRelativeOctaveEntryAtom lilypondRelativeOctaveEntryAtom::create (
396   string                        shortName,
397   string                        longName,
398   string                        description,
399   string                        valueSpecification,
400   string                        variableName,
401   lpsrOctaveEntryKind&          lpsrOctaveEntryKindVariable,
402   S_msrSemiTonesPitchAndOctave& lilypondRelativeOctaveEntryVariable)
403 {
404   lilypondRelativeOctaveEntryAtom* o = new
405     lilypondRelativeOctaveEntryAtom (
406       shortName,
407       longName,
408       description,
409       valueSpecification,
410       variableName,
411       lpsrOctaveEntryKindVariable,
412       lilypondRelativeOctaveEntryVariable);
413   assert(o!=0);
414   return o;
415 }
416 
lilypondRelativeOctaveEntryAtom(string shortName,string longName,string description,string valueSpecification,string variableName,lpsrOctaveEntryKind & lpsrOctaveEntryKindVariable,S_msrSemiTonesPitchAndOctave & lilypondRelativeOctaveEntryVariable)417 lilypondRelativeOctaveEntryAtom::lilypondRelativeOctaveEntryAtom (
418   string                        shortName,
419   string                        longName,
420   string                        description,
421   string                        valueSpecification,
422   string                        variableName,
423   lpsrOctaveEntryKind&          lpsrOctaveEntryKindVariable,
424   S_msrSemiTonesPitchAndOctave& lilypondRelativeOctaveEntryVariable)
425   : oahValuedAtom (
426       shortName,
427       longName,
428       description,
429       valueSpecification,
430       variableName),
431     fLpsrOctaveEntryKindVariable (
432       lpsrOctaveEntryKindVariable),
433     fMsrSemiTonesPitchAndOctaveVariable (
434       lilypondRelativeOctaveEntryVariable)
435 {}
436 
~lilypondRelativeOctaveEntryAtom()437 lilypondRelativeOctaveEntryAtom::~lilypondRelativeOctaveEntryAtom ()
438 {}
439 
handleOptionUnderName(string optionName,ostream & os)440 S_oahValuedAtom lilypondRelativeOctaveEntryAtom::handleOptionUnderName (
441   string   optionName,
442   ostream& os)
443 {
444 #ifdef TRACE_OAH
445   if (gTraceOah->fTraceOah) {
446     gLogOstream <<
447       "==> option '" << optionName << "' is a lilypondRelativeOctaveEntryAtom" <<
448       endl;
449   }
450 #endif
451 
452   // set octave entry kind at once
453   fLpsrOctaveEntryKindVariable = kOctaveEntryRelative;
454 
455   // an option value is needed
456   return this;
457 }
458 
handleValue(string theString,ostream & os)459 void lilypondRelativeOctaveEntryAtom::handleValue (
460   string   theString,
461   ostream& os)
462 {
463 #ifdef TRACE_OAH
464   if (gTraceOah->fTraceOah) {
465     os <<
466       "==> oahAtom is of type 'lilypondRelativeOctaveEntryAtom'" <<
467       endl;
468   }
469 #endif
470 
471   // theString contains the score output kind:
472   // is it in the score output kinds map?
473 
474 #ifdef TRACE_OAH
475   if (gTraceOah->fTraceOah) {
476     os <<
477       "==> oahAtom is of type 'lilypondRelativeOctaveEntryAtom'" <<
478       endl;
479   }
480 #endif
481 
482 /* JMI
483   map<string, lpsrOctaveEntryKind>::const_iterator
484     it =
485       gLpsrOctaveEntryKindsMap.find (
486         theString);
487 
488   if (it == gLpsrOctaveEntryKindsMap.end ()) {
489     // no, octave entry kind is unknown in the map
490 
491     printOptionsSummary (os);
492 
493     stringstream s;
494 
495     s <<
496       "octave entry kind '" << theString <<
497       "' is unknown" <<
498       endl <<
499       "The " <<
500       gLpsrOctaveEntryKindsMap.size () <<
501       " known octave entry kinds are:" <<
502       endl;
503 
504     gIndenter++;
505 
506     s <<
507       existingLpsrOctaveEntryKinds ();
508 
509     gIndenter--;
510 
511     oahError (s.str ());
512     abort ();
513   }
514 */
515 
516   setRelativeOctaveEntryVariableValue (
517     msrSemiTonesPitchAndOctave::createFromString (
518       K_NO_INPUT_LINE_NUMBER,
519       theString));
520 }
521 
acceptIn(basevisitor * v)522 void lilypondRelativeOctaveEntryAtom::acceptIn (basevisitor* v)
523 {
524 #ifdef TRACE_OAH
525   if (gOahOah->fTraceOahVisitors) {
526     gLogOstream <<
527       ".\\\" ==> lilypondRelativeOctaveEntryAtom::acceptIn ()" <<
528       endl;
529   }
530 #endif
531 
532   if (visitor<S_lilypondRelativeOctaveEntryAtom>*
533     p =
534       dynamic_cast<visitor<S_lilypondRelativeOctaveEntryAtom>*> (v)) {
535         S_lilypondRelativeOctaveEntryAtom elem = this;
536 
537 #ifdef TRACE_OAH
538         if (gOahOah->fTraceOahVisitors) {
539           gLogOstream <<
540             ".\\\" ==> Launching lilypondRelativeOctaveEntryAtom::visitStart ()" <<
541             endl;
542         }
543 #endif
544         p->visitStart (elem);
545   }
546 }
547 
acceptOut(basevisitor * v)548 void lilypondRelativeOctaveEntryAtom::acceptOut (basevisitor* v)
549 {
550 #ifdef TRACE_OAH
551   if (gOahOah->fTraceOahVisitors) {
552     gLogOstream <<
553       ".\\\" ==> lilypondRelativeOctaveEntryAtom::acceptOut ()" <<
554       endl;
555   }
556 #endif
557 
558   if (visitor<S_lilypondRelativeOctaveEntryAtom>*
559     p =
560       dynamic_cast<visitor<S_lilypondRelativeOctaveEntryAtom>*> (v)) {
561         S_lilypondRelativeOctaveEntryAtom elem = this;
562 
563 #ifdef TRACE_OAH
564         if (gOahOah->fTraceOahVisitors) {
565           gLogOstream <<
566             ".\\\" ==> Launching lilypondRelativeOctaveEntryAtom::visitEnd ()" <<
567             endl;
568         }
569 #endif
570         p->visitEnd (elem);
571   }
572 }
573 
browseData(basevisitor * v)574 void lilypondRelativeOctaveEntryAtom::browseData (basevisitor* v)
575 {
576 #ifdef TRACE_OAH
577   if (gOahOah->fTraceOahVisitors) {
578     gLogOstream <<
579       ".\\\" ==> lilypondRelativeOctaveEntryAtom::browseData ()" <<
580       endl;
581   }
582 #endif
583 }
584 
asShortNamedOptionString() const585 string lilypondRelativeOctaveEntryAtom::asShortNamedOptionString () const
586 {
587   stringstream s;
588 
589   s <<
590     "-" << fShortName << " " <<
591     fMsrSemiTonesPitchAndOctaveVariable->asString ();
592 
593   return s.str ();
594 }
595 
asActualLongNamedOptionString() const596 string lilypondRelativeOctaveEntryAtom::asActualLongNamedOptionString () const
597 {
598   stringstream s;
599 
600   s <<
601     "-" << fLongName << " " <<
602     fMsrSemiTonesPitchAndOctaveVariable->asString ();
603 
604   return s.str ();
605 }
606 
print(ostream & os) const607 void lilypondRelativeOctaveEntryAtom::print (ostream& os) const
608 {
609   const int fieldWidth = K_OAH_FIELD_WIDTH;
610 
611   os <<
612     "lilypondRelativeOctaveEntryAtom:" <<
613     endl;
614 
615   gIndenter++;
616 
617   oahElement::printOptionEssentials (
618     os, fieldWidth);
619 
620   gIndenter++;
621   os <<
622     gIndenter.indentMultiLineString (
623       fDescription) <<
624     endl;
625   gIndenter--;
626 
627   gIndenter--;
628 }
629 
printAtomOptionsValues(ostream & os,int valueFieldWidth) const630 void lilypondRelativeOctaveEntryAtom::printAtomOptionsValues (
631   ostream& os,
632   int      valueFieldWidth) const
633 {
634   os << left <<
635     setw (valueFieldWidth) <<
636     fVariableName <<
637     " : ";
638   if (fMsrSemiTonesPitchAndOctaveVariable) {
639     os << endl;
640     gIndenter++;
641     os <<
642       fMsrSemiTonesPitchAndOctaveVariable;
643     gIndenter--;
644   }
645   else {
646     os << "none" << endl;
647   }
648 }
649 
operator <<(ostream & os,const S_lilypondRelativeOctaveEntryAtom & elt)650 ostream& operator<< (ostream& os, const S_lilypondRelativeOctaveEntryAtom& elt)
651 {
652   elt->print (os);
653   return os;
654 }
655 
656 //______________________________________________________________________________
create(string shortName,string longName,string description,string valueSpecification,string variableName,lpsrOctaveEntryKind & lpsrOctaveEntryKindVariable,S_msrSemiTonesPitchAndOctave & lilypondFixedOctaveEntryVariable)657 S_lilypondFixedOctaveEntryAtom lilypondFixedOctaveEntryAtom::create (
658   string                        shortName,
659   string                        longName,
660   string                        description,
661   string                        valueSpecification,
662   string                        variableName,
663   lpsrOctaveEntryKind&          lpsrOctaveEntryKindVariable,
664   S_msrSemiTonesPitchAndOctave& lilypondFixedOctaveEntryVariable)
665 {
666   lilypondFixedOctaveEntryAtom* o = new
667     lilypondFixedOctaveEntryAtom (
668       shortName,
669       longName,
670       description,
671       valueSpecification,
672       variableName,
673       lpsrOctaveEntryKindVariable,
674       lilypondFixedOctaveEntryVariable);
675   assert(o!=0);
676   return o;
677 }
678 
lilypondFixedOctaveEntryAtom(string shortName,string longName,string description,string valueSpecification,string variableName,lpsrOctaveEntryKind & lpsrOctaveEntryKindVariable,S_msrSemiTonesPitchAndOctave & lilypondFixedOctaveEntryVariable)679 lilypondFixedOctaveEntryAtom::lilypondFixedOctaveEntryAtom (
680   string                        shortName,
681   string                        longName,
682   string                        description,
683   string                        valueSpecification,
684   string                        variableName,
685   lpsrOctaveEntryKind&          lpsrOctaveEntryKindVariable,
686   S_msrSemiTonesPitchAndOctave& lilypondFixedOctaveEntryVariable)
687   : oahValuedAtom (
688       shortName,
689       longName,
690       description,
691       valueSpecification,
692       variableName),
693     fLpsrOctaveEntryKindVariable (
694       lpsrOctaveEntryKindVariable),
695     fMsrSemiTonesPitchAndOctaveVariable (
696       lilypondFixedOctaveEntryVariable)
697 {}
698 
~lilypondFixedOctaveEntryAtom()699 lilypondFixedOctaveEntryAtom::~lilypondFixedOctaveEntryAtom ()
700 {}
701 
handleOptionUnderName(string optionName,ostream & os)702 S_oahValuedAtom lilypondFixedOctaveEntryAtom::handleOptionUnderName (
703   string   optionName,
704   ostream& os)
705 {
706 #ifdef TRACE_OAH
707   if (gTraceOah->fTraceOah) {
708     gLogOstream <<
709       "==> option '" << optionName << "' is a lilypondFixedOctaveEntryAtom" <<
710       endl;
711   }
712 #endif
713 
714   // set octave entry kind at once
715   fLpsrOctaveEntryKindVariable = kOctaveEntryFixed;
716 
717   // an option value is needed
718   return this;
719 }
720 
handleValue(string theString,ostream & os)721 void lilypondFixedOctaveEntryAtom::handleValue (
722   string   theString,
723   ostream& os)
724 {
725 #ifdef TRACE_OAH
726   if (gTraceOah->fTraceOah) {
727     os <<
728       "==> oahAtom is of type 'lilypondFixedOctaveEntryAtom'" <<
729       endl;
730   }
731 #endif
732 
733   // theString contains the score output kind:
734   // is it in the score output kinds map?
735 
736   setFixedOctaveEntryVariableValue (
737     msrSemiTonesPitchAndOctave::createFromString (
738       K_NO_INPUT_LINE_NUMBER,
739       theString));
740 }
741 
acceptIn(basevisitor * v)742 void lilypondFixedOctaveEntryAtom::acceptIn (basevisitor* v)
743 {
744 #ifdef TRACE_OAH
745   if (gOahOah->fTraceOahVisitors) {
746     gLogOstream <<
747       ".\\\" ==> lilypondFixedOctaveEntryAtom::acceptIn ()" <<
748       endl;
749   }
750 #endif
751 
752   if (visitor<S_lilypondFixedOctaveEntryAtom>*
753     p =
754       dynamic_cast<visitor<S_lilypondFixedOctaveEntryAtom>*> (v)) {
755         S_lilypondFixedOctaveEntryAtom elem = this;
756 
757 #ifdef TRACE_OAH
758         if (gOahOah->fTraceOahVisitors) {
759           gLogOstream <<
760             ".\\\" ==> Launching lilypondFixedOctaveEntryAtom::visitStart ()" <<
761             endl;
762         }
763 #endif
764         p->visitStart (elem);
765   }
766 }
767 
acceptOut(basevisitor * v)768 void lilypondFixedOctaveEntryAtom::acceptOut (basevisitor* v)
769 {
770 #ifdef TRACE_OAH
771   if (gOahOah->fTraceOahVisitors) {
772     gLogOstream <<
773       ".\\\" ==> lilypondFixedOctaveEntryAtom::acceptOut ()" <<
774       endl;
775   }
776 #endif
777 
778   if (visitor<S_lilypondFixedOctaveEntryAtom>*
779     p =
780       dynamic_cast<visitor<S_lilypondFixedOctaveEntryAtom>*> (v)) {
781         S_lilypondFixedOctaveEntryAtom elem = this;
782 
783 #ifdef TRACE_OAH
784         if (gOahOah->fTraceOahVisitors) {
785           gLogOstream <<
786             ".\\\" ==> Launching lilypondFixedOctaveEntryAtom::visitEnd ()" <<
787             endl;
788         }
789 #endif
790         p->visitEnd (elem);
791   }
792 }
793 
browseData(basevisitor * v)794 void lilypondFixedOctaveEntryAtom::browseData (basevisitor* v)
795 {
796 #ifdef TRACE_OAH
797   if (gOahOah->fTraceOahVisitors) {
798     gLogOstream <<
799       ".\\\" ==> lilypondFixedOctaveEntryAtom::browseData ()" <<
800       endl;
801   }
802 #endif
803 }
804 
asShortNamedOptionString() const805 string lilypondFixedOctaveEntryAtom::asShortNamedOptionString () const
806 {
807   stringstream s;
808 
809   s <<
810     "-" << fShortName << " " <<
811     fMsrSemiTonesPitchAndOctaveVariable->asString ();
812 
813   return s.str ();
814 }
815 
asActualLongNamedOptionString() const816 string lilypondFixedOctaveEntryAtom::asActualLongNamedOptionString () const
817 {
818   stringstream s;
819 
820   s <<
821     "-" << fLongName << " " <<
822     fMsrSemiTonesPitchAndOctaveVariable->asString ();
823 
824   return s.str ();
825 }
826 
print(ostream & os) const827 void lilypondFixedOctaveEntryAtom::print (ostream& os) const
828 {
829   const int fieldWidth = K_OAH_FIELD_WIDTH;
830 
831   os <<
832     "lilypondFixedOctaveEntryAtom:" <<
833     endl;
834 
835   gIndenter++;
836 
837   oahElement::printOptionEssentials (
838     os, fieldWidth);
839 
840   gIndenter++;
841   os <<
842     gIndenter.indentMultiLineString (
843       fDescription) <<
844     endl;
845   gIndenter--;
846 
847   gIndenter--;
848 }
849 
printAtomOptionsValues(ostream & os,int valueFieldWidth) const850 void lilypondFixedOctaveEntryAtom::printAtomOptionsValues (
851   ostream& os,
852   int      valueFieldWidth) const
853 {
854   os << left <<
855     setw (valueFieldWidth) <<
856     fVariableName <<
857     " : ";
858   if (fMsrSemiTonesPitchAndOctaveVariable) {
859     os << endl;
860     gIndenter++;
861     os <<
862       fMsrSemiTonesPitchAndOctaveVariable;
863     gIndenter--;
864   }
865   else {
866     os << "none" << endl;
867   }
868 }
869 
operator <<(ostream & os,const S_lilypondFixedOctaveEntryAtom & elt)870 ostream& operator<< (ostream& os, const S_lilypondFixedOctaveEntryAtom& elt)
871 {
872   elt->print (os);
873   return os;
874 }
875 
876 //______________________________________________________________________________
create(string shortName,string longName,string description,string valueSpecification,string variableName,lpsrAccidentalStyleKind & lilypondAccidentalStyleKindVariable)877 S_lilypondAccidentalStyleKindAtom lilypondAccidentalStyleKindAtom::create (
878   string             shortName,
879   string             longName,
880   string             description,
881   string             valueSpecification,
882   string             variableName,
883   lpsrAccidentalStyleKind&
884                      lilypondAccidentalStyleKindVariable)
885 {
886   lilypondAccidentalStyleKindAtom* o = new
887     lilypondAccidentalStyleKindAtom (
888       shortName,
889       longName,
890       description,
891       valueSpecification,
892       variableName,
893       lilypondAccidentalStyleKindVariable);
894   assert(o!=0);
895   return o;
896 }
897 
lilypondAccidentalStyleKindAtom(string shortName,string longName,string description,string valueSpecification,string variableName,lpsrAccidentalStyleKind & lilypondAccidentalStyleKindVariable)898 lilypondAccidentalStyleKindAtom::lilypondAccidentalStyleKindAtom (
899   string             shortName,
900   string             longName,
901   string             description,
902   string             valueSpecification,
903   string             variableName,
904   lpsrAccidentalStyleKind&
905                      lilypondAccidentalStyleKindVariable)
906   : oahValuedAtom (
907       shortName,
908       longName,
909       description,
910       valueSpecification,
911       variableName),
912     fLpsrAccidentalStyleKindVariable (
913       lilypondAccidentalStyleKindVariable)
914 {}
915 
~lilypondAccidentalStyleKindAtom()916 lilypondAccidentalStyleKindAtom::~lilypondAccidentalStyleKindAtom ()
917 {}
918 
handleOptionUnderName(string optionName,ostream & os)919 S_oahValuedAtom lilypondAccidentalStyleKindAtom::handleOptionUnderName (
920   string   optionName,
921   ostream& os)
922 {
923 #ifdef TRACE_OAH
924   if (gTraceOah->fTraceOah) {
925     gLogOstream <<
926       "==> option '" << optionName << "' is a lilypondAccidentalStyleKindAtom" <<
927       endl;
928   }
929 #endif
930 
931   // an option value is needed
932   return this;
933 }
934 
handleValue(string theString,ostream & os)935 void lilypondAccidentalStyleKindAtom::handleValue (
936   string   theString,
937   ostream& os)
938 {
939 #ifdef TRACE_OAH
940   if (gTraceOah->fTraceOah) {
941     os <<
942       "==> oahAtom is of type 'lilypondAccidentalStyleKindAtom'" <<
943       endl;
944   }
945 #endif
946 
947   // theString contains the language name:
948   // is it in the accidental styles map?
949 
950 #ifdef TRACE_OAH
951   if (gTraceOah->fTraceOah) {
952     os <<
953       "==> oahAtom is of type 'lilypondAccidentalStyleKindAtom'" <<
954       endl;
955   }
956 #endif
957 
958   map<string, lpsrAccidentalStyleKind>::const_iterator
959     it =
960       gLpsrAccidentalStyleKindsMap.find (
961         theString);
962 
963   if (it == gLpsrAccidentalStyleKindsMap.end ()) {
964     // no, accidental style is unknown in the map
965     stringstream s;
966 
967     s <<
968       "LPSR accidental style '" << theString <<
969       "' is unknown" <<
970       endl <<
971       "The " <<
972       gLpsrAccidentalStyleKindsMap.size () - 1 <<
973       " known LPSR accidental styles are:" <<
974       endl;
975 
976     gIndenter++;
977 
978     s <<
979       existingLpsrAccidentalStyleKinds (K_NAMES_LIST_MAX_LENGTH);
980 
981     gIndenter--;
982 
983     oahError (s.str ());
984   }
985 
986   setLpsrAccidentalStyleKindVariable (
987     (*it).second);
988 }
989 
acceptIn(basevisitor * v)990 void lilypondAccidentalStyleKindAtom::acceptIn (basevisitor* v)
991 {
992 #ifdef TRACE_OAH
993   if (gOahOah->fTraceOahVisitors) {
994     gLogOstream <<
995       ".\\\" ==> lilypondAccidentalStyleKindAtom::acceptIn ()" <<
996       endl;
997   }
998 #endif
999 
1000   if (visitor<S_lilypondAccidentalStyleKindAtom>*
1001     p =
1002       dynamic_cast<visitor<S_lilypondAccidentalStyleKindAtom>*> (v)) {
1003         S_lilypondAccidentalStyleKindAtom elem = this;
1004 
1005 #ifdef TRACE_OAH
1006         if (gOahOah->fTraceOahVisitors) {
1007           gLogOstream <<
1008             ".\\\" ==> Launching lilypondAccidentalStyleKindAtom::visitStart ()" <<
1009             endl;
1010         }
1011 #endif
1012         p->visitStart (elem);
1013   }
1014 }
1015 
acceptOut(basevisitor * v)1016 void lilypondAccidentalStyleKindAtom::acceptOut (basevisitor* v)
1017 {
1018 #ifdef TRACE_OAH
1019   if (gOahOah->fTraceOahVisitors) {
1020     gLogOstream <<
1021       ".\\\" ==> lilypondAccidentalStyleKindAtom::acceptOut ()" <<
1022       endl;
1023   }
1024 #endif
1025 
1026   if (visitor<S_lilypondAccidentalStyleKindAtom>*
1027     p =
1028       dynamic_cast<visitor<S_lilypondAccidentalStyleKindAtom>*> (v)) {
1029         S_lilypondAccidentalStyleKindAtom elem = this;
1030 
1031 #ifdef TRACE_OAH
1032         if (gOahOah->fTraceOahVisitors) {
1033           gLogOstream <<
1034             ".\\\" ==> Launching lilypondAccidentalStyleKindAtom::visitEnd ()" <<
1035             endl;
1036         }
1037 #endif
1038         p->visitEnd (elem);
1039   }
1040 }
1041 
browseData(basevisitor * v)1042 void lilypondAccidentalStyleKindAtom::browseData (basevisitor* v)
1043 {
1044 #ifdef TRACE_OAH
1045   if (gOahOah->fTraceOahVisitors) {
1046     gLogOstream <<
1047       ".\\\" ==> lilypondAccidentalStyleKindAtom::browseData ()" <<
1048       endl;
1049   }
1050 #endif
1051 }
1052 
asShortNamedOptionString() const1053 string lilypondAccidentalStyleKindAtom::asShortNamedOptionString () const
1054 {
1055   stringstream s;
1056 
1057   s <<
1058     "-" << fShortName << " " <<
1059     lpsrAccidentalStyleKindAsString (fLpsrAccidentalStyleKindVariable);
1060 
1061   return s.str ();
1062 }
1063 
asActualLongNamedOptionString() const1064 string lilypondAccidentalStyleKindAtom::asActualLongNamedOptionString () const
1065 {
1066   stringstream s;
1067 
1068   s <<
1069     "-" << fLongName << " " <<
1070     lpsrAccidentalStyleKindAsString (fLpsrAccidentalStyleKindVariable);
1071 
1072   return s.str ();
1073 }
1074 
print(ostream & os) const1075 void lilypondAccidentalStyleKindAtom::print (ostream& os) const
1076 {
1077   const int fieldWidth = K_OAH_FIELD_WIDTH;
1078 
1079   os <<
1080     "OptionsAccidentalStyleKindAtom:" <<
1081     endl;
1082 
1083   gIndenter++;
1084 
1085   printValuedAtomEssentials (
1086     os, fieldWidth);
1087 
1088   os << left <<
1089     setw (fieldWidth) <<
1090     "fVariableName" << " : " <<
1091     fVariableName <<
1092     endl <<
1093     setw (fieldWidth) <<
1094     "fLpsrAccidentalStyleKindVariable" << " : \"" <<
1095     lpsrAccidentalStyleKindAsString (
1096       fLpsrAccidentalStyleKindVariable) <<
1097     "\"" <<
1098     endl;
1099 
1100   gIndenter--;
1101 }
1102 
printAtomOptionsValues(ostream & os,int valueFieldWidth) const1103 void lilypondAccidentalStyleKindAtom::printAtomOptionsValues (
1104   ostream& os,
1105   int      valueFieldWidth) const
1106 {
1107   os << left <<
1108     setw (valueFieldWidth) <<
1109     fVariableName <<
1110     " : \"" <<
1111     lpsrAccidentalStyleKindAsString (
1112       fLpsrAccidentalStyleKindVariable) <<
1113     "\"" <<
1114     endl;
1115 }
1116 
operator <<(ostream & os,const S_lilypondAccidentalStyleKindAtom & elt)1117 ostream& operator<< (ostream& os, const S_lilypondAccidentalStyleKindAtom& elt)
1118 {
1119   elt->print (os);
1120   return os;
1121 }
1122 
1123 //______________________________________________________________________________
create(string shortName,string longName,string description,string valueSpecification,string variableName,list<pair<string,string>> & lilypondChordsDisplayVariable)1124 S_lilypondChordsDisplayAtom lilypondChordsDisplayAtom::create (
1125   string                shortName,
1126   string                longName,
1127   string                description,
1128   string                valueSpecification,
1129   string                variableName,
1130   list<pair<string, string> >&
1131                         lilypondChordsDisplayVariable)
1132 {
1133   lilypondChordsDisplayAtom* o = new
1134     lilypondChordsDisplayAtom (
1135       shortName,
1136       longName,
1137       description,
1138       valueSpecification,
1139       variableName,
1140       lilypondChordsDisplayVariable);
1141   assert(o!=0);
1142   return o;
1143 }
1144 
lilypondChordsDisplayAtom(string shortName,string longName,string description,string valueSpecification,string variableName,list<pair<string,string>> & lilypondChordsDisplayVariable)1145 lilypondChordsDisplayAtom::lilypondChordsDisplayAtom (
1146   string                shortName,
1147   string                longName,
1148   string                description,
1149   string                valueSpecification,
1150   string                variableName,
1151   list<pair<string, string> >&
1152                         lilypondChordsDisplayVariable)
1153   : oahValuedAtom (
1154       shortName,
1155       longName,
1156       description,
1157       valueSpecification,
1158       variableName),
1159     fStringsPairListVariable (
1160       lilypondChordsDisplayVariable)
1161 {}
1162 
~lilypondChordsDisplayAtom()1163 lilypondChordsDisplayAtom::~lilypondChordsDisplayAtom ()
1164 {}
1165 
handleOptionUnderName(string optionName,ostream & os)1166 S_oahValuedAtom lilypondChordsDisplayAtom::handleOptionUnderName (
1167   string   optionName,
1168   ostream& os)
1169 {
1170 #ifdef TRACE_OAH
1171   if (gTraceOah->fTraceOah) {
1172     gLogOstream <<
1173       "==> option '" << optionName << "' is a lilypondChordsDisplayAtom" <<
1174       endl;
1175   }
1176 #endif
1177 
1178   // an option value is needed
1179   return this;
1180 }
1181 
handleValue(string theString,ostream & os)1182 void lilypondChordsDisplayAtom::handleValue (
1183   string   theString,
1184   ostream& os)
1185 {
1186 #ifdef TRACE_OAH
1187   if (gTraceOah->fTraceOah) {
1188     os <<
1189       "==> oahAtom is of type 'lilypondChordsDisplayAtom'" <<
1190       endl;
1191   }
1192 #endif
1193 
1194   /*
1195     % Exception music is chords with markups
1196     #(define (lower-extension pitch chbass)
1197        "Return lowered markup for pitch note name."
1198        #{
1199          \markup \raise #-1.9 \halign #0.2
1200          #(note-name->markup pitch chbass)
1201        #})
1202 
1203     chExceptionMusic = {
1204       <c ees ges bes>1-\markup { \super {"-7(" {\small\raise #0.5 \flat} "5)"} }
1205       <c e g bes>1-\markup { \super "7" }
1206       <c e gis bes>1-\markup { \super {"7(" {\small\raise #0.5 \sharp} "5)"} }
1207       <c f g bes>1-\markup { \super {"7(sus4)"} }
1208       <c e g a d'>1-\markup { \super "6/9" }
1209       <c e g bes des'>1-\markup { \super {"7(" {\small\raise #0.5 \flat} "9)"} }
1210       <c f g bes d'>1-\markup { \super {"9(sus4)"} }
1211       <c e g bes d'>1-\markup { \super "9" }
1212       <c e g b d'>1-\markup { \super "maj9" }
1213       <c e gis bes d'>1-\markup { \super "9+" }
1214       <c e g bes d' fis'>1-\markup { \super "9#11" }
1215       <c e g bes d' f'>1-\markup { \super "11" }
1216       <c e g bes d' a'>1-\markup { \super "13" }
1217       <c e g bes d' fis' a'>1-\markup { \super {"13(" {\small\raise #0.5 \sharp} "11)"} }
1218       <c e g a d'>1-\markup { \super "6(add9)" }
1219     }
1220 
1221     chExceptions = #(append
1222                      (sequential-music-to-chord-exceptions chExceptionMusic #t)
1223                      ignatzekExceptions)
1224 
1225     -7b5:
1226       -cd, -chord-display '<c ees ges bes> \super {"-7(" {\small\raise #0.5 \flat} "5)"}'
1227   */
1228 
1229   // theString contains a specification such as:
1230   //   '<c ees ges bes> \super {"-7(" {\small\raise #0.5 \flat} "5)"}'
1231 
1232 #ifdef TRACE_OAH
1233   if (gTraceOah->fTraceOah) {
1234     os <<
1235       "==> oahAtom is of type 'lilypondChordsDisplayAtom'" <<
1236       endl;
1237   }
1238 #endif
1239 
1240   string regularExpression (
1241     "(<.+>)"
1242     "[[:space:]]+"
1243     "(.+)"
1244     );
1245 
1246   regex  e (regularExpression);
1247   smatch sm;
1248 
1249   regex_match (theString, sm, e);
1250 
1251   unsigned smSize = sm.size ();
1252 
1253 #ifdef TRACE_OAH
1254   if (gTraceOah->fTraceOah) {
1255     os <<
1256       "There are " << smSize << " matches" <<
1257       " for chords display string '" << theString <<
1258       "' with regex '" << regularExpression <<
1259       "':" <<
1260       endl;
1261 
1262     gIndenter++;
1263 
1264     for (unsigned i = 0; i < smSize; ++i) {
1265       os <<
1266         i << ": " << "\"" << sm [i] << "\"" <<
1267         endl;
1268     } // for
1269     os << endl;
1270 
1271     gIndenter--;
1272   }
1273 #endif
1274 
1275   if (smSize != 3) {
1276     stringstream s;
1277 
1278     s <<
1279       "-chords-display argument '" << theString <<
1280       "' is ill-formed";
1281 
1282     oahError (s.str ());
1283   }
1284 
1285   string chordContents     = sm [1];
1286   string chordsDisplaycode = sm [2];
1287 
1288 #ifdef TRACE_OAH
1289   if (gTraceOah->fTraceOah) {
1290     os <<
1291       "FAA chordContents  = " <<
1292       chordContents <<
1293       endl <<
1294       "chordsDisplaycode = " <<
1295       chordsDisplaycode <<
1296       endl;
1297 
1298   setStringsPairListVariable (
1299     make_pair (
1300       chordContents, chordsDisplaycode));
1301   }
1302 #endif
1303 }
1304 
acceptIn(basevisitor * v)1305 void lilypondChordsDisplayAtom::acceptIn (basevisitor* v)
1306 {
1307 #ifdef TRACE_OAH
1308   if (gOahOah->fTraceOahVisitors) {
1309     gLogOstream <<
1310       ".\\\" ==> lilypondChordsDisplayAtom::acceptIn ()" <<
1311       endl;
1312   }
1313 #endif
1314 
1315   if (visitor<S_lilypondChordsDisplayAtom>*
1316     p =
1317       dynamic_cast<visitor<S_lilypondChordsDisplayAtom>*> (v)) {
1318         S_lilypondChordsDisplayAtom elem = this;
1319 
1320 #ifdef TRACE_OAH
1321         if (gOahOah->fTraceOahVisitors) {
1322           gLogOstream <<
1323             ".\\\" ==> Launching lilypondChordsDisplayAtom::visitStart ()" <<
1324             endl;
1325         }
1326 #endif
1327         p->visitStart (elem);
1328   }
1329 }
1330 
acceptOut(basevisitor * v)1331 void lilypondChordsDisplayAtom::acceptOut (basevisitor* v)
1332 {
1333 #ifdef TRACE_OAH
1334   if (gOahOah->fTraceOahVisitors) {
1335     gLogOstream <<
1336       ".\\\" ==> lilypondChordsDisplayAtom::acceptOut ()" <<
1337       endl;
1338   }
1339 #endif
1340 
1341   if (visitor<S_lilypondChordsDisplayAtom>*
1342     p =
1343       dynamic_cast<visitor<S_lilypondChordsDisplayAtom>*> (v)) {
1344         S_lilypondChordsDisplayAtom elem = this;
1345 
1346 #ifdef TRACE_OAH
1347         if (gOahOah->fTraceOahVisitors) {
1348           gLogOstream <<
1349             ".\\\" ==> Launching lilypondChordsDisplayAtom::visitEnd ()" <<
1350             endl;
1351         }
1352 #endif
1353         p->visitEnd (elem);
1354   }
1355 }
1356 
browseData(basevisitor * v)1357 void lilypondChordsDisplayAtom::browseData (basevisitor* v)
1358 {
1359 #ifdef TRACE_OAH
1360   if (gOahOah->fTraceOahVisitors) {
1361     gLogOstream <<
1362       ".\\\" ==> lilypondChordsDisplayAtom::browseData ()" <<
1363       endl;
1364   }
1365 #endif
1366 }
1367 
asShortNamedOptionString() const1368 string lilypondChordsDisplayAtom::asShortNamedOptionString () const
1369 {
1370   stringstream s;
1371 
1372   s <<
1373     "-" << fShortName << " ";
1374 
1375   list<pair<string, string> >::const_iterator
1376     iBegin = fStringsPairListVariable.begin (),
1377     iEnd   = fStringsPairListVariable.end (),
1378     i      = iBegin;
1379   for ( ; ; ) {
1380     s <<
1381       (*i).first << " --> " << (*i).second <<
1382       endl;
1383     if (++i == iEnd) break;
1384     s << ","; // JMI
1385   } // for
1386 
1387   return s.str ();
1388 }
1389 
asActualLongNamedOptionString() const1390 string lilypondChordsDisplayAtom::asActualLongNamedOptionString () const
1391 {
1392   stringstream s;
1393 
1394   s <<
1395     "-" << fLongName << " ";
1396 
1397   list<pair<string, string> >::const_iterator
1398     iBegin = fStringsPairListVariable.begin (),
1399     iEnd   = fStringsPairListVariable.end (),
1400     i      = iBegin;
1401   for ( ; ; ) {
1402     s <<
1403       (*i).first << " --> " << (*i).second <<
1404       endl;
1405     if (++i == iEnd) break;
1406     s << ","; // JMI
1407   } // for
1408 
1409   return s.str ();
1410 }
1411 
print(ostream & os) const1412 void lilypondChordsDisplayAtom::print (ostream& os) const
1413 {
1414   const int fieldWidth = K_OAH_FIELD_WIDTH;
1415 
1416   os <<
1417     "lilypondChordsDisplayAtom:" <<
1418     endl;
1419 
1420   gIndenter++;
1421 
1422   printValuedAtomEssentials (
1423     os, fieldWidth);
1424 
1425   os << left <<
1426     setw (fieldWidth) <<
1427     "fVariableName" << " : " <<
1428     fVariableName <<
1429     setw (fieldWidth) <<
1430     "fStringsPairListVariable" << " : '" <<
1431     endl;
1432 
1433   gIndenter++;
1434 
1435   list<pair<string, string> >::const_iterator
1436     iBegin = fStringsPairListVariable.begin (),
1437     iEnd   = fStringsPairListVariable.end (),
1438     i      = iBegin;
1439   for ( ; ; ) {
1440     os <<
1441       (*i).first << " --> " << (*i).second <<
1442       endl;
1443     if (++i == iEnd) break;
1444 // JMI    os << endl;
1445   } // for
1446 
1447   gIndenter--;
1448 
1449   gIndenter--;
1450 }
1451 
printAtomOptionsValues(ostream & os,int valueFieldWidth) const1452 void lilypondChordsDisplayAtom::printAtomOptionsValues (
1453   ostream& os,
1454   int      valueFieldWidth) const
1455 {
1456   os << left <<
1457     setw (valueFieldWidth) <<
1458     fVariableName <<
1459     " : ";
1460 
1461   if (fStringsPairListVariable.size ()) {
1462     os << endl;
1463     gIndenter++;
1464 
1465     list<pair<string, string> >::const_iterator
1466       iBegin = fStringsPairListVariable.begin (),
1467       iEnd   = fStringsPairListVariable.end (),
1468       i      = iBegin;
1469     for ( ; ; ) {
1470       os << (*i).first << " --> " << (*i).second;
1471       if (++i == iEnd) break;
1472       os << endl;
1473     } // for
1474 
1475     gIndenter--;
1476   }
1477   else {
1478     os <<
1479       "none";
1480   }
1481   os << endl;
1482 }
1483 
operator <<(ostream & os,const S_lilypondChordsDisplayAtom & elt)1484 ostream& operator<< (ostream& os, const S_lilypondChordsDisplayAtom& elt)
1485 {
1486   elt->print (os);
1487   return os;
1488 }
1489 
1490 //______________________________________________________________________________
create(string shortName,string longName,string description,string valueSpecification,string variableName,lpsrLyricsDurationsKind & lilypondLyricsDurationsKindVariable)1491 S_lilypondLyricsDurationsKindAtom lilypondLyricsDurationsKindAtom::create (
1492   string             shortName,
1493   string             longName,
1494   string             description,
1495   string             valueSpecification,
1496   string             variableName,
1497   lpsrLyricsDurationsKind&
1498                      lilypondLyricsDurationsKindVariable)
1499 {
1500   lilypondLyricsDurationsKindAtom* o = new
1501     lilypondLyricsDurationsKindAtom (
1502       shortName,
1503       longName,
1504       description,
1505       valueSpecification,
1506       variableName,
1507       lilypondLyricsDurationsKindVariable);
1508   assert(o!=0);
1509   return o;
1510 }
1511 
lilypondLyricsDurationsKindAtom(string shortName,string longName,string description,string valueSpecification,string variableName,lpsrLyricsDurationsKind & lilypondLyricsDurationsKindVariable)1512 lilypondLyricsDurationsKindAtom::lilypondLyricsDurationsKindAtom (
1513   string             shortName,
1514   string             longName,
1515   string             description,
1516   string             valueSpecification,
1517   string             variableName,
1518   lpsrLyricsDurationsKind&
1519                      lilypondLyricsDurationsKindVariable)
1520   : oahValuedAtom (
1521       shortName,
1522       longName,
1523       description,
1524       valueSpecification,
1525       variableName),
1526     fLpsrLyricsDurationsKindVariable (
1527       lilypondLyricsDurationsKindVariable)
1528 {}
1529 
~lilypondLyricsDurationsKindAtom()1530 lilypondLyricsDurationsKindAtom::~lilypondLyricsDurationsKindAtom ()
1531 {}
1532 
handleOptionUnderName(string optionName,ostream & os)1533 S_oahValuedAtom lilypondLyricsDurationsKindAtom::handleOptionUnderName (
1534   string   optionName,
1535   ostream& os)
1536 {
1537 #ifdef TRACE_OAH
1538   if (gTraceOah->fTraceOah) {
1539     gLogOstream <<
1540       "==> option '" << optionName << "' is a lilypondLyricsDurationsKindAtom" <<
1541       endl;
1542   }
1543 #endif
1544 
1545   // an option value is needed
1546   return this;
1547 }
1548 
handleValue(string theString,ostream & os)1549 void lilypondLyricsDurationsKindAtom::handleValue (
1550   string   theString,
1551   ostream& os)
1552 {
1553 #ifdef TRACE_OAH
1554   if (gTraceOah->fTraceOah) {
1555     os <<
1556       "==> oahAtom is of type 'lilypondLyricsDurationsKindAtom'" <<
1557       endl;
1558   }
1559 #endif
1560 
1561   // theString contains the language name:
1562   // is it in the lyrics alignment kinds map?
1563 
1564 #ifdef TRACE_OAH
1565   if (gTraceOah->fTraceOah) {
1566     os <<
1567       "==> oahAtom is of type 'lilypondLyricsDurationsKindAtom'" <<
1568       endl;
1569   }
1570 #endif
1571 
1572   map<string, lpsrLyricsDurationsKind>::const_iterator
1573     it =
1574       gLpsrLyricsDurationsKindsMap.find (
1575         theString);
1576 
1577   if (it == gLpsrLyricsDurationsKindsMap.end ()) {
1578     // no, lyrics alignment kind is unknown in the map
1579     stringstream s;
1580 
1581     s <<
1582       "LPSR lyrics alignment kind '" << theString <<
1583       "' is unknown" <<
1584       endl <<
1585       "The " <<
1586       gLpsrLyricsDurationsKindsMap.size () - 1 <<
1587       " known LPSR lyrics alignment kind are:" <<
1588       endl;
1589 
1590     gIndenter++;
1591 
1592     s <<
1593       existingLpsrLyricsDurationsKinds (K_NAMES_LIST_MAX_LENGTH);
1594 
1595     gIndenter--;
1596 
1597     oahError (s.str ());
1598   }
1599 
1600   setLpsrLyricsDurationsKindVariable (
1601     (*it).second);
1602 }
1603 
acceptIn(basevisitor * v)1604 void lilypondLyricsDurationsKindAtom::acceptIn (basevisitor* v)
1605 {
1606 #ifdef TRACE_OAH
1607   if (gOahOah->fTraceOahVisitors) {
1608     gLogOstream <<
1609       ".\\\" ==> lilypondLyricsDurationsKindAtom::acceptIn ()" <<
1610       endl;
1611   }
1612 #endif
1613 
1614   if (visitor<S_lilypondLyricsDurationsKindAtom>*
1615     p =
1616       dynamic_cast<visitor<S_lilypondLyricsDurationsKindAtom>*> (v)) {
1617         S_lilypondLyricsDurationsKindAtom elem = this;
1618 
1619 #ifdef TRACE_OAH
1620         if (gOahOah->fTraceOahVisitors) {
1621           gLogOstream <<
1622             ".\\\" ==> Launching lilypondLyricsDurationsKindAtom::visitStart ()" <<
1623             endl;
1624         }
1625 #endif
1626         p->visitStart (elem);
1627   }
1628 }
1629 
acceptOut(basevisitor * v)1630 void lilypondLyricsDurationsKindAtom::acceptOut (basevisitor* v)
1631 {
1632 #ifdef TRACE_OAH
1633   if (gOahOah->fTraceOahVisitors) {
1634     gLogOstream <<
1635       ".\\\" ==> lilypondLyricsDurationsKindAtom::acceptOut ()" <<
1636       endl;
1637   }
1638 #endif
1639 
1640   if (visitor<S_lilypondLyricsDurationsKindAtom>*
1641     p =
1642       dynamic_cast<visitor<S_lilypondLyricsDurationsKindAtom>*> (v)) {
1643         S_lilypondLyricsDurationsKindAtom elem = this;
1644 
1645 #ifdef TRACE_OAH
1646         if (gOahOah->fTraceOahVisitors) {
1647           gLogOstream <<
1648             ".\\\" ==> Launching lilypondLyricsDurationsKindAtom::visitEnd ()" <<
1649             endl;
1650         }
1651 #endif
1652         p->visitEnd (elem);
1653   }
1654 }
1655 
browseData(basevisitor * v)1656 void lilypondLyricsDurationsKindAtom::browseData (basevisitor* v)
1657 {
1658 #ifdef TRACE_OAH
1659   if (gOahOah->fTraceOahVisitors) {
1660     gLogOstream <<
1661       ".\\\" ==> lilypondLyricsDurationsKindAtom::browseData ()" <<
1662       endl;
1663   }
1664 #endif
1665 }
1666 
asShortNamedOptionString() const1667 string lilypondLyricsDurationsKindAtom::asShortNamedOptionString () const
1668 {
1669   stringstream s;
1670 
1671   s <<
1672     "-" << fShortName << " " <<
1673     lpsrLyricsDurationsKindAsString (fLpsrLyricsDurationsKindVariable);
1674 
1675   return s.str ();
1676 }
1677 
asActualLongNamedOptionString() const1678 string lilypondLyricsDurationsKindAtom::asActualLongNamedOptionString () const
1679 {
1680   stringstream s;
1681 
1682   s <<
1683     "-" << fLongName << " " <<
1684     lpsrLyricsDurationsKindAsString (fLpsrLyricsDurationsKindVariable);
1685 
1686   return s.str ();
1687 }
1688 
print(ostream & os) const1689 void lilypondLyricsDurationsKindAtom::print (ostream& os) const
1690 {
1691   const int fieldWidth = K_OAH_FIELD_WIDTH;
1692 
1693   os <<
1694     "OptionsLyricsDurationsKindAtom:" <<
1695     endl;
1696 
1697   gIndenter++;
1698 
1699   printValuedAtomEssentials (
1700     os, fieldWidth);
1701 
1702   os << left <<
1703     setw (fieldWidth) <<
1704     "fVariableName" << " : " <<
1705     fVariableName <<
1706     endl <<
1707     setw (fieldWidth) <<
1708     "fLpsrLyricsDurationsKindVariable" << " : \"" <<
1709     lpsrLyricsDurationsKindAsString (
1710       fLpsrLyricsDurationsKindVariable) <<
1711     "\"" <<
1712     endl;
1713 
1714   gIndenter--;
1715 }
1716 
printAtomOptionsValues(ostream & os,int valueFieldWidth) const1717 void lilypondLyricsDurationsKindAtom::printAtomOptionsValues (
1718   ostream& os,
1719   int      valueFieldWidth) const
1720 {
1721   os << left <<
1722     setw (valueFieldWidth) <<
1723     fVariableName <<
1724     " : \"" <<
1725     lpsrLyricsDurationsKindAsString (
1726       fLpsrLyricsDurationsKindVariable) <<
1727     "\"" <<
1728     endl;
1729 }
1730 
operator <<(ostream & os,const S_lilypondLyricsDurationsKindAtom & elt)1731 ostream& operator<< (ostream& os, const S_lilypondLyricsDurationsKindAtom& elt)
1732 {
1733   elt->print (os);
1734   return os;
1735 }
1736 
1737 //_______________________________________________________________________________
1738 S_lilypondOah gLilypondOah;
1739 S_lilypondOah gLilypondOahUserChoices;
1740 S_lilypondOah gLilypondOahWithDetailedTrace;
1741 
create(S_oahHandler handlerUpLink)1742 S_lilypondOah lilypondOah::create (
1743   S_oahHandler handlerUpLink)
1744 {
1745   lilypondOah* o = new lilypondOah (
1746     handlerUpLink);
1747   assert(o!=0);
1748   return o;
1749 }
1750 
lilypondOah(S_oahHandler handlerUpLink)1751 lilypondOah::lilypondOah (
1752   S_oahHandler handlerUpLink)
1753   : oahGroup (
1754       "LilyPond",
1755       "hlily", "help-lilypond",
1756   R"(These lilypond control which LilyPond code is generated.)",
1757       kElementVisibilityAlways,
1758       handlerUpLink)
1759 {
1760   // append this lilypond group to the lilypond handler
1761   // if relevant
1762   if (handlerUpLink) {
1763     handlerUpLink->
1764       appendGroupToHandler (this);
1765   }
1766 
1767   // initialize it
1768   initializeLilypondOah (false);
1769 }
1770 
~lilypondOah()1771 lilypondOah::~lilypondOah ()
1772 {}
1773 
initializeIdentificationOptions(bool boolOptionsInitialValue)1774 void lilypondOah::initializeIdentificationOptions (
1775   bool boolOptionsInitialValue)
1776 {
1777   S_oahSubGroup
1778     subGroup =
1779       oahSubGroup::create (
1780         "Identification",
1781         "hlpi", "help-lilypond-identification",
1782 R"(These options can be used to enforce values in the generated LilyPond code,
1783 thus overriding the ones that may be present in the MSR data.)",
1784       kElementVisibilityAlways,
1785       this);
1786 
1787   appendSubGroupToGroup (subGroup);
1788 
1789   // the 'identification' monoplex string atom
1790 
1791   S_oahMonoplexStringAtom
1792     identificationMonoplexStringAtom =
1793       oahMonoplexStringAtom::create (
1794         "Set variable HEADER_VARIABLE in the \\header in the generated LilyPond code.",
1795         "HEADER_VARIABLE",
1796         "STRING");
1797 
1798   subGroup->
1799     appendAtomToSubGroup (
1800       identificationMonoplexStringAtom);
1801 
1802   // MusicXML informations
1803 
1804   S_oahStringAtom
1805     rightsAtom =
1806       oahStringAtom::create (
1807         "rights", "",
1808 R"(Set the 'rights' to STRING in the LilyPond code \header.)",
1809         "STRING",
1810         "rights",
1811         fRights);
1812   subGroup->
1813     appendAtomToSubGroup (
1814       rightsAtom);
1815   identificationMonoplexStringAtom->
1816     addStringAtom (
1817       rightsAtom);
1818 
1819   S_oahStringAtom
1820     composerAtom =
1821       oahStringAtom::create (
1822         "composer", "",
1823 R"(Set the 'composer' to STRING in the LilyPond code \header.)",
1824         "STRING",
1825         "composer",
1826         fComposer);
1827   subGroup->
1828     appendAtomToSubGroup (
1829       composerAtom);
1830   identificationMonoplexStringAtom->
1831     addStringAtom (
1832       composerAtom);
1833 
1834   S_oahStringAtom
1835     arrangerAtom =
1836       oahStringAtom::create (
1837         "arranger", "",
1838 R"(Set the 'arranger' to STRING in the LilyPond code \header.)",
1839         "STRING",
1840         "arranger",
1841         fArranger);
1842   subGroup->
1843     appendAtomToSubGroup (
1844       arrangerAtom);
1845   identificationMonoplexStringAtom->
1846     addStringAtom (
1847       arrangerAtom);
1848 
1849   S_oahStringAtom
1850     poetAtom =
1851       oahStringAtom::create (
1852         "poet", "",
1853 R"(Set the 'poet' to STRING in the LilyPond code \header.)",
1854         "STRING",
1855         "poet",
1856         fPoet);
1857   subGroup->
1858     appendAtomToSubGroup (
1859       poetAtom);
1860   identificationMonoplexStringAtom->
1861     addStringAtom (
1862       poetAtom);
1863 
1864   S_oahStringAtom
1865     lyricistAtom =
1866       oahStringAtom::create (
1867         "lyricist", "",
1868 R"(Set the 'lyricist' to STRING in the LilyPond code \header.)",
1869         "STRING",
1870         "lyricist",
1871         fLyricist);
1872   subGroup->
1873     appendAtomToSubGroup (
1874       lyricistAtom);
1875   identificationMonoplexStringAtom->
1876     addStringAtom (
1877       lyricistAtom);
1878 
1879   S_oahStringAtom
1880     softwareAtom =
1881       oahStringAtom::create (
1882         "software", "",
1883 R"(Set the 'software' to STRING in the LilyPond code \header.)",
1884         "STRING",
1885         "software",
1886         fSoftware);
1887   subGroup->
1888     appendAtomToSubGroup (
1889       softwareAtom);
1890   identificationMonoplexStringAtom->
1891     addStringAtom (
1892       softwareAtom);
1893 
1894   // LilyPond informations
1895 
1896   S_oahStringAtom
1897     dedicationAtom =
1898       oahStringAtom::create (
1899         "dedication", "",
1900 R"(Set 'dedication' to STRING in the LilyPond code \header.)",
1901         "STRING",
1902         "dedication",
1903         fDedication);
1904   subGroup->
1905     appendAtomToSubGroup (
1906       dedicationAtom);
1907   identificationMonoplexStringAtom->
1908     addStringAtom (
1909       dedicationAtom);
1910 
1911   S_oahStringAtom
1912     pieceAtom =
1913       oahStringAtom::create (
1914         "piece", "",
1915 R"(Set 'piece' to STRING in the LilyPond code \header.)",
1916         "STRING",
1917         "piece",
1918         fPiece);
1919   subGroup->
1920     appendAtomToSubGroup (
1921       pieceAtom);
1922   identificationMonoplexStringAtom->
1923     addStringAtom (
1924       pieceAtom);
1925 
1926   S_oahStringAtom
1927     opusAtom =
1928       oahStringAtom::create (
1929         "opus", "",
1930 R"(Set 'opus' to STRING in the LilyPond code \header.)",
1931         "STRING",
1932         "opus",
1933         fOpus);
1934   subGroup->
1935     appendAtomToSubGroup (
1936       opusAtom);
1937   identificationMonoplexStringAtom->
1938     addStringAtom (
1939       opusAtom);
1940 
1941   S_oahStringAtom
1942     titleAtom =
1943       oahStringAtom::create (
1944         "title", "",
1945 R"(Set 'title' to STRING in the LilyPond code \header.)",
1946         "STRING",
1947         "title",
1948         fTitle);
1949   subGroup->
1950     appendAtomToSubGroup (
1951       titleAtom);
1952   identificationMonoplexStringAtom->
1953     addStringAtom (
1954       titleAtom);
1955 
1956   S_oahStringAtom
1957     subtitleAtom =
1958       oahStringAtom::create (
1959         "subtitle", "",
1960 R"(Set 'subtitle' to STRING in the LilyPond code \header.)",
1961         "STRING",
1962         "subTitle",
1963         fSubTitle);
1964   subGroup->
1965     appendAtomToSubGroup (
1966       subtitleAtom);
1967   identificationMonoplexStringAtom->
1968     addStringAtom (
1969       subtitleAtom);
1970 
1971   S_oahStringAtom
1972     subsubtitleAtom =
1973       oahStringAtom::create (
1974         "subsubtitle", "",
1975 R"(Set 'subsubtitle' to STRING in the LilyPond code \header.)",
1976         "STRING",
1977         "subSubTitle",
1978         fSubSubTitle);
1979   subGroup->
1980     appendAtomToSubGroup (
1981       subsubtitleAtom);
1982   identificationMonoplexStringAtom->
1983     addStringAtom (
1984       subsubtitleAtom);
1985 
1986   S_oahStringAtom
1987     instrumentAtom =
1988       oahStringAtom::create (
1989         "instrument", "",
1990 R"(Set 'instrument' to STRING in the LilyPond code \header.)",
1991         "STRING",
1992         "instrument",
1993         fInstrument);
1994   subGroup->
1995     appendAtomToSubGroup (
1996       instrumentAtom);
1997   identificationMonoplexStringAtom->
1998     addStringAtom (
1999       instrumentAtom);
2000 
2001   S_oahStringAtom
2002     meterAtom =
2003       oahStringAtom::create (
2004         "meter", "",
2005 R"(Set 'meter' to STRING in the LilyPond code \header.)",
2006         "STRING",
2007         "meter",
2008         fMeter);
2009   subGroup->
2010     appendAtomToSubGroup (
2011       meterAtom);
2012   identificationMonoplexStringAtom->
2013     addStringAtom (
2014       meterAtom);
2015 
2016   S_oahStringAtom
2017     taglineAtom =
2018       oahStringAtom::create (
2019         "tagline", "",
2020 R"(Set 'tagline' to STRING in the LilyPond code \header.)",
2021         "STRING",
2022         "tagline",
2023         fTagline);
2024   subGroup->
2025     appendAtomToSubGroup (
2026       taglineAtom);
2027   identificationMonoplexStringAtom->
2028     addStringAtom (
2029       taglineAtom);
2030 
2031   S_oahStringAtom
2032     copyrightAtom =
2033       oahStringAtom::create (
2034         "copyright", "",
2035 R"(Set 'copyright' to STRING in the LilyPond code \header.)",
2036         "STRING",
2037         "copyright",
2038         fCopyright);
2039   subGroup->
2040     appendAtomToSubGroup (
2041       copyrightAtom);
2042   identificationMonoplexStringAtom->
2043     addStringAtom (
2044       copyrightAtom);
2045 }
2046 
initializeEngraversOptions(bool boolOptionsInitialValue)2047 void lilypondOah::initializeEngraversOptions (
2048   bool boolOptionsInitialValue)
2049 {
2050   S_oahSubGroup
2051     subGroup =
2052       oahSubGroup::create (
2053         "Engravers",
2054         "hlpe", "help-lilypond-engravers",
2055 R"()",
2056       kElementVisibilityAlways,
2057       this);
2058 
2059   appendSubGroupToGroup (subGroup);
2060 
2061   // ambitus engraver
2062 
2063   fAmbitusEngraver = boolOptionsInitialValue;
2064 
2065   subGroup->
2066     appendAtomToSubGroup (
2067       oahBooleanAtom::create (
2068         "ambitus", "",
2069 R"(Generate an ambitus range at the beginning of the staves/voices.)",
2070         "ambitusEngraver",
2071         fAmbitusEngraver));
2072 
2073   // custos engraver
2074 
2075   fCustosEngraver = boolOptionsInitialValue;
2076 
2077   subGroup->
2078     appendAtomToSubGroup (
2079       oahBooleanAtom::create (
2080         "custos", "",
2081 R"(Generate custos at the end of the lines.)",
2082         "custosEngraver",
2083         fCustosEngraver));
2084 }
2085 
initializeClefsKeysTimesOptions(bool boolOptionsInitialValue)2086 void lilypondOah::initializeClefsKeysTimesOptions (
2087   bool boolOptionsInitialValue)
2088 {
2089   S_oahSubGroup
2090     subGroup =
2091       oahSubGroup::create (
2092         "Clefs, keys, times",
2093         "hckt", "help-clefs-keys-times",
2094 R"()",
2095       kElementVisibilityAlways,
2096       this);
2097 
2098   appendSubGroupToGroup (subGroup);
2099 
2100   // clefs
2101 
2102   fCommentClefChanges = boolOptionsInitialValue;
2103 
2104   subGroup->
2105     appendAtomToSubGroup (
2106       oahBooleanAtom::create (
2107         "ccc", "comment-clef-changes",
2108 R"(Comment clef changes in the LilyPond code.
2109 They won't show up in the score, but the information is not lost.)",
2110         "commentClefChanges",
2111         fCommentClefChanges));
2112 
2113   // keys
2114 
2115   // times
2116 
2117   fNumericalTime = boolOptionsInitialValue;
2118 
2119   subGroup->
2120     appendAtomToSubGroup (
2121       oahBooleanAtom::create (
2122         "numt", "numerical-time",
2123 R"(Generate numerical time signatures, such as '4/4' instead of 'C'.)",
2124         "numericalTime",
2125         fNumericalTime));
2126 }
2127 
initializeNotesOptions(bool boolOptionsInitialValue)2128 void lilypondOah::initializeNotesOptions (
2129   bool boolOptionsInitialValue)
2130 {
2131   S_oahSubGroup
2132     subGroup =
2133       oahSubGroup::create (
2134         "Notes",
2135         "hlpn", "help-lilypond-notes",
2136 R"()",
2137       kElementVisibilityAlways,
2138       this);
2139 
2140   appendSubGroupToGroup (subGroup);
2141 
2142   // octave entry
2143 
2144   lpsrOctaveEntryKind
2145     octaveEntryKindDefaultValue =
2146       kOctaveEntryAbsolute; // relative is LilyPond's default value
2147   fOctaveEntryKind = octaveEntryKindDefaultValue;
2148 
2149   // leave fOctaveEntrySemiTonesPitchAndOctave equal to nullptr here,
2150   // since \relative without a pitch and absolute octave entry
2151   // can be used in LilyPond, in which case the pitch and actave is:
2152   fSemiTonesPitchAndOctaveDefaultValue = // JMI
2153     msrSemiTonesPitchAndOctave::create (
2154       // F under middle C, LilyPond default for relative octave entry
2155       kF_Natural_STP, 3);
2156 
2157   subGroup->
2158     appendAtomToSubGroup (
2159       lilypondAbsoluteOctaveEntryAtom::create (
2160         "abs", "absolute",
2161 R"(Use absolute octave entry in the generated LilyPond code.)",
2162           "octaveEntryKind",
2163           fOctaveEntryKind));
2164 
2165   subGroup->
2166     appendAtomToSubGroup (
2167       lilypondRelativeOctaveEntryAtom::create (
2168         "rel", "relative",
2169         replaceSubstringInString (
2170 R"(Use relative octave entry reference PITCH_AND_OCTAVE in the generated LilyPond code.
2171 PITCH_AND_OCTAVE is made of a diatonic pitch and an optional sequence of commas or single quotes.
2172 It should be placed between double quotes if it contains single quotes, such as:
2173   -rel "c''".
2174 The default is to use LilyPond's implicit reference 'DEFAULT_VALUE'.)",
2175           "DEFAULT_VALUE",
2176           msrSemiTonesPitchAndOctaveAsLilypondString (
2177             gLpsrOah->fLpsrQuarterTonesPitchesLanguageKind,
2178             fSemiTonesPitchAndOctaveDefaultValue)),
2179         "PITCH_AND_OCTAVE",
2180         "relativeOctaveEntrySemiTonesPitchAndOctave",
2181         fOctaveEntryKind,
2182         fRelativeOctaveEntrySemiTonesPitchAndOctave));
2183 
2184   subGroup->
2185     appendAtomToSubGroup (
2186       lilypondFixedOctaveEntryAtom::create (
2187         "fixed", "",
2188 R"(Use fixed octave entry reference PITCH_AND_OCTAVE in the generated LilyPond code.
2189 PITCH_AND_OCTAVE is made of a diatonic pitch and an optional sequence of commas or single quotes.
2190 It should be placed between double quotes if it contains single quotes, such as:
2191   -fixed "c''")",
2192         "PITCH_AND_OCTAVE",
2193         "fixedOctaveEntrySemiTonesPitchAndOctave",
2194         fOctaveEntryKind,
2195         fFixedOctaveEntrySemiTonesPitchAndOctave));
2196 
2197   // durations
2198 
2199   fAllDurations = boolOptionsInitialValue;
2200 
2201   subGroup->
2202     appendAtomToSubGroup (
2203       oahBooleanAtom::create (
2204         "alldurs", "all-durations",
2205 R"(Generate all LilyPond durations.
2206 By default, a duration equal to preceding one found in the current voice
2207 is omitted for code conciseness.)",
2208         "allDurations",
2209         fAllDurations));
2210 
2211   // stems
2212 
2213   fStems = boolOptionsInitialValue;
2214 
2215   subGroup->
2216     appendAtomToSubGroup (
2217       oahBooleanAtom::create (
2218         "stems", "",
2219 R"(Generate \stemUp and \stemDown LilyPond commands.
2220 By default, LilyPond will take care of that by itself.)",
2221         "stems",
2222         fStems));
2223 
2224   // beaming
2225 
2226   fNoAutoBeaming  = boolOptionsInitialValue;
2227 
2228   subGroup->
2229     appendAtomToSubGroup (
2230       oahBooleanAtom::create (
2231         "noab", "no-auto-beaming",
2232 R"(Generate '\set Staff.autoBeaming = ##f' in each voice
2233 to prevent LilyPond from handling beams automatically.)",
2234         "noAutoBeaming",
2235         fNoAutoBeaming));
2236 
2237   fNoBeams  = boolOptionsInitialValue;
2238 
2239   subGroup->
2240     appendAtomToSubGroup (
2241       oahBooleanAtom::create (
2242         "nbeams", "no-beams",
2243 R"(Don't generate beams in the LilyPond code.
2244 This is handy when the MusicXML data contains beam in vocal voices)",
2245         "noBeams",
2246         fNoBeams));
2247 
2248   // string numbers
2249 
2250   fRomanStringNumbers = boolOptionsInitialValue;
2251 
2252   subGroup->
2253     appendAtomToSubGroup (
2254       oahBooleanAtom::create (
2255         "rsn", "roman-string-numbers",
2256 R"(Generate '\romanStringNumbers' in each voice
2257 for LilyPond to generate roman instead of arabic string numbers.)",
2258         "romanStringNumbers",
2259         fRomanStringNumbers));
2260 
2261   // open strings
2262 
2263   fAvoidOpenStrings    = boolOptionsInitialValue;
2264 
2265   subGroup->
2266     appendAtomToSubGroup (
2267       oahBooleanAtom::create (
2268         "aos", "avoid-open-strings",
2269 R"(Generate '\set TabStaff.restrainOpenStrings = ##t' in each voice
2270 to prevent LilyPond from using open strings.)",
2271         "avoidOpenStrings",
2272         fAvoidOpenStrings));
2273 
2274   // accidentals
2275 
2276   const lpsrAccidentalStyleKind
2277     lpsrAccidentalStyleKindDefaultValue =
2278       kDefault; // default value
2279 
2280   fAccidentalStyleKind = lpsrAccidentalStyleKindDefaultValue;
2281 
2282   subGroup->
2283     appendAtomToSubGroup (
2284       lilypondAccidentalStyleKindAtom::create (
2285         "as", "accidental-style", // JMI
2286           replaceSubstringInString (
2287             replaceSubstringInString (
2288               replaceSubstringInString (
2289 R"(The NUMBER LilyPond accidental styles available are:
2290 ACCIDENTAL_STYLES.
2291 The default is 'DEFAULT_VALUE'.)",
2292               "NUMBER",
2293               to_string (gLpsrAccidentalStyleKindsMap.size ())),
2294             "ACCIDENTAL_STYLES",
2295             existingLpsrAccidentalStyleKinds (K_NAMES_LIST_MAX_LENGTH)),
2296           "DEFAULT_VALUE",
2297           lpsrAccidentalStyleKindAsString (
2298             lpsrAccidentalStyleKindDefaultValue)),
2299         "STYLE",
2300         "accidentalStyleKind",
2301         fAccidentalStyleKind));
2302 
2303   // rest measures
2304 
2305   fCompressFullMeasureRests = boolOptionsInitialValue;
2306 
2307   subGroup->
2308     appendAtomToSubGroup (
2309       oahBooleanAtom::create (
2310         "cfmr", "compress-full-measure-rests",
2311 R"(Compress full measure rests instead of generating successive empty measures.)",
2312         "compressFullMeasureRests",
2313         fCompressFullMeasureRests));
2314 
2315   // input line numbers
2316 
2317   fInputLineNumbers = boolOptionsInitialValue;
2318 
2319   subGroup->
2320     appendAtomToSubGroup (
2321       oahBooleanAtom::create (
2322         "iln", "input-line-numbers",
2323         replaceSubstringInString (
2324 R"(Generate after each note and barline a comment containing
2325 its MusicXML input line number.
2326 This is useful when debugging EXECUTABLE.)",
2327           "EXECUTABLE",
2328           gOahOah->fHandlerExecutableName),
2329         "inputLineNumbers",
2330         fInputLineNumbers));
2331 
2332   // original measure numbers
2333 
2334   fOriginalMeasureNumbers = boolOptionsInitialValue;
2335 
2336   subGroup->
2337     appendAtomToSubGroup (
2338       oahBooleanAtom::create (
2339         "omn", "original-measure-numbers",
2340         replaceSubstringInString (
2341 R"(Generate after each end of measure a comment containing
2342 its original MusicXML measure number.
2343 This is useful for adding line breaks and page breaks, and when debugging EXECUTABLE.)",
2344           "EXECUTABLE",
2345           gOahOah->fHandlerExecutableName),
2346         "originalMeasureNumbers",
2347         fOriginalMeasureNumbers));
2348 
2349   // positions in the measures
2350 
2351   fPositionsInMeasures = boolOptionsInitialValue;
2352 
2353   subGroup->
2354     appendAtomToSubGroup (
2355       oahBooleanAtom::create (
2356         "pim", "positions-in-measures",
2357         replaceSubstringInString (
2358 R"(Generate after each note and barline a comment containing
2359 its position in the measure.
2360 This is useful when debugging EXECUTABLE.)",
2361           "EXECUTABLE",
2362           gOahOah->fHandlerExecutableName),
2363         "positionsInMeasures",
2364         fPositionsInMeasures));
2365 }
2366 
initializeBarsOptions(bool boolOptionsInitialValue)2367 void lilypondOah::initializeBarsOptions (
2368   bool boolOptionsInitialValue)
2369 {
2370   S_oahSubGroup
2371     subGroup =
2372       oahSubGroup::create (
2373         "Bar numbers",
2374         "hlpbn", "help-lilypond-bars-numbers",
2375 R"()",
2376       kElementVisibilityAlways,
2377       this);
2378 
2379   appendSubGroupToGroup (subGroup);
2380 
2381   // all bar numbers
2382 
2383   fShowAllBarNumbers = boolOptionsInitialValue;
2384 
2385   S_oahBooleanAtom
2386     allBarNumbersAtom =
2387       oahBooleanAtom::create (
2388         "abn", "all-bar-numbers",
2389 R"(Generate LilyPond code to show all bar numbers.)",
2390         "showAllBarNumbers",
2391         fShowAllBarNumbers);
2392 
2393   subGroup->
2394     appendAtomToSubGroup (allBarNumbersAtom);
2395 
2396   // all measure numbers
2397 
2398   subGroup->
2399     appendAtomToSubGroup (
2400       oahAtomSynonym::create (
2401         "amn", "all-measure-numbers",
2402 R"(Generate LilyPond code to show all measure numbers.
2403 This option is a synonym to '-abn, -all-bar-numbers'.)",
2404         allBarNumbersAtom));
2405 
2406   // reset measure number
2407 
2408   subGroup->
2409     appendAtomToSubGroup (
2410       oahStringToIntMapAtom::create (
2411         "rmn", "reset-measure-number",
2412 R"(Generate a '\set Score.currentBarNumber = #NEW' command
2413 at the beginning of measure OLD in the LilyPond code.
2414 RESET_NUMBER_SPEC can be:
2415 'OLD = NEW'
2416 or
2417 "OLD = NEW" .
2418 OLD is the MusicXML original measure number (a string), that can be generated
2419 in the LilyPond code in '| % ...' comments with option '-omn, -original-measure-numbers'.
2420 NEW is a LilyPond (integer) measure number.
2421 This comes in handy when scanning several movements from a single PDF score,
2422 in which case measure numbers are a single sequence.
2423 There can be several occurrences of this option.)",
2424         "RESET_NUMBER_SPEC",
2425         "resetMeasureElementMeasureNumberMap",
2426         fResetMeasureElementMeasureNumberMap));
2427 
2428   // generate box around bar number
2429 
2430   S_oahIntSetAtom
2431     generateBoxAroundBarNumber =
2432       oahIntSetAtom::create (
2433         "gbabn", "generate-box-around-bar-number",
2434 R"(Generate a box around LilyPond purist bar number BAR_NUMBER,
2435 where BAR_NUMBER is an integer.
2436 This implies that bar numbers are centered on the bars.
2437 There can be several occurrences of this option.)",
2438         "BAR_NUMBER",
2439         "boxAroundBarNumberSet",
2440         fBoxAroundBarNumberSet);
2441 
2442   subGroup->
2443     appendAtomToSubGroup (generateBoxAroundBarNumber);
2444 }
2445 
initializeLineBreaksOptions(bool boolOptionsInitialValue)2446 void lilypondOah::initializeLineBreaksOptions (
2447   bool boolOptionsInitialValue)
2448 {
2449   S_oahSubGroup
2450     subGroup =
2451       oahSubGroup::create (
2452         "Line breaks",
2453         "hlplb", "help-lilypond-line-breaks",
2454 R"()",
2455       kElementVisibilityAlways,
2456       this);
2457 
2458   appendSubGroupToGroup (subGroup);
2459 
2460   // lines
2461 
2462   fIgnoreMusicXMLLineBreaks = boolOptionsInitialValue;
2463 
2464   subGroup->
2465     appendAtomToSubGroup (
2466       oahBooleanAtom::create (
2467         "imlb", "ignore-musicxml-line-breaks",
2468 R"(Ignore the line breaks from the MusicXML input - let LilyPond decide about them.)",
2469         "ignoreMusicXMLLineBreaks",
2470         fIgnoreMusicXMLLineBreaks));
2471 
2472   fBreakLinesAtIncompleteRightMeasures = boolOptionsInitialValue;
2473 
2474   subGroup->
2475     appendAtomToSubGroup (
2476       oahBooleanAtom::create (
2477         "blairm", "break-lines-at-incomplete-right-measures",
2478 R"(Generate a '\break' command at the end of incomplete right measures
2479 which is handy in popular folk dances and tunes.)",
2480         "breakLinesAtIncompleteRightMeasures",
2481         fBreakLinesAtIncompleteRightMeasures));
2482 
2483   fSeparatorLineEveryNMeasures         = -1;
2484 
2485   subGroup->
2486     appendAtomToSubGroup (
2487       oahIntegerAtom::create (
2488         "slenm", "separator-line-every-n-measures",
2489 R"(Generate an additional separator line for readability every N measures,
2490 where N is a positive integer.
2491 Nothing special is done by default.)",
2492         "N",
2493         "separatorLineEveryNMeasures",
2494         fSeparatorLineEveryNMeasures));
2495 
2496 /* JMI
2497   subGroup->
2498     appendAtomToSubGroup (
2499       oahStringsSetElementAtom::create (
2500         "blamn", "break-line-after-measure-number",
2501 R"(Generate a '\break' command after measure NUMBER in the LilyPond code.
2502 NUMBER is a MusicXML measure number (a string), to be found in the latter.
2503 This comes in handy when scanning several movements from a single PDF score.
2504 There can be several occurrences of this option.)",
2505         "NUMBER",
2506         "breakLineAfterMeasureNumberSet",
2507         fBreakLineAfterMeasureNumberSet));
2508         */
2509 }
2510 
initializePageBreaksOptions(bool boolOptionsInitialValue)2511 void lilypondOah::initializePageBreaksOptions (
2512   bool boolOptionsInitialValue)
2513 {
2514   S_oahSubGroup
2515     subGroup =
2516       oahSubGroup::create (
2517         "Page breaks",
2518         "hlppb", "help-lilypond-page-breaks",
2519 R"()",
2520       kElementVisibilityAlways,
2521       this);
2522 
2523   appendSubGroupToGroup (subGroup);
2524 
2525   // pages
2526 
2527   fIgnoreMusicXMLPageBreaks = boolOptionsInitialValue;
2528 
2529   subGroup->
2530     appendAtomToSubGroup (
2531       oahBooleanAtom::create (
2532         "impb", "ignore-musixcml-page-breaks",
2533 R"(Ignore the page breaks from the MusicXML input - let LilyPond decide about them.)",
2534         "ignoreMusicXMLPageBreaks",
2535         fIgnoreMusicXMLPageBreaks));
2536 
2537   // break page after measure number
2538 
2539 /* JMI
2540   subGroup->
2541     appendAtomToSubGroup (
2542       oahStringsSetElementAtom::create (
2543         "bpamn", "break-page-after-measure-number",
2544 R"(Generate a '\pageBreak' command after measure NUMBER in the LilyPond code.
2545 NUMBER is a MusicXML measure number (a string), to be found in the latter.
2546 This comes in handy when scanning several movements from a single PDF score.
2547 There can be several occurrences of this option.)",
2548         "NUMBER",
2549         "breakPageAfterMeasureNumberSet",
2550         fBreakPageAfterMeasureNumberSet));
2551         */
2552 }
2553 
initializeStavesOptions(bool boolOptionsInitialValue)2554 void lilypondOah::initializeStavesOptions (
2555   bool boolOptionsInitialValue)
2556 {
2557   S_oahSubGroup
2558     subGroup =
2559       oahSubGroup::create (
2560         "Staves",
2561         "hlps", "helpLilypondStaves",
2562 R"()",
2563       kElementVisibilityAlways,
2564       this);
2565 
2566   appendSubGroupToGroup (subGroup);
2567 
2568   // tabs
2569 
2570   fModernTab = boolOptionsInitialValue;
2571 
2572   subGroup->
2573     appendAtomToSubGroup (
2574       oahBooleanAtom::create (
2575         "mtab", "modernTab",
2576 R"(Generate '\moderntab' instead of the default '\tab'.)",
2577         "modernTab",
2578         fModernTab));
2579 
2580   fTabFullNotation = boolOptionsInitialValue;
2581 
2582   subGroup->
2583     appendAtomToSubGroup (
2584       oahBooleanAtom::create (
2585         "tfn", "tabFullNotation",
2586 R"(Generate '\tabFullNotation' to obtain more complete tab notation, including note stems.)",
2587         "tabFullNotation",
2588         fTabFullNotation));
2589 
2590   // staves
2591 
2592   fKeepStaffSize = boolOptionsInitialValue;
2593 
2594   subGroup->
2595     appendAtomToSubGroup (
2596       oahBooleanAtom::create (
2597         "kss", "keep-staff-size",
2598 R"(Use the staff size value found in the MusicXML data.)",
2599         "keepStaffSize",
2600         fKeepStaffSize));
2601 
2602   // ledger lines
2603 
2604   fKeepStaffSize = boolOptionsInitialValue;
2605 
2606   subGroup->
2607     appendAtomToSubGroup (
2608       oahRGBColorAtom::create (
2609         "llc", "ledger-lines-color",
2610 R"(Use RGB_COLOR for the ledger lines.
2611 RGB_COLOR should be of the form 'r,g,b',
2612 with r, g and b being float numbers between 0.0 and 1.0 inclusive.)",
2613         "RGB_COLOR",
2614         "ledgerLinesRGBColor",
2615         fLedgerLinesRGBColor,
2616         fLedgerLinesRGBColorHasBeenSet));
2617 }
2618 
initializeChordsOptions(bool boolOptionsInitialValue)2619 void lilypondOah::initializeChordsOptions (
2620   bool boolOptionsInitialValue)
2621 {
2622   S_oahSubGroup
2623     subGroup =
2624       oahSubGroup::create (
2625         "Chords",
2626         "hlpc", "help-lilypond-chordss",
2627 R"()",
2628       kElementVisibilityAlways,
2629       this);
2630 
2631   appendSubGroupToGroup (subGroup);
2632 
2633   // arpeggios
2634 
2635   fConnectArpeggios = boolOptionsInitialValue;
2636 
2637   subGroup->
2638     appendAtomToSubGroup (
2639       oahBooleanAtom::create (
2640         "conarp", "connect-arpeggios",
2641 R"(Connect arpeggios across piano staves.)",
2642         "connectArpeggios",
2643         fConnectArpeggios));
2644 }
2645 
initializeTupletsOptions(bool boolOptionsInitialValue)2646 void lilypondOah::initializeTupletsOptions (
2647   bool boolOptionsInitialValue)
2648 {
2649   S_oahSubGroup
2650     subGroup =
2651       oahSubGroup::create (
2652         "Tuplets",
2653         "hlpt", "help-lilypond-tuplets",
2654 R"()",
2655       kElementVisibilityAlways,
2656       this);
2657 
2658   appendSubGroupToGroup (subGroup);
2659 
2660   // tuplets
2661 
2662   fIndentTuplets = boolOptionsInitialValue;
2663 
2664   subGroup->
2665     appendAtomToSubGroup (
2666       oahBooleanAtom::create (
2667         "itups", "indent-tuplets",
2668 R"(Indent tuplets notes on a line of their own,
2669 instead of keeping the on one and the same line.)",
2670         "indentTuplets",
2671         fIndentTuplets));
2672 }
2673 
initializeRepeatOptions(bool boolOptionsInitialValue)2674 void lilypondOah::initializeRepeatOptions (
2675   bool boolOptionsInitialValue)
2676 {
2677   S_oahSubGroup
2678     subGroup =
2679       oahSubGroup::create (
2680         "Repeats",
2681         "hlpr", "help-lilypond-repeats",
2682 R"()",
2683       kElementVisibilityAlways,
2684       this);
2685 
2686   appendSubGroupToGroup (subGroup);
2687 
2688   // repeats
2689 
2690   fKeepRepeatBarlines = boolOptionsInitialValue;
2691 
2692   subGroup->
2693     appendAtomToSubGroup (
2694       oahBooleanAtom::create (
2695         "krbs", "keep-repeat-barlines",
2696 R"(Generate repeats start and and bar lines even though LilyPond would take care of them.)",
2697         "keepRepeatBarlines",
2698         fKeepRepeatBarlines));
2699 
2700   fRepeatBrackets = boolOptionsInitialValue;
2701 
2702   subGroup->
2703     appendAtomToSubGroup (
2704       oahBooleanAtom::create (
2705         "rbracks", "repeat-brackets",
2706 R"(Generate repeats with brackets instead of regular bar lines.)",
2707         "repeatBrackets",
2708         fRepeatBrackets));
2709 
2710   fIgnoreRepeatNumbers = boolOptionsInitialValue;
2711 
2712   subGroup->
2713     appendAtomToSubGroup (
2714       oahBooleanAtom::create (
2715         "irn", "ignore-repeat-numbers",
2716 R"(Ignore repeats numbers and let LilyPond determine them.)",
2717         "ignoreRepeatNumbers",
2718         fIgnoreRepeatNumbers));
2719 }
2720 
initializeOrnamentsOptions(bool boolOptionsInitialValue)2721 void lilypondOah::initializeOrnamentsOptions (
2722   bool boolOptionsInitialValue)
2723 {
2724   S_oahSubGroup
2725     subGroup =
2726       oahSubGroup::create (
2727         "Ornaments",
2728         "hlporns", "help-lilypond-ornaments",
2729 R"()",
2730       kElementVisibilityAlways,
2731       this);
2732 
2733   appendSubGroupToGroup (subGroup);
2734 
2735   // ornaments
2736 
2737   fDelayedOrnamentsFraction = rational (1, 2);
2738 
2739   string delayedOrnamentsFractionDefaultValue =
2740     to_string (fDelayedOrnamentsFraction.getNumerator ()) +
2741       "/" +
2742     to_string (fDelayedOrnamentsFraction.getDenominator ());
2743 
2744   subGroup->
2745     appendAtomToSubGroup (
2746       oahRationalAtom::create (
2747         "dof", "delayed-ornaments-fraction",
2748         replaceSubstringInString (
2749 R"(Place the delayed turn/reverseturn at the given fraction
2750 between the ornemented note and the next one.
2751 The default is 'DEFAULT_VALUE'.)",
2752           "DEFAULT_VALUE",
2753           delayedOrnamentsFractionDefaultValue),
2754         "NUM/DENOM",
2755         "delayedOrnamentsFraction",
2756         fDelayedOrnamentsFraction));
2757 }
2758 
initializeChordsDisplayOptions(bool boolOptionsInitialValue)2759 void lilypondOah::initializeChordsDisplayOptions (
2760   bool boolOptionsInitialValue)
2761 {
2762   S_oahSubGroup
2763     subGroup =
2764       oahSubGroup::create (
2765         "Chords display",
2766         "hchd", "help-chords-display",
2767 R"()",
2768       kElementVisibilityAlways,
2769       this);
2770 
2771   appendSubGroupToGroup (subGroup);
2772 
2773   // chords
2774 
2775   subGroup->
2776     appendAtomToSubGroup (
2777       lilypondChordsDisplayAtom::create (
2778         "chd", "chords-display",
2779 /*
2780 Including a closing parenthesis in a raw string:
2781   choose ### as the delimiter so only )###" ends the string:
2782     R"###(
2783         Some Text)"
2784     )###";
2785 */
2786 R"###(Use SPECIFICATION to display chords using LilyPond's chordNameExceptions.
2787 SPECIFICATION should contain a chord contents such as '<c ees ges bes>',
2788 followed by code to display it, for example:
2789   '<c ees ges bes> \\super {"-7(" {\\small\\raise #0.5 \\flat} "5)"}'.
2790 The LilyPond code has to escape backslashed, thus use '\\' to obtain '\'.
2791 These two elements are passed over to LilyPond verbatim, without any check.
2792 This option can be used any number of times.)###",
2793         "SPECIFICATION",
2794         "chordsDisplayList",
2795         fChordsDisplayList));
2796 
2797   fJazzChordsDisplay = boolOptionsInitialValue;
2798 
2799   fJazzChordsDisplayLilypondcode =
2800 R"###(  <c ees ges bes>1-\markup { \super {"-7(" {\small\raise #0.5 \flat} "5)"} }
2801   <c e g bes>1-\markup { \super "7" }
2802   <c e gis bes>1-\markup { \super {"7(" {\small\raise #0.5 \sharp} "5)"} }
2803   <c f g bes>1-\markup { \super {"7(sus4)"} }
2804   <c e g a d'>1-\markup { \super "6/9" }
2805   <c e g bes des'>1-\markup { \super {"7(" {\small\raise #0.5 \flat} "9)"} }
2806   <c f g bes d'>1-\markup { \super {"9(sus4)"} }
2807   <c e g bes d'>1-\markup { \super "9" }
2808   <c e g b d'>1-\markup { \super "maj9" }
2809   <c e gis bes d'>1-\markup { \super "9+" }
2810   <c e g bes d' fis'>1-\markup { \super "9#11" }
2811   <c e g bes d' f'>1-\markup { \super "11" }
2812   <c e g bes d' a'>1-\markup { \super "13" }
2813   <c e g bes d' fis' a'>1-\markup { \super {"13(" {\small\raise #0.5 \sharp} "11)"} }
2814   <c e g a d'>1-\markup { \super "6(add9)" })###";
2815 
2816   subGroup->
2817     appendAtomToSubGroup (
2818       oahBooleanAtom::create (
2819         "jchd", "jazz-chords-display",
2820         replaceSubstringInString (
2821 R"(Display the chords using LilyPond's chordNameExceptions
2822 and a set of standard specifications to display them, i.e.:
2823 LILYPOND_CODE)",
2824           "LILYPOND_CODE",
2825           fJazzChordsDisplayLilypondcode),
2826         "jazzChordsDisplay",
2827         fJazzChordsDisplay));
2828 }
2829 
initializeLyricsOptions(bool boolOptionsInitialValue)2830 void lilypondOah::initializeLyricsOptions (
2831   bool boolOptionsInitialValue)
2832 {
2833   S_oahSubGroup
2834     subGroup =
2835       oahSubGroup::create (
2836         "Lyrics",
2837         "hlyrics", "help-lyrics",
2838 R"()",
2839       kElementVisibilityAlways,
2840       this);
2841 
2842   appendSubGroupToGroup (subGroup);
2843 
2844   // lyrics alignment
2845 
2846   const lpsrLyricsDurationsKind
2847     lpsrLyricsDurationsKindDefaultValue =
2848       kLyricsDurationsExplicit; // default value
2849 
2850   fLyricsDurationsKind = lpsrLyricsDurationsKindDefaultValue;
2851 
2852   subGroup->
2853     appendAtomToSubGroup (
2854       lilypondLyricsDurationsKindAtom::create (
2855         "ld", "lyrics-durations", // JMI
2856           replaceSubstringInString (
2857             replaceSubstringInString (
2858               replaceSubstringInString (
2859 R"(The NUMBER LilyPond lyrics durations STYLEs available are:
2860 LYRICS_DURATIONS_KINDS.
2861 Using 'implicit' prevents the creation of lyrics attached to rests by LilyPond,
2862 use 'explicit' in such cases.
2863 The default is 'DEFAULT_VALUE'.)",
2864               "NUMBER",
2865               to_string (gLpsrLyricsDurationsKindsMap.size ())),
2866             "LYRICS_DURATIONS_KINDS",
2867             existingLpsrLyricsDurationsKinds (K_NAMES_LIST_MAX_LENGTH)),
2868           "DEFAULT_VALUE",
2869           lpsrLyricsDurationsKindAsString (
2870             lpsrLyricsDurationsKindDefaultValue)),
2871         "STYLE",
2872         "lyricsDurationsKind",
2873         fLyricsDurationsKind));
2874 }
2875 
initializeFontsOptions(bool boolOptionsInitialValue)2876 void lilypondOah::initializeFontsOptions (
2877   bool boolOptionsInitialValue)
2878 {
2879   S_oahSubGroup
2880     subGroup =
2881       oahSubGroup::create (
2882         "Fonts",
2883         "hfonts", "help-fonts",
2884 R"()",
2885       kElementVisibilityAlways,
2886       this);
2887 
2888   appendSubGroupToGroup (subGroup);
2889 
2890   // fonts
2891 
2892   fJazzFonts = boolOptionsInitialValue;
2893 
2894   subGroup->
2895     appendAtomToSubGroup (
2896       oahBooleanAtom::create (
2897         "jazz", "jazz-fonts",
2898 R"(Use the LilyJazz font for notes, braces, text and chords.
2899 It can be downloaded from https://github.com/OpenLilyPondFonts/lilyjazz.
2900 This font should be installed so that LilyPond can use it, see:
2901 https://github.com/OpenLilyPondFonts/lilyjazz/blob/master/LilyPond-Fonts-Installation-And-Usage.txt.)",
2902         "jazzFonts",
2903         fJazzFonts));
2904 }
2905 
initializeCodeGenerationOptions(bool boolOptionsInitialValue)2906 void lilypondOah::initializeCodeGenerationOptions (
2907   bool boolOptionsInitialValue)
2908 {
2909   S_oahSubGroup
2910     subGroup =
2911       oahSubGroup::create (
2912         "Code generation",
2913         "hlpcg", "help-lilypond-code-generation",
2914 R"()",
2915       kElementVisibilityAlways,
2916       this);
2917 
2918   appendSubGroupToGroup (subGroup);
2919 
2920   // infos
2921 
2922   fXml2lyInfos = boolOptionsInitialValue;
2923 
2924   subGroup->
2925     appendAtomToSubGroup (
2926       oahBooleanAtom::create (
2927         "xi", "xml2ly-infos",
2928 R"(Generate initial comments showing the compilation date and lilypond.)",
2929         "xml2lyInfos",
2930         fXml2lyInfos));
2931 
2932   // comments
2933 
2934   fComments = boolOptionsInitialValue;
2935 
2936   subGroup->
2937     appendAtomToSubGroup (
2938       oahBooleanAtom::create (
2939         "com", "comments",
2940 R"(Generate comments showing the structure of the score
2941 such as '% part P_POne (P1).)",
2942         "comments",
2943         fComments));
2944 
2945   fGlobal = boolOptionsInitialValue;
2946 
2947   subGroup->
2948     appendAtomToSubGroup (
2949       oahBooleanAtom::create (
2950         "global", "",
2951 R"(Generate a 'global' empty variable and place a use of it
2952 at the beginning of all voices.)",
2953         "global",
2954         fGlobal));
2955 
2956   // display music
2957 
2958   fDisplayMusic = boolOptionsInitialValue;
2959 
2960   subGroup->
2961     appendAtomToSubGroup (
2962       oahBooleanAtom::create (
2963         "dm", "display-music",
2964 R"(Place the contents of all voices inside a '\displayMusic' block,
2965 for LilyPond to show its internal representation of the music.)",
2966         "displayMusic",
2967         fDisplayMusic));
2968 
2969   // LilyPond code
2970 
2971   fNoLilypondCode = boolOptionsInitialValue;
2972 
2973   subGroup->
2974     appendAtomToSubGroup (
2975       oahBooleanAtom::create (
2976         "nolpc", "no-lilypond-code",
2977 R"(Don't generate any LilyPond code.
2978 That can be useful if only a summary of the score is needed.)",
2979         "noLilypondCode",
2980         fNoLilypondCode));
2981 
2982   // LilyPond lyrics
2983 
2984   fNoLilypondLyrics = boolOptionsInitialValue;
2985 
2986   subGroup->
2987     appendAtomToSubGroup (
2988       oahBooleanAtom::create (
2989         "nolpl", "no-lilypond-lyrics",
2990 R"(Don't generate any lyrics in the LilyPond code.)",
2991         "noLilypondLyrics",
2992         fNoLilypondLyrics));
2993 
2994   // compile date
2995 
2996   fLilypondCompileDate = boolOptionsInitialValue;
2997 
2998   subGroup->
2999     appendAtomToSubGroup (
3000       oahBooleanAtom::create (
3001         "lpcd", "lilypond-compile-date",
3002 R"(Generate code to include the compilation date
3003 when LilyPond creates the score.)",
3004         "lilypondCompileDate",
3005         fLilypondCompileDate));
3006 
3007   // draft mode
3008 
3009   fDraftMode = boolOptionsInitialValue;
3010 
3011   S_oahBooleanAtom
3012     draftOahBooleanAtom =
3013       oahBooleanAtom::create (
3014         "draft", "draft-mode",
3015 R"(Generate a difficult to use score
3016 to get only an overview in the resulting PDF file.)",
3017         "draftMode",
3018         fDraftMode);
3019   draftOahBooleanAtom->
3020     setIsHidden ();
3021 
3022   subGroup->
3023     appendAtomToSubGroup (
3024       draftOahBooleanAtom);
3025 
3026   // point and click
3027 
3028   fPointAndClickOff = boolOptionsInitialValue;
3029 
3030   subGroup->
3031     appendAtomToSubGroup (
3032       oahBooleanAtom::create (
3033         "paco", "point-and-clic-off",
3034 R"(Generate \pointAndClickOff at the beginning of the LilyPond code
3035 to reduce the size of the resulting PDF file.)",
3036         "pointAndClickOff",
3037         fPointAndClickOff));
3038 
3039   // white note heads
3040 
3041   fWhiteNoteHeads = boolOptionsInitialValue;
3042 
3043   subGroup->
3044     appendAtomToSubGroup (
3045       oahBooleanAtom::create (
3046         "wnh", "white-note-heads",
3047 R"(Generate Scheme function 'whiteNoteHeads'
3048 at the beginning of the LilyPond code.)",
3049         "whiteNoteHeads",
3050         fWhiteNoteHeads));
3051 }
3052 
initializeScoreNotationOptions(bool boolOptionsInitialValue)3053 void lilypondOah::initializeScoreNotationOptions (
3054   bool boolOptionsInitialValue)
3055 {
3056   S_oahSubGroup
3057     subGroup =
3058       oahSubGroup::create (
3059         "Score notation",
3060         "hlpsn", "help-lilypond-score-notation",
3061 R"()",
3062       kElementVisibilityAlways,
3063       this);
3064 
3065   appendSubGroupToGroup (subGroup);
3066 
3067   // score notation
3068 
3069 //  fScoreNotationKind =  lilypondOah::kWesternNotation;
3070     // default value
3071 
3072   fJianpu = false;
3073 
3074   subGroup->
3075     appendAtomToSubGroup (
3076       oahBooleanAtom::create (
3077         "jianpu", "",
3078 R"(Generate the score using jianpu (numbered) notation
3079 instead of the default western notation.
3080 That option needs lilypond-Jianpu to be accessible to LilyPond
3081 (https://github.com/nybbs2003/lilypond-Jianpu/jianpu10a.ly).)",
3082         "jianpu",
3083         fJianpu));
3084 }
3085 
initializeMidiOptions(bool boolOptionsInitialValue)3086 void lilypondOah::initializeMidiOptions (
3087   bool boolOptionsInitialValue)
3088 {
3089   S_oahSubGroup
3090     subGroup =
3091       oahSubGroup::create (
3092         "Midi",
3093         "hlpm", "help-lilypond-midi",
3094 R"()",
3095       kElementVisibilityAlways,
3096       this);
3097 
3098   appendSubGroupToGroup (subGroup);
3099 
3100   // midiTempo
3101 
3102   string midiTempoDuration  = "4";
3103   int    midiTempoPerSecond = 90;
3104 
3105   fMidiTempo.setMidiTempoDuration (midiTempoDuration);
3106   fMidiTempo.setMidiTempoPerSecond (midiTempoPerSecond);
3107 
3108   string midiTempoDefaultValue =
3109     midiTempoDuration + " = " + to_string (midiTempoPerSecond);
3110 
3111   subGroup->
3112     appendAtomToSubGroup (
3113       oahMidiTempoAtom::create (
3114         "mtempo", "midi-tempo",
3115         replaceSubstringInString (
3116           replaceSubstringInString (
3117 R"(Generate a '\tempo' command in the \midi block.
3118 MIDI_TEMPO_SPEC can be:
3119 'DURATION = PER_SECOND'
3120 or
3121 "DURATION = PER_SECOND" .
3122 DURATION is a string such as '8.', and PER_SECOND is an integer.
3123 The single or double quotes are used to allow spaces around the '=' sign,
3124 otherwise they can be dispensed with.
3125 Using double quotes allows for shell variables substitutions, as in:
3126 PER_SECOND=66
3127 EXECUTABLE -midiTempo "8. ${PER_SECOND}" .
3128 The default is 'DEFAULT_VALUE'.)",
3129             "EXECUTABLE",
3130             gOahOah->fHandlerExecutableName),
3131           "DEFAULT_VALUE",
3132           midiTempoDefaultValue),
3133         "MIDI_TEMPO_SPEC",
3134         "midiTempo",
3135         fMidiTempo));
3136 
3137   // noMidi
3138 
3139   fNoMidi = boolOptionsInitialValue;
3140 
3141   subGroup->
3142     appendAtomToSubGroup (
3143       oahBooleanAtom::create (
3144         "no-midi", "",
3145 R"(Generate the '\midi' block as a comment instead of active code.)",
3146         "noMidi",
3147         fNoMidi));
3148 }
3149 
initializeLilypondOah(bool boolOptionsInitialValue)3150 void lilypondOah::initializeLilypondOah (
3151   bool boolOptionsInitialValue)
3152 {
3153   // identification
3154   // --------------------------------------
3155   initializeIdentificationOptions (
3156     boolOptionsInitialValue);
3157 
3158   // engravers
3159   // --------------------------------------
3160   initializeEngraversOptions (
3161     boolOptionsInitialValue);
3162 
3163   // time
3164   // --------------------------------------
3165   initializeClefsKeysTimesOptions (
3166     boolOptionsInitialValue);
3167 
3168   // notes
3169   // --------------------------------------
3170   initializeNotesOptions (
3171     boolOptionsInitialValue);
3172 
3173   // bars
3174   // --------------------------------------
3175   initializeBarsOptions (
3176     boolOptionsInitialValue);
3177 
3178   // line breaks
3179   // --------------------------------------
3180   initializeLineBreaksOptions (
3181     boolOptionsInitialValue);
3182 
3183   // page breaks
3184   // --------------------------------------
3185   initializePageBreaksOptions (
3186     boolOptionsInitialValue);
3187 
3188   // staves
3189   // --------------------------------------
3190   initializeStavesOptions (
3191     boolOptionsInitialValue);
3192 
3193   // chords
3194   // --------------------------------------
3195   initializeChordsOptions (
3196     boolOptionsInitialValue);
3197 
3198   // tuplets
3199   // --------------------------------------
3200   initializeTupletsOptions (
3201     boolOptionsInitialValue);
3202 
3203   // repeats
3204   // --------------------------------------
3205   initializeRepeatOptions (
3206     boolOptionsInitialValue);
3207 
3208   // ornaments
3209   // --------------------------------------
3210   initializeOrnamentsOptions (
3211     boolOptionsInitialValue);
3212 
3213   // chords display
3214   // --------------------------------------
3215   initializeChordsDisplayOptions (
3216     boolOptionsInitialValue);
3217 
3218   // lyrics
3219   // --------------------------------------
3220   initializeLyricsOptions (
3221     boolOptionsInitialValue);
3222 
3223   // fonts
3224   // --------------------------------------
3225   initializeFontsOptions (
3226     boolOptionsInitialValue);
3227 
3228   // code generation
3229   // --------------------------------------
3230   initializeCodeGenerationOptions (
3231     boolOptionsInitialValue);
3232 
3233   // score notation
3234   // --------------------------------------
3235   initializeScoreNotationOptions (
3236     boolOptionsInitialValue);
3237 
3238   // midi
3239   // --------------------------------------
3240   initializeMidiOptions (
3241     boolOptionsInitialValue);
3242 }
3243 
createCloneWithDetailedTrace()3244 S_lilypondOah lilypondOah::createCloneWithDetailedTrace ()
3245 {
3246   S_lilypondOah
3247     clone =
3248       lilypondOah::create (0);
3249       // 0 not to have it inserted twice in the option handler
3250 
3251   // set the lilypond handler upLink
3252   clone->fHandlerUpLink =
3253     fHandlerUpLink;
3254 
3255   // identification
3256   // --------------------------------------
3257 
3258   // MusicXML informations
3259   clone->fRights =
3260     fRights;
3261   clone->fComposer =
3262     fComposer;
3263   clone->fArranger =
3264     fArranger;
3265   clone->fPoet =
3266     fPoet;
3267   clone->fLyricist =
3268     fLyricist;
3269   clone->fSoftware =
3270     fSoftware;
3271 
3272   // LilyPond informations
3273   clone->fDedication =
3274     fDedication;
3275   clone->fPiece =
3276     fPiece;
3277   clone->fOpus =
3278     fOpus;
3279   clone->fTitle =
3280     fTitle;
3281   clone->fSubTitle =
3282     fSubTitle;
3283   clone->fSubSubTitle =
3284     fSubSubTitle;
3285   clone->fInstrument =
3286     fInstrument;
3287   clone->fMeter =
3288     fMeter;
3289   clone->fTagline =
3290     fTagline;
3291   clone->fCopyright =
3292     fCopyright;
3293 
3294 
3295   // engravers
3296   // --------------------------------------
3297 
3298   clone->fAmbitusEngraver =
3299     fAmbitusEngraver;
3300   clone->fCustosEngraver =
3301     fCustosEngraver;
3302 
3303 
3304   // clefs
3305   // --------------------------------------
3306 
3307   clone->fCommentClefChanges =
3308     fCommentClefChanges;
3309 
3310 
3311   // times
3312   // --------------------------------------
3313 
3314   clone->fNumericalTime =
3315     fNumericalTime;
3316 
3317 
3318   // notes
3319   // --------------------------------------
3320 
3321   clone->fOctaveEntryKind =
3322     fOctaveEntryKind;
3323 
3324   clone->fAllDurations =
3325     fAllDurations;
3326 
3327   clone->fStems =
3328     fStems;
3329 
3330   clone->fNoAutoBeaming =
3331     fNoAutoBeaming;
3332   clone->fNoBeams =
3333     fNoBeams;
3334 
3335   clone->fRomanStringNumbers =
3336     fRomanStringNumbers;
3337   clone->fAvoidOpenStrings =
3338     fAvoidOpenStrings;
3339 
3340   clone->fAccidentalStyleKind =
3341     fAccidentalStyleKind;
3342 
3343   clone->fCompressFullMeasureRests =
3344     fCompressFullMeasureRests;
3345 
3346   clone->fInputLineNumbers =
3347     true;
3348   clone->fOriginalMeasureNumbers =
3349     true;
3350   clone->fPositionsInMeasures =
3351     true;
3352 
3353 
3354   // bars and measures
3355   // --------------------------------------
3356 
3357   clone->fShowAllBarNumbers =
3358     true;
3359 
3360   clone->fBoxAroundBarNumberSet =
3361     fBoxAroundBarNumberSet;
3362 
3363 
3364   // line breaks
3365   // --------------------------------------
3366 
3367   clone->fIgnoreMusicXMLLineBreaks =
3368     fIgnoreMusicXMLLineBreaks;
3369 
3370   clone->fBreakLinesAtIncompleteRightMeasures =
3371     fBreakLinesAtIncompleteRightMeasures;
3372 
3373   clone->fSeparatorLineEveryNMeasures =
3374     fSeparatorLineEveryNMeasures;
3375 
3376 
3377   // page breaks
3378   // --------------------------------------
3379 
3380   clone->fIgnoreMusicXMLPageBreaks =
3381     fIgnoreMusicXMLPageBreaks;
3382 
3383 
3384   // staves
3385   // --------------------------------------
3386 
3387   clone->fModernTab =
3388     fModernTab;
3389 
3390   clone->fTabFullNotation =
3391     fTabFullNotation;
3392 
3393 
3394   // chords
3395   // --------------------------------------
3396 
3397   clone->fConnectArpeggios =
3398     fConnectArpeggios;
3399 
3400 
3401   // tuplets
3402   // --------------------------------------
3403 
3404   clone->fIndentTuplets =
3405     fIndentTuplets;
3406 
3407 
3408   // repeats
3409   // --------------------------------------
3410 
3411   clone->fKeepRepeatBarlines =
3412     fKeepRepeatBarlines;
3413   clone->fRepeatBrackets =
3414     fRepeatBrackets;
3415   clone->fIgnoreRepeatNumbers =
3416     fIgnoreRepeatNumbers;
3417 
3418 
3419   // ornaments
3420   // --------------------------------------
3421 
3422   clone->fDelayedOrnamentsFraction =
3423     fDelayedOrnamentsFraction;
3424 
3425 
3426   // chords display
3427   // --------------------------------------
3428 
3429   clone->fJazzChordsDisplay =
3430     fJazzChordsDisplay;
3431   clone->fJazzChordsDisplayLilypondcode =
3432     fJazzChordsDisplayLilypondcode;
3433 
3434 
3435   // fonts
3436   // --------------------------------------
3437 
3438   clone->fJazzFonts =
3439     fJazzFonts;
3440 
3441 
3442   // code generation
3443   // --------------------------------------
3444 
3445   clone->fXml2lyInfos =
3446     fXml2lyInfos;
3447 
3448   clone->fComments =
3449     fComments;
3450 
3451   clone->fGlobal =
3452     fGlobal;
3453 
3454   clone->fDisplayMusic =
3455     fDisplayMusic;
3456 
3457   clone->fNoLilypondCode =
3458     fNoLilypondCode;
3459 
3460   clone->fNoLilypondLyrics =
3461     fNoLilypondLyrics;
3462 
3463   clone->fLilypondCompileDate =
3464     fLilypondCompileDate;
3465 
3466   clone->fDraftMode =
3467     fPointAndClickOff;
3468 
3469   clone->fPointAndClickOff =
3470     fPointAndClickOff;
3471 
3472   clone->fWhiteNoteHeads =
3473     fWhiteNoteHeads;
3474 
3475 
3476   // score notation
3477   // --------------------------------------
3478 
3479   clone->fJianpu =
3480     fJianpu;
3481 
3482 
3483   // lyrics
3484   // --------------------------------------
3485 
3486   clone->fLyricsDurationsKind =
3487     fLyricsDurationsKind;
3488 
3489 
3490   // midi
3491   // --------------------------------------
3492 
3493   clone->fMidiTempo =
3494     fMidiTempo;
3495 
3496   clone->fNoMidi =
3497     fNoMidi;
3498 
3499 // JMI ???
3500 
3501   clone->fKeepStaffSize =
3502     fKeepStaffSize;
3503 
3504   return clone;
3505 }
3506 
3507 /* JMI
3508 bool lilypondOah::setAccidentalStyleKind (lpsrAccidentalStyleKind accidentalStyleKind)
3509 {
3510   // is accidentalStyleKind in the accidental styles set?
3511   map<string, lpsrAccidentalStyleKind>::const_iterator
3512     it =
3513       gLpsrAccidentalStyleKindsMap.find (accidentalStyleKind);
3514 
3515   if (it == gLpsrAccidentalStyleKindsMap.end ()) {
3516     // no, accidentalStyleKind is unknown
3517     return false;
3518   }
3519 
3520   fAccidentalStyleKind = it.second;
3521 
3522   return true;
3523 }
3524 */
3525 
3526 //______________________________________________________________________________
enforceQuietness()3527 void lilypondOah::enforceQuietness ()
3528 {}
3529 
3530 //______________________________________________________________________________
checkOptionsConsistency()3531 void lilypondOah::checkOptionsConsistency ()
3532 {
3533   // JMI
3534 }
3535 
3536 //______________________________________________________________________________
acceptIn(basevisitor * v)3537 void lilypondOah::acceptIn (basevisitor* v)
3538 {
3539 #ifdef TRACE_OAH
3540   if (gOahOah->fTraceOahVisitors) {
3541     gLogOstream <<
3542       ".\\\" ==> lilypondOah::acceptIn ()" <<
3543       endl;
3544   }
3545 #endif
3546 
3547   if (visitor<S_lilypondOah>*
3548     p =
3549       dynamic_cast<visitor<S_lilypondOah>*> (v)) {
3550         S_lilypondOah elem = this;
3551 
3552 #ifdef TRACE_OAH
3553         if (gOahOah->fTraceOahVisitors) {
3554           gLogOstream <<
3555             ".\\\" ==> Launching lilypondOah::visitStart ()" <<
3556             endl;
3557         }
3558 #endif
3559         p->visitStart (elem);
3560   }
3561 }
3562 
acceptOut(basevisitor * v)3563 void lilypondOah::acceptOut (basevisitor* v)
3564 {
3565 #ifdef TRACE_OAH
3566   if (gOahOah->fTraceOahVisitors) {
3567     gLogOstream <<
3568       ".\\\" ==> lilypondOah::acceptOut ()" <<
3569       endl;
3570   }
3571 #endif
3572 
3573   if (visitor<S_lilypondOah>*
3574     p =
3575       dynamic_cast<visitor<S_lilypondOah>*> (v)) {
3576         S_lilypondOah elem = this;
3577 
3578 #ifdef TRACE_OAH
3579         if (gOahOah->fTraceOahVisitors) {
3580           gLogOstream <<
3581             ".\\\" ==> Launching lilypondOah::visitEnd ()" <<
3582             endl;
3583         }
3584 #endif
3585         p->visitEnd (elem);
3586   }
3587 }
3588 
browseData(basevisitor * v)3589 void lilypondOah::browseData (basevisitor* v)
3590 {
3591 #ifdef TRACE_OAH
3592   if (gOahOah->fTraceOahVisitors) {
3593     gLogOstream <<
3594       ".\\\" ==> lilypondOah::browseData ()" <<
3595       endl;
3596   }
3597 #endif
3598 }
3599 
3600 //______________________________________________________________________________
scoreNotationKindAsString(scoreNotationKind notationKind)3601 string lilypondOah::scoreNotationKindAsString (
3602   scoreNotationKind notationKind)
3603 {
3604   string result;
3605 
3606   switch (notationKind) {
3607     case lilypondOah::kWesternNotation:
3608       result = "western";
3609       break;
3610     case lilypondOah::kJianpuNotation:
3611       result = "jianpu";
3612       break;
3613     case lilypondOah::kABCNotation:
3614       result = "abc";
3615       break;
3616   } // switch
3617 
3618   return result;
3619 }
3620 
printAtomOptionsValues(ostream & os,int valueFieldWidth) const3621 void lilypondOah::printAtomOptionsValues (
3622   ostream& os,
3623   int      valueFieldWidth) const
3624 {
3625   os <<
3626     "The LilyPond lilypond are:" <<
3627     endl;
3628 
3629   gIndenter++;
3630 
3631   // identification
3632   // --------------------------------------
3633   os <<
3634     "Identification:" <<
3635     endl;
3636 
3637   gIndenter++;
3638 
3639   // MusicXML informations
3640   os << left <<
3641     setw (valueFieldWidth) << "rights" << " : " <<
3642       fRights <<
3643       endl <<
3644 
3645     setw (valueFieldWidth) << "composer" << " : " <<
3646       fComposer <<
3647       endl <<
3648     setw (valueFieldWidth) << "arranger" << " : " <<
3649       fArranger <<
3650       endl <<
3651     setw (valueFieldWidth) << "poet" << " : " <<
3652       fPoet <<
3653       endl <<
3654     setw (valueFieldWidth) << "lyricist" << " : " <<
3655       fLyricist <<
3656       endl <<
3657 
3658     setw (valueFieldWidth) << "software" << " : " <<
3659       fSoftware <<
3660       endl <<
3661 
3662   // LilyPond informations
3663     setw (valueFieldWidth) << "dedication" << " : " <<
3664       fDedication <<
3665       endl <<
3666 
3667     setw (valueFieldWidth) << "piece" << " : " <<
3668       fPiece <<
3669       endl <<
3670     setw (valueFieldWidth) << "opus" << " : " <<
3671       fOpus <<
3672       endl <<
3673 
3674     setw (valueFieldWidth) << "title" << " : " <<
3675       fTitle <<
3676       endl <<
3677     setw (valueFieldWidth) << "subTitle" << " : " <<
3678       fSubTitle <<
3679       endl <<
3680     setw (valueFieldWidth) << "subSubTitle" << " : " <<
3681       fSubSubTitle <<
3682       endl <<
3683 
3684     setw (valueFieldWidth) << "instrument" << " : " <<
3685       fInstrument <<
3686       endl <<
3687 
3688     setw (valueFieldWidth) << "meter" << " : " <<
3689       fMeter <<
3690       endl <<
3691 
3692     setw (valueFieldWidth) << "tagline" << " : " <<
3693       fTagline <<
3694       endl <<
3695 
3696     setw (valueFieldWidth) << "copyright" << " : " <<
3697       fCopyright <<
3698       endl;
3699 
3700   gIndenter--;
3701 
3702 
3703   // engravers
3704   // --------------------------------------
3705   os <<
3706     "Engravers:" <<
3707     endl;
3708 
3709   gIndenter++;
3710 
3711   os << left <<
3712     setw (valueFieldWidth) << "ambitusEngraver" << " : " <<
3713       booleanAsString (fAmbitusEngraver) <<
3714       endl <<
3715     setw (valueFieldWidth) << "custosEngraver" << " : " <<
3716       booleanAsString (fCustosEngraver) <<
3717       endl;
3718 
3719   gIndenter--;
3720 
3721 
3722   // clefs
3723   // --------------------------------------
3724   os <<
3725     "Clefs:" <<
3726     endl;
3727 
3728   gIndenter++;
3729 
3730   os << left <<
3731     setw (valueFieldWidth) << "commentClefChanges" << " : " <<
3732       booleanAsString (fCommentClefChanges) <<
3733       endl;
3734 
3735   gIndenter--;
3736 
3737 
3738   // times
3739   // --------------------------------------
3740   os <<
3741     "Times:" <<
3742     endl;
3743 
3744   gIndenter++;
3745 
3746   os << left <<
3747     setw (valueFieldWidth) << "numericalTime" << " : " <<
3748       booleanAsString (fNumericalTime) <<
3749       endl;
3750 
3751   gIndenter--;
3752 
3753 
3754   // notes
3755   // --------------------------------------
3756   os <<
3757     "Notes:" <<
3758     endl;
3759 
3760   gIndenter++;
3761 
3762   os << left <<
3763     setw (valueFieldWidth) << "octaveEntryKind" << " : " <<
3764     lpsrOctaveEntryKindAsString (fOctaveEntryKind) <<
3765     endl;
3766 
3767   switch (gLilypondOah->fOctaveEntryKind) {
3768     case kOctaveEntryRelative:
3769       if (fRelativeOctaveEntrySemiTonesPitchAndOctave) {
3770         os << left <<
3771           setw (valueFieldWidth) <<
3772           "relativeOctaveEntrySemiTonesPitchAndOctave" << " : " <<
3773           fRelativeOctaveEntrySemiTonesPitchAndOctave->asString () <<
3774           endl;
3775       }
3776       break;
3777     case kOctaveEntryAbsolute:
3778       break;
3779     case kOctaveEntryFixed:
3780       if (fFixedOctaveEntrySemiTonesPitchAndOctave) {
3781         os << left <<
3782           setw (valueFieldWidth) <<
3783           "fixedOctaveEntrySemiTonesPitchAndOctave" << " : " <<
3784           fFixedOctaveEntrySemiTonesPitchAndOctave->asString () <<
3785           endl;
3786       }
3787       break;
3788   } // switch
3789 
3790   os << left <<
3791     setw (valueFieldWidth) << "allDurations" << " : " <<
3792       booleanAsString (fAllDurations) <<
3793       endl <<
3794 
3795     setw (valueFieldWidth) << "stems" << " : " <<
3796       booleanAsString (fStems) <<
3797       endl <<
3798 
3799     setw (valueFieldWidth) << "noAutoBeaming" << " : " <<
3800       booleanAsString (fNoAutoBeaming) <<
3801       endl <<
3802     setw (valueFieldWidth) << "noBeams" << " : " <<
3803       booleanAsString (fNoBeams) <<
3804       endl <<
3805 
3806     setw (valueFieldWidth) << "romanStringNumbers" << " : " <<
3807       booleanAsString (fRomanStringNumbers) <<
3808       endl <<
3809     setw (valueFieldWidth) << "avoidOpenString" << " : " <<
3810       booleanAsString (fAvoidOpenStrings) <<
3811       endl <<
3812 
3813     setw (valueFieldWidth) << "accidentalStyleKind" << " : " <<
3814       fAccidentalStyleKind <<
3815       endl <<
3816 
3817     setw (valueFieldWidth) << "lyricsDurationsKind" << " : " <<
3818       lpsrLyricsDurationsKindAsString (fLyricsDurationsKind) <<
3819       endl <<
3820 
3821     setw (valueFieldWidth) << "compressFullMeasureRests" << " : " <<
3822       booleanAsString (fCompressFullMeasureRests) <<
3823       endl <<
3824 
3825     setw (valueFieldWidth) << "inputLineNumbers" << " : " <<
3826       booleanAsString (fInputLineNumbers) <<
3827       endl <<
3828 
3829     setw (valueFieldWidth) << "originalMeasureNumbers" << " : " <<
3830       booleanAsString (fOriginalMeasureNumbers) <<
3831       endl <<
3832 
3833     setw (valueFieldWidth) << "positionsInMeasures" << " : " <<
3834       booleanAsString (fPositionsInMeasures) <<
3835       endl;
3836 
3837   gIndenter--;
3838 
3839 
3840   // bars and measures
3841   // --------------------------------------
3842   os <<
3843     "Bars:" <<
3844     endl;
3845 
3846   gIndenter++;
3847 
3848   os << left <<
3849     setw (valueFieldWidth) << "showAllBarNumbers" << " : " <<
3850     booleanAsString (fShowAllBarNumbers) <<
3851     endl;
3852 
3853   os << left <<
3854     setw (valueFieldWidth) << "resetMeasureElementMeasureNumberMap" << " : ";
3855   if (! fResetMeasureElementMeasureNumberMap.size ()) {
3856     os << "empty";
3857   }
3858   else {
3859     map<string, int>::const_iterator
3860       iBegin = fResetMeasureElementMeasureNumberMap.begin (),
3861       iEnd   = fResetMeasureElementMeasureNumberMap.end (),
3862       i      = iBegin;
3863     for ( ; ; ) {
3864       os << (*i).first << "=" << (*i).second;
3865       if (++i == iEnd) break;
3866       os << ",";
3867     } // for
3868   }
3869   os << endl;
3870 
3871   os << left <<
3872     setw (valueFieldWidth) << "boxAroundBarNumberSet" << " : ";
3873   if (! fBoxAroundBarNumberSet.size ()) {
3874     os << "empty";
3875   }
3876   else {
3877     set<int>::const_iterator
3878       iBegin = fBoxAroundBarNumberSet.begin (),
3879       iEnd   = fBoxAroundBarNumberSet.end (),
3880       i      = iBegin;
3881     for ( ; ; ) {
3882       os << (*i);
3883       if (++i == iEnd) break;
3884       os << ",";
3885     } // for
3886   }
3887   os << endl;
3888 
3889   gIndenter--;
3890 
3891 
3892   // line breaks
3893   // --------------------------------------
3894   os <<
3895     "Line breaks:" <<
3896     endl;
3897 
3898   gIndenter++;
3899 
3900   os << left <<
3901     setw (valueFieldWidth) << "ignoreMusicXMLLineBreaks" << " : " <<
3902       booleanAsString (fIgnoreMusicXMLLineBreaks) <<
3903       endl <<
3904 
3905     setw (valueFieldWidth) << "breakLinesAtIncompleteRightMeasures" << " : " <<
3906       booleanAsString (fBreakLinesAtIncompleteRightMeasures) <<
3907       endl <<
3908 
3909     setw (valueFieldWidth) << "separatorLineEveryNMeasures" << " : " <<
3910       booleanAsString (fSeparatorLineEveryNMeasures) <<
3911       endl;
3912 
3913   gIndenter--;
3914 
3915 
3916   // page breaks
3917   // --------------------------------------
3918   os <<
3919     "Page breaks:" <<
3920     endl;
3921 
3922   gIndenter++;
3923 
3924   os << left <<
3925     setw (valueFieldWidth) << "ignoreMusicXMLPageBreaks" << " : " <<
3926     booleanAsString (fIgnoreMusicXMLPageBreaks) <<
3927     endl;
3928 
3929   gIndenter--;
3930 
3931 
3932   // staves
3933   // --------------------------------------
3934   os <<
3935     "Staves:" <<
3936     endl;
3937 
3938   gIndenter++;
3939 
3940   os << left <<
3941     setw (valueFieldWidth) << "modernTab" << " : " <<
3942     booleanAsString (fModernTab) <<
3943     endl <<
3944     setw (valueFieldWidth) << "tabFullNotation" << " : " <<
3945     booleanAsString (fTabFullNotation) <<
3946     endl <<
3947 
3948     setw (valueFieldWidth) << "keepStaffSize" << " : " <<
3949     booleanAsString (fKeepStaffSize) <<
3950     endl;
3951 
3952   gIndenter--;
3953 
3954 
3955   // chords
3956   // --------------------------------------
3957 
3958   os <<
3959     "Chords:" <<
3960     endl;
3961 
3962   gIndenter++;
3963 
3964   os << left <<
3965     setw (valueFieldWidth) << "connectArpeggios" << " : " <<
3966     booleanAsString (fConnectArpeggios) <<
3967     endl;
3968 
3969   gIndenter--;
3970 
3971 
3972   // tuplets
3973   // --------------------------------------
3974 
3975   os <<
3976     "Tuplets:" <<
3977     endl;
3978 
3979   gIndenter++;
3980 
3981   os << left <<
3982     setw (valueFieldWidth) << "indentTuplets" << " : " <<
3983     booleanAsString (fIndentTuplets) <<
3984     endl;
3985 
3986   gIndenter--;
3987 
3988 
3989   // repeats
3990   // --------------------------------------
3991 
3992   os <<
3993     "Repeats:" <<
3994     endl;
3995 
3996   gIndenter++;
3997 
3998   os << left <<
3999     setw (valueFieldWidth) << "keepRepeatBarlines" << " : " <<
4000     booleanAsString (fKeepRepeatBarlines) <<
4001     endl <<
4002     setw (valueFieldWidth) << "repeatBrackets" << " : " <<
4003     booleanAsString (fRepeatBrackets) <<
4004     endl <<
4005     setw (valueFieldWidth) << "ignoreRepeatNumbers" << " : " <<
4006     booleanAsString (fIgnoreRepeatNumbers) <<
4007     endl;
4008 
4009   gIndenter--;
4010 
4011 
4012   // ornaments
4013   // --------------------------------------
4014 
4015   os <<
4016     "Ornaments:" <<
4017     endl;
4018 
4019   gIndenter++;
4020 
4021   os << left <<
4022     setw (valueFieldWidth) << "fDelayedOrnamentsFraction" << " : " <<
4023     fDelayedOrnamentsFraction <<
4024     endl;
4025 
4026   gIndenter--;
4027 
4028 
4029   // chords display
4030   // --------------------------------------
4031 
4032   os <<
4033     "Chords display:" <<
4034     endl;
4035 
4036   gIndenter++;
4037 
4038   os << left <<
4039     setw (valueFieldWidth) << "chordsDisplayList" << " : ";
4040 
4041   if (fChordsDisplayList.size ()) {
4042     os << endl;
4043 
4044     gIndenter++;
4045 
4046     list<pair<string, string> >::const_iterator
4047       iBegin = fChordsDisplayList.begin (),
4048       iEnd   = fChordsDisplayList.end (),
4049       i      = iBegin;
4050 
4051     for ( ; ; ) {
4052       os <<
4053         gTab <<
4054         (*i).first <<
4055         " -> " <<
4056         (*i).second <<
4057         endl;
4058       if (++i == iEnd) break;
4059   //     os << endl;
4060     } // for
4061 
4062     gIndenter--;
4063   }
4064   else {
4065     os <<
4066       "none";
4067   }
4068   os << endl;
4069 
4070   os << left <<
4071     setw (valueFieldWidth) << "jazzChordsDisplay" << " : " <<
4072     booleanAsString (fJazzChordsDisplay) <<
4073     endl <<
4074     setw (valueFieldWidth) << "jazzChordsDisplayLilypondcode" << " : " <<
4075     fJazzChordsDisplayLilypondcode <<
4076     endl;
4077 
4078   gIndenter--;
4079 
4080 
4081   // fonts
4082   // --------------------------------------
4083 
4084   os <<
4085     "Fonts:" <<
4086     endl;
4087 
4088   gIndenter++;
4089 
4090   os << left <<
4091     setw (valueFieldWidth) << "jazzFonts" << " : " <<
4092     booleanAsString (fJazzFonts) <<
4093     endl;
4094 
4095   gIndenter--;
4096 
4097 
4098   // code generation
4099   // --------------------------------------
4100 
4101   os <<
4102     "LilyPond code generation:" <<
4103     endl;
4104 
4105   gIndenter++;
4106 
4107   os << left <<
4108     setw (valueFieldWidth) << "xml2lyInfos" << " : " <<
4109       booleanAsString (fXml2lyInfos) <<
4110       endl <<
4111 
4112     setw (valueFieldWidth) << "comments" << " : " <<
4113       booleanAsString (fComments) <<
4114       endl <<
4115 
4116     setw (valueFieldWidth) << "global" << " : " <<
4117       booleanAsString (fGlobal) <<
4118       endl <<
4119 
4120     setw (valueFieldWidth) << "displayMusic" << " : " <<
4121       booleanAsString (fDisplayMusic) <<
4122       endl <<
4123 
4124     setw (valueFieldWidth) << "noLilypondCode" << " : " <<
4125       booleanAsString (fNoLilypondCode) <<
4126       endl <<
4127 
4128     setw (valueFieldWidth) << "noLilypondLyrics" << " : " <<
4129       booleanAsString (fNoLilypondLyrics) <<
4130       endl <<
4131 
4132     setw (valueFieldWidth) << "lilypondCompileDate" << " : " <<
4133       booleanAsString (fLilypondCompileDate) <<
4134       endl <<
4135 
4136     setw (valueFieldWidth) << "draftMode" << " : " <<
4137       booleanAsString (fDraftMode) <<
4138       endl <<
4139 
4140     setw (valueFieldWidth) << "pointAndClickOff" << " : " <<
4141       booleanAsString (fPointAndClickOff) <<
4142       endl <<
4143 
4144     setw (valueFieldWidth) << "whiteNoteHeads" << " : " <<
4145       booleanAsString (fWhiteNoteHeads) <<
4146       endl;
4147 
4148   gIndenter--;
4149 
4150 
4151   // score notation
4152   // --------------------------------------
4153 
4154   os <<
4155     "Score notation:" <<
4156     endl;
4157 
4158   gIndenter++;
4159 
4160   os << left <<
4161     setw (valueFieldWidth) << "fJianpu" << " : " <<
4162       booleanAsString (fJianpu) <<
4163       endl;
4164 
4165   gIndenter--;
4166 
4167 
4168   // midi
4169   // --------------------------------------
4170   os <<
4171     "Midi:" <<
4172     endl;
4173 
4174   gIndenter++;
4175 
4176   os << left <<
4177     setw (valueFieldWidth) << "midiTempo" << " : " <<
4178       fMidiTempo.asString () <<
4179       endl <<
4180 
4181     setw (valueFieldWidth) << "noMidi" << " : " <<
4182       booleanAsString (fNoMidi) <<
4183       endl;
4184 
4185   gIndenter--;
4186 
4187   gIndenter--;
4188 }
4189 
printLilypondOahValues(int fieldWidth)4190 void lilypondOah::printLilypondOahValues (int fieldWidth)
4191 {
4192   gLogOstream <<
4193     "The LilyPond lilypond are:" <<
4194     endl;
4195 
4196   gIndenter++;
4197 
4198   // identification
4199   // --------------------------------------
4200   gLogOstream <<
4201     "Identification:" <<
4202     endl;
4203 
4204   gIndenter++;
4205 
4206   // MusicXML informations
4207   gLogOstream << left <<
4208     setw (fieldWidth) << "rights" << " : " <<
4209       fRights <<
4210       endl <<
4211 
4212     setw (fieldWidth) << "composer" << " : " <<
4213       fComposer <<
4214       endl <<
4215     setw (fieldWidth) << "arranger" << " : " <<
4216       fArranger <<
4217       endl <<
4218     setw (fieldWidth) << "poet" << " : " <<
4219       fPoet <<
4220       endl <<
4221     setw (fieldWidth) << "lyricist" << " : " <<
4222       fLyricist <<
4223       endl <<
4224 
4225     setw (fieldWidth) << "software" << " : " <<
4226       fSoftware <<
4227       endl <<
4228 
4229   // LilyPond informations
4230     setw (fieldWidth) << "dedication" << " : " <<
4231       fDedication <<
4232       endl <<
4233 
4234     setw (fieldWidth) << "piece" << " : " <<
4235       fPiece <<
4236       endl <<
4237     setw (fieldWidth) << "opus" << " : " <<
4238       fOpus <<
4239       endl <<
4240 
4241     setw (fieldWidth) << "title" << " : " <<
4242       fTitle <<
4243       endl <<
4244     setw (fieldWidth) << "subTitle" << " : " <<
4245       fSubTitle <<
4246       endl <<
4247     setw (fieldWidth) << "subSubTitle" << " : " <<
4248       fSubSubTitle <<
4249       endl <<
4250     setw (fieldWidth) << "instrument" << " : " <<
4251       fInstrument <<
4252       endl <<
4253     setw (fieldWidth) << "meter" << " : " <<
4254       fMeter <<
4255       endl <<
4256 
4257     setw (fieldWidth) << "tagline" << " : " <<
4258       fTagline <<
4259       endl <<
4260 
4261     setw (fieldWidth) << "copyright" << " : " <<
4262       fCopyright <<
4263       endl;
4264 
4265   gIndenter--;
4266 
4267 
4268   // engravers
4269   // --------------------------------------
4270   gLogOstream <<
4271     "Engravers:" <<
4272     endl;
4273 
4274   gIndenter++;
4275 
4276   gLogOstream << left <<
4277     setw (fieldWidth) << "ambitusEngraver" << " : " <<
4278       booleanAsString (fAmbitusEngraver) <<
4279       endl <<
4280     setw (fieldWidth) << "custosEngraver" << " : " <<
4281       booleanAsString (fCustosEngraver) <<
4282       endl;
4283 
4284   gIndenter--;
4285 
4286 
4287   // clefs
4288   // --------------------------------------
4289   gLogOstream <<
4290     "Clefs:" <<
4291     endl;
4292 
4293   gIndenter++;
4294 
4295   gLogOstream << left <<
4296     setw (fieldWidth) << "commentClefChanges" << " : " <<
4297       booleanAsString (fCommentClefChanges) <<
4298       endl;
4299 
4300   gIndenter--;
4301 
4302 
4303   // time
4304   // --------------------------------------
4305   gLogOstream <<
4306     "Times:" <<
4307     endl;
4308 
4309   gIndenter++;
4310 
4311   gLogOstream << left <<
4312     setw (fieldWidth) << "numericalTime" << " : " <<
4313       booleanAsString (fNumericalTime) <<
4314       endl;
4315 
4316   gIndenter--;
4317 
4318 
4319   // notes
4320   // --------------------------------------
4321   gLogOstream <<
4322     "Notes:" <<
4323     endl;
4324 
4325   gIndenter++;
4326 
4327   gLogOstream << left <<
4328     setw (fieldWidth) << "octaveEntryKind" << " : " <<
4329       lpsrOctaveEntryKindAsString (fOctaveEntryKind) <<
4330       endl <<
4331 
4332     setw (fieldWidth) << "allDurations" << " : " <<
4333       booleanAsString (fAllDurations) <<
4334       endl <<
4335 
4336     setw (fieldWidth) << "stems" << " : " <<
4337       booleanAsString (fStems) <<
4338       endl <<
4339 
4340     setw (fieldWidth) << "noAutoBeaming" << " : " <<
4341       booleanAsString (fNoAutoBeaming) <<
4342       endl <<
4343     setw (fieldWidth) << "noBeams" << " : " <<
4344       booleanAsString (fNoBeams) <<
4345       endl <<
4346 
4347     setw (fieldWidth) << "romanStringNumbers" << " : " <<
4348       booleanAsString (fRomanStringNumbers) <<
4349       endl <<
4350     setw (fieldWidth) << "avoidOpenString" << " : " <<
4351       booleanAsString (fAvoidOpenStrings) <<
4352       endl <<
4353 
4354     setw (fieldWidth) << "accidentalStyleKind" << " : " <<
4355       fAccidentalStyleKind <<
4356       endl <<
4357 
4358     setw (fieldWidth) << "lyricsDurationsKind" << " : " <<
4359       lpsrLyricsDurationsKindAsString (fLyricsDurationsKind) <<
4360       endl <<
4361 
4362     setw (fieldWidth) << "compressFullMeasureRests" << " : " <<
4363       booleanAsString (fCompressFullMeasureRests) <<
4364       endl <<
4365 
4366     setw (fieldWidth) << "inputLineNumbers" << " : " <<
4367       booleanAsString (fInputLineNumbers) <<
4368       endl <<
4369 
4370     setw (fieldWidth) << "originalMeasureNumbers" << " : " <<
4371       booleanAsString (fOriginalMeasureNumbers) <<
4372       endl <<
4373 
4374     setw (fieldWidth) << "notesPositionsInMeasures" << " : " <<
4375       booleanAsString (fPositionsInMeasures) <<
4376       endl;
4377 
4378   gIndenter--;
4379 
4380 
4381   // bars and measures
4382   // --------------------------------------
4383   gLogOstream <<
4384     "Bars:" <<
4385     endl;
4386 
4387   gIndenter++;
4388 
4389   gLogOstream << left <<
4390     setw (fieldWidth) << "showAllBarNumbers" << " : " <<
4391     booleanAsString (fShowAllBarNumbers) <<
4392     endl;
4393 
4394   gLogOstream << left <<
4395     setw (fieldWidth) << "resetMeasureElementMeasureNumberMap" << " : ";
4396   if (! fResetMeasureElementMeasureNumberMap.size ()) {
4397     gLogOstream << "empty";
4398   }
4399   else {
4400     map<string, int>::const_iterator
4401       iBegin = fResetMeasureElementMeasureNumberMap.begin (),
4402       iEnd   = fResetMeasureElementMeasureNumberMap.end (),
4403       i      = iBegin;
4404     for ( ; ; ) {
4405       gLogOstream << (*i).first << "=" << (*i).second;
4406       if (++i == iEnd) break;
4407       gLogOstream << ",";
4408     } // for
4409   }
4410   gLogOstream << endl;
4411 
4412   gLogOstream << left <<
4413     setw (fieldWidth) << "boxAroundBarNumberSet" << " : ";
4414   if (! fBoxAroundBarNumberSet.size ()) {
4415     gLogOstream << "empty";
4416   }
4417   else {
4418     set<int>::const_iterator
4419       iBegin = fBoxAroundBarNumberSet.begin (),
4420       iEnd   = fBoxAroundBarNumberSet.end (),
4421       i      = iBegin;
4422     for ( ; ; ) {
4423       gLogOstream << (*i);
4424       if (++i == iEnd) break;
4425       gLogOstream << ",";
4426     } // for
4427   }
4428   gLogOstream << endl;
4429 
4430   gIndenter--;
4431 
4432 
4433   // line breaks
4434   // --------------------------------------
4435   gLogOstream <<
4436     "Line breaks:" <<
4437     endl;
4438 
4439   gIndenter++;
4440 
4441   gLogOstream << left <<
4442     setw (fieldWidth) << "ignoreMusicXMLLineBreaks" << " : " <<
4443       booleanAsString (fIgnoreMusicXMLLineBreaks) <<
4444       endl <<
4445 
4446     setw (fieldWidth) << "breakLinesAtIncompleteRightMeasures" << " : " <<
4447       booleanAsString (fBreakLinesAtIncompleteRightMeasures) <<
4448       endl <<
4449 
4450     setw (fieldWidth) << "separatorLineEveryNMeasures" << " : " <<
4451       booleanAsString (fSeparatorLineEveryNMeasures) <<
4452       endl;
4453 
4454   gIndenter--;
4455 
4456 
4457   // page breaks
4458   // --------------------------------------
4459   gLogOstream <<
4460     "Page breaks:" <<
4461     endl;
4462 
4463   gIndenter++;
4464 
4465   gLogOstream << left <<
4466     setw (fieldWidth) << "ignoreMusicXMLPageBreaks" << " : " <<
4467     booleanAsString (fIgnoreMusicXMLPageBreaks) <<
4468     endl;
4469 
4470   gIndenter--;
4471 
4472 
4473   // staves
4474   // --------------------------------------
4475   gLogOstream <<
4476     "Staves:" <<
4477     endl;
4478 
4479   gIndenter++;
4480 
4481   gLogOstream << left <<
4482     setw (fieldWidth) << "modernTab" << " : " <<
4483     booleanAsString (fModernTab) <<
4484     endl <<
4485     setw (fieldWidth) << "tabFullNotation" << " : " <<
4486     booleanAsString (fTabFullNotation) <<
4487     endl;
4488 
4489   gIndenter--;
4490 
4491 
4492   // chords
4493   // --------------------------------------
4494 
4495   gLogOstream <<
4496     "Chords:" <<
4497     endl;
4498 
4499   gIndenter++;
4500 
4501   gLogOstream << left <<
4502     setw (fieldWidth) << "connectArpeggios" << " : " <<
4503     booleanAsString (fConnectArpeggios) <<
4504     endl;
4505 
4506   gIndenter--;
4507 
4508 
4509   // tuplets
4510   // --------------------------------------
4511 
4512   gLogOstream <<
4513     "Tuplets:" <<
4514     endl;
4515 
4516   gIndenter++;
4517 
4518   gLogOstream << left <<
4519     setw (fieldWidth) << "indentTuplets" << " : " <<
4520     booleanAsString (fIndentTuplets) <<
4521     endl;
4522 
4523   gIndenter--;
4524 
4525 
4526   // repeats
4527   // --------------------------------------
4528 
4529   gLogOstream <<
4530     "Repeats:" <<
4531     endl;
4532 
4533   gIndenter++;
4534 
4535   gLogOstream << left <<
4536     setw (fieldWidth) << "keepRepeatBarlines" << " : " <<
4537     booleanAsString (fKeepRepeatBarlines) <<
4538     endl <<
4539     setw (fieldWidth) << "repeatBrackets" << " : " <<
4540     booleanAsString (fRepeatBrackets) <<
4541     endl <<
4542     setw (fieldWidth) << "ignoreRepeatNumbers" << " : " <<
4543     booleanAsString (fIgnoreRepeatNumbers) <<
4544     endl;
4545 
4546   gIndenter--;
4547 
4548 
4549   // ornaments
4550   // --------------------------------------
4551 
4552   gLogOstream <<
4553     "Ornaments:" <<
4554     endl;
4555 
4556   gIndenter++;
4557 
4558   gLogOstream << left <<
4559     setw (fieldWidth) << "fDelayedOrnamentsFraction" << " : " <<
4560     fDelayedOrnamentsFraction <<
4561     endl;
4562 
4563   gIndenter--;
4564 
4565 
4566   // chords display
4567   // --------------------------------------
4568 
4569   gLogOstream <<
4570     "Chords display:" <<
4571     endl;
4572 
4573   gIndenter++;
4574 
4575   gLogOstream << left <<
4576     setw (fieldWidth) << "jazzChordsDisplay" << " : " <<
4577     booleanAsString (fJazzChordsDisplay) <<
4578     endl <<
4579     setw (fieldWidth) << "jazzChordsDisplayLilypondcode" << " : " <<
4580     fJazzChordsDisplayLilypondcode <<
4581     endl;
4582 
4583   gIndenter--;
4584 
4585 
4586   // fonts
4587   // --------------------------------------
4588 
4589   gLogOstream <<
4590     "Fonts:" <<
4591     endl;
4592 
4593   gIndenter++;
4594 
4595   gLogOstream << left <<
4596     setw (fieldWidth) << "jazzFonts" << " : " <<
4597     booleanAsString (fJazzFonts) <<
4598     endl;
4599 
4600   gIndenter--;
4601 
4602 
4603   // code generation
4604   // --------------------------------------
4605 
4606   gLogOstream <<
4607     "LilyPond code generation:" <<
4608     endl;
4609 
4610   gIndenter++;
4611 
4612   gLogOstream << left <<
4613     setw (fieldWidth) << "xml2lyInfos" << " : " <<
4614       booleanAsString (fXml2lyInfos) <<
4615       endl <<
4616 
4617     setw (fieldWidth) << "comments" << " : " <<
4618       booleanAsString (fComments) <<
4619       endl <<
4620 
4621     setw (fieldWidth) << "global" << " : " <<
4622       booleanAsString (fGlobal) <<
4623       endl <<
4624 
4625     setw (fieldWidth) << "displayMusic" << " : " <<
4626       booleanAsString (fDisplayMusic) <<
4627       endl <<
4628 
4629     setw (fieldWidth) << "noLilypondCode" << " : " <<
4630       booleanAsString (fNoLilypondCode) <<
4631       endl <<
4632 
4633     setw (fieldWidth) << "noLilypondLyrics" << " : " <<
4634       booleanAsString (fNoLilypondLyrics) <<
4635       endl <<
4636 
4637     setw (fieldWidth) << "lilypondCompileDate" << " : " <<
4638       booleanAsString (fLilypondCompileDate) <<
4639       endl <<
4640 
4641     setw (fieldWidth) << "draftMode" << " : " <<
4642       booleanAsString (fDraftMode) <<
4643       endl <<
4644 
4645     setw (fieldWidth) << "pointAndClickOff" << " : " <<
4646       booleanAsString (fPointAndClickOff) <<
4647       endl <<
4648 
4649     setw (fieldWidth) << "whiteNoteHeads" << " : " <<
4650       booleanAsString (fWhiteNoteHeads) <<
4651       endl;
4652 
4653   gIndenter--;
4654 
4655 
4656   // score notation
4657   // --------------------------------------
4658 
4659   gLogOstream <<
4660     "Score notation:" <<
4661     endl;
4662 
4663   gIndenter++;
4664 
4665   gLogOstream << left <<
4666     setw (fieldWidth) << "fJianpu" << " : " <<
4667       booleanAsString (fJianpu) <<
4668       endl;
4669 
4670   gIndenter--;
4671 
4672 
4673   // midi
4674   // --------------------------------------
4675   gLogOstream <<
4676     "Midi:" <<
4677     endl;
4678 
4679   gIndenter++;
4680 
4681   gLogOstream << left <<
4682     setw (fieldWidth) << "fMidiTempo" << " : " <<
4683       fMidiTempo.asString () <<
4684       endl <<
4685 
4686     setw (fieldWidth) << "noMidi" << " : " <<
4687       booleanAsString (fNoMidi) <<
4688       endl;
4689 
4690   gIndenter--;
4691 
4692   gIndenter--;
4693 }
4694 
operator <<(ostream & os,const S_lilypondOah & elt)4695 ostream& operator<< (ostream& os, const S_lilypondOah& elt)
4696 {
4697   elt->print (os);
4698   return os;
4699 }
4700 
4701 //______________________________________________________________________________
initializeLilypondOahHandling(S_oahHandler handler)4702 void initializeLilypondOahHandling (
4703   S_oahHandler handler)
4704 {
4705 #ifdef TRACE_OAH
4706   if (gTraceOah->fTraceOah && ! gGeneralOah->fQuiet) {
4707     gLogOstream <<
4708       "Initializing LilyPond lilypond handling" <<
4709       endl;
4710   }
4711 #endif
4712 
4713   // create the lilypond variables
4714   // ------------------------------------------------------
4715 
4716   gLilypondOahUserChoices = lilypondOah::create (
4717     handler);
4718   assert(gLilypondOahUserChoices != 0);
4719 
4720   gLilypondOah =
4721     gLilypondOahUserChoices;
4722 
4723   // prepare for measure detailed trace
4724   // ------------------------------------------------------
4725 
4726 /* JMI
4727   gLilypondOahWithDetailedTrace =
4728     gLilypondOah->
4729       createCloneWithDetailedTrace ();
4730       */
4731 }
4732 
4733 
4734 }
4735 
4736 
4737 /*
4738 //______________________________________________________________________________
4739 S_lilypondBreakPageAfterMeasureNumberAtom lilypondBreakPageAfterMeasureNumberAtom::create (
4740   string       shortName,
4741   string       longName,
4742   string       description,
4743   string       valueSpecification,
4744   string       variableName,
4745   set<string>& fStringSetVariable)
4746 {
4747   lilypondBreakPageAfterMeasureNumberAtom* o = new
4748     lilypondBreakPageAfterMeasureNumberAtom (
4749       shortName,
4750       longName,
4751       description,
4752       valueSpecification,
4753       variableName,
4754       fStringSetVariable);
4755   assert(o!=0);
4756   return o;
4757 }
4758 
4759 lilypondBreakPageAfterMeasureNumberAtom::lilypondBreakPageAfterMeasureNumberAtom (
4760   string       shortName,
4761   string       longName,
4762   string       description,
4763   string       valueSpecification,
4764   string       variableName,
4765   set<string>& fStringSetVariable)
4766   : oahValuedAtom (
4767       shortName,
4768       longName,
4769       description,
4770       valueSpecification,
4771       variableName),
4772     fStringSetVariable (
4773       fStringSetVariable)
4774 {}
4775 
4776 lilypondBreakPageAfterMeasureNumberAtom::~lilypondBreakPageAfterMeasureNumberAtom ()
4777 {}
4778 
4779 S_oahValuedAtom lilypondBreakPageAfterMeasureNumberAtom::handleOptionUnderName (
4780   string   optionName,
4781   ostream& os)
4782 {
4783 #ifdef TRACE_OAH
4784   if (gTraceOah->fTraceOah) {
4785     gLogOstream <<
4786       "==> option '" << optionName << "' is a lilypondBreakPageAfterMeasureNumberAtom" <<
4787       endl;
4788   }
4789 #endif
4790 
4791   // an option value is needed
4792   return this;
4793 }
4794 
4795 void lilypondBreakPageAfterMeasureNumberAtom::handleValue (
4796   string   theString,
4797   ostream& os)
4798 {
4799 #ifdef TRACE_OAH
4800   if (gTraceOah->fTraceOah) {
4801     os <<
4802       "==> oahAtom is of type 'lilypondBreakPageAfterMeasureNumberAtom'" <<
4803       endl;
4804   }
4805 #endif
4806 
4807   // theString contains the midi tempo specification
4808   // decipher it to extract duration and perSecond values
4809 
4810 #ifdef TRACE_OAH
4811   if (gTraceOah->fTraceOah) {
4812     os <<
4813       "==> oahAtom is of type 'lilypondBreakPageAfterMeasureNumberAtom'" <<
4814       endl;
4815   }
4816 #endif
4817 
4818   string regularExpression (
4819     "[[:space:]]*"
4820     "([[:digit:]]+\\.*)"
4821     "[[:space:]]*"
4822     "="
4823     "[[:space:]]*"
4824     "([[:digit:]]+)"
4825     "[[:space:]]*");
4826 
4827   regex  e (regularExpression);
4828   smatch sm;
4829 
4830   regex_match (theString, sm, e);
4831 
4832   unsigned smSize = sm.size ();
4833 
4834 #ifdef TRACE_OAH
4835   if (gTraceOah->fTraceOah) {
4836     os <<
4837       "There are " << smSize << " matches" <<
4838       " for reset measure number string '" << theString <<
4839       "' with regex '" << regularExpression <<
4840       "':" <<
4841       endl;
4842 
4843     gIndenter++;
4844 
4845     for (unsigned i = 0; i < smSize; ++i) {
4846       os <<
4847         i << ": " << "\"" << sm [i] << "\"" <<
4848         endl;
4849     } // for
4850     os << endl;
4851 
4852     gIndenter--;
4853   }
4854 #endif
4855 
4856   if (smSize != 3) {
4857     stringstream s;
4858 
4859     s <<
4860       "-breakPageAfterMeasureNumber argument '" << theString <<
4861       "' is ill-formed";
4862 
4863     oahError (s.str ());
4864   }
4865 
4866   string musicXMLMeasureNumber = sm [1];
4867 
4868   int lilypondMeasureNumber;
4869   {
4870     stringstream s;
4871     s << sm [2];
4872     s >> lilypondMeasureNumber;
4873   }
4874 
4875 #ifdef TRACE_OAH
4876   if (gTraceOah->fTraceOah) {
4877     os <<
4878       "musicXMLMeasureNumber  = " <<
4879       musicXMLMeasureNumber <<
4880       endl <<
4881       "lilypondMeasureNumber = " <<
4882       lilypondMeasureNumber <<
4883       endl;
4884 
4885   fStringSetVariable [musicXMLMeasureNumber] = lilypondMeasureNumber;
4886   }
4887 #endif
4888 }
4889 
4890 void lilypondBreakPageAfterMeasureNumberAtom::print (ostream& os) const
4891 {
4892   const int fieldWidth = K_OAH_FIELD_WIDTH;
4893 
4894   os <<
4895     "OptionsBreakPageAfterMeasureNumberAtom:" <<
4896     endl;
4897 
4898   gIndenter++;
4899 
4900   printValuedAtomEssentials (
4901     os, fieldWidth);
4902 
4903   os << left <<
4904     setw (fieldWidth) <<
4905     "fVariableName" << " : " <<
4906     fVariableName <<
4907     setw (fieldWidth) <<
4908     "fStringSetVariable" << " : '" <<
4909     endl;
4910 
4911   if (! fStringSetVariable.size ()) {
4912     os << "none";
4913   }
4914   else {
4915     map<string, int>::const_iterator
4916       iBegin = fStringSetVariable.begin (),
4917       iEnd   = fStringSetVariable.end (),
4918       i      = iBegin;
4919     for ( ; ; ) {
4920       os << (*i).first << " --> " << (*i).second;
4921       if (++i == iEnd) break;
4922       os << endl;
4923     } // for
4924   }
4925 
4926   os << endl;
4927 
4928   gIndenter--;
4929 }
4930 
4931 void lilypondBreakPageAfterMeasureNumberAtom::printAtomOptionsValues (
4932   ostream& os,
4933   int      valueFieldWidth) const
4934 {
4935   os << left <<
4936     setw (valueFieldWidth) <<
4937     fVariableName <<
4938     " : ";
4939 
4940   if (! fStringSetVariable.size ()) {
4941     os <<
4942       "none" <<
4943       endl;
4944   }
4945   else {
4946     os << endl;
4947     gIndenter++;
4948 
4949     map<string, int>::const_iterator
4950       iBegin = fStringSetVariable.begin (),
4951       iEnd   = fStringSetVariable.end (),
4952       i      = iBegin;
4953     for ( ; ; ) {
4954       os <<
4955         "\"" <<
4956         (*i).first <<
4957         "\" --> \"" <<
4958         (*i).second <<
4959         "\"" <<
4960         endl;
4961       if (++i == iEnd) break;
4962     } // for
4963 
4964     gIndenter--;
4965   }
4966 }
4967 
4968 ostream& operator<< (ostream& os, const S_lilypondBreakPageAfterMeasureNumberAtom& elt)
4969 {
4970   elt->print (os);
4971   return os;
4972 }
4973 */
4974 
4975