X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Flily.scm;h=d15c8bd11aabd0fb6fe60eca55886c002d6a0970;hb=refs%2Ftags%2Frelease%2F1.3.93;hp=7088dd1dabb12dd1cfa6a9b5496f3281a6473764;hpb=0af2486a28f1c60b9de929a9101964d880927e54;p=lilypond.git diff --git a/scm/lily.scm b/scm/lily.scm index 7088dd1dab..d15c8bd11a 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -18,17 +18,22 @@ (use-modules (ice-9 regex)) ;; The regex module may not be available, or may be broken. -;; If you have trouble with regex, define #f -;;(define use-regex #t) -;;(define use-regex #f) - (define use-regex (let ((os (string-downcase (vector-ref (uname) 0)))) (not (equal? "cygwin" (substring os 0 (min 6 (string-length os))))))) +;; If you have trouble with regex, define #f +(define use-regex #t) +;;(define use-regex #f) + ;; do nothing in .scm output (define (comment s) "") +;; URG guile-1.3/1.4 compatibility +(define (ly-eval x) (eval2 x #f)) + +(define (comment s) "") + (define (mm-to-pt x) (* (/ 72.27 25.40) x) ) @@ -81,61 +86,6 @@ (define security-paranoia #f) -;; See documentation of Item::visibility_lambda_ -(define (begin-of-line-visible d) (if (= d 1) '(#f . #f) '(#t . #t))) -(define (spanbar-begin-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f))) -(define (all-visible d) '(#f . #f)) -(define (all-invisible d) '(#t . #t)) -(define (begin-of-line-invisible d) (if (= d 1) '(#t . #t) '(#f . #f))) -(define (end-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f))) - - -(define mark-visibility end-of-line-invisible) - -;; Spacing constants for prefatory matter. -;; -;; rules for this spacing are much more complicated than this. See [Wanske] page 126 -- 134, [Ross] pg 143 -- 147 -;; -;; - -;; (Measured in staff space) -(define space-alist - '( - ((none Instrument_name) . (extra-space 1.0)) - ((Instrument_name Left_edge_item) . (extra-space 1.0)) - ((Left_edge_item Clef_item) . (extra-space 1.0)) - ((Left_edge_item Key_item) . (extra-space 0.0)) - ((Left_edge_item begin-of-note) . (extra-space 1.0)) - ((none Left_edge_item) . (extra-space 0.0)) - ((Left_edge_item Staff_bar) . (extra-space 0.0)) -; ((none Left_edge_item) . (extra-space -15.0)) -; ((none Left_edge_item) . (extra-space -15.0)) - ((none Clef_item) . (minimum-space 1.0)) - ((none Staff_bar) . (minimum-space 0.0)) - ((none Clef_item) . (minimum-space 1.0)) - ((none Key_item) . (minimum-space 0.5)) - ((none Time_signature) . (extra-space 0.0)) - ((none begin-of-note) . (minimum-space 1.5)) - ((Clef_item Key_item) . (minimum-space 4.0)) - ((Key_item Time_signature) . (extra-space 1.0)) - ((Clef_item Time_signature) . (minimum-space 3.5)) - ((Staff_bar Clef_item) . (minimum-space 1.0)) - ((Clef_item Staff_bar) . (minimum-space 3.7)) - ((Time_signature Staff_bar) . (minimum-space 2.0)) - ((Key_item Staff_bar) . (extra-space 1.0)) - ((Staff_bar Time_signature) . (minimum-space 1.5)) ;double check this. - ((Time_signature begin-of-note) . (extra-space 2.0)) ;double check this. - ((Key_item begin-of-note) . (extra-space 2.5)) - ((Staff_bar begin-of-note) . (extra-space 1.0)) - ((Clef_item begin-of-note) . (minimum-space 5.0)) - ((none Breathing_sign) . (minimum-space 0.0)) - ((Breathing_sign Key_item) . (minimum-space 1.5)) - ((Breathing_sign begin-of-note) . (minimum-space 1.0)) - ((Breathing_sign Staff_bar) . (minimum-space 1.5)) - ((Breathing_sign Clef_item) . (minimum-space 2.0)) - ) -) - ;; silly, use alist? (define (find-notehead-symbol duration style) (case style @@ -201,7 +151,7 @@ ) ) -(define script-alist '()) +(define default-script-alist '()) (define font-name-alist '()) (define (font-command name-mag) @@ -231,12 +181,9 @@ ; Make a function that checks score element for being of a specific type. (define (make-type-checker symbol) (lambda (elt) -; (display symbol) -; (eq? #t (ly-get-elt-property elt symbol)) (not (eq? #f (memq symbol (ly-get-elt-property elt 'interfaces)))) - )) - + ;;;;;;;;;;;;;;;;;;; TeX output (define (tex-scm action-name) (define (unknown) @@ -395,6 +342,19 @@ (define (volta h w thick vert_start vert_end) (embedded-ps ((ps-scm 'volta) h w thick vert_start vert_end))) + (define (define-origin file line col) + ; use this for column positions + (string-append "\\special{src:" (number->string line) ":" + (number->string col) " " file "}") + + ; line numbers only: + ;(string-append "\\special{src:" (number->string line) " " file "}") +) + ; no origin info: return empty string + ; "" + ; no-origin not yet supported by Xdvi + (define (no-origin) "") + ;; TeX ;; The procedures listed below form the public interface of TeX-scm. ;; (should merge the 2 lists) @@ -427,6 +387,8 @@ (define text ,text) (define tuplet ,tuplet) (define volta ,volta) + (define define-origin ,define-origin) + (define no-origin ,no-origin) )) ((eq? action-name 'beam) beam) @@ -645,6 +607,9 @@ "\n unknown\n") + (define (define-origin a b c ) "") + (define (no-origin) "") + ;; PS (cond ((eq? action-name 'all-definitions) `(begin @@ -676,6 +641,8 @@ (define stop-line ,stop-line) (define stop-last-line ,stop-line) (define text ,text) + (define no-origin ,no-origin) + (define define-origin ,define-origin) )) ((eq? action-name 'tuplet) tuplet) ((eq? action-name 'beam) beam) @@ -712,7 +679,7 @@ (define (sign x) (if (= x 0) 1 - (inexact->exact (/ x (abs x))))) + (if (< x 0) -1 1))) ;;;; AsciiScript as (define (as-scm action-name) @@ -760,6 +727,8 @@ (define (char i) (func "char" i)) + (define (define-origin a b c ) "") + (define (end-output) (func "end-output")) @@ -801,6 +770,8 @@ (string-append "(define " key " " (arg->string val) ")\n") "")) + (define (no-origin) "") + (define (placebox x y s) (let ((ey (inexact->exact y))) (string-append "(move-to " (number->string (inexact->exact x)) " " @@ -829,6 +800,8 @@ (define (text s) (func "text" s)) + (define (tuplet ht gap dx dy thick dir) "") + (define (volta h w thick vert-start vert-end) ;; urg (string-append @@ -853,6 +826,7 @@ (define beam ,beam) (define bracket ,bracket) (define char ,char) + (define define-origin ,define-origin) ;;(define crescendo ,crescendo) (define bezier-sandwich ,bezier-sandwich) ;;(define dashed-slur ,dashed-slur) @@ -868,6 +842,7 @@ (define lily-def ,lily-def) ;;(define invoke-char ,invoke-char) ;;(define invoke-dim1 ,invoke-dim1) + (define no-origin ,no-origin) (define placebox ,placebox) (define select-font ,select-font) (define start-line ,start-line) @@ -875,10 +850,10 @@ (define stop-line ,stop-line) (define stop-last-line ,stop-line) (define text ,text) - ;;(define tuplet ,tuplet) + (define tuplet ,tuplet) (define volta ,volta) )) - ;;((eq? action-name 'tuplet) tuplet) + ((eq? action-name 'tuplet) tuplet) ;;((eq? action-name 'beam) beam) ;;((eq? action-name 'bezier-sandwich) bezier-sandwich) ;;((eq? action-name 'bracket) bracket) @@ -919,46 +894,19 @@ (gulp-file name)))) (define (scm-tex-output) - (eval (tex-scm 'all-definitions))) + (ly-eval (tex-scm 'all-definitions))) (define (scm-ps-output) - (eval (ps-scm 'all-definitions))) + (ly-eval (ps-scm 'all-definitions))) (define (scm-as-output) - (eval (as-scm 'all-definitions))) + (ly-eval (as-scm 'all-definitions))) (define (index-cell cell dir) (if (equal? dir 1) (cdr cell) (car cell))) -; -; How should a bar line behave at a break? -; -(define (break-barline glyph dir) - (let ((result (assoc glyph - '((":|:" . (":|" . "|:")) - ("|" . ("|" . "")) - ("|s" . (nil . "|")) - ("|:" . ("|" . "|:")) - ("|." . ("|." . nil)) - (".|" . (nil . ".|")) - (":|" . (":|" . nil)) - ("||" . ("||" . nil)) - (".|." . (".|." . nil)) - ("scorebar" . (nil . "scorepostbreak")) - ("brace" . (nil . "brace")) - ("bracket" . (nil . "bracket")) - ) - ))) - - (if (equal? result #f) - (ly-warn (string-append "Unknown bar glyph: `" glyph "'")) - (index-cell (cdr result) dir)) - ) - ) - - (define major-scale '( (0 . 0)