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 (("" "Clef_item") . (minimum-space 1.0))
104 (("" "Staff_bar") . (minimum-space 0.0))
105 (("" "Clef_item") . (minimum-space 1.0))
106 (("" "Key_item") . (minimum-space 0.5))
107 (("" "Span_bar") . (extra-space 0.0))
108 (("" "Time_signature") . (extra-space 0.0))
109 (("" "begin-of-note") . (minimum-space 1.5))
110 (("Clef_item" "Key_item") . (minimum-space 4.0))
111 (("Key_item" "Time_signature") . (extra-space 1.0))
112 (("Clef_item" "Time_signature") . (minimum-space 3.5))
113 (("Staff_bar" "Clef_item") . (minimum-space 1.0))
114 (("Clef_item" "Staff_bar") . (minimum-space 3.7))
115 (("Time_signature" "Staff_bar") . (minimum-space 2.0))
116 (("Key_item" "Staff_bar") . (extra-space 1.0))
117 (("Span_bar" "Clef_item") . (extra-space 1.0))
118 (("Clef_item" "Span_bar") . (minimum-space 3.7))
119 (("Time_signature" "Span_bar") . (minimum-space 2.0))
120 (("Key_item" "Span_bar") . (minimum-space 2.5))
121 (("Staff_bar" "Time_signature") . (minimum-space 1.5)) ;double check this.
122 (("Time_signature" "begin-of-note") . (extra-space 2.0)) ;double check this.
123 (("Key_item" "begin-of-note") . (extra-space 2.5))
124 (("Staff_bar" "begin-of-note") . (extra-space 1.0))
125 (("Clef_item" "begin-of-note") . (minimum-space 5.0))
126 (("" "Breathing_sign") . (minimum-space 0.0))
127 (("Breathing_sign" "Key_item") . (minimum-space 1.5))
128 (("Breathing_sign" "begin-of-note") . (minimum-space 1.0))
129 (("Breathing_sign" "Staff_bar") . (minimum-space 1.5))
130 (("Breathing_sign" "Clef_item") . (minimum-space 2.0))
134 (define (break-align-spacer this next)
135 (let ((entry (assoc `(,this ,next) space-alist)))
138 (begin (ly-warn (string-append "Unknown spacing pair `" this "', `" next "'"))
139 '(minimum-space 0.0)))))
145 ;; this is silly, can't we use something like
146 ;; roman-0, roman-1 roman+1 ?
149 ("brace" . "feta-braces")
150 ("default" . "cmr10")
151 ("dynamic" . "feta-din")
155 ("finger" . "feta-nummer")
156 ("typewriter" . "cmtt")
162 ("mark" . "feta-nummer")
163 ("number" . "feta-nummer")
164 ("volta" . "feta-nummer"))
167 (define (string-encode-integer i)
170 ((< i 0) (string-append "n" (string-encode-integer (- i))))
172 (make-string 1 (integer->char (+ 65 (modulo i 26))))
173 (string-encode-integer (quotient i 26))
180 (cdr (assoc i '((-4 . 482)
193 (define script-alist '())
194 (define (articulation-to-scriptdef a)
195 (assoc a script-alist)
198 ;; Map style names to TeX font names. Return false if
199 ;; no font name found.
200 (define (style-to-cmr s)
206 (define font-name-alist '())
207 (define (font-command name-mag)
209 (string-append "magfont"
210 (string-encode-integer (hashq (car name-mag) 1000000))
212 (string-encode-integer (cdr name-mag)))
216 (define (define-fonts names)
217 (set! font-name-alist (map font-command names))
220 (font-load-command (car x) (cdr x))) font-name-alist)
223 (define (fontify name exp)
224 (string-append (select-font name)
231 ; Make a function that checks score element for being of a specific type.
232 (define (make-type-checker name)
234 (not (not (memq name (ly-get-elt-property elt 'interfaces))))))
237 ;;;;;;;;;;;;;;;;;;; TeX output
238 (define (tex-scm action-name)
243 (define (select-font font-name-symbol)
246 (c (assoc font-name-symbol font-name-alist))
251 (ly-warn (string-append
252 "Programming error: No such font known " (car font-name-symbol)))
253 "") ; issue no command
254 (string-append "\\" (cdr c)))
259 (define (beam width slope thick)
260 (embedded-ps ((ps-scm 'beam) width slope thick)))
262 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
263 (embedded-ps ((ps-scm 'bracket) arch_angle arch_width arch_height width height arch_thick thick)))
265 (define (dashed-slur thick dash l)
266 (embedded-ps ((ps-scm 'dashed-slur) thick dash l)))
268 (define (crescendo thick w h cont)
269 (embedded-ps ((ps-scm 'crescendo) thick w h cont)))
272 (string-append "\\char" (inexact->string i 10) " "))
274 (define (dashed-line thick dash w)
275 (embedded-ps ((ps-scm 'dashed-line) thick dash w)))
277 (define (decrescendo thick w h cont)
278 (embedded-ps ((ps-scm 'decrescendo) thick w h cont)))
280 (define (font-load-command name-mag command)
282 "\\font\\" command "="
283 (symbol->string (car name-mag))
285 (number->string (magstep (cdr name-mag)))
288 (define (embedded-ps s)
289 (string-append "\\embeddedps{" s "}"))
292 (string-append "% " s))
295 "\n\\EndLilyPondOutput")
297 (define (experimental-on)
300 (define (font-switch i)
304 (define (font-def i s)
306 "\\font" (font-switch i) "=" s "\n"))
312 ;(ly-gulp-file "lily.ps")
314 ;; URG: now we can't use scm output without Lily
315 (regexp-substitute/global #f "\n" (ly-gulp-file "lily.ps") 'pre " %\n" 'post)
317 "\\input lilyponddefs \\turnOnPostScript"))
319 (define (header creator generate)
321 "%created by: " creator generate "\n"))
323 (define (invoke-char s i)
325 "\n\\" s "{" (inexact->string i 10) "}" ))
327 (define (invoke-dim1 s d)
329 "\n\\" s "{" (number->dim d) "}"))
334 ;; need to do something to make this really safe.
336 (define (output-tex-string s)
337 (if security-paranoia
338 (regexp-substitute/global #f "\\\\" s 'pre "$\\backslash$" 'post)
341 (define (lily-def key val)
345 (regexp-substitute/global #f "_" (output-tex-string key) 'pre "X" 'post)
346 ;(output-tex-string key)
347 "{" (output-tex-string val) "}\n"))
349 (define (number->dim x)
351 (ly-number->string x) " pt "))
353 (define (placebox x y s)
356 (number->dim y) "}{" (number->dim x) "}{" s "}\n"))
358 (define (bezier-sandwich l thick)
359 (embedded-ps ((ps-scm 'bezier-sandwich) l thick)))
361 (define (start-line ht)
362 (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n"))
365 "}\\vss}\\interscoreline")
366 (define (stop-last-line)
368 (define (filledbox breapth width depth height)
370 "\\kern" (number->dim (- breapth))
371 "\\vrule width " (number->dim (+ breapth width))
372 "depth " (number->dim depth)
373 "height " (number->dim height) " "))
376 (string-append "\\hbox{" (output-tex-string s) "}"))
378 (define (tuplet ht gapx dx dy thick dir)
379 (embedded-ps ((ps-scm 'tuplet) ht gapx dx dy thick dir)))
381 (define (volta h w thick vert_start vert_end)
382 (embedded-ps ((ps-scm 'volta) h w thick vert_start vert_end)))
385 ;; The procedures listed below form the public interface of TeX-scm.
386 ;; (should merge the 2 lists)
387 (cond ((eq? action-name 'all-definitions)
389 (define font-load-command ,font-load-command)
391 (define bezier-sandwich ,bezier-sandwich)
392 (define bracket ,bracket)
394 (define crescendo ,crescendo)
395 (define dashed-line ,dashed-line)
396 (define dashed-slur ,dashed-slur)
397 (define decrescendo ,decrescendo)
398 (define end-output ,end-output)
399 (define experimental-on ,experimental-on)
400 (define filledbox ,filledbox)
401 (define font-def ,font-def)
402 (define font-switch ,font-switch)
403 (define header-end ,header-end)
404 (define lily-def ,lily-def)
405 (define header ,header)
406 (define invoke-char ,invoke-char)
407 (define invoke-dim1 ,invoke-dim1)
408 (define placebox ,placebox)
409 (define select-font ,select-font)
410 (define start-line ,start-line)
411 (define stop-line ,stop-line)
412 (define stop-last-line ,stop-last-line)
414 (define tuplet ,tuplet)
415 (define volta ,volta)
418 ((eq? action-name 'beam) beam)
419 ((eq? action-name 'tuplet) tuplet)
420 ((eq? action-name 'bracket) bracket)
421 ((eq? action-name 'crescendo) crescendo)
422 ((eq? action-name 'dashed-line) dashed-line)
423 ((eq? action-name 'dashed-slur) dashed-slur)
424 ((eq? action-name 'decrescendo) decrescendo)
425 ((eq? action-name 'end-output) end-output)
426 ((eq? action-name 'experimental-on) experimental-on)
427 ((eq? action-name 'font-def) font-def)
428 ((eq? action-name 'font-switch) font-switch)
429 ((eq? action-name 'header-end) header-end)
430 ((eq? action-name 'lily-def) lily-def)
431 ((eq? action-name 'header) header)
432 ((eq? action-name 'invoke-char) invoke-char)
433 ((eq? action-name 'invoke-dim1) invoke-dim1)
434 ((eq? action-name 'placebox) placebox)
435 ((eq? action-name 'bezier-sandwich) bezier-sandwich)
436 ((eq? action-name 'start-line) start-line)
437 ((eq? action-name 'stem) stem)
438 ((eq? action-name 'stop-line) stop-line)
439 ((eq? action-name 'stop-last-line) stop-last-line)
440 ((eq? action-name 'volta) volta)
441 (else (error "unknown tag -- PS-TEX " action-name))
447 (define (ps-scm action-name)
449 ;; alist containing fontname -> fontcommand assoc (both strings)
450 (define font-alist '())
451 (define font-count 0)
452 (define current-font "")
455 (define (cached-fontname i)
458 (make-string 1 (integer->char (+ 65 i)))))
460 (define (mag-to-size m)
461 (number->string (case m
464 (2 14) ; really: 14.400
465 (3 17) ; really: 17.280
466 (4 21) ; really: 20.736
467 (5 24) ; really: 24.888
468 (6 30) ; really: 29.856
472 (define (select-font font-name-symbol)
475 (c (assoc font-name-symbol font-name-alist))
480 (ly-warn (string-append
481 "Programming error: No such font known " (car font-name-symbol)))
482 "") ; issue no command
483 (string-append " " (cdr c) " "))
488 (define (font-load-command name-mag command)
492 (symbol->string (car name-mag))
494 (number->string (magstep (cdr name-mag)))
495 " 1000 div 12 mul scalefont setfont } bind def "
499 (define (beam width slope thick)
501 (numbers->string (list width slope thick)) " draw_beam" ))
504 (string-append "% " s))
506 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
508 (numbers->string (list arch_angle arch_width arch_height width height arch_thick thick)) " draw_bracket" ))
511 (invoke-char " show" i))
513 (define (crescendo thick w h cont )
515 (numbers->string (list w h (inexact->exact cont) thick))
518 ;; what the heck is this interface ?
519 (define (dashed-slur thick dash l)
521 (apply string-append (map control->string l))
522 (number->string thick)
524 (number->string dash)
526 (number->string (* 10 thick)) ;UGH. 10 ?
527 " ] 0 draw_dashed_slur"))
529 (define (dashed-line thick dash width)
531 (number->string width)
533 (number->string thick)
535 (number->string dash)
537 (number->string dash)
538 " ] 0 draw_dashed_line"))
540 (define (decrescendo thick w h cont)
542 (numbers->string (list w h (inexact->exact cont) thick))
543 " draw_decrescendo"))
549 (define (experimental-on) "")
551 (define (filledbox breapth width depth height)
552 (string-append (numbers->string (list breapth width depth height))
556 (define (font-def i s)
559 (substring s 0 (- (string-length s) 4))
560 " findfont 12 scalefont setfont} bind def \n"))
562 (define (font-switch i)
563 (string-append (font i) " "))
567 ;; URG: now we can't use scm output without Lily
568 (ly-gulp-file "lilyponddefs.ps")
569 " {exch pop //systemdict /run get exec} "
570 (ly-gulp-file "lily.ps")
571 "{ exch pop //systemdict /run get exec } "
574 (define (lily-def key val)
576 (if (string=? (substring key 0 (min (string-length "mudelapaper") (string-length key))) "mudelapaper")
577 (string-append "/" key " {" val "} bind def\n")
578 (string-append "/" key " (" val ") def\n")
582 (define (header creator generate)
585 "%%Creator: " creator generate "\n"))
587 (define (invoke-char s i)
589 "(\\" (inexact->string i 8) ") " s " " ))
591 (define (invoke-dim1 s d)
593 (number->string (* d (/ 72.27 72))) " " s ))
595 (define (placebox x y s)
597 (number->string x) " " (number->string y) " {" s "} placebox "))
599 (define (bezier-sandwich l thick)
601 (apply string-append (map control->string l))
602 (number->string thick)
603 " draw_bezier_sandwich"))
605 (define (start-line height)
608 (define (stem breapth width depth height)
609 (string-append (numbers->string (list breapth width depth height))
616 (string-append "(" s ") show "))
619 (define (volta h w thick vert_start vert_end)
621 (numbers->string (list h w thick (inexact->exact vert_start) (inexact->exact vert_end)))
624 (define (tuplet ht gap dx dy thick dir)
626 (numbers->string (list ht gap dx dy thick (inexact->exact dir)))
635 (cond ((eq? action-name 'all-definitions)
638 (define tuplet ,tuplet)
639 (define bracket ,bracket)
641 (define crescendo ,crescendo)
642 (define volta ,volta)
643 (define bezier-sandwich ,bezier-sandwich)
644 (define dashed-line ,dashed-line)
645 (define dashed-slur ,dashed-slur)
646 (define decrescendo ,decrescendo)
647 (define end-output ,end-output)
648 (define experimental-on ,experimental-on)
649 (define filledbox ,filledbox)
650 (define font-def ,font-def)
651 (define font-switch ,font-switch)
652 (define header-end ,header-end)
653 (define lily-def ,lily-def)
654 (define font-load-command ,font-load-command)
655 (define header ,header)
656 (define invoke-char ,invoke-char)
657 (define invoke-dim1 ,invoke-dim1)
658 (define placebox ,placebox)
659 (define select-font ,select-font)
660 (define start-line ,start-line)
662 (define stop-line ,stop-line)
663 (define stop-last-line ,stop-line)
666 ((eq? action-name 'tuplet) tuplet)
667 ((eq? action-name 'beam) beam)
668 ((eq? action-name 'bezier-sandwich) bezier-sandwich)
669 ((eq? action-name 'bracket) bracket)
670 ((eq? action-name 'char) char)
671 ((eq? action-name 'crescendo) crescendo)
672 ((eq? action-name 'dashed-line) dashed-line)
673 ((eq? action-name 'dashed-slur) dashed-slur)
674 ((eq? action-name 'decrescendo) decrescendo)
675 ((eq? action-name 'experimental-on) experimental-on)
676 ((eq? action-name 'filledbox) filledbox)
677 ((eq? action-name 'select-font) select-font)
678 ((eq? action-name 'volta) volta)
679 (else (error "unknown tag -- PS-SCM " action-name))
684 (define (arg->string arg)
685 (cond ((number? arg) (inexact->string arg 10))
686 ((string? arg) (string-append "\"" arg "\""))
687 ((symbol? arg) (string-append "\"" (symbol->string arg) "\""))))
689 (define (func name . args)
695 (map (lambda (x) (string-append " " (arg->string x))) args)))
701 (inexact->exact (/ x (abs x)))))
704 (define (as-scm action-name)
706 (define (beam width slope thick)
708 (func "set-line-char" "#")
709 (func "rline-to" width (* width slope))
713 (define (bezier-sandwich l thick)
720 (dy (- (cdr c3) (cdr c0)))
722 (c1-dx (- (car c1) x))
723 (c1-line-y (+ (cdr c0) (* c1-dx rc)))
724 (dir (if (< c1-line-y (cdr c1)) 1 -1))
725 (y (+ -1 (* dir (max (* dir (cdr c0)) (* dir (cdr c3)))))))
727 (func "rmove-to" x y)
728 (func "put" (if (< 0 dir) "/" "\\\\"))
729 (func "rmove-to" 1 (if (< 0 dir) 1 0))
730 (func "set-line-char" "_")
731 (func "h-line" (- dx 1))
732 (func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
733 (func "put" (if (< 0 dir) "\\\\" "/"))))))
735 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
737 (func "rmove-to" (+ width 1) (- (/ height -2) 1))
739 (func "set-line-char" "|")
740 (func "rmove-to" 0 1)
741 (func "v-line" (+ height 1))
742 (func "rmove-to" 0 (+ height 1))
752 (define (experimental-on)
755 (define (filledbox breapth width depth height)
756 (let ((dx (+ width breapth))
757 (dy (+ depth height)))
759 (func "rmove-to" (* -1 breapth) (* -1 depth))
762 (func "set-line-char"
763 (if (<= dx 1) "|" "#"))
766 (func "set-line-char"
767 (if (<= dy 1) "-" "="))
768 (func "h-line" dx))))))
770 (define (font-load-command name-mag command)
771 (func "load-font" (car name-mag) (magstep (cdr name-mag))))
773 (define (header creator generate)
774 (func "header" creator generate))
779 ;; urg: this is good for half of as2text's execution time
780 (define (xlily-def key val)
781 (string-append "(define " key " " (arg->string val) ")\n"))
783 (define (lily-def key val)
785 (or (equal? key "mudelapaperlinewidth")
786 (equal? key "mudelapaperstaffheight"))
787 (string-append "(define " key " " (arg->string val) ")\n")
790 (define (placebox x y s)
791 (let ((ey (inexact->exact y)))
792 (string-append "(move-to " (number->string (inexact->exact x)) " "
793 (if (= 0.5 (- (abs y) (abs ey)))
798 (define (select-font font-name-symbol)
799 (let* ((c (assoc font-name-symbol font-name-alist)))
804 "Programming error: No such font known "
805 (car font-name-symbol)))
806 "") ; issue no command
807 (func "select-font" (car font-name-symbol)))))
809 (define (start-line height)
810 (func "start-line" height))
818 (define (volta h w thick vert-start vert-end)
821 (func "set-line-char" "|")
822 (func "rmove-to" 0 -4)
823 ;; definition strange-way around
827 (func "rmove-to" 1 h)
828 (func "set-line-char" "_")
829 (func "h-line" (- w 1))
830 (func "set-line-char" "|")
833 (func "rmove-to" (- w 1) (* -1 h))
834 (func "v-line" (* -1 h)))
837 (cond ((eq? action-name 'all-definitions)
840 (define bracket ,bracket)
842 ;;(define crescendo ,crescendo)
843 (define bezier-sandwich ,bezier-sandwich)
844 ;;(define dashed-slur ,dashed-slur)
845 ;;(define decrescendo ,decrescendo)
846 (define end-output ,end-output)
847 (define experimental-on ,experimental-on)
848 (define filledbox ,filledbox)
849 ;;(define font-def ,font-def)
850 (define font-load-command ,font-load-command)
851 ;;(define font-switch ,font-switch)
852 (define header ,header)
853 (define header-end ,header-end)
854 (define lily-def ,lily-def)
855 ;;(define invoke-char ,invoke-char)
856 ;;(define invoke-dim1 ,invoke-dim1)
857 (define placebox ,placebox)
858 (define select-font ,select-font)
859 (define start-line ,start-line)
860 ;;(define stem ,stem)
861 (define stop-line ,stop-line)
862 (define stop-last-line ,stop-line)
864 ;;(define tuplet ,tuplet)
865 (define volta ,volta)
867 ;;((eq? action-name 'tuplet) tuplet)
868 ;;((eq? action-name 'beam) beam)
869 ;;((eq? action-name 'bezier-sandwich) bezier-sandwich)
870 ;;((eq? action-name 'bracket) bracket)
871 ((eq? action-name 'char) char)
872 ;;((eq? action-name 'crescendo) crescendo)
873 ;;((eq? action-name 'dashed-slur) dashed-slur)
874 ;;((eq? action-name 'decrescendo) decrescendo)
875 ;;((eq? action-name 'experimental-on) experimental-on)
876 ((eq? action-name 'filledbox) filledbox)
877 ((eq? action-name 'select-font) select-font)
878 ;;((eq? action-name 'volta) volta)
879 (else (error "unknown tag -- MUSA-SCM " action-name))
884 (define (gulp-file name)
885 (let* ((port (open-file name "r"))
886 (content (let loop ((text ""))
887 (let ((line (read-line port)))
888 (if (or (eof-object? line)
891 (loop (string-append text line "\n")))))))
895 ;; urg: Use when standalone, do:
896 ;; (define (ly-gulp-file name) (scm-gulp-file name))
897 (define (scm-gulp-file name)
899 (cons (string-append (getenv 'LILYPONDPREFIX) "/ly")
900 (cons (string-append (getenv 'LILYPONDPREFIX) "/ps")
902 (let ((path (%search-load-path name)))
907 (define (scm-tex-output)
908 (eval (tex-scm 'all-definitions)))
910 (define (scm-ps-output)
911 (eval (ps-scm 'all-definitions)))
913 (define (scm-as-output)
914 (eval (as-scm 'all-definitions)))
916 ; Russ McManus, <mcmanus@IDT.NET>
918 ; I use the following, which should definitely be provided somewhere
919 ; in guile, but isn't, AFAIK:
923 (define (hash-table-for-each fn ht)
925 ((= i (vector-length ht)))
926 (do ((alist (vector-ref ht i) (cdr alist)))
928 (fn (car (car alist)) (cdr (car alist))))))
930 (define (hash-table-map fn ht)
933 ((= i (vector-length ht)) (reverse ret-ls))
934 (do ((alist (vector-ref ht i) (cdr alist)))
936 (set! ret-ls (cons (fn (car (car alist)) (cdr (car alist))) ret-ls)))))
940 (define (index-cell cell dir)
946 ; How should a bar line behave at a break?
948 (define (break-barline glyph dir)
949 (let ((result (assoc glyph
950 '((":|:" . (":|" . "|:"))
953 ("|:" . ("|" . "|:"))
954 ("|." . ("|." . nil))
955 (":|" . (":|" . nil))
956 ("||" . ("||" . nil))
957 (".|." . (".|." . nil))
958 ("scorebar" . (nil . "scorepostbreak"))
959 ("brace" . (nil . "brace"))
960 ("bracket" . (nil . "bracket"))
964 (if (equal? result #f)
965 (ly-warn (string-append "Unknown bar glyph: `" glyph "'"))
966 (index-cell (cdr result) dir))
971 (define (slur-ugly ind ht)
976 (> ht (+ (* 2 ind) -4))
977 (< ht (+ (* -2 ind) 8)))