3 (define (as-scm action-name)
5 (define (beam width slope thick)
7 (func "set-line-char" "#")
8 (func "rline-to" width (* width slope))
12 (define (bezier-sandwich l thick)
19 (dy (- (cdr c3) (cdr c0)))
21 (c1-dx (- (car c1) x))
22 (c1-line-y (+ (cdr c0) (* c1-dx rc)))
23 (dir (if (< c1-line-y (cdr c1)) 1 -1))
24 (y (+ -1 (* dir (max (* dir (cdr c0)) (* dir (cdr c3)))))))
27 (func "put" (if (< 0 dir) "/" "\\\\"))
28 (func "rmove-to" 1 (if (< 0 dir) 1 0))
29 (func "set-line-char" "_")
30 (func "h-line" (- dx 1))
31 (func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
32 (func "put" (if (< 0 dir) "\\\\" "/"))))))
34 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
36 (func "rmove-to" (+ width 1) (- (/ height -2) 1))
38 (func "set-line-char" "|")
40 (func "v-line" (+ height 1))
41 (func "rmove-to" 0 (+ height 1))
48 (define (define-origin a b c ) "")
53 (define (experimental-on)
56 (define (filledbox breapth width depth height)
57 (let ((dx (+ width breapth))
58 (dy (+ depth height)))
60 (func "rmove-to" (* -1 breapth) (* -1 depth))
64 (if (<= dx 1) "|" "#"))
68 (if (<= dy 1) "-" "="))
69 (func "h-line" dx))))))
71 (define (font-load-command name-mag command)
72 (func "load-font" (car name-mag) (magstep (cdr name-mag))))
74 (define (header creator generate)
75 (func "header" creator generate))
80 ;; urg: this is good for half of as2text's execution time
81 (define (xlily-def key val)
82 (string-append "(define " key " " (arg->string val) ")\n"))
84 (define (lily-def key val)
86 (or (equal? key "lilypondpaperlinewidth")
87 (equal? key "lilypondpaperstaffheight"))
88 (string-append "(define " key " " (arg->string val) ")\n")
91 (define (no-origin) "")
93 (define (placebox x y s)
94 (let ((ey (inexact->exact y)))
95 (string-append "(move-to " (number->string (inexact->exact x)) " "
96 (if (= 0.5 (- (abs y) (abs ey)))
101 (define (select-font name-mag-pair)
102 (let* ((c (assoc name-mag-pair font-name-alist)))
107 "Programming error: No such font known "
108 (car name-mag-pair))))
109 "") ; issue no command
110 (func "select-font" (car font-name-symbol)))))
112 (define (start-line height)
113 (func "start-line" height))
121 (define (tuplet ht gap dx dy thick dir) "")
123 (define (volta h w thick vert-start vert-end)
126 (func "set-line-char" "|")
127 (func "rmove-to" 0 -4)
128 ;; definition strange-way around
132 (func "rmove-to" 1 h)
133 (func "set-line-char" "_")
134 (func "h-line" (- w 1))
135 (func "set-line-char" "|")
138 (func "rmove-to" (- w 1) (* -1 h))
139 (func "v-line" (* -1 h)))
142 (cond ((eq? action-name 'all-definitions)
145 (define bracket ,bracket)
147 (define define-origin ,define-origin)
148 ;;(define crescendo ,crescendo)
149 (define bezier-sandwich ,bezier-sandwich)
150 ;;(define dashed-slur ,dashed-slur)
151 ;;(define decrescendo ,decrescendo)
152 (define end-output ,end-output)
153 (define experimental-on ,experimental-on)
154 (define filledbox ,filledbox)
155 ;;(define font-def ,font-def)
156 (define font-load-command ,font-load-command)
157 ;;(define font-switch ,font-switch)
158 (define header ,header)
159 (define header-end ,header-end)
160 (define lily-def ,lily-def)
161 ;;(define invoke-char ,invoke-char)
162 ;;(define invoke-dim1 ,invoke-dim1)
163 (define no-origin ,no-origin)
164 (define placebox ,placebox)
165 (define select-font ,select-font)
166 (define start-line ,start-line)
167 ;;(define stem ,stem)
168 (define stop-line ,stop-line)
169 (define stop-last-line ,stop-line)
171 (define tuplet ,tuplet)
172 (define volta ,volta)
174 ((eq? action-name 'tuplet) tuplet)
175 ;;((eq? action-name 'beam) beam)
176 ;;((eq? action-name 'bezier-sandwich) bezier-sandwich)
177 ;;((eq? action-name 'bracket) bracket)
178 ((eq? action-name 'char) char)
179 ;;((eq? action-name 'crescendo) crescendo)
180 ;;((eq? action-name 'dashed-slur) dashed-slur)
181 ;;((eq? action-name 'decrescendo) decrescendo)
182 ;;((eq? action-name 'experimental-on) experimental-on)
183 ((eq? action-name 'filledbox) filledbox)
184 ((eq? action-name 'select-font) select-font)
185 ;;((eq? action-name 'volta) volta)
186 (else (error "unknown tag -- MUSA-SCM " action-name))
190 (define (scm-as-output)
191 (ly-eval (as-scm 'all-definitions)))