]> git.donarmstrong.com Git - lilypond.git/commitdiff
Update to new system-count function names.
authorJan Nieuwenhuizen <janneke@gnu.org>
Wed, 24 Jul 2002 16:11:10 +0000 (16:11 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Wed, 24 Jul 2002 16:11:10 +0000 (16:11 +0000)
Use LY_DEFINE.

Remove DECLARE_SCHEME_CALLBACKs.

ChangeLog
input/mutopia/J.S.Bach/baerenreiter-sarabande.ly
input/test/count-systems.ly
lily/grob.cc
lily/include/duration.hh
lily/include/grob.hh
lily/include/spanner.hh
lily/spanner.cc

index da93cbba21a13e1059bf0bfef33103b87d38c483..e972ce915d31369a414495031c345cb3cd21a747 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,17 @@
 
 2002-07-24  Jan Nieuwenhuizen  <janneke@gnu.org>
 
+       * input/mutopia/J.S.Bach/baerenreiter-sarabande.ly: *
+       input/test/count-systems.ly: Update to new system-count function
+       names.
+
+       * lily/grob.cc (get_line, get_original): Use LY_DEFINE.
+
+       * lily/spanner.cc (get_broken_into): Use LY_DEFINE.
+
+       * lily/include/spanner.hh:
+       * lily/include/grob.hh: Remove DECLARE_SCHEME_CALLBACKs.
+
        * input/mutopia/J.S.Bach/baerenreiter-sarabande.ly: Add
        forcedBreak options and fix measure count comments.
 
index c6e1724e4572a5c139014f865bfc8838ec01e849..2c08b7e0586e76c89c803a0de65e654a6a2cf4d7 100644 (file)
@@ -1,11 +1,25 @@
 
 #(set! point-and-click line-column-location)
 
-forcedBreak = \notes { }
-%%forcedBreak = \notes { \break }
+%%forcedBreak = \notes { }
+forcedBreak = \notes { \break }
 forcedLastBreak = \notes { \break }
 %%forcedLastBreak = \notes { }
 
+%% We want this to perfectly match the Baerenreiter spacing.
+%% If we're not using 6 systems, there's definately a problem.
+#(define (assert-system-count smob n)
+  (let ((systems (length (get-broken-into
+                         (get-original
+                          (get-line smob))))))
+    (if (not (equal? n systems))
+       ;; Can't use error yet, as we know that we're not using 6...
+       ;;(error
+       (warn
+       (string-append "Got " (number->string systems)
+                            " systems (expecting " (number->string n))))))
+            
+
 \header {
   title = "Solo Cello Suite II"
   piece ="Sarabande"
@@ -112,7 +126,12 @@ sarabandeA =  \context Voice \notes \relative c {
   [a,8 e']
   \oneVoice
   [d' cis] |
-  d4 d,,2 |
+  %%  d4 d,,2 |
+  d4
+  \property Thread.NoteHead
+  \override #'after-line-breaking-callback
+  = #(lambda (smob) (assert-system-count smob 6.1))
+  d,,2 |
 }
 
 
index 5869fcad6fb769ad110f5781b3f6df1cfc5eefed..c7f4ba6130a5cac36536814a2b549a75f954af1a 100644 (file)
@@ -7,9 +7,9 @@
 }
 
 #(define (display-systemno smob)
-  (let* ((this-line (Grob::line_scm smob))
-        (systems (Spanner::get_broken_into
-                  (Grob::original_scm this-line))))
+  (let* ((this-line (get-line smob))
+        (systems (get-broken-into
+                  (get-original this-line))))
     (display smob)
     (display (list-index systems this-line))
     (newline)))
@@ -17,9 +17,9 @@
 
 #(define (display-system-count smob)
   (display (length
-           (Spanner::get_broken_into
-            (Grob::original_scm
-             (Grob::line_scm smob))))))
+           (get-broken-into
+            (get-original
+             (get-line smob))))))
 
   
   
index f4cb9937b19db23390ae3edddbc97e1a88030363..76e2503745786bff46233752ce2ea6684c53bd43 100644 (file)
@@ -308,26 +308,32 @@ Grob::line_l () const
   return 0;
 }
 
