- | grace_head Music {
-#if 1
- /*
- The other version is for easier debugging of
- Sequential_music_iterator in combination with grace notes.
- */
-
-/*
-
-TODO: should distinguish between both grace types in the
-basic music objects too, since the meaning is different.
-
-*/
-
- String start_str = "start" + ly_scm2string ($1) + "Music";
- String stop_str = "stop" + ly_scm2string ($1) + "Music";
-
- SCM start = THIS->lexer_->lookup_identifier (start_str);
- SCM stop = THIS->lexer_->lookup_identifier (stop_str);
-
- Music *startm = unsmob_music (start);
- Music *stopm = unsmob_music (stop);
-
- SCM ms = SCM_EOL;
- if (stopm) {
- stopm = stopm->clone ();
- ms = scm_cons (stopm->self_scm (), ms);
- scm_gc_unprotect_object (stopm->self_scm ());
- }
- ms = scm_cons ($2->self_scm (), ms);
- scm_gc_unprotect_object ($2->self_scm ());
- if (startm) {
- startm = startm->clone ();
- ms = scm_cons (startm->self_scm (), ms);
- scm_gc_unprotect_object (startm->self_scm ());
+ | MUSIC_FUNCTION_SCM_MUSIC {
+ THIS->push_spot ();
+ } embedded_scm Music {
+ $$ = scm_list_4 ($1, make_input (THIS->pop_spot ()), $3, $4->self_scm ());
+ scm_gc_unprotect_object ($4->self_scm ());
+ }
+ | MUSIC_FUNCTION_SCM_SCM {
+ THIS->push_spot ();
+ } embedded_scm embedded_scm {
+ $$ = scm_list_4 ($1, make_input (THIS->pop_spot ()), $3, $4);
+ }
+ | MUSIC_FUNCTION_MUSIC_MUSIC {
+ THIS->push_spot ();
+ } Music Music {
+ $$ = scm_list_4 ($1, make_input (THIS->pop_spot ()), $3->self_scm (), $4->self_scm ());
+ scm_gc_unprotect_object ($3->self_scm ());
+ scm_gc_unprotect_object ($4->self_scm ());
+ }
+ | MUSIC_FUNCTION_SCM_MUSIC_MUSIC {
+ THIS->push_spot ();
+ } embedded_scm Music Music {
+ $$ = scm_list_5 ($1, make_input (THIS->pop_spot ()),
+ $3, $4->self_scm (), $5->self_scm ());
+ scm_gc_unprotect_object ($5->self_scm ());
+ scm_gc_unprotect_object ($4->self_scm ());
+ }
+ ;
+
+Generic_prefix_music:
+ Generic_prefix_music_scm {
+ SCM func = ly_car ($1);
+ Input *loc = unsmob_input (ly_cadr ($1));
+ SCM args = ly_cddr ($1);
+ SCM sig = scm_object_property (func, ly_symbol2scm ("music-function-signature"));
+ int k = 0;
+ bool ok = true;
+ for (SCM s = sig, t = args;
+ ok && ly_c_pair_p (s) && ly_c_pair_p (t);
+ s = ly_cdr (s), t = ly_cdr (t)) {
+ k++;
+ if (scm_call_1 (ly_car (s), ly_car (t)) != SCM_BOOL_T)
+ {
+ loc->error (_f ("Argument %d failed typecheck", k));
+ THIS->error_level_ = 1;
+ ok = false;
+ }