+static void
+init_pedal_types ()
+{
+ const char *names [NUM_PEDAL_TYPES];
+ names[SOSTENUTO] = "Sostenuto";
+ names[SUSTAIN] = "Sustain";
+ names[UNA_CORDA] = "UnaCorda";
+
+ for (int i = 0; i < NUM_PEDAL_TYPES; i++)
+ {
+ const char *name = names[i];
+ /* FooBar */
+ string base_name = name;
+ /* foo-bar */
+ string base_ident = "";
+ int prev_pos = 0;
+ int cur_pos;
+ for (cur_pos = 1; name[cur_pos]; cur_pos++)
+ if (isupper (name[cur_pos]))
+ {
+ base_ident = base_ident + String_convert::to_lower (string (name, prev_pos, cur_pos - prev_pos)) + "-";
+ prev_pos = cur_pos;
+ }
+ base_ident += String_convert::to_lower (string (name, prev_pos, cur_pos - prev_pos));
+
+ /*
+ be careful, as we don't want to loose references to the _sym_ members.
+ */
+ Pedal_type_info info;
+ info.event_class_sym_ = scm_from_locale_symbol ((base_ident + "-event").c_str ());
+ info.style_sym_ = scm_from_locale_symbol (("pedal" + base_name + "Style").c_str ());
+ info.strings_sym_ = scm_from_locale_symbol (("pedal" + base_name + "Strings").c_str ());
+
+ info.base_name_ = name;
+ info.pedal_c_str_ = strdup ((base_name + "Pedal").c_str ());
+
+ info.protect ();
+
+ pedal_types_[i] = info;
+ }
+}
+
+ADD_SCM_INIT_FUNC (Piano_pedal_engraver_init_pedal_types_, init_pedal_types);
+