lilypond-1.3.154
[lilypond.git] / lily / music-iterator-ctor.cc
blobbb1317371708958f44afbbff14d61deac42709a3
1 /*
2 grob-callback.cc -- implement Callback smob.
4 source file of the GNU LilyPond music typesetter
6 (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include "music-iterator-ctor.hh"
11 #include "ly-smobs.icc"
13 static long callback_tag;
15 static
16 SCM mark_smob (SCM)
18 return SCM_EOL;
21 static int
22 print_smob (SCM, SCM port, scm_print_state *)
24 scm_puts ("#<encapsulated C++ function>", port);
25 return 1;
28 static
29 scm_sizet free_smob (SCM)
31 return 0;
35 void init_cxx_function_smobs()
37 callback_tag = scm_make_smob_type_mfpe ("callback", 0,
38 mark_smob, free_smob,
39 print_smob, 0);
42 SCM
43 smobify_cxx_function (Cxx_function cb )
45 SCM z;
47 SCM_NEWCELL(z);
48 SCM_SETCDR (z, (SCM)cb);
49 SCM_SETCAR (z, (SCM)callback_tag);
51 return z;
55 Cxx_function
56 unsmob_cxx_function (SCM x)
58 if (SCM_CELL_TYPE(x) == callback_tag)
59 return (Cxx_function) SCM_CELL_WORD_1(x);
60 else
61 return 0;