From 0ccace80447d10fe0f52f9f189f01d60d60202e8 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Tue, 9 Mar 2004 20:56:18 +0000 Subject: [PATCH] * lily/include/paper-book.hh (PAGE_LAYOUT): Define as "ps"; make switch runtime. --- ChangeLog | 3 +++ lily/include/paper-book.hh | 4 ++-- lily/input-file-results.cc | 5 ++--- lily/paper-outputter.cc | 9 ++++----- lily/parser.yy | 12 +++++------- lily/score.cc | 5 ++--- lily/system.cc | 21 +++++++++++---------- 7 files changed, 29 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 05b08bc7e1..7fe6375e3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2004-03-09 Jan Nieuwenhuizen + * lily/include/paper-book.hh (PAGE_LAYOUT): Define as "ps"; make + switch runtime. + * lily/include/music-output.hh (process): Change signature to return SCM. diff --git a/lily/include/paper-book.hh b/lily/include/paper-book.hh index 3c2dd05f67..0a18454979 100644 --- a/lily/include/paper-book.hh +++ b/lily/include/paper-book.hh @@ -9,12 +9,12 @@ #ifndef PAPER_BOOK_HH #define PAPER_BOOK_HH -// #define PAGE_LAYOUT 1 - #include "lily-guile.hh" #include "parray.hh" #include "protected-scm.hh" +#define PAGE_LAYOUT "ps" + class Paper_book { public: diff --git a/lily/input-file-results.cc b/lily/input-file-results.cc index 6c446f881d..17a67cba57 100644 --- a/lily/input-file-results.cc +++ b/lily/input-file-results.cc @@ -233,7 +233,6 @@ do_one_file (char const *file) Paper_book book; paper_book = &book; Input_file_results inp_file (init, in_file, out_file); -#ifdef PAGE_LAYOUT - book.output (out_file); -#endif + if (output_format_global == PAGE_LAYOUT) + book.output (out_file); } diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index dead824a55..4ec59b228f 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -24,8 +24,7 @@ #include "paper-def.hh" #include "input-file-results.hh" #include "ly-module.hh" - - +#include "paper-book.hh" #include "input-smob.hh" // output_expr @@ -108,13 +107,13 @@ Paper_outputter::output_line (SCM line, bool is_last) { Stencil *stil = unsmob_stencil (ly_cdar (s)); SCM head = ly_caar (s); -#ifndef PAGE_LAYOUT + if (head == ly_symbol2scm ("between-system-string")) { between = stil->get_expr (); continue; } -#endif + output_expr (stil->get_expr (), ly_scm2offset (head)); } @@ -123,7 +122,7 @@ Paper_outputter::output_line (SCM line, bool is_last) else { output_scheme (scm_list_1 (ly_symbol2scm ("stop-system"))); - if (between != SCM_EOL) + if (output_format_global != PAGE_LAYOUT && between != SCM_EOL) output_scheme (between); } } diff --git a/lily/parser.yy b/lily/parser.yy index 80ba7a4fe4..fed1f4469c 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -453,14 +453,12 @@ toplevel_expression: id = id ? id->clone () : new Paper_def; default_rendering (sc->music_, id->self_scm (), head, outname); - -#ifndef PAGE_LAYOUT - scm_gc_unprotect_object (id->self_scm ()); -#endif + + if (output_format_global != PAGE_LAYOUT) + scm_gc_unprotect_object (id->self_scm ()); } -#ifndef PAGE_LAYOUT - scm_gc_unprotect_object (sc->self_scm ()); -#endif + if (output_format_global != PAGE_LAYOUT) + scm_gc_unprotect_object (sc->self_scm ()); } | output_def { SCM id = SCM_EOL; diff --git a/lily/score.cc b/lily/score.cc index ae9c81f647..a83573b7b2 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -178,9 +178,8 @@ default_rendering (SCM music, SCM outdef, SCM header, SCM outname) paper_book->headers_.push (header); Paper_score *ps = dynamic_cast (output); paper_book->papers_.push (ps->paper_); -#ifndef PAGE_LAYOUT - paper_book->classic_output (ly_scm2string (outname)); -#endif + if (output_format_global != PAGE_LAYOUT) + paper_book->classic_output (ly_scm2string (outname)); } delete output; } diff --git a/lily/system.cc b/lily/system.cc index ac6fc06702..393d2abf5b 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -424,18 +424,19 @@ System::get_line () stil->smobbed_copy ()), line); } -#ifndef PAGE_LAYOUT - SCM lastcol = ly_car (get_property ("columns")); - Grob *g = unsmob_grob (lastcol); - - SCM between = ly_symbol2scm ("between-system-string"); - SCM inter = g->internal_get_property (between); - if (gh_string_p (inter)) + if (output_format_global != PAGE_LAYOUT) { - Stencil *stil = new Stencil (Box (), scm_list_2 (between, inter)); - line = scm_cons (scm_cons (between, stil->smobbed_copy ()), line); + SCM lastcol = ly_car (get_property ("columns")); + Grob *g = unsmob_grob (lastcol); + + SCM between = ly_symbol2scm ("between-system-string"); + SCM inter = g->internal_get_property (between); + if (gh_string_p (inter)) + { + Stencil *stil = new Stencil (Box (), scm_list_2 (between, inter)); + line = scm_cons (scm_cons (between, stil->smobbed_copy ()), line); + } } -#endif Interval x (extent (this, X_AXIS)); Interval y (extent (this, Y_AXIS)); -- 2.39.5