2006-05-29 Han-Wen Nienhuys <hanwen@lilypond.org>
+ * 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
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
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
(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)
(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))
(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)
(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))
(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)
(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))
(else expr)))
(define (fold-false-pairs expr)
+ "Try to remove lists of #f as much as possible."
(if (pair? expr)
(let*
((first (car expr))
(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)"
(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)))
(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))))