]> git.donarmstrong.com Git - lilypond.git/blob - lily/music-iterator-ctor.cc
0af9158698c0f90cf3e10c9599d5a4a6e8a06f37
[lilypond.git] / lily / music-iterator-ctor.cc
1 /*   
2   score-element-callback.cc --  implement Callback smob.
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #include "music-iterator-ctor.hh"
11
12 static long callback_tag;
13
14 static
15 SCM mark_smob (SCM)
16 {
17   return SCM_EOL;
18 }
19
20 static int
21 print_smob (SCM, SCM port, scm_print_state *)
22 {
23   scm_puts ("#<encapsulated C++ function>", port);
24   return 1;
25 }
26
27 static
28 scm_sizet free_smob (SCM)
29 {
30   return 0;
31 }
32
33 static
34 void start_callback_smobs()
35 {
36   callback_tag = scm_make_smob_type_mfpe ("callback", 0,
37                                           mark_smob, free_smob,
38                                           print_smob, 0);
39 }
40
41 SCM
42 smobify_callback (Cpp_function cb )
43 {
44   SCM z;
45   
46   SCM_NEWCELL(z);
47   SCM_SETCDR (z, (SCM)cb);
48   SCM_SETCAR (z, (SCM)callback_tag);
49
50   return z;
51 }
52   
53 ADD_SCM_INIT_FUNC(callback, start_callback_smobs);
54