-MAKE_SCHEME_CALLBACK (Grob, line_scm, 1);
-SCM
-Grob::line_scm (SCM smob)
-{
-  Grob *me = unsmob_grob (smob); 
+LY_DEFINE (get_line,
+          "get-line",
+          1, 0, 0, (SCM grob),
+          "
+Return the Line Grob of @var{grob}.
+")
+{
+  Grob *me = unsmob_grob (grob);
+  SCM_ASSERT_TYPE (me, grob, SCM_ARG1, __FUNCTION__, "grob");
+  
   if (Grob *g = me->line_l ())
     return g->self_scm ();
-      
+    
   return SCM_EOL;
 }
 
-MAKE_SCHEME_CALLBACK (Grob, original_scm, 1);
-SCM
-Grob::original_scm (SCM smob)
+LY_DEFINE (get_original,
+          "get-original",
+          1, 0, 0, (SCM grob),
+          "
+Return the original Grob of @var{grob}
+")
 {
-  Grob *me = unsmob_grob (smob);
-  if (me->original_l_)
-    return me->original_l_->self_scm ();
-      
-  return SCM_EOL;
+  Grob *me = unsmob_grob (grob);
+  SCM_ASSERT_TYPE (me, grob, SCM_ARG1, __FUNCTION__, "grob");
+  return me->original_l_ ? me->original_l_->self_scm () : me->self_scm ();
 }
 
 void
@@ -799,6 +805,35 @@ Grob::internal_has_interface (SCM k)
   return scm_memq (k, ifs) != SCM_BOOL_F;
 }
 
+
+/** Return Array of Grobs in SCM list L */
+Link_array<Grob>
+ly_scm2grob_array (SCM l)
+{
+  Link_array<Grob> arr;
+
+  for (SCM s = l; gh_pair_p (s); s = gh_cdr (s))
+    {
+      SCM e = gh_car (s);
+      arr.push (unsmob_grob (e));
+    }
+
+  arr.reverse ();
+  return arr;
+}
+
+/** Return SCM list of Grob array A */
+SCM
+ly_grob_array2scm (Link_array<Grob> a)
+{
+  SCM s = SCM_EOL;
+  for (int i = a.size (); i; i--)
+    s = gh_cons (a[i-1]->self_scm (), s);
+
+  return s;
+}
+
+
 IMPLEMENT_TYPE_P (Grob, "ly-grob?");
 
 ADD_INTERFACE (Grob, "grob-interface",
index 654db0db8b5b3f3ed4873916212d5f237e00b174..f301fe296acab5406623fabee68db870cae4e134 100644 (file)
@@ -46,8 +46,7 @@ private:
 
 #include "compare.hh"
 INSTANTIATE_COMPARE (Duration, Duration::compare);
-DECLARE_UNSMOB(Duration,duration);
-
+DECLARE_UNSMOB (Duration, duration);
 
 #endif // DURATION_HH
 
index bc62ac7e25e8b3daafb35de22a505a9982a10fe9..6c3ef633c10fe6e5ed90b1b31e6c476a0fde24ea 100644 (file)
@@ -154,8 +154,6 @@ public:
   
   Grob *get_parent (Axis a) const {   return  dim_cache_[a].parent_l_; }
   DECLARE_SCHEME_CALLBACK (fixup_refpoint, (SCM));
-  DECLARE_SCHEME_CALLBACK (original_scm, (SCM smob));
-  DECLARE_SCHEME_CALLBACK (line_scm, (SCM smob));
 };
 
 DECLARE_UNSMOB(Grob,grob);
@@ -168,35 +166,8 @@ Grob*common_refpoint_of_array (Link_array<Grob> const&, Grob * , Axis a);
 void set_break_subsititution (SCM criterion);
 SCM substitute_mutable_property_alist (SCM alist);
 
-
-/** Return Array of Grobs in SCM list L */
-inline Link_array<Grob>
-ly_scm2grob_array (SCM l)
-{
-  Link_array<Grob> arr;
-
-  for (SCM s = l; gh_pair_p (s); s = gh_cdr (s))
-    {
-      SCM e = gh_car (s);
-      arr.push (unsmob_grob (e));
-    }
-
-  arr.reverse ();
-  return arr;
-}
-
-#if 0
-/** Return SCM list of Grob array A */
-inline SCM
-ly_grob_array2scm (Link_array<Grob> a)
-{
-  SCM s = SCM_EOL;
-  for (int i = a.size (); i; i--)
-    s = gh_cons (a[i-1]->self_scm (), s);
-
-  return s;
-}
-#endif
+Link_array<Grob> ly_scm2grob_array (SCM l);
+SCM ly_grob_array2scm (Link_array<Grob> a);
 
 #endif // STAFFELEM_HH
 
index cc0bd57753079627b630bc8b90cdd7c9d84e227c..9ea2df7870bb2c83a083f1d5d03053633cd62998 100644 (file)
@@ -34,7 +34,6 @@ class Spanner : public  Grob {
 
 public:
   DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
-  DECLARE_SCHEME_CALLBACK (get_broken_into, (SCM));
   
   Link_array<Spanner> broken_into_l_arr_;
 
@@ -66,6 +65,6 @@ protected:
 
 
 void add_bound_item (Spanner*, Grob*);
-
+///DECLARE_UNSMOB (Spanner, spanner);
 
 #endif
index 7cae376694708d71bdb77c3db953e4383e52bc89..9b2f30fcbcfb91d18fc33bb5f751040098d89946 100644 (file)
 #include "system.hh"
 #include "group-interface.hh"
 
-
-MAKE_SCHEME_CALLBACK (Spanner, get_broken_into, 1);
-SCM
-Spanner::get_broken_into (SCM smob)
+/* spanner in name? */
+LY_DEFINE (get_broken_into,
+         "get-broken-into", 1, 0, 0, (SCM spanner),
+          "
+Return broken-into list for @var{spanner}.
+"
+)
 {
-  if (Spanner *me = dynamic_cast<Spanner*> (unsmob_grob (smob)))
-#if 0    
-    return ly_grob_array2scm (me->broken_into_l_arr_);
-#else
-  {
-      SCM s = SCM_EOL;
-      for (int i = me->broken_into_l_arr_.size (); i; i--)
-       s = gh_cons (me->broken_into_l_arr_[i-1]->self_scm (), s);
-      return s;
-  }
-#endif
-  
-  return SCM_EOL;
+  ///  Spanner *me = unsmob_spanner (spanner);
+  Spanner *me = dynamic_cast<Spanner*> (unsmob_grob (spanner));
+  SCM_ASSERT_TYPE (me, spanner, SCM_ARG1, __FUNCTION__, "spanner");
+
+  SCM s = SCM_EOL;
+  for (int i = me->broken_into_l_arr_.size (); i; i--)
+    s = gh_cons (me->broken_into_l_arr_[i-1]->self_scm (), s);
+  return s;
 }
 
 void