From 73c936b8ce96f051ca113fa366da16ad41024839 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 4 Jan 2007 17:37:03 +0100 Subject: [PATCH] coverage fixes. --- input/regression/profile-property-access.ly | 33 +++++++++++++++++++++ input/regression/relative-repeat.ly | 10 +++++++ lily/auto-beam-engraver.cc | 8 ++++- lily/bezier.cc | 15 ---------- lily/duration-scheme.cc | 2 +- lily/figured-bass-engraver.cc | 2 +- lily/general-scheme.cc | 2 +- lily/include/lookup.hh | 1 + lily/include/stencil.hh | 1 - lily/instrument-switch-engraver.cc | 3 ++ lily/line-interface.cc | 18 ----------- lily/lookup.cc | 32 +++++++++++++------- lily/system.cc | 5 ++-- 13 files changed, 82 insertions(+), 50 deletions(-) create mode 100644 input/regression/profile-property-access.ly create mode 100644 input/regression/relative-repeat.ly diff --git a/input/regression/profile-property-access.ly b/input/regression/profile-property-access.ly new file mode 100644 index 0000000000..c46bbf58dc --- /dev/null +++ b/input/regression/profile-property-access.ly @@ -0,0 +1,33 @@ +\header { + texidoc = "This file profiles property accesses; the log file shows the top properties examined." +} + + +#(ly:set-option 'profile-property-accesses #t) + +\version "2.10.8" + +\include "../../input/typography-demo.ly" +%\book { \score { {c4 } } } + +#(define (prop-stats>? x y) (> (cdr x) (cdr y))) + +#(define (display-stats what hash) + (let* + ((count 50) + (rnd 10)) + (ly:progress "\n~A properties, top ~a rounded to ~a\n~a" + what count rnd + (string-join + (map (lambda (x) (format "~30a: ~6@a" (car x) (* rnd (inexact->exact (round (/ (cdr x) rnd)))))) + (take + (sort (hash-table->alist hash) prop-stats>?) count)) + "\n")))) + + + +#(display-stats "Context" (ly:context-property-lookup-stats)) + +#(display-stats "Grob" (ly:grob-property-lookup-stats)) + + diff --git a/input/regression/relative-repeat.ly b/input/regression/relative-repeat.ly new file mode 100644 index 0000000000..5f0c613b41 --- /dev/null +++ b/input/regression/relative-repeat.ly @@ -0,0 +1,10 @@ +\header { + texidoc = "Relative mode for repeats uses order of entry." + } +\version "2.10.8" + +\relative { + \repeat "unfold" 3 + { f2 bes2 } + \alternative { a1 e b } +} diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index 48766e7e52..af6eae454a 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -427,5 +427,11 @@ ADD_TRANSLATOR (Auto_beam_engraver, "@ref{Stem_engraver} properties @code{stemLeftBeamCount} and " "@code{stemRightBeamCount}. ", /* create */ "Beam", - /* read */ "autoBeaming autoBeamSettings beatLength subdivideBeams", + + /* read */ + "autoBeaming " + "autoBeamSettings " + "beatLength " + "subdivideBeams ", + /* write */ ""); diff --git a/lily/bezier.cc b/lily/bezier.cc index 77f3949992..3da46abe0f 100644 --- a/lily/bezier.cc +++ b/lily/bezier.cc @@ -14,21 +14,6 @@ Real binomial_coefficient_3[] = { 1, 3, 3, 1 }; -Real -binomial_coefficient (Real over, int under) -{ - Real x = 1.0; - - while (under) - { - x *= over / Real (under); - - over -= 1.0; - under--; - } - return x; -} - void scale (vector *array, Real x, Real y) { diff --git a/lily/duration-scheme.cc b/lily/duration-scheme.cc index d10d8f2ee3..de8646e858 100644 --- a/lily/duration-scheme.cc +++ b/lily/duration-scheme.cc @@ -123,7 +123,7 @@ LY_DEFINE (ly_duration_length, "ly:duration-length", LY_DEFINE (ly_duration2string, "ly:duration->string", 1, 0, 0, (SCM dur), - "Convert{dur} to string.") + "Convert @var{dur} to string.") { SCM_ASSERT_TYPE (unsmob_duration (dur), dur, SCM_ARG1, __FUNCTION__, "duration"); return ly_string2scm (unsmob_duration (dur)->to_string ()); diff --git a/lily/figured-bass-engraver.cc b/lily/figured-bass-engraver.cc index 025f7de6ed..d058f78059 100644 --- a/lily/figured-bass-engraver.cc +++ b/lily/figured-bass-engraver.cc @@ -286,7 +286,7 @@ Figured_bass_engraver::add_brackets () void Figured_bass_engraver::process_music () { - if (!to_boolean (get_property ("useBassFigureExtenders"))) + if (alignment_ && !to_boolean (get_property ("useBassFigureExtenders"))) clear_spanners (); if (rest_event_) diff --git a/lily/general-scheme.cc b/lily/general-scheme.cc index 1dcc4ecc52..a75ff51181 100644 --- a/lily/general-scheme.cc +++ b/lily/general-scheme.cc @@ -344,7 +344,7 @@ LY_DEFINE (ly_camel_case_to_lisp_identifier, "ly:camel-case->lisp-identifier", LY_DEFINE (ly_expand_environment, "ly:expand-environment", 1, 0, 0, (SCM str), - "Expand $VAR and ${VAR} in @var{str}.") + "Expand $VAR and $@{VAR@} in @var{str}.") { SCM_ASSERT_TYPE(scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string"); diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index db5f2d9cc7..cbd10549b0 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -31,6 +31,7 @@ struct Lookup static Stencil repeat_slash (Real w, Real slope, Real th); static Stencil horizontal_line (Interval w, Real th); static Stencil triangle (Interval, Real, Real); + static Stencil points_to_line_stencil (Real thick, vector const &points); }; #endif // LOOKUP_HH diff --git a/lily/include/stencil.hh b/lily/include/stencil.hh index b80bcc1c3d..807ea6d110 100644 --- a/lily/include/stencil.hh +++ b/lily/include/stencil.hh @@ -95,6 +95,5 @@ void register_stencil_head (SCM symbol); bool is_stencil_head (SCM symbol); SCM all_stencil_heads (); -Stencil points_to_line_stencil (vector points); #endif /* STENCIL_HH */ diff --git a/lily/instrument-switch-engraver.cc b/lily/instrument-switch-engraver.cc index fe30a0423c..c9dce0aafb 100644 --- a/lily/instrument-switch-engraver.cc +++ b/lily/instrument-switch-engraver.cc @@ -31,6 +31,9 @@ Instrument_switch_engraver::Instrument_switch_engraver () text_ = 0; } +/* + TODO: should use an event. + */ void Instrument_switch_engraver::process_music () { diff --git a/lily/line-interface.cc b/lily/line-interface.cc index f65dc946f2..c765ffcd4c 100644 --- a/lily/line-interface.cc +++ b/lily/line-interface.cc @@ -156,21 +156,3 @@ ADD_INTERFACE (Line_interface, "arrow-length " "arrow-width") - - -/* todo: move this somewhere else? */ -Stencil -points_to_line_stencil (vector points) -{ - Stencil ret; - for (vsize i = 1; i < points.size (); i++) - { - if (points[i-1].is_sane () && points[i].is_sane ()) - { - Stencil line - = Line_interface::make_line (0.1, points[i-1], points[i]); - ret.add_stencil (line); - } - } - return ret; -} diff --git a/lily/lookup.cc b/lily/lookup.cc index 8a81937352..1a34881d80 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -714,17 +714,29 @@ Lookup::triangle (Interval iv, Real thick, Real protude) b[X_AXIS] = Interval (0, iv.length ()); b[Y_AXIS] = Interval (min (0., protude), max (0.0, protude)); - Offset z1 (iv[LEFT], 0); - Offset z2 (iv[RIGHT], 0); - Offset z3 ((z1 + z2)[X_AXIS] / 2, protude); + vector points; + points.push_back (Offset (iv[LEFT], 0)); + points.push_back (Offset (iv[RIGHT], 0)); + points.push_back (Offset (iv.center (), protude)); - /* - TODO: move Triangle to Line_interface ? - */ - Stencil tri = Line_interface::make_line (thick, z1, z2); - tri.add_stencil (Line_interface::make_line (thick, z2, z3)); - tri.add_stencil (Line_interface::make_line (thick, z3, z1)); + return points_to_line_stencil (thick, points); - return tri; } + + +Stencil +Lookup::points_to_line_stencil (Real thick, vector const &points) +{ + Stencil ret; + for (vsize i = 1; i < points.size (); i++) + { + if (points[i-1].is_sane () && points[i].is_sane ()) + { + Stencil line + = Line_interface::make_line (thick, points[i-1], points[i]); + ret.add_stencil (line); + } + } + return ret; +} diff --git a/lily/system.cc b/lily/system.cc index 8fee382572..6ae37f93fa 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -23,6 +23,7 @@ #include "staff-symbol-referencer.hh" #include "tweak-registration.hh" #include "warn.hh" +#include "lookup.hh" extern bool debug_skylines; @@ -399,8 +400,8 @@ System::get_paper_system () exprs)); if (debug_skylines) { - sys_stencil.add_stencil (points_to_line_stencil (skylines_[UP].to_points ()).in_color (255, 0, 0)); - sys_stencil.add_stencil (points_to_line_stencil (skylines_[DOWN].to_points ()).in_color (0, 255, 0)); + sys_stencil.add_stencil (Lookup::points_to_line_stencil (0.1, skylines_[UP].to_points ()).in_color (255, 0, 0)); + sys_stencil.add_stencil (Lookup::points_to_line_stencil (0.1, skylines_[DOWN].to_points ()).in_color (0, 255, 0)); } Grob *left_bound = this->get_bound (LEFT); -- 2.39.2