]> git.donarmstrong.com Git - lilypond.git/commitdiff
''
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 22 Jun 2002 02:02:21 +0000 (02:02 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 22 Jun 2002 02:02:21 +0000 (02:02 +0000)
ChangeLog
DEDICATION
lily/grob.cc
lily/include/grob.hh
lily/item.cc
ly/engraver-init.ly

index 153161ec49a834ba0968187e68778cc28f43fa43..06b993dc6e5fe261523a050f8aaa47009ef71558 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2002-06-21  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+2002-06-22  Han-Wen  <hanwen@cs.uu.nl>
+
+       * lily/grob.cc (do_break_substitution): rename function, use
+       global var for criterion argument. Reduces stack usage a little.
+
+       * ly/engraver-init.ly (StaffContext): add Instrument_engraver
 
        * scripts/convert-ly.py, lily/*.cc, scm/*.scm: change
        visibility-lambda to break-visibility
index ad8fcd5309a8e7f1ec2f5e2741eb97545c140445..5a4b29022f6bfc0b2fac3fb21abe005d2171a7ae 100644 (file)
@@ -5,10 +5,10 @@
                         met through music. 
 
 
-       Those deserving special mentioning (in no particular order): Esther,
-Marijke, Heike, Inge, Judith, Hannah, Auke, Ilse, Evelyn, Maartje, Suzanne,
-Ilse (gee, again?), Marieke, Irene, Martine, Idwine and last (but certainly not
-least) Janneke!
+       Those deserving special mentioning (in no particular order):
+Esther, Marijke, Heike, Inge, Judith, Hannah, Auke, Ilse, Evelyn,
+Maartje, Suzanne, Ilse (gee, again?), Marieke, Irene, Martine, Idwine,
+Hanna and last (but certainly not least) Janneke!
 
        HWN
 
index 08d263bcf6d30f966a10194dff7419c95ac176d7..d8e4dbf438c84282070dd94b1d428a39d068554c 100644 (file)
@@ -377,18 +377,30 @@ Grob::add_dependency (Grob*e)
       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;
+}
+
 SCM
-Grob::handle_broken_grobs (SCM src, SCM criterion)
+do_break_substitution (SCM src)
 {
  again:
   Grob *sc = unsmob_grob (src);
   if (sc)
     {
-      if (SCM_INUMP (criterion))
+      if (SCM_INUMP (break_criterion))
        {
          Item * i = dynamic_cast<Item*> (sc);
-         Direction d = to_dir (criterion);
+         Direction d = to_dir (break_criterion);
          if (i && i->break_status_dir () != d)
            {
              Item *br = i->find_prebroken_piece (d);
@@ -398,7 +410,7 @@ Grob::handle_broken_grobs (SCM src, SCM criterion)
       else
        {
          System * line
-           = dynamic_cast<System*> (unsmob_grob (criterion));
+           = dynamic_cast<System*> (unsmob_grob (break_criterion));
          if (sc->line_l () != line)
            {
              sc = sc->find_broken_piece (line);
@@ -435,7 +447,7 @@ Grob::handle_broken_grobs (SCM src, SCM criterion)
       /*
        UGH! breaks on circular lists.
       */
-      SCM newcar = handle_broken_grobs (oldcar, criterion);
+      SCM newcar = do_break_substitution (oldcar);
       SCM oldcdr = ly_cdr (src);
       
       if (newcar == SCM_UNDEFINED
@@ -444,7 +456,7 @@ Grob::handle_broken_grobs (SCM src, SCM criterion)
          /*
            This is tail-recursion, ie. 
            
-           return handle_broken_grobs (cdr, criterion);
+           return do_break_substution (cdr, break_criterion);
 
            We don't want to rely on the compiler to do this.  Without
            tail-recursion, this easily crashes with a stack overflow.  */
@@ -452,7 +464,7 @@ Grob::handle_broken_grobs (SCM src, SCM criterion)
          goto again;
        }
 
-      SCM newcdr = handle_broken_grobs (oldcdr, criterion);
+      SCM newcdr = do_break_substitution (oldcdr);
       return scm_cons (newcar, newcdr);
     }
   else
@@ -474,9 +486,11 @@ Grob::handle_broken_dependencies ()
        {
          Grob * sc = s->broken_into_l_arr_[i];
          System * l = sc->line_l ();
+
+         set_break_subsititution (l ? l->self_scm () : SCM_UNDEFINED);
          sc->mutable_property_alist_ =
-           handle_broken_grobs (mutable_property_alist_,
-                                l ? l->self_scm () : SCM_UNDEFINED);
+           do_break_substitution (mutable_property_alist_);
+
        }
     }
 
@@ -485,14 +499,13 @@ Grob::handle_broken_dependencies ()
 
   if (line && common_refpoint (line, X_AXIS) && common_refpoint (line, Y_AXIS))
     {
-      mutable_property_alist_
-       = handle_broken_grobs (mutable_property_alist_,
-                              line ? line->self_scm () : SCM_UNDEFINED);
+      set_break_subsititution (line ? line->self_scm () : SCM_UNDEFINED);
+      mutable_property_alist_ = do_break_substitution (mutable_property_alist_);
     }
   else if (dynamic_cast <System*> (this))
     {
-      mutable_property_alist_ = handle_broken_grobs (mutable_property_alist_,
-                                           SCM_UNDEFINED);
+      set_break_subsititution (SCM_UNDEFINED);
+      mutable_property_alist_ = do_break_substitution (mutable_property_alist_);
     }
   else
     {
@@ -540,6 +553,9 @@ Grob::find_broken_piece (System*) const
   return 0;
 }
 
