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)
20 (debug-enable 'backtrace)
23 (define point-and-click #f)
24 (define security-paranoia #f)
25 (define midi-debug #f)
27 (define (line-column-location line col file)
28 "Print an input location, including column number ."
29 (string-append (number->string line) ":"
30 (number->string col) " " file)
33 (define (line-location line col file)
34 "Print an input location, without column number ."
35 (string-append (number->string line) " " file)
38 ;; cpp hack to get useful error message
39 (define ifdef "First run this through cpp.")
40 (define ifndef "First run this through cpp.")
42 (define default-script-alist '())
43 (define font-name-alist '())
45 (if (not (defined? 'standalone))
46 (define standalone (not (defined? 'ly-gulp-file))))
48 ;; The regex module may not be available, or may be broken.
50 (let ((os (string-downcase (vector-ref (uname) 0))))
51 (not (equal? "cygwin" (substring os 0 (min 6 (string-length os)))))))
53 ;; If you have trouble with regex, define #f
55 ;;(define use-regex #f)
60 ;; URG guile-1.4/1.4.x compatibility
61 (if (not (defined? 'primitive-eval))
62 (define (primitive-eval form)
70 (define (write-me n x)
82 (define (filter-list pred? list)
83 "return that part of LIST for which PRED is true."
85 (let* ((rest (filter-list pred? (cdr list))))
86 (if (pred? (car list))
87 (cons (car list) rest)
90 (define (filter-out-list pred? list)
91 "return that part of LIST for which PRED is true."
93 (let* ((rest (filter-list pred? (cdr list))))
94 (if (not (pred? (car list)))
95 (cons (car list) rest)
98 (define (uniqued-alist alist acc)
100 (if (assoc (caar alist) acc)
101 (uniqued-alist (cdr alist) acc)
102 (uniqued-alist (cdr alist) (cons (car alist) acc)))))
104 (define (uniq-list list)
106 (if (null? (cdr list))
108 (if (equal? (car list) (cadr list))
109 (uniq-list (cdr list))
110 (cons (car list) (uniq-list (cdr list)))))))
112 (define (alist<? x y)
113 (string<? (symbol->string (car x))
114 (symbol->string (car y))))
117 (let* ((fn (%search-load-path x)))
119 (format (current-error-port) "[~A]" fn))
120 (primitive-load fn)))
123 (use-modules (scm tex)
133 ("tex" . ("TeX output. The default output form." ,tex-output-expression))
134 ("ps" . ("Direct postscript. Requires setting GS_LIB and GS_FONTPATH" ,ps-output-expression))
135 ("scm" . ("Scheme dump: debug scheme molecule expressions" ,write))
136 ("as" . ("Asci-script. Postprocess with as2txt to get ascii art" ,as-output-expression))
137 ("sketch" . ("Bare bones Sketch output. Requires sketch 0.7" ,sketch-output-expression))
138 ("pdftex" . ("PDFTeX output. Was last seen nonfunctioning." ,pdftex-output-expression))
141 (define (pad-string-to str wid)
142 (string-append str (make-string (max (- wid (string-length str)) 0) #\ ))
145 (define (document-format-dumpers)
148 (display (string-append (pad-string-to 5 (car x)) (cadr x) "\n"))
152 (define (find-dumper format )
154 ((d (assoc format output-alist)))
158 (scm-error "Could not find dumper for format ~s" format))
176 "grob-property-description.scm"
177 "context-description.scm"
178 "interface-description.scm"
183 "music-functions.scm"
184 "music-property-description.scm"
186 "basic-properties.scm"
188 "grob-description.scm"
189 "translator-property-description.scm"