]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/dispatcher.cc
Web-es: update Introduction. Add untranslated Pondings block.
[lilypond.git] / lily / dispatcher.cc
index 94519021abe43ccb4def37ce25fa595e3dd676a9..c2e777a131de776b42eda946f84d4ac7018da217 100644 (file)
@@ -77,19 +77,13 @@ void
 Dispatcher::dispatch (SCM sev)
 {
   Stream_event *ev = unsmob_stream_event (sev);
-  SCM class_symbol = ev->get_property ("class");
-  if (!scm_is_symbol (class_symbol))
-    {
-      warning (_ ("Event class should be a symbol"));
-      return;
-    }
-
-  SCM class_list = scm_call_1 (ly_lily_module_constant ("ly:make-event-class"), class_symbol);
+  SCM class_list = ev->get_property ("class");
   if (!scm_is_pair (class_list))
     {
-      ev->origin ()->warning (_f ("Unknown event class %s", ly_symbol2string (class_symbol).c_str ()));
+      ev->origin ()->warning (_ ("Event class should be a list"));
       return;
     }
+
 #if 0
   bool sent = false;
 #endif
@@ -173,6 +167,36 @@ Dispatcher::dispatch (SCM sev)
 #endif
 }
 
+bool
+Dispatcher::is_listened_class (SCM cl)
+{
+  for (; scm_is_pair (cl); cl = scm_cdr (cl))
+    {
+      SCM list = scm_hashq_ref (listeners_, scm_car (cl), SCM_EOL);
+      if (scm_is_pair (list))
+        return true;
+    }
+  return false;
+}
+
+static SCM
+accumulate_types (void * /* closure */,
+                 SCM key,
+                 SCM val,
+                 SCM result)
+{
+  if (scm_is_pair (val))
+    return scm_cons (key, result);
+  return result;
+}
+
+SCM
+Dispatcher::listened_types ()
+{
+  return scm_internal_hash_fold ((scm_t_hash_fold_fn) &accumulate_types,
+                                 NULL, SCM_EOL, listeners_);
+}
+
 void
 Dispatcher::broadcast (Stream_event *ev)
 {