>From d07fb2e8ae791f6e2846db942515d5a4de8f9de2 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 2 Jul 2009 11:17:35 +0200 Subject: [PATCH] Add backend warning/error switch for svg. Fixes exit upon missing function. This allows for easy backend testing doing something like lilypond -dbackend=svg -dwarning-as-error=#t input/typography-demo.ly --- lily/program-option-scheme.cc | 2 ++ scm/lily.scm | 2 ++ scm/output-svg.scm | 29 ++++++++++++++++++++--------- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/lily/program-option-scheme.cc b/lily/program-option-scheme.cc index 1e03c5f..5ea08fd 100644 --- a/lily/program-option-scheme.cc +++ b/lily/program-option-scheme.cc @@ -113,6 +113,8 @@ internal_set_option (SCM var, relative_includes = to_boolean (val); val = scm_from_bool (to_boolean (val)); } + else if (var == ly_symbol2scm ("warning-as-error")) + val = scm_from_bool (to_boolean (val)); scm_hashq_set_x (option_hash, var, val); } diff --git a/scm/lily.scm b/scm/lily.scm index d62c70b..7528a28 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -152,6 +152,8 @@ second. Dump results to `FILE.stacks' and "List available font names.") (verbose ,(ly:command-line-verbose?) "Value of the --verbose flag (read-only).") + (warning-as-error #f +"Exit upon warning.") )) ;; Need to do this in the beginning. Other parts of the Scheme diff --git a/scm/output-svg.scm b/scm/output-svg.scm index 80199a1..278a804 100644 --- a/scm/output-svg.scm +++ b/scm/output-svg.scm @@ -24,6 +24,7 @@ (guile) (ice-9 regex) (ice-9 format) + (ice-9 optargs) (lily) (srfi srfi-1) (srfi srfi-13)) @@ -173,14 +174,24 @@ ;;; catch-all for missing stuff ;;; comment this out to see find out what functions you miss :-) -(if #f - (begin - (define (dummy . foo) "") - (map (lambda (x) (module-define! this-module x dummy)) - (append - (ly:all-stencil-expressions) - (ly:all-output-backend-commands))) - )) + ;; FIXME: share with other output-* backends + (define (missing-function type name) + (apply + (if (ly:get-option 'warning-as-error) ly:error ly:warning) + (list (_ "missing: ~S: ~S") type name))) + (define (missing-stencil-expression name) + (missing-function 'stencil-expression name)) + (define (missing-backend-command name) + (missing-function 'backend-command name)) + + (map (lambda (x) (module-define! + (current-module) + x (lambda* (#:optional y . z) (missing-stencil-expression x)))) + (ly:all-stencil-expressions)) + (map (lambda (x) (module-define! + (current-module) + x (lambda* (#:optional y . z) (missing-backend-command x)))) + (ly:all-output-backend-commands)) (define (url-link url x y) (string-append @@ -259,7 +270,7 @@ (define-public (comment s) (string-append "\n")) -(define (draw-line thick x1 y1 x2 y2 . alist) +(define (xdraw-line thick x1 y1 x2 y2 . alist) (apply entity 'line "" (append -- 1.6.0.rc1.49.g98a8