Callback0_wrapper::make_smob
<Translator_group, &Translator_group::finalize> (),
UP);
- send_stream_event (ctx, "RemoveContext", 0, 0);
+ send_stream_event (ctx, "RemoveContext", 0);
}
}
}
}
/*
-Called by the send_stream_event macro. props is a 0-terminated array of
-properties and corresponding values, interleaved. This method should not
-be called from any other place than the send_stream_event macro.
+These methods should not be called from any other place than the
+send_stream_event macro.
*/
+
void
-Context::internal_send_stream_event (SCM type, Input *origin, SCM props[])
+Context::internal_send_stream_event (SCM type, Input *origin)
{
Stream_event *e = new Stream_event (Lily::ly_make_event_class (type), origin);
- for (int i = 0; props[i]; i += 2)
- {
- e->set_property (props[i], props[i + 1]);
- }
+ event_source_->broadcast (e);
+ e->unprotect ();
+}
+
+void
+Context::internal_send_stream_event (SCM type, Input *origin,
+ SCM prop, SCM val)
+{
+ Stream_event *e = new Stream_event (Lily::ly_make_event_class (type), origin);
+ e->set_property (prop, val);
+ event_source_->broadcast (e);
+ e->unprotect ();
+}
+
+void
+Context::internal_send_stream_event (SCM type, Input *origin,
+ SCM prop, SCM val, SCM prop2, SCM val2)
+{
+ Stream_event *e = new Stream_event (Lily::ly_make_event_class (type), origin);
+ e->set_property (prop, val);
+ e->set_property (prop2, val2);
+ event_source_->broadcast (e);
+ e->unprotect ();
+}
+
+void
+Context::internal_send_stream_event (SCM type, Input *origin,
+ SCM prop, SCM val, SCM prop2, SCM val2,
+ SCM prop3, SCM val3)
+{
+ Stream_event *e = new Stream_event (Lily::ly_make_event_class (type), origin);
+ e->set_property (prop, val);
+ e->set_property (prop2, val2);
+ e->set_property (prop3, val3);
+ event_source_->broadcast (e);
+ e->unprotect ();
+}
+
+void
+Context::internal_send_stream_event (SCM type, Input *origin,
+ SCM prop, SCM val, SCM prop2, SCM val2,
+ SCM prop3, SCM val3, SCM prop4, SCM val4)
+{
+ Stream_event *e = new Stream_event (Lily::ly_make_event_class (type), origin);
+ e->set_property (prop, val);
+ e->set_property (prop2, val2);
+ e->set_property (prop3, val3);
+ e->set_property (prop4, val4);
event_source_->broadcast (e);
e->unprotect ();
}
Dispatcher *event_source () const { return event_source_; }
Dispatcher *events_below () const { return events_below_; }
- void internal_send_stream_event (SCM type, Input *origin, SCM props[]);
-
+ void internal_send_stream_event (SCM type, Input *origin);
+ void internal_send_stream_event (SCM type, Input *origin,
+ SCM prop, SCM val);
+ void internal_send_stream_event (SCM type, Input *origin,
+ SCM prop, SCM val, SCM prop2, SCM val2);
+ void internal_send_stream_event (SCM type, Input *origin,
+ SCM prop, SCM val, SCM prop2, SCM val2,
+ SCM prop3, SCM val3);
+ void internal_send_stream_event (SCM type, Input *origin,
+ SCM prop, SCM val, SCM prop2, SCM val2,
+ SCM prop3, SCM val3, SCM prop4, SCM val4);
SCM get_definition () const { return definition_; }
SCM get_definition_mods () const { return definition_mods_; }
/* Shorthand for creating and broadcasting stream events. */
#define send_stream_event(ctx, type, origin, ...) \
- do { \
- SCM props[] = { __VA_ARGS__, 0 }; \
- ctx->internal_send_stream_event (ly_symbol2scm (type), origin, props); \
- } while (0)
+ ctx->internal_send_stream_event (ly_symbol2scm (type), origin, ##__VA_ARGS__)
SCM nested_property_alist (SCM alist, SCM prop_path, SCM value);
SCM nested_property (SCM alist, SCM prop_path, SCM fallback = SCM_EOL);