2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2009 Carl Sorensen <c_sorensen@byu.edu>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "beam-settings.hh"
22 #include "guile-compatibility.hh"
24 LY_DEFINE (ly_grouping_rules, "ly:grouping-rules",
25 3, 0, 0, (SCM settings, SCM time_signature, SCM rule_type),
26 "Return grouping rules for @var{time-signature} and"
27 " @var{rule-type} from @var{settings}.")
29 LY_ASSERT_TYPE (ly_cheap_is_list, settings, 1);
30 LY_ASSERT_TYPE (scm_is_pair, time_signature, 2);
31 LY_ASSERT_TYPE (ly_is_symbol, rule_type, 3);
33 SCM grouping_rules = SCM_EOL;
34 if (scm_is_pair (settings))
36 ly_assoc_get (scm_list_2 (time_signature, rule_type),
39 return grouping_rules;
42 LY_DEFINE (ly_beam_grouping, "ly:beam-grouping",
43 4, 0, 0, (SCM settings, SCM time_signature, SCM rule_type,
45 "Return grouping for beams of @var{beam-type} in"
46 " @var{time-signature} for"
47 " @var{rule-type} from @var{settings}.")
49 LY_ASSERT_TYPE (ly_cheap_is_list, settings, 1);
50 LY_ASSERT_TYPE (scm_is_pair, time_signature, 2);
51 LY_ASSERT_TYPE (ly_is_symbol, rule_type, 3);
52 SCM_ASSERT_TYPE (scm_is_symbol(beam_type) || scm_is_pair(beam_type),
53 beam_type, SCM_ARG4, __FUNCTION__, "symbol or pair");
55 ly_assoc_get (beam_type,
56 ly_grouping_rules (settings,time_signature,rule_type),
61 LY_DEFINE (ly_beat_grouping, "ly:beat-grouping",
62 1, 0, 0, (SCM context),
63 "Return default beat grouping currently active in @var{context}.")
65 LY_ASSERT_SMOB (Context, context, 1);
66 Context *c = unsmob_context (context);
68 c->get_property ("timeSignatureFraction");
70 c->get_property("beamSettings");
72 ly_beam_grouping (settings,
74 ly_symbol2scm ("end"),