From: Han-Wen Nienhuys Date: Sun, 28 May 2006 22:40:50 +0000 (+0000) Subject: * scm/stencil.scm (write-system-signature): better escaping. X-Git-Tag: release/2.9.7~16 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=101b5dbd7018e185fb64c8dbd7589aec99395605;p=lilypond.git * scm/stencil.scm (write-system-signature): better escaping. * scm/framework-ps.scm (output-framework): dump-signatures support for plain output. * GNUmakefile.in: create web-signature-root/ too * make/lilypond-vars.make (LILYPOND_BOOK_FLAGS): add -ddump-signatures. * scm/framework-ps.scm (write-preamble): redefine mark_URI to nop for -dno-point-and-click --- diff --git a/ChangeLog b/ChangeLog index b2820535f2..f91581a814 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2006-05-29 Han-Wen Nienhuys + * scm/stencil.scm (write-system-signature): better escaping. + + * scm/framework-ps.scm (output-framework): dump-signatures support + for plain output. + + * GNUmakefile.in: create web-signature-root/ too + + * make/lilypond-vars.make (LILYPOND_BOOK_FLAGS): add -ddump-signatures. + * scm/framework-ps.scm (write-preamble): redefine mark_URI to nop for -dno-point-and-click diff --git a/GNUmakefile.in b/GNUmakefile.in index 8a7becf1a6..2506689861 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -76,18 +76,25 @@ local-WWW-post: cd $(top-build-dir) && find Documentation input \ $(web-ext:%=-path '*/out-www/*.%' -or) -type l \ > $(outdir)/weblist + cd $(top-build-dir) && find Documentation input \ + -path '*/out-www/*.signature' \ + > $(outdir)/siglist ls $(outdir)/*.html >> $(outdir)/weblist ## rewrite file names so we lose out-www rm -rf $(outdir)/web-root/ - mkdir $(outdir)/web-root/ + mkdir $(outdir)/web-root/ $(outdir)/web-signature-root/ cat $(outdir)/weblist | (cd $(top-build-dir); tar -cf- -T- ) | \ tar -C $(outdir)/web-root/ -xf - - cd $(outdir)/web-root/ && \ + cat $(outdir)/siglist | (cd $(top-build-dir); tar -cf- -T- ) | \ + tar -C $(outdir)/web-signature-root/ -xf - + for dir in $(outdir)/web-root/ $(outdir)/web-signature-root/ ; do \ + cd $$dir && \ for a in `find . -name out-www`; do \ rsync -a --link-dest $$a/ $$a/ $$a/.. ; \ rm -rf $$a ; \ - done + done \ + done tree-prefix = $(outdir) tree-bin = $(tree-prefix)/bin diff --git a/make/lilypond-vars.make b/make/lilypond-vars.make index 9f6ef3f97e..1dd53512b8 100644 --- a/make/lilypond-vars.make +++ b/make/lilypond-vars.make @@ -25,7 +25,7 @@ CONVERT_LY = $(script-dir)/convert-ly.py LILYPOND_BOOK = $(script-dir)/lilypond-book.py LILYPOND_BOOK_INCLUDES = -I $(src-dir)/ -I $(outdir) -I $(input-dir) -I $(input-dir)/regression/ -I $(input-dir)/test/ -I $(input-dir)/tutorial/ -I $(top-build-dir)/mf/$(outconfbase)/ -I $(top-build-dir)/mf/out/ LILYPOND_BOOK_LILYPOND_FLAGS=-dgs-font-load -LILYPOND_BOOK_FLAGS = --process="$(LILYPOND_BINARY) --backend=eps --formats=ps,png --header=texidoc -I $(top-src-dir)/input/test -dinternal-type-checking -danti-alias-factor=2 $(LILYPOND_BOOK_LILYPOND_FLAGS)" +LILYPOND_BOOK_FLAGS = --process="$(LILYPOND_BINARY) --backend=eps --formats=ps,png --header=texidoc -I $(top-src-dir)/input/test -dinternal-type-checking -ddump-signatures -danti-alias-factor=2 $(LILYPOND_BOOK_LILYPOND_FLAGS)" TEXINPUTS=$(top-src-dir)/tex/:: export TEXINPUTS diff --git a/scm/framework-eps.scm b/scm/framework-eps.scm index 13874d2af7..930ac51bf1 100644 --- a/scm/framework-eps.scm +++ b/scm/framework-eps.scm @@ -96,16 +96,6 @@ stencil, so LaTeX includegraphics doesn't fuck up the alignment." (format "~a.eps" basename) (ly:output-formats))) -(define (write-system-signatures basename paper-systems count) - (if (pair? paper-systems) - (begin - (let* - ((outname (format "~a-~a.signature" basename count)) ) - - (ly:message "writing ~a" outname) - (write-system-signature outname (car paper-systems)) - (write-system-signatures basename (cdr paper-systems) (1+ count)))))) - (define-public (output-classic-framework basename book scopes fields) (output-scopes scopes fields basename) diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 3a95c5166d..bf794c3a74 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -446,6 +446,7 @@ (open-file filename "wb") "ps")) (paper (ly:paper-book-paper book)) + (systems (ly:paper-book-systems book)) (page-stencils (map page-stencil (ly:paper-book-pages book))) (landscape? (eq? (ly:output-def-lookup paper 'landscape) #t)) @@ -453,6 +454,9 @@ (page-count (length page-stencils)) (port (ly:outputter-port outputter))) + (if (ly:get-option 'dump-signatures) + (write-system-signatures basename (ly:paper-book-systems book) 0)) + (output-scopes scopes fields basename) (display (file-header paper page-count #t) port) diff --git a/scm/lily-library.scm b/scm/lily-library.scm index 8ba25d5347..d178c6926c 100644 --- a/scm/lily-library.scm +++ b/scm/lily-library.scm @@ -428,6 +428,7 @@ possibly turned off." (define matches '()) (define end-of-prev-match 0) (define (notice match) + (set! matches (cons (substring (match:string match) end-of-prev-match (match:start match)) diff --git a/scm/stencil.scm b/scm/stencil.scm index fdbefd1f0f..6b13e72d04 100644 --- a/scm/stencil.scm +++ b/scm/stencil.scm @@ -269,6 +269,18 @@ grestore (ly:make-stencil "" '(0 . 0) '(0 . 0))) )) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; output signatures. +(define-public (write-system-signatures basename paper-systems count) + (if (pair? paper-systems) + (begin + (let* + ((outname (format "~a-~a.signature" basename count)) ) + + (ly:message "writing ~a" outname) + (write-system-signature outname (car paper-systems)) + (write-system-signatures basename (cdr paper-systems) (1+ count)))))) + (define-public (write-system-signature filename paper-system) (define (float? x) @@ -276,9 +288,11 @@ grestore (define system-grob (paper-system-system-grob paper-system)) + (define output (open-output-file filename)) (define (strip-floats expr) + "Replace floats by #f" (cond ((float? expr) #f) ((ly:font-metric? expr) (ly:font-name expr)) @@ -287,6 +301,7 @@ grestore (else expr))) (define (fold-false-pairs expr) + "Try to remove lists of #f as much as possible." (if (pair? expr) (let* ((first (car expr)) @@ -307,7 +322,8 @@ grestore (else #f)))) (define (pythonic-string expr) - (string-regexp-substitute "'" "\\'" (format "~a" expr))) + "escape quotes and slashes for python consumption" + (regexp-substitute/global #f "([\\\\'\"])" (format "~a" expr) 'pre "\\" 1 'post)) (define (pythonic-pair expr) (format "(~a,~a)" @@ -342,7 +358,9 @@ grestore (define (interpret-for-signature escape collect expr) (define (interpret expr) (let* - ((head (car expr))) + ((head (if (pair? expr) + (car expr) + #f))) (cond ((eq? head 'grob-cause) (escape (cdr expr))) @@ -358,6 +376,8 @@ grestore (interpret expr)) + (display (format "# Output signature\n# Generated by LilyPond ~a\n" (lilypond-version)) + output) (interpret-for-signature found-grob (lambda (x) #f) (ly:stencil-expr (paper-system-stencil paper-system))))