]> git.donarmstrong.com Git - lilypond.git/blob - scm/standalone.scm
1bed6c7f5e3b1ece0a36bb80cfa38dd2ada7bb16
[lilypond.git] / scm / standalone.scm
1 ;;;; standalone.scm -- implement Scheme stuff for use without LilyPond
2 ;;;;
3 ;;;;  source file of the GNU LilyPond music typesetter
4 ;;;; 
5 ;;;; (c) 1998--2007 Jan Nieuwenhuizen <janneke@gnu.org>
6 ;;;;                 Han-Wen Nienhuys <hanwen@xs4all.nl>
7
8
9 (use-modules (ice-9 rdelim))
10
11 (define standalone (not (defined? 'ly:gulp-file)))
12 ;;(write standalone (current-error-port))
13
14 (define (gulp-file name)
15   (let* ((file (open-input-file name))
16          (text (read-delimited "" file)))
17     (close file)
18     text))
19
20 (define (scm-gulp-file name)
21   (set! %load-path 
22         (cons (string-append (getenv "LILYPOND_DATADIR") "/ly")
23               (cons (string-append (getenv "LILYPOND_DATADIR") "/ps")
24                     %load-path)))
25   (let ((path (%search-load-path name)))
26        (if path
27            (gulp-file path)
28            (gulp-file name))))
29
30 (define (scm-number->string x)
31   (let ((e (inexact->exact x)))
32     (string-append (if (= e x)
33                        (number->string e)
34                        (number->string x))
35                    " ")))
36
37 (define ly:gulp-file scm-gulp-file)
38 (define ly:number->string scm-number->string)
39
40 (eval-string (ly:gulp-file "lily.scm"))