2 grob-interface.cc -- implement graphic objects interface
4 source file of the GNU LilyPond music typesetter
6 (c) 2002--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
9 #include "grob-interface.hh"
11 #include "protected-scm.hh"
15 void add_interface (char const *symbol,
19 SCM s = ly_symbol2scm (symbol);
20 SCM d = scm_makfrom0str (descr);
21 SCM l = parse_symbol_list (vars);
23 ly_add_interface (s, d, l);
27 check_interfaces_for_property (Grob const *me, SCM sym)
29 if (sym == ly_symbol2scm ("meta"))
32 otherwise we get in a nasty recursion loop.
37 SCM ifs = me->interfaces ();
39 SCM all_ifaces = ly_all_grob_interfaces ();
41 for (; !found && scm_is_pair (ifs); ifs = scm_cdr (ifs))
43 SCM iface = scm_hashq_ref (all_ifaces, scm_car (ifs), SCM_BOOL_F);
44 if (iface == SCM_BOOL_F)
46 String msg = to_string (_f ("Unknown interface `%s'",
47 ly_symbol2string (scm_car (ifs)).to_str0 ()));
48 programming_error (msg);
52 found = found || (scm_c_memq (sym, scm_caddr (iface)) != SCM_BOOL_F);
57 String str = to_string (_f ("Grob `%s' has no interface for property `%s'",
58 me->name ().to_str0 (),
59 ly_symbol2string (sym).to_str0 ()));
60 programming_error (str);