]> git.donarmstrong.com Git - lilypond.git/commitdiff
Define define-void-function and \void
authorDavid Kastrup <dak@gnu.org>
Wed, 19 Oct 2011 12:50:57 +0000 (14:50 +0200)
committerDavid Kastrup <dak@gnu.org>
Thu, 20 Oct 2011 16:59:38 +0000 (18:59 +0200)
ly/music-functions-init.ly
scm/music-functions.scm

index af09d9db1481882a939e3c74012124fb6c6cdcd4..369d62ea3fa1d9e103486494d2633ff7968b2594 100644 (file)
@@ -38,13 +38,13 @@ acciaccatura =
 %% keep these two together
 "instrument-definitions" = #'()
 addInstrumentDefinition =
-#(define-scheme-function
+#(define-void-function
    (parser location name lst) (string? list?)
    (_i "Create instrument @var{name} with properties @var{list}.")
    (set! instrument-definitions (acons name lst instrument-definitions)))
 
 addQuote =
-#(define-scheme-function (parser location name music) (string? ly:music?)
+#(define-void-function (parser location name music) (string? ly:music?)
    (_i "Define @var{music} as a quotable music expression named
 @var{name}")
    (add-quotable parser name music))
@@ -194,12 +194,12 @@ bendAfter =
               'delta-step delta))
 
 bookOutputName =
-#(define-scheme-function (parser location newfilename) (string?)
+#(define-void-function (parser location newfilename) (string?)
    (_i "Direct output for the current book block to @var{newfilename}.")
    (set! book-filename newfilename))
 
 bookOutputSuffix =
-#(define-scheme-function (parser location newsuffix) (string?)
+#(define-void-function (parser location newsuffix) (string?)
    (_i "Set the output filename suffix for the current book block to
 @var{newsuffix}.")
    (set! book-output-suffix newsuffix))
@@ -501,18 +501,18 @@ label =
 
 
 language =
-#(define-scheme-function (parser location language) (string?)
+#(define-void-function (parser location language) (string?)
    (_i "Set note names for language @var{language}.")
    (note-names-language parser language))
 
 languageSaveAndChange =
-#(define-scheme-function (parser location language) (string?)
+#(define-void-function (parser location language) (string?)
   (_i "Store the previous pitchnames alist, and set a new one.")
   (set! previous-pitchnames pitchnames)
   (note-names-language parser language))
 
 languageRestore =
-#(define-scheme-function (parser location) ()
+#(define-void-function (parser location) ()
    (_i "Restore a previously-saved pitchnames alist.")
    (if previous-pitchnames
        (begin
@@ -666,7 +666,7 @@ pageTurn =
                                           'break-permission 'force))))
 
 parallelMusic =
-#(define-scheme-function (parser location voice-ids music) (list? ly:music?)
+#(define-void-function (parser location voice-ids music) (list? ly:music?)
    (_i "Define parallel music sequences, separated by '|' (bar check signs),
 and assign them to the identifiers provided in @var{voice-ids}.
 
@@ -1055,6 +1055,11 @@ unfoldRepeats =
 as @code{\\repeat unfold}.")
    (unfold-repeats music))
 
+void =
+#(define-void-function (parser location arg) (scheme?)
+   (_i "Accept a scheme argument, return a void expression.
+Use this if you want to have a scheme expression evaluated
+because of its side-effects, but its value ignored."))
 
 
 withMusicProperty =
index be4d62e438de36c7a67aba984bfbbbf097eea357..bfec250992e5c9c7910e496a7f40823a48fadd6e 100644 (file)
@@ -850,6 +850,14 @@ parameter."
 
   `(define-syntax-function scheme? ,@rest))
 
+(defmacro-public define-void-function rest
+  "This defines a Scheme function like @code{define-scheme-function} with
+void return value (i.e., what most Guile functions with `unspecified'
+value return).  Use this when defining functions for executing actions
+rather than returning values, to keep Lilypond from trying to interpret
+the return value."
+  `(define-syntax-function void? ,@rest #f (begin)))
+
 (defmacro-public define-event-function rest
   "Defining macro returning event functions.
 Syntax: