Fixes Issue 1504, allowing feather beam line breaking.
[lilypond/patrick.git] / lily / identifier-smob.cc
blobd0e9f6e4733007874064e0aba539363733062cca
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2002--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "identifier-smob.hh"
22 scm_t_bits package_tag;
24 static int
25 print_box (SCM b, SCM port, scm_print_state *)
27 SCM value = SCM_CELL_OBJECT_1 (b);
29 scm_puts ("#<packaged object ", port);
30 scm_write (value, port);
31 scm_puts (">", port);
33 /* Non-zero means success. */
34 return 1;
37 /* This defines the primitve `make-box', which returns a new smob of
38 type `box', initialized to `#f'. */
39 LY_DEFINE (ly_export, "ly:export",
40 1, 0, 0, (SCM arg),
41 "Export a Scheme object to the parser"
42 " so it is treated as an identifier.")
44 SCM_RETURN_NEWSMOB (package_tag, arg);
47 SCM
48 unpack_identifier (SCM box)
50 if (SCM_IMP (box) || SCM_CELL_TYPE (box) != package_tag)
51 return SCM_UNDEFINED;
53 return SCM_CELL_OBJECT_1 (box);
56 static void
57 init_box_type (void)
59 package_tag = scm_make_smob_type ("box", 0);
60 scm_set_smob_mark (package_tag, scm_markcdr);
61 scm_set_smob_print (package_tag, print_box);
64 ADD_SCM_INIT_FUNC (package, init_box_type);