]> git.donarmstrong.com Git - lilypond.git/blob - lily/score-element-callback.cc
patch::: 1.3.49.hwn1: deze dus
[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
13 static long callback_tag;
14
15 static
16 SCM mark_smob (SCM)
17 {
18   return SCM_EOL;
19 }
20
21 static int
22 print_smob (SCM, SCM port, scm_print_state *)
23 {
24   scm_puts ("#<Callback>", port);
25   return 1;
26 }
27
28 static
29 scm_sizet free_smob (SCM)
30 {
31   return 0;
32 }
33
34 static scm_smobfuns callback_funs = {
35   mark_smob, free_smob,
36   print_smob, 0,
37 };
38
39 static
40 void start_callback_smobs()
41 {
42   callback_tag = scm_newsmob (&callback_funs);
43 }
44
45
46 SCM smobify_callback (Score_element_callback cb )
47 {
48   SCM z;
49   
50   SCM_NEWCELL(z);
51   SCM_SETCDR(z, cb);
52   SCM_SETCAR(z, callback_tag);
53
54   return z;
55 }
56   
57 ADD_SCM_INIT_FUNC(callback, start_callback_smobs);