CVSROOT: /cvsroot/lilypond Module name: lilypond Branch: Changes by: Han-Wen Nienhuys <[EMAIL PROTECTED]> 05/07/11 12:51:14
Modified files: . : ChangeLog lily : book-scheme.cc book.cc default-actions.cc lily-parser-scheme.cc output-def.cc paper-book-scheme.cc paper-book.cc score-scheme.cc score.cc lily/include : book.hh ly-module.hh ly : declarations-init.ly init.ly python : convertrules.py scm : framework-eps.scm lily-library.scm safe-lily.scm scripts : lilypond-book.py Log message: (LY_DEFINE): ly:parser-output-name: new function. (LY_DEFINE): change name ly:parser-define -> ly:parser-define! CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3865&tr2=1.3866&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/book-scheme.cc.diff?tr1=1.4&tr2=1.5&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/book.cc.diff?tr1=1.41&tr2=1.42&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/default-actions.cc.diff?tr1=1.1&tr2=1.2&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/lily-parser-scheme.cc.diff?tr1=1.16&tr2=1.17&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/output-def.cc.diff?tr1=1.17&tr2=1.18&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/paper-book-scheme.cc.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/paper-book.cc.diff?tr1=1.109&tr2=1.110&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/score-scheme.cc.diff?tr1=1.9&tr2=1.10&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/score.cc.diff?tr1=1.165&tr2=1.166&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/book.hh.diff?tr1=1.16&tr2=1.17&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/ly-module.hh.diff?tr1=1.11&tr2=1.12&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ly/declarations-init.ly.diff?tr1=1.88&tr2=1.89&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ly/init.ly.diff?tr1=1.77&tr2=1.78&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/python/convertrules.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/framework-eps.scm.diff?tr1=1.11&tr2=1.12&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/lily-library.scm.diff?tr1=1.39&tr2=1.40&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/safe-lily.scm.diff?tr1=1.32&tr2=1.33&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scripts/lilypond-book.py.diff?tr1=1.267&tr2=1.268&r1=text&r2=text Patches: Index: lilypond/ChangeLog diff -u lilypond/ChangeLog:1.3865 lilypond/ChangeLog:1.3866 --- lilypond/ChangeLog:1.3865 Mon Jul 11 11:51:40 2005 +++ lilypond/ChangeLog Mon Jul 11 12:51:12 2005 @@ -1,5 +1,9 @@ 2005-07-11 Han-Wen Nienhuys <[EMAIL PROTECTED]> + * lily/lily-parser-scheme.cc (LY_DEFINE): ly:parser-output-name: + new function. + (LY_DEFINE): change name ly:parser-define -> ly:parser-define! + * scm/framework-*.scm: use port arguments throughout. * lily/include/lily-guile.hh: rename ly_c_X_p -> ly_is_X Index: lilypond/lily/book-scheme.cc diff -u lilypond/lily/book-scheme.cc:1.4 lilypond/lily/book-scheme.cc:1.5 --- lilypond/lily/book-scheme.cc:1.4 Thu Mar 10 14:36:15 2005 +++ lilypond/lily/book-scheme.cc Mon Jul 11 12:51:13 2005 @@ -7,8 +7,10 @@ */ #include "book.hh" + #include "output-def.hh" #include "score.hh" +#include "paper-book.hh" #include "ly-module.hh" LY_DEFINE (ly_make_book, "ly:make-book", @@ -23,7 +25,7 @@ Book *book = new Book; book->paper_ = odef; - if (ly_c_module_p (header)) + if (ly_is_module (header)) book->header_ = header; book->scores_ = scm_append (scm_list_2 (scores, book->scores_)); @@ -32,3 +34,34 @@ scm_gc_unprotect_object (x); return x; } + +LY_DEFINE (ly_parser_print_book, "ly:book-process", + 3, 0, 0, (SCM book_smob, + SCM default_paper, + SCM default_layout, + SCM basename), + "Print book.") +{ + 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"); + SCM_ASSERT_TYPE (scm_is_string (basename), basename, SCM_ARG4, __FUNCTION__, "string"); + + String base = ly_scm2string (basename); + Paper_book *pb = book->process (base, + unsmob_output_def (default_paper), + unsmob_output_def (default_layout) + ); + if (pb) + { + pb->output (base); + scm_gc_unprotect_object (pb->self_scm ()); + } + + return SCM_UNSPECIFIED; +} + Index: lilypond/lily/book.cc diff -u lilypond/lily/book.cc:1.41 lilypond/lily/book.cc:1.42 --- lilypond/lily/book.cc:1.41 Tue Jun 7 15:13:06 2005 +++ lilypond/lily/book.cc Mon Jul 11 12:51:13 2005 @@ -77,16 +77,20 @@ /* This function does not dump the output; outname is required eg. for dumping header fields. */ Paper_book * -Book::process (String outname, Output_def *default_def) +Book::process (String outname, + Output_def *default_paper, + Output_def *default_layout) { for (SCM s = scores_; s != SCM_EOL; s = scm_cdr (s)) if (Score *score = unsmob_score (scm_car (s))) if (score->error_found_) return 0; + Output_def *paper = paper_ ? default_paper : paper_; + Paper_book *paper_book = new Paper_book (); - Real scale = scm_to_double (paper_->c_variable ("outputscale")); - Output_def *scaled_bookdef = scale_output_def (paper_, scale); + Real scale = scm_to_double (paper->c_variable ("outputscale")); + Output_def *scaled_bookdef = scale_output_def (paper, scale); Object_key *key = new Lilypond_general_key (0, user_key_, 0); SCM scm_key = key->self_scm (); @@ -104,7 +108,7 @@ if (Score *score = unsmob_score (scm_car (s))) { SCM outputs = score - ->book_rendering (paper_book->paper_, default_def, key); + ->book_rendering (paper_book->paper_, default_layout, key); while (scm_is_pair (outputs)) { @@ -122,7 +126,7 @@ else if (Paper_score *pscore = dynamic_cast<Paper_score *> (output)) { SCM systems = pscore->get_paper_systems (); - if (ly_c_module_p (score->header_)) + if (ly_is_module (score->header_)) paper_book->add_score (score->header_); paper_book->add_score (systems); } Index: lilypond/lily/default-actions.cc diff -u lilypond/lily/default-actions.cc:1.1 lilypond/lily/default-actions.cc:1.2 --- lilypond/lily/default-actions.cc:1.1 Fri Jun 10 10:58:49 2005 +++ lilypond/lily/default-actions.cc Mon Jul 11 12:51:13 2005 @@ -8,99 +8,3 @@ */ -#include "lily-parser.hh" -#include "lily-lexer.hh" -#include "lilypond-key.hh" -#include "book.hh" -#include "paper-book.hh" -#include "score.hh" -#include "file-name.hh" -#include "output-def.hh" - - - - -/* TODO: move this to Scheme? Why take the parser arg, and all the back - & forth between scm and c++? */ -LY_DEFINE (ly_parser_print_score, "ly:parser-print-score", - 2, 0, 0, - (SCM parser_smob, SCM score_smob), - "Print score, i.e., the classic way.") -{ - Lily_parser *parser = unsmob_lily_parser (parser_smob); - Score *score = unsmob_score (score_smob); - - Object_key *key = new Lilypond_general_key (0, score->user_key_, 0); - - if (score->error_found_) - return SCM_UNSPECIFIED; - - SCM_ASSERT_TYPE (parser, parser_smob, SCM_ARG1, __FUNCTION__, "parser"); - SCM_ASSERT_TYPE (score, score_smob, SCM_ARG2, __FUNCTION__, "score"); - - SCM header = ly_c_module_p (score->header_) - ? score->header_ - : parser->lexer_->lookup_identifier ("$globalheader"); - - File_name outname (parser->output_basename_); - int *c = &parser->book_count_; - if (*c) - outname.base_ += "-" + to_string (*c); - (*c)++; - - SCM os = scm_makfrom0str (outname.to_string ().to_str0 ()); - SCM paper = get_paper (parser)->self_scm (); - for (int i = 0; i < score->defs_.size (); i++) - default_rendering (score->get_music (), score->defs_[i]->self_scm (), - paper, header, os, key->self_scm ()); - - if (score->defs_.is_empty ()) - { - Output_def *layout = get_layout (parser); - default_rendering (score->get_music (), - layout->self_scm (), - paper, - header, os, key->self_scm ()); - - scm_gc_unprotect_object (layout->self_scm ()); - } - - scm_gc_unprotect_object (paper); - scm_gc_unprotect_object (key->self_scm ()); - return SCM_UNSPECIFIED; -} - - -LY_DEFINE (ly_parser_print_book, "ly:parser-print-book", - 2, 0, 0, (SCM parser_smob, SCM book_smob), - "Print book.") -{ - Lily_parser *parser = unsmob_lily_parser (parser_smob); - Book *book = unsmob_book (book_smob); - Output_def *bp = unsmob_output_def (parser->lexer_->lookup_identifier ("$defaultpaper")); - - SCM_ASSERT_TYPE (parser, parser_smob, SCM_ARG1, __FUNCTION__, "Lilypond parser"); - SCM_ASSERT_TYPE (book, book_smob, SCM_ARG2, __FUNCTION__, "Book"); - - /* ugh. changing argument.*/ - book->paper_ = bp; - - File_name outname (parser->output_basename_); - int *c = &parser->book_count_; - if (*c) - outname.base_ += "-" + to_string (*c); - (*c)++; - - Output_def *layout = get_layout (parser); - Paper_book *pb = book->process (outname.to_string (), layout); - - if (pb) - { - pb->output (outname.to_string ()); - scm_gc_unprotect_object (pb->self_scm ()); - } - - scm_gc_unprotect_object (layout->self_scm ()); - return SCM_UNSPECIFIED; -} - Index: lilypond/lily/include/book.hh diff -u lilypond/lily/include/book.hh:1.16 lilypond/lily/include/book.hh:1.17 --- lilypond/lily/include/book.hh:1.16 Thu Mar 10 14:36:12 2005 +++ lilypond/lily/include/book.hh Mon Jul 11 12:51:13 2005 @@ -27,7 +27,9 @@ Book (); void add_score (SCM); - Paper_book *process (String, Output_def *); + Paper_book *process (String, + Output_def *def_paper, + Output_def *def_layout); void set_keys (); }; Index: lilypond/lily/include/ly-module.hh diff -u lilypond/lily/include/ly-module.hh:1.11 lilypond/lily/include/ly-module.hh:1.12 --- lilypond/lily/include/ly-module.hh:1.11 Thu Mar 10 14:36:12 2005 +++ lilypond/lily/include/ly-module.hh Mon Jul 11 12:51:13 2005 @@ -17,7 +17,7 @@ SCM ly_modules_lookup (SCM modules, SCM sym, SCM); SCM ly_module_symbols (SCM mod); void ly_reexport_module (SCM mod); -inline bool ly_c_module_p (SCM x) { return SCM_MODULEP (x); } +inline bool ly_is_module (SCM x) { return SCM_MODULEP (x); } void ly_clear_anonymous_modules (); SCM ly_use_module (SCM mod, SCM used); Index: lilypond/lily/lily-parser-scheme.cc diff -u lilypond/lily/lily-parser-scheme.cc:1.16 lilypond/lily/lily-parser-scheme.cc:1.17 --- lilypond/lily/lily-parser-scheme.cc:1.16 Wed Jun 22 15:06:05 2005 +++ lilypond/lily/lily-parser-scheme.cc Mon Jul 11 12:51:13 2005 @@ -155,7 +155,7 @@ return scm_gc_unprotect_object (clone->self_scm ()); } -LY_DEFINE (ly_parser_define, "ly:parser-define", +LY_DEFINE (ly_parser_define, "ly:parser-define!", 3, 0, 0, (SCM parser_smob, SCM symbol, SCM val), "Bind SYMBOL to VAL in PARSER_SMOB's module.") { @@ -216,3 +216,15 @@ return SCM_UNSPECIFIED; } + + +LY_DEFINE (ly_parser_output_name, "ly:parser-output-name", + 1, 0, 0, (SCM parser), + "Return the base name of the output file.") +{ + Lily_parser *p = unsmob_lily_parser (parser); + SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser"); + + return scm_from_locale_string (p->output_basename_.to_str0 ()); +} + Index: lilypond/lily/output-def.cc diff -u lilypond/lily/output-def.cc:1.17 lilypond/lily/output-def.cc:1.18 --- lilypond/lily/output-def.cc:1.17 Fri Jun 10 00:36:22 2005 +++ lilypond/lily/output-def.cc Mon Jul 11 12:51:13 2005 @@ -40,7 +40,7 @@ input_origin_ = s.input_origin_; scope_ = ly_make_anonymous_module (false); - if (ly_c_module_p (s.scope_)) + if (ly_is_module (s.scope_)) ly_module_copy (scope_, s.scope_); } Index: lilypond/lily/paper-book-scheme.cc diff -u lilypond/lily/paper-book-scheme.cc:1.3 lilypond/lily/paper-book-scheme.cc:1.4 --- lilypond/lily/paper-book-scheme.cc:1.3 Thu Mar 10 14:36:13 2005 +++ lilypond/lily/paper-book-scheme.cc Mon Jul 11 12:51:13 2005 @@ -25,7 +25,7 @@ SCM_ASSERT_TYPE (pb, book, SCM_ARG1, __FUNCTION__, "Paper_book"); SCM scopes = SCM_EOL; - if (ly_c_module_p (pb->header_)) + if (ly_is_module (pb->header_)) scopes = scm_cons (pb->header_, scopes); return scopes; Index: lilypond/lily/paper-book.cc diff -u lilypond/lily/paper-book.cc:1.109 lilypond/lily/paper-book.cc:1.110 --- lilypond/lily/paper-book.cc:1.109 Mon Jul 11 11:51:42 2005 +++ lilypond/lily/paper-book.cc Mon Jul 11 12:51:13 2005 @@ -89,7 +89,7 @@ pages (); SCM scopes = SCM_EOL; - if (ly_c_module_p (header_)) + if (ly_is_module (header_)) scopes = scm_cons (header_, scopes); String mod_nm = "scm framework-" + output_backend_global; @@ -126,10 +126,10 @@ systems (); SCM scopes = SCM_EOL; - if (ly_c_module_p (header_)) + if (ly_is_module (header_)) scopes = scm_cons (header_, scopes); - if (ly_c_module_p (header_0_)) + if (ly_is_module (header_0_)) scopes = scm_cons (header_0_, scopes); String format = output_backend_global; @@ -156,7 +156,7 @@ Stencil title; SCM scopes = SCM_EOL; - if (ly_c_module_p (header_)) + if (ly_is_module (header_)) scopes = scm_cons (header_, scopes); SCM tit = SCM_EOL; @@ -182,10 +182,10 @@ Stencil title; SCM scopes = SCM_EOL; - if (ly_c_module_p (header_)) + if (ly_is_module (header_)) scopes = scm_cons (header_, scopes); - if (ly_c_module_p (header)) + if (ly_is_module (header)) scopes = scm_cons (header, scopes); SCM tit = SCM_EOL; @@ -206,7 +206,7 @@ void set_system_penalty (Paper_system *ps, SCM header) { - if (ly_c_module_p (header)) + if (ly_is_module (header)) { SCM force = ly_module_lookup (header, ly_symbol2scm ("breakbefore")); if (SCM_VARIABLEP (force) @@ -259,7 +259,7 @@ SCM header = SCM_EOL; for (SCM s = scm_reverse (scores_); s != SCM_EOL; s = scm_cdr (s)) { - if (ly_c_module_p (scm_car (s))) + if (ly_is_module (scm_car (s))) { header = scm_car (s); if (header_0_ == SCM_EOL) Index: lilypond/lily/score-scheme.cc diff -u lilypond/lily/score-scheme.cc:1.9 lilypond/lily/score-scheme.cc:1.10 --- lilypond/lily/score-scheme.cc:1.9 Sun Jul 10 11:25:24 2005 +++ lilypond/lily/score-scheme.cc Mon Jul 11 12:51:13 2005 @@ -7,9 +7,12 @@ */ #include "score.hh" + #include "music.hh" #include "output-def.hh" #include "global-context.hh" +#include "lilypond-key.hh" + LY_DEFINE (ly_make_score, "ly:make-score", 1, 0, 0, @@ -69,3 +72,52 @@ scm_remember_upto_here_1 (prot); return output; } + +LY_DEFINE (ly_score_process, "ly:score-process", + 2, 0, 0, + (SCM score_smob, + SCM default_header, + SCM default_paper, + SCM default_layout, + SCM basename), + "Print score, i.e., the classic way.") +{ + Score *score = unsmob_score (score_smob); + + SCM_ASSERT_TYPE (score, score_smob, SCM_ARG1, __FUNCTION__, "score"); + + SCM_ASSERT_TYPE (ly_is_module (default_header), + default_header, SCM_ARG2, __FUNCTION__, "module"); + SCM_ASSERT_TYPE (unsmob_output_def (default_paper), + default_header, SCM_ARG3, __FUNCTION__, "\\paper block"); + SCM_ASSERT_TYPE (unsmob_output_def (default_layout), + default_header, SCM_ARG4, __FUNCTION__, "\\layout block"); + SCM_ASSERT_TYPE (scm_is_string (basename), + default_header, SCM_ARG5, __FUNCTION__, "basename"); + + Object_key *key = new Lilypond_general_key (0, score->user_key_, 0); + + if (score->error_found_) + return SCM_UNSPECIFIED; + + SCM header = ly_is_module (score->header_) + ? score->header_ + : default_header; + + for (int i = 0; i < score->defs_.size (); i++) + default_rendering (score->get_music (), score->defs_[i]->self_scm (), + default_paper, header, basename, key->self_scm ()); + + if (score->defs_.is_empty ()) + { + default_rendering (score->get_music (), + default_layout, + default_paper, + header, basename, key->self_scm ()); + } + + scm_gc_unprotect_object (key->self_scm ()); + return SCM_UNSPECIFIED; +} + + Index: lilypond/lily/score.cc diff -u lilypond/lily/score.cc:1.165 lilypond/lily/score.cc:1.166 --- lilypond/lily/score.cc:1.165 Sun Jul 10 11:25:24 2005 +++ lilypond/lily/score.cc Mon Jul 11 12:51:13 2005 @@ -15,17 +15,17 @@ #include "global-context.hh" #include "lily-parser.hh" #include "lilypond-key.hh" -#include "ly-smobs.icc" #include "main.hh" -#include "music-iterator.hh" #include "music.hh" #include "output-def.hh" -#include "output-def.hh" #include "paper-book.hh" #include "paper-score.hh" -#include "scm-hash.hh" #include "warn.hh" + +#include "music.hh" +#include "ly-smobs.icc" + Score::Score () : Input () { @@ -84,7 +84,7 @@ scm_gc_unprotect_object (copy->self_scm ()); } header_ = ly_make_anonymous_module (false); - if (ly_c_module_p (s.header_)) + if (ly_is_module (s.header_)) ly_module_copy (header_, s.header_); texts_ = s.texts_; @@ -130,7 +130,7 @@ paper_book->header_ = header; paper_book->paper_ = unsmob_output_def (scaled_bookdef); - if (ly_c_module_p (header)) + if (ly_is_module (header)) paper_book->add_score (header); SCM systems = pscore->get_paper_systems (); Index: lilypond/ly/declarations-init.ly diff -u lilypond/ly/declarations-init.ly:1.88 lilypond/ly/declarations-init.ly:1.89 --- lilypond/ly/declarations-init.ly:1.88 Fri Jul 8 17:53:41 2005 +++ lilypond/ly/declarations-init.ly Mon Jul 11 12:51:13 2005 @@ -116,7 +116,7 @@ %% MAKE-HASH-TABLE in GUILE 1.6 takes mandatory size parameter. #(define musicQuotes (make-hash-table 29)) -#(define toplevel-book-handler ly:parser-print-book) +#(define toplevel-book-handler print-book-with-defaults) #(define toplevel-music-handler collect-music-for-book) #(define toplevel-score-handler collect-scores-for-book) #(define toplevel-text-handler collect-scores-for-book) Index: lilypond/ly/init.ly diff -u lilypond/ly/init.ly:1.77 lilypond/ly/init.ly:1.78 --- lilypond/ly/init.ly:1.77 Fri Jul 8 17:53:41 2005 +++ lilypond/ly/init.ly Mon Jul 11 12:51:13 2005 @@ -34,6 +34,6 @@ (version-not-seen-message input-file-name)) #(if (pair? toplevel-scores) - (ly:parser-print-book parser + (toplevel-book-handler + parser (apply ly:make-book $defaultpaper $globalheader toplevel-scores))) - Index: lilypond/python/convertrules.py diff -u lilypond/python/convertrules.py:1.4 lilypond/python/convertrules.py:1.5 --- lilypond/python/convertrules.py:1.4 Fri Jul 8 18:08:24 2005 +++ lilypond/python/convertrules.py Mon Jul 11 12:51:13 2005 @@ -2504,12 +2504,18 @@ 'dummy rule for 2.6')) + def conv (str): return re.sub('ly:get-default-font', 'ly:grob-default-font', str) conversions.append (((2, 7, 0), conv, - - 'ly:get-default-font -> ly:grob-default-font')) + 'ly:get-default-font -> ly:grob-default-font')) + +def conv (str): + return re.sub('ly:parser-define', 'ly:parser-define!', str) + +conversions.append (((2, 7, 0), conv, + 'ly:parser-define -> ly:parser-define!')) ################################################################ Index: lilypond/scm/framework-eps.scm diff -u lilypond/scm/framework-eps.scm:1.11 lilypond/scm/framework-eps.scm:1.12 --- lilypond/scm/framework-eps.scm:1.11 Tue May 3 11:31:51 2005 +++ lilypond/scm/framework-eps.scm Mon Jul 11 12:51:13 2005 @@ -60,7 +60,7 @@ (display (format "@image{~a-~a}\n" basename (1+ c)) texi-system-port)) (iota (length stencils))) - (display "@c eof - 'eof' is a Makefile marker; don not remove. " texi-system-port) + (display "@c eof - 'eof' is a Makefile marker; do not remove. " texi-system-port) (display "% eof - 'eof' is Makefile marker; do not remove. " tex-system-port) (dump-infinite-stack-EPS stencils)) Index: lilypond/scm/lily-library.scm diff -u lilypond/scm/lily-library.scm:1.39 lilypond/scm/lily-library.scm:1.40 --- lilypond/scm/lily-library.scm:1.39 Sun Jul 10 11:25:24 2005 +++ lilypond/scm/lily-library.scm Mon Jul 11 12:51:13 2005 @@ -72,16 +72,53 @@ (set! music (func music parser))) toplevel-music-functions) -; (display-scheme-music music) (ly:make-score music)) - (define-public (collect-music-for-book parser music) (collect-scores-for-book parser (scorify-music music parser))) - + +(define-public (print-book-with-defaults parser book) + (let* + ((paper (ly:parser-lookup parser '$defaultpaper)) + (layout (ly:parser-lookup parser '$defaultlayout)) + (count (ly:parser-lookup parser 'book-count)) + (base (ly:parser-output-name parser))) + + (if (not (integer? count)) + (set! count 0)) + + (if (> count 0) + (set! (base (format #f "~a-~a" count)))) + + (ly:parser-define! book-count (1+ count)) + + + (ly:book-process book paper layout base) + )) + +(define-public (print-score-with-defaults parser score) + (let* + ((paper (ly:parser-lookup parser '$defaultpaper)) + (layout (ly:parser-lookup parser '$defaultlayout)) + (layout (ly:parser-lookup parser '$globalheader)) + (count (ly:parser-lookup parser 'book-count))i + (base (ly:parser-output-name parser))) + + (if (not (integer? count)) + (set! count 0)) + + (if (> count 0) + (set! (base (format #f "~a-~a" count)))) + + (ly:parser-define! book-count (1+ count)) + + + (ly:score-process score header paper layout base) + )) + ;;;;;;;;;;;;;;;; -; alist +;; alist (define-public assoc-get ly:assoc-get) (define-public (uniqued-alist alist acc) Index: lilypond/scm/safe-lily.scm diff -u lilypond/scm/safe-lily.scm:1.32 lilypond/scm/safe-lily.scm:1.33 --- lilypond/scm/safe-lily.scm:1.32 Sun Jul 10 11:25:24 2005 +++ lilypond/scm/safe-lily.scm Mon Jul 11 12:51:13 2005 @@ -108,8 +108,6 @@ ly:output-def-lookup ly:parse-string ly:parser-parse-string - ly:parser-print-book - ly:parser-print-score ly:pitch-alteration ly:pitch-diff ly:pitch-notename Index: lilypond/scripts/lilypond-book.py diff -u lilypond/scripts/lilypond-book.py:1.267 lilypond/scripts/lilypond-book.py:1.268 --- lilypond/scripts/lilypond-book.py:1.267 Sun Jul 10 11:25:24 2005 +++ lilypond/scripts/lilypond-book.py Mon Jul 11 12:51:13 2005 @@ -551,9 +551,9 @@ PREAMBLE_LY = r'''%%%% Generated by %(program_name)s %%%% Options: [%(option_string)s] -#(set! toplevel-score-handler ly:parser-print-score) +#(set! toplevel-score-handler print-score-with-defaults) #(set! toplevel-music-handler (lambda (p m) - (ly:parser-print-score + (print-score-with-defaults p (scorify-music m p)))) #(ly:set-option (quote no-point-and-click)) _______________________________________________ Lilypond-cvs mailing list Lilypond-cvs@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-cvs