CVSROOT:        /cvsroot/lilypond
Module name:    lilypond
Branch:         
Changes by:     Graham Percival <[EMAIL PROTECTED]>     05/08/02 07:46:58

Modified files:
        .              : ChangeLog 
        Documentation/user: global.itely 
        lily           : lily-parser.cc parser.yy 
        lily/include   : lily-parser.hh 
        ly             : init.ly 
        scm            : lily-library.scm 

Log message:
        Yoshinobu Ishizaki's multiple header definition patch.  Thanks!

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3940&tr2=1.3941&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/Documentation/user/global.itely.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/lily-parser.cc.diff?tr1=1.45&tr2=1.46&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/parser.yy.diff?tr1=1.484&tr2=1.485&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/lily-parser.hh.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ly/init.ly.diff?tr1=1.79&tr2=1.80&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/lily-library.scm.diff?tr1=1.45&tr2=1.46&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3940 lilypond/ChangeLog:1.3941
--- lilypond/ChangeLog:1.3940   Mon Aug  1 20:15:09 2005
+++ lilypond/ChangeLog  Tue Aug  2 07:46:56 2005
@@ -1,3 +1,18 @@
+2005-08-02  Yoshinobu Ishizaki  <[EMAIL PROTECTED]>
+
+       * lily/lily-parser.cc (get_header): new function. Enable multiple
+       \header definitions.
+
+       * lily/parser.yy (lilypond_header_body): use get_header.
+
+       * ly/init.ly:
+       * scm/lily-library.scm (print-score-with-defaults): renamed
+       $globalheader to $defaultheader
+        
+       * Documentation/user/global.itely (Creating titles): added short
+       explanation that multiple headers are useable.
+
+
 2005-08-01  Han-Wen Nienhuys  <[EMAIL PROTECTED]>
 
        * lily/module-scheme.cc (LY_DEFINE): new file. 
Index: lilypond/Documentation/user/global.itely
diff -u lilypond/Documentation/user/global.itely:1.27 
lilypond/Documentation/user/global.itely:1.28
--- lilypond/Documentation/user/global.itely:1.27       Thu Jul 28 05:59:37 2005
+++ lilypond/Documentation/user/global.itely    Tue Aug  2 07:46:57 2005
@@ -943,6 +943,25 @@
 }
 @end lilypond
 
