]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/lily-guile.hh
release: 1.5.25
[lilypond.git] / lily / include / lily-guile.hh
index 30c154cac59be09607676b80e0154d3a6d9a1c8d..55aafc98c7d8cdea7102233ab888d2544626ce58 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)
 #define fix_guile_1_4_scm_primitive_eval(form) scm_eval_3 (form, 1, SCM_EOL)
 #define scm_primitive_eval(form) fix_guile_1_4_scm_primitive_eval (form)
 
+#define scm_current_module() (SCM)0
+#define scm_set_current_module(x) (void)x
+#define scm_c_resolve_module(x) (SCM)0
+
 #define scm_c_define_gsubr scm_make_gsubr
 #define scm_c_eval_string(str) gh_eval_str ((char*)str)
 #define scm_c_memq scm_sloppy_memq
@@ -75,9 +90,19 @@ 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
 
+
+/*
+  We don't use gh_symbol2scm directly, since it has const-correctness
+  problems in GUILE 1.3.4
+  
+ */
+SCM my_gh_symbol2scm (const char* x);
+
 // #warning: CACHE_SYMBOLS
 
 /*
@@ -91,13 +116,14 @@ SCM ly_deep_copy (SCM);
 */
 #define ly_symbol2scm(x) ({ static SCM cached;  \
  SCM value = cached;  /* We store this one locally, since G++ -O2 fucks up else */   \
- if (__builtin_constant_p (x))\
-   value = cached =  scm_permanent_object (gh_symbol2scm((char*)x));\
- else\
-  value = gh_symbol2scm ((char*)x); \
+ if ( __builtin_constant_p ((x)))\
+ {  if (!cached)\
+     value = cached =  scm_gc_protect_object (my_gh_symbol2scm((x)));\
+ } else\
+  value = gh_symbol2scm ((char*) (x)); \
   value; })
 #else
-inline SCM ly_symbol2scm(char const* x) { return gh_symbol2scm((char*)x); }
+inline SCM ly_symbol2scm(char const* x) { return gh_symbol2scm((x)); }
 #endif 
 
 
@@ -142,7 +168,7 @@ void ly_display_scm (SCM s);
 #include "array.hh"
 
 void read_lily_scm_file (String);
-void init_lily_guile ();
+void init_lily_guile (String dir);
 
 bool isdir_b (SCM s);
 bool isaxis_b (SCM s);