From 3a6b84e918bf26c035813545fe82940b7ee5ac73 Mon Sep 17 00:00:00 2001 From: hanwen Date: Tue, 14 Jun 2005 00:19:37 +0000 Subject: [PATCH] * lily/main.cc (parse_argv): only set output format to pdf if no other format specified. * scm/backend-library.scm (postprocess-output): process 'delete-intermediate-files after running convert-to-*. This fixes PNG generation when 'delete-intermediate-files is set. --- ChangeLog | 9 +++++++++ lily/main.cc | 5 ++++- scm/backend-library.scm | 30 ++++++++++++++++++++++-------- scm/framework-ps.scm | 6 +++--- scm/framework-tex.scm | 1 + 5 files changed, 39 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index b153f02de0..b65c31c4f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-06-14 Han-Wen Nienhuys + + * lily/main.cc (parse_argv): only set output format to pdf if no + other format specified. + + * scm/backend-library.scm (postprocess-output): process + 'delete-intermediate-files after running convert-to-*. This fixes + PNG generation when 'delete-intermediate-files is set. + 2005-06-13 Han-Wen Nienhuys * buildscripts/mutopia-index.py (list_item): thinko. Fixes png diff --git a/lily/main.cc b/lily/main.cc index 02d399aefe..1efd32303b 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -56,7 +56,7 @@ String init_name_global; One of (gnome, ps [default], scm, svg, tex, texstr)") */ String output_backend_global = "ps"; /* Output formats to generate. */ -String output_format_global = "pdf"; +String output_format_global = ""; bool is_pango_format_global; bool is_TeX_format_global; @@ -713,6 +713,9 @@ parse_argv (int argc, char **argv) } } + if (output_format_global == "") + output_format_global = "pdf"; + if (show_help) { identify (stdout); diff --git a/scm/backend-library.scm b/scm/backend-library.scm index edd00941de..bcbcad46b6 100644 --- a/scm/backend-library.scm +++ b/scm/backend-library.scm @@ -82,9 +82,7 @@ (ly:message (_ "Converting to `~a'...") pdf-name) (ly:progress "\n") (ly:system cmd) - - (if (ly:get-option 'delete-intermediate-files) - (delete-file name)))) + )) (use-modules (scm ps-to-png)) (define-public (postscript->png resolution paper-size-name name) @@ -100,11 +98,27 @@ (ly:progress "\n"))) (define-public (postprocess-output paper-book module filename formats) - (for-each - (lambda (f) - ((eval (string->symbol (string-append "convert-to-" f)) module) - paper-book filename)) - formats)) + (let* + ((completed (completize-formats formats)) + (base (string-regexp-substitute "\\.[a-z]+$" "" filename)) + (intermediate (remove + (lambda (x) + (member x formats)) + completed))) + (for-each + (lambda (f) + ((eval (string->symbol (string-append "convert-to-" f)) module) + paper-book filename)) + completed) + + (if (ly:get-option 'delete-intermediate-files) + (for-each + (lambda (f) + (display (string-append base "." f)) + (display "del\n") + (delete-file (string-append base "." f))) + intermediate)) + )) (define-public (completize-formats formats) (define new-fmts '()) diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index b4f23a7416..56bbddc5aa 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -424,7 +424,7 @@ (display "%%Trailer\n%%EOF\n" port) (ly:outputter-close outputter) (postprocess-output book framework-ps-module filename - (completize-formats (ly:output-formats))))) + (ly:output-formats)))) (if (not (defined? 'nan?)) (define (nan? x) #f)) @@ -501,7 +501,7 @@ (postprocess-output book framework-ps-module (format "~a.preview.eps" basename) - (completize-formats (cons "png" (ly:output-formats)))))) + (cons "png" (ly:output-formats))))) (if #f (define-public (output-preview-framework basename book scopes fields) @@ -522,7 +522,7 @@ (postprocess-output book framework-ps-module (format "~a.preview.eps" basename) - (completize-formats (ly:output-formats)))))) + (ly:output-formats))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-public (convert-to-pdf book name) diff --git a/scm/framework-tex.scm b/scm/framework-tex.scm index 55fc402d8c..b8907f76f0 100644 --- a/scm/framework-tex.scm +++ b/scm/framework-tex.scm @@ -371,3 +371,4 @@ (define-public (convert-to-tex book name) #t) + -- 2.39.5