]> git.donarmstrong.com Git - lilypond.git/commitdiff
(warning): better robustness fix.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 19 Nov 2002 12:23:30 +0000 (12:23 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 19 Nov 2002 12:23:30 +0000 (12:23 +0000)
ChangeLog
VERSION
aclocal.m4
autogen.sh
lily/cluster-engraver.cc
lily/cluster.cc
lily/grob.cc
lily/ligature-bracket-engraver.cc
scm/grob-description.scm

index 4e59cb531ae9f238e8a091a6bd7687264c6c1b8d..133842e9dac7b841f6d3f87db6bfadc74cd76de9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2002-11-19  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * lily/grob.cc (warning): better robustness fix.
+
+2002-11-19 Juergen Reuter  <reuter@ipd.uka.de>
+
+       * lily/cluster-engraver.cc: bugfix: use protected scm upon columns
+
+       * lily/cluster-engraver.cc: stick better to variable naming
+       conventions
+
+       * lily/cluster-engraver.cc: bugfix: delay typesetting of cluster
+       until stop_translation_timestep()
+
+       * lily/cluster-engraver.cc, lily/cluster.cc: design fix: pass
+       min/max coordinates to backend, but no musical info such as
+       pitches
+
+       * lily/cluster.cc: robustness fix: do not crash upon empty cluster
+
+       * lily/grob.cc: robustness fix: warning(): do not crash if
+       cause is not set
+
+       * lily/ligature-bracket-engraver.cc, scm/grob-description.scm: use
+       the much more elaborated tuplet brackets than the very naive and
+       simple ligature bracket grob
+
 2002-11-19  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
        * Documentation/user/refman.itely (Analysis brackets): add
@@ -63,6 +90,8 @@
        
        * input/*.ly: update syntax to 1.7 + new-chords.
 
+       * VERSION: 1.7.7 released.
+       
        * Documentation/user/*.tely: new chord syntax.
 
        * input/regression/[bc]*.ly (texidoc): syntax updates.
diff --git a/VERSION b/VERSION
index dceff6e1c3adf88c09b6f146173fd37d2a8b1e7c..60fe3bf00fade35d0ac1fabdfab42ab79bc92173 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=7
-PATCH_LEVEL=7
+PATCH_LEVEL=8
 MY_PATCH_LEVEL=
 
 # Use the above to send patches: MY_PATCH_LEVEL is always empty for a
index c396de57f8cdfc8e3d8633177833cb5c0ccb937e..e62adcde3725ebbe79f5b1f15a7c3c1c2edc19c8 100644 (file)
@@ -1,6 +1,6 @@
 dnl aclocal.m4   -*-shell-script-*-
 dnl WARNING WARNING WARNING
-dnl do not edit! this is aclocal.m4, generated from /home/fred/lily/stepmake/aclocal.m4
+dnl do not edit! this is aclocal.m4, generated from /users/hanwen/usr/src/lilypond/stepmake/aclocal.m4
 dnl aclocal.m4   -*-shell-script-*-
 dnl StepMake subroutines for configure.in
 
index f70572727e57edcdc54a47352e7c8ae7efe16046..36d6b4939ff9eb10f10577314e3449466910a05a 100755 (executable)
@@ -1,7 +1,4 @@
 #!/bin/sh
-# WARNING WARNING WARNING
-# do not edit! this is autogen.sh, generated from /home/fred/lily/stepmake/autogen.sh
-#!/bin/sh
 # Run this to generate configure and initial GNUmakefiles
 
 srcdir=`dirname $0`
index a9bd545314797a19250c787e68f401c8d4b67a70..4308326c535f1d8f1e3130ee6796b31d80120e8d 100644 (file)
@@ -8,6 +8,7 @@
 #include "item.hh"
 #include "spanner.hh"
 #include "note-head.hh"
+#include "protected-scm.hh"
 #include "warn.hh"
 
 class Cluster_engraver : public Engraver
@@ -23,9 +24,9 @@ TRANSLATOR_DECLARATIONS(Cluster_engraver);
 
 private:
   Drul_array<Music*> reqs_drul_;
-  Pitch pitch_min, pitch_max;
-  Spanner *cluster;
-  SCM columns_scm;
+  Pitch pitch_min_, pitch_max_;
+  Spanner *cluster_;
+  SCM columns_scm_;
 };
 
 void reset_min_max (Pitch *pitch_min, Pitch *pitch_max)
@@ -40,8 +41,8 @@ void reset_min_max (Pitch *pitch_min, Pitch *pitch_max)
 
 Cluster_engraver::Cluster_engraver ()
 {
-  cluster = 0;
-  columns_scm = SCM_EOL;
+  cluster_ = 0;
+  columns_scm_ = SCM_EOL;
   reqs_drul_[LEFT] = reqs_drul_[RIGHT] = 0;
 }
 
@@ -52,11 +53,11 @@ Cluster_engraver::try_music (Music *m)
     {
       reqs_drul_[START] = 0;
       reqs_drul_[STOP] = 0;
-      if (cluster)
+      if (cluster_)
        {
-         cluster->suicide ();
-         cluster = 0;
-         columns_scm = SCM_EOL;
+         cluster_->suicide ();
+         cluster_ = 0;
+         columns_scm_ = SCM_EOL;
        }
     }
   else if (m->is_mus_type ("cluster-event"))
@@ -73,35 +74,30 @@ Cluster_engraver::process_music ()
 {
   if (reqs_drul_[STOP])
     {
-      if (!cluster)
+      if (!cluster_)
        {
          reqs_drul_[STOP]->origin ()->warning ("can't find start of cluster");
        }
       else
        {
          Grob *bound = unsmob_grob (get_property ("currentMusicalColumn"));
-         cluster->set_bound (RIGHT, bound);
-         cluster->set_grob_property ("segments", columns_scm);
-         typeset_grob (cluster);
-         cluster = 0;
-         columns_scm = SCM_EOL;
+         cluster_->set_bound (RIGHT, bound);
        }
-      reqs_drul_[STOP] = 0;
     }
   if (reqs_drul_[START])
     {
-      if (cluster)
+      if (cluster_)
        {
          reqs_drul_[START]->origin ()->warning ("may not nest clusters");
        }
       else
        {
          SCM basicProperties = get_property ("Cluster");
-         cluster = new Spanner (basicProperties);
-         columns_scm = SCM_EOL;
+         cluster_ = new Spanner (basicProperties);
+         columns_scm_ = SCM_EOL;
          Grob *bound = unsmob_grob (get_property ("currentMusicalColumn"));
-         cluster->set_bound (LEFT, bound);
-         announce_grob (cluster, bound->self_scm ());
+         cluster_->set_bound (LEFT, bound);
+         announce_grob (cluster_, bound->self_scm ());
        }
       reqs_drul_[START] = 0;
     }
@@ -110,40 +106,55 @@ Cluster_engraver::process_music ()
 void
 Cluster_engraver::start_translation_timestep ()
 {
-  reset_min_max (&pitch_min, &pitch_max);
+  reset_min_max (&pitch_min_, &pitch_max_);
 }
 
 void
 Cluster_engraver::stop_translation_timestep ()
 {
-  if (cluster)
+  if (cluster_)
     {
       SCM column_scm = get_property ("currentMusicalColumn");
       if (column_scm == SCM_EOL)
        {
          programming_error("failed retrieving current column");
-         return;
        }
-
-      if (Pitch::compare (pitch_min, pitch_max) <= 0)
+      else
        {
-         int staff_position = pitch_min.steps ();
-         SCM c0 = get_property ("centralCPosition");
-         if (gh_number_p (c0))
-           staff_position += gh_scm2int (c0);
-         SCM segment = scm_list_n (column_scm,
-                                   gh_int2scm (staff_position),
-                                   pitch_min.smobbed_copy (),
-                                   pitch_max.smobbed_copy (),
-                                   SCM_UNDEFINED);
-         segment = scm_list_n (segment, SCM_UNDEFINED);
-         columns_scm = (columns_scm != SCM_EOL) ?
-           gh_append2 (columns_scm, segment) : segment;
+         if (Pitch::compare (pitch_min_, pitch_max_) <= 0)
+           {
+             Real y_bottom = 0.5 * pitch_min_.steps ();
+             SCM c0 = get_property ("centralCPosition");
+             if (gh_number_p (c0))
+               y_bottom += 0.5 * gh_scm2int (c0);
+             else
+               programming_error ("Cluster_engraver: failed evaluating c0");
+             Real y_top = y_bottom +
+               0.5 * (pitch_max_.steps () - pitch_min_.steps ());
+             column_scm = Protected_scm (column_scm);
+             SCM segment = scm_list_n (column_scm,
+                                       gh_double2scm (y_bottom),
+                                       gh_double2scm (y_top),
+                                       SCM_UNDEFINED);
+             segment = scm_list_n (segment, SCM_UNDEFINED);
+             columns_scm_ = (columns_scm_ != SCM_EOL) ?
+               gh_append2 (columns_scm_, segment) : segment;
+             cluster_->set_grob_property ("segments", columns_scm_); // Urrgh!
+           }
+         else
+           {
+             /* This timestep is caused by a different voice of the
+                same staff and hence should be ignored. */
+           }
        }
