2 tweak-registration-scheme.cc -- implement Tweak_registry bindings
4 source file of the GNU LilyPond music typesetter
6 (c) 2004--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
9 #include "tweak-registration.hh"
11 #include "object-key-undumper.hh"
13 LY_DEFINE (ly_clear_tweak_registry, "ly:tweak-clear-registry",
15 "Clear global tweak registry")
17 global_registry_->clear ();
18 return SCM_UNSPECIFIED;
21 LY_DEFINE (ly_grob_insert_tweak, "ly:grob-insert-tweak",
23 (SCM grob, SCM tweak),
24 "add new tweak for grob.")
26 Grob *gr = unsmob_grob (grob);
27 SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "Grob");
28 SCM_ASSERT_TYPE (scm_list_p (tweak) == SCM_BOOL_T
29 && ly_c_procedure_p (scm_car (tweak)),
30 tweak, SCM_ARG2, __FUNCTION__, "Tweak");
32 global_registry_->insert_grob_tweak (gr, tweak);
33 return SCM_UNSPECIFIED;
36 LY_DEFINE (ly_grob_replace_tweak, "ly:grob-replace-tweak",
38 (SCM grob, SCM tweak),
39 "Replace tweak for grob.")
41 Grob *gr = unsmob_grob (grob);
42 SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "Grob");
43 SCM_ASSERT_TYPE (scm_list_p (tweak) == SCM_BOOL_T
44 && ly_c_procedure_p (scm_car (tweak)),
45 tweak, SCM_ARG2, __FUNCTION__, "Tweak");
47 global_registry_->replace_grob_tweak (gr, tweak);
48 return SCM_UNSPECIFIED;
51 LY_DEFINE (ly_tweak_read_keys, "ly:tweak-define-keys",
55 global_registry_->undumper ()->parse_contents (keys);
56 return SCM_UNSPECIFIED;
59 LY_DEFINE (ly_all_tweaks, "ly:all-tweaks",
63 return global_registry_->list_tweaks ();
66 LY_DEFINE (ly_tweak_read_tweaks, "ly:tweak-define-tweaks",
67 1, 0, 0, (SCM tweaks),
70 for (SCM s = tweaks; scm_is_pair (s); s = scm_cdr (s))
71 global_registry_->insert_tweak_from_file (scm_car (s));
72 return SCM_UNSPECIFIED;