[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

add ly:book-set-header! (issue 5720062)

From: janek . lilypond
Subject: add ly:book-set-header! (issue 5720062)
Date: Sat, 03 Mar 2012 00:42:25 +0000

Reviewers: ,

From Jan-Peter Voigt, please review:

Hello list,

sorry for resending this, it might get lost, because I simply answered
to another thread with another subject.

now, we have a book-predicate and we are dealing with books in scheme.
Then we might want to set a header after creating a book.
There is a function ly:score-set-header!, which I copied and adapted for
the Book-class.
This patch compiled and works with the following snippet.

\version "2.15.32"

bk = \book {
 \score {
   \relative c' {
     c4 e g b

#(let ((bh (eval-string "(define-module (a b))")))
    (eval '(define title "Hallo") bh)
    (ly:book-set-header! bk bh))

\book { \bk }

Is this helpful for lily-devel?
And is there another (better) way of creating a module (for header
generation) on the fly in scheme?

add ly:book-set-header!

Add a scheme function ly:book-set-header! like ly:score-set-header!

Function is copied from to,
setting public member var header_ in class Book.

Please review this at

Affected files:
  M lily/

Index: lily/
diff --git a/lily/ b/lily/
index 7f1026a3e79239c83a95c6144c47427adda4f5f1..ae505af3184b422f4c34ff9308f984b35acc4f19 100644
--- a/lily/
+++ b/lily/
@@ -156,6 +156,19 @@ LY_DEFINE (ly_book_header, "ly:book-header",
   return b->header_ ? b->header_ : SCM_BOOL_F;

+LY_DEFINE (ly_book_set_header_x, "ly:book-set-header!",
+           2, 0, 0, (SCM book, SCM module),
+           "Set the book header.")
+  LY_ASSERT_SMOB (Book, book, 1);
+  SCM_ASSERT_TYPE (ly_is_module (module), module, SCM_ARG2, __FUNCTION__,
+                   "module");
+  Book *b = unsmob_book (book);
+  b->header_ = (module);
 LY_DEFINE (ly_book_scores, "ly:book-scores",
            1, 0, 0, (SCM book),
            "Return scores in @var{book}.")

reply via email to

[Prev in Thread] Current Thread [Next in Thread]