CVSROOT:        /cvsroot/lilypond
Module name:    lilypond
Branch:         
Changes by:     Han-Wen Nienhuys <[EMAIL PROTECTED]>    05/07/23 12:22:00

Modified files:
        .              : ChangeLog 
        lily           : auto-beam-engraver.cc context.cc 
                         engraver-group-engraver.cc 
                         font-size-engraver.cc grob-property.cc 
                         measure-grouping-engraver.cc 
                         translator-dispatch-list.cc tuplet-engraver.cc 

Log message:
        * lily/tuplet-engraver.cc (start_translation_timestep): only read
        tupletSpannerDuration if applicable.
        
        * lily/font-size-engraver.cc (process_music): read fontSize only
        once per timestep.
        
        * lily/engraver-group-engraver.cc (Engraver_group_engraver):
        change acknowledgeHashTable to C++ member.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3915&tr2=1.3916&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/auto-beam-engraver.cc.diff?tr1=1.148&tr2=1.149&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/context.cc.diff?tr1=1.60&tr2=1.61&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/engraver-group-engraver.cc.diff?tr1=1.60&tr2=1.61&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/font-size-engraver.cc.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/grob-property.cc.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/measure-grouping-engraver.cc.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/translator-dispatch-list.cc.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/tuplet-engraver.cc.diff?tr1=1.76&tr2=1.77&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3915 lilypond/ChangeLog:1.3916
--- lilypond/ChangeLog:1.3915   Sat Jul 23 01:24:27 2005
+++ lilypond/ChangeLog  Sat Jul 23 12:22:00 2005
@@ -1,5 +1,11 @@
 2005-07-23  Han-Wen Nienhuys  <[EMAIL PROTECTED]>
 
+       * lily/tuplet-engraver.cc (start_translation_timestep): only read
+       tupletSpannerDuration if applicable.
+
+       * lily/font-size-engraver.cc (process_music): read fontSize only
+       once per timestep.
+
        * lily/engraver*cc: use throughout.
        
        * lily/include/translator.icc (ADD_ACKNOWLEDGER): new macro.
Index: lilypond/lily/auto-beam-engraver.cc
diff -u lilypond/lily/auto-beam-engraver.cc:1.148 
lilypond/lily/auto-beam-engraver.cc:1.149
--- lilypond/lily/auto-beam-engraver.cc:1.148   Sat Jul 23 01:24:27 2005
+++ lilypond/lily/auto-beam-engraver.cc Sat Jul 23 12:22:00 2005
@@ -114,7 +114,7 @@
 Auto_beam_engraver::Auto_beam_engraver ()
 {
   forbid_ = 0;
-process_acknowledged_count_ = 0;
+  process_acknowledged_count_ = 0;
   stems_ = 0;
   shortest_mom_ = Moment (Rational (1, 8));
   finished_beam_ = 0;
Index: lilypond/lily/context.cc
diff -u lilypond/lily/context.cc:1.60 lilypond/lily/context.cc:1.61
--- lilypond/lily/context.cc:1.60       Tue Jul 19 15:03:22 2005
+++ lilypond/lily/context.cc    Sat Jul 23 12:22:00 2005
@@ -339,12 +339,29 @@
   return (daddy_context_) ? daddy_context_->where_defined (sym) : 0;
 }
 
+//#define PROFILE_PROPERTY_ACCESSES
+
+SCM context_property_lookup_table;
+LY_DEFINE(ly_context_property_lookup_stats, "ly:context-property-lookup-stats",
+         0,0,0, (),
+         "")
+{
+  return context_property_lookup_table ?  context_property_lookup_table
+    : scm_c_make_hash_table (1);
+}
+
+
 /*
   return SCM_EOL when not found.
 */
 SCM
 Context::internal_get_property (SCM sym) const
 {
+#ifdef PROFILE_PROPERTY_ACCESSES
+  extern void note_property_access (SCM *table, SCM sym);
+  note_property_access (&context_property_lookup_table, sym);
+#endif
+  
   SCM val = SCM_EOL;
   if (properties_dict ()->try_retrieve (sym, &val))
     return val;
Index: lilypond/lily/engraver-group-engraver.cc
diff -u lilypond/lily/engraver-group-engraver.cc:1.60 
lilypond/lily/engraver-group-engraver.cc:1.61
--- lilypond/lily/engraver-group-engraver.cc:1.60       Sat Jul 23 01:24:27 2005
+++ lilypond/lily/engraver-group-engraver.cc    Sat Jul 23 12:22:00 2005
@@ -27,9 +27,6 @@
     dad_eng->announce_grob (info);
 }
 