-      else
+
+      if (reqs_drul_[STOP])
        {
-         /* This timestep is caused by a different voice of the same
-            staff and hence should be ignored. */
+         reqs_drul_[STOP] = 0;
+         cluster_->set_grob_property ("segments", columns_scm_);
+         typeset_grob (cluster_);
+         cluster_ = 0;
+         columns_scm_ = SCM_EOL;
        }
     }
 }
@@ -160,19 +171,19 @@ Cluster_engraver::acknowledge_grob (Grob_info info)
          if (nr && nr->is_mus_type ("note-event"))
            {
              Pitch pitch = *unsmob_pitch (nr->get_mus_property ("pitch"));
-             if (Pitch::compare (pitch_min, pitch_max) > 0) // already init'd?
+             if (Pitch::compare (pitch_min_, pitch_max_) > 0) // already init'd?
                {
                  // not yet init'd; use current pitch to init min/max
-                 pitch_min = pitch;
-                 pitch_max = pitch;
+                 pitch_min_ = pitch;
+                 pitch_max_ = pitch;
                }
-             else if (Pitch::compare (pitch, pitch_max) > 0) // new max?
+             else if (Pitch::compare (pitch, pitch_max_) > 0) // new max?
                {
-                 pitch_max = pitch;
+                 pitch_max_ = pitch;
                }
-             else if (Pitch::compare (pitch, pitch_min) < 0) // new min?
+             else if (Pitch::compare (pitch, pitch_min_) < 0) // new min?
                {
-                 pitch_min = pitch;
+                 pitch_min_ = pitch;
                }
            }
        }
