]> git.donarmstrong.com Git - lilypond.git/blob - lily/score-element-callback.cc
patch::: 1.3.57.jcn1
[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 scm_smobfuns callback_funs = {
34   mark_smob, free_smob,
35   print_smob, 0,
36 };
37
38 static
39 void start_callback_smobs()
40 {
41   callback_tag = scm_newsmob (&callback_funs);
42 }
43
44
45 SCM
46 smobify_callback (Score_element_callback cb )
47 {
48   SCM z;
49   
50   SCM_NEWCELL(z);
51   SCM_SETCDR (z, (SCM)cb);
52   SCM_SETCAR (z, (SCM)callback_tag);
53
54   return z;
55 }
56   
57 ADD_SCM_INIT_FUNC(callback, start_callback_smobs);