]> git.donarmstrong.com Git - lilypond.git/blob - lily/object-key-undumper-scheme.cc
Basic-notation reorg and misc small fixes.
[lilypond.git] / lily / object-key-undumper-scheme.cc
1 /*
2   object-key-undumper-scheme.cc -- implement Object_key_undumper bindings
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #include "object-key-undumper.hh"
10
11 LY_DEFINE (ly_undumper_read_keys, "ly:undumper-read-keys",
12            2, 0, 0,
13            (SCM undumper, SCM keys),
14            "Read serialized @var{keys} into @var{undumper}.")
15 {
16   Object_key_undumper *u = unsmob_key_undumper (undumper);
17   SCM_ASSERT_TYPE (u, undumper, SCM_ARG1, __FUNCTION__, "Undumper");
18
19   u->parse_contents (keys);
20   return SCM_UNSPECIFIED;
21 }
22
23 LY_DEFINE (ly_make_undumper, "ly:make-undumper",
24            0, 0, 0,
25            (),
26            "Create a key undumper. ")
27 {
28   Object_key_undumper *u = new Object_key_undumper ();
29   return u->unprotect ();
30 }
31
32 LY_DEFINE (ly_undumper_lookup, "ly:undumper-lookup",
33            2, 0, 0,
34            (SCM undumper, SCM serial),
35            "Return the object key for number @var{serial}. ")
36
37 {
38   Object_key_undumper *u = unsmob_key_undumper (undumper);
39
40   SCM_ASSERT_TYPE (u, undumper, SCM_ARG1, __FUNCTION__, "undumper");
41   SCM_ASSERT_TYPE (scm_is_integer (serial), serial, SCM_ARG2, __FUNCTION__, "integer");
42   return u->get_key (scm_to_int (serial))->self_scm ();
43 }
44