Nitpick: ly:spanner-bound grob name slur -> spanner.
[lilypond.git] / lily / identifier-smob.cc
blob0b0460c1ffbd1b21c25d908d485d313d9076cfeb
1 /*
2 identifier-smob.cc -- implement glue to pass Scheme expressions off as
3 identifiers.
5 source file of the GNU LilyPond music typesetter
7 (c) 2002--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
8 */
10 #include "identifier-smob.hh"
12 scm_t_bits package_tag;
14 static int
15 print_box (SCM b, SCM port, scm_print_state *)
17 SCM value = SCM_CELL_OBJECT_1 (b);
19 scm_puts ("#<packaged object ", port);
20 scm_write (value, port);
21 scm_puts (">", port);
23 /* Non-zero means success. */
24 return 1;
27 /* This defines the primitve `make-box', which returns a new smob of
28 type `box', initialized to `#f'. */
29 LY_DEFINE (ly_export, "ly:export",
30 1, 0, 0, (SCM arg),
31 "Export a Scheme object to the parser"
32 " so it is treated as an identifier.")
34 SCM_RETURN_NEWSMOB (package_tag, arg);
37 SCM
38 unpack_identifier (SCM box)
40 if (SCM_IMP (box) || SCM_CELL_TYPE (box) != package_tag)
41 return SCM_UNDEFINED;
43 return SCM_CELL_OBJECT_1 (box);
46 static void
47 init_box_type (void)
49 package_tag = scm_make_smob_type ("box", 0);
50 scm_set_smob_mark (package_tag, scm_markcdr);
51 scm_set_smob_print (package_tag, print_box);
54 ADD_SCM_INIT_FUNC (package, init_box_type);