2 identifier-smob.cc -- implement glue to pass Scheme expressions off as
5 source file of the GNU LilyPond music typesetter
7 (c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "identifier-smob.hh"
13 scm_t_bits package_tag
;
16 print_box (SCM b
, SCM port
, scm_print_state
*)
18 SCM value
= SCM_CELL_OBJECT_1 (b
);
20 scm_puts ("#<packaged object ", port
);
21 scm_write (value
, port
);
24 /* Non-zero means success. */
29 /* This defines the primitve `make-box', which returns a new smob of
30 type `box', initialized to `#f'. */
31 LY_DEFINE (package_identifier
, "ly:export", 1,0,0, (SCM arg
),
32 "Export a Scheme object to the parser, so it is treated as an identifier.")
34 SCM_RETURN_NEWSMOB (package_tag
, arg
);
39 unpack_identifier (SCM box
)
41 if (SCM_IMP (box
) || SCM_CELL_TYPE (box
) != package_tag
)
44 return SCM_CELL_OBJECT_1 (box
);
50 package_tag
= scm_make_smob_type ("box", 0);
51 scm_set_smob_mark (package_tag
, scm_markcdr
);
52 scm_set_smob_print (package_tag
, print_box
);
54 ADD_SCM_INIT_FUNC (package
, init_box_type
);