-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(define (type-check-list location signature arguments)
- "Typecheck a list of arguments against a list of type predicates.
-Print a message at LOCATION if any predicate failed."
- (define (recursion-helper signature arguments count)
- (define (helper pred? arg count)
- (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))
- #f)
- #t))
-
- (if (null? signature)
- #t
- (and (helper (car signature) (car arguments) count)
- (recursion-helper (cdr signature) (cdr arguments) (1+ count)))))
- (recursion-helper signature arguments 1))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Safe definitions utility
-
-(define safe-objects
- (list))
-
-(define-macro (define-safe-public arglist . body)
- "Define a variable, export it, and mark it as safe, i.e. 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)))