]> git.donarmstrong.com Git - lilypond.git/commitdiff
coverage fixes.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 4 Jan 2007 16:37:03 +0000 (17:37 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 4 Jan 2007 16:37:03 +0000 (17:37 +0100)
13 files changed:
input/regression/profile-property-access.ly [new file with mode: 0644]
input/regression/relative-repeat.ly [new file with mode: 0644]
lily/auto-beam-engraver.cc
lily/bezier.cc
lily/duration-scheme.cc
lily/figured-bass-engraver.cc
lily/general-scheme.cc
lily/include/lookup.hh
lily/include/stencil.hh
lily/instrument-switch-engraver.cc
lily/line-interface.cc
lily/lookup.cc
lily/system.cc

diff --git a/input/regression/profile-property-access.ly b/input/regression/profile-property-access.ly
new file mode 100644 (file)
index 0000000..c46bbf5
--- /dev/null
@@ -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 (file)
index 0000000..5f0c613
--- /dev/null
@@ -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 } 
+}
index 48766e7e5245573324613f59e929431db0a4f31e..af6eae454a244ee1ac886e16a7be63bacf19a8d6 100644 (file)
@@ -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 */ "");
index 77f3949992cbf1fb6eaa380245d190aa3da3ec47..3da46abe0f31ba67830cd5e6c99a2b2ecf60aa62 100644 (file)
@@ -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<Offset> *array, Real x, Real y)
 {
index d10d8f2ee3ddbf04f9bc362bdf369721ec9b675e..de8646e85879a5e5fdd18057e172318ee8c56116 100644 (file)
@@ -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 ());
index 025f7de6edd0590e97f4c8b1853be99424bc626c..d058f780596a9086cc724f02912bda119aa25d53 100644 (file)
@@ -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_)
index 1dcc4ecc52c43bb267cf3606096d831354aa4d0b..a75ff511810131f31548e3cbf6c046768a37541a 100644 (file)
@@ -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");
index db5f2d9cc78a631edcf8bcd480c695f35ed82448..cbd10549b001803fb7eeed4fb6d29bb156aa3c44 100644 (file)
@@ -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<Offset> const &points);
 };
 
 #endif // LOOKUP_HH
index b80bcc1c3d77a281212a9701fe4ca66c926acb84..807ea6d110d5d3594720f0e239965b534995ddd1 100644 (file)
@@ -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<Offset> points);
 
 #endif /* STENCIL_HH */
index fe30a0423ce6eaf85368605a4574f1845072d92f..c9dce0aafb7ff1186a57d7b311027cbbb56b05a3 100644 (file)
@@ -31,6 +31,9 @@ Instrument_switch_engraver::Instrument_switch_engraver ()
   text_ = 0;
 }
 
+/*
+  TODO: should use an event.
+ */
 void
 Instrument_switch_engraver::process_music ()
 {
index f65dc946f2c70b62d7196f66159d99c2c1307dde..c765ffcd4cb56d7db3cfe13fc1790da464f0a457 100644 (file)
@@ -156,21 +156,3 @@ ADD_INTERFACE (Line_interface,
               "arrow-length "
               "arrow-width")
 
-
-
-/* todo: move this somewhere else? */
-Stencil
-points_to_line_stencil (vector<Offset> 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;
-}
index 8a81937352cf543edcca502706b422341a43ae8e..1a34881d80929daf2bb5a38c59f11d518372a685 100644 (file)
@@ -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<Offset> 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<Offset> 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;
+}
index 8fee38257286408c69ed8df8ce4042ece36a7ca2..6ae37f93fa7b6198231e5aa31f37b150fb54d9f5 100644 (file)
@@ -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);