1 ;------------------------------------------------------------------;
2 ; opus_libre -- 70-loadmacros.scm ;
4 ; (c) 2008-2010 Valentin Villenave <valentin@villenave.net> ;
6 ; opus_libre is a free framework for GNU LilyPond: you may ;
7 ; redistribute it and/or modify it under the terms of the GNU ;
8 ; General Public License, version 3 or later: gnu.org/licenses ;
10 ;------------------------------------------------------------------;
14 (defmacro make-simple-function (token expr)
15 (let* ((sym (if (is-defined? token)
16 (string->symbol (primitive-eval token))
19 (ly:make-music-function (list ly:music?)
20 (lambda (parser location x)
23 (defmacro make-script (str)
24 (let* ((sym (car (primitive-eval str)))
25 (script (cdr (primitive-eval str))))
27 (ly:make-music-function (list ly:music?)
28 (lambda (parser location mus)
29 (add-script mus ,script))))))
32 ;; Not used. See make-script above.
33 (define (make-scripts lst)
38 (set! lst (car lst))))
41 (eval-string (format #f
42 ;; hackish, but oh sooo convenient
44 (ly:make-music-function (list ly:music?)
45 (lambda (parser location mus)
46 (add-script mus \"~a\"))))" sym script)))
47 (if (not (null? rest)) (make-scripts rest))))
52 (load (string-append "../" x)))
53 (find-files conf:macros-dir ".scm$")))