-static int
-number_accidentals (bool *different,
- Pitch *pitch, Context *origin,
- SCM accidentals, int bar_number)
-{
- int number = 0;
-
- *different = false;
- if (scm_is_pair (accidentals) && !scm_is_symbol (scm_car (accidentals)))
- warning (_f ("accidental typesetting list must begin with context-name: %s",
- ly_scm2string (scm_car (accidentals)).c_str ()));
-
- for (; scm_is_pair (accidentals) && origin;
- accidentals = scm_cdr (accidentals))
- {
- // If pair then it is a new accidentals typesetting rule to be checked
- SCM rule = scm_car (accidentals);
- if (scm_is_pair (rule))
- {
- SCM type = scm_car (rule);
- SCM laziness = scm_cdr (rule);
- SCM localsig = origin->get_property ("localKeySignature");
-
- bool same_octave_b
- = scm_is_eq (ly_symbol2scm ("same-octave"), type);
- bool any_octave_b
- = scm_is_eq (ly_symbol2scm ("any-octave"), type);
-
- if (same_octave_b || any_octave_b)
- {
- bool d = false;
- int n = number_accidentals_from_sig
- (&d, localsig, pitch, bar_number, laziness, any_octave_b);
- *different = *different || d;
- number = max (number, n);
- }
- else
- warning (_f ("ignoring unknown accidental: %s",
- ly_symbol2string (type).c_str ()));
- }
-
- /* if symbol then it is a context name. Scan parent contexts to
- find it. */