+/*
+  translate in one direction
+*/
 void
 Grob::translate_axis (Real y, Axis a)
 {
@@ -551,6 +567,13 @@ Grob::translate_axis (Real y, Axis a)
     }
 }  
 
+
+/*
+  Find the offset relative to D.  If   D equals THIS, then it is 0.
+  Otherwise, it recursively defd as
+  
+  OFFSET_ + PARENT_L_->relative_coordinate (D)
+*/
 Real
 Grob::relative_coordinate (Grob const*refp, Axis a) const
 {
@@ -568,6 +591,11 @@ Grob::relative_coordinate (Grob const*refp, Axis a) const
     return get_offset (a) + dim_cache_[a].parent_l_->relative_coordinate (refp, a);
 }
 
+
+  
+/*
+  Invoke callbacks to get offset relative to parent.
+*/
 Real
 Grob::get_offset (Axis a) const
 {
@@ -656,6 +684,9 @@ Grob::extent (Grob * refp, Axis a) const
   return ext;
 }
 
+/*
+  Find the group-element which has both #this# and #s#
+*/
 Grob * 
 Grob::common_refpoint (Grob const* s, Axis a) const
 {
index 792cdf8f9e36375db413d0431e91bc1ef02bc7a6..8e8cde5890d8b73d295224b45348b9524c57cd74 100644 (file)
@@ -101,7 +101,7 @@ public:
      #funcptr# is the function to call to update this element.
    */
   void calculate_dependencies (int final, int busy, SCM funcname);
-  static SCM handle_broken_grobs(SCM, SCM criterion);
+
 
   virtual void do_break_processing ();
   virtual Grob *find_broken_piece (System*) const;
@@ -117,7 +117,6 @@ public:
   DECLARE_SCHEME_CALLBACK (point_dimension_callback, (SCM smob, SCM axis));
   DECLARE_SCHEME_CALLBACK (molecule_extent, (SCM smob, SCM axis));
 
-
   static SCM ly_set_grob_property (SCM, SCM,SCM);
   static SCM ly_get_grob_property (SCM, SCM);  
 
@@ -127,34 +126,16 @@ public:
   virtual void handle_broken_dependencies ();
   virtual void handle_prebroken_dependencies ();
 
-
   DECLARE_SMOBS (Grob,foo);
 
   void init ();
-
-
 public:
-  
   bool empty_b (Axis a) const;
 
   Interval extent (Grob * refpoint, Axis) const;
  
-  /**
-    translate in one direction
-    */
-    
   void translate_axis (Real, Axis);
-
-  /**
-     Find the offset relative to D.  If   D equals THIS, then it is 0.
-     Otherwise, it recursively defd as
-
-     OFFSET_ + PARENT_L_->relative_coordinate (D)
-   */
   Real relative_coordinate (Grob const* refp, Axis) const;
-  /**
-    Find the group-element which has both #this# and #s#
-   */
   Grob*common_refpoint (Grob const* s, Axis a) const;
 
 
@@ -163,15 +144,8 @@ public:
   void add_offset_callback (SCM callback, Axis);
   bool has_extent_callback_b (SCM, Axis)const;  
   void set_extent (SCM , Axis);
-
-  
-  /**
-    Invoke callbacks to get offset relative to parent.
-   */
   Real get_offset (Axis a) const;
-  /**
-     Set the  parent refpoint of THIS to E
-   */
+  
   void set_parent (Grob* e, Axis);
   
   Grob *get_parent (Axis a) const {   return  dim_cache_[a].parent_l_; }
@@ -185,5 +159,8 @@ Item* unsmob_item (SCM );
 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);
+
 #endif // STAFFELEM_HH
 
index 594c97517c8c9b40c796c9cc5a6df9e4d68ab132..0f964f2668688e7af45276fd3aeaea979530a5cf 100644 (file)
@@ -145,9 +145,9 @@ Item::handle_prebroken_dependencies ()
 {
   if (original_l_)
     {
-      mutable_property_alist_
-       = handle_broken_grobs(original_l_->mutable_property_alist_,
-                              gh_int2scm (break_status_dir ()));
+      set_break_subsititution (gh_int2scm (break_status_dir ()));
+      mutable_property_alist_ = do_break_substitution(original_l_->mutable_property_alist_);
+
     }
   
   /*
index 003d0cc5c15b263abb0c3b9c169ce82644505432..313fb1623792d33d5513f31c0418c568f33f1918 100644 (file)
@@ -113,6 +113,7 @@ RhythmicStaffContext=\translator{
        \consists "Bar_engraver"
        \consists "Time_signature_engraver"
        \consists "Staff_symbol_engraver"
+       \consists "Instrument_name_engraver"
        \consistsend "Axis_group_engraver"
        \accepts "Voice"
 }
@@ -446,16 +447,17 @@ FiguredBassContext = \translator {
        \consistsend "Axis_group_engraver"
 }
 
+
 TabVoiceContext =   \translator {
       \VoiceContext
       \name "TabVoice"
       \denies "Thread"
       \consists "Tab_note_heads_engraver"
-      
+
       % Draws all stems/beams out of the staff (and not in the middle of the staff !)
       Beam \override #'damping = #100000
       Stem \override #'up-to-staff = ##t
-      
+
       % No accidental in tablature !
       \remove Accidental_engraver
       Accidental  = \turnOff