]> git.donarmstrong.com Git - lilypond.git/blob - scm/lily.scm
release: 1.3.149
[lilypond.git] / scm / lily.scm
1 ;;;; lily.scm -- implement Scheme output routines for TeX and PostScript
2 ;;;;
3 ;;;;  source file of the GNU LilyPond music typesetter
4 ;;;; 
5 ;;;; (c) 1998--2001 Jan Nieuwenhuizen <janneke@gnu.org>
6 ;;;; Han-Wen Nienhuys <hanwen@cs.uu.nl>
7
8 ;;; Library funtions
9
10 (use-modules (ice-9 regex))
11
12 ;;(write standalone (current-error-port))
13
14 ;;; General settings
15
16 (debug-enable 'backtrace)
17
18
19 (define point-and-click #f)
20 (define security-paranoia #f)
21 (define midi-debug #f)
22
23 (define (line-column-location line col file)
24   "Print an input location, including column number ."
25   (string-append (number->string line) ":"
26                  (number->string col) " " file)
27   )
28
29 (define (line-location line col file)
30   "Print an input location, without column number ."
31   (string-append (number->string line) " " file)
32   )
33
34 ;; cpp hack to get useful error message
35 (define ifdef "First run this through cpp.")
36 (define ifndef "First run this through cpp.")
37   
38 (define default-script-alist '())
39 (define font-name-alist  '())
40
41 (if (not (defined? 'standalone))
42     (define standalone (not (defined? 'ly-gulp-file))))
43
44 ;; The regex module may not be available, or may be broken.
45 (define use-regex
46   (let ((os (string-downcase (vector-ref (uname) 0))))
47     (not (equal? "cygwin" (substring os 0 (min 6 (string-length os)))))))
48
49 ;; If you have trouble with regex, define #f
50 (define use-regex #t)
51 ;;(define use-regex #f)
52
53
54 ;;; Un-assorted stuff
55
56 ;; URG guile-1.4/1.4.x compatibility
57 (define (ly-eval x) (eval2 x #f))
58
59 (define (sign x)
60   (if (= x 0)
61       1
62       (if (< x 0) -1 1)))
63
64 (define (write-me n x)
65   (display n)
66   (write x)
67   (newline)
68   x)
69
70 (define (empty? x)
71   (equal? x '()))
72
73 (define (!= l r)
74   (not (= l r)))
75
76 (define (filter-list pred? list)
77   "return that part of LIST for which PRED is true."
78   (if (null? list) '()
79       (let* ((rest  (filter-list pred? (cdr list))))
80         (if (pred?  (car list))
81             (cons (car list)  rest)
82             rest))))
83
84 (define (filter-out-list pred? list)
85   "return that part of LIST for which PRED is true."
86   (if (null? list) '()
87       (let* ((rest  (filter-list pred? (cdr list))))
88         (if (not (pred?  (car list)))
89             (cons (car list)  rest)
90             rest))))
91
92 (define (uniqued-alist  alist acc)
93   (if (null? alist) acc
94       (if (assoc (caar alist) acc)
95           (uniqued-alist (cdr alist) acc)
96           (uniqued-alist (cdr alist) (cons (car alist) acc)))))
97
98 (define (uniq-list list)
99   (if (null? list) '()
100       (if (null? (cdr list))
101           list
102           (if (equal? (car list) (cadr list))
103               (uniq-list (cdr list))
104               (cons (car list) (uniq-list (cdr list)))))))
105
106 (define (alist<? x y)
107   (string<? (symbol->string (car x))
108             (symbol->string (car y))))
109
110
111 (map (lambda (x) (eval-string (ly-gulp-file x)))
112      '("output-lib.scm"
113        "tex.scm"
114        "ps.scm"
115        "ascii-script.scm"
116        ))
117
118 (if (not standalone)
119     (map (lambda (x) (eval-string (ly-gulp-file x)))
120          '("c++.scm"
121            "grob-property-description.scm"
122            "translator-property-description.scm"
123            "interface-description.scm"
124            "beam.scm"
125            "clef.scm"
126            "slur.scm"
127            "font.scm"
128            "music-functions.scm"
129            "music-property-description.scm"
130            "auto-beam.scm"
131            "generic-property.scm"
132            "basic-properties.scm"
133            "chord-name.scm"
134            "grob-description.scm"
135            "script.scm"
136            "drums.scm"
137            "midi.scm"
138            )))
139
140