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)
24 (define point-and-click #f)
25 (define security-paranoia #f)
26 (define midi-debug #f)
28 (define (line-column-location line col file)
29 "Print an input location, including column number ."
30 (string-append (number->string line) ":"
31 (number->string col) " " file)
34 (define (line-location line col file)
35 "Print an input location, without column number ."
36 (string-append (number->string line) " " file)
39 ;; cpp hack to get useful error message
40 (define ifdef "First run this through cpp.")
41 (define ifndef "First run this through cpp.")
43 (define default-script-alist '())
44 (define font-name-alist '())
46 (if (not (defined? 'standalone))
47 (define standalone (not (defined? 'ly-gulp-file))))
49 ;; The regex module may not be available, or may be broken.
51 (let ((os (string-downcase (vector-ref (uname) 0))))
52 (not (equal? "cygwin" (substring os 0 (min 6 (string-length os)))))))
54 ;; If you have trouble with regex, define #f
56 ;;(define use-regex #f)
61 ;; URG guile-1.4/1.4.x compatibility
62 (if (not (defined? 'primitive-eval))
63 (define (primitive-eval form)
71 (define (write-me n x)
83 (define (filter-list pred? list)
84 "return that part of LIST for which PRED is true."
86 (let* ((rest (filter-list pred? (cdr list))))
87 (if (pred? (car list))
88 (cons (car list) rest)
91 (define (filter-out-list pred? list)
92 "return that part of LIST for which PRED is true."
94 (let* ((rest (filter-list pred? (cdr list))))
95 (if (not (pred? (car list)))
96 (cons (car list) rest)
99 (define (uniqued-alist alist acc)
100 (if (null? alist) acc
101 (if (assoc (caar alist) acc)
102 (uniqued-alist (cdr alist) acc)
103 (uniqued-alist (cdr alist) (cons (car alist) acc)))))
105 (define (uniq-list list)
107 (if (null? (cdr list))
109 (if (equal? (car list) (cadr list))
110 (uniq-list (cdr list))
111 (cons (car list) (uniq-list (cdr list)))))))
113 (define (alist<? x y)
114 (string<? (symbol->string (car x))
115 (symbol->string (car y))))
118 (let* ((fn (%search-load-path x)))
120 (format (current-error-port) "[~A]" fn))
121 (primitive-load fn)))
124 (use-modules (scm tex)
134 ("tex" . ("TeX output. The default output form." ,tex-output-expression))
135 ("ps" . ("Direct postscript. Requires setting GS_LIB and GS_FONTPATH" ,ps-output-expression))
136 ("scm" . ("Scheme dump: debug scheme molecule expressions" ,write))
137 ("as" . ("Asci-script. Postprocess with as2txt to get ascii art" ,as-output-expression))
138 ("sketch" . ("Bare bones Sketch output. Requires sketch 0.7" ,sketch-output-expression))
139 ("pdftex" . ("PDFTeX output. Was last seen nonfunctioning." ,pdftex-output-expression))
142 (define (pad-string-to str wid)
143 (string-append str (make-string (max (- wid (string-length str)) 0) #\ ))
146 (define (document-format-dumpers)
149 (display (string-append (pad-string-to 5 (car x)) (cadr x) "\n"))
153 (define (find-dumper format )
155 ((d (assoc format output-alist)))
159 (scm-error "Could not find dumper for format ~s" format))
177 "grob-property-description.scm"
178 "context-description.scm"
179 "interface-description.scm"
184 "music-functions.scm"
185 "music-property-description.scm"
187 "basic-properties.scm"
189 "grob-description.scm"
190 "translator-property-description.scm"