From: Han-Wen Nienhuys Date: Sat, 27 May 2006 01:07:55 +0000 (+0000) Subject: (write-system-signature): new routine: write X-Git-Tag: release/2.9.7~26 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f82f9474b9b2852084b42b2e79e2743a90769167;p=lilypond.git (write-system-signature): new routine: write python parseable signature of a separate paper system. --- diff --git a/ChangeLog b/ChangeLog index 25f254c581..2aaa733ddf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-05-27 Han-Wen Nienhuys + + * scm/stencil.scm (write-system-signature): new routine: write + python parseable signature of a separate paper system. + 2006-05-26 Han-Wen Nienhuys * lily/stanza-number-engraver.cc (process_music): use is_markup() diff --git a/VERSION b/VERSION index eeddea6bb5..404fb35970 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=9 -PATCH_LEVEL=6 +PATCH_LEVEL=7 MY_PATCH_LEVEL= diff --git a/input/regression/figured-bass.ly b/input/regression/figured-bass.ly index 9ff2e5224e..6b45751850 100644 --- a/input/regression/figured-bass.ly +++ b/input/regression/figured-bass.ly @@ -31,6 +31,7 @@ You can also enter markup strings. The vertical alignment may also be tuned. <3+ 5- 7!> <3 _! 5 _- 7> <3 _ 5 _ 7> + <3 6/ > <"V7" ["bla" 6] \markup{ \musicglyph #"rests.2"} > \once \override BassFigureAlignment #'stacking-dir = #UP diff --git a/lily/figured-bass-engraver.cc b/lily/figured-bass-engraver.cc index d6c5f78c26..158959eda8 100644 --- a/lily/figured-bass-engraver.cc +++ b/lily/figured-bass-engraver.cc @@ -278,6 +278,7 @@ Figured_bass_engraver::process_music () { if (to_boolean (get_property ("figuredBassCenterContinuations"))) center_repeated_continuations (); + alignment_ = 0; for (vsize i = 0; i < groups_.size (); i++) { diff --git a/lily/grob-scheme.cc b/lily/grob-scheme.cc index d510a11bcb..c8bdc2c828 100644 --- a/lily/grob-scheme.cc +++ b/lily/grob-scheme.cc @@ -9,7 +9,7 @@ #include "grob.hh" -#include "warn.hh" +#include "warn.hh" // error() #include "item.hh" #include "output-def.hh" #include "system.hh" diff --git a/lily/input-scheme.cc b/lily/input-scheme.cc index a13ca876e7..6e954ef162 100644 --- a/lily/input-scheme.cc +++ b/lily/input-scheme.cc @@ -13,7 +13,7 @@ implemented separately from the class. */ LY_DEFINE (ly_input, "ly:input-location?", 1, 0, 0, (SCM x), - "Return #t if @var{x} is an input location.") + "Is @var{x} an @code{input-location}?") { return unsmob_input (x) ? SCM_BOOL_T : SCM_BOOL_F; } @@ -34,13 +34,18 @@ LY_DEFINE (ly_input_message, "ly:input-message", 2, 0, 1, (SCM sip, SCM msg, SCM return SCM_UNSPECIFIED; } -LY_DEFINE (ly_input_file_line_column, "ly:input-file-line-char-column", 1, 0, 0, (SCM sip), + +LY_DEFINE (ly_input_file_line_column, + "ly:input-file-line-char-column", + 1, 0, 0, (SCM sip), "Return input location in @var{sip} as (file-name line char column).") { Input *ip = unsmob_input (sip); SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location"); - int l, ch, col; + int l = 0; + int ch = 0; + int col = 0; ip->get_counts (&l, &ch, &col); return scm_list_4 (scm_makfrom0str (ip->file_string ().c_str ()), scm_from_int (l), @@ -48,8 +53,11 @@ LY_DEFINE (ly_input_file_line_column, "ly:input-file-line-char-column", 1, 0, 0, scm_from_int (col)); } -LY_DEFINE (ly_input_both_locations, "ly:input-both-locations", 1, 0, 0, (SCM sip), - "Return input location in @var{sip} as (file-name first-line first-column last-line last-column).") +LY_DEFINE (ly_input_both_locations, + "ly:input-both-locations", + 1, 0, 0, (SCM sip), + "Return input location in @var{sip} as " + "(file-name first-line first-column last-line last-column).") { Input *ip = unsmob_input (sip); SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location"); diff --git a/scm/framework-eps.scm b/scm/framework-eps.scm index 9a7036df36..18464278dd 100644 --- a/scm/framework-eps.scm +++ b/scm/framework-eps.scm @@ -95,8 +95,22 @@ stencil, so LaTeX includegraphics doesn't fuck up the alignment." (postprocess-output book framework-eps-module (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) + + (write-system-signatures basename (ly:paper-book-systems book) 0) (dump-stencils-as-EPSes (map paper-system-stencil (ly:paper-book-systems book)) diff --git a/scm/layout-page-layout.scm b/scm/layout-page-layout.scm index a0a35027a3..8a7628af85 100644 --- a/scm/layout-page-layout.scm +++ b/scm/layout-page-layout.scm @@ -318,7 +318,7 @@ is what have collected so far, and has ascending page numbers." (cons force positions))) - (define (walk-paths done-lines best-paths current-lines last? current-best) + (define (walk-paths done-lines best-paths current-lines last? current-best) "Return the best optimal-page-break-node that contains CURRENT-LINES. DONE-LINES.reversed ++ CURRENT-LINES is a consecutive ascending range of lines, and BEST-PATHS contains the optimal breaks @@ -343,6 +343,7 @@ CURRENT-BEST is the best result sofar, or #f." last?))) (height (page-printable-height this-page)) (vertical-spacing (space-systems height current-lines ragged?)) + (satisfied-constraints (car vertical-spacing)) (force (if satisfied-constraints (if (and last? ragged-last?) diff --git a/scm/paper-system.scm b/scm/paper-system.scm index 70985aae66..d414285d9d 100644 --- a/scm/paper-system.scm +++ b/scm/paper-system.scm @@ -17,6 +17,9 @@ (define-public (paper-system-stencil system) (ly:prob-property system 'stencil)) +(define-public (paper-system-system-grob paper-system) + (ly:prob-property paper-system 'system-grob)) + (define-public (paper-system-extent system axis) (ly:stencil-extent (paper-system-stencil system) axis)) diff --git a/scm/stencil.scm b/scm/stencil.scm index cdac70fcc8..539b9c849b 100644 --- a/scm/stencil.scm +++ b/scm/stencil.scm @@ -268,3 +268,96 @@ grestore (ly:make-stencil "" '(0 . 0) '(0 . 0))) )) + + +(define-public (write-system-signature filename paper-system) + (define (float? x) + (and (number? x) (inexact? x))) + + (define system-grob + (paper-system-system-grob paper-system)) + (define output (open-output-file filename)) + + (define (strip-floats expr) + (cond + ((float? expr) #f) + ((ly:font-metric? expr) (ly:font-name expr)) + ((pair? expr) (cons (strip-floats (car expr)) + (strip-floats (cdr expr)))) + (else expr))) + + (define (fold-false-pairs expr) + (if (pair? expr) + (let* + ((first (car expr)) + (rest (fold-false-pairs (cdr expr)))) + + (if first + (cons (fold-false-pairs first) rest) + rest)) + expr)) + + (define (music-cause grob) + (let* + ((cause (ly:grob-property grob 'cause))) + + (cond + ((ly:music? cause) cause) + ((ly:grob? cause) (music-cause cause)) + (else #f)))) + + (define (pythonic-string expr) + (string-regexp-substitute "'" "\\'" (format "~a" expr))) + + (define (pythonic-pair expr) + (format "(~a,~a)" + (car expr) (cdr expr))) + + (define (found-grob expr) + (let* + ((grob (car expr)) + (rest (cdr expr)) + (collected '()) + (cause (music-cause grob)) + (input (if (ly:music? cause) (ly:music-property cause 'origin) #f)) + (location (if (ly:input-location? input) (ly:input-file-line-char-column input) '())) + + (x-ext (ly:grob-extent grob system-grob X)) + (y-ext (ly:grob-extent grob system-grob Y)) + ) + + (interpret-for-signature #f (lambda (e) + (set! collected (cons e collected))) + rest) + + (format output + "['~a', '~a', ~a, ~a, '~a'],\n" + (cdr (assq 'name (ly:grob-property grob 'meta) )) + (pythonic-string location) + (pythonic-pair (if (interval-empty? x-ext) '(0 . 0) x-ext)) + (pythonic-pair (if (interval-empty? y-ext) '(0 . 0) y-ext)) + (pythonic-string collected)) + )) + + (define (interpret-for-signature escape collect expr) + (define (interpret expr) + (let* + ((head (car expr))) + + (cond + ((eq? head 'grob-cause) (escape (cdr expr))) + ((eq? head 'color) (interpret (caddr expr))) + ((eq? head 'rotate-stencil) (interpret (caddr expr))) + ((eq? head 'translate-stencil) (interpret (caddr expr))) + ((eq? head 'combine-stencil) + (for-each (lambda (e) (interpret e)) (cdr expr))) + (else + (collect (ffold-false-pairs (strip-floats expr)))) + + ))) + + (interpret expr)) + + (interpret-for-signature found-grob (lambda (x) #f) + (ly:stencil-expr + (paper-system-stencil paper-system)))) diff --git a/scripts/midi2ly.py b/scripts/midi2ly.py index 364e37f375..256063d679 100644 --- a/scripts/midi2ly.py +++ b/scripts/midi2ly.py @@ -25,7 +25,6 @@ import os import string import sys - ################################################################ # Users of python modules should include this snippet. #