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

Modified files:
        .              : ChangeLog VERSION 
        lily           : engraver-group-engraver.cc rest-collision.cc 
                         translator-group.cc translator.cc 
                         type-swallow-translator.cc 
        lily/include   : engraver-group-engraver.hh translator-group.hh 
                         translator.hh translator.icc 
        scm            : define-context-properties.scm page-layout.scm 

Log message:
        * scm/define-context-properties.scm
        (all-internal-translation-properties): remove acceptHashTable,
        acknowledgeHashTable
        
        * lily/translator-group.cc (mark_smob): idem for acceptHashTable.
        
        * lily/engraver-group-engraver.cc (Engraver_group_engraver):
        change acknowledgeHashTable to C++ member.
        
        * lily/rest-collision.cc (do_shift): use extract_grob_set().

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3913&tr2=1.3914&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/VERSION.diff?tr1=1.648&tr2=1.649&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/engraver-group-engraver.cc.diff?tr1=1.58&tr2=1.59&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/rest-collision.cc.diff?tr1=1.115&tr2=1.116&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/translator-group.cc.diff?tr1=1.144&tr2=1.145&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/translator.cc.diff?tr1=1.87&tr2=1.88&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/type-swallow-translator.cc.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/engraver-group-engraver.hh.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/translator-group.hh.diff?tr1=1.71&tr2=1.72&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/translator.hh.diff?tr1=1.87&tr2=1.88&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/translator.icc.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-context-properties.scm.diff?tr1=1.46&tr2=1.47&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/page-layout.scm.diff?tr1=1.78&tr2=1.79&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3913 lilypond/ChangeLog:1.3914
--- lilypond/ChangeLog:1.3913   Fri Jul 22 18:28:35 2005
+++ lilypond/ChangeLog  Fri Jul 22 22:52:25 2005
@@ -1,3 +1,16 @@
+2005-07-23  Han-Wen Nienhuys  <[EMAIL PROTECTED]>
+
+       * scm/define-context-properties.scm
+       (all-internal-translation-properties): remove acceptHashTable,
+       acknowledgeHashTable
+
+       * lily/translator-group.cc (mark_smob): idem for acceptHashTable.
+
+       * lily/engraver-group-engraver.cc (Engraver_group_engraver):
+       change acknowledgeHashTable to C++ member. 
+
+       * lily/rest-collision.cc (do_shift): use extract_grob_set().
+
 2005-07-22  Nicolas Sceaux  <[EMAIL PROTECTED]>
 
        * scm/display-lily.scm: new file. Define a `display-lily-music'
@@ -40,7 +53,8 @@
 
        * Documentation/topdocs/NEWS.tely (Top): mention barNumberCheck
 
-       * Documentation/user/basic-notation.itely (Barnumber check): add 
section.
+       * Documentation/user/basic-notation.itely (Barnumber check): add
+       section.
 
        * scm/music-functions.scm (skip-to-last): new function. Show only
        last showLastLength part of the \score.
@@ -76,15 +90,18 @@
        * Documentation/user/instrument-notation.itely (Musica ficta
        accidentals): add section Musica ficta accidentals
 
-       * lily/accidental-engraver.cc (make_suggested_accidental): new function.
+       * lily/accidental-engraver.cc (make_suggested_accidental): new
+       function.
        (make_standard_accidental): move into new function.
        (create_accidental): new function.
 
-       * scm/define-grobs.scm (all-grob-descriptions): new Grob 
AccidentalSuggestion
+       * scm/define-grobs.scm (all-grob-descriptions): new Grob
+       AccidentalSuggestion
 
        * lily/output-def-scheme.cc (LY_DEFINE): take default  argument.
 
-       * lily/output-def.cc (lookup_variable): return SCM_UNDEFINED if 
undefined.
+       * lily/output-def.cc (lookup_variable): return SCM_UNDEFINED if
+       undefined.
 
        * Documentation/user/global.itely (Page formatting): document
        horizontalshift.
Index: lilypond/VERSION
diff -u lilypond/VERSION:1.648 lilypond/VERSION:1.649
--- lilypond/VERSION:1.648      Thu Jul 21 01:11:50 2005
+++ lilypond/VERSION    Fri Jul 22 22:52:25 2005
@@ -1,6 +1,6 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=7
-PATCH_LEVEL=2
+PATCH_LEVEL=3
 MY_PATCH_LEVEL=
 
Index: lilypond/lily/engraver-group-engraver.cc
diff -u lilypond/lily/engraver-group-engraver.cc:1.58 
lilypond/lily/engraver-group-engraver.cc:1.59
--- lilypond/lily/engraver-group-engraver.cc:1.58       Mon Jul 18 23:37:24 2005
+++ lilypond/lily/engraver-group-engraver.cc    Fri Jul 22 22:52:25 2005
@@ -36,7 +36,6 @@
   if (!announce_infos_.size ())
     return;
 
-  SCM tab = context_->get_property ("acknowledgeHashTable");
   SCM name_sym = ly_symbol2scm ("name");
   SCM meta_sym = ly_symbol2scm ("meta");
 
@@ -62,11 +61,11 @@
          continue;
        }
 
-      SCM acklist = scm_hashq_ref (tab, nm, SCM_UNDEFINED);
+      SCM acklist = scm_hashq_ref (acknowledge_hash_table_, nm, SCM_UNDEFINED);
       if (acklist == SCM_BOOL_F)
        {
          acklist = find_acknowledge_engravers (get_simple_trans_list (), meta);
-         scm_hashq_set_x (tab, nm, acklist);
+         scm_hashq_set_x (acknowledge_hash_table_, nm, acklist);
        }
 
       for (SCM p = acklist; scm_is_pair (p); p = scm_cdr (p))
@@ -128,17 +127,11 @@
   while (pending_grob_count () > 0);
 }
 
-void
-Engraver_group_engraver::initialize ()
-{
-  SCM tab = scm_make_vector (scm_int2num (61), SCM_BOOL_F);
-  context ()->set_property ("acknowledgeHashTable", tab);
-
-  Translator_group::initialize ();
-}
 
 Engraver_group_engraver::Engraver_group_engraver ()
 {
+  acknowledge_hash_table_ = SCM_EOL;
+  acknowledge_hash_table_ = scm_c_make_hash_table (61);
 }
 
 #include "translator.icc"
@@ -178,4 +171,10 @@
   l = scm_reverse_x (l, SCM_EOL);
 
   return l;
+}
+
+void
+Engraver_group_engraver::derived_mark () const
+{
+  scm_gc_mark (acknowledge_hash_table_);
 }
Index: lilypond/lily/include/engraver-group-engraver.hh
diff -u lilypond/lily/include/engraver-group-engraver.hh:1.24 
lilypond/lily/include/engraver-group-engraver.hh:1.25
--- lilypond/lily/include/engraver-group-engraver.hh:1.24       Mon Jul 18 
23:37:25 2005
+++ lilypond/lily/include/engraver-group-engraver.hh    Fri Jul 22 22:52:25 2005
@@ -17,12 +17,11 @@
 {
 protected:
   Array<Grob_info> announce_infos_;
-
+  SCM acknowledge_hash_table_;
 public:
   VIRTUAL_COPY_CONSTRUCTOR ( Translator_group, Engraver_group_engraver);
   Engraver_group_engraver ();
-
-  virtual void initialize ();
+  virtual void derived_mark () const;
   PRECOMPUTED_VIRTUAL void do_announces ();
   virtual void announce_grob (Grob_info);
   int pending_grob_count () const;
Index: lilypond/lily/include/translator-group.hh
diff -u lilypond/lily/include/translator-group.hh:1.71 
lilypond/lily/include/translator-group.hh:1.72
--- lilypond/lily/include/translator-group.hh:1.71      Mon Jul 18 23:37:25 2005
+++ lilypond/lily/include/translator-group.hh   Fri Jul 22 22:52:25 2005
@@ -72,6 +72,7 @@
   Context * context () const { return context_; }
 protected:
   SCM simple_trans_list_;
+  SCM accept_hash_table_;
   Context *context_;
   
   friend class Context_def;
Index: lilypond/lily/include/translator.hh
diff -u lilypond/lily/include/translator.hh:1.87 
lilypond/lily/include/translator.hh:1.88
--- lilypond/lily/include/translator.hh:1.87    Tue Jul 19 00:41:14 2005
+++ lilypond/lily/include/translator.hh Fri Jul 22 22:52:25 2005
@@ -20,15 +20,27 @@
 
 typedef void (*Translator_void_method_ptr)(Translator*);
 
+
+struct Acknowledge_information
+{
+  SCM symbol_;
+  Translator_void_method_ptr function_;
+};
+
+
 #define TRANSLATOR_DECLARATIONS(NAME)                  \
   public:                                              \
   NAME ();                                             \
   VIRTUAL_COPY_CONSTRUCTOR (Translator, NAME);         \
   static SCM static_description_;                      \
+  static Array<Acknowledge_information> acknowledge_static_array_; \
   virtual void fetch_precomputable_methods (Translator_void_method_ptr 
methods[]);\
   virtual SCM static_translator_description () const;  \
-  virtual SCM translator_description () const;
-
+  virtual SCM translator_description () const; \
+  virtual Translator_void_method_ptr get_acknowledger (SCM sym) { \
+    return static_get_acknowledger (sym);\
+  }\
+  static Translator_void_method_ptr static_get_acknowledger (SCM sym);
 
 enum Translator_precompute_index {
   START_TRANSLATION_TIMESTEP,
@@ -48,7 +60,7 @@
 class Translator
 {
   void init ();
-
+  
 protected:
   bool must_be_last_;
 
@@ -73,7 +85,6 @@
   PRECOMPUTED_VIRTUAL void start_translation_timestep ();
   PRECOMPUTED_VIRTUAL void process_music ();
   PRECOMPUTED_VIRTUAL void process_acknowledged ();
-
   
   Score_context *get_score_context () const;
   Global_context *get_global_context () const;
Index: lilypond/lily/include/translator.icc
diff -u lilypond/lily/include/translator.icc:1.2 
lilypond/lily/include/translator.icc:1.3
--- lilypond/lily/include/translator.icc:1.2    Tue Jul 19 00:41:14 2005
+++ lilypond/lily/include/translator.icc        Fri Jul 22 22:52:25 2005
@@ -10,6 +10,8 @@
 #ifndef TRANSLATOR_ICC
 #define TRANSLATOR_ICC
 
+#include "array.hh"
+
 /**
    A macro to automate administration of translators.
 */
@@ -29,8 +31,14 @@
   ADD_GLOBAL_CTOR (_ ## T ## _adder);
 
 #define ADD_TRANSLATOR(classname, desc, grobs, accepted, acked, read, write) \
+  Array<Acknowledge_information> classname::acknowledge_static_array_;\
   IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS(classname); \
   ADD_THIS_TRANSLATOR (classname);                                     \
+  Translator_void_method_ptr\
+  classname::static_get_acknowledger (SCM sym)                         \
+  {\
+    return generic_get_acknowledger (sym, &acknowledge_static_array_);\
+  }\
   SCM                                                                  \
   classname::static_translator_description () const                    \
   {                                                                    \
@@ -83,6 +91,18 @@
     ? 0                                                                        
\
     : (Translator_void_method_ptr) &T::process_acknowledged;           \
 }
+
+void add_acknowledger (Translator_void_method_ptr ptr, const char *func_name, 
Array<Acknowledge_information> *ack_array);
+Translator_void_method_ptr
+generic_get_acknowledger (SCM sym, Array<Acknowledge_information> const 
*ack_array);
+
+#define ADD_ACKNOWLEDGER(CLASS,NAME)           \
+void CLASS ## NAME ## _ack_adder () \
+{\
+  add_acknowledger ((Translator_void_method_ptr) &CLASS::NAME, #NAME, 
&CLASS::acknowledge_static_array_);\
+}\
+ADD_SCM_INIT_FUNC(CLASS ## NAME ## _ack_adder);\
+
 
 
 #endif /* TRANSLATOR_ICC */
Index: lilypond/lily/rest-collision.cc
diff -u lilypond/lily/rest-collision.cc:1.115 
lilypond/lily/rest-collision.cc:1.116
--- lilypond/lily/rest-collision.cc:1.115       Sat Jul 16 12:23:33 2005
+++ lilypond/lily/rest-collision.cc     Fri Jul 22 22:52:25 2005
@@ -86,14 +86,14 @@
 SCM
 Rest_collision::do_shift (Grob *me)
 {
-  SCM elts = me->get_object ("elements");
+  extract_grob_set (me, "elements", elts);
 
   Link_array<Grob> rests;
   Link_array<Grob> notes;
 
-  for (SCM s = elts; scm_is_pair (s); s = scm_cdr (s))
+  for (int i = 0; i < elts.size (); i++)
     {
-      Grob *e = unsmob_grob (scm_car (s));
+      Grob *e = elts[i];
       if (unsmob_grob (e->get_object ("rest")))
        {
          /*
Index: lilypond/lily/translator-group.cc
diff -u lilypond/lily/translator-group.cc:1.144 
lilypond/lily/translator-group.cc:1.145
--- lilypond/lily/translator-group.cc:1.144     Mon Jul 18 23:37:25 2005
+++ lilypond/lily/translator-group.cc   Fri Jul 22 22:52:25 2005
@@ -34,9 +34,6 @@
 Translator_group::initialize ()
 {
   precompute_method_bindings ();
-
-  SCM tab = scm_make_vector (scm_int2num (19), SCM_BOOL_F);
-  context ()->set_property ("acceptHashTable", tab);
 }
 
 void
@@ -74,7 +71,6 @@
 bool
 Translator_group::try_music (Music *m)
 {
-  SCM tab = context ()->get_property ("acceptHashTable");
   SCM name = scm_sloppy_assq (ly_symbol2scm ("name"),
                              m->get_property_alist (false));
 
@@ -82,12 +78,12 @@
     return false;
 
   name = scm_cdr (name);
-  SCM accept_list = scm_hashq_ref (tab, name, SCM_UNDEFINED);
+  SCM accept_list = scm_hashq_ref (accept_hash_table_, name, SCM_UNDEFINED);
   if (accept_list == SCM_BOOL_F)
     {
       accept_list = find_accept_translators (get_simple_trans_list (),
                                             m->get_property ("types"));
-      scm_hashq_set_x (tab, name, accept_list);
+      scm_hashq_set_x (accept_hash_table_, name, accept_list);
     }
 
   for (SCM p = accept_list; scm_is_pair (p); p = scm_cdr (p))
@@ -162,8 +158,11 @@
 Translator_group::Translator_group ()
 {
   simple_trans_list_ = SCM_EOL;
+  accept_hash_table_ = SCM_EOL;
   context_ = 0;
   smobify_self ();
+
+  accept_hash_table_ = scm_c_make_hash_table (19);
 }
 
 void
@@ -248,7 +247,7 @@
   Translator_group *me = (Translator_group*)SCM_CELL_WORD_1 (smob);
 
   me->derived_mark ();
-  
+  scm_gc_mark (me->accept_hash_table_);
   return me->simple_trans_list_;
 }
 
Index: lilypond/lily/translator.cc
diff -u lilypond/lily/translator.cc:1.87 lilypond/lily/translator.cc:1.88
--- lilypond/lily/translator.cc:1.87    Mon Jul 18 23:37:25 2005
+++ lilypond/lily/translator.cc Fri Jul 22 22:52:25 2005
@@ -120,12 +120,6 @@
   return SCM_EOL;
 }
 
-SCM
-Translator::translator_description () const
-{
-  return SCM_EOL;
-}
-
 Global_context *
 Translator::get_global_context () const
 {
@@ -138,12 +132,6 @@
   return daddy_context_->get_score_context ();
 }
 
-SCM
-Translator::static_translator_description ()const
-{
-  return SCM_EOL;
-}
-
 IMPLEMENT_SMOBS (Translator);
 IMPLEMENT_DEFAULT_EQUAL_P (Translator);
 IMPLEMENT_TYPE_P (Translator, "ly:translator?");
@@ -159,13 +147,6 @@
 {
 }
 
-void
-Translator::fetch_precomputable_methods (Translator_void_method_ptr ptrs[])
-{
-  for (int i = 0; i < TRANSLATOR_METHOD_PRECOMPUTE_COUNT; i++)
-    ptrs[i] = 0;
-}
-
 int
 Translator::print_smob (SCM s, SCM port, scm_print_state *)
 {
@@ -176,3 +157,41 @@
   return 1;
 }
 
+void
+add_acknowledger (Translator_void_method_ptr ptr,
+                 const char *func_name,
+                 Array<Acknowledge_information> *ack_array)
+{
+  Acknowledge_information inf;
+  inf.function_ = ptr;
+
+  String interface_name(func_name);
+
+  interface_name = interface_name.substitute ("acknowledge_", "");
+  interface_name = interface_name.substitute ('_', '-');
+  interface_name += "-interface";
+
+  inf.symbol_ = scm_gc_protect_object (ly_symbol2scm (interface_name.to_str0 
()));
+  ack_array->push (inf);
+}
+
+Translator_void_method_ptr 
+generic_get_acknowledger (SCM sym, Array<Acknowledge_information> const 
*ack_array)
+{
+  for (int i = 0; i < ack_array->size(); i++)
+    {
+      if (ack_array->elem (i).symbol_ == sym)
+       {
+         return ack_array->elem(i).function_;
+       }
+    }
+  return 0;
+}
+
+ADD_TRANSLATOR(Translator,
+              "Base class. Unused",
+              "",
+              "",
+              "",
+              "",
+              "");
Index: lilypond/lily/type-swallow-translator.cc
diff -u lilypond/lily/type-swallow-translator.cc:1.21 
lilypond/lily/type-swallow-translator.cc:1.22
--- lilypond/lily/type-swallow-translator.cc:1.21       Mon Jul 18 23:37:25 2005
+++ lilypond/lily/type-swallow-translator.cc    Fri Jul 22 22:52:25 2005
@@ -29,7 +29,9 @@
   TRANSLATOR_DECLARATIONS (Rest_swallow_translator);
 };
 
-Skip_event_swallow_translator::Skip_event_swallow_translator (){}
+Skip_event_swallow_translator::Skip_event_swallow_translator ()
+{
+}
 
 ADD_TRANSLATOR (Skip_event_swallow_translator,
                "Swallow \\skip.",
Index: lilypond/scm/define-context-properties.scm
diff -u lilypond/scm/define-context-properties.scm:1.46 
lilypond/scm/define-context-properties.scm:1.47
--- lilypond/scm/define-context-properties.scm:1.46     Thu Jul 21 12:14:35 2005
+++ lilypond/scm/define-context-properties.scm  Fri Jul 22 22:52:25 2005
@@ -484,12 +484,6 @@
 ")
      (barCheckLastFail ,ly:moment? "Where in the measure did the last barcheck 
fail?") 
      (associatedVoiceContext ,ly:context? "The context object of the Voice 
that has the melody for this Lyrics.")
-     (acceptHashTable ,vector? "Internal
-variable: store table with MusicName to Engraver entries.")
-     (acknowledgeHashTable ,vector?
-                          "Internal variable: store interface to engraver smob 
table for current
-context.")
-
      (beamMelismaBusy ,boolean? "Signal if a beam is present.")
      (dynamicAbsoluteVolumeFunction ,procedure? "[DOCUMENT-ME]")
 
Index: lilypond/scm/page-layout.scm
diff -u lilypond/scm/page-layout.scm:1.78 lilypond/scm/page-layout.scm:1.79
--- lilypond/scm/page-layout.scm:1.78   Thu Jul 21 01:11:50 2005
+++ lilypond/scm/page-layout.scm        Fri Jul 22 22:52:25 2005
@@ -194,6 +194,7 @@
   (define MAXPENALTY 1e9)
   (define paper (ly:paper-book-paper paper-book))
   (define scopes (ly:paper-book-scopes paper-book))
+  (define force-equalization-factor #f)
 
   (define (page-height page-number last?)
     (let ((p (ly:output-def-lookup paper 'page-music-height)))
@@ -218,14 +219,14 @@
                             0.0
                             (node-penalty (car best-paths))))
         (inter-system-space (ly:output-def-lookup paper 'betweensystemspace))
-        (force-equalization-factor 0.3)
         (relative-force (/ force inter-system-space))
         (abs-relative-force (abs relative-force)))
 
 
       (+ (* abs-relative-force (+ abs-relative-force 1))
         prev-penalty
-        (* force-equalization-factor (/ (abs (- prev-force force)) 
inter-system-space))
+        (* force-equalization-factor (/ (abs (- prev-force force))
+                                        inter-system-space))
         user)))
 
   (define (space-systems page-height lines ragged?)
@@ -335,6 +336,7 @@
 
 CURRENT-BEST is the best result sofar, or #f."
 
+
     (let* ((this-page-num (if (null? best-paths)
                               (ly:output-def-lookup paper 'firstpagenumber)
                               (1+ (node-page-number (car best-paths)))))
@@ -382,6 +384,7 @@
                           #:penalty total-penalty)
                          current-best)))
 
+;;      (display total-penalty) (newline)
       (if #f ;; debug
           (display
            (list
@@ -428,6 +431,8 @@
     (ly:paper-system-number (car (node-lines node))))
 
   (ly:message (_ "Calculating page breaks..."))
+  (set! force-equalization-factor
+       (ly:output-def-lookup paper 'verticalequalizationfactor 0.3))
 
   (let* ((best-break-node (walk-lines '() '() lines))
         (break-nodes (get-path best-break-node '()))


_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to