On Monday 18 September 2006 16:34, Han-Wen Nienhuys wrote:
> Erik Sandberg wrote:
> >
> > I tried some days ago. A problem is that I still couldn't make web
> > completely, even without the patch.
> >
> > I also have an updated patch for my translator patch, which is as
> > well-tested. Both patches are attached.
>
> btw, can you revise  internal_event_assignment so it uses the string
> class iso. char* ?
done, patch attached.

BTW, do you plan to include this patch in 2.10?

Also: The ASSIGN_EVENT_ONCE macro displays warnings in some new situations; 
e.g. in { c\< d\!\> e\! }, where the first \! is superfluous because the 
crescendo is implicitly stopped by the diminuendo. I have created a fix that 
avoids a warning in this particular case. But in general, do you view this 
extra warning as a regression?

-- 
Erik
--- ../lilypond/lily/translator.cc	2006-09-06 15:46:34.000000000 +0200
+++ lily/translator.cc	2006-09-19 20:21:56.000000000 +0200
@@ -52,12 +52,6 @@
   must_be_last_ = src.must_be_last_;
 }
 
-bool
-Translator::try_music (Music *)
-{
-  return false;
-}
-
 Moment
 Translator::now_mom () const
 {
@@ -94,12 +88,9 @@
 }
 
 /*
-  this function has 2 properties
-
-  - It is called before try_music ()
-
-  - It is called before any user information enters the translators.
-  (i.e. any \property or event is not processed yet.)
+  this function is called once each moment, before any user
+  information enters the translators.  (i.e. no \property or event has
+  been processed yet.)
 */
 void
 Translator::start_translation_timestep ()
@@ -293,16 +284,17 @@
     {
       /* 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 = '-';
+      string ev_class = function;
+      /* This assertion fails if EVENT_ASSIGNMENT was called outside a
+	 translator listener. Don't do that. */
+      assert (0 == ev_class.find (prefix));
+
+      /* "listen_foo_bar" -> "foo-bar" */
+      ev_class.erase (0, strlen(prefix));
+      replace_all (ev_class, '_', '-');
 
-      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));
+      new_ev->origin ()->warning (_f ("Two simultaneous %s events, junking this one", ev_class.c_str ()));
+      (*old_ev)->origin ()->warning (_f ("Previous %s event here", ev_class.c_str ()));
       return false;
     }
   else
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to