]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/lily-guile.hh
release: 1.5.19
[lilypond.git] / lily / include / lily-guile.hh
index 9a0b5d2bd38a984c5dcb1f2ffa768ba6eb88e084..e67293e06f89c3c4897097722899b1e692e53f41 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef LILY_GUILE_HH
 #define LILY_GUILE_HH
 
+#define SCM_VOIDP_TEST
+
 #include <libguile.h>
 
 /*
 /* Guile 1.3.4 compatibility */
 #if GUILE_MINOR_VERSION < 4
 
+
+#ifndef SCM_CELL_TYPE
+#define SCM_CELL_TYPE(X) SCM_CAR (X)
+#endif
+
+#ifndef SCM_CELL_WORD_1
+#define SCM_CELL_WORD_1(X) SCM_CDR (X)
+#endif
+
 #define scm_bits_t SCM
 
 #define fix_guile_1_3_4_scm_puts(scm_data, port) scm_puts ((char*)scm_data, port)
@@ -75,8 +86,15 @@ SCM ly_last (SCM list);
 SCM ly_str02scm (char const*c);
 SCM ly_write2scm (SCM s);
 SCM ly_deep_copy (SCM);
+SCM ly_truncate_list (int k, SCM l );
 
+#define CACHE_SYMBOLS
 #ifdef CACHE_SYMBOLS
+
+SCM my_gh_symbol2scm (const char* x);
+
+// #warning: CACHE_SYMBOLS
+
 /*
   Using this trick we cache the value of gh_symbol2scm ("fooo") where
   "fooo" is a constant string. This is done at the cost of one static
@@ -87,9 +105,13 @@ SCM ly_deep_copy (SCM);
 
 */
 #define ly_symbol2scm(x) ({ static SCM cached;  \
- (__builtin_constant_p (x)) \
-  ? ((cached) ? cached : scm_permanent_object (cached = gh_symbol2scm((char*)x))) \
-  : gh_symbol2scm(x); })
+ SCM value = cached;  /* We store this one locally, since G++ -O2 fucks up else */   \
+ if ( __builtin_constant_p ((x)))\
+ {  if (!cached)\
+     value = cached =  scm_gc_protect_object (my_gh_symbol2scm((char*) (x)));\
+ } else\
+  value = gh_symbol2scm ((char*) (x)); \
+  value; })
 #else
 inline SCM ly_symbol2scm(char const* x) { return gh_symbol2scm((char*)x); }
 #endif