index f487cfb265a21f2371d8043ff48b8b4015e4a0f6..0e32dd14a88c841630fa27a6e4e5125bf87181e5 100644 (file)
@@ -132,10 +132,11 @@ Cluster::brew_molecule (SCM smob)
   Grob *me = unsmob_grob (smob);
 
   Spanner *spanner = dynamic_cast<Spanner*> (me);
-  if (!spanner) {
-    me->programming_error ("Cluster::brew_molecule(): not a spanner");
-    return SCM_EOL;
-  }
+  if (!spanner)
+    {
+      me->programming_error ("Cluster::brew_molecule(): not a spanner");
+      return SCM_EOL;
+    }
 
   Item *left_bound = spanner->get_bound (LEFT);
   Item *right_bound = spanner->get_bound (RIGHT);
@@ -149,7 +150,15 @@ Cluster::brew_molecule (SCM smob)
   bottom_points.clear ();
   top_points.clear ();
   SCM column_scm = SCM_EOL;
-  for (SCM columns_scm = me->get_grob_property ("segments");
+
+  SCM columns_scm = me->get_grob_property ("segments");
+  if (columns_scm == SCM_EOL)
+    {
+      me->warning ("junking empty cluster");
+      return SCM_EOL;
+    }
+
+  for (;
        columns_scm != SCM_EOL;
        columns_scm = ly_cdr (columns_scm)) {
     column_scm = ly_car (columns_scm);
@@ -162,31 +171,26 @@ Cluster::brew_molecule (SCM smob)
        break; // ok, we have seen all columns
     column = unsmob_grob (col_scm);
     column_scm = ly_cdr (column_scm);
-    Real y = 0.5 * gh_scm2double (ly_car (column_scm));
-    column_scm = ly_cdr (column_scm);
-    Pitch *pitch_min = unsmob_pitch (ly_car (column_scm));
+    Real y_bottom = gh_scm2double (ly_car (column_scm));
     column_scm = ly_cdr (column_scm);
-    Pitch *pitch_max = unsmob_pitch (ly_car (column_scm));
-    Real height = 0.5 * (pitch_max->steps () - pitch_min->steps ());
+    Real y_top = gh_scm2double (ly_car (column_scm));
     Real x = column->relative_coordinate (common, X_AXIS);
     if (right_broken)
       x -= left_bound->relative_coordinate (common, X_AXIS);
-    bottom_points.push (Offset (x, y));
-    top_points.push (Offset (x, y + height));
+    bottom_points.push (Offset (x, y_bottom));
+    top_points.push (Offset (x, y_top));
   }
   if (right_broken)
     {
-      Real y = 0.5 * gh_scm2double (ly_car (column_scm));
+      Real y_bottom = gh_scm2double (ly_car (column_scm));
       column_scm = ly_cdr (column_scm);
-      Pitch *pitch_min = unsmob_pitch (ly_car (column_scm));
+      Real y_top = gh_scm2double (ly_car (column_scm));
       column_scm = ly_cdr (column_scm);
-      Pitch *pitch_max = unsmob_pitch (ly_car (column_scm));
-      Real height = 0.5 * (pitch_max->steps () - pitch_min->steps ());
       Real x =
        right_bound->relative_coordinate (common, X_AXIS) -
        left_bound->relative_coordinate (common, X_AXIS);
-      bottom_points.push (Offset (x, y));
-      top_points.push (Offset (x, y + height));
+      bottom_points.push (Offset (x, y_bottom));
+      top_points.push (Offset (x, y_top));
     }
   Molecule out = brew_cluster_piece (me, bottom_points, top_points);
   return out.smobbed_copy ();
index 9aeb95f65195822a2afbd10ac640a4cc46e0dd68..f11e52a4fc588bbc6e94a0059870508b6907acdf 100644 (file)
@@ -700,9 +700,8 @@ void
 Grob::warning (String s)const
 {
   SCM cause = self_scm();
-  while (cause != SCM_EOL && !unsmob_music (cause))
+  while (Grob * g = unsmob_grob (cause))
     {
-      Grob * g = unsmob_grob (cause);
       cause = g->get_grob_property ("cause");
     }
 
index 59e7687907ef9b88912135c4c6b056580a7c5b0b..6f8d9e97cc0c84a675fe6daf268468950d75124d 100644 (file)
@@ -7,6 +7,8 @@
   
  */
 #include "ligature-engraver.hh"
+#include "note-column.hh"
+#include "tuplet-bracket.hh"
 #include "spanner.hh"
 #include "warn.hh"
 
@@ -14,6 +16,7 @@ class Ligature_bracket_engraver : public Ligature_engraver
 {
 protected:
   virtual Spanner *create_ligature_spanner ();
+  virtual void acknowledge_grob (Grob_info);
 
 public:
   TRANSLATOR_DECLARATIONS(Ligature_bracket_engraver);
@@ -33,10 +36,23 @@ Ligature_bracket_engraver::create_ligature_spanner ()
   return new Spanner (get_property ("LigatureBracket"));
 }
 
+void
+Ligature_bracket_engraver::acknowledge_grob (Grob_info info)
+{
+  if (ligature_)
+    {
+      if (Note_column::has_interface (info.grob_))
+       {
+         Tuplet_bracket::add_column (ligature_, dynamic_cast<Item*> (info.grob_));
+       }
+      else Ligature_engraver::acknowledge_grob (info);
+    }
+}
+
 ENTER_DESCRIPTION(Ligature_bracket_engraver,
 /* descr */       "Handles Ligature_events by engraving Ligature brackets.",
-/* creats*/       "LigatureBracket",
+/* creats*/       "TupletBracket",
 /* accepts */     "ligature-event abort-event",
-/* acks  */      "ligature-head-interface rest-interface",
+/* acks  */      "ligature-head-interface rest-interface note-column-interface",
 /* reads */       "",
 /* write */       "");
index 8c68a744dc3e1b9727d73a74b91e99f54f88f2cc..4e19b91a2251998ef71598b28231a8d0a526be67 100644 (file)
 
     (LigatureBracket
      . (
-       (width . 0.75)
-       (height . 0.5)
        (ligature-primitive-callback . ,Note_head::brew_molecule)
-       (molecule-callback . ,Ligature_bracket::brew_molecule)
-       (meta . ((interfaces . (ligature-bracket-interface spanner-interface))))
+       (direction . 1)
+       (gap . 0.0)
+       (padding . 2.0)
+       (thickness . 1.6)
+       (edge-widen . (0.0 . 0.0))
+       (edge-height . (0.7 . 0.7))
+       (shorten-pair . (-0.2 . -0.2))
+       (before-line-breaking-callback . ,Tuplet_bracket::before_line_breaking)
+       (after-line-breaking-callback . ,Tuplet_bracket::after_line_breaking)
+       (molecule-callback . ,Tuplet_bracket::brew_molecule)
+       (meta .  ((interfaces . (tuplet-bracket-interface spanner-interface))))
        ))
 
     (LigatureHead