X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fbook-scheme.cc;h=339e2c282930e6c2c892c7c54f776844af354f35;hb=4084f5affb220e6de38399e5e016be9759521045;hp=e00f1ded496965f1882390f31976f613b26debb7;hpb=92e8f758e29427d28c413d1998c895b9c61932fd;p=lilypond.git diff --git a/lily/book-scheme.cc b/lily/book-scheme.cc index e00f1ded49..339e2c2829 100644 --- a/lily/book-scheme.cc +++ b/lily/book-scheme.cc @@ -1,9 +1,20 @@ /* - book-scheme.cc -- implement Book bindings + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 2004--2011 Han-Wen Nienhuys - (c) 2004--2007 Han-Wen Nienhuys + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "book.hh" @@ -34,6 +45,18 @@ LY_DEFINE (ly_make_book, "ly:make-book", return x; } +LY_DEFINE (ly_make_book_part, "ly:make-book-part", + 1, 0, 0, (SCM scores), + "Make a @code{\\bookpart} containing @code{\\scores}.") +{ + Book *book = new Book; + book->scores_ = scm_append (scm_list_2 (scores, book->scores_)); + + SCM x = book->self_scm (); + book->unprotect (); + return x; +} + LY_DEFINE (ly_book_process, "ly:book-process", 4, 0, 0, (SCM book_smob, SCM default_paper, @@ -96,3 +119,49 @@ LY_DEFINE (ly_book_add_score_x, "ly:book-add-score!", book->add_score (score); return SCM_UNSPECIFIED; } + +LY_DEFINE (ly_book_add_bookpart_x, "ly:book-add-bookpart!", + 2, 0, 0, (SCM book_smob, SCM book_part), + "Add @var{book-part} to @var{book-smob} book part list.") +{ + LY_ASSERT_SMOB (Book, book_smob, 1); + Book *book = unsmob_book (book_smob); + book->add_bookpart (book_part); + return SCM_UNSPECIFIED; +} + +LY_DEFINE (ly_book_book_parts, "ly:book-book-parts", + 1, 0, 0, (SCM book), + "Return book parts in @var{book}.") +{ + LY_ASSERT_SMOB (Book, book, 1); + Book *b = unsmob_book (book); + return b->bookparts_; +} + +LY_DEFINE (ly_book_paper, "ly:book-paper", + 1, 0, 0, (SCM book), + "Return paper in @var{book}.") +{ + LY_ASSERT_SMOB (Book, book, 1); + Book *b = unsmob_book (book); + return b->paper_ ? b->paper_->self_scm () : SCM_BOOL_F; +} + +LY_DEFINE (ly_book_header, "ly:book-header", + 1, 0, 0, (SCM book), + "Return header in @var{book}.") +{ + LY_ASSERT_SMOB (Book, book, 1); + Book *b = unsmob_book (book); + return b->header_ ? b->header_ : SCM_BOOL_F; +} + +LY_DEFINE (ly_book_scores, "ly:book-scores", + 1, 0, 0, (SCM book), + "Return scores in @var{book}.") +{ + LY_ASSERT_SMOB (Book, book, 1); + Book *b = unsmob_book (book); + return b->scores_; +}