1 ;;;; lily.scm -- implement Scheme output routines for TeX and PostScript
3 ;;;; source file of the GNU LilyPond music typesetter
5 ;;;; (c) 1998--2001 Jan Nieuwenhuizen <janneke@gnu.org>
6 ;;;; Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 (use-modules (ice-9 regex))
12 ;;(write standalone (current-error-port))
16 ;; debugging evaluator is slower.
18 ;(debug-enable 'debug)
19 ;(debug-enable 'backtrace)
20 ;(read-enable 'positions)
21 ;(set-debug-cell-accesses! #f)
25 (define point-and-click #f)
26 (define security-paranoia #f)
27 (define midi-debug #f)
29 (define (line-column-location line col file)
30 "Print an input location, including column number ."
31 (string-append (number->string line) ":"
32 (number->string col) " " file)
35 (define (line-location line col file)
36 "Print an input location, without column number ."
37 (string-append (number->string line) " " file)
40 ;; cpp hack to get useful error message
41 (define ifdef "First run this through cpp.")
42 (define ifndef "First run this through cpp.")
44 (define default-script-alist '())
45 (define font-name-alist '())
47 (if (not (defined? 'standalone))
48 (define standalone (not (defined? 'ly-gulp-file))))
50 ;; The regex module may not be available, or may be broken.
52 (let ((os (string-downcase (vector-ref (uname) 0))))
53 (not (equal? "cygwin" (substring os 0 (min 6 (string-length os)))))))
55 ;; If you have trouble with regex, define #f
57 ;;(define use-regex #f)
62 ;; URG guile-1.4/1.4.x compatibility
63 (if (not (defined? 'primitive-eval))
64 (define (primitive-eval form)
72 (define (write-me n x)
84 (define (filter-list pred? list)
85 "return that part of LIST for which PRED is true."
87 (let* ((rest (filter-list pred? (cdr list))))
88 (if (pred? (car list))
89 (cons (car list) rest)
92 (define (filter-out-list pred? list)
93 "return that part of LIST for which PRED is true."
95 (let* ((rest (filter-list pred? (cdr list))))
96 (if (not (pred? (car list)))
97 (cons (car list) rest)
100 (define (uniqued-alist alist acc)
101 (if (null? alist) acc
102 (if (assoc (caar alist) acc)
103 (uniqued-alist (cdr alist) acc)
104 (uniqued-alist (cdr alist) (cons (car alist) acc)))))
106 (define (uniq-list list)
108 (if (null? (cdr list))
110 (if (equal? (car list) (cadr list))
111 (uniq-list (cdr list))
112 (cons (car list) (uniq-list (cdr list)))))))
114 (define (alist<? x y)
115 (string<? (symbol->string (car x))
116 (symbol->string (car y))))
119 (let* ((fn (%search-load-path x)))
121 (format (current-error-port) "[~A]" fn))
122 (primitive-load fn)))
125 (use-modules (scm tex)
135 ("tex" . ("TeX output. The default output form." ,tex-output-expression))
136 ("ps" . ("Direct postscript. Requires setting GS_LIB and GS_FONTPATH" ,ps-output-expression))
137 ("scm" . ("Scheme dump: debug scheme molecule expressions" ,write))
138 ("as" . ("Asci-script. Postprocess with as2txt to get ascii art" ,as-output-expression))
139 ("sketch" . ("Bare bones Sketch output. Requires sketch 0.7" ,sketch-output-expression))
140 ("pdftex" . ("PDFTeX output. Was last seen nonfunctioning." ,pdftex-output-expression))
143 (define (pad-string-to str wid)
144 (string-append str (make-string (max (- wid (string-length str)) 0) #\ ))
147 (define (document-format-dumpers)
150 (display (string-append (pad-string-to 5 (car x)) (cadr x) "\n"))
154 (define (find-dumper format )
156 ((d (assoc format output-alist)))
160 (scm-error "Could not find dumper for format ~s" format))
178 "grob-property-description.scm"
179 "context-description.scm"
180 "interface-description.scm"
185 "music-functions.scm"
186 "music-property-description.scm"
188 "basic-properties.scm"
190 "grob-description.scm"
191 "translator-property-description.scm"