]> git.donarmstrong.com Git - lilypond.git/blob - lily/score-element-callback.cc
7b701b15bd9ee96862b1d3fa4cf060f9bbb324bb
[lilypond.git] / lily / score-element-callback.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 "score-element-callback.hh"
11
12 static SCM 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 ("#<Callback>", 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
42 SCM
43 smobify_callback (Score_element_callback cb )
44 {
45   SCM z;
46   
47   SCM_NEWCELL(z);
48   SCM_SETCDR (z, (SCM)cb);
49   SCM_SETCAR (z, (SCM)callback_tag);
50
51   return z;
52 }
53   
54 ADD_SCM_INIT_FUNC(callback, start_callback_smobs);