From eb4d92fc2b3eaa7cae8a08b311fa0139f0b2d7b1 Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Sun, 2 Aug 2009 02:37:41 -0700 Subject: [PATCH] Fix handling of missing stencil expressions 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 | 11 ++++++++++- scm/backend-library.scm | 17 ++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 3f98b8eb86..d366426093 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -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_); + } } diff --git a/scm/backend-library.scm b/scm/backend-library.scm index a985cbb487..9fa094f518 100644 --- a/scm/backend-library.scm +++ b/scm/backend-library.scm @@ -190,6 +190,8 @@ scope))) (apply string-append (map output-scope scopes))) +(define missing-stencil-list '()) + (define-public (backend-testing output-module) (define (missing-stencil-expression name) (begin @@ -198,7 +200,16 @@ (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)) -- 2.39.5