2 lily-guile.hh encapsulate guile
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org>
15 #define fix_guile_1_3_4_scm_puts(scm_data, port) scm_puts ((char*)scm_data, port)
16 #define scm_puts(scm_data, port) fix_guile_1_3_4_scm_puts (scm_data, port)
18 #include "direction.hh"
19 #include "flower-proto.hh"
22 #define SCM_PACK(x) ((SCM) x)
26 #define SCM_UNPACK(x) ( x)
30 conversion functions follow the GUILE naming convention, i.e.
34 SCM ly_str02scm (char const*c);
35 SCM ly_deep_copy (SCM);
36 SCM ly_symbol2scm (char const *);
37 String ly_scm2string (SCM s);
38 String ly_symbol2string (SCM);
39 SCM ly_offset2scm (Offset);
40 Offset ly_scm2offset (SCM);
41 SCM ly_assoc_chain (SCM key, SCM achain);
42 Interval ly_scm2interval (SCM);
43 SCM ly_interval2scm (Interval);
45 SCM ly_parse_scm (char const* s, int* n);
46 SCM ly_quote_scm (SCM s);
48 bool type_check_assignment (SCM val, SCM sym, SCM type_symbol) ;
51 display and print newline.
54 void ly_display_scm (SCM s);
59 void read_lily_scm_file (String);
60 void init_lily_guile ();
65 these conversion functions also do a typecheck on the argument, and
66 return a default value if S has the wrong type.
69 Direction to_dir (SCM s);
70 bool to_boolean (SCM s);
72 void init_ly_protection ();
73 unsigned int ly_scm_hash (SCM s);
75 SCM index_cell (SCM cellp, Direction d);
76 SCM index_set_cell (SCM cellp, Direction d, SCM val);
82 void add_scm_init_func (void (*)());
85 typedef SCM(*Scheme_function_unknown)();
87 #if __GNUC_MINOR__ >= 96
88 typedef SCM(*Scheme_function_0)();
89 typedef SCM(*Scheme_function_1)(SCM);
90 typedef SCM(*Scheme_function_2)(SCM,SCM);
92 typedef SCM(*Scheme_function_0)(...);
93 typedef SCM(*Scheme_function_1)(...);
94 typedef SCM(*Scheme_function_2)(...);
97 #define DECLARE_SCHEME_CALLBACK(NAME,ARGS) \
98 static SCM NAME ARGS; \
99 static SCM NAME ## _proc
101 #define MAKE_SCHEME_CALLBACK(TYPE, FUNC, ARGCOUNT) \
102 SCM TYPE :: FUNC ## _proc;\
104 TYPE ## _ ## FUNC ## _init_functions () \
106 TYPE :: FUNC ## _proc = gh_new_procedure ## ARGCOUNT ## _0 (#TYPE "::" #FUNC, \
107 ((Scheme_function_ ## ARGCOUNT)TYPE :: FUNC)); \
110 ADD_SCM_INIT_FUNC(TYPE ## _ ## FUNC ## _callback, TYPE ## _ ## FUNC ## _init_functions); \
113 #define ADD_SCM_INIT_FUNC(name, func)\
114 class name ## _scm_initter { \
116 name ## _scm_initter () \
118 add_scm_init_func (func); \
120 } _ ## name ## _scm_initter; \
123 #endif // LILY_GUILE_HH