From 2937a2ef4e8db132f31d7ef029bdacce4bc3dd3b Mon Sep 17 00:00:00 2001 From: Valentin Villenave Date: Wed, 22 May 2013 01:00:44 +0200 Subject: [PATCH] Use new \tuplet syntax --- bin/macros.scm | 29 +++++++++++++++++++---------- bin/markup-commands.scm | 2 +- lib/40-loadmacros.scm | 14 ++++++-------- lib/70-findskel.scm | 4 ++-- lib/80-buildskel.scm | 2 +- lib/init.scm | 4 +++- lib/libmusic.scm | 2 +- 7 files changed, 33 insertions(+), 24 deletions(-) diff --git a/bin/macros.scm b/bin/macros.scm index 22796e0..fcbec14 100644 --- a/bin/macros.scm +++ b/bin/macros.scm @@ -24,17 +24,26 @@ ;; TODO: use make-simple-function everywhere possible. ;; Rhythm shortcuts -----------------------------------------------; -(make-simple-function lang:tuplet-letter ; default: \t - #{ \times 2/3 $x #}) +(make-function lang:tuplet-letter ; default: \t + (define-music-function (parser location span music) + ((ly:duration? '()) ly:music?) + #{ \tuplet 3/2 $(if (not-null? span) span) $music #})) + +(make-function lang:tuplet-letter-double ; \tt + (define-music-function (parser location span music) + ((ly:duration? '()) ly:music?) + #{ \tuplet 5/4 $(if (not-null? span) span) $music #})) + +(make-function lang:tuplet-letter-triple ; \ttt + (define-music-function (parser location span music) + ((ly:duration? '()) ly:music?) + #{ \tuplet 6/4 $(if (not-null? span) span) $music #})) + +(make-function lang:tuplet-letter-quad ; \tttt + (define-music-function (parser location span music) + ((ly:duration? '()) ly:music?) + #{ \tuplet 7/4 $(if (not-null? span) span) $music #})) -(make-simple-function lang:tuplet-letter-double ; \tt - #{ \times 4/5 $x #}) - -(make-simple-function lang:tuplet-letter-triple ; \ttt - #{ \times 4/6 $x #}) - -(make-simple-function lang:tuplet-letter-quad ; \tttt - #{ \times 4/7 $x #}) ;; Time signature equivalence (define equiv diff --git a/bin/markup-commands.scm b/bin/markup-commands.scm index b0ccf66..d3db5d0 100644 --- a/bin/markup-commands.scm +++ b/bin/markup-commands.scm @@ -41,7 +41,7 @@ currents current-is-lower) prev-result))) (let* ((ch1 (car rest-chars)) - (ch2 (and (not (null? (cdr rest-chars))) (cadr rest-chars))) + (ch2 (and (not-null? (cdr rest-chars)) (cadr rest-chars))) (this-char-string (string ch1)) (is-lower (char-lower-case? ch1)) (next-rest-chars (cdr rest-chars))) diff --git a/lib/40-loadmacros.scm b/lib/40-loadmacros.scm index 99bba7d..308aa14 100644 --- a/lib/40-loadmacros.scm +++ b/lib/40-loadmacros.scm @@ -18,14 +18,12 @@ - -(defmacro make-simple-function (token expr) +(defmacro make-function (token funct) (let* ((sym (if (defined-string? token) - (string->symbol (primitive-eval token)) - token))) - `(define-public ,sym - (define-music-function (parser location x) (ly:music?) - ,expr)))) + (string->symbol (primitive-eval token)) + token))) + `(define-public ,sym ,funct))) + (defmacro staff-change-command (token) (let* ((str (primitive-eval token)) @@ -59,7 +57,7 @@ "(define-public ~a (define-music-function (parser location mus) (ly:music?) (add-script mus \"~a\")))" sym script))) - (if (not (null? rest)) (make-scripts rest)))) + (if (not-null? rest) (make-scripts rest)))) (define (load-macros-in dir) (map (lambda (x) diff --git a/lib/70-findskel.scm b/lib/70-findskel.scm index 3f8c2f7..c40a752 100644 --- a/lib/70-findskel.scm +++ b/lib/70-findskel.scm @@ -43,8 +43,8 @@ in the local conf dir or in the global skeleton repository." (global-skel (find-files conf:skel-dir (string-append "/" skelname ".lyskel$")))) - (if (not (null? local-skel)) (car local-skel) - (if (not (null? global-skel)) (car global-skel) + (if (not-null? local-skel) (car local-skel) + (if (not-null? global-skel) (car global-skel) #f)))) (define (skel-file arg) diff --git a/lib/80-buildskel.scm b/lib/80-buildskel.scm index c0b65e0..014289c 100644 --- a/lib/80-buildskel.scm +++ b/lib/80-buildskel.scm @@ -112,7 +112,7 @@ exists with that name. If so, parse it." \filterDynamics $m #})))))) str-list) - (if (not (null? ret-list)) + (if (not-null? ret-list) (make-simultaneous-music ret-list) (make-music 'Music 'void #t))))) diff --git a/lib/init.scm b/lib/init.scm index fd7a462..c7199cb 100644 --- a/lib/init.scm +++ b/lib/init.scm @@ -31,6 +31,8 @@ ; parameters (srfi srfi-39)) +(define-public (not-null? x) (not (null? x))) +(define-public (false-or-null? x) (or (not x) (null? x))) (define-public (ly:debug-message string . rest) (if (ly:get-option 'verbose) @@ -86,7 +88,7 @@ (sort (do-dir dir '()) string