;;;;
;;;; source file of the GNU LilyPond music typesetter
;;;;
-;;;; (c) 1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; (c) 1998--2005 Jan Nieuwenhuizen <janneke@gnu.org>
;;;; Han-Wen Nienhuys <hanwen@cs.uu.nl>
(use-modules (ice-9 regex)
(ice-9 safe)
+ (ice-9 optargs)
(oop goops)
(srfi srfi-1) ; lists
(srfi srfi-13)) ; strings
(define-public point-and-click #f)
+(define-public tex-backend?
+ (member (ly:output-backend) '("texstr" "tex")))
+
(define-public parser #f)
(define-public (lilypond-version)
(if (not (pred? arg))
(begin
- (ly:input-message location
- (format #f
- (_ "wrong type for argument ~a. Expecting ~a, found ~s")
- count (type-name pred?) arg))
+ (ly:input-message
+ location
+ (format
+ #f (_ "wrong type for argument ~a. Expecting ~a, found ~s")
+ count (type-name pred?) arg))
#f)
#t))
repeat-slash
round-filled-box
text
+ url-link
white-dot
white-text
+ embedded-ps
zigzag-line))
;; TODO:
placebox
unknown))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Safe definitions utility
+(define safe-objects (list))
+
+(define-macro (define-safe-public arglist . body)
+ "Define a variable, export it, and mark it as safe, ie usable in LilyPond safe mode.
+The syntax is the same as `define*-public'."
+ (define (get-symbol arg)
+ (if (pair? arg)
+ (get-symbol (car arg))
+ arg))
+ (let ((safe-symbol (get-symbol arglist)))
+ `(begin
+ (define*-public ,arglist
+ ,@body)
+ (set! safe-objects (cons (cons ',safe-symbol ,safe-symbol)
+ safe-objects))
+ ,safe-symbol)))
+
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; other files.
(for-each ly:load
;; load-from-path
'("lily-library.scm"
+ "file-cache.scm"
"define-music-types.scm"
"output-lib.scm"
"c++.scm"
"titling.scm"
"paper.scm"
-
+ "backend-library.scm"
; last:
"safe-lily.scm"))
outfile)))
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(define-public (ly:system command)
- (let* ((status 0)
-
- (silenced
- (string-append command (if (ly:get-option 'verbose)
- ""
- " > /dev/null 2>&1 "))))
-
- (if (ly:get-option 'verbose)
- (format (current-error-port) (_ "Invoking `~a'...\n") command))
-
- (set! status (system silenced))
- (if (> status 0)
- (begin
- (format (current-error-port)
- (_ "Error invoking `~a'. Return value ~a") silenced status)
- (newline (current-error-port))))))
-
-(define-public (sanitize-command-option str)
- (string-append
- "\""
- (regexp-substitute/global #f "[^- 0-9,.a-zA-Z'\"\\]" str 'pre 'post)
- "\""))
-
-(define-public (postscript->pdf papersizename name)
- (let* ((cmd (string-append "ps2pdf "
- (string-append
- " -sPAPERSIZE="
- (sanitize-command-option papersizename)
- " "
- name)))
- (pdf-name (string-append (basename name ".ps") ".pdf" )))
-
- (if (access? pdf-name W_OK)
- (delete-file pdf-name))
-
- (format (current-error-port) (_ "Converting to `~a'...") pdf-name)
- (ly:system cmd)))
-
-(define-public (postscript->png resolution name)
- (let ((cmd (string-append
- "ps2png --resolution="
- (if (number? resolution)
- (number->string resolution)
- "90 ")
- (if (ly:get-option 'verbose)
- "--verbose "
- " ")
- name)))
- (ly:system cmd)))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-public (lilypond-main files)
"Entry point for LilyPond."