]> git.donarmstrong.com Git - lilypond.git/commitdiff
''
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 23 Jun 2002 22:11:21 +0000 (22:11 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 23 Jun 2002 22:11:21 +0000 (22:11 +0000)
13 files changed:
ChangeLog
Documentation/user/tutorial.itely
input/tutorial/sammartini.ly
lily/break-substitution.cc [new file with mode: 0644]
lily/grob-scheme.cc [new file with mode: 0644]
lily/grob.cc
lily/include/grob.hh
lily/item.cc
lily/piano-pedal-engraver.cc
lily/system.cc
scm/c++.scm
scm/grob-property-description.scm
scm/lily.scm

index 892730bed7ddf7b2a698fa09d5630c6a4bfa3c13..5d9564be2edcd4e341676d40a79f7ca81dd84a5d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2002-06-24  Han-Wen  <hanwen@cs.uu.nl>
+
+       * lily/grob-scheme.cc: new file
+
+       * lily/break-substitution.cc: split up break substitution
+       functionality, and make a special constant stack-space version for
+       lists of grobs. This should fix the problems of lily in
+       combination with pthreads/qthreads.
+
+2002-06-23  Han-Wen  <hanwen@cs.uu.nl>
+
+       * lily/grob.cc (mark_smob): bugfix: mark X parent too.
+
 2002-06-23  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * Documentation/user/tutorial.itely (First steps): Add missing
index 1313f8bc1df091579289a886a4dc01aa097eceda..25051856b80feb393281c54f84cc76aed0b15b51 100644 (file)
@@ -843,10 +843,11 @@ enter the following input, and save the file as @file{test.ly}:
 @c (therefore name change proposal) 
 
 LilyPond is the program that computes the sheet music. All other
-things, such as titles and page layout, are done by a small wrapper
-program called @code{ly2dvi}. @code{ly2dvi} calls lilypond to render
-the music, and then adds the titling and page layout instructions.  To
-process @file{test.ly} with ly2dvi, proceed as follows:
+things, such as adding titles, page breaking and other page layout,
+are done by a small wrapper program called
+@code{ly2dvi}. @code{ly2dvi} calls lilypond to render the music, and
+then adds the titling and page layout instructions.  To process
+@file{test.ly} with ly2dvi, proceed as follows:
 
 @quotation
 @example
@@ -1906,74 +1907,7 @@ input file is a piano reduction of the G major Sinfonia by Giovanni
 Battista Sammartini.  It was composed around 1740.  It's in the source
 package under the name @file{sammartini.ly}.
 
-@lilypond[verbatim]
-\include "paper16.ly"
-
-stemDown = \property Voice.Stem \override #'direction = #-1
-stemUp = \property Voice.Stem \override #'direction = #1
-stemBoth = \property Voice.Stem \revert #'direction  
-
-viola = \notes \relative c' \context Voice = viola {
-    <c4-\f-\arpeggio g' c>
-    \stemDown g'8. b,16
-    s1 s2. r4
-    g
-}
-
-oboes = \notes \relative c'' \context Voice = oboe {
-    \stemUp s4  g8. b,16 c8 r <e'8.^\p g> <f16 a>
-    \grace <e8( g> <d4 )f> <c2 e>
-    \times 2/3 { <d8 \< f> <e g> <f a> }
-    <
-        { \times 2/3 { a8 g c } \! c2 }
-        \context Voice = oboeTwo {
-            \stemDown
-            \grace {
-                \property Voice.Stem \override #'direction = #-1
-                [f,16 g] 
-                \property Voice.Stem \revert #'direction
-           }
-            f8 e e2
-        }
-    >
-    \stemBoth
-    \grace <c,8( e> <)b8. d8.-\trill> <c16 e> | 
-    [<d ( f> < )f8. a>] <)b,8 d> r [<d16( f> <f8. )a>] <b,8 d> r  |
-    [<c16( e>  < )e8. g>] <c8 e,>
-}
-
-hoomPah = \repeat unfold 8 \notes
-    \transpose c' { \stemUp c8 \stemBoth \stemDown g'8 \stemBoth }
-
-bassvoices = \notes \relative c' {
-    c4 g8. b,16
-    \autochange Staff \context Voice \hoomPah
-    \translator Staff = down
-    \stemDown [c8 c'8] r4
-    <g d'> r4
-    < {\stemUp r2 <e4 c'> <c8 g'> }
-        \context Voice = reallyLow  {\stemDown g2 ~ | g4 c8 } >
-}
-
-\score {
-    \context PianoStaff \notes <
-        \context Staff = up < \time 2/2
-            \viola
-            \oboes
-        >
-        \context Staff = down < \time 2/2 \clef bass
-            \bassvoices
-        >
-    >
-    \midi { }
-    \paper {
-        indent = 0.0
-        linewidth = 15.0 \cm }
-}
-@end lilypond
-
-If this looks like incomprehensible gibberish to you, you are right.
-This example has been doctored to have as many quirks as possible.
+@lilypondfile[verbatim]{sammartini.ly}
 
 As you can see, this example features multiple voices on one staff.  To
 make room for those voices, their notes have to be stemmed in opposite
