]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix handling of missing stencil expressions
authorPatrick McCarty <pnorcks@gmail.com>
Sun, 2 Aug 2009 09:37:41 +0000 (02:37 -0700)
committerPatrick McCarty <pnorcks@gmail.com>
Sun, 2 Aug 2009 09:49:57 +0000 (02:49 -0700)
I had not tested the case of multiple \book blocks.

For example, in output-ps.scm a warning is assigned for "utf-8-string",
but this assignment persists for the next \book block, which is
undesirable; the assignments are only supposed to be used while the
stencils are being dumped with the outputter.

This patch removes the "missing" stencil expressions from the
output-module when the outputter is closed.

lily/paper-outputter.cc
scm/backend-library.scm

index 3f98b8eb869322c294e42ddfcf935f754113bb92..d366426093afcd737672c2cd38a6f46a93360303 100644 (file)
@@ -112,5 +112,14 @@ void
 Paper_outputter::close ()
 {
   if (scm_port_p (file_) == SCM_BOOL_T)
-    scm_close_port (file_);
+    {
+      scm_close_port (file_);
+      /*
+       Remove the "warning" definitions for missing stencil
+       expressions so that we start fresh with the next \book
+       block.  --pmccarty
+      */
+      SCM proc = ly_lily_module_constant ("remove-stencil-warnings");
+      scm_call_1 (proc, output_module_);
+    }
 }
index a985cbb4874738c6cb84b818ff435ce2ef72ea0c..9fa094f51892e3eb0e0cad2186c1922ba97bf0b3 100644 (file)
       scope)))
   (apply string-append (map output-scope scopes)))
 
+(define missing-stencil-list '())
+
 (define-public (backend-testing output-module)
   (define (missing-stencil-expression name)
     (begin
 
   (map (lambda (x)
         (if (not (module-defined? output-module x))
-            (module-define! output-module x
-                            (lambda* (#:optional y . z)
-                              (missing-stencil-expression x)))))
+            (begin
+              (module-define! output-module x
+                              (lambda* (#:optional y . z)
+                                (missing-stencil-expression x)))
+              (set! missing-stencil-list (append (list x)
+                                                 missing-stencil-list)))))
        (ly:all-stencil-commands)))
+
+(define-public (remove-stencil-warnings output-module)
+  (for-each
+    (lambda (x)
+      (module-remove! output-module x))
+    missing-stencil-list))