]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/lily-guile.hh
* lily/modified-font-metric.cc (text_dimension): try
[lilypond.git] / lily / include / lily-guile.hh
index c8185778f7984e436ed12226b2a9803c12acfed9..8a9a7cc24c93292a54ab7719b8739a1b99cd2f6b 100644 (file)
 #define LILY_GUILE_HH
 
 #include <libguile.h>
-#include "flower-proto.hh"
-
-#include "drul-array.hh"
-#include "direction.hh"
-
-#if SCM_MINOR_VERSION < 7
-/* guile-1.6.x compatibility */
-#define scm_gc_unregister_collectable_memory(a, b, c) scm_done_free (b)
-#define scm_gc_register_collectable_memory(a, b, c) scm_done_malloc (b)
-#define SCM_VECTOR_REF(v,i) (SCM_VELTS ((v))[(i)])
-#define scm_from_int(x) SCM_MAKINUM (x)
-#define scm_is_integer(x) SCM_INUMP (x)
-#define scm_is_string(x) SCM_STRINGP(x)
-#define scm_hash_table_p scm_vector_p
-#define scm_i_string_chars(x) SCM_STRING_CHARS(x)
-#define scm_i_string_length(x) SCM_STRING_LENGTH(x)
-inline bool ly_c_number_p (SCM x) { return SCM_NUMBERP (x); }
-#define scm_is_number(x) (scm_number_p(x)==SCM_BOOL_T)
-inline int ly_scm2int (SCM x) { return scm_num2int (x, 0, "ly_scm2int"); }
-#define scm_to_int(x) (ly_scm2int(x))
-inline bool ly_c_symbol_p (SCM x) { return SCM_SYMBOLP (x); }
-#define scm_is_symbol(x) ly_c_symbol_p(x)
-inline bool ly_c_boolean_p (SCM x) { return SCM_BOOLP (x); }
-#define scm_is_bool(x) ly_c_boolean_p(
-inline bool ly_c_eq_p (SCM x, SCM y) { return SCM_EQ_P (x, y); }
-#define scm_is_eq(x,y)  (SCM_EQ_P (x, y));
-
-inline double ly_scm2double (SCM x) { return scm_num2dbl (x, "ly_scm2double"); }
-#define scm_to_double(x) (ly_scm2double(x))
-#define scm_from_double(x) (scm_make_real(x))
-
-
-#endif /* SCM_MINOR_VERSION < 7 */
+
+#include "interval.hh"
+#include "guile-compatibility.hh"
 
 #ifndef SMOB_FREE_RETURN_VAL
 #define SMOB_FREE_RETURN_VAL(CL) 0
@@ -64,6 +34,9 @@ SCM ly_write2scm (SCM s);
 SCM ly_deep_copy (SCM);
 SCM ly_truncate_list (int k, SCM lst);
 
+SCM ly_to_string (SCM scm);
+SCM ly_to_symbol (SCM scm);
+
 #if (__GNUC__ > 2)
 /* Unreliable with gcc-2.x
    FIXME: should add check for x86 as well?  */
@@ -101,7 +74,7 @@ extern SCM global_lily_module;
 /*
   TODO: rename me to ly_c_lily_module_eval
  */
-#define ly_scheme_function(x) \
+#define ly_lily_module_constant(x) \
 ({ \
   static SCM cached; \
   /* We store this one locally, since G++ -O2 fucks up else */ \
@@ -117,13 +90,16 @@ extern SCM global_lily_module;
   value; \
 })
 
+String gulp_file_to_string (String fn, bool must_exist);
 
 String ly_scm2string (SCM s);
 String ly_symbol2string (SCM);
 SCM ly_offset2scm (Offset);
 Offset ly_scm2offset (SCM);
-SCM ly_assoc_chain (SCM key, SCM achain);
+SCM ly_chain_assoc (SCM key, SCM achain);
+SCM ly_chain_assoc_get (SCM key, SCM achain, SCM dfault);
 SCM ly_assoc_cdr (SCM key, SCM alist);
+SCM ly_assoc_get (SCM key, SCM alist, SCM def);
 Interval ly_scm2interval (SCM);
 Drul_array<Real> ly_scm2realdrul (SCM);
 Slice int_list_to_slice (SCM l);
@@ -145,22 +121,12 @@ SCM parse_symbol_list (char const *);
 SCM robust_list_ref(int i, SCM l);
 SCM alist_to_hashq (SCM);
 
-inline SCM ly_cdr (SCM x) { return SCM_CDR (x); }
-inline SCM ly_car (SCM x) { return SCM_CAR (x); }
-inline SCM ly_caar (SCM x) { return SCM_CAAR (x); }
-inline SCM ly_cdar (SCM x) { return SCM_CDAR (x); }
-inline SCM ly_cadr (SCM x) { return SCM_CADR (x); }
-inline SCM ly_cddr (SCM x) { return SCM_CDDR (x); }
-inline SCM ly_caddr (SCM x) { return SCM_CADDR (x); }
-inline SCM ly_cdadr (SCM x) { return SCM_CDADR (x); }
-inline SCM ly_caadr (SCM x) { return SCM_CAADR (x); }
-inline SCM ly_cadar (SCM x) { return SCM_CADAR (x); }
+
 /* inserts at front, removing dublicates */
 inline SCM ly_assoc_front_x(SCM alist, SCM key, SCM val)
 {
   return scm_acons(key, val, scm_assoc_remove_x (alist, key));
 }
-inline bool ly_c_pair_p (SCM x) { return SCM_NFALSEP (scm_pair_p (x)); }
 inline bool ly_c_char_p (SCM x) { return SCM_CHARP (x); }
 inline bool ly_c_vector_p (SCM x) { return SCM_VECTORP (x); }
 inline bool ly_c_list_p (SCM x) { return SCM_NFALSEP (scm_list_p (x)); }
@@ -169,6 +135,7 @@ inline bool ly_c_equal_p (SCM x, SCM y) {
   return SCM_NFALSEP (scm_equal_p (x, y));
 }
 
+
 inline bool ly_scm2bool (SCM x) { return SCM_NFALSEP (x); }
 inline char ly_scm2char (SCM x) { return SCM_CHAR(x); }
 inline unsigned long ly_length (SCM x) {
@@ -222,7 +189,7 @@ SCM ly_unique (SCM lst);
 SCM ly_list_qsort_uniq_x (SCM lst);
 
 SCM ly_output_formats();
-SCM ly_kpathsea_expand_path (SCM);
+SCM ly_kpathsea_find_file (SCM);
 
 /*
   snarfing.
@@ -317,6 +284,6 @@ LY_DEFINE_WITHOUT_DECL (CLASS ## FNAME, CLASS::FNAME, PRIMNAME, REQ, OPT, \
                        VAR, ARGLIST, DOCSTRING)
 
 #define get_property(x) internal_get_property (ly_symbol2scm (x))
-#define set_property(x,y) internal_set_property (ly_symbol2scm (x), y)
+#define set_property(x, y) internal_set_property (ly_symbol2scm (x), y)
 
 #endif /* LILY_GUILE_HH */