index a6df9310dcc0aabfd2d8e1ed957ef3e22ea2045e..a1b0253ec6b3b05a6ca943af28940299c5218d44 100644 (file)
@@ -2,27 +2,26 @@
 \include "paper16.ly"
  
 viola = \notes \relative c'  \context Voice = viola {
-    <c4-\f-\arpeggio g' c>
-    \stemDown
+    <c4-\arpeggio g' c>
+    \voiceTwo
     g'8. b,16
     s1 s2. r4
     g
 }
 
 oboes = \notes \relative c'' \context Voice = oboes {
-    \stemUp
-    s4  g8. b,16 c8 r <e'8.^\p g> <f16 a>
-    \grace <e8( g> <d4 f> <c2 e>
-    \times 2/3 { <d8 \< f> <e g> <f a> }
+    \voiceOne
+    s4  g8. b,16 c8 r <e'8. g> <f16 a>
+    \grace <e8( g> <d4 )f> <c2 e>
+    \times 2/3 { <d8  f> <e g> <f a> }
     <
-        { \stemUp \times 2/3 { a8 g c } \! c2 }
-        \context Voice = second { \stemDown
-            \grace {
+        { \times 2/3 { a8 g c }  c2 }
+       \\
+        { \grace {
                 \stemDown
                 [f,16 g]
                \stemBoth }
-                f8 e e2
-            }
+                f8 e e2 }  
     >
 
     \grace <c,8( e> <)b8. d8.-\trill> <c16 e> | 
diff --git a/lily/break-substitution.cc b/lily/break-substitution.cc
new file mode 100644 (file)
index 0000000..73c24c2
--- /dev/null
@@ -0,0 +1,188 @@
+#include  "grob.hh"
+#include "item.hh"
+#include  "spanner.hh"
+#include  "system.hh"
+
+static SCM break_criterion; 
+void
+set_break_subsititution (SCM criterion)
+{
+  break_criterion = criterion;
+}
+
+/*
+  Perform the substitution for a single grob.   
+ */
+SCM
+substitute_grob (Grob *sc)
+{
+  if (SCM_INUMP (break_criterion))
+    {
+      Item * i = dynamic_cast<Item*> (sc);
+      Direction d = to_dir (break_criterion);
+      if (i && i->break_status_dir () != d)
+       {
+         Item *br = i->find_prebroken_piece (d);
+         return (br) ? br->self_scm () : SCM_UNDEFINED;
+       }
+    }
+  else
+    {
+      System * line
+       = dynamic_cast<System*> (unsmob_grob (break_criterion));
+      if (sc->line_l () != line)
+       {
+         sc = sc->find_broken_piece (line);
+
+       }
+         
+      /* now: !sc || (sc && sc->line_l () == line) */
+      if (!sc)
+       return SCM_UNDEFINED;
+
+      /* now: sc && sc->line_l () == line */
+      if (!line)
+       return sc->self_scm();
+
+
+      /*
+       This was introduced in 1.3.49 as a measure to prevent
+       programming errors. It looks rather expensive (?).
+
+       TODO:
+               
+       benchmark , document when (what kind of programming
+       errors) this happens.
+      */
+      if (sc->common_refpoint (line, X_AXIS)
+         && sc->common_refpoint (line, Y_AXIS))
+       {
+         return sc->self_scm ();
+       }
+      return SCM_UNDEFINED;
+    }
+
+  return sc->self_scm();
+}
+
+
+
+/*
+      Do break substitution in S, using CRITERION. Return new value.
+      CRITERION is either a SMOB pointer to the desired line, or a number
+      representing the break direction. Do not modify SRC.
+
+      It is rather tightly coded, since it takes a lot of time; it is
+      one of the top functions in the profile.
+
+      We don't pass break_criterion as a parameter, since it is
+      `constant', but takes up stack space.
+
+      It would be nice if we could do this in-place partially.  We now
+       generate a lot of garbage.
+ */
+
+SCM
+do_break_substitution (SCM src)
+{
+ again:
+  if (unsmob_grob (src))
+    {
+      return substitute_grob (unsmob_grob (src));
+    }
+  else if (ly_pair_p (src)) 
+    {
+      /*
+       UGH! breaks on circular lists.
+      */
+      SCM newcar = do_break_substitution (ly_car (src));
+      SCM oldcdr = ly_cdr (src);
+      
+      if (newcar == SCM_UNDEFINED
+         && (gh_pair_p (oldcdr) || oldcdr == SCM_EOL))
+       {
+         /*
+           This is tail-recursion, ie. 
+           
+           return do_break_substution (cdr);
+
+           We don't want to rely on the compiler to do this.  Without
+           tail-recursion, this easily crashes with a stack overflow.  */
+         src =  oldcdr;
+         goto again;
+       }
+
+      return scm_cons (newcar, do_break_substitution (oldcdr));
+    }
+  else
+    return src;
+
+  return src;
+}
+
+
+/*
+  Perform substitution on GROB_LIST using a constant amount of stack.
+ */
+SCM
+substitute_grob_list (SCM grob_list)
+{
+  SCM l = SCM_EOL;
+  SCM * tail = &l;
+
+  for (SCM s = grob_list; gh_pair_p (s); s =  gh_cdr (s))
+    {
+      SCM n= substitute_grob (unsmob_grob (gh_car (s)));
+
+      if (n != SCM_UNDEFINED)
+       {
+         *tail = gh_cons (n, SCM_EOL);
+         tail = SCM_CDRLOC(*tail);
+       }
+    }
+
+  return l;
+}
+
+
+SCM grob_list_p; 
+
+/*
+  Although the substitution can be written as
+
+  mutable_property_alist_ = do_substitution (mutable_property_alist_),
+
+  we have a special function here: we want to invoke a special
+  function for lists of grobs. These can be very long for large
+  orchestral scores (eg. 1M elements). do_break_substitution() can
+  recurse many levels, taking lots of stack space.
+
+  This becomes a problem if lily is linked against guile with
+  pthreads. pthreads impose small limits on the stack size.
+ */
+SCM
+substitute_mutable_properties (SCM alist)
+{
+  if (!grob_list_p)
+    grob_list_p = scm_c_eval_string ("grob-list?");
+
+  SCM l = SCM_EOL;
+  SCM *tail = &l;
+  for (SCM s = alist; gh_pair_p (s); s = gh_cdr (s))
+    {
+      SCM sym = gh_caar(s);
+      SCM val = gh_cdar(s);
+      SCM type = scm_object_property (sym, ly_symbol2scm ("backend-type?"));
+
+      if (type == grob_list_p)
+       val = substitute_grob_list (val);
+      else
+       val = do_break_substitution (val);
+
+      *tail = gh_cons (gh_cons (sym, val), SCM_EOL);
+      tail = SCM_CDRLOC (*tail);
+    }
+
+  return l;
+}
diff --git a/lily/grob-scheme.cc b/lily/grob-scheme.cc
new file mode 100644 (file)
index 0000000..8922399
--- /dev/null
@@ -0,0 +1,85 @@
+#include "grob.hh"
+#include "warn.hh"
+#include "spanner.hh"
+#include "item.hh"
+#include "paper-def.hh"
+
+LY_DEFINE(ly_set_grob_property,"ly-set-grob-property", 3, 0, 0,
+  (SCM grob, SCM sym, SCM val),
+  "Set @var{sym} in grob @var{grob} to value @var{val}")
+{
+  Grob * sc = unsmob_grob (grob);
+  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE(gh_symbol_p(sym), sym, SCM_ARG2, __FUNCTION__, "symbol");  
+
+  if (!type_check_assignment (sym, val, ly_symbol2scm ("backend-type?")))
+    error ("typecheck failed");
+      
+  sc->internal_set_grob_property (sym, val);
+  return SCM_UNSPECIFIED;
+}
+
+LY_DEFINE(ly_get_grob_property,
+         "ly-get-grob-property", 2, 0, 0, (SCM grob, SCM sym),
+         "  Get the value of a value in grob @var{g} of property @var{sym}. It
+will return @code{'()} (end-of-list) if @var{g} doesn't have @var{sym} set.
+")
+{
+  Grob * sc = unsmob_grob (grob);
+  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE(gh_symbol_p(sym), sym, SCM_ARG2, __FUNCTION__, "symbol");  
+
+  return sc->internal_get_grob_property (sym);
+}
+
+LY_DEFINE(spanner_get_bound, "ly-get-spanner-bound", 2 , 0, 0,
+         (SCM slur, SCM dir),
+         "Get one of the bounds of @var{spanner}. @var{dir} may be @code{-1} for
+left, and @code{1} for right.
+")
+{
+  Spanner * sl = dynamic_cast<Spanner*> (unsmob_grob (slur));
+  SCM_ASSERT_TYPE(sl, slur, SCM_ARG1, __FUNCTION__, "spanner grob");
+  SCM_ASSERT_TYPE(ly_dir_p (dir), slur, SCM_ARG2, __FUNCTION__, "dir");
+  return sl->get_bound (to_dir (dir))->self_scm ();
+}
+
+LY_DEFINE(ly_get_paper_var,"ly-get-paper-variable", 2, 0, 0,
+  (SCM grob, SCM sym),
+  "Get a variable from the \\paper block.")
+{
+  Grob * sc = unsmob_grob (grob);
+  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE(gh_symbol_p(sym), sym, SCM_ARG2, __FUNCTION__, "symbol");  
+
+  return sc->paper_l() ->get_scmvar_scm (sym);
+}
+
+
+
+LY_DEFINE(ly_get_extent, "ly-get-extent", 3, 0, 0,
+         (SCM grob, SCM refp, SCM axis),
+         "Get the extent in @var{axis} direction of @var{grob} relative to the
+grob @var{refp}")
+{
+  Grob * sc = unsmob_grob (grob);
+  Grob * ref = unsmob_grob (refp);
+  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE(ref, refp, SCM_ARG2, __FUNCTION__, "grob");
+  
+  SCM_ASSERT_TYPE(ly_axis_p(axis), axis, SCM_ARG3, __FUNCTION__, "axis");
+
+  return ly_interval2scm ( sc->extent (ref, Axis (gh_scm2int (axis))));
+}
+
+LY_DEFINE (ly_get_parent,   "ly-get-parent", 2, 0, 0, (SCM grob, SCM axis),
+          "Get the parent of @var{grob}.  @var{axis} can be 0 for the X-axis, 1
+for the Y-axis.")
+{
+  Grob * sc = unsmob_grob (grob);
+  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE(ly_axis_p(axis), axis, SCM_ARG2, __FUNCTION__, "axis");
+
+  return sc->get_parent (Axis (gh_scm2int (axis)))->self_scm();
+}
+
index 3121658c01ce40a268ca2e2a781c1d7fdb05cb10..992c4c9e340b7fa18909335f5f3a3fd4a54c3535 100644 (file)
@@ -212,7 +212,6 @@ Grob::molecule_extent (SCM element_smob, SCM scm_axis)
 }
 
 MAKE_SCHEME_CALLBACK (Grob,preset_extent,2);
-
 SCM
 Grob::preset_extent (SCM element_smob, SCM scm_axis)
 {
@@ -368,114 +367,6 @@ Grob::add_dependency (Grob*e)
 
 
 
-
-/**
-      Do break substitution in S, using CRITERION. Return new value.
-      CRITERION is either a SMOB pointer to the desired line, or a number
-      representing the break direction. Do not modify SRC.
-
-      It is rather tightly coded, since it takes a lot of time; it is
-      one of the top functions in the profile.
-
-      We don't pass break_criterion as a parameter, since it is
-      `constant', but takes up stack space.
-
-*/
-
-
-static SCM break_criterion; 
-void
-set_break_subsititution (SCM criterion)
-{
-  break_criterion = criterion;
-}
-
-
-/*
-  TODO: check wether we can do this in-place; now we generate a lot of
-  garbage.
- */
-SCM
-do_break_substitution (SCM src)
-{
- again:
-  if (Grob *sc = unsmob_grob (src))
-    {
-      if (SCM_INUMP (break_criterion))
-       {
-         Item * i = dynamic_cast<Item*> (sc);
-         Direction d = to_dir (break_criterion);
-         if (i && i->break_status_dir () != d)
-           {
-             Item *br = i->find_prebroken_piece (d);
-             return (br) ? br->self_scm () : SCM_UNDEFINED;
-           }
-       }
-      else
-       {
-         System * line
-           = dynamic_cast<System*> (unsmob_grob (break_criterion));
-         if (sc->line_l () != line)
-           {
-             sc = sc->find_broken_piece (line);
-
-           }
-
-         /* now: !sc || (sc && sc->line_l () == line) */
-         if (!sc)
-           return SCM_UNDEFINED;
-
-         /* now: sc && sc->line_l () == line */
-         if (!line)
-           return sc->self_scm();
-         /*
-           This was introduced in 1.3.49 as a measure to prevent
-           programming errors. It looks expensive (?).
-
-           TODO:
-               
-           benchmark , document when (what kind of programming
-           errors) this happens.
-         */
-         if (sc->common_refpoint (line, X_AXIS)
-              && sc->common_refpoint (line, Y_AXIS))
-           {
-             return sc->self_scm ();
-           }
-         return SCM_UNDEFINED;
-       }
-    }
-  else if (ly_pair_p (src)) 
-    {
-      /*
-       UGH! breaks on circular lists.
-      */
-      SCM newcar = do_break_substitution (ly_car (src));
-      SCM oldcdr = ly_cdr (src);
-      
-      if (newcar == SCM_UNDEFINED
-         && (gh_pair_p (oldcdr) || oldcdr == SCM_EOL))
-       {
-         /*
-           This is tail-recursion, ie. 
-           
-           return do_break_substution (cdr);
-
-           We don't want to rely on the compiler to do this.  Without
-           tail-recursion, this easily crashes with a stack overflow.  */
-         src =  oldcdr;
-         goto again;
-       }
-
-      return scm_cons (newcar, do_break_substitution (oldcdr));
-    }
-  else
-    return src;
-
-  return src;
-}
-
 void
 Grob::handle_broken_dependencies ()
 {
@@ -492,7 +383,7 @@ Grob::handle_broken_dependencies ()
 
          set_break_subsititution (l ? l->self_scm () : SCM_UNDEFINED);
          sc->mutable_property_alist_ =
-           do_break_substitution (mutable_property_alist_);
+           substitute_mutable_properties (mutable_property_alist_);
 
        }
     }
@@ -503,12 +394,12 @@ Grob::handle_broken_dependencies ()
   if (line && common_refpoint (line, X_AXIS) && common_refpoint (line, Y_AXIS))
     {
       set_break_subsititution (line ? line->self_scm () : SCM_UNDEFINED);
-      mutable_property_alist_ = do_break_substitution (mutable_property_alist_);
+      mutable_property_alist_ = substitute_mutable_properties (mutable_property_alist_);
     }
   else if (dynamic_cast <System*> (this))
     {
       set_break_subsititution (SCM_UNDEFINED);
-      mutable_property_alist_ = do_break_substitution (mutable_property_alist_);
+      mutable_property_alist_ = substitute_mutable_properties (mutable_property_alist_);
     }
   else
     {
@@ -516,9 +407,10 @@ Grob::handle_broken_dependencies ()
        This element is `invalid'; it has been removed from all
        dependencies, so let's junk the element itself.
 
-       do not do this for System, since that would remove
-       references to the originals of score-grobs, which get then GC'd
- (a bad thing.)
+       do not do this for System, since that would remove references
+       to the originals of score-grobs, which get then GC'd (a bad
+       thing.)
       */
       suicide ();
     }
@@ -870,7 +762,7 @@ Grob::mark_smob (SCM ses)
     {
       scm_gc_mark (s->dim_cache_[a].offset_callbacks_);
       scm_gc_mark (s->dim_cache_[a].dimension_);
-      Grob *p = s->get_parent (Y_AXIS);
+      Grob *p = s->get_parent (Axis (a));
       if (p)
        scm_gc_mark (p->self_scm ());
     }
@@ -902,34 +794,6 @@ Grob::do_derived_mark ()
   return SCM_EOL;
 }
 
-LY_DEFINE(ly_set_grob_property,"ly-set-grob-property", 3, 0, 0,
-(SCM grob, SCM sym, SCM val),
-"
-Set @var{sym} in grob @var{grob} to value @var{val}")
-{
-  Grob * sc = unsmob_grob (grob);
-  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
-  SCM_ASSERT_TYPE(gh_symbol_p(sym), sym, SCM_ARG2, __FUNCTION__, "symbol");  
-
-  if (!type_check_assignment (sym, val, ly_symbol2scm ("backend-type?")))
-    error ("typecheck failed");
-      
-  sc->internal_set_grob_property (sym, val);
-  return SCM_UNSPECIFIED;
-}
-
-LY_DEFINE(ly_get_grob_property,
-         "ly-get-grob-property", 2, 0, 0, (SCM grob, SCM sym),
-         "  Get the value of a value in grob @var{g} of property @var{sym}. It
-will return @code{'()} (end-of-list) if @var{g} doesn't have @var{sym} set.
-")
-{
-  Grob * sc = unsmob_grob (grob);
-  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
-  SCM_ASSERT_TYPE(gh_symbol_p(sym), sym, SCM_ARG2, __FUNCTION__, "symbol");  
-
-  return sc->internal_get_grob_property (sym);
-}
 
 
 void
@@ -937,59 +801,6 @@ Grob::discretionary_processing ()
 {
 }
 
-
-LY_DEFINE(spanner_get_bound, "ly-get-spanner-bound", 2 , 0, 0,
-         (SCM slur, SCM dir),
-         "Get one of the bounds of @var{spanner}. @var{dir} may be @code{-1} for
-left, and @code{1} for right.
-")
-{
-  Spanner * sl = dynamic_cast<Spanner*> (unsmob_grob (slur));
-  SCM_ASSERT_TYPE(sl, slur, SCM_ARG1, __FUNCTION__, "spanner grob");
-  SCM_ASSERT_TYPE(ly_dir_p (dir), slur, SCM_ARG2, __FUNCTION__, "dir");
-  return sl->get_bound (to_dir (dir))->self_scm ();
-}
-
-LY_DEFINE(ly_get_paper_var,"ly-get-paper-variable", 2, 0, 0,
-  (SCM grob, SCM sym),
-  "Get a variable from the \\paper block.")
-{
-  Grob * sc = unsmob_grob (grob);
-  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
-  SCM_ASSERT_TYPE(gh_symbol_p(sym), sym, SCM_ARG2, __FUNCTION__, "symbol");  
-
-  return sc->paper_l() ->get_scmvar_scm (sym);
-}
-
-
-
-LY_DEFINE(ly_get_extent, "ly-get-extent", 3, 0, 0,
-         (SCM grob, SCM refp, SCM axis),
-         "Get the extent in @var{axis} direction of @var{grob} relative to the
-grob @var{refp}")
-{
-  Grob * sc = unsmob_grob (grob);
-  Grob * ref = unsmob_grob (refp);
-  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
-  SCM_ASSERT_TYPE(ref, refp, SCM_ARG2, __FUNCTION__, "grob");
-  
-  SCM_ASSERT_TYPE(ly_axis_p(axis), axis, SCM_ARG3, __FUNCTION__, "axis");
-
-  return ly_interval2scm ( sc->extent (ref, Axis (gh_scm2int (axis))));
-}
-
-LY_DEFINE (ly_get_parent,   "ly-get-parent", 2, 0, 0, (SCM grob, SCM axis),
-          "Get the parent of @var{grob}.  @var{axis} can be 0 for the X-axis, 1
-for the Y-axis.")
-{
-  Grob * sc = unsmob_grob (grob);
-  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
-  SCM_ASSERT_TYPE(ly_axis_p(axis), axis, SCM_ARG2, __FUNCTION__, "axis");
-
-  return sc->get_parent (Axis (gh_scm2int (axis)))->self_scm();
-}
-
-
 bool
 Grob::internal_has_interface (SCM k)
 {
index 8e8cde5890d8b73d295224b45348b9524c57cd74..e8a501bc699bf02be8bf6068713964863ccf8495 100644 (file)
@@ -160,7 +160,8 @@ Grob*common_refpoint_of_list (SCM elt_list, Grob * , Axis a);
 Grob*common_refpoint_of_array (Link_array<Grob> const&, Grob * , Axis a);
 
 void set_break_subsititution (SCM criterion);
-SCM do_break_substitution (SCM);
+SCM substitute_mutable_properties (SCM alist);
+
 
 #endif // STAFFELEM_HH
 
index 0f964f2668688e7af45276fd3aeaea979530a5cf..a5d2bd6886716177c7b28048dda0d281edd37e40 100644 (file)
@@ -146,8 +146,7 @@ Item::handle_prebroken_dependencies ()
   if (original_l_)
     {
       set_break_subsititution (gh_int2scm (break_status_dir ()));
-      mutable_property_alist_ = do_break_substitution(original_l_->mutable_property_alist_);
-
+      mutable_property_alist_ = substitute_mutable_properties(original_l_->mutable_property_alist_);
     }
   
   /*
@@ -158,7 +157,6 @@ Item::handle_prebroken_dependencies ()
 
     handle break-visibility the item itself iso. breakstatusdir, so
     the function can do more complicated things.
-    
   */
   SCM vis = get_grob_property ("break-visibility");
   if (gh_procedure_p (vis))
index 113ce60982c89f6d885a8e57a1c269b385b11cad..982c33b2d10f3eb0220c70611d66ee524705e347 100644 (file)
@@ -461,7 +461,6 @@ Piano_pedal_engraver::typeset_all ()
       
       if (p->finished_bracket_p_)
        {
-         
          Grob * l = p->finished_bracket_p_->get_bound (LEFT);
          Grob * r = p->finished_bracket_p_->get_bound (RIGHT);      
          if (!r)
index 46cd931b025b003d6917c000ad816722491c6472..f9fe1f4edd8e316e1433b528e0f8d3f268c6652f 100644 (file)
@@ -359,7 +359,7 @@ System::pre_processing ()
     unsmob_grob (ly_car (s))->discretionary_processing ();
 
   if (verbose_global_b)
-    progress_indication (_f ("Element count %d ",  element_count ()));
+    progress_indication (_f ("Grob count %d ",  element_count ()));
 
   
   for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
index 56612415aa07bc294d8311d94f0967e3feef1b14..31113dc8663bd43f0bda71a1a6da58d20d63417a 100644 (file)
 (define (number-or-grob? x)
   (or (ly-grob? x) (number? x))
   )
-        
+
+(define (grob-list? x)
+  (list? x))
+
 (define (moment-pair?  x)
   (and (pair? x)
        (moment? (car x)) (moment? (cdr x))))
@@ -39,6 +42,7 @@
    (,number-pair? . "pair of numbers")
    (,ly-input-location? . "input location")   
    (,ly-grob? . "grob (GRaphical OBject)")
+   (,grob-list? . "list of grobs")
    (,duration? . "duration")
    (,pair? . "pair")
    (,integer? . "integer")
index c8e5d04f63a3c41832ca65b300bcbd0a1888ec05..1d8ef50b62d72e9cf43a260b19be0bd71ffe6dd9 100644 (file)
@@ -40,7 +40,7 @@ This procedure is called (using dependency resolution) after line breaking. Retu
 (grob-property-description 'align number? "the alignment of the text, 0 is horizontal, 1 is vertical.")
 (grob-property-description 'align-dir dir? "Which side to align? -1: left side, 0: around center of width, 1: right side.")
 (grob-property-description 'alignment-done boolean? "boolean to administrate whether we've done the alignment already (to ensure that the process is done only once).")
-(grob-property-description 'all-elements list? "list of all grobs in this line. Needed for protecting grobs from GC.")
+(grob-property-description 'all-elements grob-list? "list of all grobs in this line. Needed for protecting grobs from GC.")
 (grob-property-description 'arch-angle number? "turning angle of the hook of a system brace" )
 (grob-property-description 'arch-height number? "height of the hook of a system brace.")
 (grob-property-description 'arch-thick number? "thickness of the hook of system brace.")
@@ -60,7 +60,7 @@ attachments to prevent ugly slurs.  [fixme: we need more documentation here].
 (grob-property-description 'axes list? "list of axis numbers.
 In the case of alignment grobs, this should contain only one number.")
 (grob-property-description 'bar-size number? "size of a bar line.")
-(grob-property-description 'bars list? "list of barline pointers.")
+(grob-property-description 'bars grob-list? "list of barline pointers.")
 (grob-property-description 'bar-size-procedure procedure? "Procedure that computes the size of a bar line.")
 (grob-property-description 'base-shortest-duration moment?
                           "Spacing is based on the shortest notes in a piece. Normally, pieces are spaced as if notes at least as short as this are present.")
@@ -79,7 +79,7 @@ This procedure is called (using dependency resolution) before line breaking, but
 (grob-property-description 'between-cols pair? "Where to attach a loose column to")
 (grob-property-description 'between-system-string string? "string
  to dump between two systems. Useful for forcing pagebreaks.")
-(grob-property-description 'bounded-by-me list? "list of spanners that have this
+(grob-property-description 'bounded-by-me grob-list? "list of spanners that have this
 column as start/begin point. Only columns that have grobs or act as bounds are spaced.")
 (grob-property-description 'bracket-thick number? "width of a system start bracket. .")
 (grob-property-description 'break-align-symbol symbol? "the index in the spacing table (symbol) of the to be aligned item.")
@@ -101,7 +101,7 @@ noteheads, to the vertically nearest outer notehead, divided by the
 square of the inner notes involved.")
 (grob-property-description 'collapse-height number? "Minimum height of system start delimiter.  If equal or smaller, the bracket is removed.")
 
-(grob-property-description 'columns list? "list of grobs, typically containing paper-columns.")
+(grob-property-description 'columns grob-list? "list of grobs, typically containing paper-columns.")
 (grob-property-description 'control-points list? "List of 4 offsets (number-pairs) that form control points for the  tie/slur shape.")
 (grob-property-description 'damping integer? "amount of beam slope damping should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams .")
 (grob-property-description 'dash-length number? "the length of a dash.")
@@ -111,7 +111,7 @@ square of the inner notes involved.")
 
 (grob-property-description 'neutral-direction dir? "Where to go if we're on the neutral position of the staff (by default, the middle of the staff; see also grob-property neutral-position).  [Ross] has the following to say about this: Some engravers consider the middle line neutral, and take the option of using either up- or down-stems for notes that fall on it. However, more up-to-date engraving no longer permits an option; now a down-stem is always appropriate.")
 (grob-property-description 'neutral-position number? "Position (in half staff spaces) where to flip the direction of stems: by default, custodes above this position get their stems downwards; custodes below this position get their stems upwards.  A value of 0 designates the center of the staff.  Use property neutral-direction to control the behaviour of stems on the neutral position itself.  (Note: currently, neutral-position is supported only for custodes; for stems of note heads, neutral-position is currently fixed to 0, i.e. the middle of the staff.)")
-(grob-property-description 'dependencies list? "list of score-grob pointers that indicate who to compute first for certain global passes.")
+(grob-property-description 'dependencies grob-list? "list of score-grob pointers that indicate who to compute first for certain global passes.")
 (grob-property-description 'details list? "alist of parameters for detailed grob behavior.")
 (grob-property-description 'dir-forced boolean? "set if direction has been forced; read by Beam.")
 (grob-property-description 'dir-function procedure? "function of type (count total)->direction.  Default value: beam-dir-majority, also available: beam-dir-mean, beam-dir-median.
@@ -135,7 +135,7 @@ mean centre distance weighted per note
 (grob-property-description 'edge-height pair? "a cons that specifies the heights of the vertical edges '(LEFT-height . RIGHT-height).")
 (grob-property-description 'edge-widen pair? "a cons that specifies the widths of the slanted edges '(LEFT-width . RIGHT-width).")
 (grob-property-description 'edge-text pair? "a cons that specifies the texts to be set at the edges '(LEFT-text . RIGHT-text).")
-(grob-property-description 'elements list? "list of grobs, type depending on the Grob where this is set in.")
+(grob-property-description 'elements grob-list? "list of grobs, type depending on the Grob where this is set in.")
 (grob-property-description 'expand-limit integer? "maximum number of measures expanded in church rests.")
 (grob-property-description 'extra-extent-X number-pair? "enlarge in X dimension by this much, measured in staff space.")
 (grob-property-description 'extra-extent-Y number-pair? "see @code{extra-extent-Y}.")
@@ -190,7 +190,7 @@ is used by @ref{note-collision-interface}.")
 (grob-property-description 'ideal-distances list? "(OBJ . (DIST . STRENGTH)) pairs.")
 (grob-property-description 'interfaces list? "list of symbols indicating the interfaces supported by this object. Is initialized from the @code{meta} field.")
 (grob-property-description 'inversion list? " musical-pitch, optional.")
-(grob-property-description 'items-worth-living list? "list of interesting items. If empty in a particular system, clear that system.")
+(grob-property-description 'items-worth-living grob-list? "list of interesting items. If empty in a particular system, clear that system.")
 (grob-property-description 'kern number? "amount of extra white space to add.
 
 For text,  this is `relative'(?) to the current alignment.
@@ -262,8 +262,8 @@ FIXME: also pair? (cons LEFT RIGHT)
 (grob-property-description 'no-spacing-rods boolean? "read from grobs: boolean that makes Separation_item ignore this item (MOVE ME TO ITEM).")
 (grob-property-description 'no-stem-extend boolean? "should stem not be extended to middle staff line?.")
 (grob-property-description 'non-default boolean? "not set because of existence of a bar?.")
-(grob-property-description 'note-heads list? "List of note head grobs")
-(grob-property-description 'number-threshold number? "only put numbers bigger than this threshold over multi measuer rest.")
+(grob-property-description 'note-heads grob-list? "List of note head grobs")
+(grob-property-description 'number-threshold number? "only put numbers bigger than this threshold over multi measure rest.")
 (grob-property-description 'old-accidentals list? "list of (pitch, accidental) pairs.")
 (grob-property-description 'padding number? "add this much extra space between objects that are next to each other.")
 (grob-property-description 'pedal-type symbol? "Style of piano pedal: text, bracket or mixed.")
@@ -297,7 +297,7 @@ with this much space for the shortest duration. This is explessed in @code{spaci
 (grob-property-description 'shortest-playing-duration moment? "duration of the shortest playing in that column.")
 (grob-property-description 'shortest-starter-duration moment? "duration of the shortest notes that starts exactly in this column.")
 (grob-property-description 'side-relative-direction dir? "if set: get the direction from a different object, and multiply by this.")
-(grob-property-description 'side-support-elements list? "the support, a list of grobs.")
+(grob-property-description 'side-support-elements grob-list? "the support, a list of grobs.")
 (grob-property-description 'slope number? "some kind of slope")
 (grob-property-description 'slope-limit number? "set slope to zero if slope is running away steeper than this.")
 (grob-property-description 'solid boolean? "should porrectus be solidly filled?.")
@@ -326,7 +326,7 @@ terms of note head bounding box.")
 
 (grob-property-description 'stem-shorten list? "shorten stems in forced directions given flag multiplicity.")
 (grob-property-description 'stem-spacing-correction number? "optical correction amount.  [TODO: doco] ")
-(grob-property-description 'stems list? "list of stem objects, corresponding to the notes that the arpeggio has to be before.")
+(grob-property-description 'stems grob-list? "list of stem objects, corresponding to the notes that the arpeggio has to be before.")
 (grob-property-description 'style symbol? "a string determining what style of  glyph is typeset. Valid choices depend on the function that is reading this property. .")
 (grob-property-description 'support-head ly-grob? "the note head at
 one end of the stem.")
@@ -427,15 +427,15 @@ one of: line, dashed-line, trill or dotted-line.
 ;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;; INTERNAL
 
-(grob-property-description 'left-neighbors list? " List of
+(grob-property-description 'left-neighbors grob-list? " List of
 spacing-wish grobs that are close to the current column.
 
 The closest spacing-wishes determine the actual distances between the
 columns.
 ")
-(grob-property-description 'right-neighbors list? "see left-neighbors")
-(grob-property-description 'left-items list? "")
-(grob-property-description 'right-items list? "")
+(grob-property-description 'right-neighbors grob-list? "see left-neighbors")
+(grob-property-description 'left-items grob-list? "")
+(grob-property-description 'right-items grob-list? "")
 
 (grob-property-description 'cause scheme? "Any kind of causation objects (i.e. music, or perhaps translator) that was the cause for this grob.  ")
 (grob-property-description 'font font-metric? "Cached font metric object")
@@ -450,7 +450,7 @@ columns.
 
 (grob-property-description 'accidental-grob ly-grob? "Accidental for this note.")
 
-(grob-property-description 'causes list? "list of cause objects.")
+(grob-property-description 'causes grob-list? "list of cause objects.")
 (grob-property-description 'flag-count number? "")
 (grob-property-description 'chord-tremolo boolean? "if set, this beam is a tremolo. TODO: use interface for this!")
 (grob-property-description 'chord pair? "?")
index 7506323a653a25b222a997e058da32f777062f7e..e39e99f880c9aab03cd089c166e817819dc36518 100644 (file)
@@ -15,7 +15,6 @@
 
 
 
-
 ;(debug-enable 'backtrace)