From: Han-Wen Nienhuys Date: Fri, 20 Feb 2004 00:35:49 +0000 (+0000) Subject: * input/regression/accidental-tie.ly (mus): new file X-Git-Tag: release/2.1.26~15 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5227deb9e456fbf658ae69d4e249063aa46b4cdb;p=lilypond.git * input/regression/accidental-tie.ly (mus): new file * input/regression/tie-accidental, tie-break-accidental.ly: remove these longish tests. --- diff --git a/ChangeLog b/ChangeLog index 464cf0f02b..95c459137c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-02-20 Han-Wen Nienhuys + + * input/regression/accidental-tie.ly (mus): new file + + * input/regression/tie-accidental, tie-break-accidental.ly: remove + these longish tests. + 2004-02-19 Han-Wen Nienhuys * lily/include/*.hh (class Item): rename XXX_b () to is_XXX (). diff --git a/flower/include/interval.hh b/flower/include/interval.hh index be5f560d7e..eebe675f37 100644 --- a/flower/include/interval.hh +++ b/flower/include/interval.hh @@ -58,7 +58,7 @@ struct Interval_t : public Drul_array { TODO: strip hungarian suffix. */ bool is_empty () const { return elem (LEFT) > elem (RIGHT); } - bool contains_b (Interval_t const&) const; + bool superset (Interval_t const&) const; Interval_t () { set_empty (); } diff --git a/flower/include/interval.tcc b/flower/include/interval.tcc index 79e7c548e6..2060c92ae7 100644 --- a/flower/include/interval.tcc +++ b/flower/include/interval.tcc @@ -34,7 +34,7 @@ _Interval__compare (const Interval_t&a,Interval_t const&b) template bool -Interval_t::contains_b (Interval_t const& a) const +Interval_t::superset (Interval_t const& a) const { int c_i= _Interval__compare (*this, a); if (c_i == -2) diff --git a/input/regression/accidental-tie.ly b/input/regression/accidental-tie.ly new file mode 100644 index 0000000000..57784df72e --- /dev/null +++ b/input/regression/accidental-tie.ly @@ -0,0 +1,28 @@ +\version "2.1.25" + +\header { + + texidoc = "The second and third notes should not get accidentals, + because they are tied to a note. However, an accidental is + present if the line is broken at the tie, which happens for the G + sharp." + +} + +mus = \notes \relative c' { + f1~ + f2~f4 % ~ f8 + fis8 gis8 ~ + \break + gis1 +} + +\score { + \notes << + \new NoteNames \mus + \new Voice { \key g \major \mus } + >> + \paper { + raggedright = ##t + } +} diff --git a/input/regression/tie-accidental.ly b/input/regression/tie-accidental.ly deleted file mode 100644 index 9e5de4fef9..0000000000 --- a/input/regression/tie-accidental.ly +++ /dev/null @@ -1,58 +0,0 @@ - -\version "2.1.22" - -\header{ -texidoc=" -When tying notes with accidentals across a bar boundary, the -accidental must not be drawn on the note in the next bar. Unless the -tie crosses a line break, in which case the accidental is repeated if -it would be different from an untied note. The next note of the same -pitch in this next bar should always show the accidental (even if it is -natural). Slurring a accidentaled note to a natural one across bar -boundaries should be explicit. - -Pitches can be verified by printing them with the @code{NoteNames} context. -" -} - -thenotes = \notes \relative cis' { - \time 4/4 - g'2 g ~ | - g g4 gis | - gis2 gis ~ | - gis4 gis8 ~ gis g4 gis | - g2 gis ~ | - gis g4 gis | - g2 gis( | - g!) gis4 gis | - \break - \key a \major - gis2 gis ~ | - gis4 gis8 ~ gis g4 gis | - gis2 g ~ | - g4 gis8 ~ gis g4 gis | - g2 gis ~ | - gis g4 gis | - g2 gis( | - - % FIXME: check for accidentals at line break could look more cute - % maybe move to tie-break-accidental? - - % Btw: I don't even know what the rule is for the second note in the - % next bar, if a reminder accidental was printed. These are really - % not very common cases. Technically, if it is not tied, it - % should get an accidental but it looks a bit silly and redundant. - % See last g. - - g!) gis4 gis ~ | \break - gis2 gis ~ | gis g ~\break - g2 g -} - -\score { - << - \context Staff \thenotes - \context NoteNames \thenotes - >> -} - diff --git a/input/regression/tie-break-accidental.ly b/input/regression/tie-break-accidental.ly deleted file mode 100644 index b04e20223a..0000000000 --- a/input/regression/tie-break-accidental.ly +++ /dev/null @@ -1,20 +0,0 @@ -\version "2.1.22" - -\header { -texidoc = "First and second bes (tied across line break) -should get an accidental, but others should not. -Only first b should get natural sign." -} - -\score { - \notes { - bes1 ~ | \break - bes2 ~ bes4 ~ bes4 ~ | bes1 - \key f\major - bes1 ~|bes2 b ~|b ~ b ~|b1 - } - \paper { - linewidth = 40*\staffspace - } -} - diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index e63c0354ac..7e160184c3 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -6,8 +6,7 @@ */ #include "event.hh" - - +#include "spanner.hh" #include "item.hh" #include "tie.hh" #include "rhythmic-head.hh" @@ -27,11 +26,13 @@ struct Accidental_entry { Grob * accidental_; Context *origin_; Grob* head_; + bool tied_; Accidental_entry(); }; Accidental_entry::Accidental_entry() { + tied_ = false; done_ = false; melodic_ =0; accidental_ = 0; @@ -65,7 +66,9 @@ public: The next */ Array accidentals_; - Link_array ties_; + Link_array ties_; + + SCM get_bar_num (); }; @@ -103,15 +106,17 @@ Accidental_engraver::initialize () /* -calculates the number of accidentals on basis of the current local key sig - (passed as argument) + calculates the number of accidentals on basis of the current local key + sig (passed as argument) + Returns number of accidentals (0, 1 or 2). - Negative (-1 or -2) if accidental has changed. + Negative (-1 or -2) if accidental has changed. */ static int -number_accidentals_from_sig (SCM sig, Music *, Pitch *pitch, SCM curbarnum, SCM lazyness, - bool ignore_octave_b) +number_accidentals_from_sig (bool *different, + SCM sig, Pitch *pitch, SCM curbarnum, SCM lazyness, + bool ignore_octave) { int n = pitch->get_notename (); int o = pitch->get_octave(); @@ -120,7 +125,7 @@ number_accidentals_from_sig (SCM sig, Music *, Pitch *pitch, SCM curbarnum, SCM int accbarnum_i = 0; SCM prev; - if (ignore_octave_b) + if (ignore_octave) prev = ly_assoc_cdr (scm_int2num (n), sig); else prev = scm_assoc (gh_cons (scm_int2num (o), scm_int2num (n)), sig); @@ -149,17 +154,19 @@ number_accidentals_from_sig (SCM sig, Music *, Pitch *pitch, SCM curbarnum, SCM num = 2; else num = 1; - - return a == p ? num : -num; + + *different = (a != p); + return num; } static int -number_accidentals (Music * note, Pitch *pitch, Context * origin, +number_accidentals (bool *different, + Pitch *pitch, Context * origin, SCM accidentals, SCM curbarnum) { int number = 0; - bool diff = false; + *different = false; if (gh_pair_p (accidentals) && !gh_symbol_p (ly_car (accidentals))) warning (_f ("Accidental typesetting list must begin with context-name: %s", ly_scm2string (ly_car (accidentals)).to_str0 ())); @@ -181,10 +188,11 @@ number_accidentals (Music * note, Pitch *pitch, Context * origin, if (same_octave_b || any_octave_b) { + bool d = false; int n = number_accidentals_from_sig - (localsig, note, pitch, curbarnum, lazyness, any_octave_b); - diff = diff || (n < 0); - number = max (number, abs (n)); + (&d, localsig, pitch, curbarnum, lazyness, any_octave_b); + *different = *different || d; + number = max (number, n); } else warning (_f ("unknown accidental typesetting: %s. Ignored", @@ -208,7 +216,23 @@ number_accidentals (Music * note, Pitch *pitch, Context * origin, ly_scm2string (rule).to_str0 ())); } - return diff ? -number : number; + return number; +} + +SCM +Accidental_engraver::get_bar_num () +{ + SCM barnum = get_property ("currentBarNumber"); + SCM smp = get_property("measurePosition"); + + Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0); + if (mp.main_part_ < Rational (0) + && gh_number_p (barnum)) + barnum = scm_int2num (gh_scm2int (barnum) - 1); + + + return barnum ; + } void @@ -219,10 +243,8 @@ Accidental_engraver::process_acknowledged_grobs () //SCM localsig = get_property ("localKeySignature"); SCM accidentals = get_property ("autoAccidentals"); SCM cautionaries = get_property ("autoCautionaries"); - SCM barnum = get_property ("currentBarNumber"); - SCM smp = get_property("measurePosition"); - Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0); - if(mp.main_part_get_mus_property ("pitch")); if (!pitch) continue; + + bool different = false; + bool different_caut = false; - int num = number_accidentals (note, pitch, origin, accidentals, barnum); - int num_caut = number_accidentals (note, pitch, origin, cautionaries, barnum); + int num = number_accidentals (&different, + pitch, origin, + accidentals, barnum); + int num_caut = number_accidentals (&different_caut, + pitch, origin, + cautionaries, barnum); + bool cautionary = to_boolean (note->get_mus_property ("cautionary")); - if (abs (num_caut) > abs (num)) + if (num_caut > num) { num = num_caut; + different = different_caut; cautionary = true; } - if(num==0 && to_boolean (note->get_mus_property ("force-accidental"))) - num=1; + if (num == 0 && to_boolean (note->get_mus_property ("force-accidental"))) + num = 1; - bool different = num < 0; - num = abs (num); + /* + Can not look for ties: it's not guaranteed that they reach + us before the notes + */ /* See if there's a tie that makes the accidental disappear */ Grob *tie_break_reminder = 0; bool tie_changes = false; @@ -321,80 +354,96 @@ Accidental_engraver::process_acknowledged_grobs () for (int i = 0; i < right_objects_.size (); i++) Side_position_interface::add_support (a, right_objects_[i]); } - - - /* - We should not record the accidental if it is the first - note and it is tied from the previous measure. - - Checking whether it is tied also works mostly, but will it - always do the correct thing? - */ - - - int n = pitch->get_notename (); - int o = pitch->get_octave (); - int a = pitch->get_alteration (); - SCM on_s = gh_cons (scm_int2num (o), scm_int2num (n)); - - while (origin) - { - /* - huh? we set props all the way to the top? - */ - SCM localsig = origin->get_property ("localKeySignature"); - bool change = false; - if (tie_changes) - { - /* - Remember an alteration that is different both from - that of the tied note and of the key signature. - */ - localsig = ly_assoc_front_x - (localsig, on_s, gh_cons (SCM_BOOL_T, barnum)); - - change = true; - } - else - { - /* - not really really correct if there are more than one - noteheads with the same notename. - */ - localsig = ly_assoc_front_x - (localsig, on_s, gh_cons (scm_int2num (a), barnum)); - - change = true; - } - - if (change) - origin->set_property ("localKeySignature", localsig); - origin = origin->daddy_context_; - } } } } + + + void Accidental_engraver::finalize () { - /* - Must reset, since Accidental_engraver is GCd. - */ last_keysig_ = SCM_EOL; } void Accidental_engraver::stop_translation_timestep () { - for (int i = 0; i < accidentals_.size(); i++) + for (int j = ties_.size (); j --; ) + { + Grob * r = Tie::head (ties_[j], RIGHT); + for (int i = accidentals_.size (); i--;) + if (accidentals_[i].head_ == r) + { + if (Grob * g = accidentals_[i].accidental_) + { + g->set_grob_property ("tie", ties_[j]->self_scm ()); + accidentals_[i].tied_ = true; + } + + ties_.del (j); + break; + } + } + + for (int i = accidentals_.size (); i--;) { - Grob *a = accidentals_[i].accidental_; - if (a) + SCM barnum = get_bar_num (); + + Music * note = accidentals_[i].melodic_; + Context * origin = accidentals_[i].origin_; + + Pitch * pitch = unsmob_pitch (note->get_mus_property ("pitch")); + if (!pitch) + continue; + + int n = pitch->get_notename (); + int o = pitch->get_octave (); + int a = pitch->get_alteration (); + SCM on_s = gh_cons (scm_int2num (o), scm_int2num (n)); + + while (origin) { - typeset_grob (a); + /* + huh? we set props all the way to the top? + */ + SCM localsig = origin->get_property ("localKeySignature"); + bool change = false; + if (accidentals_[i].tied_) + { + /* + Remember an alteration that is different both from + that of the tied note and of the key signature. + */ + localsig = ly_assoc_front_x + (localsig, on_s, gh_cons (SCM_BOOL_T, barnum)); + + change = true; + } + else + { + /* + not really really correct if there are more than one + noteheads with the same notename. + */ + localsig = ly_assoc_front_x + (localsig, on_s, gh_cons (scm_int2num (a), barnum)); + + change = true; + } + + if (change) + origin->set_property ("localKeySignature", localsig); + origin = origin->daddy_context_; } } + + for (int i = 0; i < accidentals_.size(); i++) + { + if (Grob *a = accidentals_[i].accidental_) + typeset_grob (a); + } if (accidental_placement_) typeset_grob(accidental_placement_); @@ -403,7 +452,6 @@ Accidental_engraver::stop_translation_timestep () accidentals_.clear(); left_objects_.clear (); right_objects_.clear (); - ties_.clear (); } void @@ -426,7 +474,7 @@ Accidental_engraver::acknowledge_grob (Grob_info info) } else if (Tie::has_interface (info.grob_)) { - ties_.push (info.grob_); + ties_.push (dynamic_cast (info.grob_)); } else if (Arpeggio::has_interface (info.grob_)) { diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index ffdfe43140..d7eb017a17 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -45,7 +45,7 @@ private: void begin_beam (); void end_beam (); void junk_beam (); - bool same_grace_state_b (Grob* e); + bool is_same_grace_state (Grob* e); void typeset_beam (); /* diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index f5bc52ced3..65c05ad1f9 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -26,7 +26,7 @@ Axis_group_interface::add_element (Grob*me,Grob *e) } bool -Axis_group_interface::axis_b (Grob*me,Axis a) +Axis_group_interface::has_axis (Grob*me,Axis a) { /* urg. FIXME, check for Hara_kiri_group_spanner shouldn't be necessary? diff --git a/lily/binary-source-file.cc b/lily/binary-source-file.cc index 9f69b5ec98..1eceb65b8a 100644 --- a/lily/binary-source-file.cc +++ b/lily/binary-source-file.cc @@ -29,7 +29,7 @@ String Binary_source_file::error_string (char const* pos_str0) const { assert (this); - if (!in_b (pos_str0)) + if (!contains (pos_str0)) return ""; char const* begin_str0 = pos_str0 - 8 >? to_str0 (); @@ -54,7 +54,7 @@ Binary_source_file::error_string (char const* pos_str0) const int Binary_source_file::get_line (char const* pos_str0) const { - if (!in_b (pos_str0)) + if (!contains (pos_str0)) return 0; return pos_str0 - to_str0 (); diff --git a/lily/include/axis-group-interface.hh b/lily/include/axis-group-interface.hh index 61239d372e..26ab66e14d 100644 --- a/lily/include/axis-group-interface.hh +++ b/lily/include/axis-group-interface.hh @@ -22,7 +22,7 @@ struct Axis_group_interface static void add_element (Grob* me, Grob*); static void set_axes (Grob*,Axis,Axis); - static bool axis_b (Grob*,Axis); + static bool has_axis (Grob*,Axis); static Link_array get_children (Grob*); static bool has_interface (Grob*); diff --git a/lily/include/grob.hh b/lily/include/grob.hh index f5d47300d5..f01bf92bdf 100644 --- a/lily/include/grob.hh +++ b/lily/include/grob.hh @@ -90,8 +90,6 @@ public: */ void add_dependency (Grob*); virtual System * get_system () const; - bool linked_b () const; - VIRTUAL_COPY_CONS (Grob); diff --git a/lily/include/my-lily-lexer.hh b/lily/include/my-lily-lexer.hh index a7653902e6..6f012b3549 100644 --- a/lily/include/my-lily-lexer.hh +++ b/lily/include/my-lily-lexer.hh @@ -64,10 +64,10 @@ public: void pop_state (); void LexerError (char const *); void set_identifier (SCM name_string, SCM); - bool note_state_b () const; - bool chord_state_b () const; - bool lyric_state_b () const; - bool figure_state_b () const; + bool is_note_state () const; + bool is_chord_state () const; + bool is_lyric_state () const; + bool is_figure_state () const; private: int lookup_keyword (String); int scan_bare_word (String); diff --git a/lily/include/simple-spacer.hh b/lily/include/simple-spacer.hh index 6c2a16f5d8..48e8dd2e34 100644 --- a/lily/include/simple-spacer.hh +++ b/lily/include/simple-spacer.hh @@ -25,7 +25,7 @@ struct Spring_description Real length (Real force) const; Spring_description (); - bool sane_b () const; + bool is_sane () const; }; struct Simple_spacer diff --git a/lily/include/source-file.hh b/lily/include/source-file.hh index 18363da1d8..d1aa173c15 100644 --- a/lily/include/source-file.hh +++ b/lily/include/source-file.hh @@ -29,7 +29,7 @@ public: char const* to_str0 () const; virtual String error_string (char const* pos_str0 ) const; std::istream * get_istream (); - bool in_b (char const* pos_str0 ) const; + bool contains (char const* pos_str0 ) const; int length () const; virtual int get_line (char const* pos_str0 ) const; String name_string () const; diff --git a/lily/include/system.hh b/lily/include/system.hh index df209eb5fe..8f1506a78e 100644 --- a/lily/include/system.hh +++ b/lily/include/system.hh @@ -26,8 +26,6 @@ public: void post_processing (bool); System (SCM); - /// is #c# contained in #*this#? - bool contains_b (Paper_column const *c) const; int element_count () const; int spanner_count () const; diff --git a/lily/instrument-name-engraver.cc b/lily/instrument-name-engraver.cc index 5b2ab6b198..bbecea499a 100644 --- a/lily/instrument-name-engraver.cc +++ b/lily/instrument-name-engraver.cc @@ -105,7 +105,7 @@ Instrument_name_engraver::acknowledge_grob (Grob_info i) */ if (dynamic_cast (i.grob_) && ((Axis_group_interface::has_interface (i.grob_) - && Axis_group_interface::axis_b (i.grob_, Y_AXIS))) + && Axis_group_interface::has_axis (i.grob_, Y_AXIS))) && !Align_interface::has_interface (i.grob_)) { SCM nl = gh_cons (i.grob_->self_scm (), diff --git a/lily/lexer.ll b/lily/lexer.ll index 7c622accd2..376bd81fd9 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -63,7 +63,7 @@ SCM lookup_markup_command (String s); bool -valid_version_b (String s); +is_valid_version (String s); @@ -171,7 +171,7 @@ HYPHEN -- s = s.left_string (s.index_last ('\"')); yy_pop_state(); - if (!valid_version_b (s)) + if (!is_valid_version (s)) return INVALID; } \"[^"]*\" { /* got the version number */ @@ -706,25 +706,25 @@ My_lily_lexer::scan_bare_word (String str) } bool -My_lily_lexer::note_state_b () const +My_lily_lexer::is_note_state () const { return YY_START == notes; } bool -My_lily_lexer::chord_state_b () const +My_lily_lexer::is_chord_state () const { return YY_START == chords; } bool -My_lily_lexer::lyric_state_b () const +My_lily_lexer::is_lyric_state () const { return YY_START == lyrics; } bool -My_lily_lexer::figure_state_b () const +My_lily_lexer::is_figure_state () const { return YY_START == figures; } @@ -762,7 +762,7 @@ Lilypond_version oldest_version ("1.9.0"); bool -valid_version_b (String s) +is_valid_version (String s) { Lilypond_version current ( MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL ); Lilypond_version ver (s); diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc index e3fbfbcf70..5950002548 100644 --- a/lily/note-spacing.cc +++ b/lily/note-spacing.cc @@ -141,7 +141,7 @@ Note_spacing::get_spacing (Grob *me, Item* right_col, *space = (base_space - increment) + *fixed ; if (!extents[RIGHT].is_empty () - && (Item::breakable_b (right_col) + && (Item::is_breakable (right_col) || right_col->original_)) { /* diff --git a/lily/paper-column.cc b/lily/paper-column.cc index 9de3eda80e..6ca95c712e 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -99,7 +99,7 @@ Paper_column::is_musical (Grob *me) bool Paper_column::is_used (Grob*me) { - return gh_pair_p (me->get_grob_property ("elements")) || Item::breakable_b (me) + return gh_pair_p (me->get_grob_property ("elements")) || Item::is_breakable (me) || gh_pair_p (me->get_grob_property ("bounded-by-me")) ; } diff --git a/lily/parser.yy b/lily/parser.yy index 99d5e8feb4..358895ea78 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -118,7 +118,7 @@ tag_music (Music*m, SCM tag, Input ip) bool -regular_identifier_b (SCM id) +is_regular_identifier (SCM id) { String str = ly_scm2string (id); char const *s = str.to_str0 () ; @@ -144,7 +144,7 @@ make_simple_markup (SCM a) bool -is_duration_b (int t) +is_is_duration (int t) { return t && t == 1 << intlog2 (t); } @@ -503,7 +503,7 @@ assignment: */ Input ip = THIS->pop_spot (); - if (! regular_identifier_b ($1)) + if (! is_regular_identifier ($1)) { ip.warning (_ ("Identifier should have alphabetic characters only")); } @@ -1494,12 +1494,12 @@ post_event: $$ = $1; } | HYPHEN { - if (!THIS->lexer_->lyric_state_b ()) + if (!THIS->lexer_->is_lyric_state ()) THIS->parser_error (_ ("Have to be in Lyric mode for lyrics")); $$ = MY_MAKE_MUSIC("HyphenEvent"); } | EXTENDER { - if (!THIS->lexer_->lyric_state_b ()) + if (!THIS->lexer_->is_lyric_state ()) THIS->parser_error (_ ("Have to be in Lyric mode for lyrics")); $$ = MY_MAKE_MUSIC("ExtenderEvent"); } @@ -1791,7 +1791,7 @@ optional_notemode_duration: steno_duration: bare_unsigned dots { int l = 0; - if (!is_duration_b ($1)) + if (!is_is_duration ($1)) THIS->parser_error (_f ("not a duration: %d", $1)); else l = intlog2 ($1); @@ -1846,7 +1846,7 @@ tremolo_type: $$ =0; } | ':' bare_unsigned { - if (!is_duration_b ($2)) + if (!is_is_duration ($2)) THIS->parser_error (_f ("not a duration: %d", $2)); $$ = $2; } @@ -1942,7 +1942,7 @@ simple_element: pitch exclamations questions oct_check optional_notemode_duration optional_rest { Input i = THIS->pop_spot (); - if (!THIS->lexer_->note_state_b ()) + if (!THIS->lexer_->is_note_state ()) THIS->parser_error (_ ("Have to be in Note mode for notes")); Music *n = 0; @@ -2035,7 +2035,7 @@ simple_element: | lyric_element optional_notemode_duration { Input i = THIS->pop_spot (); - if (!THIS->lexer_->lyric_state_b ()) + if (!THIS->lexer_->is_lyric_state ()) THIS->parser_error (_ ("Have to be in Lyric mode for lyrics")); Music * lreq = MY_MAKE_MUSIC("LyricEvent"); @@ -2050,7 +2050,7 @@ simple_element: | new_chord { THIS->pop_spot (); - if (!THIS->lexer_->chord_state_b ()) + if (!THIS->lexer_->is_chord_state ()) THIS->parser_error (_ ("Have to be in Chord mode for chords")); $$ = unsmob_music ($1); } diff --git a/lily/script-column-engraver.cc b/lily/script-column-engraver.cc index 80e41b5b9b..45a2d4d6b0 100644 --- a/lily/script-column-engraver.cc +++ b/lily/script-column-engraver.cc @@ -51,7 +51,7 @@ Script_column_engraver::acknowledge_grob (Grob_info inf) Item *thing = dynamic_cast (inf.grob_); if (thing && Side_position_interface::has_interface (inf.grob_)) // ugh FIXME { - if (!Item::breakable_b (thing) + if (!Item::is_breakable (thing) && Side_position_interface::get_axis (inf.grob_) == Y_AXIS) { scripts_.push (thing); diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index 5f97221900..9f24a4d823 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -129,7 +129,7 @@ Separating_line_group_engraver::acknowledge_grob (Grob_info i) return ; } - bool ib =Item::breakable_b (it); + bool ib =Item::is_breakable (it); Item *&p_ref_ (ib ? break_item_ : musical_item_); diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index ff044d676e..972da55278 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -254,7 +254,7 @@ Simple_spacer::add_columns (Link_array const &icols) continue; } - if (!desc.sane_b ()) + if (!desc.is_sane ()) { programming_error ("Insane spring found. Setting to unit spring."); @@ -395,7 +395,7 @@ Spring_description::Spring_description () bool -Spring_description::sane_b () const +Spring_description::is_sane () const { return (hooke_ > 0) && !isinf (ideal_) && !isnan (ideal_); } diff --git a/lily/source-file.cc b/lily/source-file.cc index 0ef67667b5..f4e1ddcfd4 100644 --- a/lily/source-file.cc +++ b/lily/source-file.cc @@ -166,7 +166,7 @@ Source_file::~Source_file () Slice Source_file::line_slice (char const* pos_str0) const { - if (!in_b (pos_str0)) + if (!contains (pos_str0)) return Slice (0,0); char const* data_str0 = to_str0 (); @@ -196,7 +196,7 @@ Source_file::line_slice (char const* pos_str0) const String Source_file::line_string (char const* pos_str0) const { - if (!in_b (pos_str0)) + if (!contains (pos_str0)) return ""; Slice line = line_slice (pos_str0); @@ -207,7 +207,7 @@ Source_file::line_string (char const* pos_str0) const int Source_file::get_char (char const* pos_str0) const { - if (!in_b (pos_str0)) + if (!contains (pos_str0)) return 0; char const* data_str0 = to_str0 (); @@ -217,7 +217,7 @@ Source_file::get_char (char const* pos_str0) const int Source_file::get_column (char const* pos_str0) const { - if (!in_b (pos_str0)) + if (!contains (pos_str0)) return 0; int ch_i = get_char (pos_str0); @@ -236,7 +236,7 @@ Source_file::get_column (char const* pos_str0) const String Source_file::error_string (char const* pos_str0) const { - if (!in_b (pos_str0)) + if (!contains (pos_str0)) return " (" + _ ("position unknown") + ")"; int ch_i = get_char (pos_str0); @@ -250,7 +250,7 @@ Source_file::error_string (char const* pos_str0) const } bool -Source_file::in_b (char const* pos_str0) const +Source_file::contains (char const* pos_str0) const { return (pos_str0 && (pos_str0 >= to_str0 ()) && (pos_str0 <= to_str0 () + length ())); } @@ -258,7 +258,7 @@ Source_file::in_b (char const* pos_str0) const int Source_file::get_line (char const* pos_str0) const { - if (!in_b (pos_str0)) + if (!contains (pos_str0)) return 0; if (!newline_locations_.size()) @@ -298,7 +298,7 @@ Source_file::to_str0 () const void Source_file::set_pos (char const * pos_str0) { - if (in_b (pos_str0)) + if (contains (pos_str0)) pos_str0_ = pos_str0; else error (error_string (pos_str0) + "invalid pos"); @@ -310,7 +310,7 @@ Source_file::seek_str0 (int n) char const* new_str0 = to_str0 () + n; if (n < 0) new_str0 += length (); - if (in_b (new_str0)) + if (contains (new_str0)) pos_str0_ = new_str0; else error (error_string (new_str0) + "seek past eof"); @@ -323,7 +323,7 @@ Source_file::forward_str0 (int n) { char const* old_pos = pos_str0_; char const* new_str0 = pos_str0_ + n; - if (in_b (new_str0)) + if (contains (new_str0)) pos_str0_ = new_str0; else error (error_string (new_str0) + "forward past eof"); diff --git a/lily/source.cc b/lily/source.cc index 1ba4378196..da6ce5339d 100644 --- a/lily/source.cc +++ b/lily/source.cc @@ -78,7 +78,7 @@ Sources::get_sourcefile (char const* str0) { for (Cons *i = sourcefile_list_; i; i = i->next_) - if (i->car_->in_b (str0)) + if (i->car_->contains (str0)) return i->car_; return 0; } diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 4399fc5051..eb83b6097b 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -121,8 +121,8 @@ loose_column (Grob *l, Grob *c, Grob *r) some cases (two isolated, consecutive clef changes) won't be nicely folded, but hey, then don't do that. */ - if(! ((Paper_column::is_musical (l_neighbor) || Item::breakable_b (l_neighbor)) - && (Paper_column::is_musical (r_neighbor) || Item::breakable_b (r_neighbor))) ) + if(! ((Paper_column::is_musical (l_neighbor) || Item::is_breakable (l_neighbor)) + && (Paper_column::is_musical (r_neighbor) || Item::is_breakable (r_neighbor))) ) { return false; } @@ -167,7 +167,7 @@ Spacing_spanner::prune_loose_columns (Grob*me,Link_array *cols, Rational s Real increment = robust_scm2double (me->get_grob_property ("spacing-increment"), 1.2); for (int i=0; i < cols->size (); i++) { - if (Item::breakable_b (cols->elem(i)) || Paper_column::is_musical (cols->elem (i))) + if (Item::is_breakable (cols->elem(i)) || Paper_column::is_musical (cols->elem (i))) { newcols.push (cols->elem(i)); continue; @@ -339,7 +339,7 @@ Spacing_spanner::set_implicit_neighbor_columns (Link_array cols) for (int i = 0; i < cols.size (); i++) { Item * it = dynamic_cast(cols[i]); - if (!Item::breakable_b (it) && !Paper_column::is_musical (it)) + if (!Item::is_breakable (it) && !Paper_column::is_musical (it)) continue; // it->breakable || it->musical @@ -394,7 +394,7 @@ Spacing_spanner::set_springs (SCM smob) for (int i = 1; i < all.size (); i++) { Grob *sc = all[i]; - if (Item::breakable_b (sc)) + if (Item::is_breakable (sc)) { Link_array measure (all.slice (j, i+1)); do_measure (global_shortest, me, &measure); @@ -446,7 +446,7 @@ Spacing_spanner::find_shortest (Grob *me, Link_array const &cols) shortest_in_measure = shortest_in_measure breakable_b (l) && r->breakable_b(r)) + if (l->is_breakable (l) && r->is_breakable (r)) { Moment *dt = unsmob_moment (l->get_grob_property ("measure-length")); Moment mlen (1); diff --git a/lily/spanner.cc b/lily/spanner.cc index d5341c4c55..dfa24281a0 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -37,7 +37,7 @@ Spanner::do_break_processing () { if (Spanner* parent = dynamic_cast (get_parent ((Axis)a))) { - if (!parent->spanned_rank_iv ().contains_b (this->spanned_rank_iv ())) + if (!parent->spanned_rank_iv ().superset (this->spanned_rank_iv ())) { programming_error (to_string ("Spanner `%s' is not fully contained in parent spanner `%s'.", name ().to_str0 (), diff --git a/lily/system.cc b/lily/system.cc index aaad06c870..b6d7c70d04 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -131,7 +131,7 @@ System::output_lines () Kill no longer needed grobs. */ Item * it = dynamic_cast (g); - if (it && Item::breakable_b(it)) + if (it && Item::is_breakable (it)) { it->find_prebroken_piece (LEFT)->suicide(); it->find_prebroken_piece (RIGHT)->suicide(); @@ -570,7 +570,7 @@ System::broken_col_range (Item const*l, Item const*r) const while (gh_pair_p (s) && ly_car (s) != l->self_scm ()) { Paper_column*c = dynamic_cast (unsmob_grob (ly_car (s))); - if (Item::breakable_b (c) && !c->system_) + if (Item::is_breakable (c) && !c->system_) ret.push (c); s = ly_cdr (s); @@ -592,7 +592,7 @@ System::columns ()const bool bfound = false; for (int i= acs.size (); i -- ;) { - bool brb = Item::breakable_b (acs[i]); + bool brb = Item::is_breakable (acs[i]); bfound = bfound || brb; /* diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc index 97681de90a..f4d24c71f0 100644 --- a/lily/vertical-align-engraver.cc +++ b/lily/vertical-align-engraver.cc @@ -58,7 +58,7 @@ Vertical_align_engraver::qualifies (Grob_info i) const int sz = i.origin_contexts ((Translator*)this).size () ; return sz > 0 && Axis_group_interface::has_interface (i.grob_) - && !i.grob_->get_parent (Y_AXIS) && Axis_group_interface::axis_b (i.grob_, Y_AXIS); + && !i.grob_->get_parent (Y_AXIS) && Axis_group_interface::has_axis (i.grob_, Y_AXIS); } void