[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Putting a \layout block in a Scheme macro
From: |
Jérôme Plût |
Subject: |
Re: Putting a \layout block in a Scheme macro |
Date: |
Fri, 27 Jan 2017 20:20:16 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
> \version "2.19.54"
>
> BlankStaff =
> #(define-void-function (count) (integer?)
> (let* ((blankstaff #{ \score { { s1 \break } } #} )
> (layout #{ \layout { \context { \Staff \remove "Bar_engraver" }
> } #} )
> (bookpart (ly:make-book-part (make-list count blankstaff)))
> (book (ly:make-book $defaultpaper $defaultheader)))
> (ly:output-def-set-variable! layout 'indent (ly:mm 0))
> (ly:output-def-set-variable! layout 'ragged-right #f)
> (ly:book-add-bookpart! book bookpart)
> (ly:book-process book $defaultpaper layout (ly:parser-output-name))
> ))
>
> \BlankStaff 4
Thanks for the answer, but:
your code produces a failed assertion in the lilypond binary:
lilypond:
/home/gub/NewGub/gub/target/linux-x86/src/lilypond-git.sv.gnu.org--lilypond.git-release-unstable/lily/book.cc:258:
void Book::process_score(SCM, Paper_book*, Output_def*): Assertion `0' failed.
This assertion is unclear but, looking at the source file, it
obviously means that the top-level book content was neither a Score
nor a markup list (the execution path seems to go ly:book-process ->
Book::process -> Book::process_score). I leave it to the experts from
there!
And while we are there: your solution seems to create a new book for
the score. Is that the case? How would one adapt it to incorporate the
score at top-level?
<rant>
(More generally, why is it that painful to translate Lilypond
language to Scheme? I would have imagined that there would be some
(relatively) small number of primitive functions in the binary
exported from Scheme, and that Lilypond would be mainly a set of
macros on top of that - a la TeX and LaTeX. But the whole data
structures in ly/scm are completely different, and the syntax makes
absolutely no sense in either incarnation. Is there a design document
somewhere that I missed?)
</rant>
--
Jérôme Plût