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))
14 ; (set-debug-cell-accesses! #t)
19 ;; debugging evaluator is slower.
21 ;(debug-enable 'debug)
22 ;(debug-enable 'backtrace)
23 ;(read-enable 'positions)
26 (define point-and-click #f)
27 (define security-paranoia #f)
28 (define midi-debug #f)
30 (define (line-column-location line col file)
31 "Print an input location, including column number ."
32 (string-append (number->string line) ":"
33 (number->string col) " " file)
36 (define (line-location line col file)
37 "Print an input location, without column number ."
38 (string-append (number->string line) " " file)
41 ;; cpp hack to get useful error message
42 (define ifdef "First run this through cpp.")
43 (define ifndef "First run this through cpp.")
45 (define default-script-alist '())
46 (define font-name-alist '())
48 (if (not (defined? 'standalone))
49 (define standalone (not (defined? 'ly-gulp-file))))
51 ;; The regex module may not be available, or may be broken.
53 (let ((os (string-downcase (vector-ref (uname) 0))))
54 (not (equal? "cygwin" (substring os 0 (min 6 (string-length os)))))))
56 ;; If you have trouble with regex, define #f
58 ;;(define use-regex #f)
63 ;; URG guile-1.4/1.4.x compatibility
64 (if (not (defined? 'primitive-eval))
65 (define (primitive-eval form)
73 (define (write-me n x)
85 (define (filter-list pred? list)
86 "return that part of LIST for which PRED is true."
88 (let* ((rest (filter-list pred? (cdr list))))
89 (if (pred? (car list))
90 (cons (car list) rest)
93 (define (filter-out-list pred? list)
94 "return that part of LIST for which PRED is true."
96 (let* ((rest (filter-list pred? (cdr list))))
97 (if (not (pred? (car list)))
98 (cons (car list) rest)
101 (define (uniqued-alist alist acc)
102 (if (null? alist) acc
103 (if (assoc (caar alist) acc)
104 (uniqued-alist (cdr alist) acc)
105 (uniqued-alist (cdr alist) (cons (car alist) acc)))))
107 (define (uniq-list list)
109 (if (null? (cdr list))
111 (if (equal? (car list) (cadr list))
112 (uniq-list (cdr list))
113 (cons (car list) (uniq-list (cdr list)))))))
115 (define (alist<? x y)
116 (string<? (symbol->string (car x))
117 (symbol->string (car y))))
120 (let* ((fn (%search-load-path x)))
122 (format (current-error-port) "[~A]" fn))
123 (primitive-load fn)))
126 (use-modules (scm tex)
136 ("tex" . ("TeX output. The default output form." ,tex-output-expression))
137 ("ps" . ("Direct postscript. Requires setting GS_LIB and GS_FONTPATH" ,ps-output-expression))
138 ("scm" . ("Scheme dump: debug scheme molecule expressions" ,write))
139 ("as" . ("Asci-script. Postprocess with as2txt to get ascii art" ,as-output-expression))
140 ("sketch" . ("Bare bones Sketch output. Requires sketch 0.7" ,sketch-output-expression))
141 ("pdftex" . ("PDFTeX output. Was last seen nonfunctioning." ,pdftex-output-expression))
144 (define (pad-string-to str wid)
145 (string-append str (make-string (max (- wid (string-length str)) 0) #\ ))
148 (define (document-format-dumpers)
151 (display (string-append (pad-string-to 5 (car x)) (cadr x) "\n"))
155 (define (find-dumper format )
157 ((d (assoc format output-alist)))
161 (scm-error "Could not find dumper for format ~s" format))
179 "grob-property-description.scm"
180 "context-description.scm"
181 "interface-description.scm"
186 "music-functions.scm"
187 "music-property-description.scm"
189 "basic-properties.scm"
191 "grob-description.scm"
192 "translator-property-description.scm"