]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/translator.cc
Run `make grand-replace'.
[lilypond.git] / lily / translator.cc
index b7a46d29b65b20c67aa724b351012b0c18817da3..9ebe2cd4bf97fcc829030087c4b0e0713450e106 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 1997--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include "translator.hh"
@@ -132,7 +132,8 @@ ensure_listened_hash ()
 
 LY_DEFINE (ly_get_listened_event_classes, "ly:get-listened-event-classes",
           0, 0, 0, (),
-          "Returns a list of all event classes that some translator listens to.")
+          "Return a list of all event classes that some translator listens"
+          " to.")
 {
   ensure_listened_hash ();
   return ly_hash_table_keys (listened_event_class_table);
@@ -170,7 +171,7 @@ Translator::add_translator_listener (translator_listener_record **listener_list,
 {
   /* ev_class is the C++ identifier name. Convert to scm symbol */
   string name = string (ev_class);
-  name = replace_all (name, '_', '-');
+  name = replace_all (&name, '_', '-');
   name += "-event";
   
   SCM class_sym = scm_str2symbol (name.c_str ());
@@ -199,7 +200,7 @@ Translator::static_translator_description (const char *grobs,
                                 parse_symbol_list (grobs), static_properties);
   
   static_properties = scm_acons (ly_symbol2scm ("description"),        
-                                scm_makfrom0str (desc), static_properties); 
+                                scm_from_locale_string (desc), static_properties); 
   
   SCM list = SCM_EOL;
   for (; listener_list; listener_list = listener_list->next_)
@@ -274,11 +275,11 @@ add_acknowledger (Engraver_void_function_engraver_grob_info ptr,
 
   string interface_name (func_name);
 
-  interface_name = replace_all (interface_name, '_', '-');
+  interface_name = replace_all (&interface_name, '_', '-');
   interface_name += "-interface";
 
   /*
-    this is only called during program init, so safe to use scm_gc_protect_object()
+    this is only called during program init, so safe to use scm_gc_protect_object ()
   */
   inf.symbol_ = scm_gc_protect_object (ly_symbol2scm (interface_name.c_str ()));
   ack_array->push_back (inf);
@@ -295,6 +296,7 @@ generic_get_acknowledger (SCM sym, vector<Acknowledge_information> const *ack_ar
   return 0;
 }
 
+
 Moment
 get_event_length (Stream_event *e)
 {
@@ -305,6 +307,19 @@ get_event_length (Stream_event *e)
     return Moment (0);
 }
 
+Moment
+get_event_length (Stream_event *e, Moment now)
+{
+  Moment len = get_event_length (e);
+  
+  if (now.grace_part_)
+    {
+      len.grace_part_ = len.main_part_;
+      len.main_part_ = Rational (0);
+    }
+  return len;
+}
+
 /*
   Helper, used through ASSIGN_EVENT_ONCE to throw warnings for
   simultaneous events. The helper is only useful in listen_* methods
@@ -326,8 +341,8 @@ internal_event_assignment (Stream_event **old_ev, Stream_event *new_ev, const ch
       assert (0 == ev_class.find (prefix));
 
       /* "listen_foo_bar" -> "foo-bar" */
-      ev_class.erase (0, strlen(prefix));
-      replace_all (ev_class, '_', '-');
+      ev_class.erase (0, strlen (prefix));
+      replace_all (&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 ()));
@@ -341,7 +356,15 @@ internal_event_assignment (Stream_event **old_ev, Stream_event *new_ev, const ch
 }
 
 ADD_TRANSLATOR (Translator,
-               "Base class. Not instantiated.",
+               /* doc */
+               "Base class.  Not instantiated.",
+
+               /* create */
                "",
+
+               /* read */
                "",
-               "");
+
+               /* write */
+               ""
+               );