2 identifier-smob.cc -- implement glue to pass Scheme expressions off as
5 source file of the GNU LilyPond music typesetter
7 (c) 2002--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "identifier-smob.hh"
12 scm_t_bits package_tag
;
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
);
23 /* Non-zero means success. */
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",
31 "Export a Scheme object to the parser"
32 " so it is treated as an identifier.")
34 SCM_RETURN_NEWSMOB (package_tag
, arg
);
38 unpack_identifier (SCM box
)
40 if (SCM_IMP (box
) || SCM_CELL_TYPE (box
) != package_tag
)
43 return SCM_CELL_OBJECT_1 (box
);
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
);