]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/book-paper-def.cc (Book_paper_def): add copy ctor.
authorhanwen <hanwen>
Tue, 18 May 2004 20:36:31 +0000 (20:36 +0000)
committerhanwen <hanwen>
Tue, 18 May 2004 20:36:31 +0000 (20:36 +0000)
* lily/parser.yy (book_paper_head): \bookpaper {}

* python/midi.c: remove config.h

ChangeLog
lily/book-paper-def.cc
lily/include/book-paper-def.hh
lily/my-lily-lexer.cc
lily/parser.yy
python/midi.c

index 05882a70bf2e947bfb7d2eec67a2e820df04ba07..1da111720807aad9f2ff6310d8a2cab15d70308d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-05-18  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * lily/book-paper-def.cc (Book_paper_def): add copy ctor.
+
+       * lily/parser.yy (book_paper_head): \bookpaper {} 
+
+       * python/midi.c: remove config.h
+
 2004-05-18  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * scm/output-gnome.scm: Update.
index ce9d872554fdd78e03e5bc378ef60c7c52482613..7aa837dc90fcef1852499f01068cf8a58bc2c0a9 100644 (file)
@@ -7,6 +7,7 @@
   
 */
 
+#include "ly-module.hh"
 #include "paper-def.hh"
 #include "dimensions.hh"
 #include "book-paper-def.hh"
@@ -22,8 +23,20 @@ Book_paper_def::Book_paper_def ()
 {
   output_scale_ = 1.0;
   scaled_fonts_ = SCM_EOL;
+  scope_ = SCM_EOL;
   smobify_self ();
   scaled_fonts_ = scm_c_make_hash_table (11);
+  scope_ = ly_make_anonymous_module (false); 
+}
+
+Book_paper_def::Book_paper_def (Book_paper_def const & src)
+{
+  scope_ = SCM_EOL;
+  scaled_fonts_ = SCM_EOL;
+  smobify_self ();
+  scope_= ly_make_anonymous_module (false);
+  if (is_module (src.scope_))
+    ly_import_module (scope_, src.scope_);
 }
 
 Book_paper_def::~Book_paper_def ()
@@ -34,6 +47,8 @@ SCM
 Book_paper_def::mark_smob (SCM m)
 {
   Book_paper_def *mo = (Book_paper_def*) SCM_CELL_WORD_1 (m);
+
+  scm_gc_mark (mo->scope_);
   return mo->scaled_fonts_;
 }
 
index 9482335e1e5f6a4ed852f0cbb1e42593010210d9..144df004a72c8571336c3d47d9accff688c826e2 100644 (file)
@@ -19,7 +19,8 @@ class Book_paper_def
 
 public:
   VIRTUAL_COPY_CONSTRUCTOR (Book_paper_def, Book_paper_def);
-  
+  Book_paper_def(Book_paper_def const &);
+  SCM scope_;
   SCM scaled_fonts_;
   Real output_scale_;
 
index 5acae67b8bf6c6b0110d821c7c0d52b72c1115d1..88661b346dcd4512b3a91314c54df3563a919291 100644 (file)
@@ -31,6 +31,7 @@ static Keyword_ent the_key_tab[] = {
   {"alternative", ALTERNATIVE},
   {"bar", BAR},
   {"book", BOOK},
+  {"bookpaper", BOOKPAPER},
   {"change", CHANGE},
   {"chords", CHORDS},
   {"clef", CLEF},
index 96b939419b454645b4ff3ac1621295d700632c57..07562de665ccadd0c3afdc6d8952a1118585fc50 100644 (file)
@@ -194,6 +194,7 @@ of the parse stack onto the heap. */
 
 %union {
        Book *book;
+       Book_paper_def *bookpaper;
        Music_output_def *outputdef;
        SCM scm;
        String *string;
@@ -249,6 +250,7 @@ or
 %token ALTERNATIVE
 %token BAR
 %token BOOK
+%token BOOKPAPER
 %token CHANGE
 %token CHORDMODIFIERS
 %token CHORDS
@@ -362,6 +364,8 @@ or
 %type <scm> markup markup_line markup_list  markup_list_body full_markup
 
 %type <book>   book_block book_body
+%type <bookpaper> book_paper_head book_paper_block book_paper_body
+
 %type <i>      exclamations questions dots optional_rest
 %type <i>      bass_mod
 %type <scm>    oct_check
@@ -477,6 +481,10 @@ toplevel_expression:
                THIS->lexer_->set_identifier (id, $1->self_scm ());
                scm_gc_unprotect_object ($1->self_scm ());
        }
+       | book_paper_block {
+               THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultbookpaper"), $1->self_scm ());
+               scm_gc_unprotect_object ($1->self_scm ());
+       }
        ;
 
 toplevel_music:
@@ -606,6 +614,26 @@ context_def_spec_body:
        }
        ;
 
+
+book_paper_block:
+       book_paper_body '}' {
+               $$ = $1;
+       }
+       ;
+book_paper_head:
+       BOOKPAPER '{' {
+               $$ = unsmob_book_paper_def (THIS->lexer_->lookup_identifier ("$defaultbookpaper"))->clone ();
+               THIS->lexer_->add_scope ($$->scope_);
+       }
+       ;
+
+book_paper_body:
+       book_paper_head
+       | book_paper_body assignment { }
+       ;
+       
+
+
 book_block:
        BOOK {
                THIS->push_spot ();
@@ -623,7 +651,11 @@ book_body:
        {
                $$ = new Book;
                $$->set_spot (THIS->here_input ());
-               $$->bookpaper_ = unsmob_book_paper_def (THIS->lexer_->lookup_identifier ("$defaultbookpaper"));
+               scm_gc_unprotect_object ($$->bookpaper_->self_scm ());
+       }
+       | book_body book_paper_block {
+               $$->bookpaper_ = $2;
+               scm_gc_unprotect_object ($2->self_scm ());
        }
        | book_body score_block {
                Score *score = $2;
@@ -641,6 +673,7 @@ book_body:
                THIS->header_ = $1;
        }
        | book_body error {
+
        }
        ;
 
index f815a2ecba4c8f90bfd28d1b5b224a3180036cab..fc2906cacdb707e91ab86163b2a70209abfb572f 100644 (file)
@@ -18,7 +18,6 @@ midi.parse (s)
 
 */
 
-#include "config.h"
 #include <Python.h>
 
 #if 0