-SCM find_acknowledge_engravers (SCM gravlist, SCM meta);
-SCM find_accept_engravers (SCM gravlist, SCM music_descr);
-
 void
 Engraver_group_engraver::acknowledge_grobs ()
 {
@@ -48,20 +45,9 @@
       if (scm_is_pair (nm))
        nm = scm_cdr (nm);
       else
-       {
-         /*
-           it's tempting to put an assert for
-           immutable_property_alist_ == '(), but in fact, some
-           engravers (clef-engraver) add some more information to the
-           immutable_property_alist_ (after it has been '()-ed).
-
-           We ignore the grob anyway. He who has no name, shall not
-           be helped.  */
-
-         continue;
-       }
+       continue;
 
-      SCM acklist = scm_hashq_ref (acknowledge_hash_table_, nm, SCM_UNDEFINED);
+      SCM acklist = scm_hashq_ref (acknowledge_hash_table_, nm, SCM_BOOL_F);
       Engraver_dispatch_list *dispatch
        = Engraver_dispatch_list::unsmob (acklist);
 
@@ -70,13 +56,12 @@
          SCM ifaces
            = scm_cdr (scm_assoc (ly_symbol2scm ("interfaces"), meta));
          acklist = Engraver_dispatch_list::create (get_simple_trans_list (),
-                                                     ifaces);
+                                                   ifaces);
 
          dispatch
            = Engraver_dispatch_list::unsmob (acklist);
 
-         if (dispatch)
-           scm_hashq_set_x (acknowledge_hash_table_, nm, acklist);
+         scm_hashq_set_x (acknowledge_hash_table_, nm, acklist);
        }
 
 
@@ -84,25 +69,9 @@
        {
          dispatch->apply (info);
        }
-      else
-       {
-         if (acklist == SCM_BOOL_F)
-           {
-             acklist = find_acknowledge_engravers (get_simple_trans_list (),
-                                                   meta);
-             scm_hashq_set_x (acknowledge_hash_table_, nm, acklist);
-           }
-
-         for (SCM p = acklist; scm_is_pair (p); p = scm_cdr (p))
-           {
-             Translator *t = unsmob_translator (scm_car (p));
-             Engraver *eng = dynamic_cast<Engraver *> (t);
-             if (eng && eng != info.origin_translator ())
-               eng->acknowledge_grob (info);
-           }
-       }
     }
 }
+
 /*
   Ugh. This is slightly expensive. We could/should cache the value of
   the group count?
@@ -170,32 +139,6 @@
                      /* write */ "");
 
 
-bool
-engraver_valid (Translator *tr, SCM ifaces)
-{
-  SCM ack_ifs = scm_assoc (ly_symbol2scm ("interfaces-acked"),
-                          tr->translator_description ());
-  ack_ifs = scm_cdr (ack_ifs);
-  for (SCM s = ifaces; scm_is_pair (s); s = scm_cdr (s))
-    if (scm_c_memq (scm_car (s), ack_ifs) != SCM_BOOL_F)
-      return true;
-  return false;
-}
-
-SCM
-find_acknowledge_engravers (SCM gravlist, SCM ifaces)
-{
-  SCM l = SCM_EOL;
-  for (SCM s = gravlist; scm_is_pair (s); s = scm_cdr (s))
-    {
-      Translator *tr = unsmob_translator (scm_car (s));
-      if (engraver_valid (tr, ifaces))
-       l = scm_cons (tr->self_scm (), l);
-    }
-  l = scm_reverse_x (l, SCM_EOL);
-
-  return l;
-}
 
 void
 Engraver_group_engraver::derived_mark () const
