]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/lily.scm
* Documentation/topdocs/INSTALL.texi (Top): Remove information
[lilypond.git] / scm / lily.scm
index e76b8307622029692ac55b18706e1ffff5c9c33b..0fe8fbfb22512e515f7d5fbcb89aa48be4c03188 100644 (file)
@@ -2,7 +2,7 @@
 ;;;;
 ;;;;  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>
 
 
@@ -13,6 +13,7 @@
 
 (use-modules (ice-9 regex)
             (ice-9 safe)
+             (ice-9 optargs)
             (oop goops)
             (srfi srfi-1)  ; lists
             (srfi srfi-13)) ; strings
@@ -88,10 +89,11 @@ predicates. Print a message at LOCATION if any predicate failed."
       (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))
 
@@ -137,6 +139,7 @@ predicates. Print a message at LOCATION if any predicate failed."
     repeat-slash
     round-filled-box
     text
+    url-link
     white-dot
     white-text
     embedded-ps
@@ -155,6 +158,26 @@ predicates. Print a message at LOCATION if any predicate failed."
     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.
 
@@ -277,10 +300,11 @@ predicates. Print a message at LOCATION if any predicate failed."
 (define-public (lilypond-main files)
   "Entry point for LilyPond."
   (let* ((failed '())
-        (handler (lambda (key arg) (set! failed (cons arg failed)))))
+        (handler (lambda (key . arg) (set! failed (append arg failed)))))
     (for-each
      (lambda (f)
-       (catch 'ly-file-failed (lambda () (ly:parse-file f)) handler)
+       (catch 'ly-file-failed (lambda () (ly:parse-file f))
+             (lambda (x) (handler x f)))
        (if #f
           (dump-gc-protects)))
      files)