From: Han-Wen Nienhuys Date: Wed, 29 Dec 2004 12:33:02 +0000 (+0000) Subject: * scripts/lilypond-book.py (process_snippets): add texstr support. X-Git-Tag: release/2.5.14~342 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=60a74756b1d3753b75ce535d08893846af145ec5;p=lilypond.git * scripts/lilypond-book.py (process_snippets): add texstr support. * scm/framework-texstr.scm (header): change extension to .textmetrics * lily/lily-parser.cc (parse_file): do try_load_text_metrics for -f tex. * lily/text-metrics.cc: new file. (try_load_text_metrics): new function --- diff --git a/ChangeLog b/ChangeLog index 49a40f4bd3..9200ad6054 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2004-12-29 Han-Wen Nienhuys + * scripts/lilypond-book.py (process_snippets): add texstr support. + * scm/framework-texstr.scm (header): change extension to .textmetrics * lily/lily-parser.cc (parse_file): do try_load_text_metrics for diff --git a/VERSION b/VERSION index 189da5b16f..41483e3a70 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=5 -PATCH_LEVEL=5 +PATCH_LEVEL=6 MY_PATCH_LEVEL= diff --git a/lily/text-metrics.cc b/lily/text-metrics.cc index c987579e40..604c7ef956 100644 --- a/lily/text-metrics.cc +++ b/lily/text-metrics.cc @@ -13,10 +13,8 @@ static SCM text_dimension_hash_tab; - Box -lookup_tex_text_dimension (Font_metric *font, - SCM text) +lookup_tex_text_dimension (Font_metric *font, SCM text) { Box b; @@ -45,8 +43,6 @@ lookup_tex_text_dimension (Font_metric *font, return b; } - - LY_DEFINE(ly_load_text_dimensions, "ly:load-text-dimensions", 1, 0, 0, (SCM dimension_alist), diff --git a/scm/framework-texstr.scm b/scm/framework-texstr.scm index 9931a81c45..903cd19310 100644 --- a/scm/framework-texstr.scm +++ b/scm/framework-texstr.scm @@ -31,7 +31,18 @@ ") -(define-public (output-framework outputter book scopes fields basename ) +(define-public (output-classic-framework outputter book scopes fields basename) + (let* ((paper (ly:paper-book-paper book)) + (lines (ly:paper-book-systems book)) + ) + (ly:outputter-dump-string outputter (header basename)) + (for-each + (lambda (system) + (ly:outputter-dump-stencil outputter (ly:paper-system-stencil system))) + lines) + (ly:outputter-dump-string outputter (footer)))) + +(define-public (output-framework outputter book scopes fields basename) (let* ((paper (ly:paper-book-paper book)) (pages (ly:paper-book-pages book)) ) diff --git a/scm/output-texstr.scm b/scm/output-texstr.scm index d9cc2e3b77..7b285cf2ba 100644 --- a/scm/output-texstr.scm +++ b/scm/output-texstr.scm @@ -11,7 +11,7 @@ (guile) (ice-9 regex) (srfi srfi-13) - (lily output-tex) + (scm framework-tex) (lily)) (define (dummy . foo) #f) diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index de067edc25..dc5a24cc1c 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -891,7 +891,12 @@ class Lilypond_snippet (Snippet): ok = ok and (os.path.exists (base + '.png') or glob.glob (base + '-page*.png')) return not ok - + def texstr_is_outdated (self): + base = self.basename () + ok = self.ly_is_outdated () + ok = ok and (os.path.exists (base + '.texstr')) + return not ok + def filter_text (self): code = self.substring ('code') s = run_filter (code) @@ -1124,20 +1129,33 @@ def is_derived_class (cl, baseclass): return 1 return 0 -def process_snippets (cmd, ly_snippets, png_snippets): +def process_snippets (cmd, ly_snippets, texstr_snippets, png_snippets): ly_names = filter (lambda x: x, map (Lilypond_snippet.basename, ly_snippets)) + texstr_names = filter (lambda x: x, + map (Lilypond_snippet.basename, texstr_snippets)) png_names = filter (lambda x: x, map (Lilypond_snippet.basename, png_snippets)) status = 0 - if ly_names: - status = ly.system (string.join ([cmd] + ly_names), + def my_system (cmd): + status = ly.system (cmd, ignore_error = 1, progress_p = 1) - if status: - ly.error ('Process %s exited unsuccessfully.' % cmd) - raise Compile_error + if status: + ly.error ('Process %s exited unsuccessfully.' % cmd) + raise Compile_error + + if texstr_names: + my_system (string.join ([cmd + ' -f texstr ' ] + texstr_names)) + for l in texstr_names: + my_system ('latex %s.texstr' % l) + + + if ly_names: + my_system (string.join ([cmd] + ly_names)) + + if format == HTML or format == TEXINFO: for i in png_names: @@ -1213,6 +1231,11 @@ def do_process_cmd (chunks): Lilypond_snippet) and x.ly_is_outdated (), chunks) + texstr_outdated = \ + filter (lambda x: is_derived_class (x.__class__, + Lilypond_snippet) + and x.texstr_is_outdated (), + chunks) png_outdated = \ filter (lambda x: is_derived_class (x.__class__, Lilypond_snippet) @@ -1225,7 +1248,7 @@ def do_process_cmd (chunks): if ly_outdated: ly.progress (_ ("Processing...\n")) - process_snippets (process_cmd, ly_outdated, png_outdated) + process_snippets (process_cmd, ly_outdated, texstr_outdated, png_outdated) else: ly.progress (_ ("All snippets are up to date...")) ly.progress ('\n') @@ -1414,7 +1437,7 @@ def main (): files = do_options () global process_cmd if process_cmd == '': - process_cmd = lilypond_binary + ' -f tex' + process_cmd = lilypond_binary if process_cmd: process_cmd += string.join ([(' -I %s' % p)