Index: lilypond/lily/font-size-engraver.cc
diff -u lilypond/lily/font-size-engraver.cc:1.44 
lilypond/lily/font-size-engraver.cc:1.45
--- lilypond/lily/font-size-engraver.cc:1.44    Sat Jul 23 01:24:27 2005
+++ lilypond/lily/font-size-engraver.cc Sat Jul 23 12:22:00 2005
@@ -15,29 +15,36 @@
   TRANSLATOR_DECLARATIONS (Font_size_engraver);
 protected:
   DECLARE_ACKNOWLEDGER(font);
+  virtual void process_music ();
+  Real size;
 private:
 };
 
 Font_size_engraver::Font_size_engraver ()
 {
+  size = 0.0;
 }
 
+
 void
-Font_size_engraver::acknowledge_font (Grob_info gi)
+Font_size_engraver::process_music ()
 {
-  SCM sz = get_property ("fontSize");
+  size = robust_scm2double  (get_property ("fontSize"), 0.0);
+}
 
+void
+Font_size_engraver::acknowledge_font (Grob_info gi)
+{
   /*
     We only want to process a grob once.
   */
   if (gi.context () != context ())
     return;
 
-  if (scm_is_number (sz) && scm_to_double (sz))
+  if (size)
     {
-      Real font_size = scm_to_double (sz);
-
-      font_size += robust_scm2double (gi.grob ()->get_property ("font-size"), 
0);
+      Real font_size = size
+       + robust_scm2double (gi.grob ()->get_property ("font-size"), 0);
       gi.grob ()->set_property ("font-size", scm_make_real (font_size));
     }
 }
Index: lilypond/lily/grob-property.cc
diff -u lilypond/lily/grob-property.cc:1.27 lilypond/lily/grob-property.cc:1.28
--- lilypond/lily/grob-property.cc:1.27 Wed Jul 20 14:23:41 2005
+++ lilypond/lily/grob-property.cc      Sat Jul 23 12:22:00 2005
@@ -93,49 +93,43 @@
   mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, sym, v);
 }
 
-#ifdef DEBUG_PROFILE_ACCESSES
-Protected_scm property_lookup_table;
-LY_DEFINE(ly_property_lookup_stats, "ly:property-lookup-stats",
+//#define PROFILE_PROPERTY_ACCESSES
+
+SCM grob_property_lookup_table;
+LY_DEFINE(ly_property_lookup_stats, "ly:grob-property-lookup-stats",
          0,0,0, (),
          "")
 {
-  return (SCM) property_lookup_table;
+  return grob_property_lookup_table ?  grob_property_lookup_table :
+    scm_c_make_hash_table (1);
 }
-#endif
 
-SCM
-Grob::internal_get_property (SCM sym) const
+void
+note_property_access (SCM *table, SCM sym)
 {
-#ifndef NDEBUG
-  SCM grob_p = ly_lily_module_constant ("ly:grob?");
-  SCM grob_list_p = ly_lily_module_constant ("grob-list?");
-  SCM type = scm_object_property (sym, ly_symbol2scm ("backend-type?"));
-  
-  if (type == grob_p
-      || type == grob_list_p)
-    {
-      scm_display (scm_list_2 (sym, type), scm_current_output_port());
-      assert (0);
-    }
-#endif
-
-#ifdef DEBUG_PROFILE_ACCESSES
   /*
     Statistics: which properties are looked up? 
   */
-  if (scm_hash_table_p (property_lookup_table) != SCM_BOOL_T)
-    {
-      property_lookup_table = scm_c_make_hash_table (259);
-    }
-
-  SCM hashhandle = scm_hashq_get_handle (property_lookup_table, sym);
+  if (!*table)
+    *table = scm_permanent_object (scm_c_make_hash_table (259));
+  
+  SCM hashhandle = scm_hashq_get_handle (*table, sym);
   if (hashhandle == SCM_BOOL_F)
     {
-      scm_hashq_set_x (property_lookup_table, sym, scm_from_int (0));
-      hashhandle = scm_hashq_get_handle (property_lookup_table, sym);
+      scm_hashq_set_x (*table, sym, scm_from_int (0));
+      hashhandle = scm_hashq_get_handle (*table, sym);
     }
 
-  scm_set_cdr_x (hashhandle, scm_from_int (scm_to_int (scm_cdr (hashhandle)) + 
1));
+  int count = scm_to_int (scm_cdr (hashhandle)) + 1;  
+  scm_set_cdr_x (hashhandle, scm_from_int (count));
+}
+
+
+SCM
+Grob::internal_get_property (SCM sym) const
+{
+#ifdef PROFILE_PROPERTY_ACCESSES
+  note_property_access (&grob_property_lookup_table, sym);
 #endif
   
   SCM s = scm_sloppy_assq (sym, mutable_property_alist_);
@@ -171,6 +165,10 @@
 SCM
 Grob::internal_get_object (SCM sym) const
 {
+#ifdef PROFILE_PROPERTY_ACCESSES
+  note_property_access (&grob_property_lookup_table, sym);
+#endif
+
   SCM s = scm_sloppy_assq (sym, object_alist_);
 
   return (s == SCM_BOOL_F) ? SCM_EOL : scm_cdr (s);
Index: lilypond/lily/measure-grouping-engraver.cc
diff -u lilypond/lily/measure-grouping-engraver.cc:1.30 
lilypond/lily/measure-grouping-engraver.cc:1.31
--- lilypond/lily/measure-grouping-engraver.cc:1.30     Sat Jul 23 01:24:27 2005
+++ lilypond/lily/measure-grouping-engraver.cc  Sat Jul 23 12:22:00 2005
@@ -101,6 +101,7 @@
        }
     }
 }
