X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fgrob-interface-scheme.cc;h=9c6fbc058ca1d3fb1eddc8eba5e83c595e73b536;hb=0b544cfb7332615ef809b71b57ab656741311ae1;hp=b58699520992ea51e7e62f12155cd3c714b79460;hpb=58bcc84c9480dae1b21bc24d8396b91fe19e0131;p=lilypond.git diff --git a/lily/grob-interface-scheme.cc b/lily/grob-interface-scheme.cc index b586995209..9c6fbc058c 100644 --- a/lily/grob-interface-scheme.cc +++ b/lily/grob-interface-scheme.cc @@ -1,36 +1,61 @@ /* - grob-interface-scheme.cc -- implement grob interface bindings. + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 2005--2014 Han-Wen Nienhuys - (c) 2005 Han-Wen Nienhuys + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "lily-guile.hh" -#include "protected-scm.hh" -#include "string.hh" +#include "std-string.hh" -Protected_scm all_ifaces; +static SCM all_ifaces; -LY_DEFINE (ly_add_interface, "ly:add-interface", 3, 0, 0, (SCM a, SCM b, SCM c), - "Add an interface description.") +void +internal_add_interface (SCM a, SCM b, SCM c) { - SCM_ASSERT_TYPE (scm_is_symbol (a), a, SCM_ARG1, __FUNCTION__, "symbol"); - SCM_ASSERT_TYPE (scm_is_string (b), b, SCM_ARG2, __FUNCTION__, "string"); - SCM_ASSERT_TYPE (ly_c_list_p (c), c, SCM_ARG3, __FUNCTION__, "list of syms"); - if (!scm_is_vector (all_ifaces)) - all_ifaces = scm_make_vector (scm_int2num (40), SCM_EOL); + if (!all_ifaces) + { + SCM tab = scm_c_make_hash_table (59); + all_ifaces = tab; + scm_permanent_object (tab); + } SCM entry = scm_list_n (a, b, c, SCM_UNDEFINED); scm_hashq_set_x (all_ifaces, a, entry); +} + +LY_DEFINE (ly_add_interface, "ly:add-interface", + 3, 0, 0, (SCM iface, SCM desc, SCM props), + "Add a new grob interface. @var{iface} is the" + " interface name, @var{desc} is the interface" + " description, and @var{props} is the list of" + " user-settable properties for the interface.") +{ + LY_ASSERT_TYPE (ly_is_symbol, iface, 1); + LY_ASSERT_TYPE (scm_is_string, desc, 2); + LY_ASSERT_TYPE (ly_is_list, props, 3); + + internal_add_interface (iface, desc, props); return SCM_UNSPECIFIED; } LY_DEFINE (ly_all_grob_interfaces, "ly:all-grob-interfaces", - 0, 0, 0, (), - "Get a hash table with all interface descriptions.") + 0, 0, 0, (), + "Return the hash table with all grob interface descriptions.") { return all_ifaces; }