Use LY_DEFINE.
Remove DECLARE_SCHEME_CALLBACKs.
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.
#(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"
[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 |
}
}
#(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)))
#(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))))))
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
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",
#include "compare.hh"
INSTANTIATE_COMPARE (Duration, Duration::compare);
-DECLARE_UNSMOB(Duration,duration);
-
+DECLARE_UNSMOB (Duration, duration);
#endif // DURATION_HH
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);
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
public:
DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
- DECLARE_SCHEME_CALLBACK (get_broken_into, (SCM));
Link_array<Spanner> broken_into_l_arr_;
void add_bound_item (Spanner*, Grob*);
-
+///DECLARE_UNSMOB (Spanner, spanner);
#endif
#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