]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/lily-guile-macros.hh
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / lily / include / lily-guile-macros.hh
index 03abe6bde5eac278d91f1aa93772aaaf730b0b73..ef0db4747900b271fe9c362d06eeefe9bdbbf020 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #ifndef LILY_GUILE_MACROS_HH
@@ -68,8 +68,8 @@ inline SCM ly_symbol2scm (char const *x) { return scm_str2symbol ((x)); }
     if (__builtin_constant_p ((x)))                                    \
       {                                                                        \
        if (!cached)                                                    \
-         value = cached = scm_eval (scm_str2symbol (x),        \
-                                                           global_lily_module); \
+         value = cached = scm_eval (scm_str2symbol (x),                \
+                                    global_lily_module);               \
       }                                                                        \
     else                                                               \
       value = scm_eval (scm_str2symbol (x), global_lily_module);       \
@@ -83,19 +83,21 @@ inline SCM ly_symbol2scm (char const *x) { return scm_str2symbol ((x)); }
 #define DECLARE_SCHEME_CALLBACK(NAME, ARGS)    \
   static SCM NAME ARGS;                                \
   static SCM NAME ## _proc
-
 /*
   Make TYPE::FUNC available as a Scheme function.
 */
+string mangle_cxx_identifier (string);
 #define MAKE_SCHEME_CALLBACK(TYPE, FUNC, ARGCOUNT)                     \
   SCM TYPE ::FUNC ## _proc;                                            \
   void                                                                 \
   TYPE ## _ ## FUNC ## _init_functions ()                              \
   {                                                                    \
-    TYPE ::FUNC ## _proc = scm_c_define_gsubr (#TYPE "::" #FUNC,       \
+    string id = mangle_cxx_identifier (string (#TYPE) + "::" + string (#FUNC)); \
+    TYPE ::FUNC ## _proc = scm_c_define_gsubr (id.c_str(),                     \
                                               (ARGCOUNT), 0, 0,        \
-                                              (Scheme_function_unknown)TYPE ::FUNC); \
-    scm_c_export (#TYPE "::" #FUNC, NULL);                             \
+                                              (Scheme_function_unknown) TYPE::FUNC); \
+    scm_c_export (id.c_str (), NULL);                                  \
   }                                                                    \
                                                                        \
   ADD_SCM_INIT_FUNC (TYPE ## _ ## FUNC ## _callback,                   \