+Moment
+get_event_length (Stream_event *e)
+{
+ Moment *m = unsmob_moment (e->get_property ("length"));
+ if (m)
+ return *m;
+ else
+ return Moment (0);
+}
+
+/*
+ Helper, used through ASSIGN_EVENT_ONCE to throw warnings for
+ simultaneous events. The helper is only useful in listen_* methods
+ of translators.
+*/
+bool
+internal_event_assignment (Stream_event **old_ev, Stream_event *new_ev, const char *function)
+{
+ if (*old_ev)
+ {
+ /* extract event class from function name */
+ const char *prefix = "listen_";
+ assert (!strncmp (function, "listen_", strlen (prefix)));
+ function += strlen (prefix);
+ char ev_class[strlen (function) + 1];
+ strcpy (ev_class, function);
+ for (char *c = ev_class; *c; c++)
+ if (*c == '_')
+ *c = '-';
+
+ new_ev->origin ()->warning (_f ("Two simultaneous %s events, junking this one", ev_class));
+ (*old_ev)->origin ()->warning (_f ("Previous %s event here", ev_class));
+ return false;
+ }
+ else
+ {
+ *old_ev = new_ev;
+ return true;
+ }
+}
+
+ADD_TRANSLATOR (Translator,
+ "Base class. Unused",
+ "",
+ "",
+ "",
+ "");