;;;;
;;;; 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
(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
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"