+As demonstrated before, you can use multiple @code{\header} blocks. 
+When same fields appear in different blocks, the latter is used.  
+Here is a short example.
+
[EMAIL PROTECTED] 
+\header @{
+  composer = "Composer"
[EMAIL PROTECTED]
+\header @{
+  title = "Title"
[EMAIL PROTECTED]
+\score @{
+  \new Staff @{ c'4 @}
+  \header @{
+    title = "New title" %overwrite previous one
+  @}
[EMAIL PROTECTED]
[EMAIL PROTECTED] example
+
 A more advanced option is to change the definitions of the following
 variables in the @code{\paper} block.  The init file
 @file{ly/titling-init.ly} lists the default layout.
Index: lilypond/lily/include/lily-parser.hh
diff -u lilypond/lily/include/lily-parser.hh:1.9 
lilypond/lily/include/lily-parser.hh:1.10
--- lilypond/lily/include/lily-parser.hh:1.9    Mon Jul 11 12:59:29 2005
+++ lilypond/lily/include/lily-parser.hh        Tue Aug  2 07:46:58 2005
@@ -72,5 +72,6 @@
 Output_def *get_layout (Lily_parser *parser);
 Output_def *get_midi (Lily_parser *parser);
 Output_def *get_paper (Lily_parser *parser);
+SCM get_header(Lily_parser *parser);
 
 #endif /* LILY_PARSER_HH */
Index: lilypond/lily/lily-parser.cc
diff -u lilypond/lily/lily-parser.cc:1.45 lilypond/lily/lily-parser.cc:1.46
--- lilypond/lily/lily-parser.cc:1.45   Sun Jul 24 15:30:02 2005
+++ lilypond/lily/lily-parser.cc        Tue Aug  2 07:46:58 2005
@@ -215,3 +215,12 @@
   return layout;
 }
 
+SCM
+get_header(Lily_parser *parser)
+{
+  SCM id = parser->lexer_->lookup_identifier("$defaultheader");
+  if (!ly_is_module (id))
+    id = ly_make_anonymous_module (be_safe_global);
+
+  return id;
+}
Index: lilypond/lily/parser.yy
diff -u lilypond/lily/parser.yy:1.484 lilypond/lily/parser.yy:1.485
--- lilypond/lily/parser.yy:1.484       Sun Jul 24 19:31:02 2005
+++ lilypond/lily/parser.yy     Tue Aug  2 07:46:58 2005
@@ -568,7 +568,7 @@
 
 toplevel_expression:
        lilypond_header {
-               THIS->lexer_->set_identifier (ly_symbol2scm ("$globalheader"), 
$1);
+               THIS->lexer_->set_identifier (ly_symbol2scm ("$defaultheader"), 
$1);
        }
        | add_quote {
        
@@ -625,7 +625,7 @@
 
 lilypond_header_body:
        {
-               $$ = ly_make_anonymous_module (be_safe_global);
+               $$ = get_header(THIS);
                THIS->lexer_->add_scope ($$);
        }
        | lilypond_header_body assignment  {
@@ -754,7 +754,7 @@
                $$->set_spot (@$);
                $$->paper_ = dynamic_cast<Output_def*> (unsmob_output_def 
(THIS->lexer_->lookup_identifier ("$defaultpaper"))->clone ());
                $$->paper_->unprotect ();
-               $$->header_ = THIS->lexer_->lookup_identifier 
("$globalheader"); 
+               $$->header_ = THIS->lexer_->lookup_identifier 
("$defaultheader"); 
        }
        | book_body paper_block {
                $$->paper_ = $2;
Index: lilypond/ly/init.ly
diff -u lilypond/ly/init.ly:1.79 lilypond/ly/init.ly:1.80
--- lilypond/ly/init.ly:1.79    Mon Jul 11 12:59:29 2005
+++ lilypond/ly/init.ly Tue Aug  2 07:46:58 2005
@@ -15,7 +15,7 @@
 #(ly:set-option 'old-relative #f)
 #(define toplevel-scores '())
 #(define output-count 0) 
-#(define $globalheader #f)
+#(define $defaultheader #f)
 #(define version-seen? #f)
 
 \maininput
@@ -37,4 +37,4 @@
 #(if (pair? toplevel-scores)
   (toplevel-book-handler
    parser
-   (apply ly:make-book $defaultpaper $globalheader toplevel-scores)))
+   (apply ly:make-book $defaultpaper $defaultheader toplevel-scores)))
Index: lilypond/scm/lily-library.scm
diff -u lilypond/scm/lily-library.scm:1.45 lilypond/scm/lily-library.scm:1.46
--- lilypond/scm/lily-library.scm:1.45  Sat Jul 16 12:23:33 2005
+++ lilypond/scm/lily-library.scm       Tue Aug  2 07:46:58 2005
@@ -43,19 +43,19 @@
 
 ;; parser stuff.
 (define-public (print-music-as-book parser music)
-  (let* ((head (ly:parser-lookup parser '$globalheader))
+  (let* ((head (ly:parser-lookup parser '$defaultheader))
         (book (ly:make-book (ly:parser-lookup parser $defaultpaper)
                             head score)))
     (ly:parser-print-book parser book)))
 
 (define-public (print-score-as-book parser score)
-  (let* ((head (ly:parser-lookup parser '$globalheader))
+  (let* ((head (ly:parser-lookup parser '$defaultheader))
         (book (ly:make-book (ly:parser-lookup parser $defaultpaper)
                             head score)))
     (ly:parser-print-book parser book)))
 
 (define-public (print-score parser score)
-  (let* ((head (ly:parser-lookup parser '$globalheader))
+  (let* ((head (ly:parser-lookup parser '$defaultheader))
         (book (ly:make-book (ly:parser-lookup parser $defaultpaper)
                             head score)))
     (ly:parser-print-score parser book)))
@@ -100,7 +100,7 @@
   (let*
       ((paper (ly:parser-lookup parser '$defaultpaper))
        (layout (ly:parser-lookup parser '$defaultlayout))
-       (header (ly:parser-lookup parser '$globalheader))
+       (header (ly:parser-lookup parser '$defaultheader))
        (count (ly:parser-lookup parser 'output-count))
        (base (ly:parser-output-name parser)))
 


_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to