X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fbook-scheme.cc;h=90e67bd61191e6ba805af0b4f0b96ff41c621af8;hb=e2c7a2ab964d7ab2b4d993634303327adf5e39f2;hp=7bb9ba0c6b15a3347701e1a5a72caff015b6995d;hpb=cbb205d40a19c0d2d9801031a63607e108a18038;p=lilypond.git diff --git a/lily/book-scheme.cc b/lily/book-scheme.cc index 7bb9ba0c6b..90e67bd611 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--2010 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" @@ -15,8 +26,8 @@ LY_DEFINE (ly_make_book, "ly:make-book", 2, 0, 1, (SCM paper, SCM header, SCM scores), - "Make a \\book of @var{paper} and @var{header} (which may be #f as well) " - "containing @code{\\scores}.") + "Make a @code{\\book} of @var{paper} and @var{header}" + " (which may be @code{#f} as well) containing @code{\\scores}.") { Output_def *odef = unsmob_output_def (paper); LY_ASSERT_SMOB (Output_def, paper, 1); @@ -34,15 +45,26 @@ 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, SCM default_layout, SCM output), - "Print book. @var{output} is passed to the backend unchanged. " - "Eg. it may be " - "a string (for file based outputs) or a socket (for network based " - "output).") + "Print book. @var{output} is passed to the backend unchanged." + " For example, it may be a string (for file based outputs)" + " or a socket (for network based output).") { Book *book = unsmob_book (book_smob); @@ -67,10 +89,9 @@ LY_DEFINE (ly_book_process_to_systems, "ly:book-process-to-systems", SCM default_paper, SCM default_layout, SCM output), - "Print book. @var{output} is passed to the backend unchanged. " - "Eg. it may be " - "a string (for file based outputs) or a socket (for network based " - "output).") + "Print book. @var{output} is passed to the backend unchanged." + " For example, it may be a string (for file based outputs)" + " or a socket (for network based output).") { LY_ASSERT_SMOB (Book, book_smob, 1); LY_ASSERT_SMOB (Output_def, default_paper, 2); @@ -89,3 +110,22 @@ LY_DEFINE (ly_book_process_to_systems, "ly:book-process-to-systems", return SCM_UNSPECIFIED; } +LY_DEFINE (ly_book_add_score_x, "ly:book-add-score!", + 2, 0, 0, (SCM book_smob, SCM score), + "Add @var{score} to @var{book-smob} score list.") +{ + LY_ASSERT_SMOB (Book, book_smob, 1); + Book *book = unsmob_book (book_smob); + 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; +}