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.
14 ;(debug-enable 'backtrace)
18 (use-modules (ice-9 regex))
20 ;; do nothing in .scm output
21 (define (comment s) "")
27 (define (cons-map f x)
28 (cons (f (car x)) (f (cdr x))))
30 (define (reduce operator list)
31 (if (null? (cdr list)) (car list)
32 (operator (car list) (reduce operator (cdr list)))
37 (define (numbers->string l)
38 (apply string-append (map ly-number->string l)))
40 ; (define (chop-decimal x) (if (< (abs x) 0.001) 0.0 x))
42 (define (number->octal-string x)
43 (let* ((n (inexact->exact x))
45 (n8 (quotient (- n (* n64 64)) 8)))
49 (number->string (remainder (- n (+ (* n64 64) (* n8 8))) 8)))))
51 (define (inexact->string x radix)
52 (let ((n (inexact->exact x)))
53 (number->string n radix)))
56 (define (control->string c)
57 (string-append (number->string (car c)) " "
58 (number->string (cdr c)) " "))
64 (make-string 1 (integer->char (+ (char->integer #\A) i)))
69 (define (scm-scm action-name)
72 (define security-paranoia #f)
75 ;; See documentation of Item::visibility_lambda_
76 (define (begin-of-line-visible d) (if (= d 1) '(#f . #f) '(#t . #t)))
77 (define (spanbar-begin-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f)))
78 (define (all-visible d) '(#f . #f))
79 (define (begin-of-line-invisible d) (if (= d 1) '(#t . #t) '(#f . #f)))
80 (define (end-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f)))
83 ;; Score_span_bars are only visible at start of line
84 ;; i.e. if break_dir == RIGHT == 1
85 (define Span_bar_engraver-visibility begin-of-line-invisible)
86 (define Base_span_bar_engraver-visibility begin-of-line-invisible)
87 (define mark-visibility end-of-line-invisible)
88 (define Span_score_bar_engraver-visibility begin-of-line-visible)
89 (define Piano_bar_engraver-visibility begin-of-line-visible)
90 (define Staff_group_bar_engraver-visibility begin-of-line-visible)
92 ;; Spacing constants for prefatory matter.
94 ;; rules for this spacing are much more complicated than this. See [Wanske] page 126 -- 134, [Ross] pg 143 -- 147
98 ;; (Measured in staff space)
101 (("" "Left_edge_item") . (extra-space -15.0))
102 (("" "Clef_item") . (minimum-space 1.0))
103 (("" "Staff_bar") . (minimum-space 0.0))
104 (("" "Clef_item") . (minimum-space 1.0))
105 (("" "Key_item") . (minimum-space 0.5))
106 (("" "Span_bar") . (extra-space 0.0))
107 (("" "Time_signature") . (extra-space 0.0))
108 (("" "begin-of-note") . (minimum-space 1.5))
109 (("Clef_item" "Key_item") . (minimum-space 4.0))
110 (("Key_item" "Time_signature") . (extra-space 1.0))
111 (("Clef_item" "Time_signature") . (minimum-space 3.5))
112 (("Staff_bar" "Clef_item") . (minimum-space 1.0))
113 (("Clef_item" "Staff_bar") . (minimum-space 3.7))
114 (("Time_signature" "Staff_bar") . (minimum-space 2.0))
115 (("Key_item" "Staff_bar") . (extra-space 1.0))
116 (("Span_bar" "Clef_item") . (extra-space 1.0))
117 (("Clef_item" "Span_bar") . (minimum-space 3.7))
118 (("Time_signature" "Span_bar") . (minimum-space 2.0))
119 (("Key_item" "Span_bar") . (minimum-space 2.5))
120 (("Staff_bar" "Time_signature") . (minimum-space 1.5)) ;double check this.
121 (("Time_signature" "begin-of-note") . (extra-space 2.0)) ;double check this.
122 (("Key_item" "begin-of-note") . (extra-space 2.5))
123 (("Staff_bar" "begin-of-note") . (extra-space 1.0))
124 (("Clef_item" "begin-of-note") . (minimum-space 5.0))
125 (("" "Breathing_sign") . (minimum-space 0.0))
126 (("Breathing_sign" "Key_item") . (minimum-space 1.5))
127 (("Breathing_sign" "begin-of-note") . (minimum-space 1.0))
128 (("Breathing_sign" "Staff_bar") . (minimum-space 1.5))
129 (("Breathing_sign" "Clef_item") . (minimum-space 2.0))
133 (define (break-align-spacer this next)
134 (let ((entry (assoc `(,this ,next) space-alist)))
137 (begin (ly-warn (string-append "Unknown spacing pair `" this "', `" next "'"))
138 '(minimum-space 0.0)))))
144 ;; this is silly, can't we use something like
145 ;; roman-0, roman-1 roman+1 ?
148 ("brace" . "feta-braces")
149 ("default" . "cmr10")
150 ("dynamic" . "feta-din")
154 ("finger" . "feta-nummer")
155 ("typewriter" . "cmtt")
161 ("mark" . "feta-nummer")
162 ("number" . "feta-nummer")
163 ("volta" . "feta-nummer"))
166 (define (string-encode-integer i)
169 ((< i 0) (string-append "n" (string-encode-integer (- i))))
171 (make-string 1 (integer->char (+ 65 (modulo i 26))))
172 (string-encode-integer (quotient i 26))
179 (cdr (assoc i '((-4 . 482)
192 (define script-alist '())
193 (define (articulation-to-scriptdef a)
194 (assoc a script-alist)
197 ;; Map style names to TeX font names. Return false if
198 ;; no font name found.
199 (define (style-to-cmr s)
205 (define font-name-alist '())
206 (define (font-command name-mag)
208 (string-append "magfont"
209 (string-encode-integer (hashq (car name-mag) 1000000))
211 (string-encode-integer (cdr name-mag)))
215 (define (define-fonts names)
216 (set! font-name-alist (map font-command names))
219 (font-load-command (car x) (cdr x))) font-name-alist)
222 (define (fontify name exp)
223 (string-append (select-font name)
230 ; Make a function that checks score element for being of a specific type.
231 (define (make-type-checker name)
233 (not (not (memq name (ly-get-elt-property elt 'interfaces))))))
236 ;;;;;;;;;;;;;;;;;;; TeX output
237 (define (tex-scm action-name)
242 (define (select-font font-name-symbol)
245 (c (assoc font-name-symbol font-name-alist))
250 (ly-warn (string-append
251 "Programming error: No such font known " (car font-name-symbol)))
252 "") ; issue no command
253 (string-append "\\" (cdr c)))
258 (define (beam width slope thick)
259 (embedded-ps ((ps-scm 'beam) width slope thick)))
261 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
262 (embedded-ps ((ps-scm 'bracket) arch_angle arch_width arch_height width height arch_thick thick)))
264 (define (dashed-slur thick dash l)
265 (embedded-ps ((ps-scm 'dashed-slur) thick dash l)))
267 (define (crescendo thick w h cont)
268 (embedded-ps ((ps-scm 'crescendo) thick w h cont)))
271 (string-append "\\char" (inexact->string i 10) " "))
273 (define (dashed-line thick dash w)
274 (embedded-ps ((ps-scm 'dashed-line) thick dash w)))
276 (define (decrescendo thick w h cont)
277 (embedded-ps ((ps-scm 'decrescendo) thick w h cont)))
279 (define (font-load-command name-mag command)
281 "\\font\\" command "="
282 (symbol->string (car name-mag))
284 (number->string (magstep (cdr name-mag)))
287 (define (embedded-ps s)
288 (string-append "\\embeddedps{" s "}"))
291 (string-append "% " s))
294 "\n\\EndLilyPondOutput")
296 (define (experimental-on)
299 (define (font-switch i)
303 (define (font-def i s)
305 "\\font" (font-switch i) "=" s "\n"))
311 ;(ly-gulp-file "lily.ps")
313 ;; URG: now we can't use scm output without Lily
314 (regexp-substitute/global #f "\n" (ly-gulp-file "lily.ps") 'pre " %\n" 'post)
316 "\\input lilyponddefs \\turnOnPostScript"))
318 (define (header creator generate)
320 "%created by: " creator generate "\n"))
322 (define (invoke-char s i)
324 "\n\\" s "{" (inexact->string i 10) "}" ))
326 (define (invoke-dim1 s d)
328 "\n\\" s "{" (number->dim d) "}"))
333 ;; need to do something to make this really safe.
335 (define (output-tex-string s)
336 (if security-paranoia
337 (regexp-substitute/global #f "\\\\" s 'pre "$\\backslash$" 'post)
340 (define (lily-def key val)
344 (regexp-substitute/global #f "_" (output-tex-string key) 'pre "X" 'post)
345 ;(output-tex-string key)
346 "{" (output-tex-string val) "}\n"))
348 (define (number->dim x)
350 (ly-number->string x) " pt "))
352 (define (placebox x y s)
355 (number->dim y) "}{" (number->dim x) "}{" s "}\n"))
357 (define (bezier-sandwich l thick)
358 (embedded-ps ((ps-scm 'bezier-sandwich) l thick)))
360 (define (start-line ht)
361 (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n"))
364 "}\\vss}\\interscoreline")
365 (define (stop-last-line)
367 (define (filledbox breapth width depth height)
369 "\\kern" (number->dim (- breapth))
370 "\\vrule width " (number->dim (+ breapth width))
371 "depth " (number->dim depth)
372 "height " (number->dim height) " "))
375 (string-append "\\hbox{" (output-tex-string s) "}"))
377 (define (tuplet ht gapx dx dy thick dir)
378 (embedded-ps ((ps-scm 'tuplet) ht gapx dx dy thick dir)))
380 (define (volta h w thick vert_start vert_end)
381 (embedded-ps ((ps-scm 'volta) h w thick vert_start vert_end)))
384 ;; The procedures listed below form the public interface of TeX-scm.
385 ;; (should merge the 2 lists)
386 (cond ((eq? action-name 'all-definitions)
388 (define font-load-command ,font-load-command)
390 (define bezier-sandwich ,bezier-sandwich)
391 (define bracket ,bracket)
393 (define crescendo ,crescendo)
394 (define dashed-line ,dashed-line)
395 (define dashed-slur ,dashed-slur)
396 (define decrescendo ,decrescendo)
397 (define end-output ,end-output)
398 (define experimental-on ,experimental-on)
399 (define filledbox ,filledbox)
400 (define font-def ,font-def)
401 (define font-switch ,font-switch)
402 (define header-end ,header-end)
403 (define lily-def ,lily-def)
404 (define header ,header)
405 (define invoke-char ,invoke-char)
406 (define invoke-dim1 ,invoke-dim1)
407 (define placebox ,placebox)
408 (define select-font ,select-font)
409 (define start-line ,start-line)
410 (define stop-line ,stop-line)
411 (define stop-last-line ,stop-last-line)
413 (define tuplet ,tuplet)
414 (define volta ,volta)
417 ((eq? action-name 'beam) beam)
418 ((eq? action-name 'tuplet) tuplet)
419 ((eq? action-name 'bracket) bracket)
420 ((eq? action-name 'crescendo) crescendo)
421 ((eq? action-name 'dashed-line) dashed-line)
422 ((eq? action-name 'dashed-slur) dashed-slur)
423 ((eq? action-name 'decrescendo) decrescendo)
424 ((eq? action-name 'end-output) end-output)
425 ((eq? action-name 'experimental-on) experimental-on)
426 ((eq? action-name 'font-def) font-def)
427 ((eq? action-name 'font-switch) font-switch)
428 ((eq? action-name 'header-end) header-end)
429 ((eq? action-name 'lily-def) lily-def)
430 ((eq? action-name 'header) header)
431 ((eq? action-name 'invoke-char) invoke-char)
432 ((eq? action-name 'invoke-dim1) invoke-dim1)
433 ((eq? action-name 'placebox) placebox)
434 ((eq? action-name 'bezier-sandwich) bezier-sandwich)
435 ((eq? action-name 'start-line) start-line)
436 ((eq? action-name 'stem) stem)
437 ((eq? action-name 'stop-line) stop-line)
438 ((eq? action-name 'stop-last-line) stop-last-line)
439 ((eq? action-name 'volta) volta)
440 (else (error "unknown tag -- PS-TEX " action-name))
446 (define (ps-scm action-name)
448 ;; alist containing fontname -> fontcommand assoc (both strings)
449 (define font-alist '())
450 (define font-count 0)
451 (define current-font "")
454 (define (cached-fontname i)
457 (make-string 1 (integer->char (+ 65 i)))))
459 (define (mag-to-size m)
460 (number->string (case m
463 (2 14) ; really: 14.400
464 (3 17) ; really: 17.280
465 (4 21) ; really: 20.736
466 (5 24) ; really: 24.888
467 (6 30) ; really: 29.856
471 (define (select-font font-name-symbol)
474 (c (assoc font-name-symbol font-name-alist))
479 (ly-warn (string-append
480 "Programming error: No such font known " (car font-name-symbol)))
481 "") ; issue no command
482 (string-append " " (cdr c) " "))
487 (define (font-load-command name-mag command)
491 (symbol->string (car name-mag))
493 (number->string (magstep (cdr name-mag)))
494 " 1000 div 12 mul scalefont setfont } bind def "
498 (define (beam width slope thick)
500 (numbers->string (list width slope thick)) " draw_beam" ))
503 (string-append "% " s))
505 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
507 (numbers->string (list arch_angle arch_width arch_height width height arch_thick thick)) " draw_bracket" ))
510 (invoke-char " show" i))
512 (define (crescendo thick w h cont )
514 (numbers->string (list w h (inexact->exact cont) thick))
517 ;; what the heck is this interface ?
518 (define (dashed-slur thick dash l)
520 (apply string-append (map control->string l))
521 (number->string thick)
523 (number->string dash)
525 (number->string (* 10 thick)) ;UGH. 10 ?
526 " ] 0 draw_dashed_slur"))
528 (define (dashed-line thick dash width)
530 (number->string width)
532 (number->string thick)
534 (number->string dash)
536 (number->string dash)
537 " ] 0 draw_dashed_line"))
539 (define (decrescendo thick w h cont)
541 (numbers->string (list w h (inexact->exact cont) thick))
542 " draw_decrescendo"))
548 (define (experimental-on) "")
550 (define (filledbox breapth width depth height)
551 (string-append (numbers->string (list breapth width depth height))
555 (define (font-def i s)
558 (substring s 0 (- (string-length s) 4))
559 " findfont 12 scalefont setfont} bind def \n"))
561 (define (font-switch i)
562 (string-append (font i) " "))
566 ;; URG: now we can't use scm output without Lily
567 (ly-gulp-file "lilyponddefs.ps")
568 " {exch pop //systemdict /run get exec} "
569 (ly-gulp-file "lily.ps")
570 "{ exch pop //systemdict /run get exec } "
573 (define (lily-def key val)
575 (if (string=? (substring key 0 (min (string-length "mudelapaper") (string-length key))) "mudelapaper")
576 (string-append "/" key " {" val "} bind def\n")
577 (string-append "/" key " (" val ") def\n")
581 (define (header creator generate)
584 "%%Creator: " creator generate "\n"))
586 (define (invoke-char s i)
588 "(\\" (inexact->string i 8) ") " s " " ))
590 (define (invoke-dim1 s d)
592 (number->string (* d (/ 72.27 72))) " " s ))
594 (define (placebox x y s)
596 (number->string x) " " (number->string y) " {" s "} placebox "))
598 (define (bezier-sandwich l thick)
600 (apply string-append (map control->string l))
601 (number->string thick)
602 " draw_bezier_sandwich"))
604 (define (start-line height)
607 (define (stem breapth width depth height)
608 (string-append (numbers->string (list breapth width depth height))
615 (string-append "(" s ") show "))
618 (define (volta h w thick vert_start vert_end)
620 (numbers->string (list h w thick (inexact->exact vert_start) (inexact->exact vert_end)))
623 (define (tuplet ht gap dx dy thick dir)
625 (numbers->string (list ht gap dx dy thick (inexact->exact dir)))
634 (cond ((eq? action-name 'all-definitions)
637 (define tuplet ,tuplet)
638 (define bracket ,bracket)
640 (define crescendo ,crescendo)
641 (define volta ,volta)
642 (define bezier-sandwich ,bezier-sandwich)
643 (define dashed-line ,dashed-line)
644 (define dashed-slur ,dashed-slur)
645 (define decrescendo ,decrescendo)
646 (define end-output ,end-output)
647 (define experimental-on ,experimental-on)
648 (define filledbox ,filledbox)
649 (define font-def ,font-def)
650 (define font-switch ,font-switch)
651 (define header-end ,header-end)
652 (define lily-def ,lily-def)
653 (define font-load-command ,font-load-command)
654 (define header ,header)
655 (define invoke-char ,invoke-char)
656 (define invoke-dim1 ,invoke-dim1)
657 (define placebox ,placebox)
658 (define select-font ,select-font)
659 (define start-line ,start-line)
661 (define stop-line ,stop-line)
662 (define stop-last-line ,stop-line)
665 ((eq? action-name 'tuplet) tuplet)
666 ((eq? action-name 'beam) beam)
667 ((eq? action-name 'bezier-sandwich) bezier-sandwich)
668 ((eq? action-name 'bracket) bracket)
669 ((eq? action-name 'char) char)
670 ((eq? action-name 'crescendo) crescendo)
671 ((eq? action-name 'dashed-line) dashed-line)
672 ((eq? action-name 'dashed-slur) dashed-slur)
673 ((eq? action-name 'decrescendo) decrescendo)
674 ((eq? action-name 'experimental-on) experimental-on)
675 ((eq? action-name 'filledbox) filledbox)
676 ((eq? action-name 'select-font) select-font)
677 ((eq? action-name 'volta) volta)
678 (else (error "unknown tag -- PS-SCM " action-name))
683 (define (arg->string arg)
684 (cond ((number? arg) (inexact->string arg 10))
685 ((string? arg) (string-append "\"" arg "\""))
686 ((symbol? arg) (string-append "\"" (symbol->string arg) "\""))))
688 (define (func name . args)
694 (map (lambda (x) (string-append " " (arg->string x))) args)))
700 (inexact->exact (/ x (abs x)))))
703 (define (as-scm action-name)
705 (define (beam width slope thick)
707 (func "set-line-char" "#")
708 (func "rline-to" width (* width slope))
712 (define (bezier-sandwich l thick)
719 (dy (- (cdr c3) (cdr c0)))
721 (c1-dx (- (car c1) x))
722 (c1-line-y (+ (cdr c0) (* c1-dx rc)))
723 (dir (if (< c1-line-y (cdr c1)) 1 -1))
724 (y (+ -1 (* dir (max (* dir (cdr c0)) (* dir (cdr c3)))))))
726 (func "rmove-to" x y)
727 (func "put" (if (< 0 dir) "/" "\\\\"))
728 (func "rmove-to" 1 (if (< 0 dir) 1 0))
729 (func "set-line-char" "_")
730 (func "h-line" (- dx 1))
731 (func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
732 (func "put" (if (< 0 dir) "\\\\" "/"))))))
734 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
736 (func "rmove-to" (+ width 1) (- (/ height -2) 1))
738 (func "set-line-char" "|")
739 (func "rmove-to" 0 1)
740 (func "v-line" (+ height 1))
741 (func "rmove-to" 0 (+ height 1))
751 (define (experimental-on)
754 (define (filledbox breapth width depth height)
755 (let ((dx (+ width breapth))
756 (dy (+ depth height)))
758 (func "rmove-to" (* -1 breapth) (* -1 depth))
761 (func "set-line-char"
762 (if (<= dx 1) "|" "#"))
765 (func "set-line-char"
766 (if (<= dy 1) "-" "="))
767 (func "h-line" dx))))))
769 (define (font-load-command name-mag command)
770 (func "load-font" (car name-mag) (magstep (cdr name-mag))))
772 (define (header creator generate)
773 (func "header" creator generate))
778 ;; urg: this is good for half of as2text's execution time
779 (define (xlily-def key val)
780 (string-append "(define " key " " (arg->string val) ")\n"))
782 (define (lily-def key val)
784 (or (equal? key "mudelapaperlinewidth")
785 (equal? key "mudelapaperstaffheight"))
786 (string-append "(define " key " " (arg->string val) ")\n")
789 (define (placebox x y s)
790 (let ((ey (inexact->exact y)))
791 (string-append "(move-to " (number->string (inexact->exact x)) " "
792 (if (= 0.5 (- (abs y) (abs ey)))
797 (define (select-font font-name-symbol)
798 (let* ((c (assoc font-name-symbol font-name-alist)))
803 "Programming error: No such font known "
804 (car font-name-symbol)))
805 "") ; issue no command
806 (func "select-font" (car font-name-symbol)))))
808 (define (start-line height)
809 (func "start-line" height))
817 (define (volta h w thick vert-start vert-end)
820 (func "set-line-char" "|")
821 (func "rmove-to" 0 -4)
822 ;; definition strange-way around
826 (func "rmove-to" 1 h)
827 (func "set-line-char" "_")
828 (func "h-line" (- w 1))
829 (func "set-line-char" "|")
832 (func "rmove-to" (- w 1) (* -1 h))
833 (func "v-line" (* -1 h)))
836 (cond ((eq? action-name 'all-definitions)
839 (define bracket ,bracket)
841 ;;(define crescendo ,crescendo)
842 (define bezier-sandwich ,bezier-sandwich)
843 ;;(define dashed-slur ,dashed-slur)
844 ;;(define decrescendo ,decrescendo)
845 (define end-output ,end-output)
846 (define experimental-on ,experimental-on)
847 (define filledbox ,filledbox)
848 ;;(define font-def ,font-def)
849 (define font-load-command ,font-load-command)
850 ;;(define font-switch ,font-switch)
851 (define header ,header)
852 (define header-end ,header-end)
853 (define lily-def ,lily-def)
854 ;;(define invoke-char ,invoke-char)
855 ;;(define invoke-dim1 ,invoke-dim1)
856 (define placebox ,placebox)
857 (define select-font ,select-font)
858 (define start-line ,start-line)
859 ;;(define stem ,stem)
860 (define stop-line ,stop-line)
861 (define stop-last-line ,stop-line)
863 ;;(define tuplet ,tuplet)
864 (define volta ,volta)
866 ;;((eq? action-name 'tuplet) tuplet)
867 ;;((eq? action-name 'beam) beam)
868 ;;((eq? action-name 'bezier-sandwich) bezier-sandwich)
869 ;;((eq? action-name 'bracket) bracket)
870 ((eq? action-name 'char) char)
871 ;;((eq? action-name 'crescendo) crescendo)
872 ;;((eq? action-name 'dashed-slur) dashed-slur)
873 ;;((eq? action-name 'decrescendo) decrescendo)
874 ;;((eq? action-name 'experimental-on) experimental-on)
875 ((eq? action-name 'filledbox) filledbox)
876 ((eq? action-name 'select-font) select-font)
877 ;;((eq? action-name 'volta) volta)
878 (else (error "unknown tag -- MUSA-SCM " action-name))
883 (define (gulp-file name)
884 (let* ((port (open-file name "r"))
885 (content (let loop ((text ""))
886 (let ((line (read-line port)))
887 (if (or (eof-object? line)
890 (loop (string-append text line "\n")))))))
894 ;; urg: Use when standalone, do:
895 ;; (define (ly-gulp-file name) (scm-gulp-file name))
896 (define (scm-gulp-file name)
898 (cons (string-append (getenv 'LILYPONDPREFIX) "/ly")
899 (cons (string-append (getenv 'LILYPONDPREFIX) "/ps")
901 (let ((path (%search-load-path name)))
906 (define (scm-tex-output)
907 (eval (tex-scm 'all-definitions)))
909 (define (scm-ps-output)
910 (eval (ps-scm 'all-definitions)))
912 (define (scm-as-output)
913 (eval (as-scm 'all-definitions)))
915 ; Russ McManus, <mcmanus@IDT.NET>
917 ; I use the following, which should definitely be provided somewhere
918 ; in guile, but isn't, AFAIK:
922 (define (hash-table-for-each fn ht)
924 ((= i (vector-length ht)))
925 (do ((alist (vector-ref ht i) (cdr alist)))
927 (fn (car (car alist)) (cdr (car alist))))))
929 (define (hash-table-map fn ht)
932 ((= i (vector-length ht)) (reverse ret-ls))
933 (do ((alist (vector-ref ht i) (cdr alist)))
935 (set! ret-ls (cons (fn (car (car alist)) (cdr (car alist))) ret-ls)))))
939 (define (index-cell cell dir)
945 ; How should a bar line behave at a break?
947 (define (break-barline glyph dir)
948 (let ((result (assoc glyph
949 '((":|:" . (":|" . "|:"))
952 ("|:" . ("|" . "|:"))
953 ("|." . ("|." . nil))
954 (":|" . (":|" . nil))
955 ("||" . ("||" . nil))
956 (".|." . (".|." . nil))
957 ("scorebar" . (nil . "scorepostbreak"))
958 ("brace" . (nil . "brace"))
959 ("bracket" . (nil . "bracket"))
963 (if (equal? result #f)
964 (ly-warn (string-append "Unknown bar glyph: `" glyph "'"))
965 (index-cell (cdr result) dir))
970 (define (slur-ugly ind ht)
975 (> ht (+ (* 2 ind) -4))
976 (< ht (+ (* -2 ind) 8)))