1 ; lily.scm -- implement Scheme output routines for TeX and PostScript
3 ; source file of the GNU LilyPond music typesetter
5 ; (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
9 ; This file contains various routines in Scheme that are easier to
10 ; do here than in C++. At present it is a unorganised mess. Sorry.
16 ;(debug-enable 'backtrace)
20 (use-modules (ice-9 regex))
22 ;; do nothing in .scm output
23 (define (comment s) "")
29 (define (cons-map f x)
30 (cons (f (car x)) (f (cdr x))))
32 (define (reduce operator list)
33 (if (null? (cdr list)) (car list)
34 (operator (car list) (reduce operator (cdr list)))
39 (define (numbers->string l)
40 (apply string-append (map ly-number->string l)))
42 ; (define (chop-decimal x) (if (< (abs x) 0.001) 0.0 x))
44 (define (number->octal-string x)
45 (let* ((n (inexact->exact x))
47 (n8 (quotient (- n (* n64 64)) 8)))
51 (number->string (remainder (- n (+ (* n64 64) (* n8 8))) 8)))))
53 (define (inexact->string x radix)
54 (let ((n (inexact->exact x)))
55 (number->string n radix)))
58 (define (control->string c)
59 (string-append (number->string (car c)) " "
60 (number->string (cdr c)) " "))
66 (make-string 1 (integer->char (+ (char->integer #\A) i)))
71 (define (scm-scm action-name)
74 (define security-paranoia #f)
77 ;; See documentation of Item::visibility_lambda_
78 (define (begin-of-line-visible d) (if (= d 1) '(#f . #f) '(#t . #t)))
79 (define (spanbar-begin-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f)))
80 (define (all-visible d) '(#f . #f))
81 (define (begin-of-line-invisible d) (if (= d 1) '(#t . #t) '(#f . #f)))
82 (define (end-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f)))
85 ;; Score_span_bars are only visible at start of line
86 ;; i.e. if break_dir == RIGHT == 1
87 (define Span_bar_engraver-visibility begin-of-line-invisible)
88 (define Base_span_bar_engraver-visibility begin-of-line-invisible)
89 (define mark-visibility end-of-line-invisible)
90 (define Span_score_bar_engraver-visibility begin-of-line-visible)
91 (define Piano_bar_engraver-visibility begin-of-line-visible)
92 (define Staff_group_bar_engraver-visibility begin-of-line-visible)
94 ;; Spacing constants for prefatory matter.
96 ;; rules for this spacing are much more complicated than this. See [Wanske] page 126 -- 134, [Ross] pg 143 -- 147
100 ;; (Measured in staff space)
103 (("" "Left_edge_item") . (minimum-space -15.0))
104 (("" "Clef_item") . (minimum-space 1.0))
105 (("" "Staff_bar") . (minimum-space 0.0))
106 (("" "Clef_item") . (minimum-space 1.0))
107 (("" "Key_item") . (minimum-space 0.5))
108 (("" "Span_bar") . (extra-space 0.0))
109 (("" "Time_signature") . (extra-space 0.0))
110 (("" "begin-of-note") . (minimum-space 1.5))
111 (("Clef_item" "Key_item") . (minimum-space 4.0))
112 (("Key_item" "Time_signature") . (extra-space 1.0))
113 (("Clef_item" "Time_signature") . (minimum-space 3.5))
114 (("Staff_bar" "Clef_item") . (minimum-space 1.0))
115 (("Clef_item" "Staff_bar") . (minimum-space 3.7))
116 (("Time_signature" "Staff_bar") . (minimum-space 2.0))
117 (("Key_item" "Staff_bar") . (extra-space 1.0))
118 (("Span_bar" "Clef_item") . (extra-space 1.0))
119 (("Clef_item" "Span_bar") . (minimum-space 3.7))
120 (("Time_signature" "Span_bar") . (minimum-space 2.0))
121 (("Key_item" "Span_bar") . (minimum-space 2.5))
122 (("Staff_bar" "Time_signature") . (minimum-space 1.5)) ;double check this.
123 (("Time_signature" "begin-of-note") . (extra-space 2.0)) ;double check this.
124 (("Key_item" "begin-of-note") . (extra-space 2.5))
125 (("Staff_bar" "begin-of-note") . (extra-space 1.0))
126 (("Clef_item" "begin-of-note") . (minimum-space 5.0))
127 (("" "Breathing_sign") . (minimum-space 0.0))
128 (("Breathing_sign" "Key_item") . (minimum-space 1.5))
129 (("Breathing_sign" "begin-of-note") . (minimum-space 1.0))
130 (("Breathing_sign" "Staff_bar") . (minimum-space 1.5))
131 (("Breathing_sign" "Clef_item") . (minimum-space 2.0))
135 (define (break-align-spacer this next)
136 (let ((entry (assoc `(,this ,next) space-alist)))
139 (begin (ly-warn (string-append "Unknown spacing pair `" this "', `" next "'"))
140 '(minimum-space 0.0)))))
146 ;; this is silly, can't we use something like
147 ;; roman-0, roman-1 roman+1 ?
150 ("brace" . "feta-braces")
151 ("default" . "cmr10")
152 ("dynamic" . "feta-din")
156 ("finger" . "feta-nummer")
157 ("typewriter" . "cmtt")
163 ("mark" . "feta-nummer")
164 ("number" . "feta-nummer")
165 ("volta" . "feta-nummer"))
168 (define (string-encode-integer i)
171 ((< i 0) (string-append "n" (string-encode-integer (- i))))
173 (make-string 1 (integer->char (+ 65 (modulo i 26))))
174 (string-encode-integer (quotient i 26))
181 (cdr (assoc i '((-4 . 482)
194 (define script-alist '())
195 (define (articulation-to-scriptdef a)
196 (assoc a script-alist)
199 ;; Map style names to TeX font names. Return false if
200 ;; no font name found.
201 (define (style-to-cmr s)
207 (define font-name-alist '())
208 (define (font-command name-mag)
210 (string-append "magfont"
211 (string-encode-integer (hashq (car name-mag) 1000000))
213 (string-encode-integer (cdr name-mag)))
217 (define (define-fonts names)
218 (set! font-name-alist (map font-command names))
221 (font-load-command (car x) (cdr x))) font-name-alist)
224 (define (fontify name exp)
225 (string-append (select-font name)
232 ; Make a function that checks score element for being of a specific type.
233 (define (make-type-checker name)
235 (not (not (memq name (ly-get-elt-property elt 'interfaces))))))
238 ;;;;;;;;;;;;;;;;;;; TeX output
239 (define (tex-scm action-name)
244 (define (select-font font-name-symbol)
247 (c (assoc font-name-symbol font-name-alist))
252 (ly-warn (string-append
253 "Programming error: No such font known " (car font-name-symbol)))
254 "") ; issue no command
255 (string-append "\\" (cdr c)))
260 (define (beam width slope thick)
261 (embedded-ps ((ps-scm 'beam) width slope thick)))
263 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
264 (embedded-ps ((ps-scm 'bracket) arch_angle arch_width arch_height width height arch_thick thick)))
266 (define (dashed-slur thick dash l)
267 (embedded-ps ((ps-scm 'dashed-slur) thick dash l)))
269 (define (crescendo thick w h cont)
270 (embedded-ps ((ps-scm 'crescendo) thick w h cont)))
273 (string-append "\\char" (inexact->string i 10) " "))
275 (define (dashed-line thick dash w)
276 (embedded-ps ((ps-scm 'dashed-line) thick dash w)))
278 (define (decrescendo thick w h cont)
279 (embedded-ps ((ps-scm 'decrescendo) thick w h cont)))
281 (define (font-load-command name-mag command)
283 "\\font\\" command "="
284 (symbol->string (car name-mag))
286 (number->string (magstep (cdr name-mag)))
289 (define (embedded-ps s)
290 (string-append "\\embeddedps{" s "}"))
293 (string-append "% " s))
296 "\n\\EndLilyPondOutput")
298 (define (experimental-on)
301 (define (font-switch i)
305 (define (font-def i s)
307 "\\font" (font-switch i) "=" s "\n"))
313 ;(ly-gulp-file "lily.ps")
315 ;; URG: now we can't use scm output without Lily
316 (regexp-substitute/global #f "\n" (ly-gulp-file "lily.ps") 'pre " %\n" 'post)
318 "\\input lilyponddefs \\turnOnPostScript"))
320 (define (header creator generate)
322 "%created by: " creator generate "\n"))
324 (define (invoke-char s i)
326 "\n\\" s "{" (inexact->string i 10) "}" ))
328 (define (invoke-dim1 s d)
330 "\n\\" s "{" (number->dim d) "}"))
335 ;; need to do something to make this really safe.
337 (define (output-tex-string s)
338 (if security-paranoia
339 (regexp-substitute/global #f "\\\\" s 'pre "$\\backslash$" 'post)
342 (define (lily-def key val)
346 (regexp-substitute/global #f "_" (output-tex-string key) 'pre "X" 'post)
347 ;(output-tex-string key)
348 "{" (output-tex-string val) "}\n"))
350 (define (number->dim x)
352 (ly-number->string x) " pt "))
354 (define (placebox x y s)
357 (number->dim y) "}{" (number->dim x) "}{" s "}\n"))
359 (define (bezier-sandwich l thick)
360 (embedded-ps ((ps-scm 'bezier-sandwich) l thick)))
362 (define (start-line ht)
363 (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n"))
366 "}\\vss}\\interscoreline")
367 (define (stop-last-line)
369 (define (filledbox breapth width depth height)
371 "\\kern" (number->dim (- breapth))
372 "\\vrule width " (number->dim (+ breapth width))
373 "depth " (number->dim depth)
374 "height " (number->dim height) " "))
377 (string-append "\\hbox{" (output-tex-string s) "}"))
379 (define (tuplet ht gapx dx dy thick dir)
380 (embedded-ps ((ps-scm 'tuplet) ht gapx dx dy thick dir)))
382 (define (volta h w thick vert_start vert_end)
383 (embedded-ps ((ps-scm 'volta) h w thick vert_start vert_end)))
386 ;; The procedures listed below form the public interface of TeX-scm.
387 ;; (should merge the 2 lists)
388 (cond ((eq? action-name 'all-definitions)
390 (define font-load-command ,font-load-command)
392 (define bezier-sandwich ,bezier-sandwich)
393 (define bracket ,bracket)
395 (define crescendo ,crescendo)
396 (define dashed-line ,dashed-line)
397 (define dashed-slur ,dashed-slur)
398 (define decrescendo ,decrescendo)
399 (define end-output ,end-output)
400 (define experimental-on ,experimental-on)
401 (define filledbox ,filledbox)
402 (define font-def ,font-def)
403 (define font-switch ,font-switch)
404 (define header-end ,header-end)
405 (define lily-def ,lily-def)
406 (define header ,header)
407 (define invoke-char ,invoke-char)
408 (define invoke-dim1 ,invoke-dim1)
409 (define placebox ,placebox)
410 (define select-font ,select-font)
411 (define start-line ,start-line)
412 (define stop-line ,stop-line)
413 (define stop-last-line ,stop-last-line)
415 (define tuplet ,tuplet)
416 (define volta ,volta)
419 ((eq? action-name 'beam) beam)
420 ((eq? action-name 'tuplet) tuplet)
421 ((eq? action-name 'bracket) bracket)
422 ((eq? action-name 'crescendo) crescendo)
423 ((eq? action-name 'dashed-line) dashed-line)
424 ((eq? action-name 'dashed-slur) dashed-slur)
425 ((eq? action-name 'decrescendo) decrescendo)
426 ((eq? action-name 'end-output) end-output)
427 ((eq? action-name 'experimental-on) experimental-on)
428 ((eq? action-name 'font-def) font-def)
429 ((eq? action-name 'font-switch) font-switch)
430 ((eq? action-name 'header-end) header-end)
431 ((eq? action-name 'lily-def) lily-def)
432 ((eq? action-name 'header) header)
433 ((eq? action-name 'invoke-char) invoke-char)
434 ((eq? action-name 'invoke-dim1) invoke-dim1)
435 ((eq? action-name 'placebox) placebox)
436 ((eq? action-name 'bezier-sandwich) bezier-sandwich)
437 ((eq? action-name 'start-line) start-line)
438 ((eq? action-name 'stem) stem)
439 ((eq? action-name 'stop-line) stop-line)
440 ((eq? action-name 'stop-last-line) stop-last-line)
441 ((eq? action-name 'volta) volta)
442 (else (error "unknown tag -- PS-TEX " action-name))
448 (define (ps-scm action-name)
450 ;; alist containing fontname -> fontcommand assoc (both strings)
451 (define font-alist '())
452 (define font-count 0)
453 (define current-font "")
456 (define (cached-fontname i)
459 (make-string 1 (integer->char (+ 65 i)))))
461 (define (mag-to-size m)
462 (number->string (case m
465 (2 14) ; really: 14.400
466 (3 17) ; really: 17.280
467 (4 21) ; really: 20.736
468 (5 24) ; really: 24.888
469 (6 30) ; really: 29.856
473 (define (select-font font-name-symbol)
476 (c (assoc font-name-symbol font-name-alist))
481 (ly-warn (string-append
482 "Programming error: No such font known " (car font-name-symbol)))
483 "") ; issue no command
484 (string-append " " (cdr c) " "))
489 (define (font-load-command name-mag command)
493 (symbol->string (car name-mag))
495 (number->string (magstep (cdr name-mag)))
496 " 1000 div 12 mul scalefont setfont } bind def "
500 (define (beam width slope thick)
502 (numbers->string (list width slope thick)) " draw_beam" ))
505 (string-append "% " s))
507 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
509 (numbers->string (list arch_angle arch_width arch_height width height arch_thick thick)) " draw_bracket" ))
512 (invoke-char " show" i))
514 (define (crescendo thick w h cont )
516 (numbers->string (list w h (inexact->exact cont) thick))
519 ;; what the heck is this interface ?
520 (define (dashed-slur thick dash l)
522 (apply string-append (map control->string l))
523 (number->string thick)
525 (number->string dash)
527 (number->string (* 10 thick)) ;UGH. 10 ?
528 " ] 0 draw_dashed_slur"))
530 (define (dashed-line thick dash width)
532 (number->string width)
534 (number->string thick)
536 (number->string dash)
538 (number->string dash)
539 " ] 0 draw_dashed_line"))
541 (define (decrescendo thick w h cont)
543 (numbers->string (list w h (inexact->exact cont) thick))
544 " draw_decrescendo"))
550 (define (experimental-on) "")
552 (define (filledbox breapth width depth height)
553 (string-append (numbers->string (list breapth width depth height))
557 (define (font-def i s)
560 (substring s 0 (- (string-length s) 4))
561 " findfont 12 scalefont setfont} bind def \n"))
563 (define (font-switch i)
564 (string-append (font i) " "))
568 ;; URG: now we can't use scm output without Lily
569 (ly-gulp-file "lilyponddefs.ps")
570 " {exch pop //systemdict /run get exec} "
571 (ly-gulp-file "lily.ps")
572 "{ exch pop //systemdict /run get exec } "
575 (define (lily-def key val)
577 (if (string=? (substring key 0 (min (string-length "mudelapaper") (string-length key))) "mudelapaper")
578 (string-append "/" key " {" val "} bind def\n")
579 (string-append "/" key " (" val ") def\n")
583 (define (header creator generate)
586 "%%Creator: " creator generate "\n"))
588 (define (invoke-char s i)
590 "(\\" (inexact->string i 8) ") " s " " ))
592 (define (invoke-dim1 s d)
594 (number->string (* d (/ 72.27 72))) " " s ))
596 (define (placebox x y s)
598 (number->string x) " " (number->string y) " {" s "} placebox "))
600 (define (bezier-sandwich l thick)
602 (apply string-append (map control->string l))
603 (number->string thick)
604 " draw_bezier_sandwich"))
606 (define (start-line height)
609 (define (stem breapth width depth height)
610 (string-append (numbers->string (list breapth width depth height))
617 (string-append "(" s ") show "))
620 (define (volta h w thick vert_start vert_end)
622 (numbers->string (list h w thick (inexact->exact vert_start) (inexact->exact vert_end)))
625 (define (tuplet ht gap dx dy thick dir)
627 (numbers->string (list ht gap dx dy thick (inexact->exact dir)))
636 (cond ((eq? action-name 'all-definitions)
639 (define tuplet ,tuplet)
640 (define bracket ,bracket)
642 (define crescendo ,crescendo)
643 (define volta ,volta)
644 (define bezier-sandwich ,bezier-sandwich)
645 (define dashed-line ,dashed-line)
646 (define dashed-slur ,dashed-slur)
647 (define decrescendo ,decrescendo)
648 (define end-output ,end-output)
649 (define experimental-on ,experimental-on)
650 (define filledbox ,filledbox)
651 (define font-def ,font-def)
652 (define font-switch ,font-switch)
653 (define header-end ,header-end)
654 (define lily-def ,lily-def)
655 (define font-load-command ,font-load-command)
656 (define header ,header)
657 (define invoke-char ,invoke-char)
658 (define invoke-dim1 ,invoke-dim1)
659 (define placebox ,placebox)
660 (define select-font ,select-font)
661 (define start-line ,start-line)
663 (define stop-line ,stop-line)
664 (define stop-last-line ,stop-line)
667 ((eq? action-name 'tuplet) tuplet)
668 ((eq? action-name 'beam) beam)
669 ((eq? action-name 'bezier-sandwich) bezier-sandwich)
670 ((eq? action-name 'bracket) bracket)
671 ((eq? action-name 'char) char)
672 ((eq? action-name 'crescendo) crescendo)
673 ((eq? action-name 'dashed-line) dashed-line)
674 ((eq? action-name 'dashed-slur) dashed-slur)
675 ((eq? action-name 'decrescendo) decrescendo)
676 ((eq? action-name 'experimental-on) experimental-on)
677 ((eq? action-name 'filledbox) filledbox)
678 ((eq? action-name 'select-font) select-font)
679 ((eq? action-name 'volta) volta)
680 (else (error "unknown tag -- PS-SCM " action-name))
685 (define (arg->string arg)
686 (cond ((number? arg) (inexact->string arg 10))
687 ((string? arg) (string-append "\"" arg "\""))
688 ((symbol? arg) (string-append "\"" (symbol->string arg) "\""))))
690 (define (func name . args)
696 (map (lambda (x) (string-append " " (arg->string x))) args)))
702 (inexact->exact (/ x (abs x)))))
705 (define (as-scm action-name)
707 (define (beam width slope thick)
709 (func "set-line-char" "#")
710 (func "rline-to" width (* width slope))
714 (define (bezier-sandwich l thick)
721 (dy (- (cdr c3) (cdr c0)))
723 (c1-dx (- (car c1) x))
724 (c1-line-y (+ (cdr c0) (* c1-dx rc)))
725 (dir (if (< c1-line-y (cdr c1)) 1 -1))
726 (y (+ -1 (* dir (max (* dir (cdr c0)) (* dir (cdr c3)))))))
728 (func "rmove-to" x y)
729 (func "put" (if (< 0 dir) "/" "\\\\"))
730 (func "rmove-to" 1 (if (< 0 dir) 1 0))
731 (func "set-line-char" "_")
732 (func "h-line" (- dx 1))
733 (func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
734 (func "put" (if (< 0 dir) "\\\\" "/"))))))
736 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
738 (func "rmove-to" (+ width 1) (- (/ height -2) 1))
740 (func "set-line-char" "|")
741 (func "rmove-to" 0 1)
742 (func "v-line" (+ height 1))
743 (func "rmove-to" 0 (+ height 1))
753 (define (experimental-on)
756 (define (filledbox breapth width depth height)
757 (let ((dx (+ width breapth))
758 (dy (+ depth height)))
760 (func "rmove-to" (* -1 breapth) (* -1 depth))
763 (func "set-line-char"
764 (if (<= dx 1) "|" "#"))
767 (func "set-line-char"
768 (if (<= dy 1) "-" "="))
769 (func "h-line" dx))))))
771 (define (font-load-command name-mag command)
772 (func "load-font" (car name-mag) (magstep (cdr name-mag))))
774 (define (header creator generate)
775 (func "header" creator generate))
780 ;; urg: this is good for half of as2text's execution time
781 (define (xlily-def key val)
782 (string-append "(define " key " " (arg->string val) ")\n"))
784 (define (lily-def key val)
786 (or (equal? key "mudelapaperlinewidth")
787 (equal? key "mudelapaperstaffheight"))
788 (string-append "(define " key " " (arg->string val) ")\n")
791 (define (placebox x y s)
792 (let ((ey (inexact->exact y)))
793 (string-append "(move-to " (number->string (inexact->exact x)) " "
794 (if (= 0.5 (- (abs y) (abs ey)))
799 (define (select-font font-name-symbol)
800 (let* ((c (assoc font-name-symbol font-name-alist)))
805 "Programming error: No such font known "
806 (car font-name-symbol)))
807 "") ; issue no command
808 (func "select-font" (car font-name-symbol)))))
810 (define (start-line height)
811 (func "start-line" height))
819 (define (volta h w thick vert-start vert-end)
822 (func "set-line-char" "|")
823 (func "rmove-to" 0 -4)
824 ;; definition strange-way around
828 (func "rmove-to" 1 h)
829 (func "set-line-char" "_")
830 (func "h-line" (- w 1))
831 (func "set-line-char" "|")
834 (func "rmove-to" (- w 1) (* -1 h))
835 (func "v-line" (* -1 h)))
838 (cond ((eq? action-name 'all-definitions)
841 (define bracket ,bracket)
843 ;;(define crescendo ,crescendo)
844 (define bezier-sandwich ,bezier-sandwich)
845 ;;(define dashed-slur ,dashed-slur)
846 ;;(define decrescendo ,decrescendo)
847 (define end-output ,end-output)
848 (define experimental-on ,experimental-on)
849 (define filledbox ,filledbox)
850 ;;(define font-def ,font-def)
851 (define font-load-command ,font-load-command)
852 ;;(define font-switch ,font-switch)
853 (define header ,header)
854 (define header-end ,header-end)
855 (define lily-def ,lily-def)
856 ;;(define invoke-char ,invoke-char)
857 ;;(define invoke-dim1 ,invoke-dim1)
858 (define placebox ,placebox)
859 (define select-font ,select-font)
860 (define start-line ,start-line)
861 ;;(define stem ,stem)
862 (define stop-line ,stop-line)
863 (define stop-last-line ,stop-line)
865 ;;(define tuplet ,tuplet)
866 (define volta ,volta)
868 ;;((eq? action-name 'tuplet) tuplet)
869 ;;((eq? action-name 'beam) beam)
870 ;;((eq? action-name 'bezier-sandwich) bezier-sandwich)
871 ;;((eq? action-name 'bracket) bracket)
872 ((eq? action-name 'char) char)
873 ;;((eq? action-name 'crescendo) crescendo)
874 ;;((eq? action-name 'dashed-slur) dashed-slur)
875 ;;((eq? action-name 'decrescendo) decrescendo)
876 ;;((eq? action-name 'experimental-on) experimental-on)
877 ((eq? action-name 'filledbox) filledbox)
878 ((eq? action-name 'select-font) select-font)
879 ;;((eq? action-name 'volta) volta)
880 (else (error "unknown tag -- MUSA-SCM " action-name))
885 (define (gulp-file name)
886 (let* ((port (open-file name "r"))
887 (content (let loop ((text ""))
888 (let ((line (read-line port)))
889 (if (or (eof-object? line)
892 (loop (string-append text line "\n")))))))
896 ;; urg: Use when standalone, do:
897 ;; (define (ly-gulp-file name) (scm-gulp-file name))
898 (define (scm-gulp-file name)
900 (cons (string-append (getenv 'LILYPONDPREFIX) "/ly")
901 (cons (string-append (getenv 'LILYPONDPREFIX) "/ps")
903 (let ((path (%search-load-path name)))
908 (define (scm-tex-output)
909 (eval (tex-scm 'all-definitions)))
911 (define (scm-ps-output)
912 (eval (ps-scm 'all-definitions)))
914 (define (scm-as-output)
915 (eval (as-scm 'all-definitions)))
917 ; Russ McManus, <mcmanus@IDT.NET>
919 ; I use the following, which should definitely be provided somewhere
920 ; in guile, but isn't, AFAIK:
924 (define (hash-table-for-each fn ht)
926 ((= i (vector-length ht)))
927 (do ((alist (vector-ref ht i) (cdr alist)))
929 (fn (car (car alist)) (cdr (car alist))))))
931 (define (hash-table-map fn ht)
934 ((= i (vector-length ht)) (reverse ret-ls))
935 (do ((alist (vector-ref ht i) (cdr alist)))
937 (set! ret-ls (cons (fn (car (car alist)) (cdr (car alist))) ret-ls)))))
941 (define (index-cell cell dir)
947 ; How should a bar line behave at a break?
949 (define (break-barline glyph dir)
950 (let ((result (assoc glyph
951 '((":|:" . (":|" . "|:"))
954 ("|:" . ("|" . "|:"))
955 ("|." . ("|." . nil))
956 (":|" . (":|" . nil))
957 ("||" . ("||" . nil))
958 (".|." . (".|." . nil))
959 ("scorebar" . (nil . "scorepostbreak"))
960 ("brace" . (nil . "brace"))
961 ("bracket" . (nil . "bracket"))
965 (if (equal? result #f)
966 (ly-warn (string-append "Unknown bar glyph: `" glyph "'"))
967 (index-cell (cdr result) dir))
972 (define (slur-ugly ind ht)
977 (> ht (+ (* 2 ind) -4))
978 (< ht (+ (* -2 ind) 8)))