]> git.donarmstrong.com Git - lilypond.git/blob - lily/grob-interface-scheme.cc
Merge branch 'lilypond/translation' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / lily / grob-interface-scheme.cc
1 /*
2   grob-interface-scheme.cc -- implement grob interface bindings.
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #include "lily-guile.hh"
10 #include "std-string.hh"
11
12 static SCM all_ifaces;
13
14 void
15 internal_add_interface (SCM a, SCM b, SCM c)
16 {
17   if (!all_ifaces)
18     {
19       SCM tab = scm_c_make_hash_table (59);
20       all_ifaces = tab;
21       scm_permanent_object (tab);
22     }
23   
24   SCM entry = scm_list_n (a, b, c, SCM_UNDEFINED);
25
26   scm_hashq_set_x (all_ifaces, a, entry);
27 }
28
29 LY_DEFINE (ly_add_interface, "ly:add-interface",
30            3, 0, 0, (SCM iface, SCM desc, SCM props),
31            "Add a new grob interface.  @var{iface} is the"
32            " interface name, @var{desc} is the interface"
33            " description, and @var{props} is the list of"
34            " user-settable properties for the interface.")
35 {
36   LY_ASSERT_TYPE (ly_is_symbol, iface, 1);
37   LY_ASSERT_TYPE (scm_is_string, desc, 2);
38   LY_ASSERT_TYPE (ly_is_list, props, 3);
39
40   internal_add_interface (iface, desc, props);
41
42   return SCM_UNSPECIFIED;
43 }
44
45 LY_DEFINE (ly_all_grob_interfaces, "ly:all-grob-interfaces",
46            0, 0, 0, (),
47            "Return the hash table with all grob interface descriptions.")
48 {
49   return all_ifaces;
50 }
51