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 an unorganised mess. Sorry.
14 ;(debug-enable 'backtrace)
18 (use-modules (ice-9 regex))
20 ;; The regex module may not be available, or may be broken.
22 (let ((os (string-downcase (vector-ref (uname) 0))))
23 (not (equal? "cygwin" (substring os 0 (min 6 (string-length os)))))))
25 ;; If you have trouble with regex, define #f
27 ;;(define use-regex #f)
29 ;; do nothing in .scm output
30 (define (comment s) "")
32 ;; URG guile-1.3/1.4 compatibility
33 (define (ly-eval x) (eval2 x #f))
35 (define (comment s) "")
41 (define (cons-map f x)
42 (cons (f (car x)) (f (cdr x))))
44 (define (reduce operator list)
45 (if (null? (cdr list)) (car list)
46 (operator (car list) (reduce operator (cdr list)))
51 (define (numbers->string l)
52 (apply string-append (map ly-number->string l)))
54 ; (define (chop-decimal x) (if (< (abs x) 0.001) 0.0 x))
56 (define (number->octal-string x)
57 (let* ((n (inexact->exact x))
59 (n8 (quotient (- n (* n64 64)) 8)))
63 (number->string (remainder (- n (+ (* n64 64) (* n8 8))) 8)))))
65 (define (inexact->string x radix)
66 (let ((n (inexact->exact x)))
67 (number->string n radix)))
70 (define (control->string c)
71 (string-append (number->string (car c)) " "
72 (number->string (cdr c)) " "))
78 (make-string 1 (integer->char (+ (char->integer #\A) i)))
83 (define (scm-scm action-name)
86 (define security-paranoia #f)
88 ;; Spacing constants for prefatory matter.
90 ;; rules for this spacing are much more complicated than this. See [Wanske] page 126 -- 134, [Ross] pg 143 -- 147
94 ;; (Measured in staff space)
97 ((none Instrument_name) . (extra-space 1.0))
98 ((Instrument_name Left_edge_item) . (extra-space 1.0))
99 ((Left_edge_item Clef_item) . (extra-space 1.0))
100 ((Left_edge_item Key_item) . (extra-space 0.0))
101 ((Left_edge_item begin-of-note) . (extra-space 1.0))
102 ((none Left_edge_item) . (extra-space 0.0))
103 ((Left_edge_item Staff_bar) . (extra-space 0.0))
104 ; ((none Left_edge_item) . (extra-space -15.0))
105 ; ((none Left_edge_item) . (extra-space -15.0))
106 ((none Clef_item) . (minimum-space 1.0))
107 ((none Staff_bar) . (minimum-space 0.0))
108 ((none Clef_item) . (minimum-space 1.0))
109 ((none Key_item) . (minimum-space 0.5))
110 ((none Time_signature) . (extra-space 0.0))
111 ((none begin-of-note) . (minimum-space 1.5))
112 ((Clef_item Key_item) . (minimum-space 4.0))
113 ((Key_item Time_signature) . (extra-space 1.0))
114 ((Clef_item Time_signature) . (minimum-space 3.5))
115 ((Staff_bar Clef_item) . (minimum-space 1.0))
116 ((Clef_item Staff_bar) . (minimum-space 3.7))
117 ((Time_signature Staff_bar) . (minimum-space 2.0))
118 ((Key_item Staff_bar) . (extra-space 1.0))
119 ((Staff_bar Time_signature) . (minimum-space 1.5)) ;double check this.
120 ((Time_signature begin-of-note) . (extra-space 2.0)) ;double check this.
121 ((Key_item begin-of-note) . (extra-space 2.5))
122 ((Staff_bar begin-of-note) . (extra-space 1.0))
123 ((Clef_item begin-of-note) . (minimum-space 5.0))
124 ((none Breathing_sign) . (minimum-space 0.0))
125 ((Breathing_sign Key_item) . (minimum-space 1.5))
126 ((Breathing_sign begin-of-note) . (minimum-space 1.0))
127 ((Breathing_sign Staff_bar) . (minimum-space 1.5))
128 ((Breathing_sign Clef_item) . (minimum-space 2.0))
133 (define (find-notehead-symbol duration style)
136 ((harmonic) "0mensural")
138 (string-append (number->string duration)
139 (if (< duration 0) "mensural" "")))
140 ((default) (number->string duration))
142 (string-append (number->string duration) (symbol->string style)))))
147 ;; this is silly, can't we use something like
148 ;; roman-0, roman-1 roman+1 ?
151 ("brace" . "feta-braces")
152 ("default" . "cmr10")
153 ("dynamic" . "feta-din")
157 ("typewriter" . "cmtt")
164 ("mark" . "feta-nummer")
165 ("finger" . "feta-nummer")
166 ("timesig" . "feta-nummer")
167 ("number" . "feta-nummer")
168 ("volta" . "feta-nummer"))
171 (define (string-encode-integer i)
174 ((< i 0) (string-append "n" (string-encode-integer (- i))))
176 (make-string 1 (integer->char (+ 65 (modulo i 26))))
177 (string-encode-integer (quotient i 26))
184 (cdr (assoc i '((-4 . 482)
197 (define script-alist '())
199 (define font-name-alist '())
200 (define (font-command name-mag)
202 (string-append "magfont"
203 (string-encode-integer (hashq (car name-mag) 1000000))
205 (string-encode-integer (cdr name-mag)))
209 (define (define-fonts names)
210 (set! font-name-alist (map font-command names))
213 (font-load-command (car x) (cdr x))) font-name-alist)
216 (define (fontify name exp)
217 (string-append (select-font name)
224 ; Make a function that checks score element for being of a specific type.
225 (define (make-type-checker symbol)
227 (not (eq? #f (memq symbol (ly-get-elt-property elt 'interfaces))))
230 ;;;;;;;;;;;;;;;;;;; TeX output
231 (define (tex-scm action-name)
236 (define (select-font font-name-symbol)
239 (c (assoc font-name-symbol font-name-alist))
244 (ly-warn (string-append
245 "Programming error: No such font known " (car font-name-symbol)))
246 "") ; issue no command
247 (string-append "\\" (cdr c)))
252 (define (beam width slope thick)
253 (embedded-ps ((ps-scm 'beam) width slope thick)))
255 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
256 (embedded-ps ((ps-scm 'bracket) arch_angle arch_width arch_height width height arch_thick thick)))
258 (define (dashed-slur thick dash l)
259 (embedded-ps ((ps-scm 'dashed-slur) thick dash l)))
261 (define (crescendo thick w h cont)
262 (embedded-ps ((ps-scm 'crescendo) thick w h cont)))
265 (string-append "\\char" (inexact->string i 10) " "))
267 (define (dashed-line thick dash w)
268 (embedded-ps ((ps-scm 'dashed-line) thick dash w)))
270 (define (decrescendo thick w h cont)
271 (embedded-ps ((ps-scm 'decrescendo) thick w h cont)))
273 (define (font-load-command name-mag command)
275 "\\font\\" command "="
276 (symbol->string (car name-mag))
278 (number->string (magstep (cdr name-mag)))
281 (define (embedded-ps s)
282 (string-append "\\embeddedps{" s "}"))
285 (string-append "% " s))
289 ; uncomment for some stats about lily memory
290 ; (display (gc-stats))
291 (string-append "\n\\EndLilyPondOutput"
295 (define (experimental-on)
298 (define (font-switch i)
302 (define (font-def i s)
304 "\\font" (font-switch i) "=" s "\n"))
310 ;; URG: ly-gulp-file: now we can't use scm output without Lily
312 ;; fixed in 1.3.4 for powerpc -- broken on Windows
313 (regexp-substitute/global #f "\n"
314 (ly-gulp-file "lily.ps") 'pre " %\n" 'post)
315 (ly-gulp-file "lily.ps"))
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
339 (regexp-substitute/global #f "\\\\" s 'pre "$\\backslash$" 'post)
340 (begin (display "warning: not paranoid") (newline) s))
343 (define (lily-def key val)
347 ;; fixed in 1.3.4 for powerpc -- broken on Windows
348 (regexp-substitute/global #f "_"
349 (output-tex-string key) 'pre "X" 'post)
350 (output-tex-string key))
351 "{" (output-tex-string val) "}\n"))
353 (define (number->dim x)
355 (ly-number->string x) " pt "))
357 (define (placebox x y s)
360 (number->dim y) "}{" (number->dim x) "}{" s "}\n"))
362 (define (bezier-sandwich l thick)
363 (embedded-ps ((ps-scm 'bezier-sandwich) l thick)))
365 (define (start-line ht)
366 (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n"))
369 "}\\vss}\\interscoreline\n")
370 (define (stop-last-line)
372 (define (filledbox breapth width depth height)
374 "\\kern" (number->dim (- breapth))
375 "\\vrule width " (number->dim (+ breapth width))
376 "depth " (number->dim depth)
377 "height " (number->dim height) " "))
380 (string-append "\\hbox{" (output-tex-string s) "}"))
382 (define (tuplet ht gapx dx dy thick dir)
383 (embedded-ps ((ps-scm 'tuplet) ht gapx dx dy thick dir)))
385 (define (volta h w thick vert_start vert_end)
386 (embedded-ps ((ps-scm 'volta) h w thick vert_start vert_end)))
388 (define (define-origin file line col)
389 ; use this for column positions
390 (string-append "\\special{src:" (number->string line) ":"
391 (number->string col) " " file "}")
394 ;(string-append "\\special{src:" (number->string line) " " file "}")
396 ; no-origin not yet supported by Xdvi
397 (define (no-origin) "")
400 ;; The procedures listed below form the public interface of TeX-scm.
401 ;; (should merge the 2 lists)
402 (cond ((eq? action-name 'all-definitions)
404 (define font-load-command ,font-load-command)
406 (define bezier-sandwich ,bezier-sandwich)
407 (define bracket ,bracket)
409 (define crescendo ,crescendo)
410 (define dashed-line ,dashed-line)
411 (define dashed-slur ,dashed-slur)
412 (define decrescendo ,decrescendo)
413 (define end-output ,end-output)
414 (define experimental-on ,experimental-on)
415 (define filledbox ,filledbox)
416 (define font-def ,font-def)
417 (define font-switch ,font-switch)
418 (define header-end ,header-end)
419 (define lily-def ,lily-def)
420 (define header ,header)
421 (define invoke-char ,invoke-char)
422 (define invoke-dim1 ,invoke-dim1)
423 (define placebox ,placebox)
424 (define select-font ,select-font)
425 (define start-line ,start-line)
426 (define stop-line ,stop-line)
427 (define stop-last-line ,stop-last-line)
429 (define tuplet ,tuplet)
430 (define volta ,volta)
431 (define define-origin ,define-origin)
432 (define no-origin ,no-origin)
435 ((eq? action-name 'beam) beam)
436 ((eq? action-name 'tuplet) tuplet)
437 ((eq? action-name 'bracket) bracket)
438 ((eq? action-name 'crescendo) crescendo)
439 ((eq? action-name 'dashed-line) dashed-line)
440 ((eq? action-name 'dashed-slur) dashed-slur)
441 ((eq? action-name 'decrescendo) decrescendo)
442 ((eq? action-name 'end-output) end-output)
443 ((eq? action-name 'experimental-on) experimental-on)
444 ((eq? action-name 'font-def) font-def)
445 ((eq? action-name 'font-switch) font-switch)
446 ((eq? action-name 'header-end) header-end)
447 ((eq? action-name 'lily-def) lily-def)
448 ((eq? action-name 'header) header)
449 ((eq? action-name 'invoke-char) invoke-char)
450 ((eq? action-name 'invoke-dim1) invoke-dim1)
451 ((eq? action-name 'placebox) placebox)
452 ((eq? action-name 'bezier-sandwich) bezier-sandwich)
453 ((eq? action-name 'start-line) start-line)
454 ((eq? action-name 'stem) stem)
455 ((eq? action-name 'stop-line) stop-line)
456 ((eq? action-name 'stop-last-line) stop-last-line)
457 ((eq? action-name 'volta) volta)
458 (else (error "unknown tag -- PS-TEX " action-name))
464 (define (ps-scm action-name)
466 ;; alist containing fontname -> fontcommand assoc (both strings)
467 (define font-alist '())
468 (define font-count 0)
469 (define current-font "")
472 (define (cached-fontname i)
475 (make-string 1 (integer->char (+ 65 i)))))
477 (define (mag-to-size m)
478 (number->string (case m
481 (2 14) ; really: 14.400
482 (3 17) ; really: 17.280
483 (4 21) ; really: 20.736
484 (5 24) ; really: 24.888
485 (6 30) ; really: 29.856
489 (define (select-font font-name-symbol)
492 (c (assoc font-name-symbol font-name-alist))
497 (ly-warn (string-append
498 "Programming error: No such font known " (car font-name-symbol)))
499 "") ; issue no command
500 (string-append " " (cdr c) " "))
505 (define (font-load-command name-mag command)
509 (symbol->string (car name-mag))
511 (number->string (magstep (cdr name-mag)))
512 " 1000 div 12 mul scalefont setfont } bind def "
516 (define (beam width slope thick)
518 (numbers->string (list width slope thick)) " draw_beam" ))
521 (string-append "% " s))
523 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
525 (numbers->string (list arch_angle arch_width arch_height width height arch_thick thick)) " draw_bracket" ))
528 (invoke-char " show" i))
530 (define (crescendo thick w h cont )
532 (numbers->string (list w h (inexact->exact cont) thick))
535 ;; what the heck is this interface ?
536 (define (dashed-slur thick dash l)
538 (apply string-append (map control->string l))
539 (number->string thick)
541 (number->string dash)
543 (number->string (* 10 thick)) ;UGH. 10 ?
544 " ] 0 draw_dashed_slur"))
546 (define (dashed-line thick dash width)
548 (number->string width)
550 (number->string thick)
552 (number->string dash)
554 (number->string dash)
555 " ] 0 draw_dashed_line"))
557 (define (decrescendo thick w h cont)
559 (numbers->string (list w h (inexact->exact cont) thick))
560 " draw_decrescendo"))
566 (define (experimental-on) "")
568 (define (filledbox breapth width depth height)
569 (string-append (numbers->string (list breapth width depth height))
573 (define (font-def i s)
576 (substring s 0 (- (string-length s) 4))
577 " findfont 12 scalefont setfont} bind def \n"))
579 (define (font-switch i)
580 (string-append (font i) " "))
584 ;; URG: now we can't use scm output without Lily
585 (ly-gulp-file "lilyponddefs.ps")
586 " {exch pop //systemdict /run get exec} "
587 (ly-gulp-file "lily.ps")
588 "{ exch pop //systemdict /run get exec } "
591 (define (lily-def key val)
593 (if (string=? (substring key 0 (min (string-length "mudelapaper") (string-length key))) "mudelapaper")
594 (string-append "/" key " {" val "} bind def\n")
595 (string-append "/" key " (" val ") def\n")
599 (define (header creator generate)
602 "%%Creator: " creator generate "\n"))
604 (define (invoke-char s i)
606 "(\\" (inexact->string i 8) ") " s " " ))
608 (define (invoke-dim1 s d)
610 (number->string (* d (/ 72.27 72))) " " s ))
612 (define (placebox x y s)
614 (number->string x) " " (number->string y) " {" s "} placebox "))
616 (define (bezier-sandwich l thick)
618 (apply string-append (map control->string l))
619 (number->string thick)
620 " draw_bezier_sandwich"))
622 (define (start-line height)
625 (define (stem breapth width depth height)
626 (string-append (numbers->string (list breapth width depth height))
633 (string-append "(" s ") show "))
636 (define (volta h w thick vert_start vert_end)
638 (numbers->string (list h w thick (inexact->exact vert_start) (inexact->exact vert_end)))
641 (define (tuplet ht gap dx dy thick dir)
643 (numbers->string (list ht gap dx dy thick (inexact->exact dir)))
651 (define (define-origin a b c ) "")
652 (define (no-origin) "")
655 (cond ((eq? action-name 'all-definitions)
658 (define tuplet ,tuplet)
659 (define bracket ,bracket)
661 (define crescendo ,crescendo)
662 (define volta ,volta)
663 (define bezier-sandwich ,bezier-sandwich)
664 (define dashed-line ,dashed-line)
665 (define dashed-slur ,dashed-slur)
666 (define decrescendo ,decrescendo)
667 (define end-output ,end-output)
668 (define experimental-on ,experimental-on)
669 (define filledbox ,filledbox)
670 (define font-def ,font-def)
671 (define font-switch ,font-switch)
672 (define header-end ,header-end)
673 (define lily-def ,lily-def)
674 (define font-load-command ,font-load-command)
675 (define header ,header)
676 (define invoke-char ,invoke-char)
677 (define invoke-dim1 ,invoke-dim1)
678 (define placebox ,placebox)
679 (define select-font ,select-font)
680 (define start-line ,start-line)
682 (define stop-line ,stop-line)
683 (define stop-last-line ,stop-line)
685 (define no-origin ,no-origin)
686 (define define-origin ,define-origin)
688 ((eq? action-name 'tuplet) tuplet)
689 ((eq? action-name 'beam) beam)
690 ((eq? action-name 'bezier-sandwich) bezier-sandwich)
691 ((eq? action-name 'bracket) bracket)
692 ((eq? action-name 'char) char)
693 ((eq? action-name 'crescendo) crescendo)
694 ((eq? action-name 'dashed-line) dashed-line)
695 ((eq? action-name 'dashed-slur) dashed-slur)
696 ((eq? action-name 'decrescendo) decrescendo)
697 ((eq? action-name 'experimental-on) experimental-on)
698 ((eq? action-name 'filledbox) filledbox)
699 ((eq? action-name 'select-font) select-font)
700 ((eq? action-name 'volta) volta)
701 (else (error "unknown tag -- PS-SCM " action-name))
706 (define (arg->string arg)
707 (cond ((number? arg) (inexact->string arg 10))
708 ((string? arg) (string-append "\"" arg "\""))
709 ((symbol? arg) (string-append "\"" (symbol->string arg) "\""))))
711 (define (func name . args)
717 (map (lambda (x) (string-append " " (arg->string x))) args)))
726 (define (as-scm action-name)
728 (define (beam width slope thick)
730 (func "set-line-char" "#")
731 (func "rline-to" width (* width slope))
735 (define (bezier-sandwich l thick)
742 (dy (- (cdr c3) (cdr c0)))
744 (c1-dx (- (car c1) x))
745 (c1-line-y (+ (cdr c0) (* c1-dx rc)))
746 (dir (if (< c1-line-y (cdr c1)) 1 -1))
747 (y (+ -1 (* dir (max (* dir (cdr c0)) (* dir (cdr c3)))))))
749 (func "rmove-to" x y)
750 (func "put" (if (< 0 dir) "/" "\\\\"))
751 (func "rmove-to" 1 (if (< 0 dir) 1 0))
752 (func "set-line-char" "_")
753 (func "h-line" (- dx 1))
754 (func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
755 (func "put" (if (< 0 dir) "\\\\" "/"))))))
757 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
759 (func "rmove-to" (+ width 1) (- (/ height -2) 1))
761 (func "set-line-char" "|")
762 (func "rmove-to" 0 1)
763 (func "v-line" (+ height 1))
764 (func "rmove-to" 0 (+ height 1))
771 (define (define-origin a b c ) "")
776 (define (experimental-on)
779 (define (filledbox breapth width depth height)
780 (let ((dx (+ width breapth))
781 (dy (+ depth height)))
783 (func "rmove-to" (* -1 breapth) (* -1 depth))
786 (func "set-line-char"
787 (if (<= dx 1) "|" "#"))
790 (func "set-line-char"
791 (if (<= dy 1) "-" "="))
792 (func "h-line" dx))))))
794 (define (font-load-command name-mag command)
795 (func "load-font" (car name-mag) (magstep (cdr name-mag))))
797 (define (header creator generate)
798 (func "header" creator generate))
803 ;; urg: this is good for half of as2text's execution time
804 (define (xlily-def key val)
805 (string-append "(define " key " " (arg->string val) ")\n"))
807 (define (lily-def key val)
809 (or (equal? key "mudelapaperlinewidth")
810 (equal? key "mudelapaperstaffheight"))
811 (string-append "(define " key " " (arg->string val) ")\n")
814 (define (no-origin) "")
816 (define (placebox x y s)
817 (let ((ey (inexact->exact y)))
818 (string-append "(move-to " (number->string (inexact->exact x)) " "
819 (if (= 0.5 (- (abs y) (abs ey)))
824 (define (select-font font-name-symbol)
825 (let* ((c (assoc font-name-symbol font-name-alist)))
830 "Programming error: No such font known "
831 (car font-name-symbol)))
832 "") ; issue no command
833 (func "select-font" (car font-name-symbol)))))
835 (define (start-line height)
836 (func "start-line" height))
844 (define (tuplet ht gap dx dy thick dir) "")
846 (define (volta h w thick vert-start vert-end)
849 (func "set-line-char" "|")
850 (func "rmove-to" 0 -4)
851 ;; definition strange-way around
855 (func "rmove-to" 1 h)
856 (func "set-line-char" "_")
857 (func "h-line" (- w 1))
858 (func "set-line-char" "|")
861 (func "rmove-to" (- w 1) (* -1 h))
862 (func "v-line" (* -1 h)))
865 (cond ((eq? action-name 'all-definitions)
868 (define bracket ,bracket)
870 (define define-origin ,define-origin)
871 ;;(define crescendo ,crescendo)
872 (define bezier-sandwich ,bezier-sandwich)
873 ;;(define dashed-slur ,dashed-slur)
874 ;;(define decrescendo ,decrescendo)
875 (define end-output ,end-output)
876 (define experimental-on ,experimental-on)
877 (define filledbox ,filledbox)
878 ;;(define font-def ,font-def)
879 (define font-load-command ,font-load-command)
880 ;;(define font-switch ,font-switch)
881 (define header ,header)
882 (define header-end ,header-end)
883 (define lily-def ,lily-def)
884 ;;(define invoke-char ,invoke-char)
885 ;;(define invoke-dim1 ,invoke-dim1)
886 (define no-origin ,no-origin)
887 (define placebox ,placebox)
888 (define select-font ,select-font)
889 (define start-line ,start-line)
890 ;;(define stem ,stem)
891 (define stop-line ,stop-line)
892 (define stop-last-line ,stop-line)
894 (define tuplet ,tuplet)
895 (define volta ,volta)
897 ((eq? action-name 'tuplet) tuplet)
898 ;;((eq? action-name 'beam) beam)
899 ;;((eq? action-name 'bezier-sandwich) bezier-sandwich)
900 ;;((eq? action-name 'bracket) bracket)
901 ((eq? action-name 'char) char)
902 ;;((eq? action-name 'crescendo) crescendo)
903 ;;((eq? action-name 'dashed-slur) dashed-slur)
904 ;;((eq? action-name 'decrescendo) decrescendo)
905 ;;((eq? action-name 'experimental-on) experimental-on)
906 ((eq? action-name 'filledbox) filledbox)
907 ((eq? action-name 'select-font) select-font)
908 ;;((eq? action-name 'volta) volta)
909 (else (error "unknown tag -- MUSA-SCM " action-name))
914 (define (gulp-file name)
915 (let* ((port (open-file name "r"))
916 (content (let loop ((text ""))
917 (let ((line (read-line port)))
918 (if (or (eof-object? line)
921 (loop (string-append text line "\n")))))))
925 ;; urg: Use when standalone, do:
926 ;; (define ly-gulp-file scm-gulp-file)
927 (define (scm-gulp-file name)
929 (cons (string-append (getenv 'LILYPONDPREFIX) "/ly")
930 (cons (string-append (getenv 'LILYPONDPREFIX) "/ps")
932 (let ((path (%search-load-path name)))
937 (define (scm-tex-output)
938 (ly-eval (tex-scm 'all-definitions)))
940 (define (scm-ps-output)
941 (ly-eval (ps-scm 'all-definitions)))
943 (define (scm-as-output)
944 (ly-eval (as-scm 'all-definitions)))
946 (define (index-cell cell dir)
952 ; How should a bar line behave at a break?
954 (define (break-barline glyph dir)
955 (let ((result (assoc glyph
956 '((":|:" . (":|" . "|:"))
959 ("|:" . ("|" . "|:"))
960 ("|." . ("|." . nil))
961 (".|" . (nil . ".|"))
962 (":|" . (":|" . nil))
963 ("||" . ("||" . nil))
964 (".|." . (".|." . nil))
965 ("scorebar" . (nil . "scorepostbreak"))
966 ("brace" . (nil . "brace"))
967 ("bracket" . (nil . "bracket"))
971 (if (equal? result #f)
972 (ly-warn (string-append "Unknown bar glyph: `" glyph "'"))
973 (index-cell (cdr result) dir))