]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/book-scheme.cc
Merge branch 'master' of git+ssh://jneem@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / lily / book-scheme.cc
index 03e10af05d73c3d39caafe3105090a36210cc5cb..23237dbb0d7559e9cfa877d85f7a28596835a3d8 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2004--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 2004--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include "book.hh"
@@ -31,7 +31,7 @@ LY_DEFINE (ly_make_book, "ly:make-book",
   book->scores_ = scm_append (scm_list_2 (scores, book->scores_));
 
   SCM x = book->self_scm ();
-  scm_gc_unprotect_object (x);
+  book->unprotect ();
   return x;
 }
 
@@ -58,7 +58,37 @@ LY_DEFINE (ly_parser_print_book, "ly:book-process",
   if (pb)
     {
       pb->output (output);
-      scm_gc_unprotect_object (pb->self_scm ());
+      pb->unprotect ();
+    }
+
+  return SCM_UNSPECIFIED;
+}
+
+
+LY_DEFINE (ly_parser_print_book_to_systems, "ly:book-process-to-systems",
+          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).")
+{
+  Book *book = unsmob_book (book_smob);
+
+  SCM_ASSERT_TYPE (book, book_smob, SCM_ARG1, __FUNCTION__, "Book");
+  SCM_ASSERT_TYPE (unsmob_output_def (default_paper),
+                  default_layout, SCM_ARG2, __FUNCTION__, "\\paper block");
+  SCM_ASSERT_TYPE (unsmob_output_def (default_layout),
+                  default_layout, SCM_ARG3, __FUNCTION__, "\\layout block");
+
+  Paper_book *pb = book->process (unsmob_output_def (default_paper),
+                                 unsmob_output_def (default_layout));
+  if (pb)
+    {
+      pb->classic_output (output);
+      pb->unprotect ();
     }
 
   return SCM_UNSPECIFIED;