+ bool symbol_ok = octaveness == ly_symbol2scm ("any-octave") ||
+ octaveness == ly_symbol2scm ("same-octave");
+
+ SCM_ASSERT_TYPE (symbol_ok, octaveness, SCM_ARG5, __FUNCTION__, "'any-octave or 'same-octave");
+
+ Pitch *pitch = unsmob_pitch (pitch_scm);
+
+ int bar_number = scm_to_int (barnum);
+ bool ignore_octave = ly_symbol2scm ("any-octave") == octaveness;
+ Accidental_result result = check_pitch_against_signature (keysig, *pitch, bar_number,
+ laziness, ignore_octave);
+
+ return scm_cons (scm_from_bool (result.need_restore), scm_from_bool (result.need_acc));
+}
+
+static
+Accidental_result
+check_pitch_against_rules (Pitch const &pitch, Context *origin,
+ SCM rules, int bar_number, SCM measurepos)
+{
+ Accidental_result result;
+ SCM pitch_scm = pitch.smobbed_copy ();
+ SCM barnum_scm = scm_from_int (bar_number);
+
+ if (scm_is_pair (rules) && !scm_is_symbol (scm_car (rules)))