diff options
283 files changed, 1504 insertions, 1562 deletions
diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index 4bdf597357..016433d2ba 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -233,7 +233,7 @@ Accidental_engraver::process_acknowledged () Stream_event *note = accidentals_[i].melodic_; Context *origin = accidentals_[i].origin_; - Pitch *pitch = Pitch::unsmob (note->get_property ("pitch")); + Pitch *pitch = unsmob<Pitch> (note->get_property ("pitch")); if (!pitch) continue; @@ -348,7 +348,7 @@ Accidental_engraver::make_suggested_accidental (Stream_event * /* note */, Grob *a = trans->make_item ("AccidentalSuggestion", note_head->self_scm ()); Side_position_interface::add_support (a, note_head); - if (Grob *stem = Grob::unsmob (a->get_object ("stem"))) + if (Grob *stem = unsmob<Grob> (a->get_object ("stem"))) Side_position_interface::add_support (a, stem); a->set_parent (note_head, X_AXIS); @@ -372,8 +372,8 @@ Accidental_engraver::stop_translation_timestep () { // Don't mark accidentals as "tied" when the pitch is not // actually the same. This is relevant for enharmonic ties. - Stream_event *le = Stream_event::unsmob (l->get_property ("cause")); - Stream_event *re = Stream_event::unsmob (r->get_property ("cause")); + Stream_event *le = unsmob<Stream_event> (l->get_property ("cause")); + Stream_event *re = unsmob<Stream_event> (r->get_property ("cause")); if (le && re && !ly_is_equal (le->get_property ("pitch"), re->get_property ("pitch"))) continue; @@ -399,7 +399,7 @@ Accidental_engraver::stop_translation_timestep () int barnum = measure_number (origin); - Pitch *pitch = Pitch::unsmob (note->get_property ("pitch")); + Pitch *pitch = unsmob<Pitch> (note->get_property ("pitch")); if (!pitch) continue; @@ -409,7 +409,7 @@ Accidental_engraver::stop_translation_timestep () SCM key = scm_cons (scm_from_int (o), scm_from_int (n)); Moment end_mp = measure_position (context (), - Duration::unsmob (note->get_property ("duration"))); + unsmob<Duration> (note->get_property ("duration"))); SCM position = scm_cons (scm_from_int (barnum), end_mp.smobbed_copy ()); SCM localsig = SCM_EOL; diff --git a/lily/accidental-placement.cc b/lily/accidental-placement.cc index 04883f03a9..3555435bea 100644 --- a/lily/accidental-placement.cc +++ b/lily/accidental-placement.cc @@ -36,14 +36,14 @@ accidental_pitch (Grob *acc) { SCM cause = acc->get_parent (Y_AXIS)->get_property ("cause"); - Stream_event *mcause = Stream_event::unsmob (cause); + Stream_event *mcause = unsmob<Stream_event> (cause); if (!mcause) { programming_error ("note head has no event cause"); return 0; } - return Pitch::unsmob (mcause->get_property ("pitch")); + return unsmob<Pitch> (mcause->get_property ("pitch")); } void @@ -85,9 +85,9 @@ Accidental_placement::split_accidentals (Grob *accs, acs = scm_cdr (acs)) for (SCM s = scm_cdar (acs); scm_is_pair (s); s = scm_cdr (s)) { - Grob *a = Grob::unsmob (scm_car (s)); + Grob *a = unsmob<Grob> (scm_car (s)); - if (Grob::is_smob (a->get_object ("tie")) + if (unsmob<Grob> (a->get_object ("tie")) && !to_boolean (a->get_property ("forced"))) break_reminder->push_back (a); else @@ -237,7 +237,7 @@ build_apes (SCM accs) Accidental_placement_entry *ape = new Accidental_placement_entry; for (SCM t = scm_cdar (s); scm_is_pair (t); t = scm_cdr (t)) - ape->grobs_.push_back (Grob::unsmob (scm_car (t))); + ape->grobs_.push_back (unsmob<Grob> (scm_car (t))); apes.push_back (ape); } @@ -285,7 +285,7 @@ set_ape_skylines (Accidental_placement_entry *ape, offset -= a->extent (a, X_AXIS).length () + padding; } - if (Skyline_pair *sky = Skyline_pair::unsmob (a->get_property ("horizontal-skylines"))) + if (Skyline_pair *sky = unsmob<Skyline_pair> (a->get_property ("horizontal-skylines"))) { Skyline_pair copy (*sky); copy.raise (a->relative_coordinate (common[X_AXIS], X_AXIS)); @@ -470,7 +470,7 @@ MAKE_SCHEME_CALLBACK (Accidental_placement, calc_positioning_done, 1); SCM Accidental_placement::calc_positioning_done (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); if (!me->is_live ()) return SCM_BOOL_T; diff --git a/lily/accidental.cc b/lily/accidental.cc index 06873f0705..4343c2dc5a 100644 --- a/lily/accidental.cc +++ b/lily/accidental.cc @@ -48,16 +48,16 @@ MAKE_SCHEME_CALLBACK (Accidental_interface, horizontal_skylines, 1); SCM Accidental_interface::horizontal_skylines (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); if (!me->is_live ()) return Skyline_pair ().smobbed_copy (); - Stencil *my_stencil = Stencil::unsmob (me->get_property ("stencil")); + Stencil *my_stencil = unsmob<Stencil> (me->get_property ("stencil")); if (!my_stencil) return Skyline_pair ().smobbed_copy (); Skyline_pair *sky = - Skyline_pair::unsmob + unsmob<Skyline_pair> (Stencil::skylines_from_stencil (my_stencil->smobbed_copy (), 0.0, Y_AXIS)); @@ -90,8 +90,8 @@ MAKE_SCHEME_CALLBACK (Accidental_interface, height, 1); SCM Accidental_interface::height (SCM smob) { - Grob *me = Grob::unsmob (smob); - Grob *tie = Grob::unsmob (me->get_object ("tie")); + Grob *me = unsmob<Grob> (smob); + Grob *tie = unsmob<Grob> (me->get_object ("tie")); if (tie && !to_boolean (me->get_property ("forced")) @@ -105,8 +105,8 @@ MAKE_SCHEME_CALLBACK (Accidental_interface, remove_tied, 1); SCM Accidental_interface::remove_tied (SCM smob) { - Grob *me = Grob::unsmob (smob); - Grob *tie = Grob::unsmob (me->get_object ("tie")); + Grob *me = unsmob<Grob> (smob); + Grob *tie = unsmob<Grob> (me->get_object ("tie")); if (tie && !to_boolean (me->get_property ("forced")) @@ -121,7 +121,7 @@ MAKE_SCHEME_CALLBACK (Accidental_interface, print, 1); SCM Accidental_interface::print (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return get_stencil (me); } diff --git a/lily/align-interface.cc b/lily/align-interface.cc index fffc64b1bb..32eb1edace 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -36,7 +36,7 @@ MAKE_SCHEME_CALLBACK (Align_interface, align_to_minimum_distances, 1); SCM Align_interface::align_to_minimum_distances (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); me->set_property ("positioning-done", SCM_BOOL_T); @@ -52,7 +52,7 @@ MAKE_SCHEME_CALLBACK (Align_interface, align_to_ideal_distances, 1); SCM Align_interface::align_to_ideal_distances (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); me->set_property ("positioning-done", SCM_BOOL_T); @@ -76,7 +76,7 @@ get_skylines (Grob *g, if (!pure) { - Skyline_pair *skys = Skyline_pair::unsmob (g->get_property (a == Y_AXIS + Skyline_pair *skys = unsmob<Skyline_pair> (g->get_property (a == Y_AXIS ? "vertical-skylines" : "horizontal-skylines")); if (skys) @@ -353,11 +353,11 @@ void Align_interface::set_ordered (Grob *me) { SCM ga_scm = me->get_object ("elements"); - Grob_array *ga = Grob_array::unsmob (ga_scm); + Grob_array *ga = unsmob<Grob_array> (ga_scm); if (!ga) { ga_scm = Grob_array::make_array (); - ga = Grob_array::unsmob (ga_scm); + ga = unsmob<Grob_array> (ga_scm); me->set_object ("elements", ga_scm); } diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index 31e8fbb619..0c855fd4d0 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -113,7 +113,7 @@ All_font_metrics::find_pango_font (PangoFontDescription const *description, scm_from_double (1.0)); } g_free (pango_fn); - return derived_unsmob<Pango_font> (val); + return unsmob<Pango_font> (val); } #endif @@ -138,15 +138,15 @@ All_font_metrics::find_otf (const string &name) debug_output ("]", false); - Font_metric::unsmob (val)->file_name_ = file_name; + unsmob<Font_metric> (val)->file_name_ = file_name; SCM name_string = ly_string2scm (name); - Font_metric::unsmob (val)->description_ = scm_cons (name_string, + unsmob<Font_metric> (val)->description_ = scm_cons (name_string, scm_from_double (1.0)); otf_dict_->set (sname, val); - Font_metric::unsmob (val)->unprotect (); + unsmob<Font_metric> (val)->unprotect (); } - return derived_unsmob<Open_type_font> (val); + return unsmob<Open_type_font> (val); } Font_metric * diff --git a/lily/ambitus-engraver.cc b/lily/ambitus-engraver.cc index fedf31e5d4..9ceea9387c 100644 --- a/lily/ambitus-engraver.cc +++ b/lily/ambitus-engraver.cc @@ -144,9 +144,9 @@ Ambitus_engraver::acknowledge_note_head (Grob_info info) If the engraver is added to a percussion context, filter out unpitched note heads. */ - if (!Pitch::is_smob (p)) + if (!unsmob<Pitch> (p)) return; - Pitch pitch = *Pitch::unsmob (p); + Pitch pitch = *unsmob<Pitch> (p); Drul_array<bool> expands = pitch_interval_.add_point (pitch); if (expands[UP]) causes_[UP] = nr; diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc index 54a9a4903a..5ba2e59279 100644 --- a/lily/arpeggio.cc +++ b/lily/arpeggio.cc @@ -60,7 +60,7 @@ MAKE_SCHEME_CALLBACK (Arpeggio, calc_cross_staff, 1); SCM Arpeggio::calc_cross_staff (SCM grob) { - Grob *me = Grob::unsmob (grob); + Grob *me = unsmob<Grob> (grob); extract_grob_set (me, "stems", stems); Grob *vag = 0; @@ -83,7 +83,7 @@ MAKE_SCHEME_CALLBACK (Arpeggio, calc_positions, 1); SCM Arpeggio::calc_positions (SCM grob) { - Grob *me = Grob::unsmob (grob); + Grob *me = unsmob<Grob> (grob); Grob *common = get_common_y (me); /* @@ -116,7 +116,7 @@ MAKE_SCHEME_CALLBACK (Arpeggio, print, 1); SCM Arpeggio::print (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Interval heads = robust_scm2interval (me->get_property ("positions"), Interval ()) * Staff_symbol_referencer::staff_space (me); @@ -184,7 +184,7 @@ MAKE_SCHEME_CALLBACK (Arpeggio, brew_chord_bracket, 1); SCM Arpeggio::brew_chord_bracket (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Interval heads = robust_scm2interval (me->get_property ("positions"), Interval ()) * Staff_symbol_referencer::staff_space (me); @@ -203,7 +203,7 @@ MAKE_SCHEME_CALLBACK (Arpeggio, brew_chord_slur, 1); SCM Arpeggio::brew_chord_slur (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); SCM dash_definition = me->get_property ("dash-definition"); Interval heads = robust_scm2interval (me->get_property ("positions"), Interval ()) @@ -230,7 +230,7 @@ MAKE_SCHEME_CALLBACK (Arpeggio, width, 1); SCM Arpeggio::width (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return ly_interval2scm (get_squiggle (me).extent (X_AXIS)); } @@ -238,7 +238,7 @@ MAKE_SCHEME_CALLBACK (Arpeggio, pure_height, 3); SCM Arpeggio::pure_height (SCM smob, SCM, SCM) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); if (to_boolean (me->get_property ("cross-staff"))) return ly_interval2scm (Interval ()); diff --git a/lily/articulations.cc b/lily/articulations.cc index e55e7eb8ff..334e438682 100644 --- a/lily/articulations.cc +++ b/lily/articulations.cc @@ -56,7 +56,7 @@ articulation_list (vector<Stream_event *> note_events, for (SCM s = event->get_property ("articulations"); !articulation_event && scm_is_pair (s); s = scm_cdr (s)) { - Stream_event *art = Stream_event::unsmob (scm_car (s)); + Stream_event *art = unsmob<Stream_event> (scm_car (s)); if (art->in_event_class (articulation_name)) articulation_event = art; diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index beb8fce390..7500ec9ef0 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -395,7 +395,7 @@ Auto_beam_engraver::acknowledge_stem (Grob_info info) return; } - int durlog = Duration::unsmob (ev->get_property ("duration"))->duration_log (); + int durlog = unsmob<Duration> (ev->get_property ("duration"))->duration_log (); if (durlog <= 2) { @@ -411,10 +411,10 @@ Auto_beam_engraver::acknowledge_stem (Grob_info info) if (!is_same_grace_state (beam_start_location_, now)) return; - Duration *stem_duration = Duration::unsmob (ev->get_property ("duration")); + Duration *stem_duration = unsmob<Duration> (ev->get_property ("duration")); Moment dur = stem_duration->get_length (); - //Moment dur = Duration::unsmob (ev->get_property ("duration"))->get_length (); + //Moment dur = unsmob<Duration> (ev->get_property ("duration"))->get_length (); Moment measure_now = measure_position (context ()); bool recheck_needed = false; diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc index 41459bd56a..1709d4a86f 100644 --- a/lily/auto-change-iterator.cc +++ b/lily/auto-change-iterator.cc @@ -108,7 +108,7 @@ Auto_change_iterator::process (Moment m) for (; scm_is_pair (split_list_); split_list_ = scm_cdr (split_list_)) { - splitm = Moment::unsmob (scm_caar (split_list_)); + splitm = unsmob<Moment> (scm_caar (split_list_)); if ((*splitm + start_moment_) > now) break; diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc index adc0dae661..3a9b0d6775 100644 --- a/lily/axis-group-engraver.cc +++ b/lily/axis-group-engraver.cc @@ -89,7 +89,7 @@ Axis_group_engraver::process_music () if (!staffline_ && active_) { staffline_ = get_spanner (); - Grob *it = Grob::unsmob (get_property ("currentCommandColumn")); + Grob *it = unsmob<Grob> (get_property ("currentCommandColumn")); staffline_->set_bound (LEFT, it); } interesting_ = get_property ("keepAliveInterfaces"); @@ -106,7 +106,7 @@ Axis_group_engraver::finalize () { if (staffline_) { - Grob *it = Grob::unsmob (get_property ("currentCommandColumn")); + Grob *it = unsmob<Grob> (get_property ("currentCommandColumn")); staffline_->set_bound (RIGHT, it); Pointer_group_interface::set_ordered (staffline_, ly_symbol2scm ("elements"), false); @@ -141,7 +141,7 @@ Axis_group_engraver::process_acknowledged () for (vsize i = 0; i < elts_.size (); i++) { - if (!Grob::is_smob (elts_[i]->get_object ("axis-group-parent-Y"))) + if (!unsmob<Grob> (elts_[i]->get_object ("axis-group-parent-Y"))) { if (staffline_->get_parent (Y_AXIS) && staffline_->get_parent (Y_AXIS) == elts_[i]) diff --git a/lily/axis-group-interface-scheme.cc b/lily/axis-group-interface-scheme.cc index 8e183f9d34..ed47496fde 100644 --- a/lily/axis-group-interface-scheme.cc +++ b/lily/axis-group-interface-scheme.cc @@ -27,7 +27,7 @@ LY_DEFINE (ly_relative_group_extent, "ly:relative-group-extent", "Determine the extent of @var{elements} relative to @var{common} in the" " @var{axis} direction.") { - Grob_array *ga = Grob_array::unsmob (elements); + Grob_array *ga = unsmob<Grob_array> (elements); SCM_ASSERT_TYPE (ga || scm_is_pair (elements), elements, SCM_ARG1, __FUNCTION__, "list or Grob_array"); LY_ASSERT_SMOB (Grob, common, 2); @@ -37,11 +37,11 @@ LY_DEFINE (ly_relative_group_extent, "ly:relative-group-extent", if (!ga) { for (SCM s = elements; scm_is_pair (s); s = scm_cdr (s)) - elts.push_back (Grob::unsmob (scm_car (s))); + elts.push_back (unsmob<Grob> (scm_car (s))); } Interval ext = Axis_group_interface::relative_group_extent (ga ? ga->array () : elts, - Grob::unsmob (common), + unsmob<Grob> (common), (Axis) scm_to_int (axis)); return ly_interval2scm (ext); } @@ -56,7 +56,7 @@ LY_DEFINE (ly_generic_bound_extent, "ly:generic-bound-extent", LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_SMOB (Grob, common, 2); - Interval ext = Axis_group_interface::generic_bound_extent (Grob::unsmob (grob), Grob::unsmob (common), X_AXIS); + Interval ext = Axis_group_interface::generic_bound_extent (unsmob<Grob> (grob), unsmob<Grob> (common), X_AXIS); return ly_interval2scm (ext); } @@ -67,6 +67,6 @@ LY_DEFINE (ly_axis_group_interface__add_element, "ly:axis-group-interface::add-e { LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_SMOB (Grob, grob_element, 2); - Axis_group_interface::add_element (Grob::unsmob (grob), Grob::unsmob (grob_element)); + Axis_group_interface::add_element (unsmob<Grob> (grob), unsmob<Grob> (grob_element)); return SCM_UNSPECIFIED; } diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index 4056e25651..eabb81adaf 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -221,9 +221,9 @@ MAKE_SCHEME_CALLBACK (Axis_group_interface, adjacent_pure_heights, 1) SCM Axis_group_interface::adjacent_pure_heights (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); - Grob *common = Grob::unsmob (me->get_object ("pure-Y-common")); + Grob *common = unsmob<Grob> (me->get_object ("pure-Y-common")); extract_grob_set (me, "pure-relevant-grobs", elts); Paper_score *ps = get_root_system (me)->paper_score (); @@ -331,7 +331,7 @@ Axis_group_interface::relative_pure_height (Grob *me, int start, int end) if (p && Align_interface::has_interface (p)) return Axis_group_interface::sum_partial_pure_heights (me, start, end); - Grob *common = Grob::unsmob (me->get_object ("pure-Y-common")); + Grob *common = unsmob<Grob> (me->get_object ("pure-Y-common")); extract_grob_set (me, "pure-relevant-grobs", elts); Interval r; @@ -356,7 +356,7 @@ MAKE_SCHEME_CALLBACK (Axis_group_interface, width, 1); SCM Axis_group_interface::width (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return generic_group_extent (me, X_AXIS); } @@ -364,7 +364,7 @@ MAKE_SCHEME_CALLBACK (Axis_group_interface, height, 1); SCM Axis_group_interface::height (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return generic_group_extent (me, Y_AXIS); } @@ -374,7 +374,7 @@ Axis_group_interface::pure_height (SCM smob, SCM start_scm, SCM end_scm) { int start = robust_scm2int (start_scm, 0); int end = robust_scm2int (end_scm, INT_MAX); - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); /* Maybe we are in the second pass of a two-pass spacing run. In that case, the Y-extent of a system is already given to us */ @@ -394,7 +394,7 @@ MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_skylines, 1); SCM Axis_group_interface::calc_skylines (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Skyline_pair skylines = skyline_spacing (me); return skylines.smobbed_copy (); } @@ -409,7 +409,7 @@ MAKE_SCHEME_CALLBACK (Axis_group_interface, combine_skylines, 1); SCM Axis_group_interface::combine_skylines (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "elements", elements); Grob *y_common = common_refpoint_of_array (elements, me, Y_AXIS); Grob *x_common = common_refpoint_of_array (elements, me, X_AXIS); @@ -421,10 +421,10 @@ Axis_group_interface::combine_skylines (SCM smob) for (vsize i = 0; i < elements.size (); i++) { SCM skyline_scm = elements[i]->get_property ("vertical-skylines"); - if (Skyline_pair::is_smob (skyline_scm)) + if (unsmob<Skyline_pair> (skyline_scm)) { Real offset = elements[i]->relative_coordinate (y_common, Y_AXIS); - Skyline_pair other = *Skyline_pair::unsmob (skyline_scm); + Skyline_pair other = *unsmob<Skyline_pair> (skyline_scm); other.raise (offset); other.shift (elements[i]->relative_coordinate (x_common, X_AXIS)); ret.merge (other); @@ -473,7 +473,7 @@ MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_pure_relevant_grobs, 1); SCM Axis_group_interface::calc_pure_relevant_grobs (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); /* TODO: Filter out elements that belong to a different Axis_group, such as the tie in << \new Staff=A { c'1~ \change Staff=B c'} @@ -520,7 +520,7 @@ Axis_group_interface::internal_calc_pure_relevant_grobs (Grob *me, const string vector_sort (relevant_grobs, pure_staff_priority_less); SCM grobs_scm = Grob_array::make_array (); - Grob_array::unsmob (grobs_scm)->set_array (relevant_grobs); + unsmob<Grob_array> (grobs_scm)->set_array (relevant_grobs); return grobs_scm; } @@ -529,7 +529,7 @@ MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_pure_y_common, 1); SCM Axis_group_interface::calc_pure_y_common (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "pure-relevant-grobs", elts); Grob *common = common_refpoint_of_array (elts, me, Y_AXIS); @@ -566,20 +566,20 @@ MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_x_common, 1); SCM Axis_group_interface::calc_x_common (SCM grob) { - return calc_common (Grob::unsmob (grob), X_AXIS); + return calc_common (unsmob<Grob> (grob), X_AXIS); } MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_y_common, 1); SCM Axis_group_interface::calc_y_common (SCM grob) { - return calc_common (Grob::unsmob (grob), Y_AXIS); + return calc_common (unsmob<Grob> (grob), Y_AXIS); } Interval Axis_group_interface::pure_group_height (Grob *me, int start, int end) { - Grob *common = Grob::unsmob (me->get_object ("pure-Y-common")); + Grob *common = unsmob<Grob> (me->get_object ("pure-Y-common")); if (!common) { @@ -644,7 +644,7 @@ pure_staff_priority_less (Grob *const &g1, Grob *const &g2) static void add_interior_skylines (Grob *me, Grob *x_common, Grob *y_common, vector<Skyline_pair> *skylines) { - if (Grob_array *elements = Grob_array::unsmob (me->get_object ("elements"))) + if (Grob_array *elements = unsmob<Grob_array> (me->get_object ("elements"))) { for (vsize i = 0; i < elements->size (); i++) add_interior_skylines (elements->grob (i), x_common, y_common, skylines); @@ -652,7 +652,7 @@ add_interior_skylines (Grob *me, Grob *x_common, Grob *y_common, vector<Skyline_ else if (!scm_is_number (me->get_property ("outside-staff-priority")) && !to_boolean (me->get_property ("cross-staff"))) { - Skyline_pair *maybe_pair = Skyline_pair::unsmob (me->get_property ("vertical-skylines")); + Skyline_pair *maybe_pair = unsmob<Skyline_pair> (me->get_property ("vertical-skylines")); if (!maybe_pair) return; if (maybe_pair->is_empty ()) @@ -794,7 +794,7 @@ add_grobs_of_one_priority (Grob *me, } last_end[dir] = x_extent[RIGHT]; - Skyline_pair *v_orig = Skyline_pair::unsmob (elt->get_property ("vertical-skylines")); + Skyline_pair *v_orig = unsmob<Skyline_pair> (elt->get_property ("vertical-skylines")); if (v_orig->is_empty ()) continue; @@ -806,7 +806,7 @@ add_grobs_of_one_priority (Grob *me, for (GrobMapIterator j = range.first; j != range.second; j++) { Grob *rider = j->second; - Skyline_pair *v_rider = Skyline_pair::unsmob (rider->get_property ("vertical-skylines")); + Skyline_pair *v_rider = unsmob<Skyline_pair> (rider->get_property ("vertical-skylines")); if (v_rider) { Skyline_pair copy (*v_rider); @@ -866,7 +866,7 @@ Axis_group_interface::outside_staff_ancestor (Grob *me) Skyline_pair Axis_group_interface::skyline_spacing (Grob *me) { - extract_grob_set (me, Grob_array::unsmob (me->get_object ("vertical-skyline-elements")) ? "vertical-skyline-elements" : "elements", fakeelements); + extract_grob_set (me, unsmob<Grob_array> (me->get_object ("vertical-skyline-elements")) ? "vertical-skyline-elements" : "elements", fakeelements); vector<Grob *> elements (fakeelements); for (vsize i = 0; i < elements.size (); i++) /* @@ -981,9 +981,9 @@ Axis_group_interface::print (SCM smob) if (!debug_skylines) return SCM_BOOL_F; - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Stencil ret; - if (Skyline_pair *s = Skyline_pair::unsmob (me->get_property ("vertical-skylines"))) + if (Skyline_pair *s = unsmob<Skyline_pair> (me->get_property ("vertical-skylines"))) { ret.add_stencil (Lookup::points_to_line_stencil (0.1, (*s)[UP].to_points (X_AXIS)) .in_color (255, 0, 255)); @@ -997,7 +997,7 @@ MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_pure_staff_staff_spacing, 3) SCM Axis_group_interface::calc_pure_staff_staff_spacing (SCM smob, SCM start, SCM end) { - return calc_maybe_pure_staff_staff_spacing (Grob::unsmob (smob), + return calc_maybe_pure_staff_staff_spacing (unsmob<Grob> (smob), true, scm_to_int (start), scm_to_int (end)); @@ -1007,7 +1007,7 @@ MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_staff_staff_spacing, 1) SCM Axis_group_interface::calc_staff_staff_spacing (SCM smob) { - return calc_maybe_pure_staff_staff_spacing (Grob::unsmob (smob), + return calc_maybe_pure_staff_staff_spacing (unsmob<Grob> (smob), false, 0, INT_MAX); @@ -1016,7 +1016,7 @@ Axis_group_interface::calc_staff_staff_spacing (SCM smob) SCM Axis_group_interface::calc_maybe_pure_staff_staff_spacing (Grob *me, bool pure, int start, int end) { - Grob *grouper = Grob::unsmob (me->get_object ("staff-grouper")); + Grob *grouper = unsmob<Grob> (me->get_object ("staff-grouper")); if (grouper) { diff --git a/lily/balloon-engraver.cc b/lily/balloon-engraver.cc index b5c96bcce1..980aa92231 100644 --- a/lily/balloon-engraver.cc +++ b/lily/balloon-engraver.cc @@ -71,7 +71,7 @@ Balloon_engraver::acknowledge_grob (Grob_info info) SCM arts = cause ? cause->get_property ("articulations") : SCM_EOL; for (SCM s = arts; scm_is_pair (s); s = scm_cdr (s)) { - Stream_event *e = Stream_event::unsmob (scm_car (s)); + Stream_event *e = unsmob<Stream_event> (scm_car (s)); if (e->in_event_class ("annotate-output-event")) { balloonify (info.grob (), e); diff --git a/lily/balloon.cc b/lily/balloon.cc index b412a435d2..2b898c3d25 100644 --- a/lily/balloon.cc +++ b/lily/balloon.cc @@ -42,7 +42,7 @@ MAKE_SCHEME_CALLBACK (Balloon_interface, print, 1); SCM Balloon_interface::print (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); if (Item *item = dynamic_cast<Item *> (me)) if (!Item::break_visible (item)) @@ -60,7 +60,7 @@ MAKE_SCHEME_CALLBACK (Balloon_interface, print_spanner, 1); SCM Balloon_interface::print_spanner (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); Spanner *orig = dynamic_cast<Spanner *> (me->original ()); if (orig) @@ -102,7 +102,7 @@ Balloon_interface::internal_balloon_print (Grob *me, Grob *p, Offset off) SCM chain = Font_interface::text_font_alist_chain (me); SCM stencil = Text_interface::interpret_markup (me->layout ()->self_scm (), chain, bt); - Stencil *text_stil = Stencil::unsmob (stencil); + Stencil *text_stil = unsmob<Stencil> (stencil); Offset z1; diff --git a/lily/bar-check-iterator.cc b/lily/bar-check-iterator.cc index 2a3efe757c..d86cfa6bdf 100644 --- a/lily/bar-check-iterator.cc +++ b/lily/bar-check-iterator.cc @@ -56,7 +56,7 @@ Bar_check_iterator::process (Moment m) SCM mp = tr->get_property ("measurePosition"); SCM sync = tr->get_property ("barCheckSynchronize"); - Moment *where = Moment::unsmob (mp); + Moment *where = unsmob<Moment> (mp); if (!where) return; @@ -73,8 +73,8 @@ Bar_check_iterator::process (Moment m) else { SCM lf = tr->get_property ("barCheckLastFail"); - if (Moment::is_smob (lf) - && *Moment::unsmob (lf) == *where) + if (unsmob<Moment> (lf) + && *unsmob<Moment> (lf) == *where) warn = false; else tr->set_property ("barCheckLastFail", mp); diff --git a/lily/beam-collision-engraver.cc b/lily/beam-collision-engraver.cc index 01dbbf9e5e..bb8e42e1cf 100644 --- a/lily/beam-collision-engraver.cc +++ b/lily/beam-collision-engraver.cc @@ -121,11 +121,11 @@ Beam_collision_engraver::finalize () { // Do not consider note heads attached to the beam. if (Stem::has_interface (covered_grob)) - if (Grob::is_smob (covered_grob->get_object ("beam"))) + if (unsmob<Grob> (covered_grob->get_object ("beam"))) continue; - if (Grob *stem = Grob::unsmob (covered_grob->get_object ("stem"))) - if (Grob *beam = Grob::unsmob (stem->get_object ("beam"))) + if (Grob *stem = unsmob<Grob> (covered_grob->get_object ("stem"))) + if (Grob *beam = unsmob<Grob> (stem->get_object ("beam"))) if (beam == beam_grob) continue; diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index f19f7e604e..e6ca4caf16 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -285,9 +285,9 @@ Beam_engraver::acknowledge_stem (Grob_info info) last_stem_added_at_ = now; - Duration *stem_duration = Duration::unsmob (ev->get_property ("duration")); + Duration *stem_duration = unsmob<Duration> (ev->get_property ("duration")); int durlog = stem_duration->duration_log (); - //int durlog = Duration::unsmob (ev->get_property ("duration"))->duration_log (); + //int durlog = unsmob<Duration> (ev->get_property ("duration"))->duration_log (); if (durlog <= 2) { ev->origin ()->warning (_ ("stem does not fit in beam")); diff --git a/lily/beam-quanting.cc b/lily/beam-quanting.cc index a1486cc7ee..d974cd760e 100644 --- a/lily/beam-quanting.cc +++ b/lily/beam-quanting.cc @@ -352,7 +352,7 @@ void Beam_scoring_problem::init_instance_variables (Grob *me, Drul_array<Real> y for (LEFT_and_RIGHT (d)) add_collision (b[X_AXIS][d], b[Y_AXIS], width_factor); - Grob *stem = Grob::unsmob (collisions[j]->get_object ("stem")); + Grob *stem = unsmob<Grob> (collisions[j]->get_object ("stem")); if (stem && Stem::has_interface (stem) && Stem::is_normal_stem (stem)) { colliding_stems.insert (stem); @@ -371,7 +371,7 @@ void Beam_scoring_problem::init_instance_variables (Grob *me, Drul_array<Real> y - my_y; Real factor = parameters_.STEM_COLLISION_FACTOR; - if (!Grob::is_smob (s->get_object ("beam"))) + if (!unsmob<Grob> (s->get_object ("beam"))) factor = 1.0; add_collision (x, y, factor); } diff --git a/lily/beam.cc b/lily/beam.cc index 82cbb1e766..064f5d7b66 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -145,11 +145,11 @@ MAKE_SCHEME_CALLBACK (Beam, calc_normal_stems, 1); SCM Beam::calc_normal_stems (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "stems", stems); SCM val = Grob_array::make_array (); - Grob_array *ga = Grob_array::unsmob (val); + Grob_array *ga = unsmob<Grob_array> (val); for (vsize i = 0; i < stems.size (); i++) if (Stem::is_normal_stem (stems[i])) ga->add (stems[i]); @@ -161,7 +161,7 @@ MAKE_SCHEME_CALLBACK (Beam, calc_direction, 1); SCM Beam::calc_direction (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); /* Beams with less than 2 two stems don't make much sense, but could happen when you do @@ -275,7 +275,7 @@ MAKE_SCHEME_CALLBACK (Beam, calc_beaming, 1) SCM Beam::calc_beaming (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "stems", stems); @@ -354,7 +354,7 @@ Beam::calc_beam_segments (SCM smob) { /* ugh, this has a side-effect that we need to ensure that Stem #'beaming is correct */ - Grob *me_grob = Grob::unsmob (smob); + Grob *me_grob = unsmob<Grob> (smob); (void) me_grob->get_property ("beaming"); Spanner *me = dynamic_cast<Spanner *> (me_grob); @@ -571,7 +571,7 @@ MAKE_SCHEME_CALLBACK (Beam, calc_x_positions, 1); SCM Beam::calc_x_positions (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); SCM segments = me->get_property ("beam-segments"); Interval x_positions; x_positions.set_empty (); @@ -612,7 +612,7 @@ MAKE_SCHEME_CALLBACK (Beam, print, 1); SCM Beam::print (SCM grob) { - Spanner *me = Spanner::unsmob (grob); + Spanner *me = unsmob<Spanner> (grob); /* TODO - mild code dup for all the commonx calls. Some use just common_refpoint_of_array, some (in print and @@ -740,7 +740,7 @@ Beam::print (SCM grob) Direction stem_dir = stems.size () ? to_dir (stems[0]->get_property ("direction")) : UP; - Stencil score = *Stencil::unsmob (Text_interface::interpret_markup + Stencil score = *unsmob<Stencil> (Text_interface::interpret_markup (me->layout ()->self_scm (), properties, annotation)); if (!score.is_empty ()) @@ -948,7 +948,7 @@ MAKE_SCHEME_CALLBACK (Beam, calc_stem_shorten, 1) SCM Beam::calc_stem_shorten (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); /* shortening looks silly for x staff beams @@ -983,7 +983,7 @@ MAKE_SCHEME_CALLBACK (Beam, quanting, 3); SCM Beam::quanting (SCM smob, SCM ys_scm, SCM align_broken_intos) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Drul_array<Real> ys = robust_scm2drul (ys_scm, Drul_array<Real> (infinity_f, -infinity_f)); bool cbs = to_boolean (align_broken_intos); @@ -1065,7 +1065,7 @@ MAKE_SCHEME_CALLBACK (Beam, set_stem_lengths, 1); SCM Beam::set_stem_lengths (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); /* trigger callbacks. */ (void) me->get_property ("direction"); @@ -1218,17 +1218,17 @@ MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Beam, rest_collision_callback, 2, 1, ""); SCM Beam::rest_collision_callback (SCM smob, SCM prev_offset) { - Grob *rest = Grob::unsmob (smob); + Grob *rest = unsmob<Grob> (smob); if (scm_is_number (rest->get_property ("staff-position"))) return scm_from_int (0); Real offset = robust_scm2double (prev_offset, 0.0); - Grob *st = Grob::unsmob (rest->get_object ("stem")); + Grob *st = unsmob<Grob> (rest->get_object ("stem")); Grob *stem = st; if (!stem) return scm_from_double (0.0); - Grob *beam = Grob::unsmob (stem->get_object ("beam")); + Grob *beam = unsmob<Grob> (stem->get_object ("beam")); if (!beam || !Beam::has_interface (beam) || !Beam::normal_stem_count (beam)) @@ -1313,11 +1313,11 @@ Beam::pure_rest_collision_callback (SCM smob, { Real previous = robust_scm2double (prev_offset, 0.0); - Grob *me = Grob::unsmob (smob); - Grob *stem = Grob::unsmob (me->get_object ("stem")); + Grob *me = unsmob<Grob> (smob); + Grob *stem = unsmob<Grob> (me->get_object ("stem")); if (!stem) return scm_from_double (previous); - Grob *beam = Grob::unsmob (stem->get_object ("beam")); + Grob *beam = unsmob<Grob> (stem->get_object ("beam")); if (!beam || !Beam::normal_stem_count (beam) || !is_direction (beam->get_property_data ("direction"))) @@ -1418,7 +1418,7 @@ MAKE_SCHEME_CALLBACK (Beam, calc_cross_staff, 1) SCM Beam::calc_cross_staff (SCM smob) { - return scm_from_bool (is_cross_staff (Grob::unsmob (smob))); + return scm_from_bool (is_cross_staff (unsmob<Grob> (smob))); } int diff --git a/lily/bend-engraver.cc b/lily/bend-engraver.cc index 30c50388aa..44b0f21eaa 100644 --- a/lily/bend-engraver.cc +++ b/lily/bend-engraver.cc @@ -53,7 +53,7 @@ Bend_engraver::finalize () // We shouldn't end a spanner on the last musical column of a piece because then // it would extend past the last breakable column of the piece. if (last_fall_) - last_fall_->set_bound (RIGHT, Grob::unsmob (get_property ("currentCommandColumn"))); + last_fall_->set_bound (RIGHT, unsmob<Grob> (get_property ("currentCommandColumn"))); } void @@ -61,7 +61,7 @@ Bend_engraver::stop_fall () { bool bar = scm_is_string (get_property ("whichBar")); - fall_->set_bound (RIGHT, Grob::unsmob (bar + fall_->set_bound (RIGHT, unsmob<Grob> (bar ? get_property ("currentCommandColumn") : get_property ("currentMusicalColumn"))); last_fall_ = fall_; diff --git a/lily/book-scheme.cc b/lily/book-scheme.cc index d5f1c79153..5512521bd5 100644 --- a/lily/book-scheme.cc +++ b/lily/book-scheme.cc @@ -29,7 +29,7 @@ LY_DEFINE (ly_make_book, "ly:make-book", "Make a @code{\\book} of @var{paper} and @var{header}" " (which may be @code{#f} as well) containing @code{\\scores}.") { - Output_def *odef = Output_def::unsmob (paper); + Output_def *odef = unsmob<Output_def> (paper); LY_ASSERT_SMOB (Output_def, paper, 1); Book *book = new Book; @@ -66,14 +66,14 @@ LY_DEFINE (ly_book_process, "ly:book-process", " For example, it may be a string (for file based outputs)" " or a socket (for network based output).") { - Book *book = Book::unsmob (book_smob); + Book *book = unsmob<Book> (book_smob); LY_ASSERT_SMOB (Book, book_smob, 1); LY_ASSERT_SMOB (Output_def, default_paper, 2); LY_ASSERT_SMOB (Output_def, default_layout, 3); - Paper_book *pb = book->process (Output_def::unsmob (default_paper), - Output_def::unsmob (default_layout)); + Paper_book *pb = book->process (unsmob<Output_def> (default_paper), + unsmob<Output_def> (default_layout)); if (pb) { pb->output (output); @@ -96,10 +96,10 @@ LY_DEFINE (ly_book_process_to_systems, "ly:book-process-to-systems", LY_ASSERT_SMOB (Output_def, default_paper, 2); LY_ASSERT_SMOB (Output_def, default_layout, 3); - Book *book = Book::unsmob (book_smob); + Book *book = unsmob<Book> (book_smob); - Paper_book *pb = book->process (Output_def::unsmob (default_paper), - Output_def::unsmob (default_layout)); + Paper_book *pb = book->process (unsmob<Output_def> (default_paper), + unsmob<Output_def> (default_layout)); if (pb) { pb->classic_output (output); @@ -114,7 +114,7 @@ LY_DEFINE (ly_book_add_score_x, "ly:book-add-score!", "Add @var{score} to @var{book-smob} score list.") { LY_ASSERT_SMOB (Book, book_smob, 1); - Book *book = Book::unsmob (book_smob); + Book *book = unsmob<Book> (book_smob); book->add_score (score); return SCM_UNSPECIFIED; } @@ -124,7 +124,7 @@ LY_DEFINE (ly_book_add_bookpart_x, "ly:book-add-bookpart!", "Add @var{book-part} to @var{book-smob} book part list.") { LY_ASSERT_SMOB (Book, book_smob, 1); - Book *book = Book::unsmob (book_smob); + Book *book = unsmob<Book> (book_smob); book->add_bookpart (book_part); return SCM_UNSPECIFIED; } @@ -134,7 +134,7 @@ LY_DEFINE (ly_book_book_parts, "ly:book-book-parts", "Return book parts in @var{book}.") { LY_ASSERT_SMOB (Book, book, 1); - Book *b = Book::unsmob (book); + Book *b = unsmob<Book> (book); return b->bookparts_; } @@ -143,7 +143,7 @@ LY_DEFINE (ly_book_paper, "ly:book-paper", "Return paper in @var{book}.") { LY_ASSERT_SMOB (Book, book, 1); - Book *b = Book::unsmob (book); + Book *b = unsmob<Book> (book); return b->paper_ ? b->paper_->self_scm () : SCM_BOOL_F; } @@ -152,7 +152,7 @@ LY_DEFINE (ly_book_header, "ly:book-header", "Return header in @var{book}.") { LY_ASSERT_SMOB (Book, book, 1); - Book *b = Book::unsmob (book); + Book *b = unsmob<Book> (book); return b->header_ ? b->header_ : SCM_BOOL_F; } @@ -164,7 +164,7 @@ LY_DEFINE (ly_book_set_header_x, "ly:book-set-header!", SCM_ASSERT_TYPE (ly_is_module (module), module, SCM_ARG2, __FUNCTION__, "module"); - Book *b = Book::unsmob (book); + Book *b = unsmob<Book> (book); b->header_ = (module); return SCM_UNSPECIFIED; } @@ -174,7 +174,7 @@ LY_DEFINE (ly_book_scores, "ly:book-scores", "Return scores in @var{book}.") { LY_ASSERT_SMOB (Book, book, 1); - Book *b = Book::unsmob (book); + Book *b = unsmob<Book> (book); return b->scores_; } diff --git a/lily/book.cc b/lily/book.cc index 8e63d889e0..8ba2aac908 100644 --- a/lily/book.cc +++ b/lily/book.cc @@ -72,9 +72,9 @@ Book::Book (Book const &s) { SCM entry = scm_car (p); - if (Score *newscore = Score::unsmob (entry)) + if (Score *newscore = unsmob<Score> (entry)) * t = scm_cons (newscore->clone ()->unprotect (), SCM_EOL); - else if (Page_marker *marker = Page_marker::unsmob (entry)) + else if (Page_marker *marker = unsmob<Page_marker> (entry)) * t = scm_cons (marker->clone ()->unprotect (), SCM_EOL); else { @@ -87,7 +87,7 @@ Book::Book (Book const &s) t = &bookparts_; for (SCM p = s.bookparts_; scm_is_pair (p); p = scm_cdr (p)) { - Book *newpart = Book::unsmob (scm_car (p))->clone (); + Book *newpart = unsmob<Book> (scm_car (p))->clone (); *t = scm_cons (newpart->self_scm (), SCM_EOL); t = SCM_CDRLOC (*t); @@ -98,7 +98,7 @@ Book::Book (Book const &s) Input * Book::origin () const { - return Input::unsmob (input_location_); + return unsmob<Input> (input_location_); } Book::~Book () @@ -168,7 +168,7 @@ void Book::add_bookpart (SCM b) { add_scores_to_bookpart (); - Book *part = Book::unsmob (b); + Book *part = unsmob<Book> (b); part->set_parent (this); bookparts_ = scm_cons (b, bookparts_); } @@ -177,12 +177,12 @@ bool Book::error_found () { for (SCM s = scores_; scm_is_pair (s); s = scm_cdr (s)) - if (Score *score = Score::unsmob (scm_car (s))) + if (Score *score = unsmob<Score> (scm_car (s))) if (score->error_found_) return true; for (SCM part = bookparts_; scm_is_pair (part); part = scm_cdr (part)) - if (Book *bookpart = Book::unsmob (scm_car (part))) + if (Book *bookpart = unsmob<Book> (scm_car (part))) if (bookpart->error_found ()) return true; @@ -202,7 +202,7 @@ Book::process_bookparts (Paper_book *output_paper_book, Output_def *paper, Outpu add_scores_to_bookpart (); for (SCM p = scm_reverse (bookparts_); scm_is_pair (p); p = scm_cdr (p)) { - if (Book *book = Book::unsmob (scm_car (p))) + if (Book *book = unsmob<Book> (scm_car (p))) { Paper_book *paper_book_part = book->process (paper, layout, output_paper_book); if (paper_book_part) @@ -219,14 +219,14 @@ Book::process_bookparts (Paper_book *output_paper_book, Output_def *paper, Outpu void Book::process_score (SCM s, Paper_book *output_paper_book, Output_def *layout) { - if (Score *score = Score::unsmob (scm_car (s))) + if (Score *score = unsmob<Score> (scm_car (s))) { SCM outputs = score ->book_rendering (output_paper_book->paper_, layout); while (scm_is_pair (outputs)) { - Music_output *output = Music_output::unsmob (scm_car (outputs)); + Music_output *output = unsmob<Music_output> (scm_car (outputs)); if (Performance *perf = dynamic_cast<Performance *> (output)) output_paper_book->add_performance (perf->self_scm ()); @@ -241,7 +241,7 @@ Book::process_score (SCM s, Paper_book *output_paper_book, Output_def *layout) } } else if (Text_interface::is_markup_list (scm_car (s)) - || Page_marker::is_smob (scm_car (s))) + || unsmob<Page_marker> (scm_car (s))) output_paper_book->add_score (scm_car (s)); else assert (0); diff --git a/lily/break-align-engraver.cc b/lily/break-align-engraver.cc index 9883976f0c..f9090c8e08 100644 --- a/lily/break-align-engraver.cc +++ b/lily/break-align-engraver.cc @@ -118,7 +118,7 @@ Break_align_engraver::create_alignment (Grob_info inf) Context *origin = inf.origin_contexts (this)[0]; Translator_group *tg = origin->implementation (); - Engraver *random_source = Engraver::unsmob (scm_car (tg->get_simple_trans_list ())); + Engraver *random_source = unsmob<Engraver> (scm_car (tg->get_simple_trans_list ())); if (!random_source) random_source = this; @@ -138,7 +138,7 @@ Break_align_engraver::add_to_group (SCM align_name, Item *item) if (scm_is_true (s)) { - Grob *e = Grob::unsmob (scm_cdr (s)); + Grob *e = unsmob<Grob> (scm_cdr (s)); group = dynamic_cast<Item *> (e); } else diff --git a/lily/break-alignment-interface.cc b/lily/break-alignment-interface.cc index bb7f02eda0..58cb488d6b 100644 --- a/lily/break-alignment-interface.cc +++ b/lily/break-alignment-interface.cc @@ -94,7 +94,7 @@ MAKE_SCHEME_CALLBACK (Break_alignment_interface, calc_positioning_done, 1) SCM Break_alignment_interface::calc_positioning_done (SCM smob) { - Grob *grob = Grob::unsmob (smob); + Grob *grob = unsmob<Grob> (smob); Item *me = dynamic_cast<Item *> (grob); me->set_property ("positioning-done", SCM_BOOL_T); @@ -189,8 +189,8 @@ Break_alignment_interface::calc_positioning_done (SCM smob) sym_string = ly_symbol2string (rsym); string orig_string; - if (Grob::is_smob (l->get_property ("cause"))) - orig_string = Grob::unsmob (l->get_property ("cause"))->name (); + if (unsmob<Grob> (l->get_property ("cause"))) + orig_string = unsmob<Grob> (l->get_property ("cause"))->name (); programming_error (to_string ("No spacing entry from %s to `%s'", orig_string.c_str (), @@ -261,7 +261,7 @@ MAKE_SCHEME_CALLBACK (Break_alignable_interface, self_align_callback, 1) SCM Break_alignable_interface::self_align_callback (SCM grob) { - Grob *me = Grob::unsmob (grob); + Grob *me = unsmob<Grob> (grob); Item *alignment = dynamic_cast<Item *> (me->get_parent (X_AXIS)); if (!Break_alignment_interface::has_interface (alignment)) return scm_from_int (0); @@ -308,7 +308,7 @@ MAKE_SCHEME_CALLBACK (Break_aligned_interface, calc_average_anchor, 1) SCM Break_aligned_interface::calc_average_anchor (SCM grob) { - Grob *me = Grob::unsmob (grob); + Grob *me = unsmob<Grob> (grob); Real avg = 0.0; int count = 0; @@ -331,7 +331,7 @@ MAKE_SCHEME_CALLBACK (Break_aligned_interface, calc_extent_aligned_anchor, 1) SCM Break_aligned_interface::calc_extent_aligned_anchor (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Real alignment = robust_scm2double (me->get_property ("break-align-anchor-alignment"), 0.0); Interval iv = me->extent (me, X_AXIS); @@ -346,7 +346,7 @@ SCM Break_aligned_interface::calc_break_visibility (SCM smob) { /* a BreakAlignGroup is break-visible if it has one element that is break-visible */ - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); SCM ret = scm_c_make_vector (3, SCM_EOL); extract_grob_set (me, "elements", elts); for (int dir = 0; dir <= 2; dir++) diff --git a/lily/break-substitution.cc b/lily/break-substitution.cc index f26e9510bc..c465979fb7 100644 --- a/lily/break-substitution.cc +++ b/lily/break-substitution.cc @@ -51,7 +51,7 @@ substitute_grob (Grob *sc) else { System *line - = derived_unsmob<System> (break_criterion); + = unsmob<System> (break_criterion); if (sc->get_system () != line) sc = sc->find_broken_piece (line); @@ -101,9 +101,9 @@ do_break_substitution (SCM src) { again: - if (Grob::is_smob (src)) + if (unsmob<Grob> (src)) { - Grob *new_ptr = substitute_grob (Grob::unsmob (src)); + Grob *new_ptr = substitute_grob (unsmob<Grob> (src)); return new_ptr ? new_ptr->self_scm () : SCM_UNDEFINED; } else if (scm_is_vector (src)) @@ -408,13 +408,13 @@ Spanner::fast_substitute_grob_array (SCM sym, set_break_subsititution (l ? l->self_scm () : SCM_UNDEFINED); SCM newval = sc->internal_get_object (sym); - if (!Grob_array::is_smob (newval)) + if (!unsmob<Grob_array> (newval)) { newval = Grob_array::make_array (); sc->set_object (sym, newval); } - Grob_array *new_array = Grob_array::unsmob (newval); + Grob_array *new_array = unsmob<Grob_array> (newval); for (int k = 0; k < 2; k++) for (int j = (*arrs[k])[i][LEFT]; j <= (*arrs[k])[i][RIGHT]; j++) { @@ -461,7 +461,7 @@ substitute_object_alist (SCM alist, SCM dest) SCM sym = scm_caar (s); SCM val = scm_cdar (s); - if (Grob_array *orig = Grob_array::unsmob (val)) + if (Grob_array *orig = unsmob<Grob_array> (val)) { SCM handle = scm_assq (sym, dest); SCM newval @@ -469,7 +469,7 @@ substitute_object_alist (SCM alist, SCM dest) ? scm_cdr (handle) : Grob_array::make_array (); - Grob_array *new_arr = Grob_array::unsmob (newval); + Grob_array *new_arr = unsmob<Grob_array> (newval); substitute_grob_array (orig, new_arr); val = newval; @@ -497,7 +497,7 @@ Spanner::substitute_one_mutable_property (SCM sym, Spanner *s = this; bool fast_done = false; - Grob_array *grob_array = Grob_array::unsmob (val); + Grob_array *grob_array = unsmob<Grob_array> (val); if (grob_array) fast_done = s->fast_substitute_grob_array (sym, grob_array); @@ -511,12 +511,12 @@ Spanner::substitute_one_mutable_property (SCM sym, if (grob_array) { SCM newval = sc->internal_get_object (sym); - if (!Grob_array::is_smob (newval)) + if (!unsmob<Grob_array> (newval)) { newval = Grob_array::make_array (); sc->set_object (sym, newval); } - substitute_grob_array (grob_array, Grob_array::unsmob (newval)); + substitute_grob_array (grob_array, unsmob<Grob_array> (newval)); } else { diff --git a/lily/breathing-sign.cc b/lily/breathing-sign.cc index 77dcfb4a30..6037e777e5 100644 --- a/lily/breathing-sign.cc +++ b/lily/breathing-sign.cc @@ -43,7 +43,7 @@ MAKE_SCHEME_CALLBACK (Breathing_sign, divisio_minima, 1); SCM Breathing_sign::divisio_minima (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Real staff_space = Staff_symbol_referencer::staff_space (me); Real thickness = Staff_symbol_referencer::line_thickness (me); @@ -69,7 +69,7 @@ MAKE_SCHEME_CALLBACK (Breathing_sign, divisio_maior, 1); SCM Breathing_sign::divisio_maior (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Real thickness = Staff_symbol_referencer::line_thickness (me); thickness *= robust_scm2double (me->get_property ("thickness"), 1.0); @@ -149,7 +149,7 @@ MAKE_SCHEME_CALLBACK (Breathing_sign, divisio_maxima, 1); SCM Breathing_sign::divisio_maxima (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Real staff_space = Staff_symbol_referencer::staff_space (me); Real thickness = Staff_symbol_referencer::line_thickness (me); thickness *= robust_scm2double (me->get_property ("thickness"), 1.0); @@ -172,7 +172,7 @@ MAKE_SCHEME_CALLBACK (Breathing_sign, finalis, 1); SCM Breathing_sign::finalis (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Real staff_space = Staff_symbol_referencer::staff_space (me); Real thickness = Staff_symbol_referencer::line_thickness (me); thickness *= robust_scm2double (me->get_property ("thickness"), 1.0); @@ -196,7 +196,7 @@ MAKE_SCHEME_CALLBACK (Breathing_sign, offset_callback, 1); SCM Breathing_sign::offset_callback (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Direction d = get_grob_direction (me); if (!d) diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index 10420273ab..db8493e2a5 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -96,7 +96,7 @@ Chord_name_engraver::process_music () { Stream_event *n = notes_[i]; SCM p = n->get_property ("pitch"); - if (!Pitch::is_smob (p)) + if (!unsmob<Pitch> (p)) continue; if (to_boolean (n->get_property ("bass"))) @@ -106,7 +106,7 @@ Chord_name_engraver::process_music () SCM oct = n->get_property ("octavation"); if (scm_is_number (oct)) { - Pitch orig = Pitch::unsmob (p)->transposed (Pitch (-scm_to_int (oct), 0)); + Pitch orig = unsmob<Pitch> (p)->transposed (Pitch (-scm_to_int (oct), 0)); pitches = scm_cons (orig.smobbed_copy (), pitches); } else diff --git a/lily/chord-name.cc b/lily/chord-name.cc index 2fcff940bb..8111c77117 100644 --- a/lily/chord-name.cc +++ b/lily/chord-name.cc @@ -30,7 +30,7 @@ MAKE_SCHEME_CALLBACK (Chord_name, after_line_breaking, 1); SCM Chord_name::after_line_breaking (SCM smob) { - Item *me = Item::unsmob (smob); + Item *me = unsmob<Item> (smob); assert (me); SCM s = me->get_property ("begin-of-line-visible"); diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index ebeb71a7cb..540bcd5f7b 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -145,7 +145,7 @@ static void apply_on_children (Context *context, SCM fun) scm_call_1 (fun, context->self_scm ()); for (SCM s = context->children_contexts (); scm_is_pair (s); s = scm_cdr (s)) - apply_on_children (Context::unsmob (scm_car (s)), fun); + apply_on_children (unsmob<Context> (scm_car (s)), fun); } void diff --git a/lily/clef-modifier.cc b/lily/clef-modifier.cc index 04ae174f6f..4c24dd356e 100644 --- a/lily/clef-modifier.cc +++ b/lily/clef-modifier.cc @@ -29,7 +29,7 @@ MAKE_SCHEME_CALLBACK (Clef_modifier, calc_parent_alignment, 1) SCM Clef_modifier::calc_parent_alignment (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Grob *clef = me->get_parent (X_AXIS); string full_clef_name = ly_scm2string (clef->get_property ("glyph")); string clef_name = replace_all(&full_clef_name, "clefs.", ""); diff --git a/lily/clef.cc b/lily/clef.cc index c38b899d00..6f9062190e 100644 --- a/lily/clef.cc +++ b/lily/clef.cc @@ -28,7 +28,7 @@ MAKE_SCHEME_CALLBACK (Clef, calc_glyph_name, 1); SCM Clef::calc_glyph_name (SCM smob) { - Item *s = Item::unsmob (smob); + Item *s = unsmob<Item> (smob); SCM glyph = s->get_property ("glyph"); if (scm_is_string (glyph)) @@ -53,7 +53,7 @@ MAKE_SCHEME_CALLBACK (Clef, print, 1) SCM Clef::print (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); SCM glyph_scm = me->get_property ("glyph-name"); if (!scm_is_string (glyph_scm)) return SCM_EOL; diff --git a/lily/cluster-engraver.cc b/lily/cluster-engraver.cc index 462a1d21fe..8af3137f90 100644 --- a/lily/cluster-engraver.cc +++ b/lily/cluster-engraver.cc @@ -101,7 +101,7 @@ Cluster_spanner_engraver::process_music () for (vsize i = 0; i < cluster_notes_.size (); i++) { - Pitch *pit = Pitch::unsmob (cluster_notes_[i]->get_property ("pitch")); + Pitch *pit = unsmob<Pitch> (cluster_notes_[i]->get_property ("pitch")); int p = (pit ? pit->steps () : 0) + c0; diff --git a/lily/cluster.cc b/lily/cluster.cc index 03e4e1eb36..694da482a5 100644 --- a/lily/cluster.cc +++ b/lily/cluster.cc @@ -125,7 +125,7 @@ MAKE_SCHEME_CALLBACK (Cluster, calc_cross_staff, 1); SCM Cluster::calc_cross_staff (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "columns", cols); Grob *commony = common_refpoint_of_array (cols, me, Y_AXIS); @@ -137,7 +137,7 @@ MAKE_SCHEME_CALLBACK (Cluster, print, 1); SCM Cluster::print (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Spanner *spanner = dynamic_cast<Spanner *> (me); if (!spanner) @@ -235,7 +235,7 @@ MAKE_SCHEME_CALLBACK (Cluster_beacon, height, 1); SCM Cluster_beacon::height (SCM g) { - Grob *me = Grob::unsmob (g); + Grob *me = unsmob<Grob> (g); Interval v = robust_scm2interval (me->get_property ("positions"), Interval (0, 0)); return ly_interval2scm (Staff_symbol_referencer::staff_space (me) * 0.5 * v); diff --git a/lily/coherent-ligature-engraver.cc b/lily/coherent-ligature-engraver.cc index d7960b4ff8..2ba9eeca85 100644 --- a/lily/coherent-ligature-engraver.cc +++ b/lily/coherent-ligature-engraver.cc @@ -151,7 +151,7 @@ compute_delta_pitches (vector<Grob_info> const &primitives) primitive = dynamic_cast<Item *> (primitives[i].grob ()); Stream_event *cause = primitives[i].event_cause (); int pitch - = Pitch::unsmob (cause->get_property ("pitch"))->steps (); + = unsmob<Pitch> (cause->get_property ("pitch"))->steps (); if (prev_primitive) { delta_pitch = pitch - prev_pitch; diff --git a/lily/completion-note-heads-engraver.cc b/lily/completion-note-heads-engraver.cc index 677ede56a6..f590d2a40f 100644 --- a/lily/completion-note-heads-engraver.cc +++ b/lily/completion-note-heads-engraver.cc @@ -109,8 +109,8 @@ Completion_heads_engraver::listen_note (Stream_event *ev) Moment Completion_heads_engraver::next_moment (Rational const ¬e_len) { - Moment *e = Moment::unsmob (get_property ("measurePosition")); - Moment *l = Moment::unsmob (get_property ("measureLength")); + Moment *e = unsmob<Moment> (get_property ("measurePosition")); + Moment *l = unsmob<Moment> (get_property ("measureLength")); if (!e || !l || !to_boolean (get_property ("timing"))) { return Moment (0, 0); @@ -123,7 +123,7 @@ Completion_heads_engraver::next_moment (Rational const ¬e_len) + e->to_string () + " of " + l->to_string ()); return 0; } - Moment const *unit = Moment::unsmob (get_property ("completionUnit")); + Moment const *unit = unsmob<Moment> (get_property ("completionUnit")); if (unit) { @@ -162,7 +162,7 @@ Item * Completion_heads_engraver::make_note_head (Stream_event *ev) { Item *note = make_item ("NoteHead", ev->self_scm ()); - Pitch *pit = Pitch::unsmob (ev->get_property ("pitch")); + Pitch *pit = unsmob<Pitch> (ev->get_property ("pitch")); int pos = pit->steps (); SCM c0 = get_property ("middleCPosition"); @@ -198,7 +198,7 @@ Completion_heads_engraver::process_music () } else { - orig = Duration::unsmob (note_events_[0]->get_property ("duration")); + orig = unsmob<Duration> (note_events_[0]->get_property ("duration")); note_dur = *orig; SCM factor = get_property ("completionFactor"); if (ly_is_procedure (factor)) diff --git a/lily/completion-rest-engraver.cc b/lily/completion-rest-engraver.cc index 6430629873..8f809fde70 100644 --- a/lily/completion-rest-engraver.cc +++ b/lily/completion-rest-engraver.cc @@ -105,15 +105,15 @@ Completion_rest_engraver::listen_rest (Stream_event *ev) Moment Completion_rest_engraver::next_moment (Rational const ¬e_len) { - Moment *e = Moment::unsmob (get_property ("measurePosition")); - Moment *l = Moment::unsmob (get_property ("measureLength")); + Moment *e = unsmob<Moment> (get_property ("measurePosition")); + Moment *l = unsmob<Moment> (get_property ("measureLength")); if (!e || !l || !to_boolean (get_property ("timing"))) { return Moment (0, 0); } Moment result = *l - *e; - Moment const *unit = Moment::unsmob (get_property ("completionUnit")); + Moment const *unit = unsmob<Moment> (get_property ("completionUnit")); if (unit) { @@ -152,7 +152,7 @@ Item * Completion_rest_engraver::make_rest (Stream_event *ev) { Item *rest = make_item ("Rest", ev->self_scm ()); - if (Pitch *p = Pitch::unsmob (ev->get_property ("pitch"))) + if (Pitch *p = unsmob<Pitch> (ev->get_property ("pitch"))) { int pos = p->steps (); SCM c0 = get_property ("middleCPosition"); @@ -188,7 +188,7 @@ Completion_rest_engraver::process_music () } else { - orig = Duration::unsmob (rest_events_[0]->get_property ("duration")); + orig = unsmob<Duration> (rest_events_[0]->get_property ("duration")); rest_dur = *orig; SCM factor = get_property ("completionFactor"); if (ly_is_procedure (factor)) diff --git a/lily/constrained-breaking.cc b/lily/constrained-breaking.cc index 1a98775a96..df08d5433c 100644 --- a/lily/constrained-breaking.cc +++ b/lily/constrained-breaking.cc @@ -560,7 +560,7 @@ Line_details::Line_details (Prob *pb, Output_def *paper) if (scm_is_pair (footnotes)) for (SCM s = footnotes; scm_is_pair (s); s = scm_cdr (s)) { - Stencil *sten = Stencil::unsmob (scm_caddar (s)); + Stencil *sten = unsmob<Stencil> (scm_caddar (s)); if (!sten) { programming_error ("expecting stencil, got empty pointer"); @@ -571,7 +571,7 @@ Line_details::Line_details (Prob *pb, Output_def *paper) last_column_ = 0; force_ = 0; - Stencil *st = Stencil::unsmob (pb->get_property ("stencil")); + Stencil *st = unsmob<Stencil> (pb->get_property ("stencil")); Interval stencil_extent = st->is_empty (Y_AXIS) ? Interval (0, 0) : st->extent (Y_AXIS); shape_ = Line_shape (stencil_extent, stencil_extent); // pretend it goes all the way across diff --git a/lily/context-def.cc b/lily/context-def.cc index 10f31ae830..7e391740a6 100644 --- a/lily/context-def.cc +++ b/lily/context-def.cc @@ -50,7 +50,7 @@ Context_def::Context_def () Input * Context_def::origin () const { - return Input::unsmob (input_location_); + return unsmob<Input> (input_location_); } Context_def::Context_def (Context_def const &s) @@ -235,7 +235,7 @@ Context_def::internal_path_to_acceptable_context (SCM type_sym, vector<Context_def *> accepteds; for (SCM s = accepted; scm_is_pair (s); s = scm_cdr (s)) - if (Context_def *t = Context_def::unsmob (find_context_def (odef, + if (Context_def *t = unsmob<Context_def> (find_context_def (odef, scm_car (s)))) accepteds.push_back (t); @@ -398,7 +398,7 @@ LY_DEFINE (ly_context_def_lookup, "ly:context-def-lookup", " @samp{property-ops}, @samp{context-name}, @samp{group-type}.") { LY_ASSERT_SMOB (Context_def, def, 1); - Context_def *cd = Context_def::unsmob (def); + Context_def *cd = unsmob<Context_def> (def); LY_ASSERT_TYPE (ly_is_symbol, sym, 2); SCM res = cd->lookup (sym); @@ -422,9 +422,9 @@ LY_DEFINE (ly_context_def_modify, "ly:context-def-modify", LY_ASSERT_SMOB (Context_def, def, 1); LY_ASSERT_SMOB (Context_mod, mod, 2); - Context_def *cd = Context_def::unsmob (def)->clone (); + Context_def *cd = unsmob<Context_def> (def)->clone (); - for (SCM s = Context_mod::unsmob (mod)->get_mods (); + for (SCM s = unsmob<Context_mod> (mod)->get_mods (); scm_is_pair (s); s = scm_cdr (s)) cd->add_context_mod (scm_car (s)); diff --git a/lily/context-mod-scheme.cc b/lily/context-mod-scheme.cc index 493e151c1d..a774fc7426 100644 --- a/lily/context-mod-scheme.cc +++ b/lily/context-mod-scheme.cc @@ -26,7 +26,7 @@ LY_DEFINE (ly_get_context_mods, "ly:get-context-mods", "Returns the list of context modifications stored in" " @var{contextmod}.") { - Context_mod *tr = Context_mod::unsmob (contextmod); + Context_mod *tr = unsmob<Context_mod> (contextmod); LY_ASSERT_SMOB (Context_mod, contextmod, 1); return tr->get_mods (); } @@ -36,7 +36,7 @@ LY_DEFINE (ly_add_context_mod, "ly:add-context-mod", "Adds the given context @var{modification} to the list" " @var{contextmods} of context modifications.") { - Context_mod *ctxmod = Context_mod::unsmob (contextmods); + Context_mod *ctxmod = unsmob<Context_mod> (contextmods); LY_ASSERT_SMOB (Context_mod, contextmods, 1); ctxmod->add_context_mod (modification); return SCM_UNSPECIFIED; @@ -63,8 +63,8 @@ LY_DEFINE (ly_context_mod_apply_x, "ly:context-mod-apply!", LY_ASSERT_SMOB (Context, context, 1); LY_ASSERT_SMOB (Context_mod, mod, 2); - apply_property_operations (Context::unsmob (context), - Context_mod::unsmob (mod)->get_mods ()); + apply_property_operations (unsmob<Context> (context), + unsmob<Context_mod> (mod)->get_mods ()); scm_remember_upto_here_1 (context); return SCM_UNSPECIFIED; } diff --git a/lily/context-property.cc b/lily/context-property.cc index 59bcf9afc6..5904254d7d 100644 --- a/lily/context-property.cc +++ b/lily/context-property.cc @@ -55,11 +55,11 @@ general_pushpop_property (Context *context, bool typecheck_grob (SCM symbol, SCM value) { - if (Unpure_pure_container *upc = Unpure_pure_container::unsmob (value)) + if (Unpure_pure_container *upc = unsmob<Unpure_pure_container> (value)) return typecheck_grob (symbol, upc->unpure_part ()) && typecheck_grob (symbol, upc->pure_part ()); return ly_is_procedure (value) - || Simple_closure::is_smob (value) + || unsmob<Simple_closure> (value) || type_check_assignment (symbol, value, ly_symbol2scm ("backend-type?")); } @@ -124,8 +124,8 @@ Grob_property_info::find () SCM res = SCM_UNDEFINED; if (Context *c = context_->where_defined (symbol_, &res)) if (c != context_) - return Grob_property_info (c, symbol_, Grob_properties::unsmob (res)); - props_ = Grob_properties::unsmob (res); + return Grob_property_info (c, symbol_, unsmob<Grob_properties> (res)); + props_ = unsmob<Grob_properties> (res); return *this; } @@ -136,7 +136,7 @@ Grob_property_info::check () return true; SCM res = SCM_UNDEFINED; if (context_->here_defined (symbol_, &res)) - props_ = Grob_properties::unsmob (res); + props_ = unsmob<Grob_properties> (res); return props_; } @@ -165,7 +165,7 @@ Grob_property_info::create () || !g->here_defined (symbol_, ¤t_context_val)) return false; - Grob_properties *def = Grob_properties::unsmob (current_context_val); + Grob_properties *def = unsmob<Grob_properties> (current_context_val); if (!def) { @@ -180,7 +180,7 @@ Grob_property_info::create () // any, they will be factored in when `updated' is being called. SCM props = Grob_properties (def->alist_, def->alist_).smobbed_copy (); context_->set_property (symbol_, props); - props_ = Grob_properties::unsmob (props); + props_ = unsmob<Grob_properties> (props); return props_; } diff --git a/lily/context-scheme.cc b/lily/context-scheme.cc index d4bd77296c..a26c168fac 100644 --- a/lily/context-scheme.cc +++ b/lily/context-scheme.cc @@ -28,7 +28,7 @@ LY_DEFINE (ly_context_current_moment, 1, 0, 0, (SCM context), "Return the current moment of @var{context}.") { - Context *tr = Context::unsmob (context); + Context *tr = unsmob<Context> (context); LY_ASSERT_SMOB (Context, context, 1); @@ -41,7 +41,7 @@ LY_DEFINE (ly_context_id, "ly:context-id", " i.e., for @code{\\context Voice = \"one\" @dots{}}" " return the string @code{one}.") { - Context *tr = Context::unsmob (context); + Context *tr = unsmob<Context> (context); LY_ASSERT_SMOB (Context, context, 1); @@ -56,7 +56,7 @@ LY_DEFINE (ly_context_name, "ly:context-name", { LY_ASSERT_SMOB (Context, context, 1); - Context *tr = Context::unsmob (context); + Context *tr = unsmob<Context> (context); return ly_symbol2scm (tr->context_name ().c_str ()); } @@ -66,7 +66,7 @@ LY_DEFINE (ly_context_grob_definition, "ly:context-grob-definition", "Return the definition of @var{name} (a symbol) within" " @var{context} as an alist.") { - Context *tr = Context::unsmob (context); + Context *tr = unsmob<Context> (context); LY_ASSERT_SMOB (Context, context, 1); LY_ASSERT_TYPE (ly_is_symbol, name, 2); @@ -81,7 +81,7 @@ LY_DEFINE (ly_context_pushpop_property, "ly:context-pushpop-property", " with @var{eltprop} (if @var{val} is specified) or reverted" " (if unspecified).") { - Context *tg = Context::unsmob (context); + Context *tg = unsmob<Context> (context); LY_ASSERT_SMOB (Context, context, 1); LY_ASSERT_TYPE (ly_is_symbol, grob, 2); @@ -101,7 +101,7 @@ LY_DEFINE (ly_context_property, "ly:context-property", LY_ASSERT_SMOB (Context, context, 1); LY_ASSERT_TYPE (ly_is_symbol, sym, 2); - Context *t = Context::unsmob (context); + Context *t = unsmob<Context> (context); SCM result = t->get_property (sym); return !SCM_UNBNDP (def) && scm_is_null (result) ? def : result; } @@ -114,7 +114,7 @@ LY_DEFINE (ly_context_set_property_x, "ly:context-set-property!", LY_ASSERT_SMOB (Context, context, 1); LY_ASSERT_TYPE (ly_is_symbol, name, 2); - Context *tr = Context::unsmob (context); + Context *tr = unsmob<Context> (context); tr->set_property (name, val); @@ -129,7 +129,7 @@ LY_DEFINE (ly_context_property_where_defined, "ly:context-property-where-defined LY_ASSERT_SMOB (Context, context, 1); LY_ASSERT_TYPE (ly_is_symbol, name, 2); - Context *tr = Context::unsmob (context); + Context *tr = unsmob<Context> (context); SCM val; tr = tr->where_defined (name, &val); @@ -145,7 +145,7 @@ LY_DEFINE (ly_context_unset_property, "ly:context-unset-property", 2, 0, 0, { LY_ASSERT_SMOB (Context, context, 1); LY_ASSERT_TYPE (ly_is_symbol, name, 2); - Context *tr = Context::unsmob (context); + Context *tr = unsmob<Context> (context); tr->unset_property (name); return SCM_UNSPECIFIED; @@ -156,7 +156,7 @@ LY_DEFINE (ly_context_parent, "ly:context-parent", "Return the parent of @var{context}, @code{#f} if none.") { LY_ASSERT_SMOB (Context, context, 1); - Context *tr = Context::unsmob (context); + Context *tr = unsmob<Context> (context); tr = tr->get_parent_context (); if (tr) @@ -173,7 +173,7 @@ LY_DEFINE (ly_context_find, "ly:context-find", { LY_ASSERT_SMOB (Context, context, 1); LY_ASSERT_TYPE (ly_is_symbol, name, 2); - Context *tr = Context::unsmob (context); + Context *tr = unsmob<Context> (context); while (tr) { @@ -190,7 +190,7 @@ LY_DEFINE (ly_context_now, "ly:context-now", "Return @code{now-moment} of context @var{context}.") { LY_ASSERT_SMOB (Context, context, 1); - Context *ctx = Context::unsmob (context); + Context *ctx = unsmob<Context> (context); return ctx->now_mom ().smobbed_copy (); } @@ -199,7 +199,7 @@ LY_DEFINE (ly_context_event_source, "ly:context-event-source", "Return @code{event-source} of context @var{context}.") { LY_ASSERT_SMOB (Context, context, 1); - Context *ctx = Context::unsmob (context); + Context *ctx = unsmob<Context> (context); return ctx->event_source ()->self_scm (); } @@ -209,6 +209,6 @@ LY_DEFINE (ly_context_events_below, "ly:context-events-below", " from @var{context} and all its subcontexts.") { LY_ASSERT_SMOB (Context, context, 1); - Context *ctx = Context::unsmob (context); + Context *ctx = unsmob<Context> (context); return ctx->events_below ()->self_scm (); } diff --git a/lily/context.cc b/lily/context.cc index 348d307479..1167883b6a 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -43,7 +43,7 @@ Context::check_removal () { for (SCM p = context_list_; scm_is_pair (p); p = scm_cdr (p)) { - Context *ctx = Context::unsmob (scm_car (p)); + Context *ctx = unsmob<Context> (scm_car (p)); ctx->check_removal (); if (ctx->is_removable ()) @@ -59,7 +59,7 @@ Context::check_removal () Scheme_hash_table * Context::properties_dict () const { - return Scheme_hash_table::unsmob (properties_scm_); + return unsmob<Scheme_hash_table> (properties_scm_); } void @@ -170,7 +170,7 @@ Context::find_create_context (SCM n, const string &id, SCM operations) SCM score_name = default_child_context_name (); SCM score_def = find_context_def (get_output_def (), score_name); - if (Context_def *cd = Context_def::unsmob (score_def)) + if (Context_def *cd = unsmob<Context_def> (score_def)) { if (cd->is_alias (n)) return create_context (cd, id, operations); @@ -229,13 +229,13 @@ Context::find_create_context (SCM n, const string &id, SCM operations) void Context::acknowledge_infant (SCM sev) { - infant_event_ = Stream_event::unsmob (sev); + infant_event_ = unsmob<Stream_event> (sev); } void Context::set_property_from_event (SCM sev) { - Stream_event *ev = Stream_event::unsmob (sev); + Stream_event *ev = unsmob<Stream_event> (sev); SCM sym = ev->get_property ("symbol"); if (scm_is_symbol (sym)) @@ -258,7 +258,7 @@ Context::set_property_from_event (SCM sev) void Context::unset_property_from_event (SCM sev) { - Stream_event *ev = Stream_event::unsmob (sev); + Stream_event *ev = unsmob<Stream_event> (sev); SCM sym = ev->get_property ("symbol"); type_check_assignment (sym, SCM_EOL, ly_symbol2scm ("translation-type?")); @@ -272,7 +272,7 @@ Context::unset_property_from_event (SCM sev) void Context::create_context_from_event (SCM sev) { - Stream_event *ev = Stream_event::unsmob (sev); + Stream_event *ev = unsmob<Stream_event> (sev); string id = ly_scm2string (ev->get_property ("id")); SCM ops = ev->get_property ("ops"); @@ -318,7 +318,7 @@ Context::create_context_from_event (SCM sev) new_context->unprotect (); - Context_def *td = Context_def::unsmob (new_context->definition_); + Context_def *td = unsmob<Context_def> (new_context->definition_); /* This cannot move before add_context (), because \override operations require that we are in the hierarchy. */ @@ -343,7 +343,7 @@ Context::path_to_acceptable_context (SCM name) const accepts = scm_cons (elt, accepts); } - return Context_def::unsmob (definition_)->path_to_acceptable_context (name, + return unsmob<Context_def> (definition_)->path_to_acceptable_context (name, get_output_def (), scm_reverse_x (accepts, SCM_EOL)); @@ -373,7 +373,7 @@ Context::create_context (Context_def *cdef, assert (infant_event_); SCM infant_scm = infant_event_->get_property ("context"); - Context *infant = Context::unsmob (infant_scm); + Context *infant = unsmob<Context> (infant_scm); if (!infant || infant->get_parent_context () != this) { @@ -409,11 +409,11 @@ Context::get_default_interpreter (const string &context_id) SCM st = find_context_def (get_output_def (), nm); string name = ly_symbol2string (nm); - Context_def *t = Context_def::unsmob (st); + Context_def *t = unsmob<Context_def> (st); if (!t) { warning (_f ("cannot find or create: `%s'", name.c_str ())); - t = Context_def::unsmob (this->definition_); + t = unsmob<Context_def> (this->definition_); } if (scm_is_symbol (t->get_default_child (SCM_EOL))) { @@ -550,8 +550,8 @@ Context::unset_property (SCM sym) void Context::change_parent (SCM sev) { - Stream_event *ev = Stream_event::unsmob (sev); - Context *to = Context::unsmob (ev->get_property ("context")); + Stream_event *ev = unsmob<Stream_event> (sev); + Context *to = unsmob<Context> (ev->get_property ("context")); disconnect_from_parent (); to->add_context (this); @@ -595,7 +595,7 @@ find_context_below (Context *where, for (SCM s = where->children_contexts (); !found && scm_is_pair (s); s = scm_cdr (s)) { - Context *tr = Context::unsmob (scm_car (s)); + Context *tr = unsmob<Context> (scm_car (s)); found = find_context_below (tr, type, id); } @@ -612,7 +612,7 @@ Context::properties_as_alist () const SCM Context::context_name_symbol () const { - Context_def *td = Context_def::unsmob (definition_); + Context_def *td = unsmob<Context_def> (definition_); return td->get_context_name (); } @@ -656,7 +656,7 @@ Context::print_smob (SCM port, scm_print_state *) { scm_puts ("#<", port); scm_puts (class_name (), port); - if (Context_def *d = Context_def::unsmob (definition_)) + if (Context_def *d = unsmob<Context_def> (definition_)) { scm_puts (" ", port); scm_display (d->get_context_name (), port); @@ -728,8 +728,8 @@ measure_length (Context const *context) { SCM l = context->get_property ("measureLength"); Rational length (1); - if (Moment::is_smob (l)) - length = Moment::unsmob (l)->main_part_; + if (unsmob<Moment> (l)) + length = unsmob<Moment> (l)->main_part_; return length; } @@ -739,9 +739,9 @@ measure_position (Context const *context) SCM sm = context->get_property ("measurePosition"); Moment m = 0; - if (Moment::is_smob (sm)) + if (unsmob<Moment> (sm)) { - m = *Moment::unsmob (sm); + m = *unsmob<Moment> (sm); if (m.main_part_ < Rational (0)) { @@ -789,7 +789,7 @@ set_context_property_on_children (Context *trans, SCM sym, SCM val) trans->set_property (sym, ly_deep_copy (val)); for (SCM p = trans->children_contexts (); scm_is_pair (p); p = scm_cdr (p)) { - Context *trg = Context::unsmob (scm_car (p)); + Context *trg = unsmob<Context> (scm_car (p)); set_context_property_on_children (trg, sym, ly_deep_copy (val)); } } @@ -806,7 +806,7 @@ melisma_busy (Context *tr) // to true. do { - if (!melisma_busy (Context::unsmob (scm_car (ch)))) + if (!melisma_busy (unsmob<Context> (scm_car (ch)))) return false; ch = scm_cdr (ch); } while (scm_is_pair (ch)); diff --git a/lily/custos-engraver.cc b/lily/custos-engraver.cc index 90c221c10f..5893dc205b 100644 --- a/lily/custos-engraver.cc +++ b/lily/custos-engraver.cc @@ -95,7 +95,7 @@ Custos_engraver::acknowledge_note_head (Grob_info info) don't look at the staff-position, since we can't be sure whether Clef_engraver already applied a vertical shift. */ - pitches_.push_back (*Pitch::unsmob (ev->get_property ("pitch"))); + pitches_.push_back (*unsmob<Pitch> (ev->get_property ("pitch"))); } } diff --git a/lily/custos.cc b/lily/custos.cc index 584dcaba49..37aeb66f6b 100644 --- a/lily/custos.cc +++ b/lily/custos.cc @@ -41,7 +41,7 @@ MAKE_SCHEME_CALLBACK (Custos, print, 1); SCM Custos::print (SCM smob) { - Item *me = (Item *)Grob::unsmob (smob); + Item *me = (Item *)unsmob<Grob> (smob); SCM scm_style = me->get_property ("style"); string style; diff --git a/lily/dispatcher-scheme.cc b/lily/dispatcher-scheme.cc index 61674b3c75..44d9b792a3 100644 --- a/lily/dispatcher-scheme.cc +++ b/lily/dispatcher-scheme.cc @@ -30,8 +30,8 @@ LY_DEFINE (ly_connect_dispatchers, "ly:connect-dispatchers", 2, 0, 0, (SCM to, SCM from), "Make the dispatcher @var{to} listen to events from @var{from}.") { - Dispatcher *t = Dispatcher::unsmob (to); - Dispatcher *f = Dispatcher::unsmob (from); + Dispatcher *t = unsmob<Dispatcher> (to); + Dispatcher *f = unsmob<Dispatcher> (from); LY_ASSERT_SMOB (Dispatcher, to, 1); LY_ASSERT_SMOB (Dispatcher, from, 2); @@ -47,7 +47,7 @@ LY_DEFINE (ly_add_listener, "ly:add-listener", " to the dispatcher @var{disp}. Whenever @var{disp} hears" " an event of class @var{cl}, it calls @var{callback} with it.") { - Dispatcher *d = Dispatcher::unsmob (disp); + Dispatcher *d = unsmob<Dispatcher> (disp); LY_ASSERT_TYPE (ly_is_procedure, callback, 1); LY_ASSERT_SMOB (Dispatcher, disp, 2); @@ -69,7 +69,7 @@ LY_DEFINE (ly_listened_event_types, "ly:listened-event-types", { LY_ASSERT_SMOB (Dispatcher, disp, 1); - SCM result = Dispatcher::unsmob (disp)->listened_types (); + SCM result = unsmob<Dispatcher> (disp)->listened_types (); scm_remember_upto_here_1 (disp); @@ -84,7 +84,7 @@ LY_DEFINE (ly_listened_event_class_p, "ly:listened-event-class?", LY_ASSERT_SMOB (Dispatcher, disp, 1); LY_ASSERT_TYPE (scm_is_pair, cl, 2); - bool result = Dispatcher::unsmob (disp)->is_listened_class (cl); + bool result = unsmob<Dispatcher> (disp)->is_listened_class (cl); scm_remember_upto_here_1 (disp); @@ -95,8 +95,8 @@ LY_DEFINE (ly_broadcast, "ly:broadcast", 2, 0, 0, (SCM disp, SCM ev), "Send the stream event @var{ev} to the dispatcher @var{disp}.") { - Dispatcher *d = Dispatcher::unsmob (disp); - Stream_event *e = Stream_event::unsmob (ev); + Dispatcher *d = unsmob<Dispatcher> (disp); + Stream_event *e = unsmob<Stream_event> (ev); LY_ASSERT_SMOB (Dispatcher, disp, 1); diff --git a/lily/dispatcher.cc b/lily/dispatcher.cc index d47c2739d2..2b80c3358e 100644 --- a/lily/dispatcher.cc +++ b/lily/dispatcher.cc @@ -75,7 +75,7 @@ Event dispatching: void Dispatcher::dispatch (SCM sev) { - Stream_event *ev = Stream_event::unsmob (sev); + Stream_event *ev = unsmob<Stream_event> (sev); SCM class_list = ev->get_property ("class"); if (!scm_is_pair (class_list)) { @@ -235,7 +235,7 @@ Dispatcher::internal_add_listener (SCM callback, SCM ev_class, int priority) for (SCM disp = dispatchers_; scm_is_pair (disp); disp = scm_cdr (disp)) { int priority = scm_to_int (scm_cdar (disp)); - Dispatcher *d = Dispatcher::unsmob (scm_caar (disp)); + Dispatcher *d = unsmob<Dispatcher> (scm_caar (disp)); d->internal_add_listener (GET_LISTENER (Dispatcher, dispatch).smobbed_copy (), ev_class, priority); } @@ -264,7 +264,7 @@ Dispatcher::remove_listener (Listener l, SCM ev_class) SCM dummy = scm_cons (SCM_EOL, list); SCM e = dummy; while (scm_is_pair (scm_cdr (e))) - if (*Listener::unsmob (scm_cdadr (e)) == l && first) + if (*unsmob<Listener> (scm_cdadr (e)) == l && first) { scm_set_cdr_x (e, scm_cddr (e)); first = false; @@ -282,7 +282,7 @@ Dispatcher::remove_listener (Listener l, SCM ev_class) /* Unregister with all dispatchers. */ for (SCM disp = dispatchers_; scm_is_pair (disp); disp = scm_cdr (disp)) { - Dispatcher *d = Dispatcher::unsmob (scm_caar (disp)); + Dispatcher *d = unsmob<Dispatcher> (scm_caar (disp)); d->remove_listener (GET_LISTENER (Dispatcher, dispatch), ev_class); } listen_classes_ = scm_delq_x (ev_class, listen_classes_); diff --git a/lily/dot-column-engraver.cc b/lily/dot-column-engraver.cc index 7064eafba3..c646ed038c 100644 --- a/lily/dot-column-engraver.cc +++ b/lily/dot-column-engraver.cc @@ -51,7 +51,7 @@ Dot_column_engraver::stop_translation_timestep () void Dot_column_engraver::acknowledge_rhythmic_head (Grob_info info) { - Grob *d = Grob::unsmob (info.grob ()->get_object ("dot")); + Grob *d = unsmob<Grob> (info.grob ()->get_object ("dot")); if (d) { if (!dotcol_) diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 1ec7baa059..98db3b1476 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -45,13 +45,13 @@ MAKE_SCHEME_CALLBACK (Dot_column, calc_positioning_done, 1); SCM Dot_column::calc_positioning_done (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); /* Trigger note collision resolution first, since that may kill off dots when merging. */ - if (Grob *collision = Grob::unsmob (me->get_object ("note-collision"))) + if (Grob *collision = unsmob<Grob> (me->get_object ("note-collision"))) (void) collision->get_property ("positioning-done"); me->set_property ("positioning-done", SCM_BOOL_T); @@ -68,7 +68,7 @@ Dot_column::calc_positioning_done (SCM smob) Grob *n = dots[i]->get_parent (Y_AXIS); commonx = n->common_refpoint (commonx, X_AXIS); - if (Grob *stem = Grob::unsmob (n->get_object ("stem"))) + if (Grob *stem = unsmob<Grob> (n->get_object ("stem"))) { commonx = stem->common_refpoint (commonx, X_AXIS); @@ -125,7 +125,7 @@ Dot_column::calc_positioning_done (SCM smob) Box b (s->extent (commonx, X_AXIS), y); boxes.push_back (b); - if (Grob *stem = Grob::unsmob (s->get_object ("stem"))) + if (Grob *stem = unsmob<Grob> (s->get_object ("stem"))) stems.insert (stem); } @@ -159,7 +159,7 @@ Dot_column::calc_positioning_done (SCM smob) // Sort dots by stem, then check for dots above the limit for each stem vector <vector <Grob *> > dots_each_stem (parent_stems.size ()); for (vsize i = 0; i < dots.size (); i++) - if (Grob *stem = Grob::unsmob (dots[i]->get_parent (Y_AXIS) + if (Grob *stem = unsmob<Grob> (dots[i]->get_parent (Y_AXIS) -> get_object ("stem"))) for (vsize j = 0; j < parent_stems.size (); j++) if (stem == parent_stems[j]) @@ -242,7 +242,7 @@ Dot_column::calc_positioning_done (SCM smob) void Dot_column::add_head (Grob *me, Grob *head) { - Grob *d = Grob::unsmob (head->get_object ("dot")); + Grob *d = unsmob<Grob> (head->get_object ("dot")); if (d) { Side_position_interface::add_support (me, head); diff --git a/lily/dots-engraver.cc b/lily/dots-engraver.cc index b58bd46912..5465f460f6 100644 --- a/lily/dots-engraver.cc +++ b/lily/dots-engraver.cc @@ -43,10 +43,10 @@ Dots_engraver::acknowledge_rhythmic_head (Grob_info gi) return; Grob *note = gi.grob (); - if (Grob::is_smob (note->get_object ("dot"))) + if (unsmob<Grob> (note->get_object ("dot"))) return; - Duration *dur = Duration::unsmob (cause->get_property ("duration")); + Duration *dur = unsmob<Duration> (cause->get_property ("duration")); if (dur && dur->dot_count ()) { Item *d = make_item ("Dots", note->self_scm ()); diff --git a/lily/dots.cc b/lily/dots.cc index a8d6809026..b7f787bc02 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -30,7 +30,7 @@ MAKE_SCHEME_CALLBACK (Dots, print, 1); SCM Dots::print (SCM d) { - Grob *sc = Grob::unsmob (d); + Grob *sc = unsmob<Grob> (d); Stencil mol; SCM c = sc->get_property ("dot-count"); diff --git a/lily/drum-note-performer.cc b/lily/drum-note-performer.cc index 4b74f791cf..0285de6504 100644 --- a/lily/drum-note-performer.cc +++ b/lily/drum-note-performer.cc @@ -58,7 +58,7 @@ Drum_note_performer::process_music () && to_boolean (scm_hash_table_p (tab))) defn = scm_hashq_ref (tab, sym, SCM_EOL); - if (Pitch *pit = Pitch::unsmob (defn)) + if (Pitch *pit = unsmob<Pitch> (defn)) { SCM articulations = n->get_property ("articulations"); Stream_event *tie_event = 0; @@ -66,7 +66,7 @@ Drum_note_performer::process_music () int velocity = 0; for (SCM s = articulations; scm_is_pair (s); s = scm_cdr (s)) { - Stream_event *ev = Stream_event::unsmob (scm_car (s)); + Stream_event *ev = unsmob<Stream_event> (scm_car (s)); if (!ev) continue; diff --git a/lily/duration-scheme.cc b/lily/duration-scheme.cc index 55fbf382b2..7d0788ea3e 100644 --- a/lily/duration-scheme.cc +++ b/lily/duration-scheme.cc @@ -25,8 +25,8 @@ MAKE_SCHEME_CALLBACK (Duration, less_p, 2); SCM Duration::less_p (SCM p1, SCM p2) { - Duration *a = Duration::unsmob (p1); - Duration *b = Duration::unsmob (p2); + Duration *a = unsmob<Duration> (p1); + Duration *b = unsmob<Duration> (p2); if (compare (*a, *b) < 0) return SCM_BOOL_T; @@ -41,8 +41,8 @@ LY_DEFINE (ly_duration_less_p, "ly:duration<?", LY_ASSERT_SMOB (Duration, p1, 1); LY_ASSERT_SMOB (Duration, p2, 2); - Duration *a = Duration::unsmob (p1); - Duration *b = Duration::unsmob (p2); + Duration *a = unsmob<Duration> (p1); + Duration *b = unsmob<Duration> (p2); if (Duration::compare (*a, *b) < 0) return SCM_BOOL_T; @@ -102,7 +102,7 @@ LY_DEFINE (ly_duration_log, "ly:duration-log", "Extract the duration log from @var{dur}.") { LY_ASSERT_SMOB (Duration, dur, 1); - return scm_from_int (Duration::unsmob (dur)->duration_log ()); + return scm_from_int (unsmob<Duration> (dur)->duration_log ()); } LY_DEFINE (ly_duration_dot_count, "ly:duration-dot-count", @@ -110,7 +110,7 @@ LY_DEFINE (ly_duration_dot_count, "ly:duration-dot-count", "Extract the dot count from @var{dur}.") { LY_ASSERT_SMOB (Duration, dur, 1); - return scm_from_int (Duration::unsmob (dur)->dot_count ()); + return scm_from_int (unsmob<Duration> (dur)->dot_count ()); } LY_DEFINE (ly_intlog2, "ly:intlog2", @@ -127,7 +127,7 @@ LY_DEFINE (ly_duration_length, "ly:duration-length", "The length of the duration as a @code{moment}.") { LY_ASSERT_SMOB (Duration, dur, 1); - return Moment (Duration::unsmob (dur)->get_length ()).smobbed_copy (); + return Moment (unsmob<Duration> (dur)->get_length ()).smobbed_copy (); } LY_DEFINE (ly_duration_2_string, "ly:duration->string", @@ -135,7 +135,7 @@ LY_DEFINE (ly_duration_2_string, "ly:duration->string", "Convert @var{dur} to a string.") { LY_ASSERT_SMOB (Duration, dur, 1); - return ly_string2scm (Duration::unsmob (dur)->to_string ()); + return ly_string2scm (unsmob<Duration> (dur)->to_string ()); } LY_DEFINE (ly_duration_factor, "ly:duration-factor", @@ -144,7 +144,7 @@ LY_DEFINE (ly_duration_factor, "ly:duration-factor", " Return it as a pair.") { LY_ASSERT_SMOB (Duration, dur, 1); - Rational r = Duration::unsmob (dur)->factor (); + Rational r = unsmob<Duration> (dur)->factor (); return scm_cons (scm_from_int64 (r.num ()), scm_from_int64 (r.den ())); } @@ -156,7 +156,7 @@ LY_DEFINE (ly_duration_scale, "ly:duration-scale", " Return it as a rational.") { LY_ASSERT_SMOB (Duration, dur, 1); - Rational r = Duration::unsmob (dur)->factor (); + Rational r = unsmob<Duration> (dur)->factor (); return ly_rational2scm (r); } diff --git a/lily/dynamic-align-engraver.cc b/lily/dynamic-align-engraver.cc index df5c24cb33..4a443dec5c 100644 --- a/lily/dynamic-align-engraver.cc +++ b/lily/dynamic-align-engraver.cc @@ -181,7 +181,7 @@ Dynamic_align_engraver::set_spanner_bounds (Spanner *line, bool end) bound = spanners[0]->get_bound (d); else { - bound = Grob::unsmob (get_property ("currentMusicalColumn")); + bound = unsmob<Grob> (get_property ("currentMusicalColumn")); programming_error ("started DynamicLineSpanner but have no left bound"); } diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 0bbe69f075..4b51d90414 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -209,12 +209,12 @@ Dynamic_engraver::stop_translation_timestep () if (finished_spanner_ && !finished_spanner_->get_bound (RIGHT)) finished_spanner_ ->set_bound (RIGHT, - Grob::unsmob (get_property ("currentMusicalColumn"))); + unsmob<Grob> (get_property ("currentMusicalColumn"))); if (current_spanner_ && !current_spanner_->get_bound (LEFT)) current_spanner_ ->set_bound (LEFT, - Grob::unsmob (get_property ("currentMusicalColumn"))); + unsmob<Grob> (get_property ("currentMusicalColumn"))); script_ = 0; script_event_ = 0; accepted_spanevents_drul_.set (0, 0); @@ -267,7 +267,7 @@ Dynamic_engraver::acknowledge_note_column (Grob_info info) */ Grob *x_parent = (heads.size () ? info.grob () - : Grob::unsmob (info.grob ()->get_object ("rest"))); + : unsmob<Grob> (info.grob ()->get_object ("rest"))); if (x_parent) script_->set_parent (x_parent, X_AXIS); } diff --git a/lily/enclosing-bracket.cc b/lily/enclosing-bracket.cc index be22297ad7..57593649d3 100644 --- a/lily/enclosing-bracket.cc +++ b/lily/enclosing-bracket.cc @@ -54,7 +54,7 @@ Enclosing_bracket::width (SCM grob) /* UGH. cut & paste code. */ - Grob *me = Grob::unsmob (grob); + Grob *me = unsmob<Grob> (grob); extract_grob_set (me, "elements", elements); if (elements.empty ()) { @@ -82,7 +82,7 @@ MAKE_SCHEME_CALLBACK (Enclosing_bracket, print, 1); SCM Enclosing_bracket::print (SCM grob) { - Grob *me = Grob::unsmob (grob); + Grob *me = unsmob<Grob> (grob); extract_grob_set (me, "elements", elements); if (elements.empty ()) { diff --git a/lily/engraver-group.cc b/lily/engraver-group.cc index 9b5efb2779..c69b974a69 100644 --- a/lily/engraver-group.cc +++ b/lily/engraver-group.cc @@ -29,7 +29,7 @@ void Engraver_group::override (SCM sev) { - Stream_event *ev = Stream_event::unsmob (sev); + Stream_event *ev = unsmob<Stream_event> (sev); Grob_property_info (context (), ev->get_property ("symbol")) .push (ev->get_property ("property-path"), @@ -39,7 +39,7 @@ Engraver_group::override (SCM sev) void Engraver_group::revert (SCM sev) { - Stream_event *ev = Stream_event::unsmob (sev); + Stream_event *ev = unsmob<Stream_event> (sev); Grob_property_info (context (), ev->get_property ("symbol")) .pop (ev->get_property ("property-path")); @@ -117,7 +117,7 @@ Engraver_group::acknowledge_grobs () } Engraver_dispatch_list *dispatch - = Engraver_dispatch_list::unsmob (acklist); + = unsmob<Engraver_dispatch_list> (acklist); if (dispatch) dispatch->apply (info); @@ -136,7 +136,7 @@ Engraver_group::pending_grobs () const for (SCM s = context_->children_contexts (); scm_is_pair (s); s = scm_cdr (s)) { - Context *c = Context::unsmob (scm_car (s)); + Context *c = unsmob<Context> (scm_car (s)); Engraver_group *group = dynamic_cast<Engraver_group *> (c->implementation ()); @@ -157,7 +157,7 @@ Engraver_group::do_announces () for (SCM s = context ()->children_contexts (); scm_is_pair (s); s = scm_cdr (s)) { - Context *c = Context::unsmob (scm_car (s)); + Context *c = unsmob<Context> (scm_car (s)); Engraver_group *group = dynamic_cast<Engraver_group *> (c->implementation ()); if (group) diff --git a/lily/engraver-scheme.cc b/lily/engraver-scheme.cc index e3aa2aaab2..587a93199f 100644 --- a/lily/engraver-scheme.cc +++ b/lily/engraver-scheme.cc @@ -31,7 +31,7 @@ LY_DEFINE (ly_engraver_make_grob, "ly:engraver-make-grob", LY_ASSERT_TYPE (ly_is_symbol, grob_name, 2); LY_ASSERT_TYPE (ly_is_grob_cause, cause, 3); - Grob *g = Engraver::unsmob (engraver)-> + Grob *g = unsmob<Engraver> (engraver)-> internal_make_grob (grob_name, cause, ly_symbol2string (grob_name).c_str (), "scheme", 0, "scheme"); @@ -49,8 +49,8 @@ LY_DEFINE (ly_engraver_announce_end_grob, "ly:engraver-announce-end-grob", LY_ASSERT_SMOB (Grob, grob, 2); LY_ASSERT_TYPE (ly_is_grob_cause, cause, 3); - Engraver::unsmob (engraver)-> - announce_end_grob (Grob::unsmob (grob), cause); + unsmob<Engraver> (engraver)-> + announce_end_grob (unsmob<Grob> (grob), cause); return SCM_UNSPECIFIED; } diff --git a/lily/engraver.cc b/lily/engraver.cc index 76e1ef6f58..23d7fd9fc2 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -52,12 +52,12 @@ Grob_info Engraver::make_grob_info (Grob *e, SCM cause) { /* TODO: Remove Music code when it's no longer needed */ - if (Music *m = Music::unsmob (cause)) + if (Music *m = unsmob<Music> (cause)) { cause = m->to_event ()->unprotect (); } if (scm_is_null (e->get_property ("cause")) - && (Stream_event::is_smob (cause) || Grob::is_smob (cause))) + && (unsmob<Stream_event> (cause) || unsmob<Grob> (cause))) e->set_property ("cause", cause); return Grob_info (this, e); @@ -174,7 +174,7 @@ Engraver::internal_make_spanner (SCM x, SCM cause, char const *name, bool ly_is_grob_cause (SCM obj) { - return Grob::is_smob (obj) || Stream_event::is_smob (obj) || scm_is_null (obj); + return unsmob<Grob> (obj) || unsmob<Stream_event> (obj) || scm_is_null (obj); } #include "translator.icc" diff --git a/lily/episema-engraver.cc b/lily/episema-engraver.cc index f8b714b137..a62ed3726f 100644 --- a/lily/episema-engraver.cc +++ b/lily/episema-engraver.cc @@ -106,7 +106,7 @@ Episema_engraver::typeset_all () { Grob *col = (note_columns_.size () ? note_columns_.back () - : Grob::unsmob (get_property ("currentMusicalColumn"))); + : unsmob<Grob> (get_property ("currentMusicalColumn"))); finished_->set_bound (RIGHT, col); } finished_ = 0; @@ -120,7 +120,7 @@ Episema_engraver::stop_translation_timestep () { Grob *col = (note_columns_.size () ? note_columns_.front () - : Grob::unsmob (get_property ("currentMusicalColumn"))); + : unsmob<Grob> (get_property ("currentMusicalColumn"))); span_->set_bound (LEFT, col); } diff --git a/lily/event-chord-iterator.cc b/lily/event-chord-iterator.cc index 0eea36763f..92b385fe57 100644 --- a/lily/event-chord-iterator.cc +++ b/lily/event-chord-iterator.cc @@ -46,13 +46,13 @@ Event_chord_iterator::process (Moment m) for (SCM s = get_music ()->get_property ("elements"); scm_is_pair (s); s = scm_cdr (s)) { - Music *mus = Music::unsmob (scm_car (s)); + Music *mus = unsmob<Music> (scm_car (s)); report_event (mus); } for (SCM s = get_music ()->get_property ("articulations"); scm_is_pair (s); s = scm_cdr (s)) { - Music *mus = Music::unsmob (scm_car (s)); + Music *mus = unsmob<Music> (scm_car (s)); report_event (mus); } } diff --git a/lily/figured-bass-continuation.cc b/lily/figured-bass-continuation.cc index cdec42d6f2..371c4d24ba 100644 --- a/lily/figured-bass-continuation.cc +++ b/lily/figured-bass-continuation.cc @@ -41,7 +41,7 @@ MAKE_SCHEME_CALLBACK (Figured_bass_continuation, center_on_figures, 1); SCM Figured_bass_continuation::center_on_figures (SCM grob) { - Spanner *me = Spanner::unsmob (grob); + Spanner *me = unsmob<Spanner> (grob); extract_grob_set (me, "figures", figures); if (figures.empty ()) return scm_from_double (0.0); @@ -57,7 +57,7 @@ MAKE_SCHEME_CALLBACK (Figured_bass_continuation, print, 1); SCM Figured_bass_continuation::print (SCM grob) { - Spanner *me = Spanner::unsmob (grob); + Spanner *me = unsmob<Spanner> (grob); Real thick = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness")) diff --git a/lily/figured-bass-engraver.cc b/lily/figured-bass-engraver.cc index 4222fbe7b0..2ed07e3e83 100644 --- a/lily/figured-bass-engraver.cc +++ b/lily/figured-bass-engraver.cc @@ -222,11 +222,11 @@ Figured_bass_engraver::center_continuations (vector<Spanner *> const &consecutiv left_figs.push_back (consecutive_lines[j]->get_bound (LEFT)); SCM ga = Grob_array::make_array (); - Grob_array::unsmob (ga)->set_array (left_figs); + unsmob<Grob_array> (ga)->set_array (left_figs); for (vsize j = consecutive_lines.size (); j--;) consecutive_lines[j]->set_object ("figures", - Grob_array::unsmob (ga)->smobbed_copy ()); + unsmob<Grob_array> (ga)->smobbed_copy ()); } void @@ -407,7 +407,7 @@ void Figured_bass_engraver::create_grobs () { Grob *muscol - = Item::unsmob (get_property ("currentMusicalColumn")); + = unsmob<Item> (get_property ("currentMusicalColumn")); if (!alignment_) { alignment_ = make_spanner ("BassFigureAlignment", SCM_EOL); diff --git a/lily/fingering-column.cc b/lily/fingering-column.cc index 73a393584e..c9db28baf9 100644 --- a/lily/fingering-column.cc +++ b/lily/fingering-column.cc @@ -49,7 +49,7 @@ MAKE_SCHEME_CALLBACK (Fingering_column, calc_positioning_done, 1); SCM Fingering_column::calc_positioning_done (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); if (!me->is_live ()) return SCM_BOOL_T; diff --git a/lily/fingering-engraver.cc b/lily/fingering-engraver.cc index 58dfa4106a..d5b4102d8b 100644 --- a/lily/fingering-engraver.cc +++ b/lily/fingering-engraver.cc @@ -101,7 +101,7 @@ Fingering_engraver::make_script (Direction d, Stream_event *r, int i) junkme. */ SCM pitch = r->get_property ("pitch"); - if (Pitch::is_smob (pitch)) + if (unsmob<Pitch> (pitch)) fingering->set_property ("pitch", pitch); /* diff --git a/lily/flag.cc b/lily/flag.cc index 7ce1fc1021..1e1ba55ffe 100644 --- a/lily/flag.cc +++ b/lily/flag.cc @@ -47,8 +47,8 @@ MAKE_SCHEME_CALLBACK (Flag, width, 1); SCM Flag::width (SCM smob) { - Grob *me = Grob::unsmob (smob); - Stencil *sten = Stencil::unsmob (me->get_property ("stencil")); + Grob *me = unsmob<Grob> (smob); + Stencil *sten = unsmob<Stencil> (me->get_property ("stencil")); if (!sten) return ly_interval2scm (Interval (0.0, 0.0)); @@ -67,7 +67,7 @@ MAKE_SCHEME_CALLBACK (Flag, glyph_name, 1); SCM Flag::glyph_name (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Grob *stem = me->get_parent (X_AXIS); Direction d = get_grob_direction (stem); @@ -113,7 +113,7 @@ MAKE_SCHEME_CALLBACK (Flag, print, 1); SCM Flag::print (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Grob *stem = me->get_parent (X_AXIS); Direction d = get_grob_direction (stem); @@ -179,7 +179,7 @@ Flag::calc_y_offset (SCM smob) SCM Flag::internal_calc_y_offset (SCM smob, bool pure) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Grob *stem = me->get_parent (X_AXIS); Direction d = get_grob_direction (stem); @@ -199,7 +199,7 @@ MAKE_SCHEME_CALLBACK (Flag, calc_x_offset, 1); SCM Flag::calc_x_offset (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Grob *stem = me->get_parent (X_AXIS); return scm_from_double (stem->extent (stem, X_AXIS)[RIGHT]); } diff --git a/lily/font-interface.cc b/lily/font-interface.cc index 8f1e2c3b52..de787fd852 100644 --- a/lily/font-interface.cc +++ b/lily/font-interface.cc @@ -28,7 +28,7 @@ Font_metric * Font_interface::get_default_font (Grob *me) { - Font_metric *fm = Font_metric::unsmob (me->get_property ("font")); + Font_metric *fm = unsmob<Font_metric> (me->get_property ("font")); if (!fm) { SCM chain = music_font_alist_chain (me); diff --git a/lily/font-metric-scheme.cc b/lily/font-metric-scheme.cc index b2b9db1123..0dc41d6876 100644 --- a/lily/font-metric-scheme.cc +++ b/lily/font-metric-scheme.cc @@ -36,7 +36,7 @@ LY_DEFINE (ly_font_get_glyph, "ly:font-get-glyph", " to the font encodings @code{fetaMusic} and @code{fetaBraces}," " respectively.") { - Font_metric *fm = Font_metric::unsmob (font); + Font_metric *fm = unsmob<Font_metric> (font); LY_ASSERT_SMOB (Font_metric, font, 1); LY_ASSERT_TYPE (scm_is_string, name, 2); @@ -57,7 +57,7 @@ LY_DEFINE (ly_font_glyph_name_to_index, "ly:font-glyph-name-to-index", " to the font encodings @code{fetaMusic} and @code{fetaBraces}," " respectively.") { - Font_metric *fm = Font_metric::unsmob (font); + Font_metric *fm = unsmob<Font_metric> (font); LY_ASSERT_SMOB (Font_metric, font, 1); LY_ASSERT_TYPE (scm_is_string, name, 2); @@ -75,7 +75,7 @@ LY_DEFINE (ly_font_index_to_charcode, "ly:font-index-to-charcode", " to the font encodings @code{fetaMusic} and @code{fetaBraces}," " respectively.") { - Font_metric *fm = Font_metric::unsmob (font); + Font_metric *fm = unsmob<Font_metric> (font); LY_ASSERT_SMOB (Font_metric, font, 1); LY_ASSERT_TYPE (scm_is_integer, index, 2); @@ -93,7 +93,7 @@ LY_DEFINE (ly_font_glyph_name_to_charcode, "ly:font-glyph-name-to-charcode", " to the font encodings @code{fetaMusic} and @code{fetaBraces}," " respectively.") { - Font_metric *fm = Font_metric::unsmob (font); + Font_metric *fm = unsmob<Font_metric> (font); LY_ASSERT_SMOB (Font_metric, font, 1); LY_ASSERT_TYPE (scm_is_string, name, 2); @@ -111,7 +111,7 @@ LY_DEFINE (ly_font_file_name, "ly:font-file-name", { LY_ASSERT_SMOB (Font_metric, font, 1); - Font_metric *fm = Font_metric::unsmob (font); + Font_metric *fm = unsmob<Font_metric> (font); SCM name = fm->font_file_name (); return name; @@ -124,7 +124,7 @@ LY_DEFINE (ly_font_name, "ly:font-name", " return the corresponding name.") { LY_ASSERT_SMOB (Font_metric, font, 1); - Font_metric *fm = Font_metric::unsmob (font); + Font_metric *fm = unsmob<Font_metric> (font); return ly_string2scm (fm->font_name ()); } @@ -136,7 +136,7 @@ LY_DEFINE (ly_font_magnification, "ly:font-magnification", 1, 0, 0, { LY_ASSERT_SMOB (Font_metric, font, 1); - Font_metric *fm = Font_metric::unsmob (font); + Font_metric *fm = unsmob<Font_metric> (font); return scm_cdr (fm->description_); } @@ -147,7 +147,7 @@ LY_DEFINE (ly_font_design_size, "ly:font-design-size", 1, 0, 0, { LY_ASSERT_SMOB (Font_metric, font, 1); - Font_metric *fm = Font_metric::unsmob (font); + Font_metric *fm = unsmob<Font_metric> (font); return scm_from_double (fm->design_size ()); } diff --git a/lily/font-select.cc b/lily/font-select.cc index 9950d1a747..b38ff9268a 100644 --- a/lily/font-select.cc +++ b/lily/font-select.cc @@ -42,7 +42,7 @@ get_font_by_design_size (Output_def *layout, Real requested, if (to_boolean (scm_promise_p (entry))) { - Font_metric *fm = Font_metric::unsmob (scm_force (entry)); + Font_metric *fm = unsmob<Font_metric> (scm_force (entry)); size = fm->design_size (); } #if HAVE_PANGO_FT2 @@ -86,7 +86,7 @@ get_font_by_design_size (Output_def *layout, Real requested, #endif } else - fm = Font_metric::unsmob (scm_force (scm_c_vector_ref (font_vector, i))); + fm = unsmob<Font_metric> (scm_force (scm_c_vector_ref (font_vector, i))); return find_scaled_font (layout, fm, requested / size); } diff --git a/lily/footnote-engraver.cc b/lily/footnote-engraver.cc index 3b04ceae18..636379125f 100644 --- a/lily/footnote-engraver.cc +++ b/lily/footnote-engraver.cc @@ -63,7 +63,7 @@ Footnote_engraver::footnotify (Grob *g, SCM cause) Spanner *b = make_spanner ("FootnoteSpanner", cause); b->set_parent (s, Y_AXIS); b->set_parent (s, X_AXIS); - Grob *bound = Grob::unsmob (get_property ("currentMusicalColumn")); + Grob *bound = unsmob<Grob> (get_property ("currentMusicalColumn")); b->set_bound (LEFT, bound); annotated_spanners_.push_back (Drul_array<Spanner *> (s, b)); } @@ -78,7 +78,7 @@ Footnote_engraver::footnotify (Grob *g, SCM cause) void Footnote_engraver::acknowledge_grob (Grob_info info) { - Music *mus = Music::unsmob (info.grob ()->get_property ("footnote-music")); + Music *mus = unsmob<Music> (info.grob ()->get_property ("footnote-music")); if (mus) { @@ -107,7 +107,7 @@ Footnote_engraver::acknowledge_end_grob (Grob_info info) { if (annotated_spanners_[i][LEFT] == s) { - Grob *bound = Grob::unsmob (get_property ("currentMusicalColumn")); + Grob *bound = unsmob<Grob> (get_property ("currentMusicalColumn")); annotated_spanners_[i][RIGHT]->set_bound (RIGHT, bound); break; } diff --git a/lily/forbid-break-engraver.cc b/lily/forbid-break-engraver.cc index a0e45c8424..db0e254739 100644 --- a/lily/forbid-break-engraver.cc +++ b/lily/forbid-break-engraver.cc @@ -46,12 +46,12 @@ Forbid_line_break_engraver::start_translation_timestep () SCM busy = get_property ("busyGrobs"); Moment now = now_mom (); - while (scm_is_pair (busy) && Moment::unsmob (scm_caar (busy))->main_part_ == now.main_part_) + while (scm_is_pair (busy) && unsmob<Moment> (scm_caar (busy))->main_part_ == now.main_part_) busy = scm_cdr (busy); while (scm_is_pair (busy)) { - Grob *g = Grob::unsmob (scm_cdar (busy)); + Grob *g = unsmob<Grob> (scm_cdar (busy)); if (g->internal_has_interface (ly_symbol2scm ("rhythmic-grob-interface"))) context ()->get_score_context ()->set_property ("forbidBreak", SCM_BOOL_T); busy = scm_cdr (busy); diff --git a/lily/function-documentation.cc b/lily/function-documentation.cc index 7a9d33bd62..8535f7f2a6 100644 --- a/lily/function-documentation.cc +++ b/lily/function-documentation.cc @@ -105,9 +105,9 @@ init_func_doc () ly_add_type_predicate ((void *) &is_direction, "direction"); ly_add_type_predicate ((void *) &ly_is_port, "port"); ly_add_type_predicate ((void *) &ly_cheap_is_list, "list"); - ly_add_type_predicate ((void *) &Global_context::is_smob, "Global_context"); - ly_add_type_predicate ((void *) &Paper_score::is_smob, "Paper_score"); - ly_add_type_predicate ((void *) &Performance::is_smob, "Performance"); + ly_add_type_predicate ((void *) &unsmob<Global_context>, "Global_context"); + ly_add_type_predicate ((void *) &unsmob<Paper_score>, "Paper_score"); + ly_add_type_predicate ((void *) &unsmob<Performance>, "Performance"); ly_add_type_predicate ((void *) &is_axis, "axis"); ly_add_type_predicate ((void *) &is_number_pair, "number pair"); ly_add_type_predicate ((void *) &ly_is_list, "list"); @@ -120,10 +120,10 @@ init_func_doc () ly_add_type_predicate ((void *) &scm_is_rational, "rational"); ly_add_type_predicate ((void *) &scm_is_string, "string"); ly_add_type_predicate ((void *) &scm_is_vector, "vector"); - ly_add_type_predicate ((void *) &Item::is_smob, "Item"); - ly_add_type_predicate ((void *) &Music::is_smob, "Music"); - ly_add_type_predicate ((void *) &Spanner::is_smob, "Spanner"); - ly_add_type_predicate ((void *) &Stream_event::is_smob, "Stream_event"); + ly_add_type_predicate ((void *) &unsmob<Item>, "Item"); + ly_add_type_predicate ((void *) &unsmob<Music>, "Music"); + ly_add_type_predicate ((void *) &unsmob<Spanner>, "Spanner"); + ly_add_type_predicate ((void *) &unsmob<Stream_event>, "Stream_event"); } ADD_SCM_INIT_FUNC (func_doc, init_func_doc); diff --git a/lily/global-context-scheme.cc b/lily/global-context-scheme.cc index e39b36699a..ea100c912a 100644 --- a/lily/global-context-scheme.cc +++ b/lily/global-context-scheme.cc @@ -34,14 +34,14 @@ LY_DEFINE (ly_format_output, "ly:format-output", " process it and return the @code{Music_output} object" " in its final state.") { - Global_context *g = Global_context::unsmob (context); + Global_context *g = unsmob<Global_context> (context); LY_ASSERT_SMOB (Global_context, context, 1); SCM output = g->get_output (); progress_indication ("\n"); - if (Music_output *od = Music_output::unsmob (output)) + if (Music_output *od = unsmob<Music_output> (output)) od->process (); return output; @@ -52,7 +52,7 @@ LY_DEFINE (ly_make_global_translator, "ly:make-global-translator", "Create a translator group and connect it to the global context" " @var{global}. The translator group is returned.") { - Global_context *g = Global_context::unsmob (global); + Global_context *g = unsmob<Global_context> (global); LY_ASSERT_SMOB (Global_context, global, 1); Translator_group *tg = new Translator_group (); @@ -68,7 +68,7 @@ LY_DEFINE (ly_make_global_context, "ly:make-global-context", " block @var{output-def}. The context is returned.") { LY_ASSERT_SMOB (Output_def, output_def, 1); - Output_def *odef = Output_def::unsmob (output_def); + Output_def *odef = unsmob<Output_def> (output_def); Global_context *glob = new Global_context (odef); @@ -89,21 +89,21 @@ LY_DEFINE (ly_interpret_music_expression, "ly:interpret-music-expression", LY_ASSERT_SMOB (Music, mus, 1); LY_ASSERT_SMOB (Global_context, ctx, 2); - Music *music = Music::unsmob (mus); + Music *music = unsmob<Music> (mus); if (!music) { warning (_ ("no music found in score")); return SCM_BOOL_F; } - Global_context *g = Global_context::unsmob (ctx); + Global_context *g = unsmob<Global_context> (ctx); Cpu_timer timer; message (_ ("Interpreting music...")); SCM protected_iter = Music_iterator::get_static_get_iterator (music); - Music_iterator *iter = Music_iterator::unsmob (protected_iter); + Music_iterator *iter = unsmob<Music_iterator> (protected_iter); iter->init_context (music, g); iter->construct_children (); diff --git a/lily/global-context.cc b/lily/global-context.cc index b9afbd7671..c21deb3b9b 100644 --- a/lily/global-context.cc +++ b/lily/global-context.cc @@ -46,7 +46,7 @@ Global_context::Global_context (Output_def *o) ly_symbol2scm ("Prepare")); events_below ()->register_as_listener (event_source_); - Context_def *globaldef = Context_def::unsmob (definition_); + Context_def *globaldef = unsmob<Context_def> (definition_); if (!globaldef) programming_error ("no `Global' context found"); else @@ -91,8 +91,8 @@ Global_context::get_moments_left () const void Global_context::prepare (SCM sev) { - Stream_event *ev = Stream_event::unsmob (sev); - Moment *mom = Moment::unsmob (ev->get_property ("moment")); + Stream_event *ev = unsmob<Stream_event> (sev); + Moment *mom = unsmob<Moment> (ev->get_property ("moment")); assert (mom); @@ -113,7 +113,7 @@ Context * Global_context::get_score_context () const { return (scm_is_pair (context_list_)) - ? Context::unsmob (scm_car (context_list_)) + ? unsmob<Context> (scm_car (context_list_)) : 0; } diff --git a/lily/grace-engraver.cc b/lily/grace-engraver.cc index 42b6742dbc..b4fdbec695 100644 --- a/lily/grace-engraver.cc +++ b/lily/grace-engraver.cc @@ -100,7 +100,7 @@ Grace_engraver::consider_change_grace_settings () SCM grob = scm_cadr (elt); SCM cell = scm_cddr (elt); - Grob_property_info (Context::unsmob (context), grob).matched_pop (cell); + Grob_property_info (unsmob<Context> (context), grob).matched_pop (cell); } grace_settings_ = SCM_EOL; } diff --git a/lily/grace-music.cc b/lily/grace-music.cc index cf71a79505..8337a0b7f5 100644 --- a/lily/grace-music.cc +++ b/lily/grace-music.cc @@ -30,7 +30,7 @@ MAKE_SCHEME_CALLBACK (Grace_music, start_callback, 1); SCM Grace_music::start_callback (SCM m) { - Moment *l = Moment::unsmob (Music_wrapper::length_callback (m)); + Moment *l = unsmob<Moment> (Music_wrapper::length_callback (m)); Moment gl; gl.grace_part_ = -(l->main_part_ + l->grace_part_); return gl.smobbed_copy (); diff --git a/lily/grace-spacing-engraver.cc b/lily/grace-spacing-engraver.cc index 641c99c7d9..5da9c90b5c 100644 --- a/lily/grace-spacing-engraver.cc +++ b/lily/grace-spacing-engraver.cc @@ -54,7 +54,7 @@ Grace_spacing_engraver::process_music () if (grace_spacing_ && (now.grace_part_ || last_moment_.grace_part_)) { - Grob *column = Grob::unsmob (get_property ("currentMusicalColumn")); + Grob *column = unsmob<Grob> (get_property ("currentMusicalColumn")); Pointer_group_interface::add_grob (grace_spacing_, ly_symbol2scm ("columns"), column); diff --git a/lily/gregorian-ligature-engraver.cc b/lily/gregorian-ligature-engraver.cc index 485b97a184..4e4fc135c4 100644 --- a/lily/gregorian-ligature-engraver.cc +++ b/lily/gregorian-ligature-engraver.cc @@ -215,7 +215,7 @@ provide_context_info (vector<Grob_info> const &primitives) Grob *primitive = primitives[i].grob (); Stream_event *event_cause = primitives[i].event_cause (); int context_info = 0; - int pitch = Pitch::unsmob (event_cause->get_property ("pitch"))->steps (); + int pitch = unsmob<Pitch> (event_cause->get_property ("pitch"))->steps (); int prefix_set = scm_to_int (primitive->get_property ("prefix-set")); if (prefix_set & PES_OR_FLEXA) diff --git a/lily/grid-line-interface.cc b/lily/grid-line-interface.cc index 4c86d2f7ea..8fb2690caa 100644 --- a/lily/grid-line-interface.cc +++ b/lily/grid-line-interface.cc @@ -28,7 +28,7 @@ MAKE_SCHEME_CALLBACK (Grid_line_interface, print, 1); SCM Grid_line_interface::print (SCM smobbed_me) { - Grob *me = Grob::unsmob (smobbed_me); + Grob *me = unsmob<Grob> (smobbed_me); extract_grob_set (me, "elements", elts); /* compute common refpoint of elements */ @@ -63,7 +63,7 @@ MAKE_SCHEME_CALLBACK (Grid_line_interface, width, 1); SCM Grid_line_interface::width (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Real staffline = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness")); Real thick = robust_scm2double (me->get_property ("thickness"), 1.0) diff --git a/lily/grid-point-engraver.cc b/lily/grid-point-engraver.cc index b39ad0b2d6..f436195787 100644 --- a/lily/grid-point-engraver.cc +++ b/lily/grid-point-engraver.cc @@ -35,7 +35,7 @@ void Grid_point_engraver::process_music () { SCM grid_interval = get_property ("gridInterval"); - if (Moment *mom = Moment::unsmob (grid_interval)) + if (Moment *mom = unsmob<Moment> (grid_interval)) { Moment now = now_mom (); diff --git a/lily/grob-array-scheme.cc b/lily/grob-array-scheme.cc index b62c629224..8778763284 100644 --- a/lily/grob-array-scheme.cc +++ b/lily/grob-array-scheme.cc @@ -28,7 +28,7 @@ LY_DEFINE (ly_grob_array_length, "ly:grob-array-length", { LY_ASSERT_SMOB (Grob_array, grob_arr, 1); - Grob_array *me = Grob_array::unsmob (grob_arr); + Grob_array *me = unsmob<Grob_array> (grob_arr); return scm_from_int (me->size ()); } @@ -37,7 +37,7 @@ LY_DEFINE (ly_grob_array_ref, "ly:grob-array-ref", (SCM grob_arr, SCM index), "Retrieve the @var{index}th element of @var{grob-arr}.") { - Grob_array *me = Grob_array::unsmob (grob_arr); + Grob_array *me = unsmob<Grob_array> (grob_arr); LY_ASSERT_SMOB (Grob_array, grob_arr, 1); LY_ASSERT_TYPE (scm_is_integer, index, 2); @@ -53,7 +53,7 @@ LY_DEFINE (ly_grob_array_2_list, "ly:grob-array->list", (SCM grob_arr), "Return the elements of @var{grob-arr} as a Scheme list.") { - Grob_array *me = Grob_array::unsmob (grob_arr); + Grob_array *me = unsmob<Grob_array> (grob_arr); LY_ASSERT_SMOB (Grob_array, grob_arr, 1); return grob_array_to_list (me); diff --git a/lily/grob-array.cc b/lily/grob-array.cc index 2747e0d77f..27f05076f2 100644 --- a/lily/grob-array.cc +++ b/lily/grob-array.cc @@ -114,9 +114,9 @@ SCM grob_list_to_grob_array (SCM lst) { SCM arr_scm = Grob_array::make_array (); - Grob_array *ga = Grob_array::unsmob (arr_scm); + Grob_array *ga = unsmob<Grob_array> (arr_scm); for (SCM s = lst; scm_is_pair (s); s = scm_cdr (s)) - ga->add (Grob::unsmob (scm_car (s))); + ga->add (unsmob<Grob> (scm_car (s))); return arr_scm; } diff --git a/lily/grob-closure.cc b/lily/grob-closure.cc index ee4d1b0407..c9080f4fb7 100644 --- a/lily/grob-closure.cc +++ b/lily/grob-closure.cc @@ -33,15 +33,15 @@ add_offset_callback (Grob *g, SCM proc, Axis a) SCM data = g->get_property_data (axis_offset_symbol (a)); if (!scm_is_number (data) && !ly_is_procedure (data) - && !Simple_closure::is_smob (data)) + && !unsmob<Simple_closure> (data)) { g->set_property (axis_offset_symbol (a), proc); return; } - if (ly_is_procedure (data) || Unpure_pure_container::is_smob (data)) + if (ly_is_procedure (data) || unsmob<Unpure_pure_container> (data)) data = Simple_closure::make_smob (scm_list_1 (data)); - else if (Simple_closure *sc = Simple_closure::unsmob (data)) + else if (Simple_closure *sc = unsmob<Simple_closure> (data)) data = sc->expression (); SCM plus = ly_lily_module_constant ("+"); @@ -67,9 +67,9 @@ chain_callback (Grob *g, SCM proc, SCM sym) { SCM data = g->get_property_data (sym); - if (ly_is_procedure (data) || Unpure_pure_container::is_smob (data)) + if (ly_is_procedure (data) || unsmob<Unpure_pure_container> (data)) data = Simple_closure::make_smob (scm_list_1 (data)); - else if (Simple_closure *sc = Simple_closure::unsmob (data)) + else if (Simple_closure *sc = unsmob<Simple_closure> (data)) data = sc->expression (); else /* diff --git a/lily/grob-info.cc b/lily/grob-info.cc index ee79e4ec66..ef991418a1 100644 --- a/lily/grob-info.cc +++ b/lily/grob-info.cc @@ -50,7 +50,7 @@ Stream_event * Grob_info::event_cause () const { SCM cause = grob_->get_property ("cause"); - return Stream_event::unsmob (cause); + return unsmob<Stream_event> (cause); } vector<Context *> @@ -90,11 +90,11 @@ Stream_event * Grob_info::ultimate_event_cause () const { SCM cause = grob_->self_scm (); - while (Grob::is_smob (cause)) + while (unsmob<Grob> (cause)) { - cause = Grob::unsmob (cause)->get_property ("cause"); + cause = unsmob<Grob> (cause)->get_property ("cause"); } - return Stream_event::unsmob (cause); + return unsmob<Stream_event> (cause); } bool diff --git a/lily/grob-pq-engraver.cc b/lily/grob-pq-engraver.cc index 82083f4648..8644f6f083 100644 --- a/lily/grob-pq-engraver.cc +++ b/lily/grob-pq-engraver.cc @@ -63,8 +63,8 @@ LY_DEFINE (ly_grob_pq_less_p, "ly:grob-pq<?", "Compare two grob priority queue entries." " This is an internal function.") { - if (Moment::compare (*Moment::unsmob (scm_car (a)), - *Moment::unsmob (scm_car (b))) < 0) + if (Moment::compare (*unsmob<Moment> (scm_car (a)), + *unsmob<Moment> (scm_car (b))) < 0) return SCM_BOOL_T; else return SCM_BOOL_F; @@ -121,7 +121,7 @@ Grob_pq_engraver::stop_translation_timestep () Moment now = now_mom (); SCM start_busy = get_property ("busyGrobs"); SCM busy = start_busy; - while (scm_is_pair (busy) && *Moment::unsmob (scm_caar (busy)) == now) + while (scm_is_pair (busy) && *unsmob<Moment> (scm_caar (busy)) == now) busy = scm_cdr (busy); } @@ -133,7 +133,7 @@ Grob_pq_engraver::start_translation_timestep () SCM start_busy = get_property ("busyGrobs"); SCM busy = start_busy; - while (scm_is_pair (busy) && *Moment::unsmob (scm_caar (busy)) < now) + while (scm_is_pair (busy) && *unsmob<Moment> (scm_caar (busy)) < now) { /* The grob-pq-engraver is not water tight, and stuff like diff --git a/lily/grob-property.cc b/lily/grob-property.cc index 7f7368df69..9ec39db159 100644 --- a/lily/grob-property.cc +++ b/lily/grob-property.cc @@ -123,8 +123,8 @@ Grob::internal_set_value_on_alist (SCM *alist, SCM sym, SCM v) if (do_internal_type_checking_global) { if (!ly_is_procedure (v) - && !Simple_closure::is_smob (v) - && !Unpure_pure_container::is_smob (v) + && !unsmob<Simple_closure> (v) + && !unsmob<Unpure_pure_container> (v) && !scm_is_eq (v, ly_symbol2scm ("calculation-in-progress"))) type_check_assignment (sym, v, ly_symbol2scm ("backend-type?")); @@ -151,8 +151,8 @@ Grob::internal_get_property_data (SCM sym) const if (do_internal_type_checking_global && scm_is_pair (handle)) { SCM val = scm_cdr (handle); - if (!ly_is_procedure (val) && !Simple_closure::is_smob (val) - && !Unpure_pure_container::is_smob (val)) + if (!ly_is_procedure (val) && !unsmob<Simple_closure> (val) + && !unsmob<Unpure_pure_container> (val)) type_check_assignment (sym, val, ly_symbol2scm ("backend-type?")); check_interfaces_for_property (this, sym); @@ -180,11 +180,11 @@ Grob::internal_get_property (SCM sym) const } #endif - if (Unpure_pure_container *upc = Unpure_pure_container::unsmob (val)) + if (Unpure_pure_container *upc = unsmob<Unpure_pure_container> (val)) val = upc->unpure_part (); if (ly_is_procedure (val) - || Simple_closure::is_smob (val)) + || unsmob<Simple_closure> (val)) { Grob *me = ((Grob *)this); val = me->try_callback_on_alist (&me->mutable_property_alist_, sym, val); @@ -201,7 +201,7 @@ Grob::internal_get_pure_property (SCM sym, int start, int end) const if (ly_is_procedure (val)) return call_pure_function (val, scm_list_1 (self_scm ()), start, end); - if (Unpure_pure_container *upc = Unpure_pure_container::unsmob (val)) { + if (Unpure_pure_container *upc = unsmob<Unpure_pure_container> (val)) { // Do cache, if the function ignores 'start' and 'end' if (upc->is_unchanging ()) return internal_get_property (sym); @@ -209,7 +209,7 @@ Grob::internal_get_pure_property (SCM sym, int start, int end) const return call_pure_function (val, scm_list_1 (self_scm ()), start, end); } - if (Simple_closure *sc = Simple_closure::unsmob (val)) + if (Simple_closure *sc = unsmob<Simple_closure> (val)) return evaluate_with_simple_closure (self_scm (), sc->expression (), true, start, end); @@ -240,7 +240,7 @@ Grob::try_callback_on_alist (SCM *alist, SCM sym, SCM proc) SCM value = SCM_EOL; if (ly_is_procedure (proc)) value = scm_call_1 (proc, self_scm ()); - else if (Simple_closure *sc = Simple_closure::unsmob (proc)) + else if (Simple_closure *sc = unsmob<Simple_closure> (proc)) { value = evaluate_with_simple_closure (self_scm (), sc->expression (), @@ -304,8 +304,8 @@ Grob::internal_get_object (SCM sym) const { SCM val = scm_cdr (s); if (ly_is_procedure (val) - || Simple_closure::is_smob (val) - || Unpure_pure_container::is_smob (val)) + || unsmob<Simple_closure> (val) + || unsmob<Unpure_pure_container> (val)) { Grob *me = ((Grob *)this); val = me->try_callback_on_alist (&me->object_alist_, sym, val); @@ -332,11 +332,11 @@ Grob::internal_has_interface (SCM k) SCM call_pure_function (SCM unpure, SCM args, int start, int end) { - if (Unpure_pure_container *upc = Unpure_pure_container::unsmob (unpure)) + if (Unpure_pure_container *upc = unsmob<Unpure_pure_container> (unpure)) { SCM pure = upc->pure_part (); - if (Simple_closure *sc = Simple_closure::unsmob (pure)) + if (Simple_closure *sc = unsmob<Simple_closure> (pure)) { SCM expr = sc->expression (); return evaluate_with_simple_closure (scm_car (args), expr, true, start, end); @@ -352,7 +352,7 @@ call_pure_function (SCM unpure, SCM args, int start, int end) return pure; } - if (Simple_closure *sc = Simple_closure::unsmob (unpure)) + if (Simple_closure *sc = unsmob<Simple_closure> (unpure)) { SCM expr = sc->expression (); return evaluate_with_simple_closure (scm_car (args), expr, true, start, end); diff --git a/lily/grob-scheme.cc b/lily/grob-scheme.cc index 2a42439fb5..b6d07cb8c4 100644 --- a/lily/grob-scheme.cc +++ b/lily/grob-scheme.cc @@ -33,7 +33,7 @@ LY_DEFINE (ly_grob_property_data, "ly:grob-property-data", "Return the value for property @var{sym} of @var{grob}," " but do not process callbacks.") { - Grob *sc = Grob::unsmob (grob); + Grob *sc = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_TYPE (ly_is_symbol, sym, 2); @@ -45,13 +45,13 @@ LY_DEFINE (ly_grob_set_property_x, "ly:grob-set-property!", 3, 0, 0, (SCM grob, SCM sym, SCM val), "Set @var{sym} in grob @var{grob} to value @var{val}.") { - Grob *sc = Grob::unsmob (grob); + Grob *sc = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_TYPE (ly_is_symbol, sym, 2); if (!ly_is_procedure (val) - && !Simple_closure::is_smob (val) + && !unsmob<Simple_closure> (val) && !type_check_assignment (sym, val, ly_symbol2scm ("backend-type?"))) error ("typecheck failed"); @@ -63,7 +63,7 @@ LY_DEFINE (ly_grob_set_nested_property_x, "ly:grob-set-nested-property!", 3, 0, 0, (SCM grob, SCM symlist, SCM val), "Set nested property @var{symlist} in grob @var{grob} to value @var{val}.") { - Grob *sc = Grob::unsmob (grob); + Grob *sc = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); @@ -88,7 +88,7 @@ LY_DEFINE (ly_grob_pure_property, "ly:grob-pure-property", " If no value is found, return @var{val} or @code{'()}" " if @var{val} is not specified.") { - Grob *sc = Grob::unsmob (grob); + Grob *sc = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_TYPE (ly_is_symbol, sym, 2); @@ -110,8 +110,8 @@ LY_DEFINE (ly_grob_pure_height, "ly:grob-pure-height", " If no value is found, return @var{val} or @code{'()}" " if @var{val} is not specified.") { - Grob *sc = Grob::unsmob (grob); - Grob *ref = Grob::unsmob (refp); + Grob *sc = unsmob<Grob> (grob); + Grob *ref = unsmob<Grob> (refp); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_SMOB (Grob, refp, 2); @@ -131,7 +131,7 @@ LY_DEFINE (ly_grob_property, "ly:grob-property", " If no value is found, return @var{val} or @code{'()}" " if @var{val} is not specified.") { - Grob *sc = Grob::unsmob (grob); + Grob *sc = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_TYPE (ly_is_symbol, sym, 2); @@ -149,7 +149,7 @@ LY_DEFINE (ly_grob_interfaces, "ly:grob-interfaces", 1, 0, 0, (SCM grob), "Return the interfaces list of grob @var{grob}.") { - Grob *sc = Grob::unsmob (grob); + Grob *sc = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); @@ -162,7 +162,7 @@ LY_DEFINE (ly_grob_object, "ly:grob-object", " @var{sym}. It returns @code{'()} (end-of-list) if @var{sym}" " is undefined in @var{grob}.") { - Grob *sc = Grob::unsmob (grob); + Grob *sc = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_TYPE (ly_is_symbol, sym, 2); @@ -174,7 +174,7 @@ LY_DEFINE (ly_grob_set_object_x, "ly:grob-set-object!", 3, 0, 0, (SCM grob, SCM sym, SCM val), "Set @var{sym} in grob @var{grob} to value @var{val}.") { - Grob *sc = Grob::unsmob (grob); + Grob *sc = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_TYPE (ly_is_symbol, sym, 2); @@ -189,7 +189,7 @@ LY_DEFINE (ly_grob_layout, "ly:grob-layout", 1, 0, 0, (SCM grob), "Get @code{\\layout} definition from grob @var{grob}.") { - Grob *sc = Grob::unsmob (grob); + Grob *sc = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); @@ -202,7 +202,7 @@ LY_DEFINE (ly_grob_alist_chain, "ly:grob-alist-chain", " the global default. If unspecified, @code{font-defaults}" " from the layout block is taken.") { - Grob *sc = Grob::unsmob (grob); + Grob *sc = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); @@ -221,8 +221,8 @@ LY_DEFINE (ly_grob_extent, "ly:grob-extent", "Get the extent in @var{axis} direction of @var{grob} relative to" " the grob @var{refp}.") { - Grob *sc = Grob::unsmob (grob); - Grob *ref = Grob::unsmob (refp); + Grob *sc = unsmob<Grob> (grob); + Grob *ref = unsmob<Grob> (refp); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_SMOB (Grob, refp, 2); @@ -243,8 +243,8 @@ LY_DEFINE (ly_grob_robust_relative_extent, "ly:grob-robust-relative-extent", "Get the extent in @var{axis} direction of @var{grob} relative to" " the grob @var{refp}, or @code{(0,0)} if empty.") { - Grob *sc = Grob::unsmob (grob); - Grob *ref = Grob::unsmob (refp); + Grob *sc = unsmob<Grob> (grob); + Grob *ref = unsmob<Grob> (refp); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_SMOB (Grob, refp, 2); @@ -266,8 +266,8 @@ LY_DEFINE (ly_grob_relative_coordinate, "ly:grob-relative-coordinate", "Get the coordinate in @var{axis} direction of @var{grob} relative" " to the grob @var{refp}.") { - Grob *sc = Grob::unsmob (grob); - Grob *ref = Grob::unsmob (refp); + Grob *sc = unsmob<Grob> (grob); + Grob *ref = unsmob<Grob> (refp); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_SMOB (Grob, refp, 2); @@ -289,7 +289,7 @@ LY_DEFINE (ly_grob_parent, "ly:grob-parent", "Get the parent of @var{grob}. @var{axis} is 0 for the X-axis," " 1@tie{}for the Y-axis.") { - Grob *sc = Grob::unsmob (grob); + Grob *sc = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_TYPE (is_axis, axis, 2); @@ -302,8 +302,8 @@ LY_DEFINE (ly_grob_set_parent_x, "ly:grob-set-parent!", 3, 0, 0, (SCM grob, SCM axis, SCM parent_grob), "Set @var{parent-grob} the parent of grob @var{grob} in axis @var{axis}.") { - Grob *gr = Grob::unsmob (grob); - Grob *parent = Grob::unsmob (parent_grob); + Grob *gr = unsmob<Grob> (grob); + Grob *parent = unsmob<Grob> (parent_grob); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_TYPE (is_axis, axis, 2); @@ -318,7 +318,7 @@ LY_DEFINE (ly_grob_properties, "ly:grob-properties", 1, 0, 0, (SCM grob), "Get the mutable properties of @var{grob}.") { - Grob *g = Grob::unsmob (grob); + Grob *g = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); @@ -330,7 +330,7 @@ LY_DEFINE (ly_grob_basic_properties, "ly:grob-basic-properties", 1, 0, 0, (SCM grob), "Get the immutable properties of @var{grob}.") { - Grob *g = Grob::unsmob (grob); + Grob *g = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); @@ -342,7 +342,7 @@ LY_DEFINE (ly_grob_system, "ly:grob-system", 1, 0, 0, (SCM grob), "Return the system grob of @var{grob}.") { - Grob *me = Grob::unsmob (grob); + Grob *me = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); @@ -356,7 +356,7 @@ LY_DEFINE (ly_grob_original, "ly:grob-original", 1, 0, 0, (SCM grob), "Return the unbroken original grob of @var{grob}.") { - Grob *me = Grob::unsmob (grob); + Grob *me = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); return me->original () ? me->original ()->self_scm () : me->self_scm (); @@ -366,7 +366,7 @@ LY_DEFINE (ly_grob_suicide_x, "ly:grob-suicide!", 1, 0, 0, (SCM grob), "Kill @var{grob}.") { - Grob *me = Grob::unsmob (grob); + Grob *me = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); @@ -379,7 +379,7 @@ LY_DEFINE (ly_grob_translate_axis_x, "ly:grob-translate-axis!", "Translate @var{grob} on axis@tie{}@var{a} over" " distance@tie{}@var{d}.") { - Grob *me = Grob::unsmob (grob); + Grob *me = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_TYPE (scm_is_number, d, 2); @@ -393,7 +393,7 @@ LY_DEFINE (ly_grob_default_font, "ly:grob-default-font", 1, 0, 0, (SCM grob), "Return the default font for grob @var{grob}.") { - Grob *gr = Grob::unsmob (grob); + Grob *gr = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); @@ -411,12 +411,12 @@ LY_DEFINE (ly_grob_common_refpoint, "ly:grob-common-refpoint", " for @var{axis}.") { - Grob *gr = Grob::unsmob (grob); + Grob *gr = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_SMOB (Grob, other, 2); - Grob *o = Grob::unsmob (other); + Grob *o = unsmob<Grob> (other); LY_ASSERT_TYPE (is_axis, axis, 3); @@ -429,12 +429,12 @@ LY_DEFINE (ly_grob_common_refpoint_of_array, "ly:grob-common-refpoint-of-array", "Find the common refpoint of @var{grob} and @var{others}" " (a grob-array) for @var{axis}.") { - Grob *gr = Grob::unsmob (grob); + Grob *gr = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_SMOB (Grob_array, others, 2); - Grob_array *ga = Grob_array::unsmob (others); + Grob_array *ga = unsmob<Grob_array> (others); LY_ASSERT_TYPE (is_axis, axis, 3); Grob *refp = common_refpoint_of_array (ga->array (), gr, Axis (scm_to_int (axis))); @@ -448,10 +448,10 @@ LY_DEFINE (ly_grob_chain_callback, "ly:grob-chain-callback", " to the head of this, meaning that it is called" " using @var{grob} and the previous callback's result.") { - Grob *gr = Grob::unsmob (grob); + Grob *gr = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); - SCM_ASSERT_TYPE (ly_is_procedure (proc) || Unpure_pure_container::is_smob (proc), proc, SCM_ARG2, __FUNCTION__, "procedure or unpure pure container"); + SCM_ASSERT_TYPE (ly_is_procedure (proc) || unsmob<Unpure_pure_container> (proc), proc, SCM_ARG2, __FUNCTION__, "procedure or unpure pure container"); LY_ASSERT_TYPE (ly_is_symbol, sym, 3); chain_callback (gr, proc, sym); @@ -465,8 +465,8 @@ LY_DEFINE (ly_grob_vertical_less_p, "ly:grob-vertical<?", LY_ASSERT_SMOB (Grob, a, 1); LY_ASSERT_SMOB (Grob, b, 2); - Grob *ga = Grob::unsmob (a); - Grob *gb = Grob::unsmob (b); + Grob *ga = unsmob<Grob> (a); + Grob *gb = unsmob<Grob> (b); return ly_bool2scm (Grob::vertical_less (ga, gb)); } @@ -476,7 +476,7 @@ LY_DEFINE (ly_grob_get_vertical_axis_group_index, "ly:grob-get-vertical-axis-gro "Get the index of the vertical axis group the grob @var{grob} belongs to;" " return @code{-1} if none is found.") { - Grob *gr = Grob::unsmob (grob); + Grob *gr = unsmob<Grob> (grob); LY_ASSERT_SMOB (Grob, grob, 1); diff --git a/lily/grob.cc b/lily/grob.cc index 435a6faff3..2377a5d963 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -127,7 +127,7 @@ Grob::get_stencil () const return 0; SCM stil = get_property ("stencil"); - return Stencil::unsmob (stil); + return unsmob<Stencil> (stil); } Stencil @@ -136,7 +136,7 @@ Grob::get_print_stencil () const SCM stil = get_property ("stencil"); Stencil retval; - if (Stencil *m = Stencil::unsmob (stil)) + if (Stencil *m = unsmob<Stencil> (stil)) { retval = *m; bool transparent = to_boolean (get_property ("transparent")); @@ -180,7 +180,7 @@ Grob::get_print_stencil () const /* Call the scheme procedure stencil-whiteout in scm/stencils.scm */ /* to add a round-filled-box stencil to the stencil list */ retval - = *Stencil::unsmob (scm_call_1 (ly_lily_module_constant ("stencil-whiteout"), + = *unsmob<Stencil> (scm_call_1 (ly_lily_module_constant ("stencil-whiteout"), retval.smobbed_copy ())); } @@ -720,13 +720,13 @@ void Grob::programming_error (const string &s) const { SCM cause = self_scm (); - while (Grob *g = Grob::unsmob (cause)) + while (Grob *g = unsmob<Grob> (cause)) cause = g->get_property ("cause"); /* ES TODO: cause can't be Music*/ - if (Music *m = Music::unsmob (cause)) + if (Music *m = unsmob<Music> (cause)) m->origin ()->programming_error (s); - else if (Stream_event *ev = Stream_event::unsmob (cause)) + else if (Stream_event *ev = unsmob<Stream_event> (cause)) ev->origin ()->programming_error (s); else ::programming_error (s); @@ -736,13 +736,13 @@ void Grob::warning (const string &s) const { SCM cause = self_scm (); - while (Grob *g = Grob::unsmob (cause)) + while (Grob *g = unsmob<Grob> (cause)) cause = g->get_property ("cause"); /* ES TODO: cause can't be Music*/ - if (Music *m = Music::unsmob (cause)) + if (Music *m = unsmob<Music> (cause)) m->origin ()->warning (s); - else if (Stream_event *ev = Stream_event::unsmob (cause)) + else if (Stream_event *ev = unsmob<Stream_event> (cause)) ev->origin ()->warning (s); else ::warning (s); @@ -848,7 +848,7 @@ MAKE_SCHEME_CALLBACK (Grob, stencil_height, 1); SCM Grob::stencil_height (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return grob_stencil_extent (me, Y_AXIS); } @@ -856,8 +856,8 @@ MAKE_SCHEME_CALLBACK (Grob, pure_stencil_height, 3); SCM Grob::pure_stencil_height (SCM smob, SCM /* beg */, SCM /* end */) { - Grob *me = Grob::unsmob (smob); - if (Stencil::is_smob (me->get_property_data ("stencil"))) + Grob *me = unsmob<Grob> (smob); + if (unsmob<Stencil> (me->get_property_data ("stencil"))) return grob_stencil_extent (me, Y_AXIS); return ly_interval2scm (Interval ()); @@ -868,7 +868,7 @@ MAKE_SCHEME_CALLBACK (Grob, y_parent_positioning, 1); SCM Grob::y_parent_positioning (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Grob *par = me->get_parent (Y_AXIS); if (par) (void) par->get_property ("positioning-done"); @@ -880,7 +880,7 @@ MAKE_SCHEME_CALLBACK (Grob, x_parent_positioning, 1); SCM Grob::x_parent_positioning (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Grob *par = me->get_parent (X_AXIS); if (par) @@ -893,7 +893,7 @@ MAKE_SCHEME_CALLBACK (Grob, stencil_width, 1); SCM Grob::stencil_width (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return grob_stencil_extent (me, X_AXIS); } @@ -901,7 +901,7 @@ Grob * common_refpoint_of_list (SCM elist, Grob *common, Axis a) { for (; scm_is_pair (elist); elist = scm_cdr (elist)) - if (Grob *s = Grob::unsmob (scm_car (elist))) + if (Grob *s = unsmob<Grob> (scm_car (elist))) { if (common) common = common->common_refpoint (s, a); diff --git a/lily/hairpin.cc b/lily/hairpin.cc index 2ba6ab0d23..a083062e39 100644 --- a/lily/hairpin.cc +++ b/lily/hairpin.cc @@ -38,7 +38,7 @@ MAKE_SCHEME_CALLBACK (Hairpin, pure_height, 3); SCM Hairpin::pure_height (SCM smob, SCM, SCM) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Real height = robust_scm2double (me->get_property ("height"), 0.0) * Staff_symbol_referencer::staff_space (me); @@ -53,7 +53,7 @@ MAKE_SCHEME_CALLBACK (Hairpin, broken_bound_padding, 1); SCM Hairpin::broken_bound_padding (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); Item *r_bound = me->get_bound (RIGHT); if (r_bound->break_status_dir () != -1) { @@ -88,7 +88,7 @@ Hairpin::broken_bound_padding (SCM smob) if (!scm_is_pair (hsb)) break; - span_bars[d] = Grob::unsmob ((d == UP ? scm_car : scm_cdr) (hsb)); + span_bars[d] = unsmob<Grob> ((d == UP ? scm_car : scm_cdr) (hsb)); break; } @@ -107,7 +107,7 @@ MAKE_SCHEME_CALLBACK (Hairpin, print, 1); SCM Hairpin::print (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); SCM s = me->get_property ("grow-direction"); if (!is_direction (s)) diff --git a/lily/hara-kiri-group-spanner.cc b/lily/hara-kiri-group-spanner.cc index a682a0aa6d..06410786a6 100644 --- a/lily/hara-kiri-group-spanner.cc +++ b/lily/hara-kiri-group-spanner.cc @@ -30,7 +30,7 @@ MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, y_extent, 1); SCM Hara_kiri_group_spanner::y_extent (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); consider_suicide (me); return Axis_group_interface::generic_group_extent (me, Y_AXIS); } @@ -39,7 +39,7 @@ MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, calc_skylines, 1); SCM Hara_kiri_group_spanner::calc_skylines (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); consider_suicide (me); return Axis_group_interface::calc_skylines (smob); } @@ -48,7 +48,7 @@ MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, pure_height, 3); SCM Hara_kiri_group_spanner::pure_height (SCM smob, SCM start_scm, SCM end_scm) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); int start = robust_scm2int (start_scm, 0); int end = robust_scm2int (end_scm, INT_MAX); @@ -167,7 +167,7 @@ MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, force_hara_kiri_callback, 1); SCM Hara_kiri_group_spanner::force_hara_kiri_callback (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); consider_suicide (me); return scm_from_double (0.0); } @@ -176,7 +176,7 @@ MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, force_hara_kiri_in_y_parent_callb SCM Hara_kiri_group_spanner::force_hara_kiri_in_y_parent_callback (SCM smob) { - Grob *daughter = Grob::unsmob (smob); + Grob *daughter = unsmob<Grob> (smob); force_hara_kiri_callback (daughter->get_parent (Y_AXIS)->self_scm ()); return scm_from_double (0.0); } diff --git a/lily/horizontal-bracket.cc b/lily/horizontal-bracket.cc index df8b79173b..ddeec44d75 100644 --- a/lily/horizontal-bracket.cc +++ b/lily/horizontal-bracket.cc @@ -101,7 +101,7 @@ MAKE_SCHEME_CALLBACK (Horizontal_bracket, print, 1); SCM Horizontal_bracket::print (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); extract_grob_set (me, "columns", gs); vector<Grob *> enclosed = gs; diff --git a/lily/include/engraver.hh b/lily/include/engraver.hh index a2b3118192..70e168d783 100644 --- a/lily/include/engraver.hh +++ b/lily/include/engraver.hh @@ -65,12 +65,6 @@ public: override other ctor */ TRANSLATOR_DECLARATIONS (Engraver); - static Engraver *unsmob (SCM eng) { - return dynamic_cast<Engraver *> (Translator::unsmob (eng)); - } - static bool is_smob (SCM eng) { - return Translator::is_smob (eng) && unsmob (eng); - } }; #define make_item(x, cause) internal_make_item (ly_symbol2scm (x), cause, x, __FILE__, __LINE__, __FUNCTION__) diff --git a/lily/include/global-context.hh b/lily/include/global-context.hh index e5dbc82deb..75b52c95ae 100644 --- a/lily/include/global-context.hh +++ b/lily/include/global-context.hh @@ -48,13 +48,6 @@ public: virtual Moment now_mom () const; virtual Context *get_default_interpreter (const string &context_id = ""); - static Global_context *unsmob (SCM x) { - return dynamic_cast<Global_context *> (Context::unsmob (x)); - } - static bool is_smob (SCM x) { - return Context::is_smob (x) && unsmob (x); - } - Moment previous_moment () const; protected: Moment prev_mom_; diff --git a/lily/include/item.hh b/lily/include/item.hh index 914d2ef7b8..3b13ed8477 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -36,13 +36,6 @@ public: Item (SCM); Item (Item const &); - static Item *unsmob (SCM g) { - return dynamic_cast <Item *> (Grob::unsmob (g)); - } - static bool is_smob (SCM g) { - return Grob::is_smob (g) && unsmob (g); - } - virtual Grob *clone () const; static bool is_non_musical (Grob *); diff --git a/lily/include/lily-guile-macros.hh b/lily/include/lily-guile-macros.hh index ef48650353..9c6e59332f 100644 --- a/lily/include/lily-guile-macros.hh +++ b/lily/include/lily-guile-macros.hh @@ -235,23 +235,28 @@ void ly_check_name (const string &cxx, const string &fname); } \ } +template <class T> +T *unsmob (SCM var); + void ly_wrong_smob_arg (bool pred (SCM), SCM var, int number, const char *fun); +// Do not call this directly. +// Use LY_ASSERT_SMOB() which supplies the function name automatically. +template <class T> +inline T *ly_assert_smob (SCM var, int number, const char *fun) +{ + T *smob = unsmob<T> (var); + if (smob) + return smob; + + ly_wrong_smob_arg (T::is_smob, var, number, fun); + return 0; +} + // Could be just implemented using LY_ASSERT_TYPE, but this variant // saves a slight amount of code #define LY_ASSERT_SMOB(klass, var, number) \ - { \ - if (!klass::is_smob (var)) \ - ly_wrong_smob_arg (klass::is_smob, var, number, __FUNCTION__); \ - } - -// This variant is for the case where klass::unsmob might actually be -// situated in a base class of klass -#define LY_ASSERT_DERIVED_SMOB(klass, var, number) \ - { \ - if (!derived_unsmob<klass> (var)) \ - ly_wrong_smob_arg (klass::is_smob, var, number, __FUNCTION__); \ - } + ly_assert_smob<klass> (var, number, __FUNCTION__) #endif /* LILY_GUILE_MACROS_HH */ diff --git a/lily/include/listener.hh b/lily/include/listener.hh index d9f8aea76e..6f8995c64e 100644 --- a/lily/include/listener.hh +++ b/lily/include/listener.hh @@ -122,7 +122,7 @@ public: static SCM equal_p (SCM a, SCM b) { - return *Listener::unsmob (a) == *Listener::unsmob (b) + return *unchecked_unsmob (a) == *unchecked_unsmob (b) ? SCM_BOOL_T : SCM_BOOL_F; } }; @@ -157,8 +157,8 @@ class Callback_wrapper : public Simple_smob<Callback_wrapper> template <class T, void (T::*callback)(SCM)> static void trampoline (SCM target, SCM ev) { - T *t = derived_unsmob<T> (target); - LY_ASSERT_DERIVED_SMOB (T, target, 1); + T *t = unsmob<T> (target); + LY_ASSERT_SMOB (T, target, 1); (t->*callback) (ev); } @@ -168,12 +168,12 @@ class Callback_wrapper : public Simple_smob<Callback_wrapper> // The same, but for callbacks for translator listeners which get // the unpacked event which, in turn, gets protected previously - T *t = derived_unsmob<T> (target); - LY_ASSERT_DERIVED_SMOB (T, target, 1); + T *t = unsmob<T> (target); + LY_ASSERT_SMOB (T, target, 1); LY_ASSERT_SMOB (Stream_event, event, 2); t->protect_event (event); - (t->*callback) (Stream_event::unsmob (event)); + (t->*callback) (unsmob<Stream_event> (event)); } Callback_wrapper (void (*trampoline) (SCM, SCM)) : trampoline_ (trampoline) diff --git a/lily/include/music.hh b/lily/include/music.hh index 8cb69d0700..7c23ee21f8 100644 --- a/lily/include/music.hh +++ b/lily/include/music.hh @@ -47,12 +47,6 @@ public: Moment get_length () const; Moment start_mom () const; void print () const; - static Music *unsmob (SCM m) { - return dynamic_cast <Music *> (Prob::unsmob (m)); - } - static bool is_smob (SCM m) { - return Prob::is_smob (m) && unsmob (m); - } /// Transpose, with the interval central C to #p# void transpose (Pitch p); diff --git a/lily/include/paper-score.hh b/lily/include/paper-score.hh index e3d0813b4b..3d4d5840e1 100644 --- a/lily/include/paper-score.hh +++ b/lily/include/paper-score.hh @@ -39,13 +39,6 @@ public: DECLARE_CLASSNAME (Paper_score); - static Paper_score *unsmob (SCM ps) { - return dynamic_cast <Paper_score *> (Music_output::unsmob (ps)); - } - static bool is_smob (SCM ps) { - return Music_output::is_smob (ps) && unsmob (ps); - } - Output_def *layout () const; System *root_system () const; diff --git a/lily/include/performance.hh b/lily/include/performance.hh index 14c811b150..3f9c5d6f1b 100644 --- a/lily/include/performance.hh +++ b/lily/include/performance.hh @@ -31,13 +31,6 @@ public: ~Performance (); DECLARE_CLASSNAME (Performance); - static Performance *unsmob (SCM p) { - return dynamic_cast <Performance *> (Music_output::unsmob (p)); - } - static bool is_smob (SCM p) { - return Music_output::is_smob (p) && unsmob (p); - } - void add_element (Audio_element *p); virtual void process (); void remap_grace_durations (); diff --git a/lily/include/performer.hh b/lily/include/performer.hh index 82b4ce50cc..a640e240aa 100644 --- a/lily/include/performer.hh +++ b/lily/include/performer.hh @@ -33,12 +33,6 @@ public: VIRTUAL_COPY_CONSTRUCTOR (Translator, Performer); friend class Performer_group; Performer_group *get_daddy_performer () const; - static Performer *unsmob (SCM perf) { - return dynamic_cast <Performer *> (Translator::unsmob (perf)); - } - static bool is_smob (SCM perf) { - return Translator::is_smob (perf) && unsmob (perf); - } protected: virtual void announce_element (Audio_element_info); diff --git a/lily/include/smobs.hh b/lily/include/smobs.hh index ee6af16162..e95637cb7c 100644 --- a/lily/include/smobs.hh +++ b/lily/include/smobs.hh @@ -97,12 +97,10 @@ CALLING INTERFACE - Common public methods to C++ smob objects: + Common global functions for accessing C++ smob objects: - - unsmob (SCM x) - unpacks X and returns pointer to the C++ object, - or 0 if it has the wrong type. This can be used as a boolean - condition at C++ level. - - smob_p (SCM x) returns #t or #f at Scheme level. + - unsmob<T> (SCM x) - unpack X and return a pointer to the C++ object, + or 0 if it has the wrong type. IMPLEMENTATION @@ -153,11 +151,11 @@ class Smob_base static Scm_init scm_init_; static void init (void); static string smob_name_; +protected: static Super *unchecked_unsmob (SCM s) { return reinterpret_cast<Super *> (SCM_SMOB_DATA (s)); } -protected: // reference scm_init_ in smob_tag which is sure to be called. The // constructor, in contrast, may not be called at all in classes // like Smob1. @@ -237,7 +235,6 @@ private: return (Super::unchecked_unsmob (self)->*pmf)(arg1, arg2, arg3); } -public: static bool is_smob (SCM s) { return SCM_SMOB_PREDICATE (smob_tag (), s); @@ -246,18 +243,18 @@ public: { return is_smob (s) ? SCM_BOOL_T : SCM_BOOL_F; } - static Super *unsmob (SCM s) - { - return is_smob (s) ? Super::unchecked_unsmob (s) : 0; - } -}; -// derived_unsmob includes a dynamic_cast: + template <class T> + friend T *unsmob (SCM s); + + template <class T> + friend T *ly_assert_smob (SCM s, int number, const char *fun); +}; template <class T> -inline T *derived_unsmob (SCM arg) +inline T *unsmob (SCM s) { - return dynamic_cast<T *> (T::unsmob (arg)); + return T::is_smob (s) ? dynamic_cast<T *> (T::unchecked_unsmob (s)) : 0; } // Simple smobs diff --git a/lily/include/smobs.tcc b/lily/include/smobs.tcc index fffe4c4892..f76609bf5b 100644 --- a/lily/include/smobs.tcc +++ b/lily/include/smobs.tcc @@ -32,7 +32,7 @@ template <class Super> SCM Smob_base<Super>::mark_trampoline (SCM arg) { - Super *ptr = Super::unsmob (arg); + Super *ptr = unsmob<Super> (arg); if (ptr) return ptr->mark_smob (); return SCM_UNDEFINED; @@ -42,7 +42,7 @@ template <class Super> int Smob_base<Super>::print_trampoline (SCM arg, SCM port, scm_print_state *p) { - Super *ptr = Super::unsmob (arg); + Super *ptr = unsmob<Super> (arg); if (ptr) return ptr->print_smob (port, p); return 0; diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 788b0e46ee..7ee27abcb1 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -52,13 +52,6 @@ public: DECLARE_SCHEME_CALLBACK (bounds_width, (SCM)); DECLARE_SCHEME_CALLBACK (kill_zero_spanned_time, (SCM)); - static Spanner *unsmob (SCM s) { - return dynamic_cast <Spanner *> (Grob::unsmob (s)); - } - static bool is_smob (SCM s) { - return Grob::is_smob (s) && unsmob (s); - } - vector<Spanner *> broken_intos_; vsize get_break_index () const; diff --git a/lily/include/stencil.hh b/lily/include/stencil.hh index 6b78c18e4b..23a5be7fbc 100644 --- a/lily/include/stencil.hh +++ b/lily/include/stencil.hh @@ -47,7 +47,7 @@ using namespace std; efficient to add "fresh" stencils to what you're going to build. * Do not create Stencil objects on the heap. That includes passing - around Stencil* which are produced by Stencil::unsmob(). Either + around Stencil* which are produced by unsmob<Stencil>(). Either copy Stencil objects, or use SCM references. * Empty stencils have empty dimensions. If add_at_edge is used to diff --git a/lily/include/stream-event.hh b/lily/include/stream-event.hh index 27a83ed72f..d554f584dc 100644 --- a/lily/include/stream-event.hh +++ b/lily/include/stream-event.hh @@ -30,13 +30,6 @@ public: Stream_event (); VIRTUAL_COPY_CONSTRUCTOR (Stream_event, Stream_event); - static Stream_event *unsmob (SCM s) { - return dynamic_cast <Stream_event *> (Prob::unsmob (s)); - } - static bool is_smob (SCM s) { - return Prob::is_smob (s) && unsmob (s); - } - Stream_event (SCM event_class, SCM immutable_props = SCM_EOL); Stream_event (SCM class_name, Input *); diff --git a/lily/input-scheme.cc b/lily/input-scheme.cc index a324ccf0f4..42d35816c3 100644 --- a/lily/input-scheme.cc +++ b/lily/input-scheme.cc @@ -25,7 +25,7 @@ LY_DEFINE (ly_input_warning, "ly:input-warning", 2, 0, 1, (SCM sip, SCM msg, SCM " to the location in @var{sip}. @var{msg} is interpreted" " similar to @code{format}'s argument, using @var{rest}.") { - Input *ip = Input::unsmob (sip); + Input *ip = unsmob<Input> (sip); LY_ASSERT_SMOB (Input, sip, 1); LY_ASSERT_TYPE (scm_is_string, msg, 2); @@ -43,7 +43,7 @@ LY_DEFINE (ly_input_message, "ly:input-message", 2, 0, 1, (SCM sip, SCM msg, SCM " to the location in @var{sip}. @var{msg} is interpreted" " similar to @code{format}'s argument, using @var{rest}.") { - Input *ip = Input::unsmob (sip); + Input *ip = unsmob<Input> (sip); LY_ASSERT_SMOB (Input, sip, 1); LY_ASSERT_TYPE (scm_is_string, msg, 2); @@ -63,7 +63,7 @@ LY_DEFINE (ly_input_file_line_char_column, " @code{(file-name line char column)}.") { LY_ASSERT_SMOB (Input, sip, 1); - Input *ip = Input::unsmob (sip); + Input *ip = unsmob<Input> (sip); int l, ch, col, offset = 0; ip->get_counts (&l, &ch, &col, &offset); @@ -81,7 +81,7 @@ LY_DEFINE (ly_input_both_locations, { LY_ASSERT_SMOB (Input, sip, 1); - Input *ip = Input::unsmob (sip); + Input *ip = unsmob<Input> (sip); return scm_list_5 (ly_string2scm (ip->file_string ()), scm_from_int (ip->line_number ()), diff --git a/lily/input-smob.cc b/lily/input-smob.cc index 0a33bd6a59..605b790a68 100644 --- a/lily/input-smob.cc +++ b/lily/input-smob.cc @@ -47,8 +47,8 @@ Input::print_smob (SCM port, scm_print_state *) SCM Input::equal_p (SCM sa, SCM sb) { - Input *a = unsmob (sa); - Input *b = unsmob (sb); + Input *a = unsmob<Input> (sa); + Input *b = unsmob<Input> (sb); if (a->get_source_file () == b->get_source_file () && a->start () == b->start () && a->end () == b->end ()) diff --git a/lily/instrument-name-engraver.cc b/lily/instrument-name-engraver.cc index f65c295833..8b1a4c3003 100644 --- a/lily/instrument-name-engraver.cc +++ b/lily/instrument-name-engraver.cc @@ -107,7 +107,7 @@ Instrument_name_engraver::start_spanner () { text_spanner_ = make_spanner ("InstrumentName", SCM_EOL); - Grob *col = Grob::unsmob (get_property ("currentCommandColumn")); + Grob *col = unsmob<Grob> (get_property ("currentCommandColumn")); text_spanner_->set_bound (LEFT, col); text_spanner_->set_property ("text", short_text_); text_spanner_->set_property ("long-text", long_text_); @@ -115,7 +115,7 @@ Instrument_name_engraver::start_spanner () /* UGH, should handle this in Score_engraver. */ - Grob *system = Grob::unsmob (get_property ("rootSystem")); + Grob *system = unsmob<Grob> (get_property ("rootSystem")); if (system) Axis_group_interface::add_element (system, text_spanner_); else @@ -164,7 +164,7 @@ Instrument_name_engraver::stop_spanner () axis_groups_[i]); text_spanner_->set_bound (RIGHT, - Grob::unsmob (get_property ("currentCommandColumn"))); + unsmob<Grob> (get_property ("currentCommandColumn"))); Pointer_group_interface::set_ordered (text_spanner_, ly_symbol2scm ("elements"), diff --git a/lily/item-scheme.cc b/lily/item-scheme.cc index 24ccf5bf0d..48f3218f22 100644 --- a/lily/item-scheme.cc +++ b/lily/item-scheme.cc @@ -25,7 +25,7 @@ LY_DEFINE (ly_item_p, "ly:item?", 1, 0, 0, (SCM g), "Is @var{g} an @code{Item} object?") { - Grob *me = Grob::unsmob (g); + Grob *me = unsmob<Grob> (g); bool b = dynamic_cast<Item *> (me); return ly_bool2scm (b); } @@ -37,7 +37,7 @@ LY_DEFINE (ly_item_break_dir, "ly:item-break-dir", " @code{1}@tie{}beginning of line.") { LY_ASSERT_SMOB (Item, it, 1); - Item *me = Item::unsmob (it); + Item *me = unsmob<Item> (it); return scm_from_int (me->break_status_dir ()); } @@ -47,7 +47,7 @@ LY_DEFINE (ly_item_get_column, "ly:item-get-column", " associated with this @code{Item}.") { LY_ASSERT_SMOB (Item, it, 1); - Item *me = Item::unsmob (it); + Item *me = unsmob<Item> (it); if (Paper_column *col = me->get_column ()) return col->self_scm (); diff --git a/lily/keep-alive-together-engraver.cc b/lily/keep-alive-together-engraver.cc index c67e6e0cca..79fedc96df 100644 --- a/lily/keep-alive-together-engraver.cc +++ b/lily/keep-alive-together-engraver.cc @@ -56,9 +56,9 @@ Keep_alive_together_engraver::finalize () continue; SCM live_scm = Grob_array::make_array (); - Grob_array *live = Grob_array::unsmob (live_scm); + Grob_array *live = unsmob<Grob_array> (live_scm); SCM dead_scm = Grob_array::make_array (); - Grob_array *dead = Grob_array::unsmob (dead_scm); + Grob_array *dead = unsmob<Grob_array> (dead_scm); for (vsize j = 0; j < group_spanners_.size (); ++j) { diff --git a/lily/key-signature-interface.cc b/lily/key-signature-interface.cc index 9720b680f5..89695f7c5f 100644 --- a/lily/key-signature-interface.cc +++ b/lily/key-signature-interface.cc @@ -42,7 +42,7 @@ MAKE_SCHEME_CALLBACK (Key_signature_interface, print, 1); SCM Key_signature_interface::print (SCM smob) { - Item *me = Item::unsmob (smob); + Item *me = unsmob<Item> (smob); Real inter = Staff_symbol_referencer::staff_space (me) / 2.0; diff --git a/lily/kievan-ligature-engraver.cc b/lily/kievan-ligature-engraver.cc index f56e73c101..25582c6a39 100644 --- a/lily/kievan-ligature-engraver.cc +++ b/lily/kievan-ligature-engraver.cc @@ -81,7 +81,7 @@ Kievan_ligature_engraver::fold_up_primitives (vector<Grob_info> const &primitive first = current; // must keep track of accidentals in spacing problem - Grob *acc_gr = Grob::unsmob (current->get_object ("accidental-grob")); + Grob *acc_gr = unsmob<Grob> (current->get_object ("accidental-grob")); if (acc_gr && i > 0) { Interval acc_ext = acc_gr->extent (acc_gr, X_AXIS); @@ -107,7 +107,7 @@ Kievan_ligature_engraver::fold_up_primitives (vector<Grob_info> const &primitive if (i < primitives.size () - 1) { Item *next = dynamic_cast<Item *> (primitives[i + 1].grob ()); - Grob *acc_gr = Grob::unsmob (next->get_object ("accidental-grob")); + Grob *acc_gr = unsmob<Grob> (next->get_object ("accidental-grob")); if (acc_gr) { Interval acc_ext = acc_gr->extent (acc_gr, X_AXIS); diff --git a/lily/laissez-vibrer-engraver.cc b/lily/laissez-vibrer-engraver.cc index 1ab028bfd0..6e57a7e9df 100644 --- a/lily/laissez-vibrer-engraver.cc +++ b/lily/laissez-vibrer-engraver.cc @@ -67,13 +67,13 @@ Laissez_vibrer_engraver::acknowledge_note_head (Grob_info inf) * a single note head (attached as an articulation inside a chord) */ Stream_event *tie_ev = event_; Grob *head = inf.grob (); - Stream_event *note_ev = Stream_event::unsmob (head->get_property ("cause")); + Stream_event *note_ev = unsmob<Stream_event> (head->get_property ("cause")); if (!tie_ev && note_ev && note_ev->in_event_class ("note-event")) { SCM articulations = note_ev->get_property ("articulations"); for (SCM s = articulations; !tie_ev && scm_is_pair (s); s = scm_cdr (s)) { - Stream_event *ev = Stream_event::unsmob (scm_car (s)); + Stream_event *ev = unsmob<Stream_event> (scm_car (s)); if (ev && ev->in_event_class ("laissez-vibrer-event")) tie_ev = ev; } @@ -93,9 +93,9 @@ Laissez_vibrer_engraver::acknowledge_note_head (Grob_info inf) Pointer_group_interface::add_grob (lv_column_, ly_symbol2scm ("ties"), lv_tie); - if (is_direction (Stream_event::unsmob (cause)->get_property ("direction"))) + if (is_direction (unsmob<Stream_event> (cause)->get_property ("direction"))) { - Direction d = to_dir (Stream_event::unsmob (cause)->get_property ("direction")); + Direction d = to_dir (unsmob<Stream_event> (cause)->get_property ("direction")); lv_tie->set_property ("direction", scm_from_int (d)); } diff --git a/lily/ledger-line-engraver.cc b/lily/ledger-line-engraver.cc index 9004dc07e3..40ef019d23 100644 --- a/lily/ledger-line-engraver.cc +++ b/lily/ledger-line-engraver.cc @@ -53,7 +53,7 @@ Ledger_line_engraver::start_spanner () assert (!span_); span_ = make_spanner ("LedgerLineSpanner", SCM_EOL); - span_->set_bound (LEFT, Grob::unsmob (get_property ("currentCommandColumn"))); + span_->set_bound (LEFT, unsmob<Grob> (get_property ("currentCommandColumn"))); } void @@ -94,7 +94,7 @@ Ledger_line_engraver::stop_spanner () { if (span_) { - span_->set_bound (RIGHT, Grob::unsmob (get_property ("currentCommandColumn"))); + span_->set_bound (RIGHT, unsmob<Grob> (get_property ("currentCommandColumn"))); span_ = 0; } } diff --git a/lily/ledger-line-spanner.cc b/lily/ledger-line-spanner.cc index 6904698d7d..5cb5462351 100644 --- a/lily/ledger-line-spanner.cc +++ b/lily/ledger-line-spanner.cc @@ -66,7 +66,7 @@ MAKE_SCHEME_CALLBACK (Ledger_line_spanner, set_spacing_rods, 1); SCM Ledger_line_spanner::set_spacing_rods (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); // find size of note heads. Grob *staff = Staff_symbol_referencer::get_staff_symbol (me); @@ -164,7 +164,7 @@ MAKE_SCHEME_CALLBACK (Ledger_line_spanner, print, 1); SCM Ledger_line_spanner::print (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); extract_grob_set (me, "note-heads", heads); @@ -193,7 +193,7 @@ Ledger_line_spanner::print (SCM smob) Axis a = Axis (i); common[a] = common_refpoint_of_array (heads, me, a); for (vsize i = heads.size (); i--;) - if (Grob *g = Grob::unsmob (me->get_object ("accidental-grob"))) + if (Grob *g = unsmob<Grob> (me->get_object ("accidental-grob"))) common[a] = common[a]->common_refpoint (g, a); } @@ -287,7 +287,7 @@ Ledger_line_spanner::print (SCM smob) Interval x_extent = ledger_size; if (i == 0) - if (Grob *g = Grob::unsmob (h->get_object ("accidental-grob"))) + if (Grob *g = unsmob<Grob> (h->get_object ("accidental-grob"))) { Interval accidental_size = g->extent (common[X_AXIS], X_AXIS); Real d diff --git a/lily/lexer.ll b/lily/lexer.ll index 775cbdde0f..3c09299b4b 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -826,7 +826,7 @@ Lily_lexer::pop_extra_token () return -1; /* produce requested token */ - yylloc = *Input::unsmob (scm_caar (extra_tokens_)); + yylloc = *unsmob<Input> (scm_caar (extra_tokens_)); int type = scm_to_int (scm_cadar (extra_tokens_)); yylval = scm_cddar (extra_tokens_); extra_tokens_ = scm_cdr (extra_tokens_); @@ -913,7 +913,7 @@ Lily_lexer::scan_escaped_word (const string &str) return i; SCM sid = lookup_identifier (str); - if (Music *m = Music::unsmob (sid)) + if (Music *m = unsmob<Music> (sid)) { m->set_spot (override_input (here_input ())); } @@ -933,7 +933,7 @@ int Lily_lexer::scan_shorthand (const string &str) { SCM sid = lookup_identifier (str); - if (Music *m = Music::unsmob (sid)) + if (Music *m = unsmob<Music> (sid)) { m->set_spot (override_input (here_input ())); } @@ -952,7 +952,7 @@ Lily_lexer::scan_shorthand (const string &str) int Lily_lexer::scan_scm_id (SCM sid) { - if (Music_function *fun = Music_function::unsmob (sid)) + if (Music_function *fun = unsmob<Music_function> (sid)) { int funtype = SCM_FUNCTION; @@ -1013,7 +1013,7 @@ Lily_lexer::scan_bare_word (const string &str) if (scm_is_pair (handle)) { yylval = scm_cdr (handle); - if (Pitch::is_smob (yylval)) + if (unsmob<Pitch> (yylval)) return (YYSTATE == notes) ? NOTENAME_PITCH : TONICNAME_PITCH; else if (scm_is_symbol (yylval)) return DRUM_PITCH; @@ -1095,9 +1095,9 @@ Lily_lexer::eval_scm (SCM readerdata, Input hi, char extra_token) p = scm_cdr (p)) { SCM v = scm_car (p); - if (Music *m = Music::unsmob (v)) + if (Music *m = unsmob<Music> (v)) { - if (!Input::is_smob (m->get_property ("origin"))) + if (!unsmob<Input> (m->get_property ("origin"))) m->set_spot (override_input (here_input ())); } @@ -1120,9 +1120,9 @@ Lily_lexer::eval_scm (SCM readerdata, Input hi, char extra_token) sval = SCM_UNSPECIFIED; } - if (Music *m = Music::unsmob (sval)) + if (Music *m = unsmob<Music> (sval)) { - if (!Input::is_smob (m->get_property ("origin"))) + if (!unsmob<Input> (m->get_property ("origin"))) m->set_spot (override_input (here_input ())); } diff --git a/lily/ligature-engraver.cc b/lily/ligature-engraver.cc index b647e02edd..f3bac03c76 100644 --- a/lily/ligature-engraver.cc +++ b/lily/ligature-engraver.cc @@ -121,7 +121,7 @@ Ligature_engraver::process_music () primitives_.clear (); ligature_ = 0; } - last_bound_ = Grob::unsmob (get_property ("currentMusicalColumn")); + last_bound_ = unsmob<Grob> (get_property ("currentMusicalColumn")); if (ligature_) { @@ -140,7 +140,7 @@ Ligature_engraver::process_music () prev_start_event_ = events_drul_[START]; ligature_ = create_ligature_spanner (); - Grob *bound = Grob::unsmob (get_property ("currentMusicalColumn")); + Grob *bound = unsmob<Grob> (get_property ("currentMusicalColumn")); if (!bound) events_drul_[START]->origin ()->warning (_ ("no left bound")); else diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index d8d8d10edb..3408291c66 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -455,8 +455,8 @@ ly_wrong_smob_arg (bool pred (SCM), SCM var, int number, const char *fun) string type = predicate_to_typename ((void *) pred); if (pred (var)) { - // Uh oh. derived_unsmob <T> delivered 0, yet - // T::is_smob delivers true. This means that T::is_smob is a + // Uh oh. unsmob<T> delivered 0, yet + // unsmob<T> delivers true. This means that unsmob<T> is a // matching check from a base class of T, but var is of an // incompatible derived type. type = string (_ ("Wrong kind of ")).append (type); diff --git a/lily/lily-lexer-scheme.cc b/lily/lily-lexer-scheme.cc index c5a0bc5b7a..6ce3f7b90d 100644 --- a/lily/lily-lexer-scheme.cc +++ b/lily/lily-lexer-scheme.cc @@ -27,6 +27,6 @@ LY_DEFINE (ly_lexer_keywords, "ly:lexer-keywords", { LY_ASSERT_SMOB (Lily_lexer, lexer, 1); - Lily_lexer *lex = Lily_lexer::unsmob (lexer); + Lily_lexer *lex = unsmob<Lily_lexer> (lexer); return lex->keyword_list (); } diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index 3bb7921b2b..f2c0d18637 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -123,8 +123,8 @@ Lily_lexer::Lily_lexer (Lily_lexer const &src, Lily_parser *parser, main_input_level_ = 0; extra_tokens_ = SCM_EOL; - if (Input::is_smob (override_input)) - override_input_ = *Input::unsmob (override_input); + if (unsmob<Input> (override_input)) + override_input_ = *unsmob<Input> (override_input); smobify_self (); diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc index 806cc62fd6..6e706f29f7 100644 --- a/lily/lily-parser-scheme.cc +++ b/lily/lily-parser-scheme.cc @@ -141,7 +141,7 @@ LY_DEFINE (ly_parser_lexer, "ly:parser-lexer", 1, 0, 0, (SCM parser_smob), "Return the lexer for @var{parser-smob}.") { - Lily_parser *parser = Lily_parser::unsmob (parser_smob); + Lily_parser *parser = unsmob<Lily_parser> (parser_smob); return parser->lexer_->self_scm (); } @@ -154,7 +154,7 @@ LY_DEFINE (ly_parser_clone, "ly:parser-clone", " it becomes the source of all music expressions inside.") { LY_ASSERT_SMOB (Lily_parser, parser_smob, 1); - Lily_parser *parser = Lily_parser::unsmob (parser_smob); + Lily_parser *parser = unsmob<Lily_parser> (parser_smob); if (SCM_UNBNDP (closures)) closures = SCM_EOL; else @@ -170,7 +170,7 @@ LY_DEFINE (ly_parser_define_x, "ly:parser-define!", { LY_ASSERT_SMOB (Lily_parser, parser_smob, 1); - Lily_parser *parser = Lily_parser::unsmob (parser_smob); + Lily_parser *parser = unsmob<Lily_parser> (parser_smob); LY_ASSERT_TYPE (ly_is_symbol, symbol, 2); @@ -185,7 +185,7 @@ LY_DEFINE (ly_parser_lookup, "ly:parser-lookup", { LY_ASSERT_SMOB (Lily_parser, parser_smob, 1); - Lily_parser *parser = Lily_parser::unsmob (parser_smob); + Lily_parser *parser = unsmob<Lily_parser> (parser_smob); LY_ASSERT_TYPE (ly_is_symbol, symbol, 2); @@ -202,7 +202,7 @@ LY_DEFINE (ly_parser_parse_string, "ly:parser-parse-string", " Upon failure, throw @code{ly-file-failed} key.") { LY_ASSERT_SMOB (Lily_parser, parser_smob, 1); - Lily_parser *parser = Lily_parser::unsmob (parser_smob); + Lily_parser *parser = unsmob<Lily_parser> (parser_smob); LY_ASSERT_TYPE (scm_is_string, ly_code, 2); if (!parser->lexer_->is_clean ()) @@ -222,7 +222,7 @@ LY_DEFINE (ly_parse_string_expression, "ly:parse-string-expression", " @var{filename} and @var{line} are optional source indicators.") { LY_ASSERT_SMOB (Lily_parser, parser_smob, 1); - Lily_parser *parser = Lily_parser::unsmob (parser_smob); + Lily_parser *parser = unsmob<Lily_parser> (parser_smob); LY_ASSERT_TYPE (scm_is_string, ly_code, 2); string fn; if (SCM_UNBNDP (filename) || !scm_is_string (filename)) @@ -253,7 +253,7 @@ LY_DEFINE (ly_parser_include_string, "ly:parser-include-string", " Scheme expressions (@code{$} instead of @code{#}).") { LY_ASSERT_SMOB (Lily_parser, parser_smob, 1); - Lily_parser *parser = Lily_parser::unsmob (parser_smob); + Lily_parser *parser = unsmob<Lily_parser> (parser_smob); LY_ASSERT_TYPE (scm_is_string, ly_code, 2); parser->include_string (ly_scm2string (ly_code)); @@ -268,7 +268,7 @@ LY_DEFINE (ly_parser_set_note_names, "ly:parser-set-note-names", " if the current mode is notes.") { LY_ASSERT_SMOB (Lily_parser, parser, 1); - Lily_parser *p = Lily_parser::unsmob (parser); + Lily_parser *p = unsmob<Lily_parser> (parser); if (p->lexer_->is_note_state ()) { @@ -284,7 +284,7 @@ LY_DEFINE (ly_parser_output_name, "ly:parser-output-name", "Return the base name of the output file.") { LY_ASSERT_SMOB (Lily_parser, parser, 1); - Lily_parser *p = Lily_parser::unsmob (parser); + Lily_parser *p = unsmob<Lily_parser> (parser); return ly_string2scm (p->output_basename_); } @@ -294,12 +294,12 @@ LY_DEFINE (ly_parser_error, "ly:parser-error", "Display an error message and make the parser fail.") { LY_ASSERT_SMOB (Lily_parser, parser, 1); - Lily_parser *p = Lily_parser::unsmob (parser); + Lily_parser *p = unsmob<Lily_parser> (parser); LY_ASSERT_TYPE (scm_is_string, msg, 2); string s = ly_scm2string (msg); - Input *i = Input::unsmob (input); + Input *i = unsmob<Input> (input); if (i) p->parser_error (*i, s); else @@ -313,7 +313,7 @@ LY_DEFINE (ly_parser_clear_error, "ly:parser-clear-error", "Clear the error flag for the parser.") { LY_ASSERT_SMOB (Lily_parser, parser, 1); - Lily_parser *p = Lily_parser::unsmob (parser); + Lily_parser *p = unsmob<Lily_parser> (parser); p->error_level_ = 0; p->lexer_->error_level_ = 0; @@ -326,7 +326,7 @@ LY_DEFINE (ly_parser_has_error_p, "ly:parser-has-error?", "Does @var{parser} have an error flag?") { LY_ASSERT_SMOB (Lily_parser, parser, 1); - Lily_parser *p = Lily_parser::unsmob (parser); + Lily_parser *p = unsmob<Lily_parser> (parser); return scm_from_bool (p->error_level_ || p->lexer_->error_level_); } diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 2d006f8d78..8645d58cf1 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -219,7 +219,7 @@ Output_def * get_layout (Lily_parser *parser) { SCM id = parser->lexer_->lookup_identifier ("$defaultlayout"); - Output_def *layout = Output_def::unsmob (id); + Output_def *layout = unsmob<Output_def> (id); layout = layout ? layout->clone () : new Output_def; layout->set_variable (ly_symbol2scm ("is-layout"), SCM_BOOL_T); @@ -230,7 +230,7 @@ Output_def * get_midi (Lily_parser *parser) { SCM id = parser->lexer_->lookup_identifier ("$defaultmidi"); - Output_def *layout = Output_def::unsmob (id); + Output_def *layout = unsmob<Output_def> (id); layout = layout ? layout->clone () : new Output_def; layout->set_variable (ly_symbol2scm ("is-midi"), SCM_BOOL_T); return layout; @@ -243,9 +243,9 @@ get_paper (Lily_parser *parser) { SCM papers = parser->lexer_->lookup_identifier ("$papers"); Output_def *layout = (SCM_UNBNDP (papers) || scm_is_null (papers)) - ? 0 : Output_def::unsmob (scm_car (papers)); + ? 0 : unsmob<Output_def> (scm_car (papers)); SCM default_paper = parser->lexer_->lookup_identifier ("$defaultpaper"); - layout = layout ? layout : Output_def::unsmob (default_paper); + layout = layout ? layout : unsmob<Output_def> (default_paper); layout = layout ? dynamic_cast<Output_def *> (layout->clone ()) : new Output_def; layout->set_variable (ly_symbol2scm ("is-paper"), SCM_BOOL_T); diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc index e4f1e4c454..be20f25d98 100644 --- a/lily/line-spanner.cc +++ b/lily/line-spanner.cc @@ -56,7 +56,7 @@ Spanner *parent_spanner (Grob *g) SCM Line_spanner::calc_bound_info (SCM smob, Direction dir) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); Grob *commonx = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS); commonx = me->common_refpoint (commonx, X_AXIS); @@ -114,11 +114,11 @@ Line_spanner::calc_bound_info (SCM smob, Direction dir) ? Axis_group_interface::generic_bound_extent (bound_grob, commonx, X_AXIS) : robust_relative_extent (bound_grob, commonx, X_AXIS)).linear_combination (attach); - Grob *acc = Grob::unsmob (bound_grob->get_object ("accidental-grob")); + Grob *acc = unsmob<Grob> (bound_grob->get_object ("accidental-grob")); if (acc && to_boolean (ly_assoc_get (ly_symbol2scm ("end-on-accidental"), details, SCM_BOOL_F))) x_coord = robust_relative_extent (acc, commonx, X_AXIS).linear_combination (attach); - Grob *dot = Grob::unsmob (bound_grob->get_object ("dot")); + Grob *dot = unsmob<Grob> (bound_grob->get_object ("dot")); if (dot && to_boolean (ly_assoc_get (ly_symbol2scm ("start-at-dot"), details, SCM_BOOL_F))) x_coord = robust_relative_extent (dot, commonx, X_AXIS).linear_combination (attach); @@ -210,7 +210,7 @@ MAKE_SCHEME_CALLBACK (Line_spanner, calc_cross_staff, 1); SCM Line_spanner::calc_cross_staff (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); if (!me) return SCM_BOOL_F; @@ -241,7 +241,7 @@ SCM Line_spanner::calc_left_bound_info_and_text (SCM smob) { SCM alist = Line_spanner::calc_bound_info (smob, LEFT); - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); SCM text = me->get_property ("text"); if (Text_interface::is_markup (text) @@ -263,7 +263,7 @@ MAKE_SCHEME_CALLBACK (Line_spanner, print, 1); SCM Line_spanner::print (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); // Triggers simple-Y calculations bool simple_y = to_boolean (me->get_property ("simple-Y")) && !to_boolean (me->get_property ("cross-staff")); @@ -301,9 +301,9 @@ Line_spanner::print (SCM smob) bounds[d], SCM_BOOL_F), 0.0); arrows[d] = to_boolean (ly_assoc_get (ly_symbol2scm ("arrow"), bounds[d], SCM_BOOL_F)); - stencils[d] = Stencil::unsmob (ly_assoc_get (ly_symbol2scm ("stencil"), + stencils[d] = unsmob<Stencil> (ly_assoc_get (ly_symbol2scm ("stencil"), bounds[d], SCM_BOOL_F)); - common_y[d] = Grob::unsmob (ly_assoc_get (ly_symbol2scm ("common-Y"), + common_y[d] = unsmob<Grob> (ly_assoc_get (ly_symbol2scm ("common-Y"), bounds[d], SCM_BOOL_F)); if (!common_y[d]) common_y[d] = me; diff --git a/lily/lyric-combine-music-iterator.cc b/lily/lyric-combine-music-iterator.cc index d0b31c4963..e83d4e716c 100644 --- a/lily/lyric-combine-music-iterator.cc +++ b/lily/lyric-combine-music-iterator.cc @@ -96,7 +96,7 @@ Lyric_combine_music_iterator::Lyric_combine_music_iterator () void Lyric_combine_music_iterator::set_busy (SCM se) { - Stream_event *e = Stream_event::unsmob (se); + Stream_event *e = unsmob<Stream_event> (se); if ((e->in_event_class ("note-event") || e->in_event_class ("cluster-note-event")) && music_context_) @@ -191,8 +191,8 @@ Lyric_combine_music_iterator::derived_substitute (Context *f, Context *t) void Lyric_combine_music_iterator::construct_children () { - Music *m = Music::unsmob (get_music ()->get_property ("element")); - lyric_iter_ = Music_iterator::unsmob (get_iterator (m)); + Music *m = unsmob<Music> (get_music ()->get_property ("element")); + lyric_iter_ = unsmob<Music_iterator> (get_iterator (m)); if (!lyric_iter_) return; lyrics_context_ = find_context_below (lyric_iter_->get_outlet (), diff --git a/lily/lyric-combine-music.cc b/lily/lyric-combine-music.cc index 7611d75543..9cf603a3a4 100644 --- a/lily/lyric-combine-music.cc +++ b/lily/lyric-combine-music.cc @@ -29,7 +29,7 @@ MAKE_SCHEME_CALLBACK (Lyric_combine_music, length_callback, 1); SCM Lyric_combine_music::length_callback (SCM m) { - Music *me = Music::unsmob (m); - Music *melody = Music::unsmob (scm_car (me->get_property ("elements"))); + Music *me = unsmob<Music> (m); + Music *melody = unsmob<Music> (scm_car (me->get_property ("elements"))); return melody->get_length ().smobbed_copy (); } diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index 0d3ea00dee..58b8f6cdd2 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -95,7 +95,7 @@ get_voice_to_lyrics (Context *lyrics) bool searchForVoice = to_boolean (lyrics->get_property ("searchForVoice")); SCM avc = lyrics->get_property ("associatedVoiceContext"); - if (Context *c = Context::unsmob (avc)) + if (Context *c = unsmob<Context> (avc)) return c; SCM voice_name = lyrics->get_property ("associatedVoice"); @@ -145,8 +145,8 @@ get_current_note_head (Context *voice) for (SCM s = voice->get_property ("busyGrobs"); scm_is_pair (s); s = scm_cdr (s)) { - Grob *g = Grob::unsmob (scm_cdar (s));; - Moment *end_mom = Moment::unsmob (scm_caar (s)); + Grob *g = unsmob<Grob> (scm_cdar (s));; + Moment *end_mom = unsmob<Moment> (scm_caar (s)); if (!end_mom || !g) { programming_error ("busyGrobs invalid"); @@ -156,7 +156,7 @@ get_current_note_head (Context *voice) // It's a bit irritating that we just have the length and // duration of the Grob. Moment end_from_now = - get_event_length (Stream_event::unsmob (g->get_property ("cause")), now) + get_event_length (unsmob<Stream_event> (g->get_property ("cause")), now) + now; // We cannot actually include more than a single grace note // using busyGrobs on ungraced lyrics since a grob ending on diff --git a/lily/lyric-extender.cc b/lily/lyric-extender.cc index e6943fefa0..8afe2c5569 100644 --- a/lily/lyric-extender.cc +++ b/lily/lyric-extender.cc @@ -32,9 +32,9 @@ MAKE_SCHEME_CALLBACK (Lyric_extender, print, 1); SCM Lyric_extender::print (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); Item *left_edge = me->get_bound (LEFT); - Item *right_text = Item::unsmob (me->get_object ("next")); + Item *right_text = unsmob<Item> (me->get_object ("next")); Grob *common = left_edge; diff --git a/lily/lyric-hyphen.cc b/lily/lyric-hyphen.cc index b8afd7718c..029391f92f 100644 --- a/lily/lyric-hyphen.cc +++ b/lily/lyric-hyphen.cc @@ -35,7 +35,7 @@ MAKE_SCHEME_CALLBACK (Lyric_hyphen, print, 1); SCM Lyric_hyphen::print (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); Drul_array<Item *> bounds (me->get_bound (LEFT), me->get_bound (RIGHT)); @@ -115,7 +115,7 @@ MAKE_SCHEME_CALLBACK (Lyric_hyphen, set_spacing_rods, 1); SCM Lyric_hyphen::set_spacing_rods (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Rod r; Spanner *sp = dynamic_cast<Spanner *> (me); diff --git a/lily/measure-grouping-engraver.cc b/lily/measure-grouping-engraver.cc index 84da388861..e7fc3c6726 100644 --- a/lily/measure-grouping-engraver.cc +++ b/lily/measure-grouping-engraver.cc @@ -44,7 +44,7 @@ Measure_grouping_engraver::finalize () { if (grouping_) { - grouping_->set_bound (RIGHT, Grob::unsmob (get_property ("currentCommandColumn"))); + grouping_->set_bound (RIGHT, unsmob<Grob> (get_property ("currentCommandColumn"))); grouping_->suicide (); grouping_ = 0; } @@ -64,7 +64,7 @@ Measure_grouping_engraver::process_music () if (grouping_ && now.main_part_ >= stop_grouping_mom_ && !now.grace_part_) { grouping_->set_bound (RIGHT, - Grob::unsmob (get_property ("currentMusicalColumn"))); + unsmob<Grob> (get_property ("currentMusicalColumn"))); grouping_ = 0; } @@ -75,10 +75,10 @@ Measure_grouping_engraver::process_music () SCM grouping = get_property ("beatStructure"); if (scm_is_pair (grouping)) { - Moment *measpos = Moment::unsmob (get_property ("measurePosition")); + Moment *measpos = unsmob<Moment> (get_property ("measurePosition")); Rational mp = measpos->main_part_; - Moment *base_mom = Moment::unsmob (get_property ("baseMoment")); + Moment *base_mom = unsmob<Moment> (get_property ("baseMoment")); Rational base_moment = base_mom->main_part_; Rational where (0); @@ -97,7 +97,7 @@ Measure_grouping_engraver::process_music () if (grouplen > 1) { grouping_ = make_spanner ("MeasureGrouping", SCM_EOL); - grouping_->set_bound (LEFT, Grob::unsmob (get_property ("currentMusicalColumn"))); + grouping_->set_bound (LEFT, unsmob<Grob> (get_property ("currentMusicalColumn"))); stop_grouping_mom_ = now.main_part_ + Rational (grouplen - 1) * base_moment; get_global_context ()->add_moment_to_process (Moment (stop_grouping_mom_)); diff --git a/lily/measure-grouping-spanner.cc b/lily/measure-grouping-spanner.cc index a5cb9fd321..052aae12ac 100644 --- a/lily/measure-grouping-spanner.cc +++ b/lily/measure-grouping-spanner.cc @@ -29,7 +29,7 @@ MAKE_SCHEME_CALLBACK (Measure_grouping, print, 1); SCM Measure_grouping::print (SCM grob) { - Spanner *me = Spanner::unsmob (grob); + Spanner *me = unsmob<Spanner> (grob); SCM which = me->get_property ("style"); Real height = robust_scm2double (me->get_property ("height"), 1); diff --git a/lily/melody-spanner.cc b/lily/melody-spanner.cc index 9713b99999..3550e89382 100644 --- a/lily/melody-spanner.cc +++ b/lily/melody-spanner.cc @@ -34,8 +34,8 @@ MAKE_SCHEME_CALLBACK (Melody_spanner, calc_neutral_stem_direction, 1); SCM Melody_spanner::calc_neutral_stem_direction (SCM smob) { - Grob *stem = Grob::unsmob (smob); - Grob *me = Grob::unsmob (stem->get_object ("melody-spanner")); + Grob *stem = unsmob<Grob> (smob); + Grob *me = unsmob<Grob> (stem->get_object ("melody-spanner")); if (!me || !me->is_live ()) return scm_from_int (DOWN); diff --git a/lily/mensural-ligature-engraver.cc b/lily/mensural-ligature-engraver.cc index 7d4794434d..ac1eb1f10a 100644 --- a/lily/mensural-ligature-engraver.cc +++ b/lily/mensural-ligature-engraver.cc @@ -129,7 +129,7 @@ Mensural_ligature_engraver::transform_heads (vector<Grob_info> const &primitives continue; } - int pitch = Pitch::unsmob (nr->get_property ("pitch"))->steps (); + int pitch = unsmob<Pitch> (nr->get_property ("pitch"))->steps (); int prim = 0; if (at_beginning) @@ -182,7 +182,7 @@ Mensural_ligature_engraver::transform_heads (vector<Grob_info> const &primitives } // b. descendens longa or brevis else if (i < s - 1 - && (Pitch::unsmob (primitives[i + 1].event_cause () + && (unsmob<Pitch> (primitives[i + 1].event_cause () ->get_property ("pitch"))->steps () < pitch) && duration_log > -3) { @@ -275,7 +275,7 @@ Mensural_ligature_engraver::transform_heads (vector<Grob_info> const &primitives /* breve: check whether descending */ - int const next_pitch = Pitch::unsmob + int const next_pitch = unsmob<Pitch> (next_info.event_cause ()->get_property ("pitch"))->steps (); if (next_pitch < pitch) /* diff --git a/lily/mensural-ligature.cc b/lily/mensural-ligature.cc index 42f5270cc5..5a3b3e9543 100644 --- a/lily/mensural-ligature.cc +++ b/lily/mensural-ligature.cc @@ -270,7 +270,7 @@ MAKE_SCHEME_CALLBACK (Mensural_ligature, brew_ligature_primitive, 1); SCM Mensural_ligature::brew_ligature_primitive (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return internal_brew_primitive (me).smobbed_copy (); } diff --git a/lily/metronome-engraver.cc b/lily/metronome-engraver.cc index 279f8f721c..e1de3e23e0 100644 --- a/lily/metronome-engraver.cc +++ b/lily/metronome-engraver.cc @@ -138,9 +138,9 @@ Metronome_mark_engraver::stop_translation_timestep () first notational element of the measure if no time signature is present in that measure). */ - if (Grob *mc = Grob::unsmob (get_property ("currentMusicalColumn"))) + if (Grob *mc = unsmob<Grob> (get_property ("currentMusicalColumn"))) text_->set_parent (mc, X_AXIS); - else if (Grob *cc = Grob::unsmob (get_property ("currentCommandColumn"))) + else if (Grob *cc = unsmob<Grob> (get_property ("currentCommandColumn"))) text_->set_parent (cc, X_AXIS); } text_->set_object ("side-support-elements", diff --git a/lily/midi-control-function-performer.cc b/lily/midi-control-function-performer.cc index c35286c1eb..90ea063f73 100644 --- a/lily/midi-control-function-performer.cc +++ b/lily/midi-control-function-performer.cc @@ -73,7 +73,7 @@ Midi_control_function_performer::disconnect_from_context (Context *c) void Midi_control_function_performer::announce_function_value_change (SCM sev) { - Stream_event *ev = Stream_event::unsmob (sev); + Stream_event *ev = unsmob<Stream_event> (sev); SCM sym = ev->get_property ("symbol"); if (!scm_is_symbol (sym)) return; diff --git a/lily/moment-scheme.cc b/lily/moment-scheme.cc index 9f17543bdb..740b6ee2c9 100644 --- a/lily/moment-scheme.cc +++ b/lily/moment-scheme.cc @@ -78,8 +78,8 @@ LY_DEFINE (ly_moment_sub, "ly:moment-sub", LY_ASSERT_SMOB (Moment, a, 1); LY_ASSERT_SMOB (Moment, b, 2); - Moment *ma = Moment::unsmob (a); - Moment *mb = Moment::unsmob (b); + Moment *ma = unsmob<Moment> (a); + Moment *mb = unsmob<Moment> (b); return (*ma - *mb).smobbed_copy (); } @@ -91,8 +91,8 @@ LY_DEFINE (ly_moment_add, "ly:moment-add", LY_ASSERT_SMOB (Moment, a, 1); LY_ASSERT_SMOB (Moment, b, 2); - Moment *ma = Moment::unsmob (a); - Moment *mb = Moment::unsmob (b); + Moment *ma = unsmob<Moment> (a); + Moment *mb = unsmob<Moment> (b); return (*ma + *mb).smobbed_copy (); } @@ -104,8 +104,8 @@ LY_DEFINE (ly_moment_mul, "ly:moment-mul", LY_ASSERT_SMOB (Moment, a, 1); LY_ASSERT_SMOB (Moment, b, 2); - Moment *ma = Moment::unsmob (a); - Moment *mb = Moment::unsmob (b); + Moment *ma = unsmob<Moment> (a); + Moment *mb = unsmob<Moment> (b); return (*ma * * mb).smobbed_copy (); } @@ -116,8 +116,8 @@ LY_DEFINE (ly_moment_div, "ly:moment-div", LY_ASSERT_SMOB (Moment, a, 1); LY_ASSERT_SMOB (Moment, b, 2); - Moment *ma = Moment::unsmob (a); - Moment *mb = Moment::unsmob (b); + Moment *ma = unsmob<Moment> (a); + Moment *mb = unsmob<Moment> (b); return (*ma / * mb).smobbed_copy (); } @@ -129,8 +129,8 @@ LY_DEFINE (ly_moment_mod, "ly:moment-mod", LY_ASSERT_SMOB (Moment, a, 1); LY_ASSERT_SMOB (Moment, b, 2); - Moment *ma = Moment::unsmob (a); - Moment *mb = Moment::unsmob (b); + Moment *ma = unsmob<Moment> (a); + Moment *mb = unsmob<Moment> (b); return (*ma % * mb).smobbed_copy (); } @@ -140,7 +140,7 @@ LY_DEFINE (ly_moment_grace, "ly:moment-grace", { LY_ASSERT_SMOB (Moment, mom, 1); - return ly_rational2scm (Moment::unsmob (mom)->grace_part_); + return ly_rational2scm (unsmob<Moment> (mom)->grace_part_); } LY_DEFINE (ly_moment_grace_numerator, "ly:moment-grace-numerator", @@ -149,7 +149,7 @@ LY_DEFINE (ly_moment_grace_numerator, "ly:moment-grace-numerator", { LY_ASSERT_SMOB (Moment, mom, 1); - Moment *ma = Moment::unsmob (mom); + Moment *ma = unsmob<Moment> (mom); return scm_from_int64 (ma->grace_part_.numerator ()); } @@ -159,7 +159,7 @@ LY_DEFINE (ly_moment_grace_denominator, "ly:moment-grace-denominator", "Extract denominator from grace timing.") { LY_ASSERT_SMOB (Moment, mom, 1); - Moment *ma = Moment::unsmob (mom); + Moment *ma = unsmob<Moment> (mom); return scm_from_int64 (ma->grace_part_.denominator ()); } @@ -170,7 +170,7 @@ LY_DEFINE (ly_moment_main, "ly:moment-main", { LY_ASSERT_SMOB (Moment, mom, 1); - return ly_rational2scm (Moment::unsmob (mom)->main_part_); + return ly_rational2scm (unsmob<Moment> (mom)->main_part_); } LY_DEFINE (ly_moment_main_numerator, "ly:moment-main-numerator", @@ -178,7 +178,7 @@ LY_DEFINE (ly_moment_main_numerator, "ly:moment-main-numerator", "Extract numerator from main timing.") { LY_ASSERT_SMOB (Moment, mom, 1); - Moment *ma = Moment::unsmob (mom); + Moment *ma = unsmob<Moment> (mom); return scm_from_int64 (ma->main_part_.numerator ()); } @@ -188,7 +188,7 @@ LY_DEFINE (ly_moment_main_denominator, "ly:moment-main-denominator", "Extract denominator from main timing.") { LY_ASSERT_SMOB (Moment, mom, 1); - Moment *ma = Moment::unsmob (mom); + Moment *ma = unsmob<Moment> (mom); return scm_from_int64 (ma->main_part_.denominator ()); } @@ -200,8 +200,8 @@ LY_DEFINE (ly_moment_less_p, "ly:moment<?", LY_ASSERT_SMOB (Moment, a, 1); LY_ASSERT_SMOB (Moment, b, 2); - Moment *ma = Moment::unsmob (a); - Moment *mb = Moment::unsmob (b); + Moment *ma = unsmob<Moment> (a); + Moment *mb = unsmob<Moment> (b); return ly_bool2scm (*ma < *mb); } diff --git a/lily/moment.cc b/lily/moment.cc index 9f3e8ed383..6fbd55f498 100644 --- a/lily/moment.cc +++ b/lily/moment.cc @@ -71,8 +71,8 @@ Moment::as_scheme () const SCM Moment::equal_p (SCM a, SCM b) { - Moment *m1 = Moment::unsmob (a); - Moment *m2 = Moment::unsmob (b); + Moment *m1 = unsmob<Moment> (a); + Moment *m2 = unsmob<Moment> (b); return (*m1 == *m2) ? SCM_BOOL_T : SCM_BOOL_F; } @@ -186,7 +186,7 @@ operator << (ostream &os, Moment const &m) Moment robust_scm2moment (SCM m, Moment d) { - Moment *p = Moment::unsmob (m); + Moment *p = unsmob<Moment> (m); if (!p) return d; else @@ -196,5 +196,5 @@ robust_scm2moment (SCM m, Moment d) bool moment_less (SCM a, SCM b) { - return *Moment::unsmob (a) < *Moment::unsmob (b); + return *unsmob<Moment> (a) < *unsmob<Moment> (b); } diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc index 045359f7e9..30f3435d99 100644 --- a/lily/multi-measure-rest-engraver.cc +++ b/lily/multi-measure-rest-engraver.cc @@ -167,7 +167,7 @@ Multi_measure_rest_engraver::stop_translation_timestep () -- jneem */ if (bar_seen_) { - Grob *cmc = Grob::unsmob (get_property ("currentCommandColumn")); + Grob *cmc = unsmob<Grob> (get_property ("currentCommandColumn")); /* Ugh, this is a kludge - need this for multi-measure-rest-grace.ly */ last_command_item_ = dynamic_cast<Item *> (cmc); diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index 0321082a57..7f2a720d6f 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -62,7 +62,7 @@ MAKE_SCHEME_CALLBACK (Multi_measure_rest, percent, 1); SCM Multi_measure_rest::percent (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Spanner *sp = dynamic_cast<Spanner *> (me); Stencil r = Percent_repeat_item_interface::x_percent (me, 1); @@ -96,7 +96,7 @@ MAKE_SCHEME_CALLBACK (Multi_measure_rest, print, 1); SCM Multi_measure_rest::print (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Spanner *sp = dynamic_cast<Spanner *> (me); Interval sp_iv = bar_width (sp); @@ -120,7 +120,7 @@ MAKE_SCHEME_CALLBACK (Multi_measure_rest, height, 1); SCM Multi_measure_rest::height (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Real space = 1000000; // something very large... @@ -189,7 +189,7 @@ calc_measure_duration_log (Grob *me) { SCM sml = dynamic_cast<Spanner *> (me)->get_bound (LEFT) ->get_property ("measure-length"); - Rational ml = (Moment::is_smob (sml)) ? Moment::unsmob (sml)->main_part_ + Rational ml = (unsmob<Moment> (sml)) ? unsmob<Moment> (sml)->main_part_ : Rational (1); double measure_duration = ml.Rational::to_double (); bool force_round_up = to_boolean (scm_list_p (scm_member (scm_cons (scm_from_int64 (ml.numerator ()), @@ -326,7 +326,7 @@ Multi_measure_rest::church_rest (Grob *me, Font_metric *musfont, int measure_cou Stencil mol; for (SCM s = mols; scm_is_pair (s); s = scm_cdr (s)) - mol.add_at_edge (X_AXIS, LEFT, *Stencil::unsmob (scm_car (s)), + mol.add_at_edge (X_AXIS, LEFT, *unsmob<Stencil> (scm_car (s)), inner_padding); mol.align_to (X_AXIS, LEFT); mol.translate_axis (outer_padding_factor * inner_padding, X_AXIS); @@ -355,9 +355,9 @@ Multi_measure_rest::calculate_spacing_rods (Grob *me, Real length) Item *lb = li->find_prebroken_piece (RIGHT); Item *rb = ri->find_prebroken_piece (LEFT); - Grob *spacing = Grob::unsmob (li->get_object ("spacing")); + Grob *spacing = unsmob<Grob> (li->get_object ("spacing")); if (!spacing) - spacing = Grob::unsmob (ri->get_object ("spacing")); + spacing = unsmob<Grob> (ri->get_object ("spacing")); if (spacing) { Spacing_options options; @@ -402,7 +402,7 @@ MAKE_SCHEME_CALLBACK (Multi_measure_rest, set_spacing_rods, 1); SCM Multi_measure_rest::set_spacing_rods (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Real sym_width = symbol_stencil (me, 0.0).extent (X_AXIS).length (); calculate_spacing_rods (me, sym_width); @@ -413,7 +413,7 @@ MAKE_SCHEME_CALLBACK (Multi_measure_rest, set_text_rods, 1); SCM Multi_measure_rest::set_text_rods (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Stencil *stil = me->get_stencil (); /* FIXME uncached */ diff --git a/lily/music-function-scheme.cc b/lily/music-function-scheme.cc index 3afb1099f0..5246b6dbe6 100644 --- a/lily/music-function-scheme.cc +++ b/lily/music-function-scheme.cc @@ -6,7 +6,7 @@ LY_DEFINE (ly_music_function_extract, "ly:music-function-extract", 1, 0, 0, { LY_ASSERT_SMOB (Music_function, x, 1); - return Music_function::unsmob (x)->get_function (); + return unsmob<Music_function> (x)->get_function (); } LY_DEFINE (ly_music_function_signature, "ly:music-function-signature", 1, 0, 0, @@ -15,7 +15,7 @@ LY_DEFINE (ly_music_function_signature, "ly:music-function-signature", 1, 0, 0, { LY_ASSERT_SMOB (Music_function, x, 1); - return Music_function::unsmob (x)->get_signature (); + return unsmob<Music_function> (x)->get_signature (); } LY_DEFINE (ly_make_music_function, "ly:make-music-function", 2, 0, 0, diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc index dabcccfb25..a9098bcba3 100644 --- a/lily/music-iterator.cc +++ b/lily/music-iterator.cc @@ -85,7 +85,7 @@ Music_iterator::get_static_get_iterator (Music *m) if (ly_is_procedure (ctor)) { iter = scm_call_0 (ctor); - p = Music_iterator::unsmob (iter); + p = unsmob<Music_iterator> (iter); } else { @@ -149,7 +149,7 @@ SCM Music_iterator::get_iterator (Music *m) const { SCM ip = get_static_get_iterator (m); - Music_iterator *p = Music_iterator::unsmob (ip); + Music_iterator *p = unsmob<Music_iterator> (ip); p->init_context (m, get_outlet ()); diff --git a/lily/music-scheme.cc b/lily/music-scheme.cc index 64866c75c7..16959dbfb3 100644 --- a/lily/music-scheme.cc +++ b/lily/music-scheme.cc @@ -29,7 +29,7 @@ LY_DEFINE (ly_music_length, "ly:music-length", " it as a @code{Moment} object.") { LY_ASSERT_SMOB (Music, mus, 1); - Music *sc = Music::unsmob (mus); + Music *sc = unsmob<Music> (mus); return sc->get_length ().smobbed_copy (); } @@ -71,14 +71,14 @@ LY_DEFINE (ly_music_p, "ly:music?", 1, 0, 0, (SCM obj), "Is @var{obj} a music object?") { - return ly_bool2scm (Music::is_smob (obj)); + return ly_bool2scm (unsmob<Music> (obj)); } LY_DEFINE (ly_event_p, "ly:event?", 1, 0, 0, (SCM obj), "Is @var{obj} a proper (non-rhythmic) event object?") { - if (Music *m = Music::unsmob (obj)) + if (Music *m = unsmob<Music> (obj)) { return scm_from_bool (m->is_mus_type ("post-event")); } @@ -93,7 +93,7 @@ LY_DEFINE (ly_music_mutable_properties, "ly:music-mutable-properties", " constant and initialized by the @code{make-music} function.") { LY_ASSERT_SMOB (Music, mus, 1); - Music *m = Music::unsmob (mus); + Music *m = unsmob<Music> (mus); return m->get_property_alist (true); } @@ -106,7 +106,7 @@ LY_DEFINE (ly_music_list_p, "ly:music-list?", while (scm_is_pair (lst)) { - if (!Music::is_smob (scm_car (lst))) + if (!unsmob<Music> (scm_car (lst))) return SCM_BOOL_F; lst = scm_cdr (lst); } @@ -120,8 +120,8 @@ LY_DEFINE (ly_music_deep_copy, "ly:music-deep-copy", " @var{m} may be an arbitrary type; cons cells and music" " are copied recursively.") { - if (Music::is_smob (m)) - return Music::unsmob (m)->clone ()->unprotect (); + if (unsmob<Music> (m)) + return unsmob<Music> (m)->clone ()->unprotect (); if (scm_is_pair (m)) { SCM copy = SCM_EOL; @@ -150,8 +150,8 @@ LY_DEFINE (ly_music_transpose, "ly:music-transpose", LY_ASSERT_SMOB (Music, m, 1); LY_ASSERT_SMOB (Pitch, p, 2); - Music *sc = Music::unsmob (m); - Pitch *sp = Pitch::unsmob (p); + Music *sc = unsmob<Music> (m); + Pitch *sp = unsmob<Pitch> (p); sc->transpose (*sp); // SCM_UNDEFINED ? @@ -168,8 +168,8 @@ LY_DEFINE (ly_music_compress, "ly:music-compress", LY_ASSERT_SMOB (Music, m, 1); LY_ASSERT_SMOB (Moment, factor, 2); - Music *sc = Music::unsmob (m); - sc->compress (*Moment::unsmob (factor)); + Music *sc = unsmob<Music> (m); + sc->compress (*unsmob<Moment> (factor)); return sc->self_scm (); } @@ -181,8 +181,8 @@ LY_DEFINE (ly_make_music_relative_x, "ly:make-music-relative!", LY_ASSERT_SMOB (Music, music, 1); LY_ASSERT_SMOB (Pitch, pitch, 2); - Pitch start = *Pitch::unsmob (pitch); - Music *m = Music::unsmob (music); + Pitch start = *unsmob<Pitch> (pitch); + Music *m = unsmob<Music> (music); Pitch last = m->to_relative_octave (start); return last.smobbed_copy (); @@ -194,9 +194,9 @@ LY_DEFINE (ly_music_duration_length, "ly:music-duration-length", 1, 0, 0, " length.") { LY_ASSERT_SMOB (Music, mus, 1); - Music *m = Music::unsmob (mus); + Music *m = unsmob<Music> (mus); - Duration *d = Duration::unsmob (m->get_property ("duration")); + Duration *d = unsmob<Duration> (m->get_property ("duration")); Moment len; if (d) @@ -214,10 +214,10 @@ LY_DEFINE (ly_music_duration_compress, "ly:music-duration-compress", 2, 0, 0, LY_ASSERT_SMOB (Music, mus, 1); LY_ASSERT_SMOB (Moment, fact, 2); - Music *m = Music::unsmob (mus); - Moment *f = Moment::unsmob (fact); + Music *m = unsmob<Music> (mus); + Moment *f = unsmob<Moment> (fact); - Duration *d = Duration::unsmob (m->get_property ("duration")); + Duration *d = unsmob<Duration> (m->get_property ("duration")); if (d) m->set_property ("duration", d->compressed (f->main_part_).smobbed_copy ()); return SCM_UNSPECIFIED; @@ -236,7 +236,7 @@ LY_DEFINE (ly_transpose_key_alist, "ly:transpose-key-alist", " pitch @var{pit}.") { SCM newlist = SCM_EOL; - Pitch *p = Pitch::unsmob (pit); + Pitch *p = unsmob<Pitch> (pit); for (SCM s = l; scm_is_pair (s); s = scm_cdr (s)) { diff --git a/lily/music-sequence.cc b/lily/music-sequence.cc index 38c384ab05..d280953714 100644 --- a/lily/music-sequence.cc +++ b/lily/music-sequence.cc @@ -30,7 +30,7 @@ void transpose_music_list (SCM lst, Pitch rq) { for (SCM s = lst; scm_is_pair (s); s = scm_cdr (s)) - Music::unsmob (scm_car (s))->transpose (rq); + unsmob<Music> (scm_car (s))->transpose (rq); } Moment @@ -41,7 +41,7 @@ Music_sequence::cumulative_length (SCM l) for (SCM s = l; scm_is_pair (s); s = scm_cdr (s)) { - Moment l = Music::unsmob (scm_car (s))->get_length (); + Moment l = unsmob<Music> (scm_car (s))->get_length (); if (last_len.grace_part_ && l.main_part_) last_len.grace_part_ = Rational (0); cumulative += last_len; @@ -60,7 +60,7 @@ Music_sequence::maximum_length (SCM l) Moment dur = 0; for (SCM s = l; scm_is_pair (s); s = scm_cdr (s)) { - Music *m = Music::unsmob (scm_car (s)); + Music *m = unsmob<Music> (scm_car (s)); if (!m) programming_error ("Music sequence should have music elements"); else @@ -77,7 +77,7 @@ MAKE_SCHEME_CALLBACK (Music_sequence, maximum_length_callback, 1); SCM Music_sequence::maximum_length_callback (SCM m) { - Music *me = Music::unsmob (m); + Music *me = unsmob<Music> (m); return maximum_length (me->get_property ("elements")).smobbed_copy (); } @@ -85,8 +85,8 @@ MAKE_SCHEME_CALLBACK (Music_sequence, event_chord_length_callback, 1); SCM Music_sequence::event_chord_length_callback (SCM m) { - Music *me = Music::unsmob (m); - Duration *d = Duration::unsmob (me->get_property ("duration")); + Music *me = unsmob<Music> (m); + Duration *d = unsmob<Duration> (me->get_property ("duration")); // Preset duration is used in chord repetitions. if (d) { @@ -100,7 +100,7 @@ MAKE_SCHEME_CALLBACK (Music_sequence, cumulative_length_callback, 1); SCM Music_sequence::cumulative_length_callback (SCM m) { - Music *me = Music::unsmob (m); + Music *me = unsmob<Music> (m); return cumulative_length (me->get_property ("elements")).smobbed_copy (); } @@ -108,7 +108,7 @@ MAKE_SCHEME_CALLBACK (Music_sequence, minimum_start_callback, 1); SCM Music_sequence::minimum_start_callback (SCM m) { - Music *me = Music::unsmob (m); + Music *me = unsmob<Music> (m); return minimum_start (me->get_property ("elements")).smobbed_copy (); } @@ -116,7 +116,7 @@ MAKE_SCHEME_CALLBACK (Music_sequence, first_start_callback, 1); SCM Music_sequence::first_start_callback (SCM m) { - Music *me = Music::unsmob (m); + Music *me = unsmob<Music> (m); return first_start (me->get_property ("elements")).smobbed_copy (); } @@ -129,7 +129,7 @@ music_list_to_relative (SCM l, Pitch p, bool ret_first) Pitch last = p; for (SCM s = l; scm_is_pair (s); s = scm_cdr (s)) { - if (Music *m = Music::unsmob (scm_car (s))) + if (Music *m = unsmob<Music> (scm_car (s))) { last = m->to_relative_octave (last); if (!count++) @@ -144,7 +144,7 @@ void compress_music_list (SCM l, Moment m) { for (SCM s = l; scm_is_pair (s); s = scm_cdr (s)) - Music::unsmob (scm_car (s))->compress (m); + unsmob<Music> (scm_car (s))->compress (m); } Moment @@ -153,7 +153,7 @@ Music_sequence::minimum_start (SCM l) Moment m; for (SCM s = l; scm_is_pair (s); s = scm_cdr (s)) - m = min (m, Music::unsmob (scm_car (s))->start_mom ()); + m = min (m, unsmob<Music> (scm_car (s))->start_mom ()); return m; } @@ -163,7 +163,7 @@ Music_sequence::first_start (SCM l) for (SCM s = l; scm_is_pair (s); s = scm_cdr (s)) { - Music *mus = Music::unsmob (scm_car (s)); + Music *mus = unsmob<Music> (scm_car (s)); Moment start = mus->start_mom (); if (mus->get_length ().to_bool () || start.to_bool ()) return start; @@ -175,8 +175,8 @@ MAKE_SCHEME_CALLBACK (Music_sequence, simultaneous_relative_callback, 2); SCM Music_sequence::simultaneous_relative_callback (SCM music, SCM pitch) { - Music *me = Music::unsmob (music); - Pitch p = *Pitch::unsmob (pitch); + Music *me = unsmob<Music> (music); + Pitch p = *unsmob<Pitch> (pitch); return music_list_to_relative (me->get_property ("elements"), p, false).smobbed_copy (); } @@ -185,8 +185,8 @@ MAKE_SCHEME_CALLBACK (Music_sequence, event_chord_relative_callback, 2); SCM Music_sequence::event_chord_relative_callback (SCM music, SCM pitch) { - Music *me = Music::unsmob (music); - Pitch p = *Pitch::unsmob (pitch); + Music *me = unsmob<Music> (music); + Pitch p = *unsmob<Pitch> (pitch); return music_list_to_relative (me->get_property ("elements"), p, true).smobbed_copy (); } diff --git a/lily/music-wrapper-iterator.cc b/lily/music-wrapper-iterator.cc index cf0ee67a97..009f64f237 100644 --- a/lily/music-wrapper-iterator.cc +++ b/lily/music-wrapper-iterator.cc @@ -51,9 +51,9 @@ void Music_wrapper_iterator::construct_children () { Music *my_music = get_music (); - Music *child = Music::unsmob (my_music->get_property ("element")); + Music *child = unsmob<Music> (my_music->get_property ("element")); child_iter_ = (child) - ? Music_iterator::unsmob (get_iterator (child)) + ? unsmob<Music_iterator> (get_iterator (child)) : 0; } diff --git a/lily/music-wrapper.cc b/lily/music-wrapper.cc index f3feee8449..adf510c2f8 100644 --- a/lily/music-wrapper.cc +++ b/lily/music-wrapper.cc @@ -25,8 +25,8 @@ MAKE_SCHEME_CALLBACK (Music_wrapper, start_callback, 1); SCM Music_wrapper::start_callback (SCM m) { - Music *me = Music::unsmob (m); - Music *elt = Music::unsmob (me->get_property ("element")); + Music *me = unsmob<Music> (m); + Music *elt = unsmob<Music> (me->get_property ("element")); if (elt) return elt->start_mom ().smobbed_copy (); else @@ -37,8 +37,8 @@ MAKE_SCHEME_CALLBACK (Music_wrapper, length_callback, 1); SCM Music_wrapper::length_callback (SCM m) { - Music *me = Music::unsmob (m); - Music *elt = Music::unsmob (me->get_property ("element")); + Music *me = unsmob<Music> (m); + Music *elt = unsmob<Music> (me->get_property ("element")); if (elt) return elt->get_length ().smobbed_copy (); else diff --git a/lily/music.cc b/lily/music.cc index 6d8c9a281e..613b5387ff 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -90,13 +90,13 @@ Moment Music::get_length () const { SCM lst = get_property ("length"); - if (Moment::is_smob (lst)) - return *Moment::unsmob (lst); + if (unsmob<Moment> (lst)) + return *unsmob<Moment> (lst); if (ly_is_procedure (length_callback_)) { SCM res = scm_call_1 (length_callback_, self_scm ()); - return *Moment::unsmob (res); + return *unsmob<Moment> (res); } return Moment (0); @@ -109,7 +109,7 @@ Music::start_mom () const if (ly_is_procedure (lst)) { SCM res = scm_call_1 (lst, self_scm ()); - return *Moment::unsmob (res); + return *unsmob<Moment> (res); } Moment m; @@ -133,7 +133,7 @@ Pitch Music::generic_to_relative_octave (Pitch last) { SCM elt = get_property ("element"); - Pitch *old_pit = Pitch::unsmob (get_property ("pitch")); + Pitch *old_pit = unsmob<Pitch> (get_property ("pitch")); if (old_pit) { Pitch new_pit = *old_pit; @@ -157,7 +157,7 @@ Music::generic_to_relative_octave (Pitch last) last = new_pit; } - if (Music *m = Music::unsmob (elt)) + if (Music *m = unsmob<Music> (elt)) last = m->to_relative_octave (last); (void) music_list_to_relative (get_property ("articulations"), last, true); @@ -171,7 +171,7 @@ Music::to_relative_octave (Pitch last) SCM callback = get_property ("to-relative-callback"); if (ly_is_procedure (callback)) { - Pitch *p = Pitch::unsmob (scm_call_2 (callback, self_scm (), + Pitch *p = unsmob<Pitch> (scm_call_2 (callback, self_scm (), last.smobbed_copy ())); return *p; } @@ -184,11 +184,11 @@ Music::compress (Moment factor) { SCM elt = get_property ("element"); - if (Music *m = Music::unsmob (elt)) + if (Music *m = unsmob<Music> (elt)) m->compress (factor); compress_music_list (get_property ("elements"), factor); - Duration *d = Duration::unsmob (get_property ("duration")); + Duration *d = unsmob<Duration> (get_property ("duration")); if (d) set_property ("duration", d->compressed (factor.main_part_).smobbed_copy ()); @@ -207,7 +207,7 @@ transpose_mutable (SCM alist, Pitch delta) SCM val = scm_cdr (entry); SCM new_val = val; - if (Pitch *p = Pitch::unsmob (val)) + if (Pitch *p = unsmob<Pitch> (val)) { Pitch transposed = p->transposed (delta); @@ -219,7 +219,7 @@ transpose_mutable (SCM alist, Pitch delta) } else if (scm_is_eq (prop, ly_symbol2scm ("element"))) { - if (Music *m = Music::unsmob (val)) + if (Music *m = unsmob<Music> (val)) m->transpose (delta); } else if (scm_is_eq (prop, ly_symbol2scm ("elements")) @@ -252,7 +252,7 @@ Music::set_spot (Input ip) Input * Music::origin () const { - Input *ip = Input::unsmob (get_property ("origin")); + Input *ip = unsmob<Input> (get_property ("origin")); return ip ? ip : &dummy_input_global; } @@ -282,7 +282,7 @@ Music::to_event () const SCM art_ev = SCM_EOL; for (; scm_is_pair (art_mus); art_mus = scm_cdr (art_mus)) { - Music *m = Music::unsmob (scm_car (art_mus)); + Music *m = unsmob<Music> (scm_car (art_mus)); art_ev = scm_cons (m->to_event ()->unprotect (), art_ev); } e->set_property ("articulations", scm_reverse_x (art_ev, SCM_EOL)); @@ -312,7 +312,7 @@ make_music_by_name (SCM sym) SCM rv = scm_call_1 (make_music_proc, sym); /* UGH. */ - Music *m = Music::unsmob (rv); + Music *m = unsmob<Music> (rv); m->protect (); return m; } @@ -321,8 +321,8 @@ MAKE_SCHEME_CALLBACK (Music, duration_length_callback, 1); SCM Music::duration_length_callback (SCM m) { - Music *me = Music::unsmob (m); - Duration *d = Duration::unsmob (me->get_property ("duration")); + Music *me = unsmob<Music> (m); + Duration *d = unsmob<Duration> (me->get_property ("duration")); Moment mom; if (d) diff --git a/lily/new-fingering-engraver.cc b/lily/new-fingering-engraver.cc index bcb7766a4c..3ecad3a89e 100644 --- a/lily/new-fingering-engraver.cc +++ b/lily/new-fingering-engraver.cc @@ -99,7 +99,7 @@ New_fingering_engraver::acknowledge_rhythmic_head (Grob_info inf) for (SCM s = arts; scm_is_pair (s); s = scm_cdr (s)) { - Stream_event *ev = Stream_event::unsmob (scm_car (s)); + Stream_event *ev = unsmob<Stream_event> (scm_car (s)); if (!ev) continue; @@ -132,7 +132,7 @@ New_fingering_engraver::acknowledge_rhythmic_head (Grob_info inf) else if (ev->in_event_class ("harmonic-event")) { inf.grob ()->set_property ("style", ly_symbol2scm ("harmonic")); - Grob *d = Grob::unsmob (inf.grob ()->get_object ("dot")); + Grob *d = unsmob<Grob> (inf.grob ()->get_object ("dot")); if (d && !to_boolean (get_property ("harmonicDots"))) d->suicide (); } @@ -197,7 +197,7 @@ New_fingering_engraver::position_scripts (SCM orientations, if (stem_) { Side_position_interface::add_support (scripts->at (i).script_, stem_); - if (Grob *flag = Grob::unsmob (stem_->get_object ("flag"))) + if (Grob *flag = unsmob<Grob> (stem_->get_object ("flag"))) Side_position_interface::add_support (scripts->at (i).script_, flag); } @@ -281,12 +281,12 @@ New_fingering_engraver::position_scripts (SCM orientations, f->set_parent (ft.head_, Y_AXIS); f->set_property ("avoid-slur", ly_symbol2scm ("inside")); if (hordir == LEFT - && Grob::is_smob (ft.head_->get_object ("accidental-grob"))) + && unsmob<Grob> (ft.head_->get_object ("accidental-grob"))) Side_position_interface::add_support (f, - Grob::unsmob (ft.head_->get_object ("accidental-grob"))); - else if (Grob::is_smob (ft.head_->get_object ("dot"))) + unsmob<Grob> (ft.head_->get_object ("accidental-grob"))); + else if (unsmob<Grob> (ft.head_->get_object ("dot"))) Side_position_interface::add_support (f, - Grob::unsmob (ft.head_->get_object ("dot"))); + unsmob<Grob> (ft.head_->get_object ("dot"))); Self_alignment_interface::set_aligned_on_parent (f, Y_AXIS); Side_position_interface::set_axis (f, X_AXIS); diff --git a/lily/note-collision.cc b/lily/note-collision.cc index 6f205e3f22..a9564951f3 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -266,7 +266,7 @@ check_meshing_chords (Grob *me, if (dot_wipe_head) { - if (Grob *d = Grob::unsmob (dot_wipe_head->get_object ("dot"))) + if (Grob *d = unsmob<Grob> (dot_wipe_head->get_object ("dot"))) d->suicide (); } @@ -307,18 +307,18 @@ check_meshing_chords (Grob *me, if (shift_amount < -1e-6 && Rhythmic_head::dot_count (head_up)) { - Grob *d = Grob::unsmob (head_up->get_object ("dot")); + Grob *d = unsmob<Grob> (head_up->get_object ("dot")); Grob *parent = d->get_parent (X_AXIS); if (Dot_column::has_interface (parent)) Side_position_interface::add_support (parent, head_down); } else if (Rhythmic_head::dot_count (head_down)) { - Grob *d = Grob::unsmob (head_down->get_object ("dot")); + Grob *d = unsmob<Grob> (head_down->get_object ("dot")); Grob *parent = d->get_parent (X_AXIS); if (Dot_column::has_interface (parent)) { - Grob *stem = Grob::unsmob (head_up->get_object ("stem")); + Grob *stem = unsmob<Grob> (head_up->get_object ("stem")); // Loop over all heads on an up-pointing-stem to see if dots // need to clear any heads suspended on its right side. extract_grob_set (stem, "note-heads", heads); @@ -331,12 +331,12 @@ check_meshing_chords (Grob *me, if (shift_amount > 1e-6 && Rhythmic_head::dot_count (head_down)) { - Grob *dot_down = Grob::unsmob (head_down->get_object ("dot")); + Grob *dot_down = unsmob<Grob> (head_down->get_object ("dot")); Grob *col_down = dot_down->get_parent (X_AXIS); Direction dir = UP; if (Rhythmic_head::dot_count (head_up)) { - Grob *dot_up = Grob::unsmob (head_up->get_object ("dot")); + Grob *dot_up = unsmob<Grob> (head_up->get_object ("dot")); Grob *col_up = dot_up->get_parent (X_AXIS); if (col_up == col_down) // let the common DotColumn arrange dots dir = CENTER; @@ -345,10 +345,10 @@ check_meshing_chords (Grob *me, } if (dir != CENTER) { - Grob *stem = Grob::unsmob (head_down->get_object ("stem")); + Grob *stem = unsmob<Grob> (head_down->get_object ("stem")); extract_grob_set (stem, "note-heads", heads); for (vsize i = 0; i < heads.size (); i++) - if (Grob *dot = Grob::unsmob (heads[i]->get_object ("dot"))) + if (Grob *dot = unsmob<Grob> (heads[i]->get_object ("dot"))) dot->set_property ("direction", scm_from_int (dir)); } } @@ -360,7 +360,7 @@ MAKE_SCHEME_CALLBACK (Note_collision_interface, calc_positioning_done, 1) SCM Note_collision_interface::calc_positioning_done (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); me->set_property ("positioning-done", SCM_BOOL_T); Drul_array<vector<Grob *> > clash_groups = get_clash_groups (me); @@ -397,7 +397,7 @@ Note_collision_interface::calc_positioning_done (SCM smob) vector<Real> amounts; for (; scm_is_pair (hand); hand = scm_cdr (hand)) { - Grob *s = Grob::unsmob (scm_caar (hand)); + Grob *s = unsmob<Grob> (scm_caar (hand)); Real amount = scm_to_double (scm_cdar (hand)) * wid; done.push_back (s); @@ -407,7 +407,7 @@ Note_collision_interface::calc_positioning_done (SCM smob) } for (; scm_is_pair (autos); autos = scm_cdr (autos)) { - Grob *s = Grob::unsmob (scm_caar (autos)); + Grob *s = unsmob<Grob> (scm_caar (autos)); Real amount = scm_to_double (scm_cdar (autos)) * wid; vsize x = find (done, s) - done.begin (); @@ -589,7 +589,7 @@ Note_collision_interface::note_head_positions (Grob *me) vector<int> out; extract_grob_set (me, "elements", elts); for (vsize i = 0; i < elts.size (); i++) - if (Grob *stem = Grob::unsmob (elts[i]->get_object ("stem"))) + if (Grob *stem = unsmob<Grob> (elts[i]->get_object ("stem"))) { vector<int> nhp = Stem::note_head_positions (stem); out.insert (out.end (), nhp.begin (), nhp.end ()); diff --git a/lily/note-column-scheme.cc b/lily/note-column-scheme.cc index d9eee204ca..c665b70548 100644 --- a/lily/note-column-scheme.cc +++ b/lily/note-column-scheme.cc @@ -26,7 +26,7 @@ LY_DEFINE (ly_note_column_accidentals, "ly:note-column-accidentals", "Return the @code{AccidentalPlacement} grob from @var{note-column}" " if any, or @code{SCM_EOL} otherwise.") { - Grob *grob = Grob::unsmob (note_column); + Grob *grob = unsmob<Grob> (note_column); LY_ASSERT_SMOB (Grob, note_column, 1); Grob *acc = Note_column::accidentals (grob); if (acc) @@ -39,7 +39,7 @@ LY_DEFINE (ly_note_column_dot_column, "ly:note-column-dot-column", "Return the @code{DotColumn} grob from @var{note-column}" " if any, or @code{SCM_EOL} otherwise.") { - Grob *grob = Grob::unsmob (note_column); + Grob *grob = unsmob<Grob> (note_column); LY_ASSERT_SMOB (Grob, note_column, 1); Grob *dot_column = Note_column::dot_column (grob); if (dot_column) diff --git a/lily/note-column.cc b/lily/note-column.cc index 91a7690697..f5b6f35e90 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -43,7 +43,7 @@ using namespace std; bool Note_column::has_rests (Grob *me) { - return Grob::is_smob (me->get_object ("rest")); + return unsmob<Grob> (me->get_object ("rest")); } bool @@ -61,7 +61,7 @@ Item * Note_column::get_stem (Grob *me) { SCM s = me->get_object ("stem"); - return Item::unsmob (s); + return unsmob<Item> (s); } Item * @@ -71,7 +71,7 @@ Note_column::get_flag (Grob *me) if (stem) { SCM s = stem->get_object ("flag"); - return Item::unsmob (s); + return unsmob<Item> (s); } return 0; } @@ -97,7 +97,7 @@ Note_column::head_positions_interval (Grob *me) Direction Note_column::dir (Grob *me) { - Grob *stem = Grob::unsmob (me->get_object ("stem")); + Grob *stem = unsmob<Grob> (me->get_object ("stem")); if (stem && Stem::has_interface (stem)) return get_grob_direction (stem); else @@ -124,7 +124,7 @@ Note_column::set_stem (Grob *me, Grob *stem) Grob * Note_column::get_rest (Grob *me) { - return Grob::unsmob (me->get_object ("rest")); + return unsmob<Grob> (me->get_object ("rest")); } void @@ -141,7 +141,7 @@ Note_column::add_head (Grob *me, Grob *h) } else if (Note_head::has_interface (h)) { - if (Grob::is_smob (me->get_object ("rest"))) + if (unsmob<Grob> (me->get_object ("rest"))) both = true; Pointer_group_interface::add_grob (me, ly_symbol2scm ("note-heads"), h); } @@ -179,7 +179,7 @@ Note_column::calc_main_extent (Grob *me) } Grob *main_item = main_head ? main_head - : Grob::unsmob (me->get_object ("rest")); + : unsmob<Grob> (me->get_object ("rest")); return main_item ? main_item->extent (me, X_AXIS) @@ -197,7 +197,7 @@ Note_column::accidentals (Grob *me) for (vsize i = 0; i < heads.size (); i++) { Grob *h = heads[i]; - acc = h ? Grob::unsmob (h->get_object ("accidental-grob")) : 0; + acc = h ? unsmob<Grob> (h->get_object ("accidental-grob")) : 0; if (acc) break; } @@ -218,7 +218,7 @@ Note_column::dot_column (Grob *me) extract_grob_set (me, "note-heads", heads); for (vsize i = 0; i < heads.size (); i++) { - Grob *dots = Grob::unsmob (heads[i]->get_object ("dot")); + Grob *dots = unsmob<Grob> (heads[i]->get_object ("dot")); if (dots) return dots->get_parent (X_AXIS); } diff --git a/lily/note-head-scheme.cc b/lily/note-head-scheme.cc index fa0e58dcc6..c87aab64be 100644 --- a/lily/note-head-scheme.cc +++ b/lily/note-head-scheme.cc @@ -27,7 +27,7 @@ LY_DEFINE (ly_note_head__stem_attachment, "ly:note-head::stem-attachment", " notehead @var{glyph-name}.") { LY_ASSERT_SMOB (Font_metric, font_metric, 1); - Font_metric *fm = Font_metric::unsmob (font_metric); + Font_metric *fm = unsmob<Font_metric> (font_metric); LY_ASSERT_TYPE (scm_is_string, glyph_name, 2); return ly_offset2scm (Note_head::get_stem_attachment (fm, ly_scm2string (glyph_name))); diff --git a/lily/note-head.cc b/lily/note-head.cc index 3c6dc82763..33bbf339ca 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -51,7 +51,7 @@ internal_print (Grob *me, string *font_char) Stencil out = fm->find_by_name (idx_either + suffix); if (out.is_empty ()) { - Grob *stem = Grob::unsmob (me->get_object ("stem")); + Grob *stem = unsmob<Grob> (me->get_object ("stem")); Direction stem_dir = stem ? get_grob_direction (stem) : CENTER; if (stem_dir == CENTER) @@ -83,8 +83,8 @@ internal_print (Grob *me, string *font_char) if (style == "kievan" && 3 == robust_scm2int (me->get_property ("duration-log"), 2)) { - Grob *stem = Grob::unsmob (me->get_object ("stem")); - Grob *beam = Grob::unsmob (stem->get_object ("beam")); + Grob *stem = unsmob<Grob> (me->get_object ("stem")); + Grob *beam = unsmob<Grob> (stem->get_object ("beam")); if (beam) out = fm->find_by_name (idx_either + "2kievan"); } @@ -109,8 +109,8 @@ MAKE_SCHEME_CALLBACK (Note_head, stem_x_shift, 1); SCM Note_head::stem_x_shift (SCM smob) { - Grob *me = Grob::unsmob (smob); - Grob *stem = Grob::unsmob (me->get_object ("stem")); + Grob *me = unsmob<Grob> (smob); + Grob *stem = unsmob<Grob> (me->get_object ("stem")); if (stem) (void) stem->get_property ("positioning-done"); @@ -121,7 +121,7 @@ MAKE_SCHEME_CALLBACK (Note_head, print, 1); SCM Note_head::print (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); string idx; return internal_print (me, &idx).smobbed_copy (); @@ -131,7 +131,7 @@ MAKE_SCHEME_CALLBACK (Note_head, include_ledger_line_height, 1); SCM Note_head::include_ledger_line_height (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Grob *staff = Staff_symbol_referencer::get_staff_symbol (me); if (staff) @@ -190,7 +190,7 @@ MAKE_SCHEME_CALLBACK (Note_head, calc_stem_attachment, 1); SCM Note_head::calc_stem_attachment (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Font_metric *fm = Font_interface::get_default_font (me); string key; internal_print (me, &key); diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc index 0431981eb6..6322dfa2b9 100644 --- a/lily/note-heads-engraver.cc +++ b/lily/note-heads-engraver.cc @@ -68,7 +68,7 @@ Note_heads_engraver::process_music () Stream_event *ev = note_evs_[i]; Item *note = make_item ("NoteHead", ev->self_scm ()); - Pitch *pit = Pitch::unsmob (ev->get_property ("pitch")); + Pitch *pit = unsmob<Pitch> (ev->get_property ("pitch")); #if 0 /* TODO: should have a mechanism to switch off these warnings. */ @@ -100,8 +100,8 @@ Note_heads_engraver::process_music () { SCM scm_tonic = get_property ("tonic"); Pitch tonic; - if (Pitch::is_smob (scm_tonic)) - tonic = *Pitch::unsmob (scm_tonic); + if (unsmob<Pitch> (scm_tonic)) + tonic = *unsmob<Pitch> (scm_tonic); unsigned int delta = (pit->get_notename () - tonic.get_notename () + 7) % 7; diff --git a/lily/note-name-engraver.cc b/lily/note-name-engraver.cc index 13d3746faf..3ae9840e0d 100644 --- a/lily/note-name-engraver.cc +++ b/lily/note-name-engraver.cc @@ -50,7 +50,7 @@ Note_name_engraver::process_music () { if (i) s += " "; - Pitch p = *Pitch::unsmob (events_[i]->get_property ("pitch")); + Pitch p = *unsmob<Pitch> (events_[i]->get_property ("pitch")); if (!to_boolean (get_property ("printOctaveNames"))) p = Pitch (-1, p.get_notename (), p.get_alteration ()); diff --git a/lily/note-performer.cc b/lily/note-performer.cc index 1ddbb13ca3..aa46440006 100644 --- a/lily/note-performer.cc +++ b/lily/note-performer.cc @@ -54,15 +54,15 @@ Note_performer::process_music () Pitch transposing; SCM prop = get_property ("instrumentTransposition"); - if (Pitch::is_smob (prop)) - transposing = *Pitch::unsmob (prop); + if (unsmob<Pitch> (prop)) + transposing = *unsmob<Pitch> (prop); for (vsize i = 0; i < note_evs_.size (); i++) { Stream_event *n = note_evs_[i]; SCM pit = n->get_property ("pitch"); - if (Pitch *pitp = Pitch::unsmob (pit)) + if (Pitch *pitp = unsmob<Pitch> (pit)) { SCM articulations = n->get_property ("articulations"); Stream_event *tie_event = 0; @@ -70,7 +70,7 @@ Note_performer::process_music () int velocity = 0; for (SCM s = articulations; scm_is_pair (s); s = scm_cdr (s)) { - Stream_event *ev = Stream_event::unsmob (scm_car (s)); + Stream_event *ev = unsmob<Stream_event> (scm_car (s)); if (!ev) continue; diff --git a/lily/note-spacing-engraver.cc b/lily/note-spacing-engraver.cc index 7a7ca7275f..f0bca862d9 100644 --- a/lily/note-spacing-engraver.cc +++ b/lily/note-spacing-engraver.cc @@ -101,9 +101,9 @@ Note_spacing_engraver::finalize () Grob *last_spacing = last_spacings_[parent]; if (last_spacing - && !Grob_array::is_smob (last_spacing->get_object ("right-items"))) + && !unsmob<Grob_array> (last_spacing->get_object ("right-items"))) { - Grob *col = Grob::unsmob (get_property ("currentCommandColumn")); + Grob *col = unsmob<Grob> (get_property ("currentCommandColumn")); Pointer_group_interface::add_grob (last_spacing, ly_symbol2scm ("right-items"), @@ -120,7 +120,7 @@ Note_spacing_engraver::stop_translation_timestep () if (last_spacing && to_boolean (get_property ("hasStaffSpacing"))) { - Grob *col = Grob::unsmob (get_property ("currentCommandColumn")); + Grob *col = unsmob<Grob> (get_property ("currentCommandColumn")); Pointer_group_interface::add_grob (last_spacing, ly_symbol2scm ("right-items"), col); diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc index 0a90b2ddf7..fcd1523d2f 100644 --- a/lily/note-spacing.cc +++ b/lily/note-spacing.cc @@ -49,7 +49,7 @@ Note_spacing::get_spacing (Grob *me, Item *right_col, for (vsize i = 0; i < note_columns.size (); i++) { SCM r = note_columns[i]->get_object ("rest"); - Grob *g = Grob::unsmob (r); + Grob *g = unsmob<Grob> (r); Grob *col = note_columns[i]->get_column (); if (!g) diff --git a/lily/open-type-font-scheme.cc b/lily/open-type-font-scheme.cc index 76c5bd8db2..79370fa698 100644 --- a/lily/open-type-font-scheme.cc +++ b/lily/open-type-font-scheme.cc @@ -27,7 +27,7 @@ LY_DEFINE (ly_font_sub_fonts, "ly:font-sub-fonts", 1, 0, 0, { LY_ASSERT_SMOB (Font_metric, font, 1); - Font_metric *fm = Font_metric::unsmob (font); + Font_metric *fm = unsmob<Font_metric> (font); return fm->sub_fonts (); } @@ -37,10 +37,10 @@ LY_DEFINE (ly_otf_font_glyph_info, "ly:otf-font-glyph-info", 2, 0, 0, " information about named glyph @var{glyph} (a string).") { Modified_font_metric *fm - = derived_unsmob<Modified_font_metric> (font); + = unsmob<Modified_font_metric> (font); Open_type_font *otf = fm ? dynamic_cast<Open_type_font *> (fm->original_font ()) - : derived_unsmob<Open_type_font> (font); + : unsmob<Open_type_font> (font); SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OpenType font"); LY_ASSERT_TYPE (scm_is_string, glyph, 2); @@ -55,10 +55,10 @@ LY_DEFINE (ly_otf_font_table_data, "ly:otf-font-table-data", 2, 0, 0, " for non-existent @var{tag}.") { Modified_font_metric *fm - = derived_unsmob<Modified_font_metric> (font); + = unsmob<Modified_font_metric> (font); Open_type_font *otf = fm ? dynamic_cast<Open_type_font *> (fm->original_font ()) - : derived_unsmob<Open_type_font> (font); + : unsmob<Open_type_font> (font); SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OpenType font"); LY_ASSERT_TYPE (scm_is_string, tag, 2); @@ -78,10 +78,10 @@ LY_DEFINE (ly_otf_font_p, "ly:otf-font?", 1, 0, 0, "Is @var{font} an OpenType font?") { Modified_font_metric *fm - = derived_unsmob<Modified_font_metric> (font); + = unsmob<Modified_font_metric> (font); Open_type_font *otf = fm ? dynamic_cast<Open_type_font *> (fm->original_font ()) - : derived_unsmob<Open_type_font> (font); + : unsmob<Open_type_font> (font); return scm_from_bool (otf); } @@ -91,10 +91,10 @@ LY_DEFINE (ly_otf_glyph_count, "ly:otf-glyph-count", 1, 0, 0, "Return the number of glyphs in @var{font}.") { Modified_font_metric *fm - = derived_unsmob<Modified_font_metric> (font); + = unsmob<Modified_font_metric> (font); Open_type_font *otf = fm ? dynamic_cast<Open_type_font *> (fm->original_font ()) - : derived_unsmob<Open_type_font> (font); + : unsmob<Open_type_font> (font); SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OpenType font"); @@ -106,10 +106,10 @@ LY_DEFINE (ly_otf_glyph_list, "ly:otf-glyph-list", 1, 0, 0, "Return a list of glyph names for @var{font}.") { Modified_font_metric *fm - = derived_unsmob<Modified_font_metric> (font); + = unsmob<Modified_font_metric> (font); Open_type_font *otf = fm ? dynamic_cast<Open_type_font *> (fm->original_font ()) - : derived_unsmob<Open_type_font> (font); + : unsmob<Open_type_font> (font); SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OpenType font"); diff --git a/lily/open-type-font.cc b/lily/open-type-font.cc index 255f7caa0d..0007563ed4 100644 --- a/lily/open-type-font.cc +++ b/lily/open-type-font.cc @@ -178,7 +178,7 @@ Open_type_font::get_indexed_char_dimensions (size_t signed_idx) const { SCM box = scm_hashq_ref (lily_index_to_bbox_table_, scm_from_unsigned_integer (signed_idx), SCM_BOOL_F); - Box *box_ptr = Box::unsmob (box); + Box *box_ptr = unsmob<Box> (box); if (box_ptr) return *box_ptr; } diff --git a/lily/ottava-bracket.cc b/lily/ottava-bracket.cc index 78aef5d09b..5e962a6bb3 100644 --- a/lily/ottava-bracket.cc +++ b/lily/ottava-bracket.cc @@ -49,7 +49,7 @@ MAKE_SCHEME_CALLBACK (Ottava_bracket, print, 1); SCM Ottava_bracket::print (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); Interval span_points; Grob *common = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS); @@ -79,7 +79,7 @@ Ottava_bracket::print (SCM smob) SCM markup = me->get_property ("text"); Stencil text; if (Text_interface::is_markup (markup)) - text = *Stencil::unsmob (Text_interface::interpret_markup (layout->self_scm (), + text = *unsmob<Stencil> (Text_interface::interpret_markup (layout->self_scm (), properties, markup)); Drul_array<Real> shorten = robust_scm2interval (me->get_property ("shorten-pair"), diff --git a/lily/ottava-engraver.cc b/lily/ottava-engraver.cc index a2562b785a..d236ed779d 100644 --- a/lily/ottava-engraver.cc +++ b/lily/ottava-engraver.cc @@ -103,7 +103,7 @@ Ottava_spanner_engraver::typeset_all () { if (!finished_->get_bound (RIGHT)) { - Grob *e = Grob::unsmob (get_property ("currentMusicalColumn")); + Grob *e = unsmob<Grob> (get_property ("currentMusicalColumn")); finished_->set_bound (d, e); } } @@ -117,7 +117,7 @@ Ottava_spanner_engraver::stop_translation_timestep () { if (span_ && !span_->get_bound (LEFT)) { - Grob *e = Grob::unsmob (get_property ("currentMusicalColumn")); + Grob *e = unsmob<Grob> (get_property ("currentMusicalColumn")); span_->set_bound (LEFT, e); } diff --git a/lily/output-def-scheme.cc b/lily/output-def-scheme.cc index 3c4ee413e7..e78eff0673 100644 --- a/lily/output-def-scheme.cc +++ b/lily/output-def-scheme.cc @@ -32,7 +32,7 @@ LY_DEFINE (ly_output_def_lookup, "ly:output-def-lookup", " @var{val} or @code{'()} if @var{val} is undefined.") { LY_ASSERT_SMOB (Output_def, def, 1); - Output_def *op = Output_def::unsmob (def); + Output_def *op = unsmob<Output_def> (def); LY_ASSERT_TYPE (ly_is_symbol, sym, 2); SCM answer = op->lookup_variable (sym); @@ -52,7 +52,7 @@ LY_DEFINE (ly_output_def_scope, "ly:output-def-scope", "Return the variable scope inside @var{def}.") { LY_ASSERT_SMOB (Output_def, def, 1); - Output_def *op = Output_def::unsmob (def); + Output_def *op = unsmob<Output_def> (def); return op->scope_; } @@ -61,7 +61,7 @@ LY_DEFINE (ly_output_def_parent, "ly:output-def-parent", "Return the parent output definition of @var{def}.") { LY_ASSERT_SMOB (Output_def, def, 1); - Output_def *op = Output_def::unsmob (def); + Output_def *op = unsmob<Output_def> (def); return op->parent_ ? op->parent_->self_scm () : SCM_EOL; } @@ -70,7 +70,7 @@ LY_DEFINE (ly_output_def_set_variable_x, "ly:output-def-set-variable!", "Set an output definition @var{def} variable @var{sym} to @var{val}.") { LY_ASSERT_SMOB (Output_def, def, 1); - Output_def *output_def = Output_def::unsmob (def); + Output_def *output_def = unsmob<Output_def> (def); LY_ASSERT_TYPE (ly_is_symbol, sym, 2); output_def->set_variable (sym, val); return SCM_UNSPECIFIED; @@ -81,7 +81,7 @@ LY_DEFINE (ly_output_def_clone, "ly:output-def-clone", "Clone output definition @var{def}.") { LY_ASSERT_SMOB (Output_def, def, 1); - Output_def *op = Output_def::unsmob (def); + Output_def *op = unsmob<Output_def> (def); Output_def *clone = op->clone (); return clone->unprotect (); @@ -93,13 +93,13 @@ LY_DEFINE (ly_output_description, "ly:output-description", { LY_ASSERT_SMOB (Output_def, output_def, 1); - Output_def *id = Output_def::unsmob (output_def); + Output_def *id = unsmob<Output_def> (output_def); SCM al = ly_module_2_alist (id->scope_); SCM ell = SCM_EOL; for (SCM s = al; scm_is_pair (s); s = scm_cdr (s)) { - Context_def *td = Context_def::unsmob (scm_cdar (s)); + Context_def *td = unsmob<Context_def> (scm_cdar (s)); SCM key = scm_caar (s); if (td && key == td->get_context_name ()) ell = scm_cons (scm_cons (key, td->to_alist ()), ell); @@ -116,14 +116,14 @@ LY_DEFINE (ly_output_find_context_def, "ly:output-find-context-def", if (!SCM_UNBNDP (context_name)) LY_ASSERT_TYPE (ly_is_symbol, context_name, 2); - Output_def *id = Output_def::unsmob (output_def); + Output_def *id = unsmob<Output_def> (output_def); SCM al = ly_module_2_alist (id->scope_); SCM ell = SCM_EOL; for (SCM s = al; scm_is_pair (s); s = scm_cdr (s)) { SCM p = scm_car (s); - Context_def *td = Context_def::unsmob (scm_cdr (p)); + Context_def *td = unsmob<Context_def> (scm_cdr (p)); if (td && scm_is_eq (scm_car (p), td->get_context_name ()) && (SCM_UNBNDP (context_name) || td->is_alias (context_name))) ell = scm_cons (p, ell); @@ -139,7 +139,7 @@ LY_DEFINE (ly_paper_outputscale, "ly:paper-outputscale", "Return the output-scale for output definition @var{def}.") { LY_ASSERT_SMOB (Output_def, def, 1); - Output_def *b = Output_def::unsmob (def); + Output_def *b = unsmob<Output_def> (def); return scm_from_double (output_scale (b)); } @@ -160,7 +160,7 @@ LY_DEFINE (ly_paper_get_font, "ly:paper-get-font", { LY_ASSERT_SMOB (Output_def, def, 1); - Output_def *paper = Output_def::unsmob (def); + Output_def *paper = unsmob<Output_def> (def); Font_metric *fm = select_font (paper, chain); return fm->self_scm (); } @@ -171,7 +171,7 @@ LY_DEFINE (ly_paper_get_number, "ly:paper-get-number", " @var{def} as a double.") { LY_ASSERT_SMOB (Output_def, def, 1); - Output_def *layout = Output_def::unsmob (def); + Output_def *layout = unsmob<Output_def> (def); return scm_from_double (layout->get_dimension (sym)); } @@ -181,7 +181,7 @@ LY_DEFINE (ly_paper_fonts, "ly:paper-fonts", " @var{def} (e.g., @code{\\paper}).") { LY_ASSERT_SMOB (Output_def, def, 1); - Output_def *b = Output_def::unsmob (def); + Output_def *b = unsmob<Output_def> (def); SCM tab1 = b->lookup_variable (ly_symbol2scm ("scaled-fonts")); SCM tab2 = b->lookup_variable (ly_symbol2scm ("pango-fonts")); @@ -210,7 +210,7 @@ LY_DEFINE (ly_paper_fonts, "ly:paper-fonts", { SCM entry = scm_car (s); - Font_metric *fm = Font_metric::unsmob (entry); + Font_metric *fm = unsmob<Font_metric> (entry); if (dynamic_cast<Modified_font_metric *> (fm) || dynamic_cast<Pango_font *> (fm)) diff --git a/lily/output-def.cc b/lily/output-def.cc index af407fb70a..b58feaea6c 100644 --- a/lily/output-def.cc +++ b/lily/output-def.cc @@ -76,7 +76,7 @@ Output_def::mark_smob () void assign_context_def (Output_def * m, SCM transdef) { - Context_def *tp = Context_def::unsmob (transdef); + Context_def *tp = unsmob<Context_def> (transdef); assert (tp); if (tp) @@ -90,7 +90,7 @@ assign_context_def (Output_def * m, SCM transdef) SCM find_context_def (Output_def const *m, SCM name) { - Context_def *cd = Context_def::unsmob (m->lookup_variable (name)); + Context_def *cd = unsmob<Context_def> (m->lookup_variable (name)); return cd ? cd->self_scm () : SCM_EOL; } diff --git a/lily/page-breaking-scheme.cc b/lily/page-breaking-scheme.cc index 2ab01aa509..70ec63971d 100644 --- a/lily/page-breaking-scheme.cc +++ b/lily/page-breaking-scheme.cc @@ -29,7 +29,7 @@ LY_DEFINE (ly_page_turn_breaking, "ly:page-turn-breaking", " @var{pb} such that page turns only happen in specified places," " returning its pages.") { - Page_turn_page_breaking b (Paper_book::unsmob (pb)); + Page_turn_page_breaking b (unsmob<Paper_book> (pb)); return b.solve (); } @@ -39,7 +39,7 @@ LY_DEFINE (ly_optimal_breaking, "ly:optimal-breaking", " @var{pb} to minimize badness in bother vertical and horizontal" " spacing.") { - Optimal_page_breaking b (Paper_book::unsmob (pb)); + Optimal_page_breaking b (unsmob<Paper_book> (pb)); return b.solve (); } @@ -49,7 +49,7 @@ LY_DEFINE (ly_minimal_breaking, "ly:minimal-breaking", " without looking for optimal spacing: stack as many lines on" " a page before moving to the next one.") { - Minimal_page_breaking b (Paper_book::unsmob (pb)); + Minimal_page_breaking b (unsmob<Paper_book> (pb)); return b.solve (); } @@ -59,6 +59,6 @@ LY_DEFINE (ly_one_line_breaking, "ly:one-line-breaking", " page. The paper-width setting will be modified so that" " every page will be wider than the widest line.") { - One_line_page_breaking b (Paper_book::unsmob (pb)); + One_line_page_breaking b (unsmob<Paper_book> (pb)); return b.solve (); } diff --git a/lily/page-breaking.cc b/lily/page-breaking.cc index 5a3e646237..ef9e095d6a 100644 --- a/lily/page-breaking.cc +++ b/lily/page-breaking.cc @@ -554,7 +554,7 @@ Page_breaking::draw_page (SCM systems, SCM configuration, int page_num, bool las for (SCM s = systems; scm_is_pair (s); s = scm_cdr (s)) { SCM paper_system = scm_car (s); - if (Grob *g = Grob::unsmob (scm_car (s))) + if (Grob *g = unsmob<Grob> (scm_car (s))) { System *sys = dynamic_cast<System *> (g); paper_system = sys->get_paper_system (); @@ -567,11 +567,11 @@ Page_breaking::draw_page (SCM systems, SCM configuration, int page_num, bool las // Create the page and draw it. SCM page = make_page (page_num, last); - Prob *p = Prob::unsmob (page); + Prob *p = unsmob<Prob> (page); p->set_property ("lines", paper_systems); p->set_property ("configuration", configuration); - Stencil *foot_p = Stencil::unsmob (p->get_property ("foot-stencil")); + Stencil *foot_p = unsmob<Stencil> (p->get_property ("foot-stencil")); Stencil foot = foot_p ? *foot_p : Stencil (); SCM footnotes = Page_layout_problem::get_footnotes_from_lines (systems); @@ -658,12 +658,12 @@ Page_breaking::make_pages (vector<vsize> lines_per_page, SCM systems) for (SCM l = lines; scm_is_pair (l); l = scm_cdr (l)) { SCM labels = SCM_EOL; - if (Grob *line = Grob::unsmob (scm_car (l))) + if (Grob *line = unsmob<Grob> (scm_car (l))) { System *system = dynamic_cast<System *> (line); labels = system->get_property ("labels"); } - else if (Prob *prob = Prob::unsmob (scm_car (l))) + else if (Prob *prob = unsmob<Prob> (scm_car (l))) labels = prob->get_property ("labels"); for (SCM lbls = labels; scm_is_pair (lbls); lbls = scm_cdr (lbls)) @@ -689,13 +689,13 @@ Page_breaking::create_system_list () SCM specs = book_->get_system_specs (); for (SCM s = specs; scm_is_pair (s); s = scm_cdr (s)) { - if (Paper_score *ps = Paper_score::unsmob (scm_car (s))) + if (Paper_score *ps = unsmob<Paper_score> (scm_car (s))) { system_specs_.push_back (System_spec (ps)); } else { - Prob *pb = Prob::unsmob (scm_car (s)); + Prob *pb = unsmob<Prob> (scm_car (s)); assert (pb); pb->protect (); diff --git a/lily/page-layout-problem-scheme.cc b/lily/page-layout-problem-scheme.cc index 68df82a959..d242966a9b 100644 --- a/lily/page-layout-problem-scheme.cc +++ b/lily/page-layout-problem-scheme.cc @@ -29,8 +29,8 @@ LY_DEFINE (ly_get_spacing_spec, "ly:get-spacing-spec", 2, 0, 0, LY_ASSERT_SMOB (Grob, from_scm, 1); LY_ASSERT_SMOB (Grob, to_scm, 2); - Grob *from = Grob::unsmob (from_scm); - Grob *to = Grob::unsmob (to_scm); + Grob *from = unsmob<Grob> (from_scm); + Grob *to = unsmob<Grob> (to_scm); return Page_layout_problem::get_spacing_spec (from, to, false, 0, 0); } diff --git a/lily/page-layout-problem.cc b/lily/page-layout-problem.cc index 6fe02c8bad..1e79ba0ec5 100644 --- a/lily/page-layout-problem.cc +++ b/lily/page-layout-problem.cc @@ -44,7 +44,7 @@ Page_layout_problem::get_footnote_grobs (SCM lines) vector<Grob *> footnotes; for (SCM s = lines; scm_is_pair (s); s = scm_cdr (s)) { - if (Grob *g = Grob::unsmob (scm_car (s))) + if (Grob *g = unsmob<Grob> (scm_car (s))) { System *sys = dynamic_cast<System *> (g); if (!sys) @@ -55,7 +55,7 @@ Page_layout_problem::get_footnote_grobs (SCM lines) extract_grob_set (sys, "footnotes-after-line-breaking", footnote_grobs); footnotes.insert (footnotes.end (), footnote_grobs.begin (), footnote_grobs.end ()); } - else if (Prob *p = Prob::unsmob (scm_car (s))) + else if (Prob *p = unsmob<Prob> (scm_car (s))) { SCM stencils = p->get_property ("footnotes"); if (scm_is_null (stencils)) @@ -82,9 +82,9 @@ Page_layout_problem::get_footnotes_from_lines (SCM lines) return SCM_EOL; bool footnotes_added; - if (Grob *g = Grob::unsmob (scm_car (lines))) + if (Grob *g = unsmob<Grob> (scm_car (lines))) footnotes_added = !scm_is_null (g->get_property ("footnote-stencil")); - else if (Prob *p = Prob::unsmob (scm_car (lines))) + else if (Prob *p = unsmob<Prob> (scm_car (lines))) footnotes_added = !scm_is_null (p->get_property ("footnote-stencil")); else { @@ -100,9 +100,9 @@ Page_layout_problem::get_footnotes_from_lines (SCM lines) SCM out = SCM_EOL; for (SCM s = lines; scm_is_pair (s); s = scm_cdr (s)) { - if (Grob *g = Grob::unsmob (scm_car (s))) + if (Grob *g = unsmob<Grob> (scm_car (s))) out = scm_cons (g->get_property ("footnote-stencil"), out); - else if (Prob *p = Prob::unsmob (scm_car (s))) + else if (Prob *p = unsmob<Prob> (scm_car (s))) out = scm_cons (p->get_property ("footnote-stencil"), out); else programming_error ("Systems on a page must be a prob or grob."); @@ -175,13 +175,13 @@ Page_layout_problem::add_footnotes_to_lines (SCM lines, int counter, Paper_book } SCM markup = scm_call_1 (numbering_function, scm_from_int (counter)); SCM stencil = Text_interface::interpret_markup (layout, props, markup); - Stencil *st = Stencil::unsmob (stencil); + Stencil *st = unsmob<Stencil> (stencil); if (!st) { programming_error ("Your numbering function needs to return a stencil."); markup = SCM_EOL; stencil = Stencil (Box (Interval (0, 0), Interval (0, 0)), SCM_EOL).smobbed_copy (); - st = Stencil::unsmob (stencil); + st = unsmob<Stencil> (stencil); } in_text_numbers = scm_cons (markup, in_text_numbers); numbers = scm_cons (stencil, numbers); @@ -202,7 +202,7 @@ Page_layout_problem::add_footnotes_to_lines (SCM lines, int counter, Paper_book for (SCM p = numbers; scm_is_pair (p); p = scm_cdr (p)) { - Stencil *st = Stencil::unsmob (scm_car (p)); + Stencil *st = unsmob<Stencil> (scm_car (p)); if (!st->extent (X_AXIS).is_empty ()) st->translate_axis ((max_length - st->extent (X_AXIS)[RIGHT]), X_AXIS); @@ -213,7 +213,7 @@ Page_layout_problem::add_footnotes_to_lines (SCM lines, int counter, Paper_book for (SCM s = lines; scm_is_pair (s); s = scm_cdr (s)) { // Take care of musical systems. - if (Grob *g = Grob::unsmob (scm_car (s))) + if (Grob *g = unsmob<Grob> (scm_car (s))) { System *sys = dynamic_cast<System *> (g); if (!sys) @@ -238,7 +238,7 @@ Page_layout_problem::add_footnotes_to_lines (SCM lines, int counter, Paper_book SCM footnote_stl = Text_interface::interpret_markup (paper->self_scm (), props, footnote_markup); - Stencil footnote_stencil = *Stencil::unsmob (footnote_stl); + Stencil footnote_stencil = *unsmob<Stencil> (footnote_stl); bool do_numbering = to_boolean (footnote->get_property ("automatically-numbered")); if (Spanner *orig = dynamic_cast<Spanner *>(footnote)) { @@ -259,7 +259,7 @@ Page_layout_problem::add_footnotes_to_lines (SCM lines, int counter, Paper_book orig->broken_intos_[i]->set_property ("text", annotation_scm); } - Stencil annotation = *Stencil::unsmob (scm_car (numbers)); + Stencil annotation = *unsmob<Stencil> (scm_car (numbers)); annotation.translate_axis ((footnote_stencil.extent (Y_AXIS)[UP] + number_raise - annotation.extent (Y_AXIS)[UP]), @@ -280,24 +280,24 @@ Page_layout_problem::add_footnotes_to_lines (SCM lines, int counter, Paper_book sys->set_property ("footnote-stencil", mol.smobbed_copy ()); } // Take care of top-level markups - else if (Prob *p = Prob::unsmob (scm_car (s))) + else if (Prob *p = unsmob<Prob> (scm_car (s))) { SCM stencils = p->get_property ("footnotes"); Stencil mol; for (SCM st = stencils; scm_is_pair (st); st = scm_cdr (st)) { - Stencil footnote_stencil = *Stencil::unsmob (scm_caddar (st)); + Stencil footnote_stencil = *unsmob<Stencil> (scm_caddar (st)); bool do_numbering = to_boolean (scm_cadar (st)); SCM in_text_stencil = Stencil ().smobbed_copy (); if (do_numbering) { - Stencil annotation = *Stencil::unsmob (scm_car (numbers)); + Stencil annotation = *unsmob<Stencil> (scm_car (numbers)); SCM in_text_annotation = scm_car (in_text_numbers); in_text_stencil = Text_interface::interpret_markup (layout, props, in_text_annotation); - if (!Stencil::is_smob (in_text_stencil)) + if (!unsmob<Stencil> (in_text_stencil)) in_text_stencil = SCM_EOL; annotation.translate_axis ((footnote_stencil.extent (Y_AXIS)[UP] + number_raise @@ -335,7 +335,7 @@ Page_layout_problem::get_footnote_separator_stencil (Output_def *paper) SCM footnote_stencil = Text_interface::interpret_markup (paper->self_scm (), props, markup); - Stencil *footnote_separator = Stencil::unsmob (footnote_stencil); + Stencil *footnote_separator = unsmob<Stencil> (footnote_stencil); return footnote_separator ? *footnote_separator : Stencil (); } @@ -352,7 +352,7 @@ Page_layout_problem::add_footnotes_to_footer (SCM footnotes, Stencil foot, Paper for (SCM s = footnotes; scm_is_pair (s); s = scm_cdr (s)) { - Stencil *stencil = Stencil::unsmob (scm_car (s)); + Stencil *stencil = unsmob<Stencil> (scm_car (s)); if (!stencil) continue; @@ -377,7 +377,7 @@ Page_layout_problem::add_footnotes_to_footer (SCM footnotes, Stencil foot, Paper Page_layout_problem::Page_layout_problem (Paper_book *pb, SCM page_scm, SCM systems) : bottom_skyline_ (DOWN) { - Prob *page = Prob::unsmob (page_scm); + Prob *page = unsmob<Prob> (page_scm); bottom_loose_baseline_ = 0; header_height_ = 0; footer_height_ = 0; @@ -388,8 +388,8 @@ Page_layout_problem::Page_layout_problem (Paper_book *pb, SCM page_scm, SCM syst if (page) { - Stencil *head = Stencil::unsmob (page->get_property ("head-stencil")); - Stencil *foot = Stencil::unsmob (page->get_property ("foot-stencil")); + Stencil *head = unsmob<Stencil> (page->get_property ("head-stencil")); + Stencil *foot = unsmob<Stencil> (page->get_property ("foot-stencil")); Stencil foot_stencil = foot ? *foot : Stencil (); @@ -433,7 +433,7 @@ Page_layout_problem::Page_layout_problem (Paper_book *pb, SCM page_scm, SCM syst markup_markup_spacing = paper->c_variable ("markup-markup-spacing"); last_bottom_spacing = paper->c_variable ("last-bottom-spacing"); top_system_spacing = paper->c_variable ("top-system-spacing"); - if (scm_is_pair (systems) && Prob::is_smob (scm_car (systems))) + if (scm_is_pair (systems) && unsmob<Prob> (scm_car (systems))) top_system_spacing = paper->c_variable ("top-markup-spacing"); // Note: the page height here does _not_ reserve space for headers and @@ -453,7 +453,7 @@ Page_layout_problem::Page_layout_problem (Paper_book *pb, SCM page_scm, SCM syst { bool first = (s == systems); - if (Grob *g = Grob::unsmob (scm_car (s))) + if (Grob *g = unsmob<Grob> (scm_car (s))) { System *sys = dynamic_cast<System *> (g); if (!sys) @@ -479,7 +479,7 @@ Page_layout_problem::Page_layout_problem (Paper_book *pb, SCM page_scm, SCM syst append_system (sys, spring, indent, padding); last_system_was_title = false; } - else if (Prob *p = Prob::unsmob (scm_car (s))) + else if (Prob *p = unsmob<Prob> (scm_car (s))) { SCM spec = first ? top_system_spacing : (last_system_was_title ? markup_markup_spacing : score_markup_spacing); @@ -538,7 +538,7 @@ Page_layout_problem::set_footer_height (Real height) void Page_layout_problem::append_system (System *sys, Spring const &spring, Real indent, Real padding) { - Grob *align = Grob::unsmob (sys->get_object ("vertical-alignment")); + Grob *align = unsmob<Grob> (sys->get_object ("vertical-alignment")); if (!align) return; @@ -554,7 +554,7 @@ Page_layout_problem::append_system (System *sys, Spring const &spring, Real inde build_system_skyline (elts, minimum_offsets_with_min_dist, &up_skyline, &down_skyline); up_skyline.shift (indent); down_skyline.shift (indent); - Stencil *in_note_stencil = Stencil::unsmob (sys->get_property ("in-note-stencil")); + Stencil *in_note_stencil = unsmob<Stencil> (sys->get_property ("in-note-stencil")); if (in_note_stencil && in_note_stencil->extent (Y_AXIS).length () > 0) { @@ -587,7 +587,7 @@ Page_layout_problem::append_system (System *sys, Spring const &spring, Real inde // store the minimum distance, considering relative indents, // for a loose line Skyline first_skyline (UP); - Skyline_pair *sky = Skyline_pair::unsmob (elts[0]->get_property ("vertical-skylines")); + Skyline_pair *sky = unsmob<Skyline_pair> (elts[0]->get_property ("vertical-skylines")); if (sky) first_skyline.merge ((*sky)[UP]); first_skyline.shift (indent); @@ -659,7 +659,7 @@ Page_layout_problem::append_system (System *sys, Spring const &spring, Real inde void Page_layout_problem::append_prob (Prob *prob, Spring const &spring, Real padding) { - Skyline_pair *sky = Skyline_pair::unsmob (prob->get_property ("vertical-skylines")); + Skyline_pair *sky = unsmob<Skyline_pair> (prob->get_property ("vertical-skylines")); Real minimum_distance = 0; bool tight_spacing = to_boolean (prob->get_property ("tight-spacing")); @@ -669,7 +669,7 @@ Page_layout_problem::append_prob (Prob *prob, Spring const &spring, Real padding bottom_loose_baseline_); bottom_skyline_ = (*sky)[DOWN]; } - else if (Stencil *sten = Stencil::unsmob (prob->get_property ("stencil"))) + else if (Stencil *sten = unsmob<Stencil> (prob->get_property ("stencil"))) { Interval iv = sten->extent (Y_AXIS); minimum_distance = iv[UP] - bottom_skyline_.max_height (); @@ -772,7 +772,7 @@ Page_layout_problem::find_system_offsets () { *tail = scm_cons (scm_from_double (solution_[spring_idx]), SCM_EOL); tail = SCM_CDRLOC (*tail); - Interval prob_extent = Stencil::unsmob (elements_[i].prob->get_property ("stencil"))->extent (Y_AXIS); + Interval prob_extent = unsmob<Stencil> (elements_[i].prob->get_property ("stencil"))->extent (Y_AXIS); // Lay out any non-spaceable lines between this line and // the last one. @@ -991,7 +991,7 @@ Page_layout_problem::build_system_skyline (vector<Grob *> const &staves, { Real dy = minimum_translations[i] - first_translation; Grob *g = staves[i]; - Skyline_pair *sky = Skyline_pair::unsmob (g->get_property ("vertical-skylines")); + Skyline_pair *sky = unsmob<Skyline_pair> (g->get_property ("vertical-skylines")); if (sky) { up->raise (-dy); @@ -1025,7 +1025,7 @@ Page_layout_problem::build_system_skyline (vector<Grob *> const &staves, Interval Page_layout_problem::prob_extent (Prob *p) { - Stencil *sten = Stencil::unsmob (p->get_property ("stencil")); + Stencil *sten = unsmob<Stencil> (p->get_property ("stencil")); return sten ? sten->extent (Y_AXIS) : Interval (0, 0); } diff --git a/lily/page-turn-engraver.cc b/lily/page-turn-engraver.cc index c658c0c94b..dd90ba71cf 100644 --- a/lily/page-turn-engraver.cc +++ b/lily/page-turn-engraver.cc @@ -148,7 +148,7 @@ Page_turn_engraver::acknowledge_note_head (Grob_info gi) Stream_event *cause = gi.event_cause (); Duration *dur_ptr = cause - ? Duration::unsmob (cause->get_property ("duration")) + ? unsmob<Duration> (cause->get_property ("duration")) : 0; if (!dur_ptr) @@ -208,7 +208,7 @@ Page_turn_engraver::start_translation_timestep () void Page_turn_engraver::stop_translation_timestep () { - Grob *pc = Grob::unsmob (get_property ("currentCommandColumn")); + Grob *pc = unsmob<Grob> (get_property ("currentCommandColumn")); if (pc) { @@ -239,7 +239,7 @@ Page_turn_engraver::stop_translation_timestep () { Rational now = now_mom ().main_part_; Real pen = penalty ((now_mom () - rest_begin_).main_part_ + repeat_begin_rest_length_); - Moment *m = Moment::unsmob (get_property ("minimumRepeatLengthForPageTurn")); + Moment *m = unsmob<Moment> (get_property ("minimumRepeatLengthForPageTurn")); if (m && *m > (now_mom () - repeat_begin_)) pen = infinity_f; diff --git a/lily/pango-font-scheme.cc b/lily/pango-font-scheme.cc index e6d89b47f3..504e4ca3dd 100644 --- a/lily/pango-font-scheme.cc +++ b/lily/pango-font-scheme.cc @@ -35,7 +35,7 @@ LY_DEFINE (ly_pango_font_p, "ly:pango-font?", (SCM f), "Is @var{f} a pango font?") { - return scm_from_bool (derived_unsmob<Pango_font> (f)); + return scm_from_bool (unsmob<Pango_font> (f)); } LY_DEFINE (ly_pango_font_physical_fonts, "ly:pango-font-physical-fonts", @@ -44,7 +44,7 @@ LY_DEFINE (ly_pango_font_physical_fonts, "ly:pango-font-physical-fonts", "Return alist of @code{(ps-name file-name font-index)} lists" " for Pango font@tie{}@var{f}.") { - Pango_font *pf = derived_unsmob<Pango_font> (f); + Pango_font *pf = unsmob<Pango_font> (f); SCM alist = SCM_EOL; if (pf) diff --git a/lily/paper-book-scheme.cc b/lily/paper-book-scheme.cc index da2522b560..ba0c8592e2 100644 --- a/lily/paper-book-scheme.cc +++ b/lily/paper-book-scheme.cc @@ -26,7 +26,7 @@ LY_DEFINE (ly_paper_book_pages, "ly:paper-book-pages", "Return pages in @code{Paper_book} object @var{pb}.") { LY_ASSERT_SMOB (Paper_book, pb, 1); - return Paper_book::unsmob (pb)->pages (); + return unsmob<Paper_book> (pb)->pages (); } LY_DEFINE (ly_paper_book_scopes, "ly:paper-book-scopes", @@ -34,7 +34,7 @@ LY_DEFINE (ly_paper_book_scopes, "ly:paper-book-scopes", "Return scopes in @code{Paper_book} object @var{pb}.") { LY_ASSERT_SMOB (Paper_book, pb, 1); - Paper_book *book = Paper_book::unsmob (pb); + Paper_book *book = unsmob<Paper_book> (pb); SCM scopes = SCM_EOL; if (book->parent_) @@ -52,7 +52,7 @@ LY_DEFINE (ly_paper_book_performances, "ly:paper-book-performances", "Return performances in @code{Paper_book} object @var{pb}.") { LY_ASSERT_SMOB (Paper_book, pb, 1); - return Paper_book::unsmob (pb)->performances (); + return unsmob<Paper_book> (pb)->performances (); } LY_DEFINE (ly_paper_book_systems, "ly:paper-book-systems", @@ -60,7 +60,7 @@ LY_DEFINE (ly_paper_book_systems, "ly:paper-book-systems", "Return systems in @code{Paper_book} object @var{pb}.") { LY_ASSERT_SMOB (Paper_book, pb, 1); - return Paper_book::unsmob (pb)->systems (); + return unsmob<Paper_book> (pb)->systems (); } LY_DEFINE (ly_paper_book_paper, "ly:paper-book-paper", @@ -69,7 +69,7 @@ LY_DEFINE (ly_paper_book_paper, "ly:paper-book-paper", " in @code{Paper_book} object @var{pb}.") { LY_ASSERT_SMOB (Paper_book, pb, 1); - Paper_book *pbook = Paper_book::unsmob (pb); + Paper_book *pbook = unsmob<Paper_book> (pb); return pbook->paper_->self_scm (); } @@ -79,6 +79,6 @@ LY_DEFINE (ly_paper_book_header, "ly:paper-book-header", " in @code{Paper_book} object @var{pb}.") { LY_ASSERT_SMOB (Paper_book, pb, 1); - Paper_book *pbook = Paper_book::unsmob (pb); + Paper_book *pbook = unsmob<Paper_book> (pb); return pbook->header_; } diff --git a/lily/paper-book.cc b/lily/paper-book.cc index fbaccb3bab..b79041bb7b 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -128,7 +128,7 @@ Paper_book::output_aux (SCM output_channel, if (scm_is_pair (bookparts_)) { for (SCM p = bookparts_; scm_is_pair (p); p = scm_cdr (p)) - if (Paper_book *pbookpart = Paper_book::unsmob (scm_car (p))) + if (Paper_book *pbookpart = unsmob<Paper_book> (scm_car (p))) { bool is_last_part = (is_last && !scm_is_pair (scm_cdr (p))); page_nb += pbookpart->output_aux (output_channel, @@ -285,8 +285,8 @@ Paper_book::book_title () paper_->self_scm (), scopes); - if (Stencil::is_smob (tit)) - title = *Stencil::unsmob (tit); + if (unsmob<Stencil> (tit)) + title = *unsmob<Stencil> (tit); if (!title.is_empty ()) title.align_to (Y_AXIS, UP); @@ -314,8 +314,8 @@ Paper_book::score_title (SCM header) paper_->self_scm (), scopes); - if (Stencil::is_smob (tit)) - title = *Stencil::unsmob (tit); + if (unsmob<Stencil> (tit)) + title = *unsmob<Stencil> (tit); if (!title.is_empty ()) title.align_to (Y_AXIS, UP); @@ -326,7 +326,7 @@ Paper_book::score_title (SCM header) void set_page_permission (SCM sys, SCM symbol, SCM permission) { - if (Paper_score *ps = Paper_score::unsmob (sys)) + if (Paper_score *ps = unsmob<Paper_score> (sys)) { vector<Grob *> cols = ps->get_columns (); if (cols.size ()) @@ -336,7 +336,7 @@ set_page_permission (SCM sys, SCM symbol, SCM permission) col->find_prebroken_piece (LEFT)->set_property (symbol, permission); } } - else if (Prob *pb = Prob::unsmob (sys)) + else if (Prob *pb = unsmob<Prob> (sys)) pb->set_property (symbol, permission); } @@ -370,7 +370,7 @@ set_system_penalty (SCM sys, SCM header) void set_labels (SCM sys, SCM labels) { - if (Paper_score *ps = Paper_score::unsmob (sys)) + if (Paper_score *ps = unsmob<Paper_score> (sys)) { vector<Grob *> cols = ps->get_columns (); if (cols.size ()) @@ -386,7 +386,7 @@ set_labels (SCM sys, SCM labels) labels))); } } - else if (Prob *pb = Prob::unsmob (sys)) + else if (Prob *pb = unsmob<Prob> (sys)) pb->set_property ("labels", scm_append_x (scm_list_2 (pb->get_property ("labels"), labels))); @@ -447,7 +447,7 @@ Paper_book::get_system_specs () if (scm_is_null (header_0_)) header_0_ = header; } - else if (Page_marker *page_marker = Page_marker::unsmob (scm_car (s))) + else if (Page_marker *page_marker = unsmob<Page_marker> (scm_car (s))) { /* page markers are used to set page breaking/turning permission, or to place bookmarking labels */ @@ -465,7 +465,7 @@ Paper_book::get_system_specs () labels = scm_cons (page_marker->label (), labels); } } - else if (Music_output *mop = Music_output::unsmob (scm_car (s))) + else if (Music_output *mop = unsmob<Music_output> (scm_car (s))) { if (Paper_score *pscore = dynamic_cast<Paper_score *> (mop)) { @@ -474,10 +474,10 @@ Paper_book::get_system_specs () if (scm_is_pair (system_specs)) set_system_penalty (scm_car (system_specs), header); - if (Prob::is_smob (title)) + if (unsmob<Prob> (title)) { system_specs = scm_cons (title, system_specs); - Prob::unsmob (title)->unprotect (); + unsmob<Prob> (title)->unprotect (); } header = SCM_EOL; @@ -515,9 +515,9 @@ Paper_book::get_system_specs () ps->set_property ("last-markup-line", SCM_BOOL_F); ps->set_property ("first-markup-line", SCM_BOOL_F); - paper_system_set_stencil (ps, *Stencil::unsmob (t)); + paper_system_set_stencil (ps, *unsmob<Stencil> (t)); - SCM footnotes = get_footnotes (Stencil::unsmob (t)->expr ()); + SCM footnotes = get_footnotes (unsmob<Stencil> (t)->expr ()); ps->set_property ("footnotes", footnotes); ps->set_property ("is-title", SCM_BOOL_T); if (list == texts) @@ -568,7 +568,7 @@ Paper_book::systems () { SCM system_list = SCM_EOL; for (SCM p = bookparts_; scm_is_pair (p); p = scm_cdr (p)) - if (Paper_book *pbookpart = Paper_book::unsmob (scm_car (p))) + if (Paper_book *pbookpart = unsmob<Paper_book> (scm_car (p))) system_list = scm_cons (pbookpart->systems (), system_list); systems_ = scm_append (scm_reverse_x (system_list, SCM_EOL)); } @@ -578,7 +578,7 @@ Paper_book::systems () for (SCM s = specs; scm_is_pair (s); s = scm_cdr (s)) { if (Paper_score * pscore - = Paper_score::unsmob (scm_car (s))) + = unsmob<Paper_score> (scm_car (s))) { SCM system_list = scm_vector_to_list (pscore->get_paper_systems ()); @@ -597,7 +597,7 @@ Paper_book::systems () Prob *last = 0; for (SCM s = systems_; scm_is_pair (s); s = scm_cdr (s)) { - Prob *ps = Prob::unsmob (scm_car (s)); + Prob *ps = unsmob<Prob> (scm_car (s)); ps->set_property ("number", scm_from_int (++i)); if (last @@ -609,7 +609,7 @@ Paper_book::systems () if (scm_is_pair (scm_cdr (s))) { SCM perm = ps->get_property ("page-break-permission"); - Prob *next = Prob::unsmob (scm_cadr (s)); + Prob *next = unsmob<Prob> (scm_cadr (s)); if (scm_is_null (perm)) next->set_property ("penalty", scm_from_int (10001)); else if (scm_is_eq (perm, ly_symbol2scm ("force"))) @@ -631,7 +631,7 @@ Paper_book::pages () if (scm_is_pair (bookparts_)) { for (SCM p = bookparts_; scm_is_pair (p); p = scm_cdr (p)) - if (Paper_book *pbookpart = Paper_book::unsmob (scm_car (p))) + if (Paper_book *pbookpart = unsmob<Paper_book> (scm_car (p))) pages_ = scm_cons (pbookpart->pages (), pages_); pages_ = scm_append (scm_reverse_x (pages_, SCM_EOL)); } @@ -658,7 +658,7 @@ Paper_book::pages () systems_ = SCM_EOL; for (SCM p = pages_; scm_is_pair (p); p = scm_cdr (p)) { - Prob *page = Prob::unsmob (scm_car (p)); + Prob *page = unsmob<Prob> (scm_car (p)); SCM systems = page->get_property ("lines"); systems_ = scm_cons (systems, systems_); } diff --git a/lily/paper-column-engraver.cc b/lily/paper-column-engraver.cc index b92abe8171..87df2cbe59 100644 --- a/lily/paper-column-engraver.cc +++ b/lily/paper-column-engraver.cc @@ -98,7 +98,7 @@ Paper_column_engraver::make_columns () void Paper_column_engraver::initialize () { - system_ = derived_unsmob<System> (get_property ("rootSystem")); + system_ = unsmob<System> (get_property ("rootSystem")); make_columns (); system_->set_bound (LEFT, command_column_); @@ -214,7 +214,7 @@ Paper_column_engraver::process_music () if (start_of_measure) { Moment mlen = Moment (measure_length (context ())); - Grob *column = Grob::unsmob (get_property ("currentCommandColumn")); + Grob *column = unsmob<Grob> (get_property ("currentCommandColumn")); if (column) column->set_property ("measure-length", mlen.smobbed_copy ()); else @@ -239,7 +239,7 @@ Paper_column_engraver::stop_translation_timestep () if (!elem->get_parent (X_AXIS)) elem->set_parent (col, X_AXIS); - if (!Grob::is_smob (elem->get_object ("axis-group-parent-X"))) + if (!unsmob<Grob> (elem->get_object ("axis-group-parent-X"))) elem->set_object ("axis-group-parent-X", col->self_scm ()); if (Accidental_placement::has_interface (elem) @@ -280,7 +280,7 @@ Paper_column_engraver::stop_translation_timestep () SCM mpos = get_property ("measurePosition"); SCM barnum = get_property ("internalBarNumber"); - if (Moment::is_smob (mpos) + if (unsmob<Moment> (mpos) && scm_is_integer (barnum)) { SCM where = scm_cons (barnum, diff --git a/lily/paper-column.cc b/lily/paper-column.cc index a6e44849b6..6ea2d26889 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -118,7 +118,7 @@ Moment Paper_column::when_mom (Grob *me) { SCM m = me->get_property ("when"); - if (Moment *when = Moment::unsmob (m)) + if (Moment *when = unsmob<Moment> (m)) return *when; return Moment (0); } @@ -128,8 +128,8 @@ Paper_column::is_musical (Grob *me) { SCM m = me->get_property ("shortest-starter-duration"); Moment s (0); - if (Moment::unsmob (m)) - s = *Moment::unsmob (m); + if (unsmob<Moment> (m)) + s = *unsmob<Moment> (m); return s != Moment (0); } @@ -170,7 +170,7 @@ Paper_column::minimum_distance (Grob *left, Grob *right) for (LEFT_and_RIGHT (d)) { - Skyline_pair *sp = Skyline_pair::unsmob (cols[d]->get_property ("horizontal-skylines")); + Skyline_pair *sp = unsmob<Skyline_pair> (cols[d]->get_property ("horizontal-skylines")); if (sp) skys[d] = (*sp)[-d]; } @@ -266,11 +266,11 @@ MAKE_DOCUMENTED_SCHEME_CALLBACK (Paper_column, print, 1, SCM Paper_column::print (SCM p) { - Paper_column *me = derived_unsmob<Paper_column> (p); + Paper_column *me = unsmob<Paper_column> (p); string r = ::to_string (Paper_column::get_rank (me)); - Moment *mom = Moment::unsmob (me->get_property ("when")); + Moment *mom = unsmob<Moment> (me->get_property ("when")); string when = mom ? mom->to_string () : "?/?"; Font_metric *musfont = Font_interface::get_default_font (me); @@ -281,9 +281,9 @@ Paper_column::print (SCM p) SCM when_mol = Text_interface::interpret_markup (me->layout ()->self_scm (), properties, ly_string2scm (when)); - Stencil t = *Stencil::unsmob (scm_mol); + Stencil t = *unsmob<Stencil> (scm_mol); t.scale (1.2, 1.4); - t.add_at_edge (Y_AXIS, DOWN, *Stencil::unsmob (when_mol), 0.1); + t.add_at_edge (Y_AXIS, DOWN, *unsmob<Stencil> (when_mol), 0.1); t.align_to (X_AXIS, LEFT); // compensate for font serifs and half letter-distance t.translate (Offset (-0.1, 0)); @@ -301,9 +301,9 @@ Paper_column::print (SCM p) for (SCM s = me->get_object ("ideal-distances"); scm_is_pair (s); s = scm_cdr (s)) { - Spring *sp = Spring::unsmob (scm_caar (s)); - if (!Grob::is_smob (scm_cdar (s)) - || !Grob::unsmob (scm_cdar (s))->get_system ()) + Spring *sp = unsmob<Spring> (scm_caar (s)); + if (!unsmob<Grob> (scm_cdar (s)) + || !unsmob<Grob> (scm_cdar (s))->get_system ()) continue; j++; @@ -316,7 +316,7 @@ Paper_column::print (SCM p) SCM stil = Text_interface::interpret_markup (me->layout ()->self_scm (), properties, ly_string2scm (String_convert::form_string ("%5.2lf", sp->distance ()))); - Stencil *number_stc = Stencil::unsmob (stil); + Stencil *number_stc = unsmob<Stencil> (stil); number_stc->scale (1, 1.1); Real num_height = number_stc->extent (Y_AXIS).length (); Real num_len = number_stc->extent (X_AXIS).length (); @@ -347,7 +347,7 @@ Paper_column::print (SCM p) scm_is_pair (s); s = scm_cdr (s)) { Real dist = scm_to_double (scm_cdar (s)); - Grob *other = Grob::unsmob (scm_caar (s)); + Grob *other = unsmob<Grob> (scm_caar (s)); if (!other || other->get_system () != me->get_system ()) continue; @@ -361,7 +361,7 @@ Paper_column::print (SCM p) SCM stil = Text_interface::interpret_markup (me->layout ()->self_scm (), properties, ly_string2scm (String_convert::form_string ("%5.2lf", dist))); - Stencil *number_stc = Stencil::unsmob (stil); + Stencil *number_stc = unsmob<Stencil> (stil); number_stc->scale (1, 1.1); Real num_height = number_stc->extent (Y_AXIS).length (); Real num_len = number_stc->extent (X_AXIS).length (); @@ -403,10 +403,10 @@ MAKE_SCHEME_CALLBACK (Paper_column, before_line_breaking, 1); SCM Paper_column::before_line_breaking (SCM grob) { - Grob *me = Grob::unsmob (grob); + Grob *me = unsmob<Grob> (grob); SCM bbm = me->get_object ("bounded-by-me"); - Grob_array *ga = Grob_array::unsmob (bbm); + Grob_array *ga = unsmob<Grob_array> (bbm); if (!ga) return SCM_UNSPECIFIED; diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 3d473f202d..5329d30555 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -67,14 +67,14 @@ find_scaled_font (Output_def *mod, Font_metric *f, Real m) SCM sizes = scm_hashq_ref (font_table, f->self_scm (), SCM_EOL); SCM handle = scm_assoc (scm_from_double (lookup_mag), sizes); if (scm_is_pair (handle)) - return Font_metric::unsmob (scm_cdr (handle)); + return unsmob<Font_metric> (scm_cdr (handle)); SCM val = Modified_font_metric::make_scaled_font_metric (f, lookup_mag); sizes = scm_acons (scm_from_double (lookup_mag), val, sizes); - Font_metric::unsmob (val)->unprotect (); + unsmob<Font_metric> (val)->unprotect (); scm_hashq_set_x (font_table, f->self_scm (), sizes); - return Font_metric::unsmob (val); + return unsmob<Font_metric> (val); } Font_metric * @@ -88,7 +88,7 @@ find_pango_font (Output_def *layout, SCM descr, Real factor) SCM size_key = scm_from_double (factor); SCM handle = scm_assoc (size_key, sizes); if (scm_is_pair (handle)) - return Font_metric::unsmob (scm_cdr (handle)); + return unsmob<Font_metric> (scm_cdr (handle)); PangoFontDescription *description = pango_font_description_from_string (scm_i_string_chars (descr)); @@ -117,7 +117,7 @@ scale_output_def (Output_def *o, Real amount) SCM proc = ly_lily_module_constant ("scale-layout"); SCM new_pap = scm_call_2 (proc, o->self_scm (), scm_from_double (amount)); - o = Output_def::unsmob (new_pap); + o = unsmob<Output_def> (new_pap); o->protect (); return o; } diff --git a/lily/paper-outputter-scheme.cc b/lily/paper-outputter-scheme.cc index 92863533c4..145e9bfa93 100644 --- a/lily/paper-outputter-scheme.cc +++ b/lily/paper-outputter-scheme.cc @@ -57,8 +57,8 @@ LY_DEFINE (ly_outputter_dump_stencil, "ly:outputter-dump-stencil", LY_ASSERT_SMOB (Paper_outputter, outputter, 1); LY_ASSERT_SMOB (Stencil, stencil, 2); - Paper_outputter *po = Paper_outputter::unsmob (outputter); - Stencil *st = Stencil::unsmob (stencil); + Paper_outputter *po = unsmob<Paper_outputter> (outputter); + Stencil *st = unsmob<Stencil> (stencil); po->output_stencil (*st); return SCM_UNSPECIFIED; @@ -71,7 +71,7 @@ LY_DEFINE (ly_outputter_dump_string, "ly:outputter-dump-string", LY_ASSERT_SMOB (Paper_outputter, outputter, 1); LY_ASSERT_TYPE (scm_is_string, str, 2); - Paper_outputter *po = Paper_outputter::unsmob (outputter); + Paper_outputter *po = unsmob<Paper_outputter> (outputter); return po->dump_string (str); } @@ -81,7 +81,7 @@ LY_DEFINE (ly_outputter_port, "ly:outputter-port", "Return output port for @var{outputter}.") { LY_ASSERT_SMOB (Paper_outputter, outputter, 1); - Paper_outputter *po = Paper_outputter::unsmob (outputter); + Paper_outputter *po = unsmob<Paper_outputter> (outputter); return po->file (); } @@ -91,7 +91,7 @@ LY_DEFINE (ly_outputter_close, "ly:outputter-close", "Close port of @var{outputter}.") { LY_ASSERT_SMOB (Paper_outputter, outputter, 1); - Paper_outputter *po = Paper_outputter::unsmob (outputter); + Paper_outputter *po = unsmob<Paper_outputter> (outputter); po->close (); return SCM_UNSPECIFIED; @@ -102,7 +102,7 @@ LY_DEFINE (ly_outputter_output_scheme, "ly:outputter-output-scheme", "Eval @var{expr} in module of @var{outputter}.") { LY_ASSERT_SMOB (Paper_outputter, outputter, 1); - Paper_outputter *po = Paper_outputter::unsmob (outputter); + Paper_outputter *po = unsmob<Paper_outputter> (outputter); po->output_scheme (expr); @@ -115,6 +115,6 @@ LY_DEFINE (ly_outputter_module, "ly:outputter-module", { LY_ASSERT_SMOB (Paper_outputter, outputter, 1); - Paper_outputter *po = Paper_outputter::unsmob (outputter); + Paper_outputter *po = unsmob<Paper_outputter> (outputter); return po->module (); } diff --git a/lily/paper-score-scheme.cc b/lily/paper-score-scheme.cc index 6d2b397d9a..e2909e2844 100644 --- a/lily/paper-score-scheme.cc +++ b/lily/paper-score-scheme.cc @@ -27,6 +27,6 @@ LY_DEFINE (ly_paper_score_paper_systems, "ly:paper-score-paper-systems", { LY_ASSERT_SMOB (Paper_score, paper_score, 1); - Paper_score *pscore = Paper_score::unsmob (paper_score); + Paper_score *pscore = unsmob<Paper_score> (paper_score); return pscore->get_paper_systems (); } diff --git a/lily/paper-system-scheme.cc b/lily/paper-system-scheme.cc index c8f515aa52..1f5a39b96a 100644 --- a/lily/paper-system-scheme.cc +++ b/lily/paper-system-scheme.cc @@ -37,17 +37,17 @@ LY_DEFINE (ly_paper_system_minimum_distance, "ly:paper-system-minimum-distance", " their extents otherwise.") { Real ret = 0; - Prob *p1 = Prob::unsmob (sys1); - Prob *p2 = Prob::unsmob (sys2); - Skyline_pair *sky1 = Skyline_pair::unsmob (p1->get_property ("vertical-skylines")); - Skyline_pair *sky2 = Skyline_pair::unsmob (p2->get_property ("vertical-skylines")); + Prob *p1 = unsmob<Prob> (sys1); + Prob *p2 = unsmob<Prob> (sys2); + Skyline_pair *sky1 = unsmob<Skyline_pair> (p1->get_property ("vertical-skylines")); + Skyline_pair *sky2 = unsmob<Skyline_pair> (p2->get_property ("vertical-skylines")); if (sky1 && sky2) ret = (*sky1)[DOWN].distance ((*sky2)[UP]); else { - Stencil *s1 = Stencil::unsmob (p1->get_property ("stencil")); - Stencil *s2 = Stencil::unsmob (p2->get_property ("stencil")); + Stencil *s1 = unsmob<Stencil> (p1->get_property ("stencil")); + Stencil *s2 = unsmob<Stencil> (p2->get_property ("stencil")); Interval iv1 = s1->extent (Y_AXIS); Interval iv2 = s2->extent (Y_AXIS); ret = iv2[UP] - iv1[DOWN]; diff --git a/lily/parser.yy b/lily/parser.yy index 9630ff4837..71095680c5 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -408,7 +408,7 @@ toplevel_expression: } | BOOK_IDENTIFIER { SCM proc = parser->lexer_->lookup_identifier - (Book::unsmob($1)->paper_ + (unsmob<Book>($1)->paper_ ? "toplevel-book-handler" : "toplevel-bookpart-handler"); scm_call_2 (proc, parser->self_scm (), $1); @@ -444,11 +444,11 @@ toplevel_expression: { SCM proc = parser->lexer_->lookup_identifier ("toplevel-text-handler"); scm_call_2 (proc, parser->self_scm (), out); - } else if (Score::is_smob ($1)) + } else if (unsmob<Score> ($1)) { SCM proc = parser->lexer_->lookup_identifier ("toplevel-score-handler"); scm_call_2 (proc, parser->self_scm (), $1); - } else if (Output_def * od = Output_def::unsmob ($1)) { + } else if (Output_def * od = unsmob<Output_def> ($1)) { SCM id = SCM_EOL; if (to_boolean (od->c_variable ("is-paper"))) @@ -464,7 +464,7 @@ toplevel_expression: } | output_def { SCM id = SCM_EOL; - Output_def * od = Output_def::unsmob ($1); + Output_def * od = unsmob<Output_def> ($1); if (to_boolean (od->c_variable ("is-paper"))) id = ly_symbol2scm ("$defaultpaper"); @@ -561,7 +561,7 @@ embedded_lilypond: | post_event post_events { $$ = scm_reverse_x ($2, SCM_EOL); - if (Music *m = Music::unsmob ($1)) + if (Music *m = unsmob<Music> ($1)) { if (m->is_mus_type ("post-event-wrapper")) $$ = scm_append @@ -583,9 +583,9 @@ embedded_lilypond: | multiplied_duration | music_embedded music_embedded music_list { $3 = scm_reverse_x ($3, SCM_EOL); - if (Music::is_smob ($2)) + if (unsmob<Music> ($2)) $3 = scm_cons ($2, $3); - if (Music::is_smob ($1)) + if (unsmob<Music> ($1)) $3 = scm_cons ($1, $3); $$ = MAKE_SYNTAX ("sequential-music", @$, $3); } @@ -647,7 +647,7 @@ identifier_init: | post_event_nofinger post_events { $$ = scm_reverse_x ($2, SCM_EOL); - if (Music *m = Music::unsmob ($1)) + if (Music *m = unsmob<Music> ($1)) { if (m->is_mus_type ("post-event-wrapper")) $$ = scm_append @@ -687,10 +687,10 @@ context_def_spec_block: CONTEXT '{' context_def_spec_body '}' { $$ = $3; - Context_def *td = Context_def::unsmob ($$); + Context_def *td = unsmob<Context_def> ($$); if (!td) { $$ = Context_def::make_scm (); - td = Context_def::unsmob ($$); + td = unsmob<Context_def> ($$); } td->origin ()->set_spot (@$); } @@ -717,41 +717,41 @@ context_def_spec_body: } | context_def_spec_body context_mod { if (!SCM_UNBNDP ($2)) { - Context_def *td = Context_def::unsmob ($$); + Context_def *td = unsmob<Context_def> ($$); if (!td) { $$ = Context_def::make_scm (); - td = Context_def::unsmob ($$); + td = unsmob<Context_def> ($$); } - Context_def::unsmob ($$)->add_context_mod ($2); + unsmob<Context_def> ($$)->add_context_mod ($2); } } | context_def_spec_body context_modification { - Context_def *td = Context_def::unsmob ($$); + Context_def *td = unsmob<Context_def> ($$); if (!td) { $$ = Context_def::make_scm (); - td = Context_def::unsmob ($$); + td = unsmob<Context_def> ($$); } - SCM new_mods = Context_mod::unsmob ($2)->get_mods (); + SCM new_mods = unsmob<Context_mod> ($2)->get_mods (); for (SCM m = new_mods; scm_is_pair (m); m = scm_cdr (m)) { td->add_context_mod (scm_car (m)); } } | context_def_spec_body context_mod_arg { - Context_def *td = Context_def::unsmob ($1); + Context_def *td = unsmob<Context_def> ($1); if (scm_is_eq ($2, SCM_UNSPECIFIED)) ; - else if (!td && Context_def::unsmob ($2)) + else if (!td && unsmob<Context_def> ($2)) $$ = $2; else { if (!td) { $$ = Context_def::make_scm (); - td = Context_def::unsmob ($$); + td = unsmob<Context_def> ($$); } - if (Music::is_smob ($2)) { + if (unsmob<Music> ($2)) { SCM proc = parser->lexer_->lookup_identifier ("context-mod-music-handler"); $2 = scm_call_2 (proc, parser->self_scm (), $2); } - if (Context_mod *cm = Context_mod::unsmob ($2)) { + if (Context_mod *cm = unsmob<Context_mod> ($2)) { for (SCM m = cm->get_mods (); scm_is_pair (m); m = scm_cdr (m)) { td->add_context_mod (scm_car (m)); } @@ -766,7 +766,7 @@ context_def_spec_body: book_block: BOOK '{' book_body '}' { $$ = $3; - Book::unsmob ($$)->origin ()->set_spot (@$); + unsmob<Book> ($$)->origin ()->set_spot (@$); pop_paper (parser); parser->lexer_->set_identifier (ly_symbol2scm ("$current-book"), SCM_BOOL_F); } @@ -779,7 +779,7 @@ book_body: { Book *book = new Book; init_papers (parser); - book->paper_ = dynamic_cast<Output_def*> (Output_def::unsmob (parser->lexer_->lookup_identifier ("$defaultpaper"))->clone ()); + book->paper_ = dynamic_cast<Output_def*> (unsmob<Output_def> (parser->lexer_->lookup_identifier ("$defaultpaper"))->clone ()); book->paper_->unprotect (); push_paper (parser, book->paper_); book->header_ = get_header (parser); @@ -790,8 +790,8 @@ book_body: parser->lexer_->set_identifier (ly_symbol2scm ("$current-book"), $1); } | book_body paper_block { - Book::unsmob ($1)->paper_ = Output_def::unsmob ($2); - set_paper (parser, Output_def::unsmob ($2)); + unsmob<Book> ($1)->paper_ = unsmob<Output_def> ($2); + set_paper (parser, unsmob<Output_def> ($2)); } | book_body bookpart_block { SCM proc = parser->lexer_->lookup_identifier ("book-bookpart-handler"); @@ -828,11 +828,11 @@ book_body: { SCM proc = parser->lexer_->lookup_identifier ("book-text-handler"); scm_call_2 (proc, $1, out); - } else if (Score::is_smob ($2)) + } else if (unsmob<Score> ($2)) { SCM proc = parser->lexer_->lookup_identifier ("book-score-handler"); scm_call_2 (proc, $1, $2); - } else if (Output_def *od = Output_def::unsmob ($2)) { + } else if (Output_def *od = unsmob<Output_def> ($2)) { SCM id = SCM_EOL; if (to_boolean (od->c_variable ("is-paper"))) @@ -848,10 +848,10 @@ book_body: } | book_body { - parser->lexer_->add_scope (Book::unsmob ($1)->header_); + parser->lexer_->add_scope (unsmob<Book> ($1)->header_); } lilypond_header | book_body error { - Book *book = Book::unsmob ($1); + Book *book = unsmob<Book> ($1); book->paper_ = 0; book->scores_ = SCM_EOL; book->bookparts_ = SCM_EOL; @@ -861,7 +861,7 @@ book_body: bookpart_block: BOOKPART '{' bookpart_body '}' { $$ = $3; - Book::unsmob ($$)->origin ()->set_spot (@$); + unsmob<Book> ($$)->origin ()->set_spot (@$); parser->lexer_->set_identifier (ly_symbol2scm ("$current-bookpart"), SCM_BOOL_F); } ; @@ -876,7 +876,7 @@ bookpart_body: parser->lexer_->set_identifier (ly_symbol2scm ("$current-bookpart"), $1); } | bookpart_body paper_block { - Book::unsmob ($$)->paper_ = Output_def::unsmob ($2); + unsmob<Book> ($$)->paper_ = unsmob<Output_def> ($2); } | bookpart_body score_block { SCM proc = parser->lexer_->lookup_identifier ("bookpart-score-handler"); @@ -909,11 +909,11 @@ bookpart_body: { SCM proc = parser->lexer_->lookup_identifier ("bookpart-text-handler"); scm_call_2 (proc, $1, out); - } else if (Score::is_smob ($2)) + } else if (unsmob<Score> ($2)) { SCM proc = parser->lexer_->lookup_identifier ("bookpart-score-handler"); scm_call_2 (proc, $1, $2); - } else if (Output_def *od = Output_def::unsmob ($2)) { + } else if (Output_def *od = unsmob<Output_def> ($2)) { SCM id = SCM_EOL; if (to_boolean (od->c_variable ("is-paper"))) @@ -929,13 +929,13 @@ bookpart_body: } | bookpart_body { - Book *book = Book::unsmob ($1); + Book *book = unsmob<Book> ($1); if (!ly_is_module (book->header_)) book->header_ = ly_make_module (false); parser->lexer_->add_scope (book->header_); } lilypond_header | bookpart_body error { - Book *book = Book::unsmob ($1); + Book *book = unsmob<Book> ($1); book->paper_ = 0; book->scores_ = SCM_EOL; } @@ -943,31 +943,31 @@ bookpart_body: score_block: SCORE '{' score_body '}' { - Score::unsmob ($3)->origin ()->set_spot (@$); + unsmob<Score> ($3)->origin ()->set_spot (@$); $$ = $3; } ; score_body: score_items { - if (!Score::is_smob ($1)) { + if (!unsmob<Score> ($1)) { parser->parser_error (@1, _("Missing music in \\score")); $$ = (new Score)->unprotect (); if (scm_is_pair ($1) && ly_is_module (scm_car ($1))) { - Score::unsmob ($$)->set_header (scm_car ($1)); + unsmob<Score> ($$)->set_header (scm_car ($1)); $1 = scm_cdr ($1); } for (SCM p = scm_reverse_x ($1, SCM_EOL); scm_is_pair (p); p = scm_cdr (p)) { - Score::unsmob ($$)-> - add_output_def (Output_def::unsmob (scm_car (p))); + unsmob<Score> ($$)-> + add_output_def (unsmob<Output_def> (scm_car (p))); } } } | score_body error { - Score::unsmob ($$)->error_found_ = true; + unsmob<Score> ($$)->error_found_ = true; } ; @@ -984,7 +984,7 @@ score_items: } | score_items score_item { - Output_def *od = Output_def::unsmob ($2); + Output_def *od = unsmob<Output_def> ($2); if (od) { if (to_boolean (od->lookup_variable (ly_symbol2scm ("is-paper")))) { @@ -992,18 +992,18 @@ score_items: od = 0; $2 = SCM_UNSPECIFIED; } - } else if (!Score::is_smob ($$)) { - if (Music::is_smob ($2)) { + } else if (!unsmob<Score> ($$)) { + if (unsmob<Music> ($2)) { SCM scorify = ly_lily_module_constant ("scorify-music"); $2 = scm_call_2 (scorify, $2, parser->self_scm ()); } - if (Score::is_smob ($2)) + if (unsmob<Score> ($2)) { $$ = $2; $2 = SCM_UNSPECIFIED; } } - Score *score = Score::unsmob ($$); + Score *score = unsmob<Score> ($$); if (score && scm_is_pair ($1)) { if (ly_is_module (scm_car ($1))) { @@ -1013,7 +1013,7 @@ score_items: for (SCM p = scm_reverse_x ($1, SCM_EOL); scm_is_pair (p); p = scm_cdr (p)) { - score->add_output_def (Output_def::unsmob (scm_car (p))); + score->add_output_def (unsmob<Output_def> (scm_car (p))); } } if (od) { @@ -1028,7 +1028,7 @@ score_items: } | score_items { - if (Score *score = Score::unsmob ($1)) { + if (Score *score = unsmob<Score> ($1)) { if (!ly_is_module (score->get_header ())) score->set_header (ly_make_module (false)); parser->lexer_->add_scope (score->get_header ()); @@ -1050,7 +1050,7 @@ score_items: paper_block: output_def { - Output_def *od = Output_def::unsmob ($1); + Output_def *od = unsmob<Output_def> ($1); if (!to_boolean (od->lookup_variable (ly_symbol2scm ("is-paper")))) { @@ -1110,7 +1110,7 @@ music_or_context_def: output_def_body: output_def_head_with_mode_switch '{' { - Output_def::unsmob ($1)->input_origin_.set_spot (@$); + unsmob<Output_def> ($1)->input_origin_.set_spot (@$); // This is a stupid trick to mark the beginning of the // body for deciding whether to allow // embedded_scm_active to have an output definition @@ -1127,7 +1127,7 @@ output_def_body: // definitions. if (scm_is_pair ($1)) { - Output_def *o = Output_def::unsmob ($2); + Output_def *o = unsmob<Output_def> ($2); if (o) { o->input_origin_.set_spot (@$); $1 = o->self_scm (); @@ -1137,10 +1137,10 @@ output_def_body: } else $1 = scm_car ($1); } - if (Context_def::is_smob ($2)) - assign_context_def (Output_def::unsmob ($1), $2); + if (unsmob<Context_def> ($2)) + assign_context_def (unsmob<Output_def> ($1), $2); // Seems unlikely, but let's be complete: - else if (Music::is_smob ($2)) + else if (unsmob<Music> ($2)) { SCM proc = parser->lexer_->lookup_identifier ("output-def-music-handler"); @@ -1165,8 +1165,8 @@ output_def_body: } music_or_context_def { parser->lexer_->pop_state (); - if (Context_def::is_smob ($3)) - assign_context_def (Output_def::unsmob ($1), $3); + if (unsmob<Context_def> ($3)) + assign_context_def (unsmob<Output_def> ($1), $3); else { SCM proc = parser->lexer_->lookup_identifier @@ -1201,7 +1201,7 @@ music_list: $$ = SCM_EOL; } | music_list music_embedded { - if (Music::is_smob ($2)) + if (unsmob<Music> ($2)) $$ = scm_cons ($2, $1); } | music_list error { @@ -1229,7 +1229,7 @@ pitch_as_music: pitch_or_music { $$ = make_music_from_simple (parser, @1, $1); - if (!Music::is_smob ($$)) + if (!unsmob<Music> ($$)) { parser->parser_error (@1, _ ("music expected")); $$ = MAKE_SYNTAX ("void-music", @$); @@ -1240,7 +1240,7 @@ pitch_as_music: music_embedded: music { - if (Music::unsmob ($1)->is_mus_type ("post-event")) { + if (unsmob<Music> ($1)->is_mus_type ("post-event")) { parser->parser_error (@1, _ ("unexpected post-event")); $$ = SCM_UNSPECIFIED; } @@ -1257,7 +1257,7 @@ music_embedded: { Music *n = MY_MAKE_MUSIC ("NoteEvent", @$); - parser->default_duration_ = *Duration::unsmob ($1); + parser->default_duration_ = *unsmob<Duration> ($1); n->set_property ("duration", $1); if (scm_is_pair ($2)) @@ -1272,7 +1272,7 @@ music_embedded_backup: { if (scm_is_eq ($1, SCM_UNSPECIFIED)) $$ = $1; - else if (Music *m = Music::unsmob ($1)) { + else if (Music *m = unsmob<Music> ($1)) { if (m->is_mus_type ("post-event")) { parser->parser_error (@1, _ ("unexpected post-event")); @@ -1351,11 +1351,11 @@ context_modification: } | WITH context_modification_arg { - if (Music::is_smob ($2)) { + if (unsmob<Music> ($2)) { SCM proc = parser->lexer_->lookup_identifier ("context-mod-music-handler"); $2 = scm_call_2 (proc, parser->self_scm (), $2); } - if (Context_mod::is_smob ($2)) + if (unsmob<Context_mod> ($2)) $$ = $2; else { parser->parser_error (@2, _ ("not a context mod")); @@ -1385,23 +1385,23 @@ context_mod_list: } | context_mod_list context_mod { if (!SCM_UNBNDP ($2)) - Context_mod::unsmob ($1)->add_context_mod ($2); + unsmob<Context_mod> ($1)->add_context_mod ($2); } | context_mod_list CONTEXT_MOD_IDENTIFIER { - Context_mod *md = Context_mod::unsmob ($2); + Context_mod *md = unsmob<Context_mod> ($2); if (md) - Context_mod::unsmob ($1)->add_context_mods (md->get_mods ()); + unsmob<Context_mod> ($1)->add_context_mods (md->get_mods ()); } | context_mod_list context_mod_arg { if (scm_is_eq ($2, SCM_UNSPECIFIED)) ; - else if (Music::is_smob ($2)) { + else if (unsmob<Music> ($2)) { SCM proc = parser->lexer_->lookup_identifier ("context-mod-music-handler"); $2 = scm_call_2 (proc, parser->self_scm (), $2); } - if (Context_mod::is_smob ($2)) - Context_mod::unsmob ($$)->add_context_mods - (Context_mod::unsmob ($2)->get_mods ()); + if (unsmob<Context_mod> ($2)) + unsmob<Context_mod> ($$)->add_context_mods + (unsmob<Context_mod> ($2)->get_mods ()); else { parser->parser_error (@2, _ ("not a context mod")); } @@ -1410,14 +1410,14 @@ context_mod_list: context_prefix: CONTEXT symbol optional_id optional_context_mod { - Context_mod *ctxmod = Context_mod::unsmob ($4); + Context_mod *ctxmod = unsmob<Context_mod> ($4); SCM mods = SCM_EOL; if (ctxmod) mods = ctxmod->get_mods (); $$ = START_MAKE_SYNTAX ("context-specification", $2, $3, mods, SCM_BOOL_F); } | NEWCONTEXT symbol optional_id optional_context_mod { - Context_mod *ctxmod = Context_mod::unsmob ($4); + Context_mod *ctxmod = unsmob<Context_mod> ($4); SCM mods = SCM_EOL; if (ctxmod) mods = ctxmod->get_mods (); @@ -2238,7 +2238,7 @@ mode_changed_music: parser->lexer_->pop_state (); } | mode_changing_head_with_context optional_context_mod grouped_music_list { - Context_mod *ctxmod = Context_mod::unsmob ($2); + Context_mod *ctxmod = unsmob<Context_mod> ($2); SCM mods = SCM_EOL; if (ctxmod) mods = ctxmod->get_mods (); @@ -2639,7 +2639,7 @@ event_chord: simple_element post_events { // Let the rhythmic music iterator sort this mess out. if (scm_is_pair ($2)) { - Music::unsmob ($$)->set_property ("articulations", + unsmob<Music> ($$)->set_property ("articulations", scm_reverse_x ($2, SCM_EOL)); } } %prec ':' @@ -2663,13 +2663,13 @@ event_chord: note_chord_element: chord_body optional_notemode_duration post_events { - Music *m = Music::unsmob ($1); - SCM dur = Duration::unsmob ($2)->smobbed_copy (); + Music *m = unsmob<Music> ($1); + SCM dur = unsmob<Duration> ($2)->smobbed_copy (); SCM es = m->get_property ("elements"); SCM postevs = scm_reverse_x ($3, SCM_EOL); for (SCM s = es; scm_is_pair (s); s = scm_cdr (s)) - Music::unsmob (scm_car (s))->set_property ("duration", dur); + unsmob<Music> (scm_car (s))->set_property ("duration", dur); es = ly_append2 (es, postevs); m-> set_property ("elements", es); @@ -2736,11 +2736,11 @@ chord_body_element: } | music_function_chord_body { - Music *m = Music::unsmob ($1); + Music *m = unsmob<Music> ($1); while (m && m->is_mus_type ("music-wrapper-music")) { $$ = m->get_property ("element"); - m = Music::unsmob ($$); + m = unsmob<Music> ($$); } if (!(m && m->is_mus_type ("rhythmic-event"))) { @@ -2769,7 +2769,7 @@ post_events: } | post_events post_event { $$ = $1; - if (Music *m = Music::unsmob ($2)) + if (Music *m = unsmob<Music> ($2)) { if (m->is_mus_type ("post-event-wrapper")) { @@ -2793,12 +2793,12 @@ post_event_nofinger: } | script_dir music_function_call { $$ = $2; - if (!Music::unsmob ($2)->is_mus_type ("post-event")) { + if (!unsmob<Music> ($2)->is_mus_type ("post-event")) { parser->parser_error (@2, _ ("post-event expected")); $$ = SCM_UNSPECIFIED; } else if (!SCM_UNBNDP ($1)) { - Music::unsmob ($$)->set_property ("direction", $1); + unsmob<Music> ($$)->set_property ("direction", $1); } } | HYPHEN { @@ -2814,7 +2814,7 @@ post_event_nofinger: | script_dir direction_reqd_event { if (!SCM_UNBNDP ($1)) { - Music *m = Music::unsmob ($2); + Music *m = unsmob<Music> ($2); m->set_property ("direction", $1); } $$ = $2; @@ -2822,7 +2822,7 @@ post_event_nofinger: | script_dir direction_less_event { if (!SCM_UNBNDP ($1)) { - Music *m = Music::unsmob ($2); + Music *m = unsmob<Music> ($2); m->set_property ("direction", $1); } $$ = $2; @@ -2830,12 +2830,12 @@ post_event_nofinger: | '^' fingering { $$ = $2; - Music::unsmob ($$)->set_property ("direction", scm_from_int (UP)); + unsmob<Music> ($$)->set_property ("direction", scm_from_int (UP)); } | '_' fingering { $$ = $2; - Music::unsmob ($$)->set_property ("direction", scm_from_int (DOWN)); + unsmob<Music> ($$)->set_property ("direction", scm_from_int (DOWN)); } ; @@ -2878,7 +2878,7 @@ direction_reqd_event: a->set_property ("articulation-type", s); $$ = a->unprotect (); } else { - Music *original = Music::unsmob (s); + Music *original = unsmob<Music> (s); if (original && original->is_mus_type ("post-event")) { Music *a = original->clone (); a->set_spot (parser->lexer_->override_input (@$)); @@ -2927,7 +2927,7 @@ steno_pitch: NOTENAME_PITCH quotes { if (!scm_is_eq (SCM_INUM0, $2)) { - Pitch p = *Pitch::unsmob ($1); + Pitch p = *unsmob<Pitch> ($1); p = p.transposed (Pitch (scm_to_int ($2), 0)); $$ = p.smobbed_copy (); } @@ -2942,7 +2942,7 @@ steno_tonic_pitch: TONICNAME_PITCH quotes { if (!scm_is_eq (SCM_INUM0, $2)) { - Pitch p = *Pitch::unsmob ($1); + Pitch p = *unsmob<Pitch> ($1); p = p.transposed (Pitch (scm_to_int ($2), 0)); $$ = p.smobbed_copy (); } @@ -2954,7 +2954,7 @@ pitch: | PITCH_IDENTIFIER quotes { if (!scm_is_eq (SCM_INUM0, $2)) { - Pitch p = *Pitch::unsmob ($1); + Pitch p = *unsmob<Pitch> ($1); p = p.transposed (Pitch (scm_to_int ($2), 0)); $$ = p.smobbed_copy (); } @@ -2980,7 +2980,7 @@ gen_text_def: } | embedded_scm { - Music *m = Music::unsmob ($1); + Music *m = unsmob<Music> ($1); if (m && m->is_mus_type ("post-event")) $$ = $1; else if (Text_interface::is_markup ($1)) { @@ -3042,7 +3042,7 @@ maybe_notemode_duration: } %prec ':' | multiplied_duration { $$ = $1; - parser->default_duration_ = *Duration::unsmob ($$); + parser->default_duration_ = *unsmob<Duration> ($$); } ; @@ -3065,7 +3065,7 @@ steno_duration: } } | DURATION_IDENTIFIER dots { - Duration *d = Duration::unsmob ($1); + Duration *d = unsmob<Duration> ($1); Duration k (d->duration_log (), d->dot_count () + scm_to_int ($2)); k = k.compressed (d->factor ()); @@ -3079,12 +3079,12 @@ multiplied_duration: $$ = $1; } | multiplied_duration '*' UNSIGNED { - $$ = Duration::unsmob ($$)->compressed (scm_to_int ($3)).smobbed_copy (); + $$ = unsmob<Duration> ($$)->compressed (scm_to_int ($3)).smobbed_copy (); } | multiplied_duration '*' FRACTION { Rational m (scm_to_int (scm_car ($3)), scm_to_int (scm_cdr ($3))); - $$ = Duration::unsmob ($$)->compressed (m).smobbed_copy (); + $$ = unsmob<Duration> ($$)->compressed (m).smobbed_copy (); } ; @@ -3154,10 +3154,10 @@ bass_figure: } | bass_figure ']' { $$ = $1; - Music::unsmob ($1)->set_property ("bracket-stop", SCM_BOOL_T); + unsmob<Music> ($1)->set_property ("bracket-stop", SCM_BOOL_T); } | bass_figure figured_bass_alteration { - Music *m = Music::unsmob ($1); + Music *m = unsmob<Music> ($1); if (scm_to_double ($2)) { SCM salter = m->get_property ("alteration"); SCM alter = scm_is_number (salter) ? salter : scm_from_int (0); @@ -3168,7 +3168,7 @@ bass_figure: } } | bass_figure figured_bass_modification { - Music *m = Music::unsmob ($1); + Music *m = unsmob<Music> ($1); m->set_property ($2, SCM_BOOL_T); } ; @@ -3195,7 +3195,7 @@ br_bass_figure: } | '[' bass_figure { $$ = $2; - Music::unsmob ($$)->set_property ("bracket-start", SCM_BOOL_T); + unsmob<Music> ($$)->set_property ("bracket-start", SCM_BOOL_T); } ; @@ -3257,7 +3257,7 @@ pitch_or_music: if (!parser->lexer_->is_chord_state ()) parser->parser_error (@1, _ ("have to be in Chord mode for chords")); if (scm_is_pair ($2)) { - if (Pitch::is_smob ($1)) + if (unsmob<Pitch> ($1)) $1 = make_chord_elements (@1, $1, parser->default_duration_.smobbed_copy (), @@ -3266,7 +3266,7 @@ pitch_or_music: SCM elts = ly_append2 ($1, scm_reverse_x ($2, SCM_EOL)); $$ = MAKE_SYNTAX ("event-chord", @1, elts); - } else if (!Pitch::is_smob ($1)) + } else if (!unsmob<Pitch> ($1)) $$ = MAKE_SYNTAX ("event-chord", @1, $1); // A mere pitch drops through. } %prec ':' @@ -3313,7 +3313,7 @@ lyric_element_music: lyric_element optional_notemode_duration post_events { $$ = MAKE_SYNTAX ("lyric-event", @$, $1, $2); if (scm_is_pair ($3)) - Music::unsmob ($$)->set_property + unsmob<Music> ($$)->set_property ("articulations", scm_reverse_x ($3, SCM_EOL)); } %prec ':' ; @@ -3567,7 +3567,7 @@ markup_uncomposed_list: SCM nn = parser->lexer_->lookup_identifier ("pitchnames"); parser->lexer_->push_note_state (nn); } '{' score_body '}' { - Score *sc = Score::unsmob ($4); + Score *sc = unsmob<Score> ($4); sc->origin ()->set_spot (@$); if (sc->defs_.empty ()) { Output_def *od = get_layout (parser); @@ -3650,7 +3650,7 @@ simple_markup: SCM nn = parser->lexer_->lookup_identifier ("pitchnames"); parser->lexer_->push_note_state (nn); } '{' score_body '}' { - Score *sc = Score::unsmob ($4); + Score *sc = unsmob<Score> ($4); sc->origin ()->set_spot (@$); if (sc->defs_.empty ()) { Output_def *od = get_layout (parser); @@ -3709,8 +3709,8 @@ otherwise, we have to import music classes into the lexer. int Lily_lexer::try_special_identifiers (SCM *destination, SCM sid) { - if (Book::is_smob (sid)) { - Book *book = Book::unsmob (sid)->clone (); + if (unsmob<Book> (sid)) { + Book *book = unsmob<Book> (sid)->clone (); *destination = book->self_scm (); book->unprotect (); @@ -3718,30 +3718,30 @@ Lily_lexer::try_special_identifiers (SCM *destination, SCM sid) } else if (scm_is_number (sid)) { *destination = sid; return NUMBER_IDENTIFIER; - } else if (Context_def::is_smob (sid)) + } else if (unsmob<Context_def> (sid)) { - *destination = Context_def::unsmob (sid)->clone ()->unprotect (); + *destination = unsmob<Context_def> (sid)->clone ()->unprotect (); return SCM_IDENTIFIER; - } else if (Context_mod::is_smob (sid)) { - *destination = Context_mod::unsmob (sid)->smobbed_copy (); + } else if (unsmob<Context_mod> (sid)) { + *destination = unsmob<Context_mod> (sid)->smobbed_copy (); return CONTEXT_MOD_IDENTIFIER; - } else if (Music *mus = Music::unsmob (sid)) { + } else if (Music *mus = unsmob<Music> (sid)) { mus = mus->clone (); *destination = mus->self_scm (); bool is_event = mus->is_mus_type ("post-event"); mus->unprotect (); return is_event ? EVENT_IDENTIFIER : MUSIC_IDENTIFIER; - } else if (Pitch::is_smob (sid)) { - *destination = Pitch::unsmob (sid)->smobbed_copy (); + } else if (unsmob<Pitch> (sid)) { + *destination = unsmob<Pitch> (sid)->smobbed_copy (); return PITCH_IDENTIFIER; - } else if (Duration::is_smob (sid)) { - *destination = Duration::unsmob (sid)->smobbed_copy (); + } else if (unsmob<Duration> (sid)) { + *destination = unsmob<Duration> (sid)->smobbed_copy (); return DURATION_IDENTIFIER; - } else if (Output_def::is_smob (sid)) { - *destination = Output_def::unsmob (sid)->clone ()->unprotect (); + } else if (unsmob<Output_def> (sid)) { + *destination = unsmob<Output_def> (sid)->clone ()->unprotect (); return SCM_IDENTIFIER; - } else if (Score::is_smob (sid)) { - *destination = Score::unsmob (sid)->clone ()->unprotect (); + } else if (unsmob<Score> (sid)) { + *destination = unsmob<Score> (sid)->clone ()->unprotect (); return SCM_IDENTIFIER; } @@ -3798,7 +3798,7 @@ SCM check_scheme_arg (Lily_parser *parser, Input loc, SCM loc_on_music (Input loc, SCM arg) { - if (Music *m = Music::unsmob (arg)) + if (Music *m = unsmob<Music> (arg)) { m = m->clone (); m->set_spot (loc); @@ -3877,7 +3877,7 @@ is_regular_identifier (SCM id, bool multiple) SCM make_music_from_simple (Lily_parser *parser, Input loc, SCM simple) { - if (Music::is_smob (simple)) + if (unsmob<Music> (simple)) return simple; if (parser->lexer_->is_note_state ()) { if (scm_is_symbol (simple)) { @@ -3886,7 +3886,7 @@ make_music_from_simple (Lily_parser *parser, Input loc, SCM simple) n->set_property ("drum-type", simple); return n->unprotect (); } - if (Pitch::is_smob (simple)) { + if (unsmob<Pitch> (simple)) { Music *n = MY_MAKE_MUSIC ("NoteEvent", loc); n->set_property ("duration", parser->default_duration_.smobbed_copy ()); n->set_property ("pitch", simple); @@ -3898,7 +3898,7 @@ make_music_from_simple (Lily_parser *parser, Input loc, SCM simple) return MAKE_SYNTAX ("lyric-event", loc, simple, parser->default_duration_.smobbed_copy ()); } else if (parser->lexer_->is_chord_state ()) { - if (Pitch::is_smob (simple)) + if (unsmob<Pitch> (simple)) return MAKE_SYNTAX ("event-chord", loc, @@ -3955,7 +3955,7 @@ make_chord_elements (Input loc, SCM pitch, SCM dur, SCM modification_list) SCM res = scm_call_3 (chord_ctor, pitch, dur, modification_list); for (SCM s = res; scm_is_pair (s); s = scm_cdr (s)) { - Music::unsmob (scm_car (s))->set_spot (loc); + unsmob<Music> (scm_car (s))->set_spot (loc); } return res; } diff --git a/lily/part-combine-iterator.cc b/lily/part-combine-iterator.cc index 065ee1bce2..08dc43bc52 100644 --- a/lily/part-combine-iterator.cc +++ b/lily/part-combine-iterator.cc @@ -304,10 +304,10 @@ Part_combine_iterator::construct_children () SCM lst = get_music ()->get_property ("elements"); Context *one = handles_[CONTEXT_ONE].get_context (); set_context (one); - first_iter_ = Music_iterator::unsmob (get_iterator (Music::unsmob (scm_car (lst)))); + first_iter_ = unsmob<Music_iterator> (get_iterator (unsmob<Music> (scm_car (lst)))); Context *two = handles_[CONTEXT_TWO].get_context (); set_context (two); - second_iter_ = Music_iterator::unsmob (get_iterator (Music::unsmob (scm_cadr (lst)))); + second_iter_ = unsmob<Music_iterator> (get_iterator (unsmob<Music> (scm_cadr (lst)))); Context *shared = handles_[CONTEXT_SHARED].get_context (); set_context (shared); } @@ -318,7 +318,7 @@ Part_combine_iterator::set_busy (SCM se) if (!notice_busy_) return; - Stream_event *e = Stream_event::unsmob (se); + Stream_event *e = unsmob<Stream_event> (se); if (e->in_event_class ("note-event") || e->in_event_class ("cluster-note-event")) busy_ = true; @@ -353,7 +353,7 @@ Part_combine_iterator::process (Moment m) for (; scm_is_pair (split_list_); split_list_ = scm_cdr (split_list_)) { - splitm = Moment::unsmob (scm_caar (split_list_)); + splitm = unsmob<Moment> (scm_caar (split_list_)); if (splitm && *splitm + start_moment_ > now) break; diff --git a/lily/partial-iterator.cc b/lily/partial-iterator.cc index 7d1c44fcac..798dd3f069 100644 --- a/lily/partial-iterator.cc +++ b/lily/partial-iterator.cc @@ -38,7 +38,7 @@ void Partial_iterator::process (Moment m) { if (Duration * dur - = Duration::unsmob (get_music ()->get_property ("duration"))) + = unsmob<Duration> (get_music ()->get_property ("duration"))) { Moment length = Moment (dur->get_length ()); @@ -52,7 +52,7 @@ Partial_iterator::process (Moment m) // work since the Timing_translator does not set // measurePosition when initializing. - Context *timing = Context::unsmob + Context *timing = unsmob<Context> (scm_call_2 (ly_lily_module_constant ("ly:context-find"), get_outlet ()->self_scm (), ly_symbol2scm ("Timing"))); @@ -91,7 +91,7 @@ Partial_iterator::finalization (SCM ctx, SCM length) { LY_ASSERT_SMOB (Context, ctx, 1); LY_ASSERT_SMOB (Moment, length, 2); - Context *timing = Context::unsmob + Context *timing = unsmob<Context> (scm_call_2 (ly_lily_module_constant ("ly:context-find"), ctx, ly_symbol2scm ("Timing"))); @@ -103,7 +103,7 @@ Partial_iterator::finalization (SCM ctx, SCM length) Rational (0)); mp.main_part_ = measure_length (timing); timing->set_property ("measurePosition", - (mp - *Moment::unsmob (length)).smobbed_copy ()); + (mp - *unsmob<Moment> (length)).smobbed_copy ()); timing->unset_property (ly_symbol2scm ("partialBusy")); return SCM_UNSPECIFIED; diff --git a/lily/percent-repeat-engraver.cc b/lily/percent-repeat-engraver.cc index 03bd86b9cf..895e06981e 100644 --- a/lily/percent-repeat-engraver.cc +++ b/lily/percent-repeat-engraver.cc @@ -73,7 +73,7 @@ Percent_repeat_engraver::start_translation_timestep () if (now_mom ().main_part_ != command_moment_.main_part_) { first_command_column_ - = Grob::unsmob (get_property ("currentCommandColumn")); + = unsmob<Grob> (get_property ("currentCommandColumn")); command_moment_ = now_mom (); } diff --git a/lily/percent-repeat-item.cc b/lily/percent-repeat-item.cc index 0b88a8cb45..6799abc9ca 100644 --- a/lily/percent-repeat-item.cc +++ b/lily/percent-repeat-item.cc @@ -69,7 +69,7 @@ MAKE_SCHEME_CALLBACK (Percent_repeat_item_interface, double_percent, 1); SCM Percent_repeat_item_interface::double_percent (SCM grob) { - Grob *me = Grob::unsmob (grob); + Grob *me = unsmob<Grob> (grob); Stencil m = x_percent (me, 2); m.translate_axis (-m.extent (X_AXIS).center (), X_AXIS); return m.smobbed_copy (); @@ -79,8 +79,8 @@ MAKE_SCHEME_CALLBACK (Percent_repeat_item_interface, beat_slash, 1); SCM Percent_repeat_item_interface::beat_slash (SCM grob) { - Grob *me = Grob::unsmob (grob); - Stream_event *cause = Stream_event::unsmob (me->get_property ("cause")); + Grob *me = unsmob<Grob> (grob); + Stream_event *cause = unsmob<Stream_event> (me->get_property ("cause")); int count = robust_scm2int (cause->get_property ("slash-count"), 1); Stencil m; diff --git a/lily/performance-scheme.cc b/lily/performance-scheme.cc index ed42635756..9ab087a2c3 100644 --- a/lily/performance-scheme.cc +++ b/lily/performance-scheme.cc @@ -26,7 +26,7 @@ LY_DEFINE (ly_performance_write, "ly:performance-write", LY_ASSERT_SMOB (Performance, performance, 1); LY_ASSERT_TYPE (scm_is_string, filename, 2); - Performance::unsmob (performance)->write_output (ly_scm2string (filename)); + unsmob<Performance> (performance)->write_output (ly_scm2string (filename)); return SCM_UNSPECIFIED; } diff --git a/lily/performer-group.cc b/lily/performer-group.cc index 794fdaf48f..5502bf0958 100644 --- a/lily/performer-group.cc +++ b/lily/performer-group.cc @@ -58,7 +58,7 @@ Performer_group::acknowledge_audio_elements () for (SCM p = get_simple_trans_list (); scm_is_pair (p); p = scm_cdr (p)) { - Translator *t = Translator::unsmob (scm_car (p)); + Translator *t = unsmob<Translator> (scm_car (p)); Performer *eng = dynamic_cast<Performer *> (t); if (eng && eng != info.origin_trans_) eng->acknowledge_audio_element (info); @@ -71,7 +71,7 @@ performer_each (SCM list, Performer_method method) { for (SCM p = list; scm_is_pair (p); p = scm_cdr (p)) { - Performer *e = Performer::unsmob (scm_car (p)); + Performer *e = unsmob<Performer> (scm_car (p)); if (e) (e->*method) (); } @@ -83,7 +83,7 @@ Performer_group::do_announces () for (SCM s = context ()->children_contexts (); scm_is_pair (s); s = scm_cdr (s)) { - Context *c = Context::unsmob (scm_car (s)); + Context *c = unsmob<Context> (scm_car (s)); Performer_group *group = dynamic_cast<Performer_group *> (c->implementation ()); if (group) diff --git a/lily/piano-pedal-align-engraver.cc b/lily/piano-pedal-align-engraver.cc index 5b98c34205..0be5ff4b17 100644 --- a/lily/piano-pedal-align-engraver.cc +++ b/lily/piano-pedal-align-engraver.cc @@ -238,7 +238,7 @@ Piano_pedal_align_engraver::finalize () if (pedal_info_[i].line_spanner_) { SCM cc = get_property ("currentCommandColumn"); - Item *c = Item::unsmob (cc); + Item *c = unsmob<Item> (cc); pedal_info_[i].line_spanner_->set_bound (RIGHT, c); pedal_info_[i].clear (); diff --git a/lily/piano-pedal-bracket.cc b/lily/piano-pedal-bracket.cc index 3eecc6fa83..f58a130f75 100644 --- a/lily/piano-pedal-bracket.cc +++ b/lily/piano-pedal-bracket.cc @@ -33,7 +33,7 @@ MAKE_SCHEME_CALLBACK (Piano_pedal_bracket, print, 1); SCM Piano_pedal_bracket::print (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); Spanner *orig = dynamic_cast<Spanner *> (me->original ()); Drul_array<bool> broken (false, false); @@ -46,7 +46,7 @@ Piano_pedal_bracket::print (SCM smob) Grob *common = me->get_bound (LEFT) ->common_refpoint (me->get_bound (RIGHT), X_AXIS); - Grob *textbit = Grob::unsmob (me->get_object ("pedal-text")); + Grob *textbit = unsmob<Grob> (me->get_object ("pedal-text")); if (textbit) common = common->common_refpoint (textbit, X_AXIS); diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index 1cad3323be..2fb99407d5 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -346,7 +346,7 @@ Piano_pedal_engraver::create_bracket_grobs (Pedal_info *p, bool mixed) { assert (!p->finished_bracket_); - Grob *cmc = Grob::unsmob (get_property ("currentMusicalColumn")); + Grob *cmc = unsmob<Grob> (get_property ("currentMusicalColumn")); p->bracket_->set_bound (RIGHT, cmc); /* @@ -424,7 +424,7 @@ Piano_pedal_engraver::finalize () if (p->bracket_) { SCM cc = get_property ("currentCommandColumn"); - Item *c = Item::unsmob (cc); + Item *c = unsmob<Item> (cc); p->bracket_->set_bound (RIGHT, c); p->finished_bracket_ = p->bracket_; @@ -444,7 +444,7 @@ Piano_pedal_engraver::stop_translation_timestep () typeset_all (p); if (p->bracket_ && !p->bracket_->get_bound (LEFT)) { - Grob *cmc = Grob::unsmob (get_property ("currentMusicalColumn")); + Grob *cmc = unsmob<Grob> (get_property ("currentMusicalColumn")); p->bracket_->set_bound (LEFT, cmc); } } @@ -473,7 +473,7 @@ Piano_pedal_engraver::typeset_all (Pedal_info *p) { Grob *r = p->finished_bracket_->get_bound (RIGHT); if (!r) - p->finished_bracket_->set_bound (RIGHT, Grob::unsmob (get_property ("currentMusicalColumn"))); + p->finished_bracket_->set_bound (RIGHT, unsmob<Grob> (get_property ("currentMusicalColumn"))); p->finished_bracket_ = 0; } diff --git a/lily/pitch-scheme.cc b/lily/pitch-scheme.cc index 16f11c983e..7b4d1e3929 100644 --- a/lily/pitch-scheme.cc +++ b/lily/pitch-scheme.cc @@ -27,8 +27,8 @@ LY_DEFINE (ly_pitch_transpose, "ly:pitch-transpose", LY_ASSERT_SMOB (Pitch, p, 1); LY_ASSERT_SMOB (Pitch, delta, 2); - Pitch *t = Pitch::unsmob (p); - Pitch *d = Pitch::unsmob (delta); + Pitch *t = unsmob<Pitch> (p); + Pitch *d = unsmob<Pitch> (delta); return t->transposed (*d).smobbed_copy (); } @@ -59,7 +59,7 @@ LY_DEFINE (ly_pitch_negate, "ly:pitch-negate", 1, 0, 0, "Negate @var{p}.") { LY_ASSERT_SMOB (Pitch, p, 1); - Pitch *pp = Pitch::unsmob (p); + Pitch *pp = unsmob<Pitch> (p); return pp->negated ().smobbed_copy (); } @@ -69,7 +69,7 @@ LY_DEFINE (ly_pitch_steps, "ly:pitch-steps", 1, 0, 0, " pitch@tie{}@var{p}.") { LY_ASSERT_SMOB (Pitch, p, 1); - Pitch *pp = Pitch::unsmob (p); + Pitch *pp = unsmob<Pitch> (p); return scm_from_int (pp->steps ()); } @@ -78,7 +78,7 @@ LY_DEFINE (ly_pitch_octave, "ly:pitch-octave", "Extract the octave from pitch@tie{}@var{pp}.") { LY_ASSERT_SMOB (Pitch, pp, 1); - Pitch *p = Pitch::unsmob (pp); + Pitch *p = unsmob<Pitch> (pp); int q = p->get_octave (); return scm_from_int (q); } @@ -88,7 +88,7 @@ LY_DEFINE (ly_pitch_alteration, "ly:pitch-alteration", "Extract the alteration from pitch@tie{}@var{pp}.") { LY_ASSERT_SMOB (Pitch, pp, 1); - Pitch *p = Pitch::unsmob (pp); + Pitch *p = unsmob<Pitch> (pp); Rational q = p->get_alteration (); return ly_rational2scm (q); @@ -99,7 +99,7 @@ LY_DEFINE (ly_pitch_notename, "ly:pitch-notename", "Extract the note name from pitch @var{pp}.") { LY_ASSERT_SMOB (Pitch, pp, 1); - Pitch *p = Pitch::unsmob (pp); + Pitch *p = unsmob<Pitch> (pp); int q = p->get_notename (); return scm_from_int (q); } @@ -110,7 +110,7 @@ LY_DEFINE (ly_pitch_tones, "ly:pitch-tones", " middle@tie{}C as a rational number.") { LY_ASSERT_SMOB (Pitch, pp, 1); - return ly_rational2scm (Pitch::unsmob (pp)->tone_pitch ()); + return ly_rational2scm (unsmob<Pitch> (pp)->tone_pitch ()); } LY_DEFINE (ly_pitch_quartertones, "ly:pitch-quartertones", @@ -119,7 +119,7 @@ LY_DEFINE (ly_pitch_quartertones, "ly:pitch-quartertones", " middle@tie{}C.") { LY_ASSERT_SMOB (Pitch, pp, 1); - Pitch *p = Pitch::unsmob (pp); + Pitch *p = unsmob<Pitch> (pp); int q = p->rounded_quartertone_pitch (); return scm_from_int (q); } @@ -130,7 +130,7 @@ LY_DEFINE (ly_pitch_semitones, "ly:pitch-semitones", " middle@tie{}C.") { LY_ASSERT_SMOB (Pitch, pp, 1); - Pitch *p = Pitch::unsmob (pp); + Pitch *p = unsmob<Pitch> (pp); int q = p->rounded_semitone_pitch (); return scm_from_int (q); } @@ -142,8 +142,8 @@ LY_DEFINE (ly_pitch_less_p, "ly:pitch<?", LY_ASSERT_SMOB (Pitch, p1, 1); LY_ASSERT_SMOB (Pitch, p2, 2); - Pitch *a = Pitch::unsmob (p1); - Pitch *b = Pitch::unsmob (p2); + Pitch *a = unsmob<Pitch> (p1); + Pitch *b = unsmob<Pitch> (p2); if (Pitch::compare (*a, *b) < 0) return SCM_BOOL_T; @@ -160,8 +160,8 @@ LY_DEFINE (ly_pitch_diff, "ly:pitch-diff", LY_ASSERT_SMOB (Pitch, pitch, 1); LY_ASSERT_SMOB (Pitch, root, 2); - Pitch *p = Pitch::unsmob (pitch); - Pitch *r = Pitch::unsmob (root); + Pitch *p = unsmob<Pitch> (pitch); + Pitch *r = unsmob<Pitch> (root); return pitch_interval (*r, *p).smobbed_copy (); } @@ -176,7 +176,7 @@ LY_DEFINE (ly_set_middle_C_x, "ly:set-middle-C!", { LY_ASSERT_SMOB (Context, context, 1); - Context *c = Context::unsmob (context); + Context *c = unsmob<Context> (context); int clef_pos = robust_scm2int (c->get_property ("middleCClefPosition"), 0); int offset = robust_scm2int (c->get_property ("middleCOffset"), 0); /* middleCCuePosition overrides the clef! */ diff --git a/lily/pitch.cc b/lily/pitch.cc index 0fd7512947..1415178372 100644 --- a/lily/pitch.cc +++ b/lily/pitch.cc @@ -252,8 +252,8 @@ MAKE_SCHEME_CALLBACK (Pitch, less_p, 2); SCM Pitch::less_p (SCM p1, SCM p2) { - Pitch *a = Pitch::unsmob (p1); - Pitch *b = Pitch::unsmob (p2); + Pitch *a = unsmob<Pitch> (p1); + Pitch *b = unsmob<Pitch> (p2); if (compare (*a, *b) < 0) return SCM_BOOL_T; diff --git a/lily/pitched-trill-engraver.cc b/lily/pitched-trill-engraver.cc index 4f4fad2325..ac9e4dfd4d 100644 --- a/lily/pitched-trill-engraver.cc +++ b/lily/pitched-trill-engraver.cc @@ -88,7 +88,7 @@ Pitched_trill_engraver::acknowledge_trill_spanner (Grob_info info) if (ev && ev->in_event_class ("trill-span-event") && to_dir (ev->get_property ("span-direction")) == START - && Pitch::is_smob (ev->get_property ("pitch"))) + && unsmob<Pitch> (ev->get_property ("pitch"))) make_trill (ev); } @@ -96,7 +96,7 @@ void Pitched_trill_engraver::make_trill (Stream_event *ev) { SCM scm_pitch = ev->get_property ("pitch"); - Pitch *p = Pitch::unsmob (scm_pitch); + Pitch *p = unsmob<Pitch> (scm_pitch); SCM keysig = get_property ("localAlterations"); @@ -132,7 +132,7 @@ Pitched_trill_engraver::make_trill (Stream_event *ev) int c0 = scm_is_number (c0scm) ? scm_to_int (c0scm) : 0; trill_head_->set_property ("staff-position", - scm_from_int (Pitch::unsmob (scm_pitch)->steps () + scm_from_int (unsmob<Pitch> (scm_pitch)->steps () + c0)); trill_group_ = make_item ("TrillPitchGroup", ev->self_scm ()); diff --git a/lily/pointer-group-interface-scheme.cc b/lily/pointer-group-interface-scheme.cc index 02be37d814..a111aad58c 100644 --- a/lily/pointer-group-interface-scheme.cc +++ b/lily/pointer-group-interface-scheme.cc @@ -28,9 +28,9 @@ LY_DEFINE (ly_pointer_group_interface__add_grob, "ly:pointer-group-interface::ad LY_ASSERT_TYPE (ly_is_symbol, sym, 2); LY_ASSERT_SMOB (Grob, grob_element, 3); - Pointer_group_interface::add_grob (Grob::unsmob (grob), + Pointer_group_interface::add_grob (unsmob<Grob> (grob), sym, - Grob::unsmob (grob_element)); + unsmob<Grob> (grob_element)); return SCM_UNSPECIFIED; } diff --git a/lily/pointer-group-interface.cc b/lily/pointer-group-interface.cc index 73cf9fd6a9..2720fcf91a 100644 --- a/lily/pointer-group-interface.cc +++ b/lily/pointer-group-interface.cc @@ -25,14 +25,14 @@ int Pointer_group_interface::count (Grob *me, SCM sym) { - Grob_array *arr = Grob_array::unsmob (me->internal_get_object (sym)); + Grob_array *arr = unsmob<Grob_array> (me->internal_get_object (sym)); return arr ? arr->size () : 0; } void Pointer_group_interface::add_grob (Grob *me, SCM sym, SCM p) { - add_grob (me, sym, Grob::unsmob (p)); + add_grob (me, sym, unsmob<Grob> (p)); } void @@ -46,11 +46,11 @@ Grob_array * Pointer_group_interface::get_grob_array (Grob *me, SCM sym) { SCM scm_arr = me->internal_get_object (sym); - Grob_array *arr = Grob_array::unsmob (scm_arr); + Grob_array *arr = unsmob<Grob_array> (scm_arr); if (!arr) { scm_arr = Grob_array::make_array (); - arr = Grob_array::unsmob (scm_arr); + arr = unsmob<Grob_array> (scm_arr); me->set_object (sym, scm_arr); } return arr; @@ -88,7 +88,7 @@ static vector<Grob *> empty_array; vector<Grob *> const & ly_scm2link_array (SCM x) { - Grob_array *arr = Grob_array::unsmob (x); + Grob_array *arr = unsmob<Grob_array> (x); return arr ? arr->array () : empty_array; } @@ -103,7 +103,7 @@ internal_extract_grob_array (Grob const *elt, SCM symbol) vector<Item *> internal_extract_item_array (Grob const *elt, SCM symbol) { - Grob_array *arr = Grob_array::unsmob (elt->internal_get_object (symbol)); + Grob_array *arr = unsmob<Grob_array> (elt->internal_get_object (symbol)); vector<Item *> items; for (vsize i = 0; arr && i < arr->size (); i++) items.push_back (arr->item (i)); diff --git a/lily/prob-scheme.cc b/lily/prob-scheme.cc index 82e4fbdca3..03c84eca4d 100644 --- a/lily/prob-scheme.cc +++ b/lily/prob-scheme.cc @@ -24,7 +24,7 @@ LY_DEFINE (ly_prob_set_property_x, "ly:prob-set-property!", "Set property @var{sym} of @var{obj} to @var{value}.") { LY_ASSERT_SMOB (Prob, obj, 1); - Prob *ps = Prob::unsmob (obj); + Prob *ps = unsmob<Prob> (obj); LY_ASSERT_TYPE (ly_is_symbol, sym, 2); ps->set_property (sym, value); @@ -48,7 +48,7 @@ LY_DEFINE (ly_prob_property, "ly:prob-property", " @code{'()} if @var{val} is not specified.") { LY_ASSERT_SMOB (Prob, prob, 1); - Prob *ps = Prob::unsmob (prob); + Prob *ps = unsmob<Prob> (prob); LY_ASSERT_TYPE (ly_is_symbol, sym, 2); if (SCM_UNBNDP (val)) @@ -66,7 +66,7 @@ LY_DEFINE (ly_prob_type_p, "ly:prob-type?", (SCM obj, SCM type), "Is @var{obj} the specified prob-type?") { - Prob *prob = Prob::unsmob (obj); + Prob *prob = unsmob<Prob> (obj); return scm_from_bool (prob && prob->type () == type); } @@ -95,7 +95,7 @@ LY_DEFINE (ly_prob_mutable_properties, "ly:prob-mutable-properties", "Retrieve an alist of mutable properties.") { LY_ASSERT_SMOB (Prob, prob, 1); - Prob *ps = Prob::unsmob (prob); + Prob *ps = unsmob<Prob> (prob); return ps->get_property_alist (true); } @@ -105,7 +105,7 @@ LY_DEFINE (ly_prob_immutable_properties, "ly:prob-immutable-properties", "Retrieve an alist of immutable properties.") { LY_ASSERT_SMOB (Prob, prob, 1); - Prob *ps = Prob::unsmob (prob); + Prob *ps = unsmob<Prob> (prob); return ps->get_property_alist (false); } diff --git a/lily/prob.cc b/lily/prob.cc index a7245c653f..24ce604db9 100644 --- a/lily/prob.cc +++ b/lily/prob.cc @@ -36,7 +36,7 @@ Prob::equal_p (SCM sa, SCM sb) equality; e.g., that two probs are equal iff they can be distinguished by calls to ly:prob-property. */ - Prob *probs[2] = {Prob::unsmob (sa), Prob::unsmob (sb)}; + Prob *probs[2] = {unsmob<Prob> (sa), unsmob<Prob> (sb)}; SCM props[2][2]; int i; @@ -62,7 +62,7 @@ Prob::equal_p (SCM sa, SCM sb) SCM aval = scm_cdar (aprop); SCM bval = scm_cdar (bprop); if (!scm_is_eq (scm_caar (aprop), scm_caar (bprop)) - || (!(Input::is_smob (aval) && Input::is_smob (bval)) + || (!(unsmob<Input> (aval) && unsmob<Input> (bval)) && !ly_is_equal (aval, bval))) return SCM_BOOL_F; } diff --git a/lily/property-iterator.cc b/lily/property-iterator.cc index bb1d3b4c18..bf95ee21eb 100644 --- a/lily/property-iterator.cc +++ b/lily/property-iterator.cc @@ -89,8 +89,8 @@ MAKE_SCHEME_CALLBACK (Property_iterator, once_finalization, 3); SCM Property_iterator::once_finalization (SCM ctx, SCM music, SCM previous_value) { - Music *m = Music::unsmob (music); - Context *c = Context::unsmob (ctx); + Music *m = unsmob<Music> (music); + Context *c = unsmob<Context> (ctx); // Do not use UnsetProperty, which sets the default, but rather // cache the value before the \once \set command and restore it now @@ -159,8 +159,8 @@ MAKE_SCHEME_CALLBACK (Push_property_iterator, once_finalization, 2); SCM Push_property_iterator::once_finalization (SCM ctx, SCM music) { - Music *mus = Music::unsmob (music); - Context *c = Context::unsmob (ctx); + Music *mus = unsmob<Music> (music); + Context *c = unsmob<Context> (ctx); SCM sym = mus->get_property ("symbol"); if (check_grob (mus, sym)) diff --git a/lily/pure-from-neighbor-interface.cc b/lily/pure-from-neighbor-interface.cc index e4be5c4db1..d78d8d619c 100644 --- a/lily/pure-from-neighbor-interface.cc +++ b/lily/pure-from-neighbor-interface.cc @@ -31,7 +31,7 @@ MAKE_SCHEME_CALLBACK (Pure_from_neighbor_interface, calc_pure_relevant_grobs, 1) SCM Pure_from_neighbor_interface::calc_pure_relevant_grobs (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set ((me->original () && me->original ()->is_live () ? me->original () : me), @@ -42,10 +42,10 @@ Pure_from_neighbor_interface::calc_pure_relevant_grobs (SCM smob) new_elts.insert (new_elts.end (), elts.begin (), elts.end ()); SCM neighbors_scm = me->get_object ("neighbors"); - if (Grob_array::is_smob (neighbors_scm)) + if (unsmob<Grob_array> (neighbors_scm)) { vector<Grob *> &arr - = Grob_array::unsmob (neighbors_scm)->array_reference (); + = unsmob<Grob_array> (neighbors_scm)->array_reference (); arr = new_elts; } diff --git a/lily/quote-iterator.cc b/lily/quote-iterator.cc index c68e223456..c433625011 100644 --- a/lily/quote-iterator.cc +++ b/lily/quote-iterator.cc @@ -194,7 +194,7 @@ Moment Quote_iterator::vector_moment (int idx) const { SCM entry = scm_c_vector_ref (event_vector_, idx); - return *Moment::unsmob (scm_caar (entry)); + return *unsmob<Moment> (scm_caar (entry)); } void @@ -235,15 +235,15 @@ Quote_iterator::process (Moment m) if (quote_ok ()) { SCM entry = scm_c_vector_ref (event_vector_, event_idx_); - Pitch *quote_pitch = Pitch::unsmob (scm_cdar (entry)); + Pitch *quote_pitch = unsmob<Pitch> (scm_cdar (entry)); /* The pitch that sounds when written central C is played. */ Pitch temp_pitch; - Pitch *me_pitch = Pitch::unsmob (get_music ()->get_property ("quoted-transposition")); + Pitch *me_pitch = unsmob<Pitch> (get_music ()->get_property ("quoted-transposition")); if (!me_pitch) - me_pitch = Pitch::unsmob (get_outlet ()->get_property ("instrumentTransposition")); + me_pitch = unsmob<Pitch> (get_outlet ()->get_property ("instrumentTransposition")); else { // We are not going to win a beauty contest with this one, @@ -260,7 +260,7 @@ Quote_iterator::process (Moment m) { SCM ev_acc = scm_car (s); - Stream_event *ev = Stream_event::unsmob (scm_car (ev_acc)); + Stream_event *ev = unsmob<Stream_event> (scm_car (ev_acc)); if (!ev) programming_error ("no music found in quote"); else if (accept_music_type (ev, is_cue)) diff --git a/lily/relative-octave-check.cc b/lily/relative-octave-check.cc index a68c5b8e4a..12abf81254 100644 --- a/lily/relative-octave-check.cc +++ b/lily/relative-octave-check.cc @@ -31,9 +31,9 @@ MAKE_SCHEME_CALLBACK (Relative_octave_check, relative_callback, 2) SCM Relative_octave_check::relative_callback (SCM music, SCM last_pitch) { - Pitch p = *Pitch::unsmob (last_pitch); - Music *m = Music::unsmob (music); - Pitch *check_p = Pitch::unsmob (m->get_property ("pitch")); + Pitch p = *unsmob<Pitch> (last_pitch); + Music *m = unsmob<Music> (music); + Pitch *check_p = unsmob<Pitch> (m->get_property ("pitch")); int delta_oct = 0; if (check_p) diff --git a/lily/repeat-tie-engraver.cc b/lily/repeat-tie-engraver.cc index 9c59ac01c9..d61c52c5d8 100644 --- a/lily/repeat-tie-engraver.cc +++ b/lily/repeat-tie-engraver.cc @@ -80,9 +80,9 @@ Repeat_tie_engraver::acknowledge_note_head (Grob_info inf) semi_tie->set_parent (semi_tie_column_, Y_AXIS); semi_ties_.push_back (semi_tie); - if (is_direction (Stream_event::unsmob (cause)->get_property ("direction"))) + if (is_direction (unsmob<Stream_event> (cause)->get_property ("direction"))) { - Direction d = to_dir (Stream_event::unsmob (cause)->get_property ("direction")); + Direction d = to_dir (unsmob<Stream_event> (cause)->get_property ("direction")); semi_tie->set_property ("direction", scm_from_int (d)); } diff --git a/lily/repeated-music.cc b/lily/repeated-music.cc index f7eb5d9964..001eb0e5e4 100644 --- a/lily/repeated-music.cc +++ b/lily/repeated-music.cc @@ -26,7 +26,7 @@ Music * Repeated_music::body (Music *me) { - return Music::unsmob (me->get_property ("element")); + return unsmob<Music> (me->get_property ("element")); } SCM @@ -53,7 +53,7 @@ Repeated_music::alternatives_get_length (Music *me, bool fold) SCM p = alternative_list; while (scm_is_pair (p) && done < count) { - m = m + Music::unsmob (scm_car (p))->get_length (); + m = m + unsmob<Music> (scm_car (p))->get_length (); done++; if (count - done < len) p = scm_cdr (p); @@ -78,7 +78,7 @@ Moment Repeated_music::body_get_length (Music *me) { Moment m = 0; - if (Music *body = Music::unsmob (me->get_property ("element"))) + if (Music *body = unsmob<Music> (me->get_property ("element"))) m = body->get_length (); return m; } @@ -88,7 +88,7 @@ MAKE_SCHEME_CALLBACK (Repeated_music, unfolded_music_length, 1); SCM Repeated_music::unfolded_music_length (SCM m) { - Music *me = Music::unsmob (m); + Music *me = unsmob<Music> (m); Moment l = Moment (repeat_count (me)) * body_get_length (me) + alternatives_get_length (me, false); return l.smobbed_copy (); @@ -98,7 +98,7 @@ MAKE_SCHEME_CALLBACK (Repeated_music, folded_music_length, 1); SCM Repeated_music::folded_music_length (SCM m) { - Music *me = Music::unsmob (m); + Music *me = unsmob<Music> (m); Moment l = body_get_length (me) + alternatives_get_length (me, true); return l.smobbed_copy (); @@ -114,7 +114,7 @@ MAKE_SCHEME_CALLBACK (Repeated_music, volta_music_length, 1); SCM Repeated_music::volta_music_length (SCM m) { - Music *me = Music::unsmob (m); + Music *me = unsmob<Music> (m); Moment l = body_get_length (me) + alternatives_volta_get_length (me); return l.smobbed_copy (); } @@ -123,8 +123,8 @@ MAKE_SCHEME_CALLBACK (Repeated_music, minimum_start, 1); SCM Repeated_music::minimum_start (SCM m) { - Music *me = Music::unsmob (m); - Music *body = Music::unsmob (me->get_property ("element")); + Music *me = unsmob<Music> (m); + Music *body = unsmob<Music> (me->get_property ("element")); if (body) return body->start_mom ().smobbed_copy (); @@ -136,8 +136,8 @@ MAKE_SCHEME_CALLBACK (Repeated_music, first_start, 1); SCM Repeated_music::first_start (SCM m) { - Music *me = Music::unsmob (m); - Music *body = Music::unsmob (me->get_property ("element")); + Music *me = unsmob<Music> (m); + Music *body = unsmob<Music> (me->get_property ("element")); Moment rv = (body) ? body->start_mom () : Music_sequence::first_start (me->get_property ("elements")); diff --git a/lily/rest-collision-engraver.cc b/lily/rest-collision-engraver.cc index 47e2d71f11..20e7eb9fc7 100644 --- a/lily/rest-collision-engraver.cc +++ b/lily/rest-collision-engraver.cc @@ -57,8 +57,8 @@ Rest_collision_engraver::process_acknowledged () for (SCM s = get_property ("busyGrobs"); scm_is_pair (s); s = scm_cdr (s)) { - Grob *g = Grob::unsmob (scm_cdar (s)); - Moment *m = Moment::unsmob (scm_caar (s)); + Grob *g = unsmob<Grob> (scm_cdar (s)); + Moment *m = unsmob<Moment> (scm_caar (s)); if (!g || !m) continue; diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 7648f6d9a0..86de7a9c3d 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -41,7 +41,7 @@ MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Rest_collision, force_shift_callback_rest, 2, SCM Rest_collision::force_shift_callback_rest (SCM rest, SCM offset) { - Grob *rest_grob = Grob::unsmob (rest); + Grob *rest_grob = unsmob<Grob> (rest); Grob *parent = rest_grob->get_parent (X_AXIS); /* @@ -53,7 +53,7 @@ Rest_collision::force_shift_callback_rest (SCM rest, SCM offset) if (Note_column::has_interface (parent) && Note_column::has_rests (parent)) { - Grob *collision = Grob::unsmob (parent->get_object ("rest-collision")); + Grob *collision = unsmob<Grob> (parent->get_object ("rest-collision")); if (collision) (void) collision->get_property ("positioning-done"); @@ -69,7 +69,7 @@ Rest_collision::add_column (Grob *me, Grob *p) p->set_object ("rest-collision", me->self_scm ()); - Grob *rest = Grob::unsmob (p->get_object ("rest")); + Grob *rest = unsmob<Grob> (p->get_object ("rest")); if (rest) { chain_offset_callback (rest, @@ -96,7 +96,7 @@ MAKE_SCHEME_CALLBACK (Rest_collision, calc_positioning_done, 1); SCM Rest_collision::calc_positioning_done (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); me->set_property ("positioning-done", SCM_BOOL_T); @@ -110,7 +110,7 @@ Rest_collision::calc_positioning_done (SCM smob) Grob *e = elts[i]; if (Note_column::has_interface (e)) { - if (Grob::unsmob (e->get_object ("rest"))) + if (unsmob<Grob> (e->get_object ("rest"))) rests.push_back (e); else notes.push_back (e); diff --git a/lily/rest-engraver.cc b/lily/rest-engraver.cc index 928e4d7d95..b40aeee8a3 100644 --- a/lily/rest-engraver.cc +++ b/lily/rest-engraver.cc @@ -66,7 +66,7 @@ Rest_engraver::process_music () if (rest_event_ && !rest_) { rest_ = make_item ("Rest", rest_event_->self_scm ()); - Pitch *p = Pitch::unsmob (rest_event_->get_property ("pitch")); + Pitch *p = unsmob<Pitch> (rest_event_->get_property ("pitch")); if (p) { diff --git a/lily/rest.cc b/lily/rest.cc index 4f05764296..f562f69534 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -35,7 +35,7 @@ MAKE_SCHEME_CALLBACK (Rest, y_offset_callback, 1); SCM Rest::y_offset_callback (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); int duration_log = scm_to_int (me->get_property ("duration-log")); Real ss = Staff_symbol_referencer::staff_space (me); @@ -146,8 +146,8 @@ MAKE_SCHEME_CALLBACK (Rest, calc_cross_staff, 1); SCM Rest::calc_cross_staff (SCM smob) { - Grob *me = Grob::unsmob (smob); - Grob *stem = Grob::unsmob (me->get_object ("stem")); + Grob *me = unsmob<Grob> (smob); + Grob *stem = unsmob<Grob> (me->get_object ("stem")); if (!stem) return SCM_BOOL_F; @@ -259,7 +259,7 @@ Rest::translate (Grob *me, int dy) SCM Rest::print (SCM smob) { - return brew_internal_stencil (Grob::unsmob (smob), true); + return brew_internal_stencil (unsmob<Grob> (smob), true); } MAKE_SCHEME_CALLBACK (Rest, width, 1); @@ -269,14 +269,14 @@ MAKE_SCHEME_CALLBACK (Rest, width, 1); SCM Rest::width (SCM smob) { - return generic_extent_callback (Grob::unsmob (smob), X_AXIS); + return generic_extent_callback (unsmob<Grob> (smob), X_AXIS); } MAKE_SCHEME_CALLBACK (Rest, height, 1); SCM Rest::height (SCM smob) { - return generic_extent_callback (Grob::unsmob (smob), Y_AXIS); + return generic_extent_callback (unsmob<Grob> (smob), Y_AXIS); } /* @@ -294,7 +294,7 @@ Rest::generic_extent_callback (Grob *me, Axis a) with ledgered rests. */ SCM m = brew_internal_stencil (me, a != X_AXIS); - return ly_interval2scm (Stencil::unsmob (m)->extent (a)); + return ly_interval2scm (unsmob<Stencil> (m)->extent (a)); } MAKE_SCHEME_CALLBACK (Rest, pure_height, 3); @@ -303,9 +303,9 @@ Rest::pure_height (SCM smob, SCM /* start */, SCM /* end */) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); SCM m = brew_internal_stencil (me, false); - return ly_interval2scm (Stencil::unsmob (m)->extent (Y_AXIS)); + return ly_interval2scm (unsmob<Stencil> (m)->extent (Y_AXIS)); } ADD_INTERFACE (Rest, diff --git a/lily/rhythmic-head.cc b/lily/rhythmic-head.cc index 1030f5e13b..8628b05088 100644 --- a/lily/rhythmic-head.cc +++ b/lily/rhythmic-head.cc @@ -29,14 +29,14 @@ Item * Rhythmic_head::get_dots (Grob *me) { SCM s = me->get_object ("dot"); - return Item::unsmob (s); + return unsmob<Item> (s); } Item * Rhythmic_head::get_stem (Grob *me) { SCM s = me->get_object ("stem"); - return Item::unsmob (s); + return unsmob<Item> (s); } int diff --git a/lily/rhythmic-music-iterator.cc b/lily/rhythmic-music-iterator.cc index 011d32cd01..cff4353f40 100644 --- a/lily/rhythmic-music-iterator.cc +++ b/lily/rhythmic-music-iterator.cc @@ -62,7 +62,7 @@ Rhythmic_music_iterator::process (Moment m) SCM art = scm_car (arts); if (c->event_source ()->is_listened_class - (Stream_event::unsmob (art)->get_property ("class"))) + (unsmob<Stream_event> (art)->get_property ("class"))) listened = scm_cons (art, listened); else unlistened = scm_cons (art, unlistened); @@ -71,7 +71,7 @@ Rhythmic_music_iterator::process (Moment m) c->event_source ()->broadcast (ev); arts = scm_reverse_x (listened, SCM_EOL); for (; scm_is_pair (arts); arts = scm_cdr (arts)) - c->event_source ()->broadcast (Stream_event::unsmob (scm_car (arts))); + c->event_source ()->broadcast (unsmob<Stream_event> (scm_car (arts))); } else c->event_source ()->broadcast (ev); diff --git a/lily/scale.cc b/lily/scale.cc index 1249bb104b..02c1dc5f8e 100644 --- a/lily/scale.cc +++ b/lily/scale.cc @@ -85,7 +85,7 @@ LY_DEFINE (ly_set_default_scale, "ly:set-default-scale", LY_ASSERT_SMOB (Scale, scale, 1); default_global_scale_scm = scale; - default_global_scale = Scale::unsmob (scale); + default_global_scale = unsmob<Scale> (scale); return SCM_UNSPECIFIED; } diff --git a/lily/score-performer.cc b/lily/score-performer.cc index 0d0aa457a7..11618d0f47 100644 --- a/lily/score-performer.cc +++ b/lily/score-performer.cc @@ -105,9 +105,9 @@ Score_performer::disconnect_from_context () void Score_performer::prepare (SCM sev) { - Stream_event *ev = Stream_event::unsmob (sev); + Stream_event *ev = unsmob<Stream_event> (sev); SCM sm = ev->get_property ("moment"); - Moment *m = Moment::unsmob (sm); + Moment *m = unsmob<Moment> (sm); audio_column_ = new Audio_column (*m); announce_element (Audio_element_info (audio_column_, 0)); precomputed_recurse_over_translators (context (), START_TRANSLATION_TIMESTEP, UP); diff --git a/lily/score-scheme.cc b/lily/score-scheme.cc index c8262dc7df..1d3e55bc6e 100644 --- a/lily/score-scheme.cc +++ b/lily/score-scheme.cc @@ -44,7 +44,7 @@ LY_DEFINE (ly_score_output_defs, "ly:score-output-defs", "All output definitions in a score.") { LY_ASSERT_SMOB (Score, score, 1); - Score *sc = Score::unsmob (score); + Score *sc = unsmob<Score> (score); SCM l = SCM_EOL; for (vsize i = 0; i < sc->defs_.size (); i++) @@ -58,8 +58,8 @@ LY_DEFINE (ly_score_add_output_def_x, "ly:score-add-output-def!", { LY_ASSERT_SMOB (Score, score, 1); LY_ASSERT_SMOB (Output_def, def, 2); - Score *sc = Score::unsmob (score); - Output_def *output_def = Output_def::unsmob (def); + Score *sc = unsmob<Score> (score); + Output_def *output_def = unsmob<Output_def> (def); sc->add_output_def (output_def); return SCM_UNSPECIFIED; } @@ -69,7 +69,7 @@ LY_DEFINE (ly_score_header, "ly:score-header", "Return score header.") { LY_ASSERT_SMOB (Score, score, 1); - Score *sc = Score::unsmob (score); + Score *sc = unsmob<Score> (score); return sc->get_header (); } @@ -81,7 +81,7 @@ LY_DEFINE (ly_score_set_header_x, "ly:score-set-header!", SCM_ASSERT_TYPE (ly_is_module (module), module, SCM_ARG2, __FUNCTION__, "module"); - Score *sc = Score::unsmob (score); + Score *sc = unsmob<Score> (score); sc->set_header (module); return SCM_UNSPECIFIED; } @@ -91,7 +91,7 @@ LY_DEFINE (ly_score_music, "ly:score-music", "Return score music.") { LY_ASSERT_SMOB (Score, score, 1); - Score *sc = Score::unsmob (score); + Score *sc = unsmob<Score> (score); return sc->get_music (); } @@ -100,7 +100,7 @@ LY_DEFINE (ly_score_error_p, "ly:score-error?", "Was there an error in the score?") { LY_ASSERT_SMOB (Score, score, 1); - Score *sc = Score::unsmob (score); + Score *sc = unsmob<Score> (score); return scm_from_bool (sc->error_found_); } @@ -113,8 +113,8 @@ LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format", LY_ASSERT_SMOB (Score, score, 1); LY_ASSERT_SMOB (Output_def, layout, 2); - Score *sc = Score::unsmob (score); - Output_def *od = Output_def::unsmob (layout); + Score *sc = unsmob<Score> (score); + Output_def *od = unsmob<Output_def> (layout); if (sc->error_found_) return SCM_EOL; diff --git a/lily/score.cc b/lily/score.cc index 2388ba7cf2..fe0f761fb7 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -40,7 +40,7 @@ using namespace std; Input * Score::origin () const { - return Input::unsmob (input_location_); + return unsmob<Input> (input_location_); } Score::Score () @@ -83,7 +83,7 @@ Score::Score (Score const &s) smobify_self (); input_location_ = s.origin ()->smobbed_copy (); - Music *m = Music::unsmob (s.music_); + Music *m = unsmob<Music> (s.music_); if (m) { Music *mclone = m->clone (); @@ -139,7 +139,7 @@ Score::book_rendering (Output_def *layoutbook, /* TODO: fix or junk --no-layout. */ SCM context = ly_run_translator (music_, scaled); - if (Global_context::unsmob (context)) + if (unsmob<Global_context> (context)) { SCM s = ly_format_output (context); @@ -155,12 +155,12 @@ Score::book_rendering (Output_def *layoutbook, void Score::set_music (SCM music) { - if (Music::is_smob (music_)) + if (unsmob<Music> (music_)) { - Music::unsmob (music)->origin ()->error (_ ("already have music in score")); - Music::unsmob (music_)->origin ()->error (_ ("this is the previous music")); + unsmob<Music> (music)->origin ()->error (_ ("already have music in score")); + unsmob<Music> (music_)->origin ()->error (_ ("this is the previous music")); } - Music *m = Music::unsmob (music); + Music *m = unsmob<Music> (music); if (m && to_boolean (m->get_property ("error-found"))) { m->origin ()->error (_ ("errors found, ignoring music expression")); diff --git a/lily/script-column.cc b/lily/script-column.cc index 2456f8b00b..3a288dac72 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -46,8 +46,8 @@ LY_DEFINE (ly_grob_script_priority_less, "ly:grob-script-priority-less", 2, 0, 0, (SCM a, SCM b), "Compare two grobs by script priority. For internal use.") { - Grob *i1 = Grob::unsmob (a); - Grob *i2 = Grob::unsmob (b); + Grob *i1 = unsmob<Grob> (a); + Grob *i2 = unsmob<Grob> (b); SCM p1 = i1->get_property ("script-priority"); SCM p2 = i2->get_property ("script-priority"); @@ -59,7 +59,7 @@ MAKE_SCHEME_CALLBACK (Script_column, row_before_line_breaking, 1); SCM Script_column::row_before_line_breaking (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); vector<Grob *> horizontal_grobs; extract_grob_set (me, "scripts", scripts); @@ -102,7 +102,7 @@ MAKE_SCHEME_CALLBACK (Script_column, before_line_breaking, 1); SCM Script_column::before_line_breaking (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); vector<Grob *> staff_sided; extract_grob_set (me, "scripts", scripts); @@ -147,7 +147,7 @@ Script_column::order_grobs (vector<Grob *> grobs) for (SCM s = ss; scm_is_pair (s); s = scm_cdr (s), last = g, last_initial_outside_staff = initial_outside_staff) { - g = Grob::unsmob (scm_car (s)); + g = unsmob<Grob> (scm_car (s)); initial_outside_staff = g->get_property ("outside-staff-priority"); if (last) //not the first grob in the list { @@ -158,7 +158,7 @@ Script_column::order_grobs (vector<Grob *> grobs) */ if (!scm_is_number (last_outside_staff)) for (SCM t = ss; !scm_is_eq (t, s); t = scm_cdr (t)) - Side_position_interface::add_support (g, Grob::unsmob (scm_car (t))); + Side_position_interface::add_support (g, unsmob<Grob> (scm_car (t))); /* if outside_staff_priority is missing or is equal to original outside_staff_priority of previous grob, set new diff --git a/lily/script-interface.cc b/lily/script-interface.cc index c9442fe9ae..eaba157f34 100644 --- a/lily/script-interface.cc +++ b/lily/script-interface.cc @@ -54,7 +54,7 @@ MAKE_SCHEME_CALLBACK (Script_interface, calc_positioning_done, 1); SCM Script_interface::calc_positioning_done (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); if (Grob *par = me->get_parent (X_AXIS)) { Grob *stem = Note_column::get_stem (par); @@ -73,7 +73,7 @@ Script_interface::get_direction (Grob *me) relative_dir = to_dir (reldir); SCM other_elt = me->get_object ("direction-source"); - Grob *e = Grob::unsmob (other_elt); + Grob *e = unsmob<Grob> (other_elt); if (e) return (Direction) (relative_dir * get_grob_direction (e)); @@ -84,7 +84,7 @@ MAKE_SCHEME_CALLBACK (Script_interface, calc_direction, 1); SCM Script_interface::calc_direction (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Direction d = Script_interface::get_direction (me); if (!d) @@ -101,13 +101,13 @@ MAKE_SCHEME_CALLBACK (Script_interface, calc_cross_staff, 1); SCM Script_interface::calc_cross_staff (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Grob *stem = Note_column::get_stem (me->get_parent (X_AXIS)); if (stem && to_boolean (stem->get_property ("cross-staff"))) return SCM_BOOL_T; - Grob *slur = Grob::unsmob (me->get_object ("slur")); + Grob *slur = unsmob<Grob> (me->get_object ("slur")); SCM avoid_slur = me->get_property ("avoid-slur"); if (slur && to_boolean (slur->get_property ("cross-staff")) && (scm_is_eq (avoid_slur, ly_symbol2scm ("outside")) @@ -122,7 +122,7 @@ MAKE_SCHEME_CALLBACK (Script_interface, print, 1); SCM Script_interface::print (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Direction dir = get_grob_direction (me); diff --git a/lily/self-alignment-interface.cc b/lily/self-alignment-interface.cc index 81a21075ee..49b4125364 100644 --- a/lily/self-alignment-interface.cc +++ b/lily/self-alignment-interface.cc @@ -29,21 +29,21 @@ MAKE_SCHEME_CALLBACK (Self_alignment_interface, y_aligned_on_self, 1); SCM Self_alignment_interface::y_aligned_on_self (SCM element) { - return aligned_on_self (Grob::unsmob (element), Y_AXIS, false, 0, 0); + return aligned_on_self (unsmob<Grob> (element), Y_AXIS, false, 0, 0); } MAKE_SCHEME_CALLBACK (Self_alignment_interface, x_aligned_on_self, 1); SCM Self_alignment_interface::x_aligned_on_self (SCM element) { - return aligned_on_self (Grob::unsmob (element), X_AXIS, false, 0, 0); + return aligned_on_self (unsmob<Grob> (element), X_AXIS, false, 0, 0); } MAKE_SCHEME_CALLBACK (Self_alignment_interface, pure_y_aligned_on_self, 3); SCM Self_alignment_interface::pure_y_aligned_on_self (SCM smob, SCM start, SCM end) { - return aligned_on_self (Grob::unsmob (smob), Y_AXIS, true, robust_scm2int (start, 0), robust_scm2int (end, INT_MAX)); + return aligned_on_self (unsmob<Grob> (smob), Y_AXIS, true, robust_scm2int (start, 0), robust_scm2int (end, INT_MAX)); } SCM @@ -75,28 +75,28 @@ MAKE_SCHEME_CALLBACK (Self_alignment_interface, centered_on_x_parent, 1); SCM Self_alignment_interface::centered_on_x_parent (SCM smob) { - return centered_on_object (Grob::unsmob (smob)->get_parent (X_AXIS), X_AXIS); + return centered_on_object (unsmob<Grob> (smob)->get_parent (X_AXIS), X_AXIS); } MAKE_SCHEME_CALLBACK (Self_alignment_interface, centered_on_y_parent, 1); SCM Self_alignment_interface::centered_on_y_parent (SCM smob) { - return centered_on_object (Grob::unsmob (smob)->get_parent (Y_AXIS), Y_AXIS); + return centered_on_object (unsmob<Grob> (smob)->get_parent (Y_AXIS), Y_AXIS); } MAKE_SCHEME_CALLBACK (Self_alignment_interface, aligned_on_x_parent, 1); SCM Self_alignment_interface::aligned_on_x_parent (SCM smob) { - return aligned_on_parent (Grob::unsmob (smob), X_AXIS); + return aligned_on_parent (unsmob<Grob> (smob), X_AXIS); } MAKE_SCHEME_CALLBACK (Self_alignment_interface, aligned_on_y_parent, 1); SCM Self_alignment_interface::aligned_on_y_parent (SCM smob) { - return aligned_on_parent (Grob::unsmob (smob), Y_AXIS); + return aligned_on_parent (unsmob<Grob> (smob), Y_AXIS); } SCM diff --git a/lily/semi-tie-column.cc b/lily/semi-tie-column.cc index 9af746cf4c..8980a8cf1c 100644 --- a/lily/semi-tie-column.cc +++ b/lily/semi-tie-column.cc @@ -47,7 +47,7 @@ MAKE_SCHEME_CALLBACK (Semi_tie_column, calc_positioning_done, 1); SCM Semi_tie_column::calc_positioning_done (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); me->set_property ("positioning-done", SCM_BOOL_T); @@ -84,7 +84,7 @@ MAKE_SCHEME_CALLBACK (Semi_tie_column, calc_head_direction, 1); SCM Semi_tie_column::calc_head_direction (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "ties", ties); Direction d = LEFT; diff --git a/lily/semi-tie.cc b/lily/semi-tie.cc index d9209098dd..4e997aa78f 100644 --- a/lily/semi-tie.cc +++ b/lily/semi-tie.cc @@ -54,7 +54,7 @@ MAKE_SCHEME_CALLBACK (Semi_tie, calc_control_points, 1) SCM Semi_tie::calc_control_points (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); (void) me->get_property ("direction"); if (Semi_tie_column::has_interface (me->get_parent (Y_AXIS))) @@ -73,7 +73,7 @@ Semi_tie::calc_control_points (SCM smob) int Semi_tie::get_position (Grob *me) { - Grob *h = Grob::unsmob (me->get_object ("note-head")); + Grob *h = unsmob<Grob> (me->get_object ("note-head")); return (int) rint (Staff_symbol_referencer::get_position (h)); } diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index 07f2681c4c..5355f5cc43 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -88,7 +88,7 @@ Separating_line_group_engraver::acknowledge_item (Grob_info i) && !current_spacings_.staff_spacing_ && to_boolean (get_property ("createSpacing"))) { - Grob *col = Grob::unsmob (get_property ("currentCommandColumn")); + Grob *col = unsmob<Grob> (get_property ("currentCommandColumn")); current_spacings_.staff_spacing_ = make_item ("StaffSpacing", SCM_EOL); context ()->set_property ("hasStaffSpacing", SCM_BOOL_T); @@ -101,12 +101,12 @@ Separating_line_group_engraver::acknowledge_item (Grob_info i) && last_spacings_.staff_spacing_) { SCM ri = last_spacings_.staff_spacing_->get_object ("right-items"); - Grob_array *ga = Grob_array::unsmob (ri); + Grob_array *ga = unsmob<Grob_array> (ri); if (!ga) { SCM ga_scm = Grob_array::make_array (); last_spacings_.staff_spacing_->set_object ("right-items", ga_scm); - ga = Grob_array::unsmob (ga_scm); + ga = unsmob<Grob_array> (ga_scm); } ga->clear (); @@ -146,7 +146,7 @@ Separating_line_group_engraver::stop_translation_timestep () last_spacings_ = current_spacings_; if (Item *sp = current_spacings_.staff_spacing_) - if (Grob *col = Grob::unsmob (get_property ("currentMusicalColumn"))) + if (Grob *col = unsmob<Grob> (get_property ("currentMusicalColumn"))) Pointer_group_interface::add_grob (sp, ly_symbol2scm ("right-items"), col); current_spacings_.clear (); diff --git a/lily/separation-item.cc b/lily/separation-item.cc index 5e93a13e4c..d0cad83d8e 100644 --- a/lily/separation-item.cc +++ b/lily/separation-item.cc @@ -46,8 +46,8 @@ Separation_item::add_conditional_item (Grob *me, Grob *e) Real Separation_item::set_distance (Item *l, Item *r, Real padding) { - Drul_array<Skyline_pair *> lines (Skyline_pair::unsmob (l->get_property ("horizontal-skylines")), - Skyline_pair::unsmob (r->get_property ("horizontal-skylines"))); + Drul_array<Skyline_pair *> lines (unsmob<Skyline_pair> (l->get_property ("horizontal-skylines")), + unsmob<Skyline_pair> (r->get_property ("horizontal-skylines"))); Skyline right = conditional_skyline (r, l); right.merge ((*lines[RIGHT])[LEFT]); @@ -68,7 +68,7 @@ Separation_item::set_distance (Item *l, Item *r, Real padding) bool Separation_item::is_empty (Grob *me) { - Skyline_pair *sky = Skyline_pair::unsmob (me->get_property ("horizontal-skylines")); + Skyline_pair *sky = unsmob<Skyline_pair> (me->get_property ("horizontal-skylines")); return (!sky || sky->is_empty ()); } @@ -87,7 +87,7 @@ MAKE_SCHEME_CALLBACK (Separation_item, calc_skylines, 1); SCM Separation_item::calc_skylines (SCM smob) { - Item *me = Item::unsmob (smob); + Item *me = unsmob<Item> (smob); vector<Box> bs = boxes (me, 0); Skyline_pair sp (bs, Y_AXIS); /* @@ -201,9 +201,9 @@ Separation_item::print (SCM smob) if (!debug_skylines) return SCM_BOOL_F; - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Stencil ret; - if (Skyline_pair *s = Skyline_pair::unsmob (me->get_property ("horizontal-skylines"))) + if (Skyline_pair *s = unsmob<Skyline_pair> (me->get_property ("horizontal-skylines"))) { ret.add_stencil (Lookup::points_to_line_stencil (0.1, (*s)[LEFT].to_points (Y_AXIS)).in_color (255, 255, 0)); ret.add_stencil (Lookup::points_to_line_stencil (0.1, (*s)[RIGHT].to_points (Y_AXIS)).in_color (0, 255, 255)); diff --git a/lily/sequential-iterator.cc b/lily/sequential-iterator.cc index 0ff37e8a02..b02e58c62d 100644 --- a/lily/sequential-iterator.cc +++ b/lily/sequential-iterator.cc @@ -33,7 +33,7 @@ if (scm_is_pair (cursor_)) - iter_->music_ == Music::unsmob (scm_car (cursor_)) + iter_->music_ == unsmob<Music> (scm_car (cursor_)) else iter_ == 0; @@ -96,7 +96,7 @@ create_grace_fixup_list (SCM cursor) for (; scm_is_pair (cursor); cursor = scm_cdr (cursor)) { - Music *mus = Music::unsmob (scm_car (cursor)); + Music *mus = unsmob<Music> (scm_car (cursor)); Moment s = mus->start_mom (); Moment l = mus->get_length () - s; @@ -134,8 +134,8 @@ Sequential_iterator::construct_children () iter_ = 0; if (scm_is_pair (cursor_)) { - Music *m = Music::unsmob (scm_car (cursor_)); - iter_ = Music_iterator::unsmob (get_iterator (m)); + Music *m = unsmob<Music> (scm_car (cursor_)); + iter_ = unsmob<Music_iterator> (get_iterator (m)); } while (iter_ && !iter_->ok ()) @@ -195,7 +195,7 @@ Sequential_iterator::next_element (bool) iter_->quit (); if (scm_is_pair (cursor_)) - iter_ = Music_iterator::unsmob (get_iterator (Music::unsmob (scm_car (cursor_)))); + iter_ = unsmob<Music_iterator> (get_iterator (unsmob<Music> (scm_car (cursor_)))); else iter_ = 0; } diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 95eba005ee..08ac17285d 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -72,7 +72,7 @@ get_support_set (Grob *me) acs = scm_cdr (acs)) for (SCM s = scm_cdar (acs); scm_is_pair (s); s = scm_cdr (s)) { - Grob *a = Grob::unsmob (scm_car (s)); + Grob *a = unsmob<Grob> (scm_car (s)); support.insert (a); } } @@ -96,7 +96,7 @@ axis_aligned_side_helper (SCM smob, Axis a, bool pure, int start, int end, SCM c current_off_ptr = &r; } - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); // We will only ever want widths of spanners after line breaking // so we can set pure to false if (dynamic_cast<Spanner *> (me) && a == X_AXIS) @@ -138,7 +138,7 @@ MAKE_SCHEME_CALLBACK (Side_position_interface, calc_cross_staff, 1) SCM Side_position_interface::calc_cross_staff (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "side-support-elements", elts); Direction my_dir = get_grob_direction (me) ; @@ -212,7 +212,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i pure, start, end); - if (Skyline_pair::is_smob (skyp)) + if (unsmob<Skyline_pair> (skyp)) { // for spanner pure heights, we don't know horizontal spacing, // so a spanner can never have a meaningful x coordiante @@ -228,7 +228,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i Real yc = a == X_AXIS ? me->pure_relative_y_coordinate (common[Y_AXIS], start, end) : me->get_parent (Y_AXIS)->maybe_pure_coordinate (common[Y_AXIS], Y_AXIS, pure, start, end); - Skyline_pair copy = *Skyline_pair::unsmob (skyp); + Skyline_pair copy = *unsmob<Skyline_pair> (skyp); copy.shift (a == X_AXIS ? yc : xc); copy.raise (a == X_AXIS ? xc : yc); my_dim = copy[-dir]; @@ -271,7 +271,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i start, end); - if (Skyline_pair::is_smob (sp)) + if (unsmob<Skyline_pair> (sp)) { Real xc = pure && dynamic_cast<Spanner *> (e) ? e->get_parent (X_AXIS)->relative_coordinate (common[X_AXIS], X_AXIS) @@ -281,7 +281,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i Real yc = a == X_AXIS ? e->pure_relative_y_coordinate (common[Y_AXIS], start, end) : e->maybe_pure_coordinate (common[Y_AXIS], Y_AXIS, pure, start, end); - Skyline_pair copy = *Skyline_pair::unsmob (sp); + Skyline_pair copy = *unsmob<Skyline_pair> (sp); if (a == Y_AXIS && Stem::has_interface (e) && to_boolean (me->get_maybe_pure_property ("add-stem-support", pure, start, end))) @@ -439,7 +439,7 @@ MAKE_SCHEME_CALLBACK (Side_position_interface, move_to_extremal_staff, 1); SCM Side_position_interface::move_to_extremal_staff (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); System *sys = dynamic_cast<System *> (me->get_system ()); Direction dir = get_grob_direction (me); if (dir != DOWN) @@ -464,7 +464,7 @@ Side_position_interface::move_to_extremal_staff (SCM smob) Axis_group_interface::add_element (top_staff, me); // Remove any cross-staff side-support dependencies - Grob_array *ga = Grob_array::unsmob (me->get_object ("side-support-elements")); + Grob_array *ga = unsmob<Grob_array> (me->get_object ("side-support-elements")); if (ga) { vector<Grob *> const &elts = ga->array (); diff --git a/lily/simple-closure.cc b/lily/simple-closure.cc index b62649f06d..37759ebfab 100644 --- a/lily/simple-closure.cc +++ b/lily/simple-closure.cc @@ -47,11 +47,11 @@ evaluate_with_simple_closure (SCM delayed_argument, int start, int end) { - if (Simple_closure *sc = Simple_closure::unsmob (expr)) + if (Simple_closure *sc = unsmob<Simple_closure> (expr)) { SCM inside = sc->expression (); - SCM proc = !pure && Unpure_pure_container::is_smob (scm_car (inside)) - ? Unpure_pure_container::unsmob (scm_car (inside))->unpure_part () + SCM proc = !pure && unsmob<Unpure_pure_container> (scm_car (inside)) + ? unsmob<Unpure_pure_container> (scm_car (inside))->unpure_part () : scm_car (inside); SCM args = scm_cons (delayed_argument, evaluate_args (delayed_argument, scm_cdr (inside), @@ -66,11 +66,11 @@ evaluate_with_simple_closure (SCM delayed_argument, return expr; else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("quote"))) return scm_cadr (expr); - else if (Unpure_pure_container::is_smob (scm_car (expr)) + else if (unsmob<Unpure_pure_container> (scm_car (expr)) || ly_is_procedure (scm_car (expr))) { - SCM proc = !pure && Unpure_pure_container::is_smob (scm_car (expr)) - ? Unpure_pure_container::unsmob (scm_car (expr))->unpure_part () + SCM proc = !pure && unsmob<Unpure_pure_container> (scm_car (expr)) + ? unsmob<Unpure_pure_container> (scm_car (expr))->unpure_part () : scm_car (expr); SCM args = evaluate_args (delayed_argument, scm_cdr (expr), pure, start, end); if (scm_is_eq (args, SCM_UNSPECIFIED)) @@ -109,7 +109,7 @@ LY_DEFINE (ly_eval_simple_closure, "ly:eval-simple-closure", bool pure = (scm_is_number (scm_start) && scm_is_number (scm_end)); int start = robust_scm2int (scm_start, 0); int end = robust_scm2int (scm_end, 0); - SCM expr = Simple_closure::unsmob (closure)->expression (); + SCM expr = unsmob<Simple_closure> (closure)->expression (); return evaluate_with_simple_closure (delayed, expr, pure, start, end); } diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index ada16593aa..271c1521c5 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -380,7 +380,7 @@ get_column_description (vector<Grob *> const &cols, vsize col_index, bool line_s for (SCM s = Spaceable_grob::get_minimum_distances (col); scm_is_pair (s); s = scm_cdr (s)) { - Grob *other = Grob::unsmob (scm_caar (s)); + Grob *other = unsmob<Grob> (scm_caar (s)); vsize j = binary_search (cols, other, Paper_column::less_than, col_index); if (j != VPOS) { diff --git a/lily/simultaneous-music-iterator.cc b/lily/simultaneous-music-iterator.cc index 1ce8490772..74f2d6dc9a 100644 --- a/lily/simultaneous-music-iterator.cc +++ b/lily/simultaneous-music-iterator.cc @@ -39,7 +39,7 @@ void Simultaneous_music_iterator::derived_substitute (Context *f, Context *t) { for (SCM s = children_list_; scm_is_pair (s); s = scm_cdr (s)) - Music_iterator::unsmob (scm_car (s))->substitute_outlet (f, t); + unsmob<Music_iterator> (scm_car (s))->substitute_outlet (f, t); } void @@ -53,10 +53,10 @@ Simultaneous_music_iterator::construct_children () SCM *tail = &children_list_; for (; scm_is_pair (i); i = scm_cdr (i), j++) { - Music *mus = Music::unsmob (scm_car (i)); + Music *mus = unsmob<Music> (scm_car (i)); SCM scm_iter = get_static_get_iterator (mus); - Music_iterator *mi = Music_iterator::unsmob (scm_iter); + Music_iterator *mi = unsmob<Music_iterator> (scm_iter); /* if create_separate_contexts_ is set, create a new context with the number number as name */ @@ -92,7 +92,7 @@ Simultaneous_music_iterator::process (Moment until) SCM *proc = &children_list_; while (scm_is_pair (*proc)) { - Music_iterator *i = Music_iterator::unsmob (scm_car (*proc)); + Music_iterator *i = unsmob<Music_iterator> (scm_car (*proc)); bool run_always = i->run_always (); if (run_always || i->pending_moment () == until) i->process (until); @@ -124,7 +124,7 @@ Simultaneous_music_iterator::process (Moment until) if (had_bad && !had_good) { for (SCM p = children_list_; scm_is_pair (p); p = scm_cdr (p)) - Music_iterator::unsmob (scm_car (p))->quit (); + unsmob<Music_iterator> (scm_car (p))->quit (); children_list_ = SCM_EOL; } } @@ -137,7 +137,7 @@ Simultaneous_music_iterator::pending_moment () const for (SCM s = children_list_; scm_is_pair (s); s = scm_cdr (s)) { - Music_iterator *it = Music_iterator::unsmob (scm_car (s)); + Music_iterator *it = unsmob<Music_iterator> (scm_car (s)); next = min (next, it->pending_moment ()); } @@ -150,7 +150,7 @@ Simultaneous_music_iterator::ok () const bool run_always_ok = false; for (SCM s = children_list_; scm_is_pair (s); s = scm_cdr (s)) { - Music_iterator *it = Music_iterator::unsmob (scm_car (s)); + Music_iterator *it = unsmob<Music_iterator> (scm_car (s)); if (!it->run_always ()) return true; else @@ -164,7 +164,7 @@ Simultaneous_music_iterator::run_always () const { for (SCM s = children_list_; scm_is_pair (s); s = scm_cdr (s)) { - Music_iterator *it = Music_iterator::unsmob (scm_car (s)); + Music_iterator *it = unsmob<Music_iterator> (scm_car (s)); if (it->run_always ()) return true; } @@ -175,7 +175,7 @@ void Simultaneous_music_iterator::do_quit () { for (SCM s = children_list_; scm_is_pair (s); s = scm_cdr (s)) - Music_iterator::unsmob (scm_car (s))->quit (); + unsmob<Music_iterator> (scm_car (s))->quit (); } IMPLEMENT_CTOR_CALLBACK (Simultaneous_music_iterator); diff --git a/lily/skyline-pair.cc b/lily/skyline-pair.cc index 92ae97a342..b3c2b96df4 100644 --- a/lily/skyline-pair.cc +++ b/lily/skyline-pair.cc @@ -127,7 +127,7 @@ MAKE_SCHEME_CALLBACK (Skyline_pair, skyline, 2); SCM Skyline_pair::skyline (SCM smob, SCM dir_scm) { - Skyline_pair *sp = Skyline_pair::unsmob (smob); + Skyline_pair *sp = unsmob<Skyline_pair> (smob); Direction dir = robust_scm2dir (dir_scm, UP); if (dir == CENTER) diff --git a/lily/skyline.cc b/lily/skyline.cc index 42a028fe0a..f46b2f3e84 100644 --- a/lily/skyline.cc +++ b/lily/skyline.cc @@ -817,8 +817,8 @@ Skyline::get_touching_point (SCM skyline_scm, SCM other_skyline_scm, SCM horizon horizon_padding = scm_to_double (horizon_padding_scm); } - Skyline *skyline = Skyline::unsmob (skyline_scm); - Skyline *other_skyline = Skyline::unsmob (other_skyline_scm); + Skyline *skyline = unsmob<Skyline> (skyline_scm); + Skyline *other_skyline = unsmob<Skyline> (other_skyline_scm); return scm_from_double (skyline->touching_point (*other_skyline, horizon_padding)); } @@ -835,8 +835,8 @@ Skyline::get_distance (SCM skyline_scm, SCM other_skyline_scm, SCM horizon_paddi horizon_padding = scm_to_double (horizon_padding_scm); } - Skyline *skyline = Skyline::unsmob (skyline_scm); - Skyline *other_skyline = Skyline::unsmob (other_skyline_scm); + Skyline *skyline = unsmob<Skyline> (skyline_scm); + Skyline *other_skyline = unsmob<Skyline> (other_skyline_scm); return scm_from_double (skyline->distance (*other_skyline, horizon_padding)); } @@ -844,14 +844,14 @@ MAKE_SCHEME_CALLBACK (Skyline, get_max_height, 1) SCM Skyline::get_max_height (SCM skyline_scm) { - return scm_from_double (Skyline::unsmob (skyline_scm)->max_height ()); + return scm_from_double (unsmob<Skyline> (skyline_scm)->max_height ()); } MAKE_SCHEME_CALLBACK (Skyline, get_max_height_position, 1) SCM Skyline::get_max_height_position (SCM skyline_scm) { - return scm_from_double (Skyline::unsmob (skyline_scm)->max_height_position ()); + return scm_from_double (unsmob<Skyline> (skyline_scm)->max_height_position ()); } MAKE_SCHEME_CALLBACK (Skyline, get_height, 2) @@ -859,14 +859,14 @@ SCM Skyline::get_height (SCM skyline_scm, SCM x_scm) { Real x = robust_scm2double (x_scm, 0.0); - return scm_from_double (Skyline::unsmob (skyline_scm)->height (x)); + return scm_from_double (unsmob<Skyline> (skyline_scm)->height (x)); } LY_DEFINE (ly_skyline_empty_p, "ly:skyline-empty?", 1, 0, 0, (SCM sky), "Return whether @var{sky} is empty.") { - Skyline *s = Skyline::unsmob (sky); + Skyline *s = unsmob<Skyline> (sky); LY_ASSERT_SMOB (Skyline, sky, 1); return scm_from_bool (s->is_empty ()); } diff --git a/lily/slur-proto-engraver.cc b/lily/slur-proto-engraver.cc index 9d6d134958..215fcfd7a3 100644 --- a/lily/slur-proto-engraver.cc +++ b/lily/slur-proto-engraver.cc @@ -125,7 +125,7 @@ Slur_proto_engraver::finalize () void Slur_proto_engraver::create_slur (const string &spanner_id, Stream_event *ev_cause, Grob *g_cause, Direction dir, bool left_broken) { - Grob *ccc = Grob::unsmob (get_property ("currentCommandColumn")); + Grob *ccc = unsmob<Grob> (get_property ("currentCommandColumn")); SCM cause = ev_cause ? ev_cause->self_scm () : g_cause->self_scm (); Spanner *slur = make_spanner (grob_name_, cause); slur->set_property ("spanner-id", ly_string2scm (spanner_id)); @@ -176,7 +176,7 @@ Slur_proto_engraver::can_create_slur (const string &id, vsize old_slurs, vsize * if (!updown) return false; - Stream_event *c = Stream_event::unsmob (slur->get_property ("cause")); + Stream_event *c = unsmob<Stream_event> (slur->get_property ("cause")); if (!c) { @@ -266,7 +266,7 @@ Slur_proto_engraver::set_melisma (bool) void Slur_proto_engraver::stop_translation_timestep () { - if (Grob *g = Grob::unsmob (get_property ("currentCommandColumn"))) + if (Grob *g = unsmob<Grob> (get_property ("currentCommandColumn"))) { for (vsize i = 0; i < end_slurs_.size (); i++) Slur::add_extra_encompass (end_slurs_[i], g); @@ -280,7 +280,7 @@ Slur_proto_engraver::stop_translation_timestep () { Spanner *s = dynamic_cast<Spanner *> (end_slurs_[i]); if (!s->get_bound (RIGHT)) - s->set_bound (RIGHT, Grob::unsmob (get_property ("currentMusicalColumn"))); + s->set_bound (RIGHT, unsmob<Grob> (get_property ("currentMusicalColumn"))); announce_end_grob (s, SCM_EOL); } diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index 85e917f96f..cca56781aa 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -106,7 +106,7 @@ Slur_score_state::slur_direction () const Encompass_info Slur_score_state::get_encompass_info (Grob *col) const { - Grob *stem = Grob::unsmob (col->get_object ("stem")); + Grob *stem = unsmob<Grob> (col->get_object ("stem")); Encompass_info ei; if (!stem) @@ -331,7 +331,7 @@ MAKE_SCHEME_CALLBACK (Slur, calc_control_points, 1) SCM Slur::calc_control_points (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); Slur_score_state state; state.fill (me); diff --git a/lily/slur.cc b/lily/slur.cc index 0f3f7162a7..93f5492b66 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -47,7 +47,7 @@ MAKE_SCHEME_CALLBACK (Slur, calc_direction, 1) SCM Slur::calc_direction (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "note-columns", encompasses); if (encompasses.empty ()) @@ -81,7 +81,7 @@ Slur::pure_height (SCM smob, SCM start_scm, SCM end_scm) -- adding extra height for scripts that avoid slurs on the inside -- adding extra height for the "bulge" in a slur above a note head */ - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); int start = scm_to_int (start_scm); int end = scm_to_int (end_scm); Direction dir = get_grob_direction (me); @@ -133,7 +133,7 @@ MAKE_SCHEME_CALLBACK (Slur, height, 1); SCM Slur::height (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); // FIXME uncached Stencil *m = me->get_stencil (); @@ -145,7 +145,7 @@ MAKE_SCHEME_CALLBACK (Slur, print, 1); SCM Slur::print (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "note-columns", encompasses); if (encompasses.empty ()) { @@ -179,7 +179,7 @@ Slur::print (SCM smob) properties = scm_cons (scm_acons (ly_symbol2scm ("font-size"), scm_from_int (-6), SCM_EOL), properties); - Stencil tm = *Stencil::unsmob (Text_interface::interpret_markup + Stencil tm = *unsmob<Stencil> (Text_interface::interpret_markup (me->layout ()->self_scm (), properties, annotation)); a.add_at_edge (Y_AXIS, get_grob_direction (me), tm, 1.0); @@ -220,10 +220,10 @@ Slur::replace_breakable_encompass_objects (Grob *me) } SCM encompass_scm = me->get_object ("encompass-objects"); - if (Grob_array::is_smob (encompass_scm)) + if (unsmob<Grob_array> (encompass_scm)) { vector<Grob *> &arr - = Grob_array::unsmob (encompass_scm)->array_reference (); + = unsmob<Grob_array> (encompass_scm)->array_reference (); arr = new_encompasses; } } @@ -259,8 +259,8 @@ Slur::pure_outside_slur_callback (SCM grob, SCM start_scm, SCM end_scm, SCM offs { int start = robust_scm2int (start_scm, 0); int end = robust_scm2int (end_scm, 0); - Grob *script = Grob::unsmob (grob); - Grob *slur = Grob::unsmob (script->get_object ("slur")); + Grob *script = unsmob<Grob> (grob); + Grob *slur = unsmob<Grob> (script->get_object ("slur")); if (!slur) return offset_scm; @@ -278,8 +278,8 @@ MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Slur, outside_slur_callback, 2, 1, ""); SCM Slur::outside_slur_callback (SCM grob, SCM offset_scm) { - Grob *script = Grob::unsmob (grob); - Grob *slur = Grob::unsmob (script->get_object ("slur")); + Grob *script = unsmob<Grob> (grob); + Grob *slur = unsmob<Grob> (script->get_object ("slur")); if (!slur) return offset_scm; @@ -371,7 +371,7 @@ MAKE_SCHEME_CALLBACK (Slur, vertical_skylines, 1); SCM Slur::vertical_skylines (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); vector<Box> boxes; if (!me) @@ -450,8 +450,8 @@ Slur::outside_slur_cross_staff (SCM smob, SCM previous) if (to_boolean (previous)) return previous; - Grob *me = Grob::unsmob (smob); - Grob *slur = Grob::unsmob (me->get_object ("slur")); + Grob *me = unsmob<Grob> (smob); + Grob *slur = unsmob<Grob> (me->get_object ("slur")); if (!slur) return SCM_BOOL_F; @@ -462,7 +462,7 @@ MAKE_SCHEME_CALLBACK (Slur, calc_cross_staff, 1) SCM Slur::calc_cross_staff (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "note-columns", cols); extract_grob_set (me, "encompass-objects", extras); diff --git a/lily/spaceable-grob.cc b/lily/spaceable-grob.cc index 6a9183486d..c6ed912039 100644 --- a/lily/spaceable-grob.cc +++ b/lily/spaceable-grob.cc @@ -85,9 +85,9 @@ Spaceable_grob::get_spring (Grob *this_col, Grob *next_col) s = scm_cdr (s)) { if (scm_is_pair (scm_car (s)) - && Grob::unsmob (scm_cdar (s)) == next_col - && Spring::is_smob (scm_caar (s))) - spring = Spring::unsmob (scm_caar (s)); + && unsmob<Grob> (scm_cdar (s)) == next_col + && unsmob<Spring> (scm_caar (s))) + spring = unsmob<Spring> (scm_caar (s)); } if (!spring) diff --git a/lily/spacing-basic.cc b/lily/spacing-basic.cc index 20f76dfda0..ff245aa30f 100644 --- a/lily/spacing-basic.cc +++ b/lily/spacing-basic.cc @@ -44,7 +44,7 @@ Spacing_spanner::standard_breakable_column_spacing (Grob *me, Item *l, Item *r, if (Paper_column::is_breakable (l) && Paper_column::is_breakable (r)) { - Moment *dt = Moment::unsmob (l->get_property ("measure-length")); + Moment *dt = unsmob<Moment> (l->get_property ("measure-length")); Moment mlen (1); if (dt) mlen = *dt; @@ -91,7 +91,7 @@ get_measure_length (Grob *column) do { - if (Moment *len = Moment::unsmob (cols[col_idx]->get_property ("measure-length"))) + if (Moment *len = unsmob<Moment> (cols[col_idx]->get_property ("measure-length"))) { return len; } @@ -111,8 +111,8 @@ Spacing_spanner::note_spacing (Grob * /* me */, Moment shortest_playing_len = 0; SCM s = lc->get_property ("shortest-playing-duration"); - if (Moment::is_smob (s)) - shortest_playing_len = *Moment::unsmob (s); + if (unsmob<Moment> (s)) + shortest_playing_len = *unsmob<Moment> (s); if (! shortest_playing_len.to_bool ()) { @@ -161,7 +161,7 @@ Spacing_spanner::note_spacing (Grob * /* me */, } else if (delta_t.grace_part_) { - Grob *grace_spacing = Grob::unsmob (lc->get_object ("grace-spacing")); + Grob *grace_spacing = unsmob<Grob> (lc->get_object ("grace-spacing")); if (grace_spacing) { Spacing_options grace_opts; diff --git a/lily/spacing-determine-loose-columns.cc b/lily/spacing-determine-loose-columns.cc index 87dd3ff197..c7990558dd 100644 --- a/lily/spacing-determine-loose-columns.cc +++ b/lily/spacing-determine-loose-columns.cc @@ -80,8 +80,8 @@ is_loose_column (Grob *l, Grob *col, Grob *r, Spacing_options const *options) */ - Item *r_neighbor = Item::unsmob (col->get_object ("right-neighbor")); - Item *l_neighbor = Item::unsmob (col->get_object ("left-neighbor")); + Item *r_neighbor = unsmob<Item> (col->get_object ("right-neighbor")); + Item *l_neighbor = unsmob<Item> (col->get_object ("left-neighbor")); if (!l_neighbor || !r_neighbor) return false; @@ -220,8 +220,8 @@ Spacing_spanner::prune_loose_columns (Grob *me, if (loose) { - Grob *right_neighbor = Grob::unsmob (c->get_object ("right-neighbor")); - Grob *left_neighbor = Grob::unsmob (c->get_object ("left-neighbor")); + Grob *right_neighbor = unsmob<Grob> (c->get_object ("right-neighbor")); + Grob *left_neighbor = unsmob<Grob> (c->get_object ("left-neighbor")); /* Either object can be non existent, if the score ends @@ -283,7 +283,7 @@ Spacing_spanner::set_explicit_neighbor_columns (vector<Grob *> const &cols) min_right_rank = right_rank; } - Grob *old_left_neighbor = Grob::unsmob (right_col->get_object ("left-neighbor")); + Grob *old_left_neighbor = unsmob<Grob> (right_col->get_object ("left-neighbor")); if (!old_left_neighbor || left_rank > Paper_column::get_rank (old_left_neighbor)) right_col->set_object ("left-neighbor", left_col->self_scm ()); } @@ -305,9 +305,9 @@ Spacing_spanner::set_implicit_neighbor_columns (vector<Grob *> const &cols) if (!Paper_column::is_breakable (it) && !Paper_column::is_musical (it)) continue; - if (i && !Grob::is_smob (cols[i]->get_object ("left-neighbor"))) + if (i && !unsmob<Grob> (cols[i]->get_object ("left-neighbor"))) cols[i]->set_object ("left-neighbor", cols[i - 1]->self_scm ()); - if (i + 1 < cols.size () && !Grob::is_smob (cols[i]->get_object ("right-neighbor"))) + if (i + 1 < cols.size () && !unsmob<Grob> (cols[i]->get_object ("right-neighbor"))) cols[i]->set_object ("right-neighbor", cols[i + 1]->self_scm ()); } } diff --git a/lily/spacing-engraver.cc b/lily/spacing-engraver.cc index a8e21253e6..cc5b1e31d1 100644 --- a/lily/spacing-engraver.cc +++ b/lily/spacing-engraver.cc @@ -123,7 +123,7 @@ Spacing_engraver::start_spanner () spacing_ = make_spanner ("SpacingSpanner", SCM_EOL); spacing_->set_bound (LEFT, - Grob::unsmob (get_property ("currentCommandColumn"))); + unsmob<Grob> (get_property ("currentCommandColumn"))); } void @@ -137,7 +137,7 @@ Spacing_engraver::stop_spanner () { if (spacing_) { - Grob *p = Grob::unsmob (get_property ("currentCommandColumn")); + Grob *p = unsmob<Grob> (get_property ("currentCommandColumn")); spacing_->set_bound (RIGHT, p); spacing_ = 0; @@ -194,17 +194,17 @@ void Spacing_engraver::stop_translation_timestep () { Paper_column *musical_column - = derived_unsmob<Paper_column> (get_property ("currentMusicalColumn")); + = unsmob<Paper_column> (get_property ("currentMusicalColumn")); if (!spacing_) start_spanner (); musical_column->set_object ("spacing", spacing_->self_scm ()); - Grob::unsmob (get_property ("currentCommandColumn")) + unsmob<Grob> (get_property ("currentCommandColumn")) ->set_object ("spacing", spacing_->self_scm ()); SCM proportional = get_property ("proportionalNotationDuration"); - if (Moment::is_smob (proportional)) + if (unsmob<Moment> (proportional)) { musical_column->set_property ("shortest-playing-duration", proportional); musical_column->set_property ("shortest-starter-duration", proportional); diff --git a/lily/spacing-interface.cc b/lily/spacing-interface.cc index b8b3cf0711..1ade62b0e5 100644 --- a/lily/spacing-interface.cc +++ b/lily/spacing-interface.cc @@ -67,7 +67,7 @@ Spacing_interface::skylines (Grob *me, Grob *right_col) if (g && Separation_item::has_interface (g) && g->get_column () == columns[d]) { SCM sky_scm = g->get_property ("horizontal-skylines"); - Skyline_pair *sky = Skyline_pair::unsmob (sky_scm); + Skyline_pair *sky = unsmob<Skyline_pair> (sky_scm); extract_grob_set (g, "elements", elts); Grob *ycommon = common_refpoint_of_array (elts, g, Y_AXIS); @@ -108,7 +108,7 @@ Spacing_interface::right_column (Grob *me) if (!me->is_live ()) return 0; - Grob_array *a = Grob_array::unsmob (me->get_object ("right-items")); + Grob_array *a = unsmob<Grob_array> (me->get_object ("right-items")); Item *mincol = 0; int min_rank = INT_MAX; for (vsize i = 0; a && i < a->size (); i++) diff --git a/lily/spacing-loose-columns.cc b/lily/spacing-loose-columns.cc index aad9dd0db7..c3846e694d 100644 --- a/lily/spacing-loose-columns.cc +++ b/lily/spacing-loose-columns.cc @@ -60,8 +60,8 @@ set_loose_columns (System *which, Column_x_positions const *posns) if (!loose->get_system ()) break; - Paper_column *le = derived_unsmob<Paper_column> (scm_car (between)); - Paper_column *re = derived_unsmob<Paper_column> (scm_cdr (between)); + Paper_column *le = unsmob<Paper_column> (scm_car (between)); + Paper_column *re = unsmob<Paper_column> (scm_cdr (between)); if (! (le && re)) break; @@ -135,8 +135,8 @@ set_loose_columns (System *which, Column_x_positions const *posns) Paper_column *loose_col = dynamic_cast<Paper_column *> (clique[j]); Paper_column *next_col = dynamic_cast<Paper_column *> (clique[j + 1]); - Grob *spacing = Grob::unsmob (clique_col->get_object ("spacing")); - if (Grob *grace_spacing = Grob::unsmob (clique_col->get_object ("grace-spacing"))) + Grob *spacing = unsmob<Grob> (clique_col->get_object ("spacing")); + if (Grob *grace_spacing = unsmob<Grob> (clique_col->get_object ("grace-spacing"))) { spacing = grace_spacing; } diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index ee4904999f..f6f532125a 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -58,7 +58,7 @@ MAKE_SCHEME_CALLBACK (Spacing_spanner, set_springs, 1); SCM Spacing_spanner::set_springs (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); /* can't use get_system () ? --hwn. @@ -89,7 +89,7 @@ MAKE_SCHEME_CALLBACK (Spacing_spanner, calc_common_shortest_duration, 1); SCM Spacing_spanner::calc_common_shortest_duration (SCM grob) { - Spanner *me = Spanner::unsmob (grob); + Spanner *me = unsmob<Spanner> (grob); vector<Grob *> cols (get_columns (me)); @@ -106,7 +106,7 @@ Spacing_spanner::calc_common_shortest_duration (SCM grob) { if (Paper_column::is_musical (cols[i])) { - Moment *when = Moment::unsmob (cols[i]->get_property ("when")); + Moment *when = unsmob<Moment> (cols[i]->get_property ("when")); /* ignore grace notes for shortest notes. @@ -115,7 +115,7 @@ Spacing_spanner::calc_common_shortest_duration (SCM grob) continue; SCM st = cols[i]->get_property ("shortest-starter-duration"); - Moment this_shortest = *Moment::unsmob (st); + Moment this_shortest = *unsmob<Moment> (st); assert (this_shortest.to_bool ()); shortest_in_measure = min (shortest_in_measure, this_shortest.main_part_); } @@ -161,7 +161,7 @@ Spacing_spanner::calc_common_shortest_duration (SCM grob) SCM bsd = me->get_property ("base-shortest-duration"); Rational d = Rational (1, 8); - if (Moment *m = Moment::unsmob (bsd)) + if (Moment *m = unsmob<Moment> (bsd)) d = m->main_part_; if (max_idx != VPOS) @@ -237,7 +237,7 @@ set_column_rods (vector<Grob *> const &cols, Real padding) if (Separation_item::is_empty (r) && (!rb || Separation_item::is_empty (rb))) continue; - Skyline_pair *skys = Skyline_pair::unsmob (r->get_property ("horizontal-skylines")); + Skyline_pair *skys = unsmob<Skyline_pair> (r->get_property ("horizontal-skylines")); overhangs[i] = skys ? (*skys)[RIGHT].max_height () : 0.0; if (0 == i) continue; @@ -354,7 +354,7 @@ Spacing_spanner::musical_column_spacing (Grob *me, if (found_matching_column && Note_spacing::has_interface (wish)) { Real inc = options->increment_; - Grob *gsp = Grob::unsmob (left_col->get_object ("grace-spacing")); + Grob *gsp = unsmob<Grob> (left_col->get_object ("grace-spacing")); if (gsp && Paper_column::when_mom (left_col).grace_part_) { Spacing_options grace_opts; @@ -447,7 +447,7 @@ Spacing_spanner::fills_measure (Grob *me, Item *left, Item *col) Moment dt = Paper_column::when_mom (next) - Paper_column::when_mom (col); - Moment *len = Moment::unsmob (left->get_property ("measure-length")); + Moment *len = unsmob<Moment> (left->get_property ("measure-length")); if (!len) return false; diff --git a/lily/span-bar-stub-engraver.cc b/lily/span-bar-stub-engraver.cc index 9e1927db94..0f1df50b6e 100644 --- a/lily/span-bar-stub-engraver.cc +++ b/lily/span-bar-stub-engraver.cc @@ -94,7 +94,7 @@ Span_bar_stub_engraver::process_acknowledged () programming_error ("At least one vertical axis group needs to be created in the first time step."); return; } - Grob *vertical_alignment = Grob::get_root_vertical_alignment (Grob::unsmob (scm_caar (axis_groups_))); + Grob *vertical_alignment = Grob::get_root_vertical_alignment (unsmob<Grob> (scm_caar (axis_groups_))); if (!vertical_alignment) // we are at the beginning of a score, so no need for stubs return; @@ -113,8 +113,8 @@ Span_bar_stub_engraver::process_acknowledged () vector<bool> keep_extent; for (SCM s = axis_groups_; scm_is_pair (s); s = scm_cdr (s)) { - Context *c = Context::unsmob (scm_cdar (s)); - Grob *g = Grob::unsmob (scm_caar (s)); + Context *c = unsmob<Context> (scm_cdar (s)); + Grob *g = unsmob<Grob> (scm_caar (s)); if (!c || !g) continue; if (c->is_removable ()) @@ -163,8 +163,8 @@ Span_bar_stub_engraver::stop_translation_timestep () SCM axis_groups = SCM_EOL; for (SCM s = axis_groups_; scm_is_pair (s); s = scm_cdr (s)) { - Context *c = Context::unsmob (scm_cdar (s)); - Grob *g = Grob::unsmob (scm_caar (s)); + Context *c = unsmob<Context> (scm_cdar (s)); + Grob *g = unsmob<Grob> (scm_caar (s)); if (!c || !g) continue; if (c->is_removable ()) diff --git a/lily/spanner-scheme.cc b/lily/spanner-scheme.cc index 7ace84024c..1d413439b4 100644 --- a/lily/spanner-scheme.cc +++ b/lily/spanner-scheme.cc @@ -28,7 +28,7 @@ LY_DEFINE (ly_spanner_bound, "ly:spanner-bound", { LY_ASSERT_SMOB (Spanner, spanner, 1); LY_ASSERT_TYPE (is_direction, dir, 2); - Item *bound = Spanner::unsmob (spanner)->get_bound (to_dir (dir)); + Item *bound = unsmob<Spanner> (spanner)->get_bound (to_dir (dir)); return bound ? bound->self_scm () : SCM_EOL; } @@ -41,7 +41,7 @@ LY_DEFINE (ly_spanner_set_bound_x, "ly:spanner-set-bound!", LY_ASSERT_TYPE (is_direction, dir, 2); LY_ASSERT_SMOB (Item, item, 3); - Spanner::unsmob (spanner)->set_bound (to_dir (dir), Item::unsmob (item)); + unsmob<Spanner> (spanner)->set_bound (to_dir (dir), unsmob<Item> (item)); return SCM_UNSPECIFIED; } @@ -51,8 +51,8 @@ LY_DEFINE (ly_spanner_broken_into, "ly:spanner-broken-into", 1, 0, 0, (SCM spanner), "Return broken-into list for @var{spanner}.") { - LY_ASSERT_TYPE (Spanner::unsmob, spanner, 1); - Spanner *me = Spanner::unsmob (spanner); + LY_ASSERT_TYPE (unsmob<Spanner>, spanner, 1); + Spanner *me = unsmob<Spanner> (spanner); SCM s = SCM_EOL; for (vsize i = me->broken_intos_.size (); i--;) @@ -64,7 +64,7 @@ LY_DEFINE (ly_spanner_p, "ly:spanner?", 1, 0, 0, (SCM g), "Is @var{g} a spanner object?") { - Grob *me = Grob::unsmob (g); + Grob *me = unsmob<Grob> (g); bool b = dynamic_cast<Spanner *> (me); return ly_bool2scm (b); diff --git a/lily/spanner.cc b/lily/spanner.cc index 6232b8e7d3..087331ab9f 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -364,7 +364,7 @@ MAKE_SCHEME_CALLBACK (Spanner, set_spacing_rods, 1); SCM Spanner::set_spacing_rods (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); SCM num_length = me->get_property ("minimum-length"); SCM broken_length = me->get_property ("minimum-length-after-break"); if (scm_is_number (num_length) @@ -437,7 +437,7 @@ MAKE_SCHEME_CALLBACK (Spanner, calc_normalized_endpoints, 1); SCM Spanner::calc_normalized_endpoints (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); SCM result = SCM_EOL; Spanner *orig = dynamic_cast<Spanner *> (me->original ()); @@ -484,7 +484,7 @@ MAKE_SCHEME_CALLBACK (Spanner, bounds_width, 1); SCM Spanner::bounds_width (SCM grob) { - Spanner *me = Spanner::unsmob (grob); + Spanner *me = unsmob<Spanner> (grob); Grob *common = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS); @@ -500,7 +500,7 @@ MAKE_SCHEME_CALLBACK (Spanner, kill_zero_spanned_time, 1); SCM Spanner::kill_zero_spanned_time (SCM grob) { - Spanner *me = Spanner::unsmob (grob); + Spanner *me = unsmob<Spanner> (grob); /* Remove the line or hairpin at the start of the line. For piano voice indicators, it makes no sense to have them at diff --git a/lily/spring-smob.cc b/lily/spring-smob.cc index 4f6a787e37..77b01bb158 100644 --- a/lily/spring-smob.cc +++ b/lily/spring-smob.cc @@ -49,7 +49,7 @@ LY_DEFINE (ly_spring_set_inverse_compress_strength_x, "ly:spring-set-inverse-com LY_ASSERT_SMOB (Spring, spring, 1); LY_ASSERT_TYPE (scm_is_number, strength, 2); - Spring *s = Spring::unsmob (spring); + Spring *s = unsmob<Spring> (spring); s->set_inverse_compress_strength (scm_to_double (strength)); return s->smobbed_copy (); } @@ -61,7 +61,7 @@ LY_DEFINE (ly_spring_set_inverse_stretch_strength_x, "ly:spring-set-inverse-stre LY_ASSERT_SMOB (Spring, spring, 1); LY_ASSERT_TYPE (scm_is_number, strength, 2); - Spring *s = Spring::unsmob (spring); + Spring *s = unsmob<Spring> (spring); s->set_inverse_stretch_strength (scm_to_double (strength)); return s->smobbed_copy (); } diff --git a/lily/staff-grouper-interface.cc b/lily/staff-grouper-interface.cc index 6e496ca03c..55162c2bc7 100644 --- a/lily/staff-grouper-interface.cc +++ b/lily/staff-grouper-interface.cc @@ -41,7 +41,7 @@ Staff_grouper_interface::maybe_pure_within_group (Grob *me, Grob *child, bool pu if (Page_layout_problem::is_spaceable (*i) && ((pure && !Hara_kiri_group_spanner::request_suicide (*i, start, end)) || (!pure && (*i)->is_live ()))) - return me == Grob::unsmob ((*i)->get_object ("staff-grouper")); + return me == unsmob<Grob> ((*i)->get_object ("staff-grouper")); // If there was no spaceable, living child after me, I don't // count as within the group. diff --git a/lily/staff-symbol-engraver.cc b/lily/staff-symbol-engraver.cc index f9994d6954..cad91e76c3 100644 --- a/lily/staff-symbol-engraver.cc +++ b/lily/staff-symbol-engraver.cc @@ -110,7 +110,7 @@ Staff_symbol_engraver::start_spanner () { span_ = make_spanner ("StaffSymbol", SCM_EOL); span_->set_bound (LEFT, - Grob::unsmob (get_property ("currentCommandColumn"))); + unsmob<Grob> (get_property ("currentCommandColumn"))); } } @@ -121,7 +121,7 @@ Staff_symbol_engraver::stop_spanner () return; if (!finished_span_->get_bound (RIGHT)) - finished_span_->set_bound (RIGHT, Grob::unsmob (get_property ("currentCommandColumn"))); + finished_span_->set_bound (RIGHT, unsmob<Grob> (get_property ("currentCommandColumn"))); announce_end_grob (finished_span_, span_events_[STOP] diff --git a/lily/staff-symbol-referencer-scheme.cc b/lily/staff-symbol-referencer-scheme.cc index be282fa4b6..5fbd8c080b 100644 --- a/lily/staff-symbol-referencer-scheme.cc +++ b/lily/staff-symbol-referencer-scheme.cc @@ -27,7 +27,7 @@ LY_DEFINE (ly_grob_staff_position, "ly:grob-staff-position", "Return the Y-position of @var{sg} relative to the staff.") { LY_ASSERT_SMOB (Grob, sg, 1); - Grob *g = Grob::unsmob (sg); + Grob *g = unsmob<Grob> (sg); Real pos = Staff_symbol_referencer::get_position (g); if (fabs (rint (pos) - pos) < 1e-6) // ugh. @@ -43,7 +43,7 @@ LY_DEFINE (ly_position_on_line_p, "ly:position-on-line?", { LY_ASSERT_SMOB (Grob, sg, 1); LY_ASSERT_TYPE (scm_is_number, spos, 2); - Grob *g = Grob::unsmob (sg); + Grob *g = unsmob<Grob> (sg); Grob *st = Staff_symbol_referencer::get_staff_symbol (g); int pos = scm_to_int (spos); bool on_line = st ? Staff_symbol::on_line (g, pos) : false; @@ -57,7 +57,7 @@ LY_DEFINE (ly_staff_symbol_line_thickness, "ly:staff-symbol-line-thickness", " current staff-space height.") { LY_ASSERT_SMOB (Grob, grob, 1); - Grob *g = Grob::unsmob (grob); + Grob *g = unsmob<Grob> (grob); Real thickness = Staff_symbol_referencer::line_thickness (g); return scm_from_double (thickness); } @@ -70,7 +70,7 @@ LY_DEFINE (ly_staff_symbol_staff_space, "ly:staff-symbol-staff-space", " five-line staff.") { LY_ASSERT_SMOB (Grob, grob, 1); - Grob *g = Grob::unsmob (grob); + Grob *g = unsmob<Grob> (grob); Real staff_space = Staff_symbol_referencer::staff_space (g); return scm_from_double (staff_space); } @@ -81,7 +81,7 @@ LY_DEFINE (ly_staff_symbol_staff_radius, "ly:staff-symbol-staff-radius", " @var{grob}.") { LY_ASSERT_SMOB (Grob, grob, 1); - Grob *g = Grob::unsmob (grob); + Grob *g = unsmob<Grob> (grob); Real staff_radius = Staff_symbol_referencer::staff_radius (g); return scm_from_double (staff_radius); } diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index 89863d0e43..2f245fda9b 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -52,7 +52,7 @@ Staff_symbol_referencer::get_staff_symbol (Grob *me) return me; SCM st = me->get_object ("staff-symbol"); - return Grob::unsmob (st); + return unsmob<Grob> (st); } Real @@ -138,7 +138,7 @@ MAKE_SCHEME_CALLBACK (Staff_symbol_referencer, callback, 1); SCM Staff_symbol_referencer::callback (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); SCM pos = me->get_property ("staff-position"); Real off = 0.0; diff --git a/lily/staff-symbol.cc b/lily/staff-symbol.cc index f4b18dfd78..de88102d14 100644 --- a/lily/staff-symbol.cc +++ b/lily/staff-symbol.cc @@ -33,7 +33,7 @@ MAKE_SCHEME_CALLBACK (Staff_symbol, print, 1); SCM Staff_symbol::print (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Spanner *sp = dynamic_cast<Spanner *> (me); Grob *common = sp->get_bound (LEFT)->common_refpoint (sp->get_bound (RIGHT), X_AXIS); @@ -289,7 +289,7 @@ MAKE_SCHEME_CALLBACK (Staff_symbol, height, 1); SCM Staff_symbol::height (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Real t = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness")); t *= robust_scm2double (me->get_property ("thickness"), 1.0); diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index 45c777fb04..a84dd701bd 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -91,7 +91,7 @@ Stem_engraver::make_stem (Grob_info gi, bool tuplet_start) for a note head is always <= 2. */ Stream_event *ev = gi.event_cause (); - Duration *dur = Duration::unsmob (ev->get_property ("duration")); + Duration *dur = unsmob<Duration> (ev->get_property ("duration")); int tremolo_flags = intlog2 (requested_type) - 2 - (dur->duration_log () > 2 ? dur->duration_log () - 2 : 0); @@ -124,7 +124,7 @@ Stem_engraver::acknowledge_rhythmic_head (Grob_info gi) Stream_event *cause = gi.event_cause (); if (!cause) return; - Duration *d = Duration::unsmob (cause->get_property ("duration")); + Duration *d = unsmob<Duration> (cause->get_property ("duration")); if (!d) return; @@ -173,7 +173,7 @@ void Stem_engraver::kill_unused_flags () { for (vsize i = 0; i < maybe_flags_.size (); i++) - if (Grob::is_smob (maybe_flags_[i]->get_parent (X_AXIS)->get_object ("beam"))) + if (unsmob<Grob> (maybe_flags_[i]->get_parent (X_AXIS)->get_object ("beam"))) maybe_flags_[i]->suicide (); } diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index f2c716d2ec..8cb60db078 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -35,8 +35,8 @@ MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_slope, 1) SCM Stem_tremolo::calc_slope (SCM smob) { - Grob *me = Grob::unsmob (smob); - Grob *stem = Grob::unsmob (me->get_object ("stem")); + Grob *me = unsmob<Grob> (smob); + Grob *stem = unsmob<Grob> (me->get_object ("stem")); Spanner *beam = Stem::get_beam (stem); SCM style = me->get_property ("style"); @@ -69,8 +69,8 @@ MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_width, 1) SCM Stem_tremolo::calc_width (SCM smob) { - Grob *me = Grob::unsmob (smob); - Grob *stem = Grob::unsmob (me->get_object ("stem")); + Grob *me = unsmob<Grob> (smob); + Grob *stem = unsmob<Grob> (me->get_object ("stem")); Direction dir = get_grob_direction (me); bool beam = Stem::get_beam (stem); bool flag = Stem::duration_log (stem) >= 3 && !beam; @@ -83,8 +83,8 @@ MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_shape, 1) SCM Stem_tremolo::calc_shape (SCM smob) { - Grob *me = Grob::unsmob (smob); - Grob *stem = Grob::unsmob (me->get_object ("stem")); + Grob *me = unsmob<Grob> (smob); + Grob *stem = unsmob<Grob> (me->get_object ("stem")); Direction dir = get_grob_direction (me); bool beam = Stem::get_beam (stem); bool flag = Stem::duration_log (stem) >= 3 && !beam; @@ -98,7 +98,7 @@ Stem_tremolo::calc_shape (SCM smob) Real Stem_tremolo::get_beam_translation (Grob *me) { - Grob *stem = Grob::unsmob (me->get_object ("stem")); + Grob *stem = unsmob<Grob> (me->get_object ("stem")); Spanner *beam = Stem::get_beam (stem); return (beam && beam->is_live ()) @@ -155,13 +155,13 @@ MAKE_SCHEME_CALLBACK (Stem_tremolo, pure_height, 3); SCM Stem_tremolo::pure_height (SCM smob, SCM, SCM) { - Item *me = Item::unsmob (smob); + Item *me = unsmob<Item> (smob); /* Cannot use the real slope, since it looks at the Beam. */ Stencil s1 (untranslated_stencil (me, 0.35)); - Item *stem = Item::unsmob (me->get_object ("stem")); + Item *stem = unsmob<Item> (me->get_object ("stem")); if (!stem) return ly_interval2scm (s1.extent (Y_AXIS)); @@ -188,7 +188,7 @@ MAKE_SCHEME_CALLBACK (Stem_tremolo, width, 1); SCM Stem_tremolo::width (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); /* Cannot use the real slope, since it looks at the Beam. @@ -207,7 +207,7 @@ Stem_tremolo::vertical_length (Grob *me) Stencil Stem_tremolo::untranslated_stencil (Grob *me, Real slope) { - Grob *stem = Grob::unsmob (me->get_object ("stem")); + Grob *stem = unsmob<Grob> (me->get_object ("stem")); if (!stem) { programming_error ("no stem for stem-tremolo"); @@ -228,7 +228,7 @@ MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_y_offset, 1); SCM Stem_tremolo::calc_y_offset (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return scm_from_double (y_offset (me, false)); } @@ -238,7 +238,7 @@ Stem_tremolo::pure_calc_y_offset (SCM smob, SCM, /* start */ SCM /* end */) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return scm_from_double (y_offset (me, true)); } @@ -246,9 +246,9 @@ MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_direction, 1); SCM Stem_tremolo::calc_direction (SCM smob) { - Item *me = Item::unsmob (smob); + Item *me = unsmob<Item> (smob); - Item *stem = Item::unsmob (me->get_object ("stem")); + Item *stem = unsmob<Item> (me->get_object ("stem")); if (!stem) return scm_from_int (CENTER); @@ -285,7 +285,7 @@ Stem_tremolo::calc_direction (SCM smob) Real Stem_tremolo::y_offset (Grob *me, bool pure) { - Item *stem = Item::unsmob (me->get_object ("stem")); + Item *stem = unsmob<Item> (me->get_object ("stem")); if (!stem) return 0.0; @@ -337,7 +337,7 @@ MAKE_SCHEME_CALLBACK (Stem_tremolo, print, 1); SCM Stem_tremolo::print (SCM grob) { - Grob *me = Grob::unsmob (grob); + Grob *me = unsmob<Grob> (grob); Stencil s = untranslated_stencil (me, robust_scm2double (me->get_property ("slope"), 0.25)); return s.smobbed_copy (); diff --git a/lily/stem.cc b/lily/stem.cc index 0c2625b9e4..1ddd329867 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -123,7 +123,7 @@ Stem::set_stem_positions (Grob *me, Real se) // todo: margins Direction d = get_grob_direction (me); - Grob *beam = Grob::unsmob (me->get_object ("beam")); + Grob *beam = unsmob<Grob> (me->get_object ("beam")); if (d && d * head_positions (me)[get_grob_direction (me)] >= se * d) me->warning (_ ("weird stem size, check for narrow beams")); @@ -298,7 +298,7 @@ Stem::pure_height (SCM smob, SCM /* start */, SCM /* end */) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return ly_interval2scm (internal_pure_height (me, true)); } @@ -308,7 +308,7 @@ Stem::internal_pure_height (Grob *me, bool calc_beam) if (!is_normal_stem (me)) return Interval (0.0, 0.0); - Grob *beam = Grob::unsmob (me->get_object ("beam")); + Grob *beam = unsmob<Grob> (me->get_object ("beam")); Interval iv = internal_height (me, false); @@ -378,7 +378,7 @@ MAKE_SCHEME_CALLBACK (Stem, calc_stem_end_position, 1) SCM Stem::calc_stem_end_position (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return scm_from_double (internal_calc_stem_end_position (me, true)); } @@ -388,7 +388,7 @@ Stem::pure_calc_stem_end_position (SCM smob, SCM, /* start */ SCM /* end */) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return scm_from_double (internal_calc_stem_end_position (me, false)); } @@ -455,8 +455,8 @@ Stem::internal_calc_stem_end_position (Grob *me, bool calc_beam) length *= robust_scm2double (me->get_property ("length-fraction"), 1.0); /* Tremolo stuff. */ - Grob *t_flag = Grob::unsmob (me->get_object ("tremolo-flag")); - if (t_flag && (!Grob::is_smob (me->get_object ("beam")) || !calc_beam)) + Grob *t_flag = unsmob<Grob> (me->get_object ("tremolo-flag")); + if (t_flag && (!unsmob<Grob> (me->get_object ("beam")) || !calc_beam)) { /* Crude hack: add extra space if tremolo flag is there. @@ -506,7 +506,7 @@ MAKE_SCHEME_CALLBACK (Stem, calc_positioning_done, 1); SCM Stem::calc_positioning_done (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); if (!head_count (me)) return SCM_BOOL_T; @@ -632,9 +632,9 @@ MAKE_SCHEME_CALLBACK (Stem, calc_direction, 1); SCM Stem::calc_direction (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Direction dir = CENTER; - if (Grob *beam = Grob::unsmob (me->get_object ("beam"))) + if (Grob *beam = unsmob<Grob> (me->get_object ("beam"))) { SCM ignore_me = beam->get_property ("direction"); (void) ignore_me; @@ -655,7 +655,7 @@ MAKE_SCHEME_CALLBACK (Stem, calc_default_direction, 1); SCM Stem::calc_default_direction (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Direction dir = CENTER; int staff_center = 0; @@ -677,7 +677,7 @@ MAKE_SCHEME_CALLBACK (Stem, height, 1); SCM Stem::height (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return ly_interval2scm (internal_height (me, true)); } @@ -692,7 +692,7 @@ Stem::get_reference_head (Grob *me) Real Stem::beam_end_corrective (Grob *me) { - Grob *beam = Grob::unsmob (me->get_object ("beam")); + Grob *beam = unsmob<Grob> (me->get_object ("beam")); Direction dir = get_grob_direction (me); if (beam) { @@ -725,7 +725,7 @@ Stem::internal_height (Grob *me, bool calc_beam) If there is a beam but no stem, slope calculations depend on this routine to return where the stem end /would/ be. */ - if (calc_beam && !beam && !Stencil::is_smob (me->get_property ("stencil"))) + if (calc_beam && !beam && !unsmob<Stencil> (me->get_property ("stencil"))) return Interval (); Real y1 = robust_scm2double ((calc_beam @@ -750,7 +750,7 @@ MAKE_SCHEME_CALLBACK (Stem, width, 1); SCM Stem::width (SCM e) { - Grob *me = Grob::unsmob (e); + Grob *me = unsmob<Grob> (e); Interval r; @@ -776,7 +776,7 @@ MAKE_SCHEME_CALLBACK (Stem, calc_stem_begin_position, 1); SCM Stem::calc_stem_begin_position (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return scm_from_double (internal_calc_stem_begin_position (me, true)); } @@ -786,7 +786,7 @@ Stem::pure_calc_stem_begin_position (SCM smob, SCM, /* start */ SCM /* end */) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return scm_from_double (internal_calc_stem_begin_position (me, false)); } @@ -827,7 +827,7 @@ MAKE_SCHEME_CALLBACK (Stem, pure_calc_length, 3); SCM Stem::pure_calc_length (SCM smob, SCM /*start*/, SCM /*end*/) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Real beg = robust_scm2double (me->get_pure_property ("stem-begin-position", 0, INT_MAX), 0.0); Real res = fabs (internal_calc_stem_end_position (me, false) - beg); return scm_from_double (res); @@ -837,8 +837,8 @@ MAKE_SCHEME_CALLBACK (Stem, calc_length, 1); SCM Stem::calc_length (SCM smob) { - Grob *me = Grob::unsmob (smob); - if (Grob::is_smob (me->get_object ("beam"))) + Grob *me = unsmob<Grob> (smob); + if (unsmob<Grob> (me->get_object ("beam"))) { me->programming_error ("ly:stem::calc-length called but will not be used for beamed stem."); return scm_from_double (0.0); @@ -857,7 +857,7 @@ Stem::is_valid_stem (Grob *me) if (!me) return false; Grob *lh = get_reference_head (me); - Grob *beam = Grob::unsmob (me->get_object ("beam")); + Grob *beam = unsmob<Grob> (me->get_object ("beam")); if (!lh && !beam) return false; @@ -872,7 +872,7 @@ MAKE_SCHEME_CALLBACK (Stem, print, 1); SCM Stem::print (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); if (!is_valid_stem (me)) return SCM_EOL; @@ -908,7 +908,7 @@ MAKE_SCHEME_CALLBACK (Stem, offset_callback, 1); SCM Stem::offset_callback (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "rests", rests); if (rests.size ()) @@ -952,7 +952,7 @@ Spanner * Stem::get_beam (Grob *me) { SCM b = me->get_object ("beam"); - return Spanner::unsmob (b); + return unsmob<Spanner> (b); } Stem_info @@ -971,7 +971,7 @@ MAKE_SCHEME_CALLBACK (Stem, calc_stem_info, 1); SCM Stem::calc_stem_info (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Direction my_dir = get_grob_direction (me); if (!my_dir) @@ -1021,7 +1021,7 @@ Stem::calc_stem_info (SCM smob) : 0.0); Real height_of_my_trem = 0.0; - Grob *trem = Grob::unsmob (me->get_object ("tremolo-flag")); + Grob *trem = unsmob<Grob> (me->get_object ("tremolo-flag")); if (trem) { height_of_my_trem @@ -1120,7 +1120,7 @@ Stem::beam_multiplicity (Grob *stem) bool Stem::is_cross_staff (Grob *stem) { - Grob *beam = Grob::unsmob (stem->get_object ("beam")); + Grob *beam = unsmob<Grob> (stem->get_object ("beam")); return beam && Beam::is_cross_staff (beam); } @@ -1128,13 +1128,13 @@ MAKE_SCHEME_CALLBACK (Stem, calc_cross_staff, 1) SCM Stem::calc_cross_staff (SCM smob) { - return scm_from_bool (is_cross_staff (Grob::unsmob (smob))); + return scm_from_bool (is_cross_staff (unsmob<Grob> (smob))); } Grob * Stem::flag (Grob *me) { - return Grob::unsmob (me->get_object ("flag")); + return unsmob<Grob> (me->get_object ("flag")); } /* FIXME: Too many properties */ diff --git a/lily/stencil-integral.cc b/lily/stencil-integral.cc index 0bdb00a8ed..e72517e4ea 100644 --- a/lily/stencil-integral.cc +++ b/lily/stencil-integral.cc @@ -691,7 +691,7 @@ void make_named_glyph_boxes (vector<Box> &boxes, vector<Drul_array<Offset> > &buildings, PangoMatrix trans, SCM expr) { SCM fm_scm = scm_car (expr); - Font_metric *fm = Font_metric::unsmob (fm_scm); + Font_metric *fm = unsmob<Font_metric> (fm_scm); expr = scm_cdr (expr); SCM glyph = scm_car (expr); string glyph_s = ly_scm2string (glyph); @@ -730,7 +730,7 @@ void make_glyph_string_boxes (vector<Box> &boxes, vector<Drul_array<Offset> > &buildings, PangoMatrix trans, SCM expr) { SCM fm_scm = scm_car (expr); - Font_metric *fm = Font_metric::unsmob (fm_scm); + Font_metric *fm = unsmob<Font_metric> (fm_scm); expr = scm_cdr (expr); expr = scm_cdr (expr); // font-name expr = scm_cdr (expr); // size @@ -994,7 +994,7 @@ MAKE_SCHEME_CALLBACK (Grob, pure_simple_vertical_skylines_from_extents, 3); SCM Grob::pure_simple_vertical_skylines_from_extents (SCM smob, SCM begscm, SCM endscm) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); int beg = robust_scm2int (begscm, 0); int end = robust_scm2int (endscm, INT_MAX); // We cannot measure the widths before line breaking, @@ -1006,7 +1006,7 @@ MAKE_SCHEME_CALLBACK (Grob, simple_vertical_skylines_from_extents, 1); SCM Grob::simple_vertical_skylines_from_extents (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return maybe_pure_internal_simple_skylines_from_extents (me, X_AXIS, false, 0, 0, false, false); } @@ -1014,7 +1014,7 @@ MAKE_SCHEME_CALLBACK (Grob, pure_simple_horizontal_skylines_from_extents, 3); SCM Grob::pure_simple_horizontal_skylines_from_extents (SCM smob, SCM begscm, SCM endscm) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); int beg = robust_scm2int (begscm, 0); int end = robust_scm2int (endscm, INT_MAX); // If the grob is cross staff, we cannot measure its Y-extent before @@ -1027,7 +1027,7 @@ MAKE_SCHEME_CALLBACK (Grob, simple_horizontal_skylines_from_extents, 1); SCM Grob::simple_horizontal_skylines_from_extents (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); // See comment in function above. return maybe_pure_internal_simple_skylines_from_extents (me, Y_AXIS, false, 0, 0, false, to_boolean (me->get_property ("cross-staff"))); } @@ -1035,7 +1035,7 @@ Grob::simple_horizontal_skylines_from_extents (SCM smob) SCM Stencil::skylines_from_stencil (SCM sten, Real pad, Axis a) { - Stencil *s = Stencil::unsmob (sten); + Stencil *s = unsmob<Stencil> (sten); if (!s) return Skyline_pair ().smobbed_copy (); @@ -1064,7 +1064,7 @@ MAKE_SCHEME_CALLBACK (Grob, vertical_skylines_from_stencil, 1); SCM Grob::vertical_skylines_from_stencil (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Real pad = robust_scm2double (me->get_property ("skyline-horizontal-padding"), 0.0); SCM out = Stencil::skylines_from_stencil (me->get_property ("stencil"), pad, X_AXIS); @@ -1076,7 +1076,7 @@ MAKE_SCHEME_CALLBACK (Grob, horizontal_skylines_from_stencil, 1); SCM Grob::horizontal_skylines_from_stencil (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Real pad = robust_scm2double (me->get_property ("skyline-vertical-padding"), 0.0); SCM out = Stencil::skylines_from_stencil (me->get_property ("stencil"), pad, Y_AXIS); @@ -1104,7 +1104,7 @@ Grob::internal_skylines_from_element_stencils (Grob *me, Axis a, bool pure, int Skyline_pair res; for (vsize i = 0; i < elts.size (); i++) { - Skyline_pair *skyp = Skyline_pair::unsmob (elts[i]->get_maybe_pure_property (a == X_AXIS ? "vertical-skylines" : "horizontal-skylines", pure, beg, end)); + Skyline_pair *skyp = unsmob<Skyline_pair> (elts[i]->get_maybe_pure_property (a == X_AXIS ? "vertical-skylines" : "horizontal-skylines", pure, beg, end)); if (skyp) { /* @@ -1138,7 +1138,7 @@ MAKE_SCHEME_CALLBACK (Grob, vertical_skylines_from_element_stencils, 1); SCM Grob::vertical_skylines_from_element_stencils (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return internal_skylines_from_element_stencils (me, X_AXIS, false, 0, INT_MAX); } @@ -1146,7 +1146,7 @@ MAKE_SCHEME_CALLBACK (Grob, horizontal_skylines_from_element_stencils, 1); SCM Grob::horizontal_skylines_from_element_stencils (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); return internal_skylines_from_element_stencils (me, Y_AXIS, false, 0, INT_MAX); } @@ -1154,7 +1154,7 @@ MAKE_SCHEME_CALLBACK (Grob, pure_vertical_skylines_from_element_stencils, 3); SCM Grob::pure_vertical_skylines_from_element_stencils (SCM smob, SCM beg_scm, SCM end_scm) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); int beg = robust_scm2int (beg_scm, 0); int end = robust_scm2int (end_scm, 0); return internal_skylines_from_element_stencils (me, X_AXIS, true, beg, end); @@ -1164,7 +1164,7 @@ MAKE_SCHEME_CALLBACK (Grob, pure_horizontal_skylines_from_element_stencils, 3); SCM Grob::pure_horizontal_skylines_from_element_stencils (SCM smob, SCM beg_scm, SCM end_scm) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); int beg = robust_scm2int (beg_scm, 0); int end = robust_scm2int (end_scm, 0); return internal_skylines_from_element_stencils (me, Y_AXIS, true, beg, end); diff --git a/lily/stencil-scheme.cc b/lily/stencil-scheme.cc index ab4ebd3a7c..e79dda1873 100644 --- a/lily/stencil-scheme.cc +++ b/lily/stencil-scheme.cc @@ -31,7 +31,7 @@ LY_DEFINE (ly_stencil_translate_axis, "ly:stencil-translate-axis", "Return a copy of @var{stil} but translated by @var{amount}" " in @var{axis} direction.") { - Stencil *s = Stencil::unsmob (stil); + Stencil *s = unsmob<Stencil> (stil); LY_ASSERT_SMOB (Stencil, stil, 1); LY_ASSERT_TYPE (scm_is_number, amount, 2); @@ -42,7 +42,7 @@ LY_DEFINE (ly_stencil_translate_axis, "ly:stencil-translate-axis", SCM new_s = s->smobbed_copy (); scm_remember_upto_here_1 (stil); - Stencil *q = Stencil::unsmob (new_s); + Stencil *q = unsmob<Stencil> (new_s); q->translate_axis (real_amount, Axis (scm_to_int (axis))); return new_s; } @@ -52,7 +52,7 @@ LY_DEFINE (ly_stencil_translate, "ly:stencil-translate", "Return a @var{stil}, but translated by @var{offset}" " (a pair of numbers).") { - Stencil *s = Stencil::unsmob (stil); + Stencil *s = unsmob<Stencil> (stil); LY_ASSERT_SMOB (Stencil, stil, 1); LY_ASSERT_TYPE (is_number_pair, offset, 2); Offset o = ly_scm2offset (offset); @@ -60,7 +60,7 @@ LY_DEFINE (ly_stencil_translate, "ly:stencil-translate", SCM new_s = s->smobbed_copy (); scm_remember_upto_here_1 (stil); - Stencil *q = Stencil::unsmob (new_s); + Stencil *q = unsmob<Stencil> (new_s); q->translate (o); return new_s; } @@ -69,7 +69,7 @@ LY_DEFINE (ly_stencil_expr, "ly:stencil-expr", 1, 0, 0, (SCM stil), "Return the expression of @var{stil}.") { - Stencil *s = Stencil::unsmob (stil); + Stencil *s = unsmob<Stencil> (stil); LY_ASSERT_SMOB (Stencil, stil, 1); return s->expr (); } @@ -80,7 +80,7 @@ LY_DEFINE (ly_stencil_extent, "ly:stencil-extent", " @var{axis} direction (@code{0} or @code{1} for x and" " y@tie{}axis, respectively).") { - Stencil *s = Stencil::unsmob (stil); + Stencil *s = unsmob<Stencil> (stil); LY_ASSERT_SMOB (Stencil, stil, 1); LY_ASSERT_TYPE (is_axis, axis, 2); @@ -93,7 +93,7 @@ LY_DEFINE (ly_stencil_empty_p, "ly:stencil-empty?", " @var{axis} is supplied, the emptiness check is" " restricted to that axis.") { - Stencil *s = Stencil::unsmob (stil); + Stencil *s = unsmob<Stencil> (stil); LY_ASSERT_SMOB (Stencil, stil, 1); if (SCM_UNBNDP (axis)) return scm_from_bool (s->is_empty ()); @@ -112,8 +112,8 @@ LY_DEFINE (ly_stencil_combine_at_edge, "ly:stencil-combine-at-edge", " space. @var{first} and @var{second} may also be @code{'()} or" " @code{#f}.") { - Stencil *s1 = Stencil::unsmob (first); - Stencil *s2 = Stencil::unsmob (second); + Stencil *s1 = unsmob<Stencil> (first); + Stencil *s2 = unsmob<Stencil> (second); Stencil result; SCM_ASSERT_TYPE (s1 || scm_is_false (first) || scm_is_null (first), @@ -159,8 +159,8 @@ LY_DEFINE (ly_stencil_stack, "ly:stencil-stack", " apart at least by this distance. If either of the stencils" " is spacing, @var{padding} and @var{mindist} do not apply.") { - Stencil *s1 = Stencil::unsmob (first); - Stencil *s2 = Stencil::unsmob (second); + Stencil *s1 = unsmob<Stencil> (first); + Stencil *s2 = unsmob<Stencil> (second); Stencil result; SCM_ASSERT_TYPE (s1 || scm_is_false (first) || scm_is_null (first), @@ -210,7 +210,7 @@ LY_DEFINE (ly_stencil_add, "ly:stencil-add", while (!SCM_NULLP (args)) { - Stencil *s = Stencil::unsmob (scm_car (args)); + Stencil *s = unsmob<Stencil> (scm_car (args)); if (!s) SCM_ASSERT_TYPE (s, scm_car (args), SCM_ARGn, __FUNCTION__, "Stencil"); @@ -280,7 +280,7 @@ LY_DEFINE (ly_stencil_aligned_to, "ly:stencil-aligned-to", LY_ASSERT_TYPE (is_axis, axis, 2); LY_ASSERT_TYPE (scm_is_number, dir, 3); - Stencil target = *Stencil::unsmob (stil); + Stencil target = *unsmob<Stencil> (stil); target.align_to ((Axis)scm_to_int (axis), scm_to_double (dir)); @@ -293,7 +293,7 @@ LY_DEFINE (ly_stencil_fonts, "ly:stencil-fonts", " in@tie{}@var{s}.") { LY_ASSERT_SMOB (Stencil, s, 1); - Stencil *stil = Stencil::unsmob (s); + Stencil *stil = unsmob<Stencil> (s); return find_expression_fonts (stil->expr ()); } @@ -302,7 +302,7 @@ LY_DEFINE (ly_stencil_in_color, "ly:stencil-in-color", "Put @var{stc} in a different color.") { LY_ASSERT_SMOB (Stencil, stc, 1); - Stencil *stil = Stencil::unsmob (stc); + Stencil *stil = unsmob<Stencil> (stc); return Stencil (stil->extent_box (), scm_list_3 (ly_symbol2scm ("color"), scm_list_3 (r, g, b), @@ -363,7 +363,7 @@ LY_DEFINE (ly_stencil_rotate, "ly:stencil-rotate", " the relative offset (@var{x}, @var{y}). E.g., an offset of" " (-1, 1) will rotate the stencil around the left upper corner.") { - Stencil *s = Stencil::unsmob (stil); + Stencil *s = unsmob<Stencil> (stil); LY_ASSERT_SMOB (Stencil, stil, 1); LY_ASSERT_TYPE (scm_is_number, angle, 2); LY_ASSERT_TYPE (scm_is_number, x, 3); @@ -373,7 +373,7 @@ LY_DEFINE (ly_stencil_rotate, "ly:stencil-rotate", Real y_off = scm_to_double (y); SCM new_s = s->smobbed_copy (); - Stencil *q = Stencil::unsmob (new_s); + Stencil *q = unsmob<Stencil> (new_s); q->rotate_degrees (a, Offset (x_off, y_off)); return new_s; } @@ -383,7 +383,7 @@ LY_DEFINE (ly_stencil_rotate_absolute, "ly:stencil-rotate-absolute", "Return a stencil @var{stil} rotated @var{angle} degrees around" " point (@var{x}, @var{y}), given in absolute coordinates.") { - Stencil *s = Stencil::unsmob (stil); + Stencil *s = unsmob<Stencil> (stil); LY_ASSERT_SMOB (Stencil, stil, 1); LY_ASSERT_TYPE (scm_is_number, angle, 2); LY_ASSERT_TYPE (scm_is_number, x, 3); @@ -393,7 +393,7 @@ LY_DEFINE (ly_stencil_rotate_absolute, "ly:stencil-rotate-absolute", Real y_off = scm_to_double (y); SCM new_s = s->smobbed_copy (); - Stencil *q = Stencil::unsmob (new_s); + Stencil *q = unsmob<Stencil> (new_s); q->rotate_degrees_absolute (a, Offset (x_off, y_off)); return new_s; } @@ -462,13 +462,13 @@ LY_DEFINE (ly_stencil_scale, "ly:stencil-scale", " flip or mirror @var{stil} without changing its origin;" " this may result in collisions unless it is repositioned.") { - Stencil *s = Stencil::unsmob (stil); + Stencil *s = unsmob<Stencil> (stil); LY_ASSERT_SMOB (Stencil, stil, 1); LY_ASSERT_TYPE (scm_is_number, x, 2); LY_ASSERT_TYPE (scm_is_number, y, 3); SCM new_s = s->smobbed_copy (); - Stencil *q = Stencil::unsmob (new_s); + Stencil *q = unsmob<Stencil> (new_s); q->scale (scm_to_double (x), scm_to_double (y)); return new_s; diff --git a/lily/stream-event-scheme.cc b/lily/stream-event-scheme.cc index bf8056e16a..ccc37e0110 100644 --- a/lily/stream-event-scheme.cc +++ b/lily/stream-event-scheme.cc @@ -23,7 +23,7 @@ LY_DEFINE (ly_stream_event_p, "ly:stream-event?", 1, 0, 0, (SCM obj), "Is @code{@var{obj}} a @code{Stream_event} object?") { - return scm_from_bool (Stream_event::is_smob (obj)); + return scm_from_bool (unsmob<Stream_event> (obj)); } LY_DEFINE (ly_make_stream_event, "ly:make-stream-event", @@ -49,7 +49,7 @@ LY_DEFINE (ly_event_property, "ly:event-property", " If @var{sym} is undefined, return @var{val} or" " @code{'()} if @var{val} is not specified.") { - LY_ASSERT_SMOB (Stream_event, sev, 1) + LY_ASSERT_SMOB (Stream_event, sev, 1); return ly_prob_property (sev, sym, val); } @@ -68,7 +68,7 @@ LY_DEFINE (ly_event_deep_copy, "ly:event-deep-copy", "Copy @var{m} and all sub expressions of@tie{}@var{m}.") { SCM copy = m; - if (Stream_event *ev = Stream_event::unsmob (m)) + if (Stream_event *ev = unsmob<Stream_event> (m)) { ev = ev->clone (); copy = ev->unprotect (); diff --git a/lily/stream-event.cc b/lily/stream-event.cc index 7fb596c264..82bcfd8db8 100644 --- a/lily/stream-event.cc +++ b/lily/stream-event.cc @@ -54,7 +54,7 @@ Stream_event::copy_mutable_properties () const Input * Stream_event::origin () const { - Input *i = Input::unsmob (get_property ("origin")); + Input *i = unsmob<Input> (get_property ("origin")); return i ? i : &dummy_input_global; } @@ -86,8 +86,8 @@ Stream_event::make_transposable () SCM prop = scm_car (entry); SCM val = scm_cdr (entry); - if ((Pitch::is_smob (val) - || (scm_is_eq (prop, ly_symbol2scm ("element")) && Music::is_smob (val)) + if ((unsmob<Pitch> (val) + || (scm_is_eq (prop, ly_symbol2scm ("element")) && unsmob<Music> (val)) || (scm_is_eq (prop, ly_symbol2scm ("elements")) && scm_is_pair (val)) || (scm_is_eq (prop, ly_symbol2scm ("pitch-alist")) && scm_is_pair (val))) && scm_is_false (scm_assq (prop, mutable_property_alist_))) @@ -99,7 +99,7 @@ Stream_event::make_transposable () SCM Stream_event::dump (SCM self) { - Stream_event *ev = Stream_event::unsmob (self); + Stream_event *ev = unsmob<Stream_event> (self); // Reversed alists look prettier. return scm_cons (scm_reverse (ev->immutable_property_alist_), scm_reverse (ev->mutable_property_alist_)); diff --git a/lily/sustain-pedal.cc b/lily/sustain-pedal.cc index e020bc522e..724059742d 100644 --- a/lily/sustain-pedal.cc +++ b/lily/sustain-pedal.cc @@ -48,7 +48,7 @@ MAKE_SCHEME_CALLBACK (Sustain_pedal, print, 1); SCM Sustain_pedal::print (SCM smob) { - Grob *e = Grob::unsmob (smob); + Grob *e = unsmob<Grob> (smob); Stencil mol; SCM glyph = e->get_property ("text"); diff --git a/lily/system-start-delimiter-engraver.cc b/lily/system-start-delimiter-engraver.cc index 73a3c8ccc7..a37c520dfc 100644 --- a/lily/system-start-delimiter-engraver.cc +++ b/lily/system-start-delimiter-engraver.cc @@ -191,7 +191,7 @@ System_start_delimiter_engraver::process_music () nesting_->from_list (hierarchy); nesting_->create_grobs (this, delimiter_name); nesting_->set_bound (LEFT, - Grob::unsmob (get_property ("currentCommandColumn"))); + unsmob<Grob> (get_property ("currentCommandColumn"))); } } @@ -201,7 +201,7 @@ System_start_delimiter_engraver::finalize () if (nesting_) { nesting_->set_bound (RIGHT, - Grob::unsmob (get_property ("currentCommandColumn"))); + unsmob<Grob> (get_property ("currentCommandColumn"))); nesting_->set_nesting_support (0); delete nesting_; diff --git a/lily/system-start-delimiter.cc b/lily/system-start-delimiter.cc index 563a035acc..e5460a0f04 100644 --- a/lily/system-start-delimiter.cc +++ b/lily/system-start-delimiter.cc @@ -93,7 +93,7 @@ MAKE_SCHEME_CALLBACK (System_start_delimiter, print, 1); SCM System_start_delimiter::print (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); extract_grob_set (me, "elements", elts); Grob *common = common_refpoint_of_array (elts, me, Y_AXIS); diff --git a/lily/system.cc b/lily/system.cc index 4f98412745..d30a5f3429 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -62,7 +62,7 @@ void System::init_elements () { SCM scm_arr = Grob_array::make_array (); - all_elements_ = Grob_array::unsmob (scm_arr); + all_elements_ = unsmob<Grob_array> (scm_arr); all_elements_->set_ordered (false); set_object ("all-elements", scm_arr); } @@ -333,7 +333,7 @@ System::internal_get_note_heights_in_range (vsize start, vsize end, bool foot) SCM footnote_stl = Text_interface::interpret_markup (pscore_->layout ()->self_scm (), props, footnote_markup); - Stencil *footnote_stencil = Stencil::unsmob (footnote_stl); + Stencil *footnote_stencil = unsmob<Stencil> (footnote_stl); out.push_back (footnote_stencil->extent (Y_AXIS).length ()); } @@ -378,7 +378,7 @@ MAKE_SCHEME_CALLBACK (System, footnotes_before_line_breaking, 1); SCM System::footnotes_before_line_breaking (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); vector<Grob *> footnotes; SCM grobs_scm = Grob_array::make_array (); extract_grob_set (me, "all-elements", elts); @@ -386,7 +386,7 @@ System::footnotes_before_line_breaking (SCM smob) if (elts[i]->internal_has_interface (ly_symbol2scm ("footnote-interface"))) footnotes.push_back (elts[i]); - Grob_array::unsmob (grobs_scm)->set_array (footnotes); + unsmob<Grob_array> (grobs_scm)->set_array (footnotes); return grobs_scm; } @@ -394,14 +394,14 @@ MAKE_SCHEME_CALLBACK (System, footnotes_after_line_breaking, 1); SCM System::footnotes_after_line_breaking (SCM smob) { - Spanner *sys_span = Spanner::unsmob (smob); + Spanner *sys_span = unsmob<Spanner> (smob); System *sys = dynamic_cast<System *> (sys_span); Interval_t<int> sri = sys->spanned_rank_interval (); vector<Grob *> footnote_grobs = sys->get_footnote_grobs_in_range (sri[LEFT], sri[RIGHT]); vector_sort (footnote_grobs, grob_2D_less); SCM grobs_scm = Grob_array::make_array (); - Grob_array::unsmob (grobs_scm)->set_array (footnote_grobs); + unsmob<Grob_array> (grobs_scm)->set_array (footnote_grobs); return grobs_scm; } @@ -409,7 +409,7 @@ MAKE_SCHEME_CALLBACK (System, vertical_skyline_elements, 1); SCM System::vertical_skyline_elements (SCM smob) { - Grob *me_grob = Grob::unsmob (smob); + Grob *me_grob = unsmob<Grob> (smob); vector<Grob *> vertical_skyline_grobs; extract_grob_set (me_grob, "elements", my_elts); for (vsize i = 0; i < my_elts.size (); i++) @@ -417,11 +417,11 @@ System::vertical_skyline_elements (SCM smob) vertical_skyline_grobs.push_back (my_elts[i]); System *me = dynamic_cast<System *> (me_grob); - Grob *align = Grob::unsmob (me->get_object ("vertical-alignment")); + Grob *align = unsmob<Grob> (me->get_object ("vertical-alignment")); if (!align) { SCM grobs_scm = Grob_array::make_array (); - Grob_array::unsmob (grobs_scm)->set_array (vertical_skyline_grobs); + unsmob<Grob_array> (grobs_scm)->set_array (vertical_skyline_grobs); return grobs_scm; } @@ -432,7 +432,7 @@ System::vertical_skyline_elements (SCM smob) vertical_skyline_grobs.push_back (elts[i]); SCM grobs_scm = Grob_array::make_array (); - Grob_array::unsmob (grobs_scm)->set_array (vertical_skyline_grobs); + unsmob<Grob_array> (grobs_scm)->set_array (vertical_skyline_grobs); return grobs_scm; } @@ -489,12 +489,12 @@ void System::add_column (Paper_column *p) { Grob *me = this; - Grob_array *ga = Grob_array::unsmob (me->get_object ("columns")); + Grob_array *ga = unsmob<Grob_array> (me->get_object ("columns")); if (!ga) { SCM scm_ga = Grob_array::make_array (); me->set_object ("columns", scm_ga); - ga = Grob_array::unsmob (scm_ga); + ga = unsmob<Grob_array> (scm_ga); } p->set_rank (ga->size ()); @@ -624,7 +624,7 @@ System::get_paper_system () exprs)); if (debug_skylines) { - Skyline_pair *skylines = Skyline_pair::unsmob (get_property ("vertical-skylines")); + Skyline_pair *skylines = unsmob<Skyline_pair> (get_property ("vertical-skylines")); if (skylines) { Stencil up @@ -653,7 +653,7 @@ System::get_paper_system () pl->set_property ("last-in-score", SCM_BOOL_T); Interval staff_refpoints; - if (Grob *align = Grob::unsmob (get_object ("vertical-alignment"))) + if (Grob *align = unsmob<Grob> (get_object ("vertical-alignment"))) { extract_grob_set (align, "elements", staves); for (vsize i = 0; i < staves.size (); i++) @@ -758,7 +758,7 @@ MAKE_SCHEME_CALLBACK (System, get_vertical_alignment, 1); SCM System::get_vertical_alignment (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "elements", elts); Grob *ret = 0; for (vsize i = 0; i < elts.size (); i++) @@ -782,7 +782,7 @@ System::get_vertical_alignment (SCM smob) Grob * System::get_extremal_staff (Direction dir, Interval const &iv) { - Grob *align = Grob::unsmob (get_object ("vertical-alignment")); + Grob *align = unsmob<Grob> (get_object ("vertical-alignment")); if (!align) return 0; @@ -806,7 +806,7 @@ System::get_extremal_staff (Direction dir, Interval const &iv) Grob * System::get_neighboring_staff (Direction dir, Grob *vertical_axis_group, Interval_t<int> bounds) { - Grob *align = Grob::unsmob (get_object ("vertical-alignment")); + Grob *align = unsmob<Grob> (get_object ("vertical-alignment")); if (!align) return 0; @@ -836,7 +836,7 @@ Interval System::pure_refpoint_extent (vsize start, vsize end) { Interval ret; - Grob *alignment = Grob::unsmob (get_object ("vertical-alignment")); + Grob *alignment = unsmob<Grob> (get_object ("vertical-alignment")); if (!alignment) return Interval (); @@ -863,7 +863,7 @@ System::pure_refpoint_extent (vsize start, vsize end) Interval System::part_of_line_pure_height (vsize start, vsize end, bool begin) { - Grob *alignment = Grob::unsmob (get_object ("vertical-alignment")); + Grob *alignment = unsmob<Grob> (get_object ("vertical-alignment")); if (!alignment) return Interval (); @@ -909,7 +909,7 @@ MAKE_SCHEME_CALLBACK (System, calc_pure_relevant_grobs, 1); SCM System::calc_pure_relevant_grobs (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "elements", elts); vector<Grob *> relevant_grobs; @@ -934,7 +934,7 @@ System::calc_pure_relevant_grobs (SCM smob) SCM grobs_scm = Grob_array::make_array (); - Grob_array::unsmob (grobs_scm)->set_array (relevant_grobs); + unsmob<Grob_array> (grobs_scm)->set_array (relevant_grobs); return grobs_scm; } @@ -949,7 +949,7 @@ MAKE_SCHEME_CALLBACK (System, calc_pure_height, 3); SCM System::calc_pure_height (SCM smob, SCM start_scm, SCM end_scm) { - System *me = derived_unsmob<System> (smob); + System *me = unsmob<System> (smob); int start = scm_to_int (start_scm); int end = scm_to_int (end_scm); @@ -993,8 +993,8 @@ enum static SCM get_maybe_spaceable_staves (SCM smob, int filter) { - System *me = derived_unsmob<System> (smob); - Grob *align = Grob::unsmob (me->get_object ("vertical_alignment")); + System *me = unsmob<System> (smob); + Grob *align = unsmob<Grob> (me->get_object ("vertical_alignment")); SCM ret = SCM_EOL; if (align) diff --git a/lily/tab-tie-follow-engraver.cc b/lily/tab-tie-follow-engraver.cc index 16da8853a1..b26bf0f6f6 100644 --- a/lily/tab-tie-follow-engraver.cc +++ b/lily/tab-tie-follow-engraver.cc @@ -85,7 +85,7 @@ Tab_tie_follow_engraver::stop_translation_timestep () if (left_item) { SCM left_cause = left_item->get_property ("cause"); - Item *slur_cause = Item::unsmob (left_cause); + Item *slur_cause = unsmob<Item> (left_cause); if (slur_cause == note_heads_[k]) { note_heads_[k]->set_property ("span-start", SCM_BOOL_T); diff --git a/lily/tempo-performer.cc b/lily/tempo-performer.cc index f69166e9c5..b17e9202cb 100644 --- a/lily/tempo-performer.cc +++ b/lily/tempo-performer.cc @@ -61,10 +61,10 @@ void Tempo_performer::process_music () { SCM w = get_property ("tempoWholesPerMinute"); - if (Moment::is_smob (w) + if (unsmob<Moment> (w) && !ly_is_equal (w, last_tempo_)) { - Rational r = Moment::unsmob (w)->main_part_; + Rational r = unsmob<Moment> (w)->main_part_; r *= Rational (4, 1); audio_ = new Audio_tempo (r.to_int ()); diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc index f242fa4db2..2a12e75a7a 100644 --- a/lily/text-engraver.cc +++ b/lily/text-engraver.cc @@ -88,7 +88,7 @@ Text_engraver::acknowledge_note_column (Grob_info info) extract_grob_set (info.grob (), "note-heads", heads); Grob *x_parent = (heads.size () ? info.grob () - : Grob::unsmob (info.grob ()->get_object ("rest"))); + : unsmob<Grob> (info.grob ()->get_object ("rest"))); for (vsize i = 0; i < scripts_.size (); i++) { diff --git a/lily/text-interface.cc b/lily/text-interface.cc index 012718d621..138ede129e 100644 --- a/lily/text-interface.cc +++ b/lily/text-interface.cc @@ -76,7 +76,7 @@ Text_interface::interpret_string (SCM layout_smob, LY_ASSERT_TYPE (scm_is_string, markup, 3); string str = ly_scm2string (markup); - Output_def *layout = Output_def::unsmob (layout_smob); + Output_def *layout = unsmob<Output_def> (layout_smob); Font_metric *fm = select_encoded_font (layout, props); replace_special_characters (str, props); @@ -159,7 +159,7 @@ MAKE_SCHEME_CALLBACK (Text_interface, print, 1); SCM Text_interface::print (SCM grob) { - Grob *me = Grob::unsmob (grob); + Grob *me = unsmob<Grob> (grob); SCM t = me->get_property ("text"); SCM chain = Font_interface::text_font_alist_chain (me); diff --git a/lily/text-spanner-engraver.cc b/lily/text-spanner-engraver.cc index 8b0e72265d..f34f494301 100644 --- a/lily/text-spanner-engraver.cc +++ b/lily/text-spanner-engraver.cc @@ -101,7 +101,7 @@ Text_spanner_engraver::typeset_all () { if (!finished_->get_bound (RIGHT)) { - Grob *e = Grob::unsmob (get_property ("currentMusicalColumn")); + Grob *e = unsmob<Grob> (get_property ("currentMusicalColumn")); finished_->set_bound (RIGHT, e); } finished_ = 0; @@ -113,7 +113,7 @@ Text_spanner_engraver::stop_translation_timestep () { if (span_ && !span_->get_bound (LEFT)) { - Grob *e = Grob::unsmob (get_property ("currentMusicalColumn")); + Grob *e = unsmob<Grob> (get_property ("currentMusicalColumn")); span_->set_bound (LEFT, e); } diff --git a/lily/tie-column.cc b/lily/tie-column.cc index ca3d320e9e..6241a4c246 100644 --- a/lily/tie-column.cc +++ b/lily/tie-column.cc @@ -62,10 +62,10 @@ MAKE_SCHEME_CALLBACK (Tie_column, before_line_breaking, 1); SCM Tie_column::before_line_breaking (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); for (SCM s = me->get_property ("ties"); scm_is_pair (s); s = scm_cdr (s)) { - Spanner *tie = Spanner::unsmob (scm_car (s)); + Spanner *tie = unsmob<Spanner> (scm_car (s)); for (LEFT_and_RIGHT (dir)) { if (dir * tie->get_bound (dir)->get_column ()->get_rank () @@ -81,7 +81,7 @@ MAKE_SCHEME_CALLBACK (Tie_column, calc_positioning_done, 1) SCM Tie_column::calc_positioning_done (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "ties", ro_ties); vector<Grob *> ties (ro_ties); if (!ties.size ()) diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc index 5ca994873f..ef03f87bd6 100644 --- a/lily/tie-engraver.cc +++ b/lily/tie-engraver.cc @@ -155,8 +155,8 @@ Tie_engraver::tie_notehead (Grob *h, bool enharmonic) for (vsize i = 0; i < heads_to_tie_.size (); i++) { Grob *th = heads_to_tie_[i].head_; - Stream_event *right_ev = Stream_event::unsmob (h->get_property ("cause")); - Stream_event *left_ev = Stream_event::unsmob (th->get_property ("cause")); + Stream_event *right_ev = unsmob<Stream_event> (h->get_property ("cause")); + Stream_event *left_ev = unsmob<Stream_event> (th->get_property ("cause")); /* maybe should check positions too. @@ -171,8 +171,8 @@ Tie_engraver::tie_notehead (Grob *h, bool enharmonic) SCM p1 = left_ev->get_property ("pitch"); SCM p2 = right_ev->get_property ("pitch"); if ((enharmonic - ? (Pitch::is_smob (p1) && Pitch::is_smob (p2) && - Pitch::unsmob (p1)->tone_pitch () == Pitch::unsmob (p2)->tone_pitch ()) + ? (unsmob<Pitch> (p1) && unsmob<Pitch> (p2) && + unsmob<Pitch> (p1)->tone_pitch () == unsmob<Pitch> (p2)->tone_pitch ()) : ly_is_equal (p1, p2)) && (!Tie_engraver::has_autosplit_end (left_ev))) { @@ -281,7 +281,7 @@ Tie_engraver::process_acknowledged () { Grob *head = now_heads_[i]; Stream_event *left_ev - = Stream_event::unsmob (head->get_property ("cause")); + = unsmob<Stream_event> (head->get_property ("cause")); if (!left_ev) { @@ -301,7 +301,7 @@ Tie_engraver::process_acknowledged () !tie_event && !tie_stream_event && scm_is_pair (s); s = scm_cdr (s)) { - Stream_event *ev = Stream_event::unsmob (scm_car (s)); + Stream_event *ev = unsmob<Stream_event> (scm_car (s)); if (!ev) continue; diff --git a/lily/tie-formatting-problem.cc b/lily/tie-formatting-problem.cc index 1faa3d9445..83e5d25464 100644 --- a/lily/tie-formatting-problem.cc +++ b/lily/tie-formatting-problem.cc @@ -102,7 +102,7 @@ Tie_formatting_problem::set_column_chord_outline (vector<Item *> bounds, continue; if (!stem) - stem = Grob::unsmob (head->get_object ("stem")); + stem = unsmob<Grob> (head->get_object ("stem")); Real p = Staff_symbol_referencer::get_position (head); Interval y ((p - 1) * 0.5 * staff_space, @@ -211,7 +211,7 @@ Tie_formatting_problem::set_column_chord_outline (vector<Item *> bounds, boxes.push_back (Box (x, y)); } - Grob *acc = Grob::unsmob (heads[i]->get_object ("accidental-grob")); + Grob *acc = unsmob<Grob> (heads[i]->get_object ("accidental-grob")); if (acc) acc->get_property ("after-line-breaking"); /* trigger tie-related suicide */ @@ -380,7 +380,7 @@ Tie_formatting_problem::from_semi_ties (vector<Grob *> const &semi_ties, Directi for (vsize i = 0; i < semi_ties.size (); i++) { Tie_specification spec; - Item *head = Item::unsmob (semi_ties[i]->get_object ("note-head")); + Item *head = unsmob<Item> (semi_ties[i]->get_object ("note-head")); if (!head) programming_error ("LV tie without head?!"); @@ -655,7 +655,7 @@ Tie_formatting_problem::score_aptitude (Tie_configuration *conf, if (!spec.note_head_drul_[d]) continue; - Grob *stem = Grob::unsmob (spec.note_head_drul_[d]->get_object ("stem")); + Grob *stem = unsmob<Grob> (spec.note_head_drul_[d]->get_object ("stem")); if (stem && Stem::is_normal_stem (stem)) stems[d] = stem; diff --git a/lily/tie-performer.cc b/lily/tie-performer.cc index ba7954e995..b1aa15ffeb 100644 --- a/lily/tie-performer.cc +++ b/lily/tie-performer.cc @@ -128,8 +128,8 @@ Tie_performer::acknowledge_audio_element (Audio_element_info inf) SCM p1 = left_mus->get_property ("pitch"); SCM p2 = right_mus->get_property ("pitch"); - if (Pitch::is_smob (p1) && Pitch::is_smob (p2) - && Pitch::unsmob (p1)->tone_pitch () == Pitch::unsmob (p2)->tone_pitch ()) + if (unsmob<Pitch> (p1) && unsmob<Pitch> (p2) + && unsmob<Pitch> (p1)->tone_pitch () == unsmob<Pitch> (p2)->tone_pitch ()) { found = true; // (*it).moment_ already stores the end of the tied note! diff --git a/lily/tie.cc b/lily/tie.cc index 9bffbb3ce1..631ec18428 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -60,7 +60,7 @@ Tie::head (Grob *me, Direction d) Direction hd = to_dir (me->get_property ("head-direction")); return (hd == d) - ? Grob::unsmob (me->get_object ("note-head")) + ? unsmob<Grob> (me->get_object ("note-head")) : 0; } @@ -157,12 +157,12 @@ MAKE_SCHEME_CALLBACK (Tie, calc_direction, 1); SCM Tie::calc_direction (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Grob *yparent = me->get_parent (Y_AXIS); if ((Tie_column::has_interface (yparent) || Semi_tie_column::has_interface (yparent)) - && Grob_array::is_smob (yparent->get_object ("ties")) - // && Grob_array::unsmob (yparent->get_object ("ties"))->size () > 1 + && unsmob<Grob_array> (yparent->get_object ("ties")) + // && unsmob<Grob_array> (yparent->get_object ("ties"))->size () > 1 ) { /* trigger positioning. */ @@ -218,12 +218,12 @@ MAKE_SCHEME_CALLBACK (Tie, calc_control_points, 1); SCM Tie::calc_control_points (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Grob *yparent = me->get_parent (Y_AXIS); if ((Tie_column::has_interface (yparent) || Semi_tie_column::has_interface (yparent)) - && Grob_array::is_smob (yparent->get_object ("ties"))) + && unsmob<Grob_array> (yparent->get_object ("ties"))) { extract_grob_set (yparent, "ties", ties); if (me->original () && ties.size () == 1 @@ -250,7 +250,7 @@ MAKE_SCHEME_CALLBACK (Tie, print, 1); SCM Tie::print (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); SCM cp = me->get_property ("control-points"); @@ -281,7 +281,7 @@ Tie::print (SCM smob) string str; SCM properties = Font_interface::text_font_alist_chain (me); - Stencil tm = *Stencil::unsmob (Text_interface::interpret_markup + Stencil tm = *unsmob<Stencil> (Text_interface::interpret_markup (me->layout ()->self_scm (), properties, annotation)); tm.translate (Offset (b.control_[3][X_AXIS] + 0.5, diff --git a/lily/time-signature-engraver.cc b/lily/time-signature-engraver.cc index 46e42679aa..521d3ca2d9 100644 --- a/lily/time-signature-engraver.cc +++ b/lily/time-signature-engraver.cc @@ -106,7 +106,7 @@ Time_signature_engraver::stop_translation_timestep () { if (time_signature_ && !scm_is_null (time_cause_)) { - Moment *mp = Moment::unsmob (get_property ("measurePosition")); + Moment *mp = unsmob<Moment> (get_property ("measurePosition")); if (mp && (mp->main_part_ > Rational (0)) && !to_boolean (get_property ("partialBusy"))) time_signature_->warning ("mid-measure time signature without \\partial"); diff --git a/lily/timing-translator.cc b/lily/timing-translator.cc index 6c3a5c88c2..a041bfff84 100644 --- a/lily/timing-translator.cc +++ b/lily/timing-translator.cc @@ -47,7 +47,7 @@ Timing_translator::stop_translation_timestep () void Timing_translator::initialize () { - Context *timing = Context::unsmob (scm_call_2 (ly_lily_module_constant ("ly:context-find"), + Context *timing = unsmob<Context> (scm_call_2 (ly_lily_module_constant ("ly:context-find"), context ()->self_scm (), ly_symbol2scm ("Timing"))); if (timing != context ()) @@ -78,7 +78,7 @@ Timing_translator::initialize () SCM measureLength = timing->get_property ("measureLength"); - if (!Moment::is_smob (measureLength)) + if (!unsmob<Moment> (measureLength)) { measureLength = Moment (ly_scm2rational @@ -115,7 +115,7 @@ Timing_translator::initialize () context ()->set_property ("beamExceptions", beamExceptions); SCM baseMoment = timing->get_property ("baseMoment"); - if (!Moment::is_smob (baseMoment)) + if (!unsmob<Moment> (baseMoment)) { baseMoment = Moment (ly_scm2rational @@ -130,7 +130,7 @@ Timing_translator::initialize () { beatStructure = scm_call_3 (ly_lily_module_constant ("beat-structure"), - ly_rational2scm (Moment::unsmob (baseMoment)->main_part_), + ly_rational2scm (unsmob<Moment> (baseMoment)->main_part_), timeSignatureFraction, timeSignatureSettings); } @@ -147,8 +147,8 @@ Rational Timing_translator::measure_length () const { SCM l = get_property ("measureLength"); - if (Moment::is_smob (l)) - return Moment::unsmob (l)->main_part_; + if (unsmob<Moment> (l)) + return unsmob<Moment> (l)->main_part_; else return Rational (1); } @@ -181,8 +181,8 @@ Timing_translator::start_translation_timestep () Moment measposp; SCM s = get_property ("measurePosition"); - if (Moment::is_smob (s)) - measposp = *Moment::unsmob (s); + if (unsmob<Moment> (s)) + measposp = *unsmob<Moment> (s); else { measposp = now; diff --git a/lily/translator-ctors.cc b/lily/translator-ctors.cc index bf39a7d96e..15edd7df4a 100644 --- a/lily/translator-ctors.cc +++ b/lily/translator-ctors.cc @@ -69,6 +69,6 @@ get_translator (SCM sym) return 0; } - return Translator::unsmob (v); + return unsmob<Translator> (v); } diff --git a/lily/translator-dispatch-list.cc b/lily/translator-dispatch-list.cc index 79647bc783..10bf064075 100644 --- a/lily/translator-dispatch-list.cc +++ b/lily/translator-dispatch-list.cc @@ -40,14 +40,14 @@ Engraver_dispatch_list::create (SCM trans_list, SCM iface_list, Direction start_end) { SCM retval = Engraver_dispatch_list ().smobbed_copy (); - Engraver_dispatch_list *list = Engraver_dispatch_list::unsmob (retval); + Engraver_dispatch_list *list = unsmob<Engraver_dispatch_list> (retval); Engraver_dispatch_entry entry; bool found = false; for (SCM s = trans_list; scm_is_pair (s); s = scm_cdr (s)) { Engraver *eng - = Engraver::unsmob (scm_car (s)); + = unsmob<Engraver> (scm_car (s)); if (!eng) continue; diff --git a/lily/translator-group.cc b/lily/translator-group.cc index 24f1efaae9..73a9c602e0 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -39,7 +39,7 @@ void translator_each (SCM list, Translator_method method) { for (SCM p = list; scm_is_pair (p); p = scm_cdr (p)) - (Translator::unsmob (scm_car (p))->*method) (); + (unsmob<Translator> (scm_car (p))->*method) (); } void @@ -62,7 +62,7 @@ Translator_group::connect_to_context (Context *c) ly_symbol2scm ("AnnounceNewContext")); for (SCM tr_list = simple_trans_list_; scm_is_pair (tr_list); tr_list = scm_cdr (tr_list)) { - Translator *tr = Translator::unsmob (scm_car (tr_list)); + Translator *tr = unsmob<Translator> (scm_car (tr_list)); tr->connect_to_context (c); } } @@ -72,7 +72,7 @@ Translator_group::disconnect_from_context () { for (SCM tr_list = simple_trans_list_; scm_is_pair (tr_list); tr_list = scm_cdr (tr_list)) { - Translator *tr = Translator::unsmob (scm_car (tr_list)); + Translator *tr = unsmob<Translator> (scm_car (tr_list)); tr->disconnect_from_context (context_); } context_->event_source ()->remove_listener (GET_LISTENER (Translator_group, create_child_translator), @@ -90,7 +90,7 @@ Translator_group::finalize () Both filter_performers and filter_engravers used to use a direct dynamic_cast on the unsmobbed translator to be filtered, i.e., - if (Performer::unsmob (scm_car (*tail))) + if (unsmob<Performer> (scm_car (*tail))) but this caused mysterious optimisation issues in several GUB builds. See issue #818 for the background to this change. @@ -101,7 +101,7 @@ filter_performers (SCM ell) SCM *tail = ℓ for (SCM p = ell; scm_is_pair (p); p = scm_cdr (p)) { - if (Performer::is_smob (scm_car (*tail))) + if (unsmob<Performer> (scm_car (*tail))) *tail = scm_cdr (*tail); else tail = SCM_CDRLOC (*tail); @@ -115,7 +115,7 @@ filter_engravers (SCM ell) SCM *tail = ℓ for (SCM p = ell; scm_is_pair (p); p = scm_cdr (p)) { - if (Engraver::is_smob (scm_car (*tail))) + if (unsmob<Engraver> (scm_car (*tail))) *tail = scm_cdr (*tail); else tail = SCM_CDRLOC (*tail); @@ -148,11 +148,11 @@ Translator_group::protect_event (SCM ev) void Translator_group::create_child_translator (SCM sev) { - Stream_event *ev = Stream_event::unsmob (sev); + Stream_event *ev = unsmob<Stream_event> (sev); // get from AnnounceNewContext SCM cs = ev->get_property ("context"); - Context *new_context = Context::unsmob (cs); - Context_def *def = Context_def::unsmob (new_context->get_definition ()); + Context *new_context = unsmob<Context> (cs); + Context_def *def = unsmob<Context_def> (new_context->get_definition ()); SCM ops = new_context->get_definition_mods (); SCM trans_names = def->get_translator_names (ops); @@ -248,7 +248,7 @@ precomputed_recurse_over_translators (Context *c, Translator_precompute_index id for (SCM s = c->children_contexts (); scm_is_pair (s); s = scm_cdr (s)) - precomputed_recurse_over_translators (Context::unsmob (scm_car (s)), idx, dir); + precomputed_recurse_over_translators (unsmob<Context> (scm_car (s)), idx, dir); if (tg && dir == UP) { @@ -272,7 +272,7 @@ recurse_over_translators (Context *c, Translator_method ptr, for (SCM s = c->children_contexts (); scm_is_pair (s); s = scm_cdr (s)) - recurse_over_translators (Context::unsmob (scm_car (s)), ptr, tg_ptr, dir); + recurse_over_translators (unsmob<Context> (scm_car (s)), ptr, tg_ptr, dir); if (tg && dir == UP) { @@ -301,7 +301,7 @@ Translator_group::precompute_method_bindings () { for (SCM s = simple_trans_list_; scm_is_pair (s); s = scm_cdr (s)) { - Translator *tr = Translator::unsmob (scm_car (s)); + Translator *tr = unsmob<Translator> (scm_car (s)); Translator::Callback ptrs[TRANSLATOR_METHOD_PRECOMPUTE_COUNT]; tr->fetch_precomputable_methods (ptrs); diff --git a/lily/translator-scheme.cc b/lily/translator-scheme.cc index 1be52621b3..3aaf92fc3d 100644 --- a/lily/translator-scheme.cc +++ b/lily/translator-scheme.cc @@ -28,7 +28,7 @@ LY_DEFINE (ly_translator_name, "ly:translator-name", " The name is a symbol.") { LY_ASSERT_SMOB (Translator, trans, 1); - Translator *tr = Translator::unsmob (trans); + Translator *tr = unsmob<Translator> (trans); char const *nm = tr->class_name (); return ly_symbol2scm (nm); } @@ -38,7 +38,7 @@ LY_DEFINE (ly_translator_description, "ly:translator-description", "Return an alist of properties of translator @var{me}.") { LY_ASSERT_SMOB (Translator, me, 1); - Translator *tr = Translator::unsmob (me); + Translator *tr = unsmob<Translator> (me); return tr->translator_description (); } @@ -47,7 +47,7 @@ LY_DEFINE (ly_translator_context, "ly:translator-context", "Return the context of the translator object @var{trans}.") { LY_ASSERT_SMOB (Translator, trans, 1); - Translator *tr = Translator::unsmob (trans); + Translator *tr = unsmob<Translator> (trans); Context *c = tr->context (); return c ? c->self_scm () : SCM_BOOL_F; diff --git a/lily/translator.cc b/lily/translator.cc index 87fc0a15a4..b20e2aa4ed 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -263,7 +263,7 @@ generic_get_acknowledger (SCM sym, vector<Acknowledge_information> const *ack_ar Moment get_event_length (Stream_event *e) { - Moment *m = Moment::unsmob (e->get_property ("length")); + Moment *m = unsmob<Moment> (e->get_property ("length")); if (m) return *m; else diff --git a/lily/trill-spanner-engraver.cc b/lily/trill-spanner-engraver.cc index d71743fbce..eb36aff7e6 100644 --- a/lily/trill-spanner-engraver.cc +++ b/lily/trill-spanner-engraver.cc @@ -121,7 +121,7 @@ Trill_spanner_engraver::typeset_all () { if (!finished_->get_bound (RIGHT)) { - Grob *e = Grob::unsmob (get_property ("currentMusicalColumn")); + Grob *e = unsmob<Grob> (get_property ("currentMusicalColumn")); finished_->set_bound (RIGHT, e); } finished_ = 0; @@ -133,7 +133,7 @@ Trill_spanner_engraver::stop_translation_timestep () { if (span_ && !span_->get_bound (LEFT)) { - Grob *e = Grob::unsmob (get_property ("currentMusicalColumn")); + Grob *e = unsmob<Grob> (get_property ("currentMusicalColumn")); span_->set_bound (LEFT, e); } @@ -147,7 +147,7 @@ Trill_spanner_engraver::finalize () typeset_all (); if (span_) { - Grob *e = Grob::unsmob (get_property ("currentCommandColumn")); + Grob *e = unsmob<Grob> (get_property ("currentCommandColumn")); span_->set_bound (RIGHT, e); } } diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index 28803d5bf6..a1886620be 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -133,7 +133,7 @@ MAKE_SCHEME_CALLBACK (Tuplet_bracket, calc_connect_to_neighbors, 1); SCM Tuplet_bracket::calc_connect_to_neighbors (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); Direction dir = get_grob_direction (me); Drul_array<Item *> bounds (get_x_bound_item (me, LEFT, dir), @@ -184,7 +184,7 @@ MAKE_SCHEME_CALLBACK (Tuplet_bracket, calc_x_positions, 1) SCM Tuplet_bracket::calc_x_positions (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); extract_grob_set (me, "note-columns", columns); Grob *commonx = get_common_x (me); @@ -255,7 +255,7 @@ MAKE_SCHEME_CALLBACK (Tuplet_bracket, print, 1); SCM Tuplet_bracket::print (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); Stencil mol; extract_grob_set (me, "note-columns", columns); @@ -303,7 +303,7 @@ Tuplet_bracket::print (SCM smob) Output_def *pap = me->layout (); - Grob *number_grob = Grob::unsmob (me->get_object ("tuplet-number")); + Grob *number_grob = unsmob<Grob> (me->get_object ("tuplet-number")); /* Don't print the bracket when it would be smaller than the number. @@ -364,7 +364,7 @@ Tuplet_bracket::print (SCM smob) = Text_interface::interpret_markup (pap->self_scm (), properties, text); - Stencil *edge_text = Stencil::unsmob (t); + Stencil *edge_text = unsmob<Stencil> (t); edge_text->translate_axis (x_span[d] - x_span[LEFT], X_AXIS); edge_stencils[d] = *edge_text; @@ -632,7 +632,7 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy) } // Check for number-on-bracket collisions - Grob *number = Grob::unsmob (tuplets[i]->get_object ("tuplet-number")); + Grob *number = unsmob<Grob> (tuplets[i]->get_object ("tuplet-number")); if (number) points.push_back (Offset (number->extent (commonx, X_AXIS).center () - x0, number->extent (commony, Y_AXIS)[dir])); @@ -651,7 +651,7 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy) // assume that if a script is avoiding slurs, it should not get placed // under a tuplet bracket - if (Grob::is_smob (scripts[i]->get_object ("slur"))) + if (unsmob<Grob> (scripts[i]->get_object ("slur"))) continue; Interval script_x (scripts[i]->extent (commonx, X_AXIS)); @@ -701,7 +701,7 @@ MAKE_SCHEME_CALLBACK (Tuplet_bracket, calc_direction, 1); SCM Tuplet_bracket::calc_direction (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Direction dir = Tuplet_bracket::get_default_dir (me); return scm_from_int (dir); } @@ -710,7 +710,7 @@ MAKE_SCHEME_CALLBACK (Tuplet_bracket, calc_positions, 1); SCM Tuplet_bracket::calc_positions (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); Real dy = 0.0; Real offset = 0.0; @@ -787,7 +787,7 @@ MAKE_SCHEME_CALLBACK (Tuplet_bracket, calc_cross_staff, 1); SCM Tuplet_bracket::calc_cross_staff (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); extract_grob_set (me, "note-columns", cols); extract_grob_set (me, "tuplets", tuplets); @@ -806,7 +806,7 @@ Tuplet_bracket::calc_cross_staff (SCM smob) for (vsize i = 0; i < cols.size (); i++) { - Grob *stem = Grob::unsmob (cols[i]->get_object ("stem")); + Grob *stem = unsmob<Grob> (cols[i]->get_object ("stem")); if (stem && to_boolean (stem->get_property ("cross-staff"))) return SCM_BOOL_T; } diff --git a/lily/tuplet-engraver.cc b/lily/tuplet-engraver.cc index b9c35fb482..369389200f 100644 --- a/lily/tuplet-engraver.cc +++ b/lily/tuplet-engraver.cc @@ -138,7 +138,7 @@ Tuplet_engraver::process_music () if (stopped_tuplets_[i].full_length_) { Item *col - = Item::unsmob (stopped_tuplets_[i].full_length_note_ + = unsmob<Item> (stopped_tuplets_[i].full_length_note_ ? get_property ("currentMusicalColumn") : get_property ("currentCommandColumn")); @@ -263,7 +263,7 @@ Tuplet_engraver::finalize () if (to_boolean (get_property ("tupletFullLength"))) for (vsize i = 0; i < last_tuplets_.size (); i++) { - Item *col = Item::unsmob (get_property ("currentCommandColumn")); + Item *col = unsmob<Item> (get_property ("currentCommandColumn")); last_tuplets_[i]->set_bound (RIGHT, col); } } diff --git a/lily/tuplet-iterator.cc b/lily/tuplet-iterator.cc index 80a75a9beb..79ee9241b4 100644 --- a/lily/tuplet-iterator.cc +++ b/lily/tuplet-iterator.cc @@ -68,7 +68,7 @@ Tuplet_iterator::create_event (Direction d) Music *mus = get_music (); - Music *ev = Music::unsmob (ev_scm); + Music *ev = unsmob<Music> (ev_scm); ev->set_spot (*mus->origin ()); if (d == START) { @@ -128,10 +128,10 @@ Tuplet_iterator::process (Moment m) void Tuplet_iterator::construct_children () { - if (Duration *d = Duration::unsmob (get_music ()->get_property ("duration"))) + if (Duration *d = unsmob<Duration> (get_music ()->get_property ("duration"))) spanner_duration_ = d->get_length (); else if (Moment *mp - = Moment::unsmob (get_outlet ()->get_property ("tupletSpannerDuration"))) + = unsmob<Moment> (get_outlet ()->get_property ("tupletSpannerDuration"))) spanner_duration_ = mp->main_part_; else spanner_duration_.set_infinite (1); diff --git a/lily/tuplet-number.cc b/lily/tuplet-number.cc index 381aa994f3..c8781ca14d 100644 --- a/lily/tuplet-number.cc +++ b/lily/tuplet-number.cc @@ -109,7 +109,7 @@ Drul_array<Grob *> Tuplet_number::adjacent_note_columns (Grob *me_grob, Grob *ref_stem) { Spanner *me = dynamic_cast<Spanner *> (me_grob); - Spanner *tuplet = Spanner::unsmob (me->get_object ("bracket")); + Spanner *tuplet = unsmob<Spanner> (me->get_object ("bracket")); extract_grob_set (tuplet, "note-columns", columns); Grob *ref_col = ref_stem->get_parent (X_AXIS); // X-parent of Stem = NoteColumn @@ -156,7 +156,7 @@ bool Tuplet_number::knee_position_against_beam (Grob *me_grob, Grob *ref_stem) { Spanner *me = dynamic_cast<Spanner *> (me_grob); - Spanner *tuplet = Spanner::unsmob (me->get_object ("bracket")); + Spanner *tuplet = unsmob<Spanner> (me->get_object ("bracket")); bool bracket_visible = to_boolean (me->get_property ("bracket-visibility")) || !tuplet->extent (tuplet, Y_AXIS).is_empty (); @@ -213,8 +213,8 @@ MAKE_SCHEME_CALLBACK (Tuplet_number, print, 1); SCM Tuplet_number::print (SCM smob) { - Spanner *me = Spanner::unsmob (smob); - Spanner *tuplet = Spanner::unsmob (me->get_object ("bracket")); + Spanner *me = unsmob<Spanner> (smob); + Spanner *tuplet = unsmob<Spanner> (me->get_object ("bracket")); if (!tuplet || !tuplet->is_live ()) { @@ -223,7 +223,7 @@ Tuplet_number::print (SCM smob) } SCM stc_scm = Text_interface::print (smob); - Stencil *stc = Stencil::unsmob (stc_scm); + Stencil *stc = unsmob<Stencil> (stc_scm); stc->align_to (X_AXIS, CENTER); stc->align_to (Y_AXIS, CENTER); @@ -257,13 +257,13 @@ MAKE_SCHEME_CALLBACK (Tuplet_number, calc_x_offset, 1); SCM Tuplet_number::calc_x_offset (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); Item *left_bound = me->get_bound (LEFT); Item *right_bound = me->get_bound (RIGHT); Drul_array<Item *> bounds (left_bound, right_bound); - Spanner *tuplet = Spanner::unsmob (me->get_object ("bracket")); + Spanner *tuplet = unsmob<Spanner> (me->get_object ("bracket")); Grob *commonx = Tuplet_bracket::get_common_x (tuplet); commonx = commonx->common_refpoint (me, X_AXIS); @@ -347,8 +347,8 @@ MAKE_SCHEME_CALLBACK (Tuplet_number, calc_y_offset, 1); SCM Tuplet_number::calc_y_offset (SCM smob) { - Spanner *me = Spanner::unsmob (smob); - Spanner *tuplet = Spanner::unsmob (me->get_object ("bracket")); + Spanner *me = unsmob<Spanner> (smob); + Spanner *tuplet = unsmob<Spanner> (me->get_object ("bracket")); Drul_array<Real> positions = robust_scm2drul (tuplet->get_property ("positions"), Drul_array<Real> (0.0, 0.0)); SCM to_bracket = scm_from_double ((positions[LEFT] + positions[RIGHT]) / 2.0); @@ -450,7 +450,7 @@ Tuplet_number::calc_y_offset (SCM smob) Interval colliding_acc_ext_y; for (vsize i = 0; i < heads.size (); i++) - if (Grob *acc = Grob::unsmob (heads[i]->get_object ("accidental-grob"))) + if (Grob *acc = unsmob<Grob> (heads[i]->get_object ("accidental-grob"))) { commony = commony->common_refpoint (acc, Y_AXIS); Interval acc_ext_y = acc->extent (commony, Y_AXIS); @@ -484,8 +484,8 @@ MAKE_SCHEME_CALLBACK (Tuplet_number, calc_cross_staff, 1) SCM Tuplet_number::calc_cross_staff (SCM smob) { - Grob *me = Grob::unsmob (smob); - return Grob::unsmob (me->get_object ("bracket"))->get_property ("cross-staff"); + Grob *me = unsmob<Grob> (smob); + return unsmob<Grob> (me->get_object ("bracket"))->get_property ("cross-staff"); } ADD_INTERFACE (Tuplet_number, diff --git a/lily/undead.cc b/lily/undead.cc index d6e3d550d1..40d8316157 100644 --- a/lily/undead.cc +++ b/lily/undead.cc @@ -67,7 +67,7 @@ LY_DEFINE (ly_get_undead, "ly:get-undead", "Get back object from @var{undead}.") { LY_ASSERT_SMOB (Undead, undead, 1); - return Undead::unsmob (undead)->object (); + return unsmob<Undead> (undead)->object (); } // ' diff --git a/lily/unpure-pure-container.cc b/lily/unpure-pure-container.cc index 1d073af0fc..d5962bd028 100644 --- a/lily/unpure-pure-container.cc +++ b/lily/unpure-pure-container.cc @@ -61,7 +61,7 @@ LY_DEFINE (ly_unpure_pure_container_unpure_part, "ly:unpure-pure-container-unpur "Return the unpure part of @var{pc}.") { LY_ASSERT_SMOB (Unpure_pure_container, pc, 1); - return Unpure_pure_container::unsmob (pc)->unpure_part (); + return unsmob<Unpure_pure_container> (pc)->unpure_part (); } LY_DEFINE (ly_unpure_pure_container_pure_part, "ly:unpure-pure-container-pure-part", @@ -69,7 +69,7 @@ LY_DEFINE (ly_unpure_pure_container_pure_part, "ly:unpure-pure-container-pure-pa "Return the pure part of @var{pc}.") { LY_ASSERT_SMOB (Unpure_pure_container, pc, 1); - return Unpure_pure_container::unsmob (pc)->pure_part (); + return unsmob<Unpure_pure_container> (pc)->pure_part (); } int diff --git a/lily/vaticana-ligature-engraver.cc b/lily/vaticana-ligature-engraver.cc index a39e0cef59..2d94c03892 100644 --- a/lily/vaticana-ligature-engraver.cc +++ b/lily/vaticana-ligature-engraver.cc @@ -455,11 +455,11 @@ Vaticana_ligature_engraver::check_for_ambiguous_dot_pitch (Grob_info primitive) // bitmask based O (1) test); where n=<number of primitives in the // ligature> (which is typically small (n<10), though). Stream_event *new_cause = primitive.event_cause (); - int new_pitch = Pitch::unsmob (new_cause->get_property ("pitch"))->steps (); + int new_pitch = unsmob<Pitch> (new_cause->get_property ("pitch"))->steps (); for (vsize i = 0; i < augmented_primitives_.size (); i++) { Stream_event *cause = augmented_primitives_[i].event_cause (); - int pitch = Pitch::unsmob (cause->get_property ("pitch"))->steps (); + int pitch = unsmob<Pitch> (cause->get_property ("pitch"))->steps (); if (pitch == new_pitch) { primitive.grob ()-> diff --git a/lily/vaticana-ligature.cc b/lily/vaticana-ligature.cc index 2066716b80..ddbe0d86bd 100644 --- a/lily/vaticana-ligature.cc +++ b/lily/vaticana-ligature.cc @@ -290,7 +290,7 @@ MAKE_SCHEME_CALLBACK (Vaticana_ligature, brew_ligature_primitive, 1); SCM Vaticana_ligature::brew_ligature_primitive (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); SCM primitive = vaticana_brew_primitive (me).smobbed_copy (); return primitive; } diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc index 472b1a080a..d28d0d74a3 100644 --- a/lily/vertical-align-engraver.cc +++ b/lily/vertical-align-engraver.cc @@ -100,7 +100,7 @@ Vertical_align_engraver::process_music () top_level_ = to_boolean (get_property ("topLevelAlignment")); valign_ = make_spanner (top_level_ ? "VerticalAlignment" : "StaffGrouper", SCM_EOL); - valign_->set_bound (LEFT, Grob::unsmob (get_property ("currentCommandColumn"))); + valign_->set_bound (LEFT, unsmob<Grob> (get_property ("currentCommandColumn"))); Align_interface::set_ordered (valign_); } } @@ -110,7 +110,7 @@ Vertical_align_engraver::finalize () { if (valign_) { - valign_->set_bound (RIGHT, Grob::unsmob (get_property ("currentCommandColumn"))); + valign_->set_bound (RIGHT, unsmob<Grob> (get_property ("currentCommandColumn"))); valign_ = 0; } } @@ -145,14 +145,14 @@ Vertical_align_engraver::acknowledge_axis_group (Grob_info i) SCM before = scm_hash_ref (id_to_group_hashtab_, before_id, SCM_BOOL_F); SCM after = scm_hash_ref (id_to_group_hashtab_, after_id, SCM_BOOL_F); - Grob *before_grob = Grob::unsmob (before); - Grob *after_grob = Grob::unsmob (after); + Grob *before_grob = unsmob<Grob> (before); + Grob *after_grob = unsmob<Grob> (after); Align_interface::add_element (valign_, i.grob ()); if (before_grob || after_grob) { - Grob_array *ga = Grob_array::unsmob (valign_->get_object ("elements")); + Grob_array *ga = unsmob<Grob_array> (valign_->get_object ("elements")); vector<Grob *> &arr = ga->array_reference (); Grob *added = arr.back (); @@ -182,7 +182,7 @@ Vertical_align_engraver::acknowledge_axis_group (Grob_info i) else if (qualifies (i)) { Pointer_group_interface::add_grob (valign_, ly_symbol2scm ("elements"), i.grob ()); - if (!Grob::is_smob (i.grob ()->get_object ("staff-grouper"))) + if (!unsmob<Grob> (i.grob ()->get_object ("staff-grouper"))) i.grob ()->set_object ("staff-grouper", valign_->self_scm ()); } } diff --git a/lily/volta-bracket.cc b/lily/volta-bracket.cc index d4a4e0b41e..08a578de75 100644 --- a/lily/volta-bracket.cc +++ b/lily/volta-bracket.cc @@ -46,7 +46,7 @@ MAKE_SCHEME_CALLBACK (Volta_bracket_interface, print, 1); SCM Volta_bracket_interface::print (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob<Spanner> (smob); Spanner *orig_span = dynamic_cast<Spanner *> (me->original ()); bool broken_first_bracket = orig_span && (orig_span->broken_intos_[0] == (Spanner *)me); @@ -106,7 +106,7 @@ Volta_bracket_interface::print (SCM smob) SCM properties = me->get_property_alist_chain (SCM_EOL); SCM snum = Text_interface::interpret_markup (layout->self_scm (), properties, text); - Stencil num = *Stencil::unsmob (snum); + Stencil num = *unsmob<Stencil> (snum); num.align_to (Y_AXIS, UP); num.translate_axis (-0.5, Y_AXIS); total.add_at_edge (X_AXIS, LEFT, num, - num.extent (X_AXIS).length () diff --git a/lily/volta-engraver.cc b/lily/volta-engraver.cc index 60c8987b3e..bd198cbb67 100644 --- a/lily/volta-engraver.cc +++ b/lily/volta-engraver.cc @@ -99,8 +99,8 @@ Volta_engraver::process_music () SCM l (get_property ("voltaSpannerDuration")); Moment now = now_mom (); - bool early_stop = Moment::is_smob (l) - && *Moment::unsmob (l) <= now - started_mom_; + bool early_stop = unsmob<Moment> (l) + && *unsmob<Moment> (l) <= now - started_mom_; end = end || early_stop; } @@ -161,7 +161,7 @@ Volta_engraver::acknowledge_bar_line (Grob_info i) void Volta_engraver::stop_translation_timestep () { - Grob *cc = Grob::unsmob (get_property ("currentCommandColumn")); + Grob *cc = unsmob<Grob> (get_property ("currentCommandColumn")); Item *ci = dynamic_cast<Item *> (cc); if (end_volta_bracket_ && !end_volta_bracket_->get_bound (RIGHT)) @@ -173,7 +173,7 @@ Volta_engraver::stop_translation_timestep () if (end_volta_bracket_ && !volta_bracket_) { for (SCM s = get_property ("stavesFound"); scm_is_pair (s); s = scm_cdr (s)) - Side_position_interface::add_support (volta_spanner_, Grob::unsmob (scm_car (s))); + Side_position_interface::add_support (volta_spanner_, unsmob<Grob> (scm_car (s))); volta_spanner_ = 0; } |