if (scm_is_eq (cs, ly_lily_module_constant ("ly:music?")))
funtype = MUSIC_FUNCTION;
+ else if (scm_is_eq (cs, ly_lily_module_constant ("ly:event?")))
+ funtype = EVENT_FUNCTION;
else if (ly_is_procedure (cs))
funtype = SCM_FUNCTION;
else programming_error ("Bad syntax function predicate");
%token <scm> PITCH_IDENTIFIER
%token <scm> DURATION_IDENTIFIER
%token <scm> EVENT_IDENTIFIER
+%token <scm> EVENT_FUNCTION
%token <scm> FRACTION
%token <scm> LYRICS_STRING
%token <scm> LYRIC_MARKUP_IDENTIFIER
%type <scm> embedded_scm_closed
%type <scm> embedded_scm_chord_body
%type <scm> embedded_scm_event
+%type <scm> event_function_event
%type <scm> figure_list
%type <scm> figure_spec
%type <scm> fraction
}
;
+event_function_event:
+ EVENT_FUNCTION music_function_event_arglist {
+ $$ = run_music_function (PARSER, @$,
+ $1, $2);
+ }
+ ;
+
command_element:
command_event {
$$ = $1;
a->set_property ("tremolo-type", scm_from_int ($1));
$$ = a->unprotect ();
}
+ | event_function_event
;
direction_reqd_event:
`(define-syntax-function scheme? ,@rest))
+(defmacro-public define-event-function rest
+ "Defining macro returning event functions.
+Syntax:
+ (define-event-function (parser location arg1 arg2 ...) (arg1-type? arg2-type? ...)
+ ...function body...)
+
+argX-type can take one of the forms @code{predicate?} for mandatory
+arguments satisfying the predicate, @code{(predicate?)} for optional
+parameters of that type defaulting to @code{#f}, @code{@w{(predicate?
+value)}} for optional parameters with a specified default
+value (evaluated at definition time). An optional parameter can be
+omitted in a call only when it can't get confused with a following
+parameter of different type.
+
+Predicates with syntactical significance are @code{ly:pitch?},
+@code{ly:duration?}, @code{ly:music?}, @code{markup?}. Other
+predicates require the parameter to be entered as Scheme expression.
+
+Must return an event expression. The @code{origin} is automatically
+set to the @code{location} parameter."
+
+ `(define-syntax-function (ly:event? (make-music 'Event 'void #t)) ,@rest))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;