X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fmusic-function-scheme.cc;h=93c7e0fbc4773cbc121ca45779b1c71db26c8c96;hb=1265d01b03ae4cbf1913f51a063cda8dc2842cf0;hp=828929994a93515b22840709f5a5efdcda65d28c;hpb=c5a3f0c024f4cb629811cff9eb04abff36e94138;p=lilypond.git diff --git a/lily/music-function-scheme.cc b/lily/music-function-scheme.cc index 828929994a..93c7e0fbc4 100644 --- a/lily/music-function-scheme.cc +++ b/lily/music-function-scheme.cc @@ -1,29 +1,44 @@ #include "music-function.hh" LY_DEFINE (ly_music_function_p, "ly:music-function?", 1, 0, 0, - (SCM x), - "Is @var{x} an @code{music-function}?") + (SCM x), + "Is @var{x} a @code{music-function}?") { return is_music_function (x) ? SCM_BOOL_T : SCM_BOOL_F; } - + LY_DEFINE (ly_music_function_extract, "ly:music-function-extract", 1, 0, 0, - (SCM x), - "Return the Scheme function inside @var{x}") + (SCM x), + "Return the Scheme function inside@tie{}@var{x}.") { LY_ASSERT_TYPE (is_music_function, x, 1); - - return SCM_CELL_OBJECT_1(x); + + return SCM_CELL_OBJECT_1 (x); } LY_DEFINE (ly_make_music_function, "ly:make-music-function", 2, 0, 0, - (SCM signature, SCM func), - "Make a function to process music, to be used for the " - "parser. @code{func} is the function, and @code{signature} describes " - "Its arguments. @code{signature} is a list containing either " - "@code{ly:music?} predicates or other type predicates.") + (SCM signature, SCM func), + "Make a function to process music, to be used for the" + " parser. @var{func} is the function, and @var{signature}" + " describes its arguments. @var{signature}'s cdr is a list" + " containing either @code{ly:music?} predicates or other type" + " predicates. Its car is the syntax function to call.") { - LY_ASSERT_TYPE (ly_is_procedure, func, 1); - return make_music_function (signature, func); + LY_ASSERT_TYPE (ly_is_list, signature, 1); + LY_ASSERT_TYPE (ly_is_procedure, func, 2); + int n = 0; + for (SCM p = signature; scm_is_pair (p); p = scm_cdr (p), ++n) + { + SCM proc = scm_car (p); + if (scm_is_pair (proc)) + proc = scm_car (proc); + if (scm_is_false (scm_procedure_p (proc))) + { + scm_wrong_type_arg_msg ("music-function", n, p, + "music function predicate"); + } + } + + return make_music_function (signature, func); }