+
 Measure_grouping_engraver::Measure_grouping_engraver ()
 {
   grouping_ = 0;
Index: lilypond/lily/translator-dispatch-list.cc
diff -u lilypond/lily/translator-dispatch-list.cc:1.1 
lilypond/lily/translator-dispatch-list.cc:1.2
--- lilypond/lily/translator-dispatch-list.cc:1.1       Sat Jul 23 01:24:27 2005
+++ lilypond/lily/translator-dispatch-list.cc   Sat Jul 23 12:22:00 2005
@@ -60,7 +60,7 @@
     }
 
   
-  return found ? retval : SCM_BOOL_F;
+  return found ? retval : SCM_EOL;
 }
 
 SCM
Index: lilypond/lily/tuplet-engraver.cc
diff -u lilypond/lily/tuplet-engraver.cc:1.76 
lilypond/lily/tuplet-engraver.cc:1.77
--- lilypond/lily/tuplet-engraver.cc:1.76       Sat Jul 23 11:00:00 2005
+++ lilypond/lily/tuplet-engraver.cc    Sat Jul 23 12:22:00 2005
@@ -100,13 +100,12 @@
 {
   Moment now = now_mom ();
 
-  Moment tsd;
-  SCM s = get_property ("tupletSpannerDuration");
-  if (unsmob_moment (s))
-    tsd = unsmob_moment (s)->main_part_;
-
   for (int i = tuplets_.size (); i--;)
     {
+      Moment tsdmom = robust_scm2moment (get_property 
("tupletSpannerDuration"), Moment (0));
+
+      Rational tsd = tsdmom.main_part_;
+
       if (now.main_part_ >= tuplets_[i].span_stop_)
        {
          if (Spanner *sp = tuplets_[i].spanner_)
@@ -117,8 +116,8 @@
              tuplets_[i].spanner_ = 0;
            }
 
-         if (tsd.to_bool ())
-           tuplets_[i].span_stop_ += tsd.main_part_;
+         if (tsd)
+           tuplets_[i].span_stop_ += tsd;
        }
 
       if (now.main_part_ >= tuplets_[i].stop_)


_______________________________________________
Lilypond-cvs mailing list
Lilypond-cvs@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to