]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/guile-compatibility.hh
*** empty log message ***
[lilypond.git] / lily / include / guile-compatibility.hh
1 /* 
2   guile-compatibility.hh -- declare compat functions for GUILE 1.6
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
7   
8 */
9
10 #ifndef GUILE_COMPATIBILITY_HH
11 #define GUILE_COMPATIBILITY_HH
12
13
14
15 #if SCM_MINOR_VERSION < 7
16 /* guile-1.6.x compatibility */
17
18 inline SCM scm_cdr (SCM x)
19 {
20   if (SCM_NCONSP(x))
21     abort();
22   return SCM_CDR (x);
23 }
24 inline SCM scm_car (SCM x)
25 {
26   if (SCM_NCONSP(x))
27     abort();    
28   return SCM_CAR (x);
29 }
30 inline SCM scm_caar (SCM x) { return SCM_CAAR (x); }
31 inline SCM scm_cdar (SCM x) { return SCM_CDAR (x); }
32 inline SCM scm_cadr (SCM x) { return SCM_CADR (x); }
33 inline SCM scm_cddr (SCM x) { return SCM_CDDR (x); }
34 inline SCM scm_caddr (SCM x) { return SCM_CADDR (x); }
35 inline SCM scm_cdadr (SCM x) { return SCM_CDADR (x); }
36 inline SCM scm_caadr (SCM x) { return SCM_CAADR (x); }
37 inline SCM scm_cadar (SCM x) { return SCM_CADAR (x); }
38 #define scm_gc_unregister_collectable_memory(a, b, c) scm_done_free (b)
39 #define scm_gc_register_collectable_memory(a, b, c) scm_done_malloc (b)
40 #define SCM_VECTOR_REF(v,i) (SCM_VELTS ((v))[(i)])
41 #define scm_from_int(x) SCM_MAKINUM (x)
42 #define scm_is_integer(x) SCM_INUMP (x)
43 #define scm_is_string(x) SCM_STRINGP(x)
44 #define scm_hash_table_p scm_vector_p
45 #define scm_i_string_chars(x) SCM_STRING_CHARS(x)
46 #define scm_i_string_length(x) SCM_STRING_LENGTH(x)
47 inline bool ly_c_number_p (SCM x) { return SCM_NUMBERP (x); }
48 #define scm_is_number(x) (scm_number_p(x)==SCM_BOOL_T)
49 inline int ly_scm2int (SCM x) { return scm_num2int (x, 0, "ly_scm2int"); }
50 #define scm_to_int(x) (ly_scm2int(x))
51 inline bool ly_c_symbol_p (SCM x) { return SCM_SYMBOLP (x); }
52 #define scm_is_symbol(x) ly_c_symbol_p(x)
53 inline bool ly_c_boolean_p (SCM x) { return SCM_BOOLP (x); }
54 #define scm_is_bool(x) ly_c_boolean_p(x)
55 inline bool ly_c_eq_p (SCM x, SCM y) { return SCM_EQ_P (x, y); }
56 #define scm_is_eq(x,y)  (SCM_EQ_P((x), (y)))
57
58 #define scm_is_pair(x) (SCM_CONSP(x))
59
60
61 inline double ly_scm2double (SCM x) { return scm_num2dbl (x, "ly_scm2double"); }
62 #define scm_to_double(x) (ly_scm2double(x))
63 #define scm_from_double(x) (scm_make_real(x))
64
65
66
67 #endif /* SCM_MINOR_VERSION < 7 */
68 #endif /* GUILE_COMPATIBILITY_HH */