1 (debug-enable 'backtrace)
4 (define (as-scm action-name)
6 (define (beam width slope thick)
8 (func "set-line-char" "#")
9 (func "rline-to" width (* width slope))
13 (define (bezier-sandwich l thick)
20 (dy (- (cdr c3) (cdr c0)))
22 (c1-dx (- (car c1) x))
23 (c1-line-y (+ (cdr c0) (* c1-dx rc)))
24 (dir (if (< c1-line-y (cdr c1)) 1 -1))
25 (y (+ -1 (* dir (max (* dir (cdr c0)) (* dir (cdr c3)))))))
28 (func "put" (if (< 0 dir) "/" "\\\\"))
29 (func "rmove-to" 1 (if (< 0 dir) 1 0))
30 (func "set-line-char" "_")
31 (func "h-line" (- dx 1))
32 (func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
33 (func "put" (if (< 0 dir) "\\\\" "/"))))))
35 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
37 (func "rmove-to" (+ width 1) (- (/ height -2) 1))
39 (func "set-line-char" "|")
41 (func "v-line" (+ height 1))
42 (func "rmove-to" 0 (+ height 1))
49 (define (define-origin a b c ) "")
54 (define (experimental-on)
57 (define (filledbox breapth width depth height)
58 (let ((dx (+ width breapth))
59 (dy (+ depth height)))
61 (func "rmove-to" (* -1 breapth) (* -1 depth))
65 (if (<= dx 1) "|" "#"))
69 (if (<= dy 1) "-" "="))
70 (func "h-line" dx))))))
72 (define (font-load-command name-mag command)
73 (func "load-font" (car name-mag) (cdr name-mag)))
75 (define (header creator generate)
76 (func "header" creator generate))
81 ;; urg: this is good for half of as2text's execution time
82 (define (xlily-def key val)
83 (string-append "(define " key " " (arg->string val) ")\n"))
85 (define (lily-def key val)
87 (or (equal? key "lilypondpaperlinewidth")
88 (equal? key "lilypondpaperstaffheight"))
89 (string-append "(define " key " " (arg->string val) ")\n")
92 (define (no-origin) "")
94 (define (placebox x y s)
95 (let ((ey (inexact->exact y)))
96 (string-append "(move-to " (number->string (inexact->exact x)) " "
97 (if (= 0.5 (- (abs y) (abs ey)))
102 (define (select-font name-mag-pair)
103 (let* ((c (assoc name-mag-pair font-name-alist)))
108 "Programming error: No such font known "
109 (car name-mag-pair))))
110 "") ; issue no command
111 (func "select-font" (car name-mag-pair))))
113 (define (start-line height)
114 (func "start-line" height))
122 (define (tuplet ht gap dx dy thick dir) "")
124 (define (volta h w thick vert-start vert-end)
127 (func "set-line-char" "|")
128 (func "rmove-to" 0 -4)
129 ;; definition strange-way around
133 (func "rmove-to" 1 h)
134 (func "set-line-char" "_")
135 (func "h-line" (- w 1))
136 (func "set-line-char" "|")
139 (func "rmove-to" (- w 1) (* -1 h))
140 (func "v-line" (* -1 h)))
143 (cond ((eq? action-name 'all-definitions)
146 (define bracket ,bracket)
148 (define define-origin ,define-origin)
149 ;;(define crescendo ,crescendo)
150 (define bezier-sandwich ,bezier-sandwich)
151 ;;(define dashed-slur ,dashed-slur)
152 ;;(define decrescendo ,decrescendo)
153 (define end-output ,end-output)
154 (define experimental-on ,experimental-on)
155 (define filledbox ,filledbox)
156 ;;(define font-def ,font-def)
157 (define font-load-command ,font-load-command)
158 ;;(define font-switch ,font-switch)
159 (define header ,header)
160 (define header-end ,header-end)
161 (define lily-def ,lily-def)
162 ;;(define invoke-char ,invoke-char)
163 ;;(define invoke-dim1 ,invoke-dim1)
164 (define no-origin ,no-origin)
165 (define placebox ,placebox)
166 (define select-font ,select-font)
167 (define start-line ,start-line)
168 ;;(define stem ,stem)
169 (define stop-line ,stop-line)
170 (define stop-last-line ,stop-line)
172 (define tuplet ,tuplet)
173 (define volta ,volta)
175 ((eq? action-name 'tuplet) tuplet)
176 ;;((eq? action-name 'beam) beam)
177 ;;((eq? action-name 'bezier-sandwich) bezier-sandwich)
178 ;;((eq? action-name 'bracket) bracket)
179 ((eq? action-name 'char) char)
180 ;;((eq? action-name 'crescendo) crescendo)
181 ;;((eq? action-name 'dashed-slur) dashed-slur)
182 ;;((eq? action-name 'decrescendo) decrescendo)
183 ;;((eq? action-name 'experimental-on) experimental-on)
184 ((eq? action-name 'filledbox) filledbox)
185 ((eq? action-name 'select-font) select-font)
186 ;;((eq? action-name 'volta) volta)
187 (else (error "unknown tag -- MUSA-SCM " action-name))
191 (define (scm-as-output)
192 (ly-eval (as-scm 'all-definitions)))