From: Han-Wen Nienhuys Date: Fri, 3 Sep 2004 23:54:16 +0000 (+0000) Subject: (scm_from_double): more compat glue. X-Git-Tag: release/2.3.14~7 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=faaee71fb44c8e1040239797aad336f4e46c2c21;p=lilypond.git (scm_from_double): more compat glue. --- diff --git a/lily/align-interface.cc b/lily/align-interface.cc index 952f012b5e..e11671ca51 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -218,7 +218,7 @@ Align_interface::align_elements_to_extents (Grob * me, Axis a) line-of-score. */ if (ly_c_number_p (align)) - center_offset = total.linear_combination (ly_scm2double (align)); + center_offset = total.linear_combination (scm_to_double (align)); for (int j = 0 ; j < all_grobs.size (); j++) all_grobs[j]->translate_axis (all_translates[j] - center_offset, a); diff --git a/lily/bar-line.cc b/lily/bar-line.cc index 832ab1af32..56609b231f 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -196,7 +196,7 @@ Bar_line::get_staff_bar_size (SCM smob) Real ss = Staff_symbol_referencer::staff_space (me); SCM size = me->get_property ("bar-size"); if (ly_c_number_p (size)) - return scm_make_real (ly_scm2double (size)*ss); + return scm_make_real (scm_to_double (size)*ss); else if (Staff_symbol_referencer::get_staff_symbol (me)) { /* diff --git a/lily/beam-quanting.cc b/lily/beam-quanting.cc index 51ccb2e942..c329bafcc5 100644 --- a/lily/beam-quanting.cc +++ b/lily/beam-quanting.cc @@ -94,8 +94,8 @@ Beam::quanting (SCM smob) Grob *me = unsmob_grob (smob); SCM s = me->get_property ("positions"); - Real yl = ly_scm2double (ly_car (s)); - Real yr = ly_scm2double (ly_cdr (s)); + Real yl = scm_to_double (ly_car (s)); + Real yr = scm_to_double (ly_cdr (s)); /* @@ -108,7 +108,7 @@ Beam::quanting (SCM smob) Real slt = Staff_symbol_referencer::line_thickness (me) / ss; SCM sdy = me->get_property ("least-squares-dy"); - Real dy_mus = ly_c_number_p (sdy) ? ly_scm2double (sdy) : 0.0; + Real dy_mus = ly_c_number_p (sdy) ? scm_to_double (sdy) : 0.0; Real straddle = 0.0; Real sit = (thickness - slt) / 2; @@ -282,7 +282,7 @@ Beam::quanting (SCM smob) if (to_boolean (me->get_paper ()->lookup_variable (ly_symbol2scm ("debug-beam-quanting"))) && ly_c_pair_p (inspect_quants)) { - Drul_array ins = scm_to_interval (inspect_quants); + Drul_array ins = ly_scm2interval (inspect_quants); int i = 0; diff --git a/lily/beam.cc b/lily/beam.cc index cad26f0190..03f5206e04 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -80,7 +80,7 @@ Beam::get_beam_translation (Grob *me) if (ly_c_procedure_p (func)) { SCM s = scm_call_2 (func, me->self_scm (), scm_int2num (get_beam_count (me))); - return ly_scm2double (s); + return scm_to_double (s); } else { @@ -455,7 +455,7 @@ Beam::print (SCM grob) SCM proc = me->get_property ("flag-width-function"); SCM result = scm_call_1 (proc, scm_int2num (t)); - nw_f = ly_scm2double (result); + nw_f = scm_to_double (result); } else nw_f = break_overshoot / 2; @@ -667,7 +667,7 @@ Beam::consider_auto_knees (Grob* me) if (!ly_c_number_p (scm)) return ; - Real threshold = ly_scm2double (scm); + Real threshold = scm_to_double (scm); Int_set gaps; @@ -789,7 +789,7 @@ Beam::set_stem_shorten (Grob *me) SCM shorten_elt = robust_list_ref (beam_count -1, shorten_list); - Real shorten_f = ly_scm2double (shorten_elt) * staff_space; + Real shorten_f = scm_to_double (shorten_elt) * staff_space; /* your similar cute comment here */ shorten_f *= forced_fraction; @@ -992,7 +992,7 @@ Beam::shift_region_to_valid (SCM grob) Real dx = lvs->relative_coordinate (commonx, X_AXIS) - x0; - Drul_array pos = scm_to_interval ( me->get_property ("positions")); + Drul_array pos = ly_scm2interval ( me->get_property ("positions")); scale_drul (&pos, Staff_symbol_referencer::staff_space (me)); @@ -1101,7 +1101,7 @@ Beam::check_concave (SCM smob) SCM gap = me->get_property ("concaveness-gap"); if (ly_c_number_p (gap)) { - Real r1 = ly_scm2double (gap); + Real r1 = scm_to_double (gap); Real dy = Stem::chord_start_y (stems.top ()) - Stem::chord_start_y (stems[0]); @@ -1138,7 +1138,7 @@ Beam::check_concave (SCM smob) Real r2 = infinity_f; if (!is_concave1 && ly_c_number_p (thresh)) { - r2 = ly_scm2double (thresh); + r2 = scm_to_double (thresh); Interval iv; iv.add_point (Stem::chord_start_y (stems[0])); @@ -1157,7 +1157,7 @@ Beam::check_concave (SCM smob) /* TODO: some sort of damping iso -> plain horizontal */ if (is_concave1 || concaveness2 > r2) { - Drul_array pos = scm_to_interval (me->get_property ("positions")); + Drul_array pos = ly_scm2interval (me->get_property ("positions")); Real r = linear_combination (pos, 0.0); r /= Staff_symbol_referencer::staff_space (me); @@ -1185,7 +1185,7 @@ Beam::slope_damping (SCM smob) if (damping) { - Drul_array pos = scm_to_interval (me->get_property ("positions")); + Drul_array pos = ly_scm2interval (me->get_property ("positions")); scale_drul (&pos, Staff_symbol_referencer::staff_space (me)); Real dy = pos[RIGHT] - pos[LEFT]; @@ -1471,7 +1471,7 @@ Beam::rest_collision_callback (SCM element_smob, SCM axis) Drul_array pos (0, 0); SCM s = beam->get_property ("positions"); if (ly_c_pair_p (s) && ly_c_number_p (ly_car (s))) - pos = scm_to_interval (s); + pos = ly_scm2interval (s); Real staff_space = Staff_symbol_referencer::staff_space (rest); scale_drul (&pos, staff_space); diff --git a/lily/book-paper-def.cc b/lily/book-paper-def.cc index d2ca7103f0..baf444e9d1 100644 --- a/lily/book-paper-def.cc +++ b/lily/book-paper-def.cc @@ -16,7 +16,7 @@ Real output_scale (Output_def *od) { - return ly_scm2double (od->lookup_variable (ly_symbol2scm ("outputscale"))); + return scm_to_double (od->lookup_variable (ly_symbol2scm ("outputscale"))); } /* TODO: should add nesting for Output_def here too. */ diff --git a/lily/book.cc b/lily/book.cc index 3e68631b28..0eff1b5117 100644 --- a/lily/book.cc +++ b/lily/book.cc @@ -65,7 +65,7 @@ Paper_book * Book::process (String outname, Output_def *default_def) { Paper_book *paper_book = new Paper_book (); - Real scale = ly_scm2double (bookpaper_->c_variable ("outputscale")); + Real scale = scm_to_double (bookpaper_->c_variable ("outputscale")); Output_def * scaled_bookdef = scale_output_def (bookpaper_, scale); diff --git a/lily/break-align-interface.cc b/lily/break-align-interface.cc index c4d429a008..c7ec2daabb 100644 --- a/lily/break-align-interface.cc +++ b/lily/break-align-interface.cc @@ -223,7 +223,7 @@ Break_align_interface::do_alignment (Grob *grob) { entry = ly_cdr (entry); - distance = ly_scm2double (ly_cdr (entry)); + distance = scm_to_double (ly_cdr (entry)); type = ly_car (entry) ; } diff --git a/lily/coherent-ligature-engraver.cc b/lily/coherent-ligature-engraver.cc index 05f9a96d3e..1bc75b847a 100644 --- a/lily/coherent-ligature-engraver.cc +++ b/lily/coherent-ligature-engraver.cc @@ -86,7 +86,7 @@ Real distance; if (incr_scm != SCM_EOL) { - distance = ly_scm2double (incr_scm); + distance = scm_to_double (incr_scm); } else { diff --git a/lily/dynamic-performer.cc b/lily/dynamic-performer.cc index 0cd1b49952..7f6008cb79 100644 --- a/lily/dynamic-performer.cc +++ b/lily/dynamic-performer.cc @@ -63,9 +63,9 @@ Dynamic_performer::create_audio_elements () { Interval iv (0, 1); if (ly_c_number_p (min)) - iv[MIN] = ly_scm2double (min); + iv[MIN] = scm_to_double (min); if (ly_c_number_p (max)) - iv[MAX] = ly_scm2double (max); + iv[MAX] = scm_to_double (max); volume = iv[MIN] + iv.length () * volume; } else @@ -90,7 +90,7 @@ Dynamic_performer::create_audio_elements () if (is_number_pair (s)) { - Interval iv = scm_to_interval (s); + Interval iv = ly_scm2interval (s); volume = iv[MIN] + iv.length () * volume; } } diff --git a/lily/font-select.cc b/lily/font-select.cc index 1e5134a24c..df6e008684 100644 --- a/lily/font-select.cc +++ b/lily/font-select.cc @@ -138,9 +138,9 @@ select_encoded_font (Output_def *paper, SCM chain, SCM input_encoding) SCM font_size = ly_assoc_chain (ly_symbol2scm ("font-size"), chain); Real req = 0; if (ly_c_pair_p (font_size)) - req = ly_scm2double (ly_cdr (font_size)); + req = scm_to_double (ly_cdr (font_size)); - return get_font_by_mag_step (paper, req, vec, ly_scm2double (base_size), + return get_font_by_mag_step (paper, req, vec, scm_to_double (base_size), input_encoding); } diff --git a/lily/font-size-engraver.cc b/lily/font-size-engraver.cc index 6c6bfa91d1..edb728a5c5 100644 --- a/lily/font-size-engraver.cc +++ b/lily/font-size-engraver.cc @@ -36,9 +36,9 @@ Font_size_engraver::acknowledge_grob (Grob_info gi) if (gi.origin_trans_->context () != context ()) return ; - if (ly_c_number_p (sz) && ly_scm2double (sz)) + if (ly_c_number_p (sz) && scm_to_double (sz)) { - Real font_size = ly_scm2double (sz); + Real font_size = scm_to_double (sz); font_size += robust_scm2double (gi.grob_->get_property ("font-size"), 0); gi.grob_->set_property ("font-size", scm_make_real (font_size)); diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index a8245fe7d7..14b65f7fc9 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -237,9 +237,9 @@ Gourlay_breaking::combine_demerits (Column_x_positions const &prev, if (pc->original_) { SCM pen = pc->get_property ("penalty"); - if (ly_c_number_p (pen) && fabs (ly_scm2double (pen)) < 10000) + if (ly_c_number_p (pen) && fabs (scm_to_double (pen)) < 10000) { - break_penalties += ly_scm2double (pen); + break_penalties += scm_to_double (pen); } } diff --git a/lily/grob-scheme.cc b/lily/grob-scheme.cc index d05a561046..d1fd9c38f1 100644 --- a/lily/grob-scheme.cc +++ b/lily/grob-scheme.cc @@ -190,7 +190,7 @@ LY_DEFINE (ly_grob_translate_axis_x, "ly:grob-translate-axis!", SCM_ASSERT_TYPE (ly_c_number_p (d), d, SCM_ARG2, __FUNCTION__, "dimension"); SCM_ASSERT_TYPE (is_axis (a), a, SCM_ARG3, __FUNCTION__, "axis"); - me->translate_axis (ly_scm2double (d), Axis (scm_to_int (a))); + me->translate_axis (scm_to_double (d), Axis (scm_to_int (a))); return SCM_UNSPECIFIED; } diff --git a/lily/grob.cc b/lily/grob.cc index baefcc77d1..d66dccb960 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -373,7 +373,7 @@ Grob::get_offset (Axis a) const SCM cb = scm_list_ref (dim_cache_[a].offset_callbacks_, scm_int2num (l)); SCM retval = scm_call_2 (cb, self_scm (), scm_int2num (a)); - Real r = ly_scm2double (retval); + Real r = scm_to_double (retval); if (isinf (r) || isnan (r)) { programming_error (INFINITY_MSG); @@ -409,7 +409,7 @@ Grob::extent (Grob *refp, Axis a) const if (!ly_c_pair_p (d->dimension_)) return ext; - ext = scm_to_interval (d->dimension_); + ext = ly_scm2interval (d->dimension_); SCM extra = get_property (a == X_AXIS ? "extra-X-extent" @@ -418,16 +418,16 @@ Grob::extent (Grob *refp, Axis a) const /* Signs ? */ if (ly_c_pair_p (extra)) { - ext[BIGGER] += ly_scm2double (ly_cdr (extra)); - ext[SMALLER] += ly_scm2double (ly_car (extra)); + ext[BIGGER] += scm_to_double (ly_cdr (extra)); + ext[SMALLER] += scm_to_double (ly_car (extra)); } extra = get_property (a == X_AXIS ? "minimum-X-extent" : "minimum-Y-extent"); if (ly_c_pair_p (extra)) - ext.unite (Interval (ly_scm2double (ly_car (extra)), - ly_scm2double (ly_cdr (extra)))); + ext.unite (Interval (scm_to_double (ly_car (extra)), + scm_to_double (ly_cdr (extra)))); ext.translate (x); diff --git a/lily/hairpin.cc b/lily/hairpin.cc index d5c17d7209..799616bf14 100644 --- a/lily/hairpin.cc +++ b/lily/hairpin.cc @@ -35,7 +35,7 @@ Hairpin::print (SCM smob) Direction grow_dir = to_dir (s); - Real padding = ly_scm2double (me->get_property ("bound-padding")); + Real padding = scm_to_double (me->get_property ("bound-padding")); Drul_array broken; Drul_array bounds ; diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index 7004c02605..40f5339a7a 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -1,4 +1,4 @@ -/* +ii/* lily-guile.hh encapsulate guile source file of the GNU LilyPond music typesetter @@ -27,7 +27,10 @@ #define scm_i_string_chars(x) SCM_STRING_CHARS(x) #define scm_i_string_length(x) SCM_STRING_LENGTH(x) #define scm_is_number(x) (scm_number_p(x)==SCM_BOOL_T) +inline int ly_scm2int (SCM x) { return scm_num2int (x, 0, "ly_scm2int"); } #define scm_to_int(x) (ly_scm2int(x)) + +inline double ly_scm2double (SCM x) { return scm_num2dbl (x, "ly_scm2double"); } #define scm_to_double(x) (ly_scm2double(x)) #define scm_from_double(x) (scm_make_real(x)) #endif /* SCM_MINOR_VERSION < 7 */ @@ -164,8 +167,6 @@ inline bool ly_c_equal_p (SCM x, SCM y) { inline bool ly_scm2bool (SCM x) { return SCM_NFALSEP (x); } inline char ly_scm2char (SCM x) { return SCM_CHAR(x); } -inline int ly_scm2int (SCM x) { return scm_num2int (x, 0, "ly_scm2int"); } -inline double ly_scm2double (SCM x) { return scm_num2dbl (x, "ly_scm2double"); } inline unsigned long ly_length (SCM x) { return scm_num2ulong (scm_length (x), 0, "ly_length"); } diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index bda59bf291..67ab65e028 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -283,16 +283,16 @@ to_dir (SCM s) } Interval -scm_to_interval (SCM p) +ly_scm2interval (SCM p) { - return Interval (ly_scm2double (ly_car (p)), ly_scm2double (ly_cdr (p))); + return Interval (scm_to_double (ly_car (p)), scm_to_double (ly_cdr (p))); } Drul_array ly_scm2realdrul (SCM p) { - return Drul_array (ly_scm2double (ly_car (p)), - ly_scm2double (ly_cdr (p))); + return Drul_array (scm_to_double (ly_car (p)), + scm_to_double (ly_cdr (p))); } SCM @@ -336,8 +336,8 @@ ly_offset2scm (Offset o) Offset ly_scm2offset (SCM s) { - return Offset (ly_scm2double (ly_car (s)), - ly_scm2double (ly_cdr (s))); + return Offset (scm_to_double (ly_car (s)), + scm_to_double (ly_cdr (s))); } LY_DEFINE (ly_number2string, "ly:number->string", @@ -350,7 +350,7 @@ LY_DEFINE (ly_number2string, "ly:number->string", if (scm_exact_p (s) == SCM_BOOL_F) { - Real r (ly_scm2double (s)); + Real r (scm_to_double (s)); if (my_isinf (r) || my_isnan (r)) { @@ -730,7 +730,7 @@ Real robust_scm2double (SCM k, double x) { if (ly_c_number_p (k)) - x = ly_scm2double (k); + x = scm_to_double (k); return x; } @@ -741,7 +741,7 @@ robust_scm2interval (SCM k, Drul_array v) i[LEFT]= v[LEFT]; i[RIGHT]= v[RIGHT]; if (is_number_pair (k)) - i = scm_to_interval (k); + i = ly_scm2interval (k); return i; } @@ -749,7 +749,7 @@ Drul_array robust_scm2drul (SCM k, Drul_array v) { if (is_number_pair (k)) - v = scm_to_interval (k); + v = ly_scm2interval (k); return v; } diff --git a/lily/lookup.cc b/lily/lookup.cc index bb622cb97f..8d5c22acff 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -712,10 +712,10 @@ LY_DEFINE (ly_bracket ,"ly:bracket", SCM_ASSERT_TYPE (ly_c_number_p (p), a, SCM_ARG4, __FUNCTION__, "number") ; - return Lookup::bracket ((Axis)scm_to_int (a), scm_to_interval (iv), - ly_scm2double (t), - ly_scm2double (p), - 0.95 * ly_scm2double (t)).smobbed_copy (); + return Lookup::bracket ((Axis)scm_to_int (a), ly_scm2interval (iv), + scm_to_double (t), + scm_to_double (p), + 0.95 * scm_to_double (t)).smobbed_copy (); } @@ -732,7 +732,7 @@ LY_DEFINE (ly_filled_box ,"ly:round-filled-box", SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG2, __FUNCTION__, "number pair") ; SCM_ASSERT_TYPE (ly_c_number_p (blot), blot, SCM_ARG3, __FUNCTION__, "number") ; - return Lookup::round_filled_box (Box (scm_to_interval (xext), scm_to_interval (yext)), - ly_scm2double (blot)).smobbed_copy (); + return Lookup::round_filled_box (Box (ly_scm2interval (xext), ly_scm2interval (yext)), + scm_to_double (blot)).smobbed_copy (); } diff --git a/lily/mensural-ligature-engraver.cc b/lily/mensural-ligature-engraver.cc index 518948ebe3..da419df21f 100644 --- a/lily/mensural-ligature-engraver.cc +++ b/lily/mensural-ligature-engraver.cc @@ -407,8 +407,8 @@ Mensural_ligature_engraver::fold_up_primitives (Array primitives) } distance += - ly_scm2double (current->get_property ("head-width")) - - ly_scm2double (current->get_property ("thickness")); + scm_to_double (current->get_property ("head-width")) - + scm_to_double (current->get_property ("thickness")); } } diff --git a/lily/modified-font-metric.cc b/lily/modified-font-metric.cc index 6bb485fa96..a28c1bd372 100644 --- a/lily/modified-font-metric.cc +++ b/lily/modified-font-metric.cc @@ -34,7 +34,7 @@ Modified_font_metric::Modified_font_metric (String input_encoding, SCM desc = m->description_; - Real total_mag = magn * ly_scm2double (ly_cdr (desc)); + Real total_mag = magn * scm_to_double (ly_cdr (desc)); assert (total_mag); description_ = scm_cons (ly_car (desc), scm_make_real (total_mag)); diff --git a/lily/note-collision.cc b/lily/note-collision.cc index 51bf6d13ee..ae6f74cd9c 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -321,7 +321,7 @@ Note_collision_interface::do_shifts (Grob* me) for (; ly_c_pair_p (hand); hand =ly_cdr (hand)) { Grob * s = unsmob_grob (ly_caar (hand)); - Real amount = ly_scm2double (ly_cdar (hand)) * wid; + Real amount = scm_to_double (ly_cdar (hand)) * wid; done.push (s); amounts.push (amount); @@ -332,7 +332,7 @@ Note_collision_interface::do_shifts (Grob* me) for (; ly_c_pair_p (autos); autos =ly_cdr (autos)) { Grob * s = unsmob_grob (ly_caar (autos)); - Real amount = ly_scm2double (ly_cdar (autos)) *wid; + Real amount = scm_to_double (ly_cdar (autos)) *wid; if (!done.find (s)) { diff --git a/lily/output-def.cc b/lily/output-def.cc index 1895daa660..2bf1ea1d2b 100644 --- a/lily/output-def.cc +++ b/lily/output-def.cc @@ -103,7 +103,7 @@ Real Output_def::get_dimension (SCM s) const { SCM val = lookup_variable (s); - return ly_scm2double (val); + return scm_to_double (val); } SCM diff --git a/lily/parser.yy b/lily/parser.yy index df8b34a62c..7d2db41605 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -2374,10 +2374,10 @@ bare_number: $$ = $1; } | REAL NUMBER_IDENTIFIER { - $$ = scm_make_real (ly_scm2double ($1) *ly_scm2double ($2)); + $$ = scm_make_real (scm_to_double ($1) *scm_to_double ($2)); } | UNSIGNED NUMBER_IDENTIFIER { - $$ = scm_make_real ($1 *ly_scm2double ($2)); + $$ = scm_make_real ($1 *scm_to_double ($2)); } ; diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 881ff8958f..2227ee00ac 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -245,11 +245,11 @@ Score_engraver::try_music (Music *m) if (m->is_mus_type ("break-event")) { SCM pen = command_column_->get_property ("penalty"); - Real total_penalty = ly_c_number_p (pen) ? ly_scm2double (pen) : 0.0; + Real total_penalty = ly_c_number_p (pen) ? scm_to_double (pen) : 0.0; SCM mpen = m->get_property ("penalty"); if (ly_c_number_p (mpen)) - total_penalty += ly_scm2double (mpen); + total_penalty += scm_to_double (mpen); command_column_->set_property ("penalty", scm_make_real (total_penalty)); @@ -258,10 +258,10 @@ Score_engraver::try_music (Music *m) forbid_breaks (); SCM page_pen = command_column_->get_property ("page-penalty"); - Real total_pp = ly_c_number_p (page_pen) ? ly_scm2double (page_pen) : 0.0; + Real total_pp = ly_c_number_p (page_pen) ? scm_to_double (page_pen) : 0.0; SCM mpage_pen = m->get_property ("page-penalty"); if (ly_c_number_p (mpage_pen)) - total_pp += ly_scm2double (mpage_pen); + total_pp += scm_to_double (mpage_pen); command_column_->set_property ("page-penalty", scm_make_real (total_pp)); return true; diff --git a/lily/score.cc b/lily/score.cc index 774cdba07c..2dadb3f7f4 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -167,7 +167,7 @@ default_rendering (SCM music, SCM outdef, /* ugh. */ if (bpd->c_variable ("is-bookpaper") == SCM_BOOL_T) { - Real scale = ly_scm2double (bpd->c_variable ("outputscale")); + Real scale = scm_to_double (bpd->c_variable ("outputscale")); Output_def *def = scale_output_def (unsmob_output_def (outdef), scale); scaled_def = def->self_scm (); @@ -225,7 +225,7 @@ Score::book_rendering (String outname, Real scale = 1.0; if (paperbook && paperbook->c_variable ("is-bookpaper") == SCM_BOOL_T) - scale = ly_scm2double (paperbook->c_variable ("outputscale")); + scale = scm_to_double (paperbook->c_variable ("outputscale")); SCM out = scm_makfrom0str (outname.to_str0 ()); SCM systems = SCM_EOL; diff --git a/lily/self-aligment-interface.cc b/lily/self-aligment-interface.cc index badd4899a9..17e53b9b63 100644 --- a/lily/self-aligment-interface.cc +++ b/lily/self-aligment-interface.cc @@ -39,7 +39,7 @@ Self_alignment_interface::aligned_on_parent (SCM element_smob, SCM axis) return scm_int2num (0); Real x = 0.0; - Real align = ly_scm2double (align_prop); + Real align = scm_to_double (align_prop); Interval ext (me->extent (me, a)); if (ext.is_empty ()) @@ -86,7 +86,7 @@ Self_alignment_interface::aligned_on_self (SCM element_smob, SCM axis) if (ext.is_empty ()) programming_error ("I'm empty. Can't align on self"); else - return scm_make_real (- ext.linear_combination (ly_scm2double (align))); + return scm_make_real (- ext.linear_combination (scm_to_double (align))); } return scm_make_real (0.0); } diff --git a/lily/separation-item.cc b/lily/separation-item.cc index 0fc3075d45..4a308146e1 100644 --- a/lily/separation-item.cc +++ b/lily/separation-item.cc @@ -77,7 +77,7 @@ Separation_item::width (Grob *me) SCM sw = me->get_property ("X-extent"); if (is_number_pair (sw)) { - return scm_to_interval (sw); + return ly_scm2interval (sw); } Item *item = dynamic_cast (me); diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 7c0596e985..a65d8f25fa 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -201,7 +201,7 @@ Side_position_interface::aligned_side (SCM element_smob, SCM axis) Direction d = Side_position_interface::get_direction (me); - Real o = ly_scm2double (aligned_on_support_extents (element_smob,axis)); + Real o = scm_to_double (aligned_on_support_extents (element_smob,axis)); Interval iv = me->extent (me, a); @@ -226,7 +226,7 @@ Side_position_interface::aligned_side (SCM element_smob, SCM axis) { Real padding= Staff_symbol_referencer::staff_space (me) - * ly_scm2double (me->get_property ("staff-padding")); + * scm_to_double (me->get_property ("staff-padding")); Grob *common = me->common_refpoint (st, Y_AXIS); diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index a7fd8a7680..8261f702fa 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -414,9 +414,9 @@ Simple_spacer_wrapper::solve (Column_x_positions *positions, bool ragged) SCM p = positions->cols_[i]->get_property ( "penalty"); if (ly_c_number_p (p)) { - if (ly_scm2double (p) < -9999) + if (scm_to_double (p) < -9999) break_satisfy = break_satisfy && (i == 0 || i == sz -1); - if (ly_scm2double (p) > 9999) + if (scm_to_double (p) > 9999) break_satisfy = break_satisfy && !(i == 0 || i == sz -1); } @@ -505,7 +505,7 @@ Simple_spacer_wrapper::add_columns (Link_array const &icols) int oi = cols.find_index (other); if (oi >= 0) { - spacer_->add_rod (i, oi, ly_scm2double (ly_cdar (s))); + spacer_->add_rod (i, oi, scm_to_double (ly_cdar (s))); } } } diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index 2223b372bb..0db9b834a3 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -489,7 +489,7 @@ set_end_points (Grob *me) ->lookup_variable (ly_symbol2scm ("debug-slur-quanting"))) && ly_c_pair_p (inspect_quants)) { - Drul_array ins = scm_to_interval (inspect_quants); + Drul_array ins = ly_scm2interval (inspect_quants); Real mindist = 1e6; for (int i = 0; i < scores.size (); i ++) { @@ -651,7 +651,7 @@ generate_curves (Grob *me, Grob **common, (void) extremes; Real staff_space = Staff_symbol_referencer::staff_space ((Grob *) me); Real r_0 = robust_scm2double (me->get_property ("ratio"), 0.33); - Real h_inf = staff_space * ly_scm2double (me->get_property ("height-limit")); + Real h_inf = staff_space * scm_to_double (me->get_property ("height-limit")); for (int i = 0; i < scores->size(); i++) { Bezier bez= get_bezier (me, diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 7bd2df59c7..869c1d1681 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -218,7 +218,7 @@ Span_bar::evaluate_glyph (Grob*me) Interval Span_bar::get_spanned_interval (Grob*me) { - return scm_to_interval (Axis_group_interface::group_extent_callback + return ly_scm2interval (Axis_group_interface::group_extent_callback (me->self_scm (), scm_int2num (Y_AXIS))); } diff --git a/lily/staff-spacing.cc b/lily/staff-spacing.cc index c8684e791a..4e0e0497cf 100644 --- a/lily/staff-spacing.cc +++ b/lily/staff-spacing.cc @@ -209,7 +209,7 @@ Staff_spacing::get_spacing_params (Grob *me, Real * space, Real * fixed) } space_def = ly_cdr (space_def); - Real distance = ly_scm2double (ly_cdr (space_def)); + Real distance = scm_to_double (ly_cdr (space_def)); SCM type = ly_car (space_def) ; *fixed = last_ext[RIGHT]; diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index 9fbe6f8b43..b7a42e1aae 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -121,7 +121,7 @@ Staff_symbol_referencer::callback (SCM element_smob, SCM) if (ly_c_number_p (pos)) { Real space = Staff_symbol_referencer::staff_space (me); - off = ly_scm2double (pos) * space / 2.0; + off = scm_to_double (pos) * space / 2.0; me->set_property ("staff-position", scm_int2num (0)); } diff --git a/lily/staff-symbol.cc b/lily/staff-symbol.cc index 7a74c25bbf..9526e36dd8 100644 --- a/lily/staff-symbol.cc +++ b/lily/staff-symbol.cc @@ -52,7 +52,7 @@ Staff_symbol::print (SCM smob) since that would make aligning staff symbols of different sizes to one right margin hell. */ - span_points[RIGHT] = ly_scm2double (width_scm); + span_points[RIGHT] = scm_to_double (width_scm); } else { diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 008bd90094..508a37f8f5 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -59,7 +59,7 @@ Stem_tremolo::raw_stencil (Grob *me) Real dy = 0; SCM s = beam->get_property ("positions"); if (is_number_pair (s)) - dy = -ly_scm2double (ly_car (s)) +ly_scm2double (ly_cdr (s)); + dy = -scm_to_double (ly_car (s)) +scm_to_double (ly_cdr (s)); Real dx = Beam::last_visible_stem (beam)->relative_coordinate (0, X_AXIS) - Beam::first_visible_stem (beam)->relative_coordinate (0, X_AXIS); @@ -138,7 +138,7 @@ Stem_tremolo::print (SCM grob) Real beamthickness = 0.0; SCM sbt = (beam) ? beam->get_property ("thickness") : SCM_EOL ; if (ly_c_number_p (sbt)) - beamthickness = ly_scm2double (sbt) * ss; + beamthickness = scm_to_double (sbt) * ss; Real end_y = Stem::stem_end_position (stem) * ss / 2 diff --git a/lily/stem.cc b/lily/stem.cc index 966d036151..c83c7a7b37 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -97,7 +97,7 @@ Stem::stem_end_position (Grob *me) me->set_property ("stem-end-position", scm_make_real (pos)); } else - pos = ly_scm2double (p); + pos = scm_to_double (p); return pos; } @@ -272,12 +272,12 @@ Stem::get_default_stem_end_position (Grob *me) Real length = 7; SCM scm_len = me->get_property ("length"); if (ly_c_number_p (scm_len)) - length = ly_scm2double (scm_len); + length = scm_to_double (scm_len); else { s = me->get_property ("lengths"); if (ly_c_pair_p (s)) - length = 2 * ly_scm2double (robust_list_ref (durlog - 2, s)); + length = 2 * scm_to_double (robust_list_ref (durlog - 2, s)); } /* URGURGURG @@ -622,7 +622,7 @@ Stem::dim_callback (SCM e, SCM ax) Real Stem::thickness (Grob *me) { - return ly_scm2double (me->get_property ("thickness")) + return scm_to_double (me->get_property ("thickness")) * Staff_symbol_referencer::line_thickness (me); } @@ -743,8 +743,8 @@ Stem::get_stem_info (Grob *me) Stem_info si; si.dir_ = get_grob_direction (me); - si.ideal_y_ = ly_scm2double (ly_car (scm_info)); - si.shortest_y_ = ly_scm2double (ly_cadr (scm_info)); + si.ideal_y_ = scm_to_double (ly_car (scm_info)); + si.shortest_y_ = scm_to_double (ly_cadr (scm_info)); return si; } @@ -771,7 +771,7 @@ Stem::calc_stem_info (Grob *me) /* Simple standard stem length */ SCM lengths = me->get_property ("beamed-lengths"); Real ideal_length = - ly_scm2double (robust_list_ref (beam_count - 1,lengths)) + scm_to_double (robust_list_ref (beam_count - 1,lengths)) * staff_space /* stem only extends to center of beam @@ -782,7 +782,7 @@ Stem::calc_stem_info (Grob *me) /* Condition: sane minimum free stem length (chord to beams) */ lengths = me->get_property ("beamed-minimum-free-lengths"); Real ideal_minimum_free = - ly_scm2double (robust_list_ref (beam_count - 1, lengths)) + scm_to_double (robust_list_ref (beam_count - 1, lengths)) * staff_space; @@ -842,7 +842,7 @@ Stem::calc_stem_info (Grob *me) ideal_y -= robust_scm2double (beam->get_property ("shorten"), 0); Real minimum_free = - ly_scm2double (robust_list_ref + scm_to_double (robust_list_ref (beam_count - 1, me->get_property ("beamed-extreme-minimum-free-lengths"))) diff --git a/lily/stencil-scheme.cc b/lily/stencil-scheme.cc index 4a34f13025..09f317fd08 100644 --- a/lily/stencil-scheme.cc +++ b/lily/stencil-scheme.cc @@ -27,7 +27,7 @@ LY_DEFINE (ly_stencil_set_extent_x, "ly:stencil-set-extent!", SCM_ASSERT_TYPE (is_number_pair (np), np, SCM_ARG3, __FUNCTION__, "number pair"); - Interval iv = scm_to_interval (np); + Interval iv = ly_scm2interval (np); s->dim_[Axis (scm_to_int (axis))] = iv; return SCM_UNSPECIFIED; @@ -44,7 +44,7 @@ LY_DEFINE (ly_translate_stencil_axis, "ly:stencil-translate-axis", SCM new_s = s->smobbed_copy (); Stencil *q = unsmob_stencil (new_s); - q->translate_axis (ly_scm2double (amount), Axis (scm_to_int (axis))); + q->translate_axis (scm_to_double (amount), Axis (scm_to_int (axis))); return new_s; } @@ -106,13 +106,13 @@ LY_DEFINE (ly_stencil_moved_to_edge, "ly:stencil-moved-to-edge", if (padding != SCM_UNDEFINED) { SCM_ASSERT_TYPE (ly_c_number_p (padding), padding, SCM_ARG5, __FUNCTION__, "number"); - p = ly_scm2double (padding); + p = scm_to_double (padding); } Real m = 0.0; if (minimum != SCM_UNDEFINED) { SCM_ASSERT_TYPE (ly_c_number_p (minimum), minimum, SCM_ARG6, __FUNCTION__, "number"); - m = ly_scm2double (minimum); + m = scm_to_double (minimum); } if (s1) @@ -156,13 +156,13 @@ LY_DEFINE (ly_stencil_combine_at_edge, "ly:stencil-combine-at-edge", if (padding != SCM_UNDEFINED) { SCM_ASSERT_TYPE (ly_c_number_p (padding), padding, SCM_ARG5, __FUNCTION__, "number"); - p = ly_scm2double (padding); + p = scm_to_double (padding); } Real m = 0.0; if (minimum != SCM_UNDEFINED) { SCM_ASSERT_TYPE (ly_c_number_p (minimum), minimum, SCM_ARG6, __FUNCTION__, "number"); - m = ly_scm2double (minimum); + m = scm_to_double (minimum); } if (s1) @@ -210,7 +210,7 @@ LY_DEFINE (ly_make_stencil, "ly:make-stencil", SCM_ASSERT_TYPE (is_number_pair (xext), xext, SCM_ARG2, __FUNCTION__, "number pair"); SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG3, __FUNCTION__, "number pair"); - Box b (scm_to_interval (xext), scm_to_interval (yext)); + Box b (ly_scm2interval (xext), ly_scm2interval (yext)); Stencil s (b, expr); return s.smobbed_copy (); } @@ -227,6 +227,6 @@ LY_DEFINE (ly_stencil_align_to_x, "ly:stencil-align-to!", SCM_ASSERT_TYPE (ly_c_number_p (dir), dir, SCM_ARG3, __FUNCTION__, "number"); unsmob_stencil (stil)->align_to ((Axis)scm_to_int (axis), - ly_scm2double (dir)); + scm_to_double (dir)); return stil; } diff --git a/lily/system-start-delimiter-engraver.cc b/lily/system-start-delimiter-engraver.cc index 158d201330..3aeb41b130 100644 --- a/lily/system-start-delimiter-engraver.cc +++ b/lily/system-start-delimiter-engraver.cc @@ -56,7 +56,7 @@ System_start_delimiter_engraver::acknowledge_grob (Grob_info inf) { inf.grob_->translate_axis ( -0.8, X_AXIS); // ugh inf.grob_->set_property ("arch-height", - scm_make_real (ly_scm2double (inf.grob_->get_property + scm_make_real (scm_to_double (inf.grob_->get_property ("arch-height"))+0.5)); } } diff --git a/lily/system-start-delimiter.cc b/lily/system-start-delimiter.cc index 2aa3da9d4c..0127310b01 100644 --- a/lily/system-start-delimiter.cc +++ b/lily/system-start-delimiter.cc @@ -22,7 +22,7 @@ Stencil System_start_delimiter::staff_bracket (Grob*me,Real height) { - Real arc_height = ly_scm2double (me->get_property ("arch-height")) ; + Real arc_height = scm_to_double (me->get_property ("arch-height")) ; SCM at = scm_list_n (ly_symbol2scm ("bracket"), me->get_property ("arch-angle"), diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index dea9d39d3e..5e43a0880b 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -71,11 +71,11 @@ Text_spanner::print (SCM smob) robust_relative_extent (b, common, X_AXIS).linear_combination (d * encl); if (is_number_pair (shorten)) - span_points -= d * ly_scm2double (index_get_cell (shorten, d)); + span_points -= d * scm_to_double (index_get_cell (shorten, d)); } if (is_number_pair (flare)) - span_points -= d * ly_scm2double (index_get_cell (flare, d)); + span_points -= d * scm_to_double (index_get_cell (flare, d)); } while (flip (&d) != LEFT); @@ -115,7 +115,7 @@ Text_spanner::print (SCM smob) Real dx = 0.0; if (is_number_pair (flare)) - dx = ly_scm2double (index_get_cell (flare, d)) * d; + dx = scm_to_double (index_get_cell (flare, d)) * d; Real dy = - dir * edge_height[d] ; if (dy) diff --git a/lily/tie.cc b/lily/tie.cc index 2690f4920b..1f4d4a58b0 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -206,8 +206,8 @@ Tie::get_control_points (SCM smob) SCM lim // groetjes aan de chirurgendochter. = scm_assq (ly_symbol2scm ("height-limit"),details); - Real h_inf = ly_scm2double (ly_cdr (lim)) * staff_space; - Real r_0 = ly_scm2double (ly_cdr (scm_assq (ly_symbol2scm ("ratio"),details))); + Real h_inf = scm_to_double (ly_cdr (lim)) * staff_space; + Real r_0 = scm_to_double (ly_cdr (scm_assq (ly_symbol2scm ("ratio"),details))); Bezier b = slur_shape (width, h_inf, r_0); @@ -220,7 +220,7 @@ Tie::get_control_points (SCM smob) */ Real ypos = Tie::get_position (me) * staff_space/2 - + dir * ly_scm2double (me->get_property ("y-offset"));; + + dir * scm_to_double (me->get_property ("y-offset"));; /* Make sure we don't start on a dots @@ -268,7 +268,7 @@ Tie::get_control_points (SCM smob) Real diff = ry - y; Real newy = y; - Real clear = staff_space * ly_scm2double (me->get_property ("staffline-clearance")); + Real clear = staff_space * scm_to_double (me->get_property ("staffline-clearance")); if (fabs (y) <= Staff_symbol_referencer::staff_radius (me) * staff_space + clear diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index 8e2aa1b249..ecf3c72598 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -213,11 +213,11 @@ Tuplet_bracket::print (SCM smob) do { flare[d] = height[d] = shorten[d] = 0.0; if (is_number_pair (fl)) - flare[d] += ss * ly_scm2double (index_get_cell (fl, d)); + flare[d] += ss * scm_to_double (index_get_cell (fl, d)); if (is_number_pair (eh)) - height[d] += - dir * ss *ly_scm2double (index_get_cell (eh, d)); + height[d] += - dir * ss *scm_to_double (index_get_cell (eh, d)); if (is_number_pair (sp)) - shorten[d] += ss *ly_scm2double (index_get_cell (sp, d)); + shorten[d] += ss *scm_to_double (index_get_cell (sp, d)); } while (flip (&d) != LEFT); @@ -383,7 +383,7 @@ Tuplet_bracket::calc_position_and_height (Grob*me,Real *offset, Real * dy) } // padding - *offset += ly_scm2double (me->get_property ("padding")) *dir; + *offset += scm_to_double (me->get_property ("padding")) *dir; /* @@ -473,13 +473,13 @@ Tuplet_bracket::after_line_breaking (SCM smob) { SCM ps = par_beam->get_property ("positions"); - Real lp = ly_scm2double (ly_car (ps)); - Real rp = ly_scm2double (ly_cdr (ps)); + Real lp = scm_to_double (ly_car (ps)); + Real rp = scm_to_double (ly_cdr (ps)); /* duh. magic. < */ - offset = lp + dir * (0.5 + ly_scm2double (me->get_property ("padding"))); + offset = lp + dir * (0.5 + scm_to_double (me->get_property ("padding"))); dy = rp- lp; } @@ -489,11 +489,11 @@ Tuplet_bracket::after_line_breaking (SCM smob) if (ly_c_number_p (lp) && !ly_c_number_p (rp)) { - rp = scm_make_real (ly_scm2double (lp) + dy); + rp = scm_make_real (scm_to_double (lp) + dy); } else if (ly_c_number_p (rp) && !ly_c_number_p (lp)) { - lp = scm_make_real (ly_scm2double (rp) - dy); + lp = scm_make_real (scm_to_double (rp) - dy); } else if (!ly_c_number_p (rp) && !ly_c_number_p (lp)) { diff --git a/scm/page-layout.scm b/scm/page-layout.scm index 65f15c78e4..3587606561 100644 --- a/scm/page-layout.scm +++ b/scm/page-layout.scm @@ -213,6 +213,7 @@ of lines. " (define (get-path node done) "Follow NODE.PREV, and return as an ascending list of pages. DONE is what have collected so far, and has ascending page numbers." + (if (is-a? node ) (get-path (node-prev node) (cons node done)) done)) @@ -368,7 +369,7 @@ CURRENT-BEST is the best result sofar, or #f." #:penalty total-penalty) current-best))) - (if #t ;; debug + (if #f ;; debug (display (list "\nuser pen " user-penalty