+2004-09-05 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * input/regression/key-signature-cancellation.ly (Module): new file.
+
+ * lily/*.cc: more ly_scm2 -> scm_to converions.
+
+ * lily/key-signature-interface.cc (print): take position
+ difference into account when spacing naturals.
+
+ * lily/key-engraver.cc (create_key): create KeyCancellation grob
+ separately, so the cancellation can be put before the staff-bar
+
+ * scm/define-grobs.scm (all-grob-descriptions): add a
+ KeyCancellation grob.
+
+ * lily/tuplet-engraver.cc (struct Tuplet_description): new
+ struct. Use to clean-up Tuplet_engraver
+
2004-09-04 Han-Wen Nienhuys <hanwen@xs4all.nl>
* lily/*: ly_scm2int -> scm_to_int
+ ly_scm2double -> scm_to_double
* lily/include/lily-guile.hh (scm_from_double): more compat glue.
@itemize @bullet
+@item Key signature cancellations are now printed before the bar line,
+and their appearance has been improved.
+
+
@item The automatic staff changer, which is invoked with
@code{\autochange}, now creates the @code{up} and @code{down} staff
automatically, and uses bass clef for the bottom staff.
--- /dev/null
+\header { texidoc = "Cancellation are printed before the barline. The
+ spacing of the natural signs depends on their vertical
+ positions. The stems should not clash graphically."
+
+
+}
+
+\paper {
+ raggedright = ##T
+}
+
+{
+
+ \key a \major
+ g'1
+ \key f \minor
+ g'1
+}
if (ly_c_pair_p (prev_local))
{
if (ly_c_pair_p (ly_cdr (prev_local))
- && ly_c_number_p (laziness))
+ && scm_is_number (laziness))
{
int barnum = scm_to_int (ly_cddr (prev_local));
prev_alt = (prev_alt == SCM_BOOL_F) ? scm_int2num (0) : ly_cdr (prev_alt);
/* UGH. prev_acc can be #t in case of ties. What is this for? */
- int p = ly_c_number_p (prev_alt) ? scm_to_int (prev_alt) : 0;
+ int p = scm_is_number (prev_alt) ? scm_to_int (prev_alt) : 0;
int num;
- if (a == p && ly_c_number_p (prev_alt))
+ if (a == p && scm_is_number (prev_alt))
num = 0;
else if ( (abs (a)<abs (p) || p*a<0) && a != 0 )
num = 2;
int number = 0;
*different = false;
- if (ly_c_pair_p (accidentals) && !ly_c_symbol_p (ly_car (accidentals)))
+ if (ly_c_pair_p (accidentals) && !scm_is_symbol (ly_car (accidentals)))
warning (_f ("Accidental typesetting list must begin with context-name: %s",
ly_scm2string (ly_car (accidentals)).to_str0 ()));
SCM localsig = origin->get_property ("localKeySignature");
bool same_octave_b =
- ly_c_eq_p (ly_symbol2scm ("same-octave"), type);
+ scm_is_eq (ly_symbol2scm ("same-octave"), type);
bool any_octave_b =
- ly_c_eq_p (ly_symbol2scm ("any-octave"), type);
+ scm_is_eq (ly_symbol2scm ("any-octave"), type);
if (same_octave_b || any_octave_b)
{
/*
if symbol then it is a context name. Scan parent contexts to find it.
*/
- else if (ly_c_symbol_p (rule))
+ else if (scm_is_symbol (rule))
{
Context *dad = origin;
while (dad && !dad->is_alias (rule))
}
Array<Box>
-Accidental_interface::accurate_boxes (Grob *a,Grob**common)
+Accidental_interface::accurate_boxes (Grob *a, Grob**common)
{
Box b;
b[X_AXIS] = a->extent (a, X_AXIS);
SCM accs = a->get_property ("accidentals");
SCM scm_style = a->get_property ("style");
- if (!ly_c_symbol_p (scm_style)
+ if (!scm_is_symbol (scm_style)
&& !parens
&& scm_ilength (accs) == 1)
{
SCM scm_style = me->get_property ("style");
String style;
- if (ly_c_symbol_p (scm_style))
+ if (scm_is_symbol (scm_style))
{
style = ly_symbol2string (scm_style);
}
SCM d = me->get_property ("stacking-dir");
- Direction stacking_dir = ly_c_number_p (d) ? to_dir (d) : CENTER;
+ Direction stacking_dir = scm_is_number (d) ? to_dir (d) : CENTER;
if (!stacking_dir)
stacking_dir = DOWN;
SCM d = me->get_property ("stacking-dir");
- Direction stacking_dir = ly_c_number_p (d) ? to_dir (d) : CENTER;
+ Direction stacking_dir = scm_is_number (d) ? to_dir (d) : CENTER;
if (!stacking_dir)
stacking_dir = DOWN;
FIXME: uncommenting freaks out the Y-alignment of
line-of-score.
*/
- if (ly_c_number_p (align))
+ if (scm_is_number (align))
center_offset = total.linear_combination (scm_to_double (align));
for (int j = 0 ; j < all_grobs.size (); j++)
{
while (g)
{
- if (ly_c_number_p (g->get_property ("forced-distance")))
+ if (scm_is_number (g->get_property ("forced-distance")))
return g;
g = g->get_parent (Y_AXIS);
Grob*me = unsmob_grob (smob);
Real ss = Staff_symbol_referencer::staff_space (me);
SCM size = me->get_property ("bar-size");
- if (ly_c_number_p (size))
+ if (scm_is_number (size))
return scm_make_real (scm_to_double (size)*ss);
else if (Staff_symbol_referencer::get_staff_symbol (me))
{
{
SCM bn = get_property ("currentBarNumber");
SCM proc = get_property ("barNumberVisibility");
- if (ly_c_number_p (bn) && ly_c_procedure_p (proc)
+ if (scm_is_number (bn) && ly_c_procedure_p (proc)
&& to_boolean (scm_call_1(proc, bn)))
{
create_items ();
Real slt = Staff_symbol_referencer::line_thickness (me) / ss;
SCM sdy = me->get_property ("least-squares-dy");
- Real dy_mus = ly_c_number_p (sdy) ? scm_to_double (sdy) : 0.0;
+ Real dy_mus = scm_is_number (sdy) ? scm_to_double (sdy) : 0.0;
Real straddle = 0.0;
Real sit = (thickness - slt) / 2;
Stencil gapped;
int gap_count = 0;
- if (ly_c_number_p (me->get_property ("gap-count")))
+ if (scm_is_number (me->get_property ("gap-count")))
{
gap_count = scm_to_int (me->get_property ("gap-count"));
gapped = Lookup::beam (dydx, w - 2 * gap_length, thick, blot);
scm_cons (scm_int2num (total[UP]),
scm_int2num (total[DOWN])));
- if (ly_c_number_p (s) && scm_to_int (s))
+ if (scm_is_number (s) && scm_to_int (s))
return to_dir (s);
/* If dir is not determined: get default */
Beam::consider_auto_knees (Grob* me)
{
SCM scm = me->get_property ("auto-knee-gap");
- if (!ly_c_number_p (scm))
+ if (!scm_is_number (scm))
return ;
Real threshold = scm_to_double (scm);
*/
bool is_concave1 = false;
SCM gap = me->get_property ("concaveness-gap");
- if (ly_c_number_p (gap))
+ if (scm_is_number (gap))
{
Real r1 = scm_to_double (gap);
Real dy = Stem::chord_start_y (stems.top ())
Real concaveness2 = 0;
SCM thresh = me->get_property ("concaveness-threshold");
Real r2 = infinity_f;
- if (!is_concave1 && ly_c_number_p (thresh))
+ if (!is_concave1 && scm_is_number (thresh))
{
r2 = scm_to_double (thresh);
bool gap = false;
Real thick =0.0;
- if (ly_c_number_p (me->get_property ("gap-count"))
+ if (scm_is_number (me->get_property ("gap-count"))
&&scm_to_int (me->get_property ("gap-count")))
{
gap = true;
Grob *rest = unsmob_grob (element_smob);
Axis a = (Axis) scm_to_int (axis);
- if (ly_c_number_p (rest->get_property ("staff-position")))
+ if (scm_is_number (rest->get_property ("staff-position")))
return scm_int2num (0);
assert (a == Y_AXIS);
Drul_array<Real> pos (0, 0);
SCM s = beam->get_property ("positions");
- if (ly_c_pair_p (s) && ly_c_number_p (ly_car (s)))
+ if (ly_c_pair_p (s) && scm_is_number (ly_car (s)))
pos = ly_scm2interval (s);
Real staff_space = Staff_symbol_referencer::staff_space (rest);
Beam::is_knee (Grob* me)
{
SCM k = me->get_property ("knee");
- if (ly_c_boolean_p (k))
+ if (scm_is_bool (k))
return ly_scm2bool (k);
bool knee = false;
return ;
SCM align_name = item->get_property ("break-align-symbol");
- if (!ly_c_symbol_p (align_name))
+ if (!scm_is_symbol (align_name))
return ;
if (!align_)
reason.
*/
for (SCM s = r ? r->get_property ("elements") : SCM_EOL;
- !ly_c_symbol_p (rsym) && ly_c_pair_p (s); s = ly_cdr (s))
+ !scm_is_symbol (rsym) && ly_c_pair_p (s); s = ly_cdr (s))
{
Grob * elt =unsmob_grob (ly_car (s));
edge_idx = next_idx;
SCM entry = SCM_EOL;
- if (ly_c_symbol_p (rsym))
+ if (scm_is_symbol (rsym))
entry = scm_assq (rsym, alist);
bool entry_found = ly_c_pair_p (entry);
if (!entry_found)
{
String sym_string;
- if (ly_c_symbol_p (rsym))
+ if (scm_is_symbol (rsym))
sym_string = ly_symbol2string (rsym);
String orig_string ;
if (inversion_event)
{
SCM oct = inversion_event->get_property ("octavation");
- if (ly_c_number_p (oct))
+ if (scm_is_number (oct))
{
Pitch *p = unsmob_pitch (inversion_event->get_property ("pitch"));
int octavation = scm_to_int (oct);
clef_ = c;
SCM cpos = get_property ("clefPosition");
- if (ly_c_number_p (cpos))
+ if (scm_is_number (cpos))
clef_->set_property ("staff-position", cpos);
SCM oct = get_property ("clefOctavation");
- if (ly_c_number_p (oct) && scm_to_int (oct))
+ if (scm_is_number (oct) && scm_to_int (oct))
{
Item * g = make_item ("OctavateEight", SCM_EOL);
{
SCM c0scm = get_property ("middleCPosition");
- int c0 = ly_c_number_p (c0scm) ? scm_to_int (c0scm) : 0;
+ int c0 = scm_is_number (c0scm) ? scm_to_int (c0scm) : 0;
int pmax = INT_MIN;
int pmin = INT_MAX;
SCM shape_scm = me->get_property ("style");
String shape;
- if (ly_c_symbol_p (shape_scm))
+ if (scm_is_symbol (shape_scm))
{
shape = ly_symbol2string (shape_scm);
}
int pos = pit->steps ();
SCM c0 = get_property ("middleCPosition");
- if (ly_c_number_p (c0))
+ if (scm_is_number (c0))
pos += scm_to_int (c0);
note->set_property ("staff-position", scm_int2num (pos));
Link_array<Context_def>
Context_def::path_to_acceptable_context (SCM type_sym, Output_def *odef) const
{
- assert (ly_c_symbol_p (type_sym));
+ assert (scm_is_symbol (type_sym));
SCM accepted = get_accepted (SCM_EOL);
ell = scm_cons (scm_cons (ly_symbol2scm ("context-name"), context_name_),
ell);
- if (ly_c_symbol_p (translator_group_type_))
+ if (scm_is_symbol (translator_group_type_))
ell = scm_cons (scm_cons (ly_symbol2scm ("group-type"),
translator_group_type_), ell);
return ell;
{
Context *tr = unsmob_context (context);
SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
- SCM_ASSERT_TYPE (ly_c_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (name), name, SCM_ARG2, __FUNCTION__, "symbol");
return updated_grob_properties (tr, name);
{
Context *tg = unsmob_context (context);
SCM_ASSERT_TYPE (tg, context, SCM_ARG1, __FUNCTION__, "context");
- SCM_ASSERT_TYPE (ly_c_symbol_p (grob), grob, SCM_ARG2, __FUNCTION__, "symbol");
- SCM_ASSERT_TYPE (ly_c_symbol_p (eltprop), eltprop, SCM_ARG3, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (grob), grob, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (eltprop), eltprop, SCM_ARG3, __FUNCTION__, "symbol");
execute_pushpop_property (tg, grob, eltprop, val);
Context *t = unsmob_context (c);
Context * tr= (t);
SCM_ASSERT_TYPE (tr, c, SCM_ARG1, __FUNCTION__, "Translator group");
- SCM_ASSERT_TYPE (ly_c_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (name), name, SCM_ARG2, __FUNCTION__, "symbol");
return tr->internal_get_property (name);
}
{
Context *tr = unsmob_context (context);
SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
- SCM_ASSERT_TYPE (ly_c_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (name), name, SCM_ARG2, __FUNCTION__, "symbol");
tr->internal_set_property (name, val);
{
Context *tr = unsmob_context (context);
SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
- SCM_ASSERT_TYPE (ly_c_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (name), name, SCM_ARG2, __FUNCTION__, "symbol");
tr = tr->where_defined (name);
if (tr)
{
Context *tr = unsmob_context (context);
SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
- SCM_ASSERT_TYPE (ly_c_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (name), name, SCM_ARG2, __FUNCTION__, "symbol");
tr->unset_property (name);
return SCM_UNSPECIFIED;
{
Context *tr = unsmob_context (context);
SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "context");
- SCM_ASSERT_TYPE (ly_c_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (name), name, SCM_ARG2, __FUNCTION__, "symbol");
while (tr)
{
bool
Context::is_bottom_context () const
{
- return !ly_c_symbol_p (default_child_context_name ());
+ return !scm_is_symbol (default_child_context_name ());
}
Context*
int p = pitches_[i].steps ();
SCM c0 = get_property ("middleCPosition");
- if (ly_c_number_p (c0))
+ if (scm_is_number (c0))
p += scm_to_int (c0);
SCM scm_style = me->get_property ("style");
String style;
- if (ly_c_symbol_p (scm_style))
+ if (scm_is_symbol (scm_style))
{
style = ly_symbol2string (scm_style);
}
SCM c = sc->get_property ("dot-count");
- if (ly_c_number_p (c))
+ if (scm_is_number (c))
{
Stencil d = Font_interface::get_default_font (sc)->find_by_name (String ("dots-dot"));
Real dw = d.extent (X_AXIS).length ();
if (scm_integer_p (pos) == SCM_BOOL_T)
note->set_property ("staff-position", pos);
- if (ly_c_symbol_p (style))
+ if (scm_is_symbol (style))
note->set_property ("style", style);
if (scm_is_string (script))
SCM sym = n->get_property ("drum-type");
SCM defn = SCM_EOL;
- if (ly_c_symbol_p (sym)
+ if (scm_is_symbol (sym)
&& (scm_hash_table_p (tab) == SCM_BOOL_T))
defn = scm_hashq_ref (tab, sym, SCM_EOL);
bool compress = false;
if (num != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE (ly_c_number_p (num), length, SCM_ARG3, __FUNCTION__, "integer");
+ SCM_ASSERT_TYPE (scm_is_number (num), length, SCM_ARG3, __FUNCTION__, "integer");
compress = true;
}
else
if (den != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE (ly_c_number_p (den), length, SCM_ARG4, __FUNCTION__, "integer");
+ SCM_ASSERT_TYPE (scm_is_number (den), length, SCM_ARG4, __FUNCTION__, "integer");
compress = true;
}
else
1, 0, 0, (SCM d),
"The 2-logarithm of 1/@var{d}.")
{
- SCM_ASSERT_TYPE (ly_c_number_p (d), d, SCM_ARG1, __FUNCTION__, "integer");
+ SCM_ASSERT_TYPE (scm_is_number (d), d, SCM_ARG1, __FUNCTION__, "integer");
int log = intlog2 (scm_to_int (d));
return scm_int2num (log);
}
start_type = "crescendo";
SCM s = get_property ((start_type + "Spanner").to_str0 ());
- if (!ly_c_symbol_p (s) || s == ly_symbol2scm ("hairpin"))
+ if (!scm_is_symbol (s) || s == ly_symbol2scm ("hairpin"))
{
cresc_ = make_spanner ("Hairpin", accepted_spanreqs_drul_[START]->self_scm ());
cresc_->set_property ("grow-direction",
DynamicText doesn't really have a script-priority field.
*/
- if (ly_c_number_p (p)
+ if (scm_is_number (p)
&& scm_to_int (p)
< scm_to_int (script_->get_property ("script-priority")))
Side_position_interface::add_support (line_spanner_, info.grob_);
*/
SCM min = get_property ("midiMinimumVolume");
SCM max = get_property ("midiMaximumVolume");
- if (ly_c_number_p (min) || ly_c_number_p (max))
+ if (scm_is_number (min) || scm_is_number (max))
{
Interval iv (0, 1);
- if (ly_c_number_p (min))
+ if (scm_is_number (min))
iv[MIN] = scm_to_double (min);
- if (ly_c_number_p (max))
+ if (scm_is_number (max))
iv[MAX] = scm_to_double (max);
volume = iv[MIN] + iv.length () * volume;
}
new_pit = new_pit.to_relative_octave (last);
SCM check = get_property ("absolute-octave");
- if (ly_c_number_p (check) &&
+ if (scm_is_number (check) &&
new_pit.get_octave () != scm_to_int (check))
{
Pitch expected_pit (scm_to_int (check),
newlist = scm_cons (scm_cons (key, scm_int2num (orig.get_alteration ())),
newlist);
}
- else if (ly_c_number_p (key))
+ else if (scm_is_number (key))
{
Pitch orig (0, scm_to_int (key), scm_to_int (alter));
orig = orig.transposed (*p);
// Hmm
int priority = 200;
SCM s = fingering->get_property ("script-priority");
- if (ly_c_number_p (s))
+ if (scm_is_number (s))
priority = scm_to_int (s);
/* See script-engraver.cc */
{
Font_metric *fm = unsmob_metrics (font);
SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
- SCM_ASSERT_TYPE (ly_c_number_p (index), index, SCM_ARG2, __FUNCTION__, "number");
+ SCM_ASSERT_TYPE (scm_is_number (index), index, SCM_ARG2, __FUNCTION__, "number");
return fm->get_ascii_char_stencil (scm_to_int (index)).smobbed_copy ();
}
if (gi.origin_trans_->context () != context ())
return ;
- if (ly_c_number_p (sz) && scm_to_double (sz))
+ if (scm_is_number (sz) && scm_to_double (sz))
{
Real font_size = scm_to_double (sz);
if (pc->original_)
{
SCM pen = pc->get_property ("penalty");
- if (ly_c_number_p (pen) && fabs (scm_to_double (pen)) < 10000)
+ if (scm_is_number (pen) && fabs (scm_to_double (pen)) < 10000)
{
break_penalties += scm_to_double (pen);
}
LY_DEFINE (ly_add_interface, "ly:add-interface", 3,0,0, (SCM a, SCM b, SCM c),
"Add an interface description.")
{
- SCM_ASSERT_TYPE (ly_c_symbol_p (a), a, SCM_ARG1, __FUNCTION__, "symbol");
+ 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 (!ly_c_vector_p (all_ifaces))
{
Grob *sc = unsmob_grob (grob);
SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
- SCM_ASSERT_TYPE (ly_c_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
if (!type_check_assignment (sym, val, ly_symbol2scm ("backend-type?")))
error ("typecheck failed");
{
Grob *sc = unsmob_grob (grob);
SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
- SCM_ASSERT_TYPE (ly_c_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
return sc->internal_get_property (sym);
}
{
Grob *me = unsmob_grob (g);
SCM_ASSERT_TYPE (me, g, SCM_ARG1, __FUNCTION__, "grob");
- SCM_ASSERT_TYPE (ly_c_number_p (d), d, SCM_ARG2, __FUNCTION__, "dimension");
+ SCM_ASSERT_TYPE (scm_is_number (d), d, SCM_ARG2, __FUNCTION__, "dimension");
SCM_ASSERT_TYPE (is_axis (a), a, SCM_ARG3, __FUNCTION__, "axis");
me->translate_axis (scm_to_double (d), Axis (scm_to_int (a)));
SCM meta = get_property ("meta");
SCM nm = scm_assoc (ly_symbol2scm ("name"), meta);
nm = (ly_c_pair_p (nm)) ? ly_cdr (nm) : SCM_EOL;
- return ly_c_symbol_p (nm) ? ly_symbol2string (nm) : classname (this);
+ return scm_is_symbol (nm) ? ly_symbol2string (nm) : classname (this);
}
void
#define scm_hash_table_p scm_vector_p
#define scm_i_string_chars(x) SCM_STRING_CHARS(x)
#define scm_i_string_length(x) SCM_STRING_LENGTH(x)
+inline bool ly_c_number_p (SCM x) { return SCM_NUMBERP (x); }
#define scm_is_number(x) (scm_number_p(x)==SCM_BOOL_T)
inline int ly_scm2int (SCM x) { return scm_num2int (x, 0, "ly_scm2int"); }
#define scm_to_int(x) (ly_scm2int(x))
+inline bool ly_c_symbol_p (SCM x) { return SCM_SYMBOLP (x); }
+#define scm_is_symbol(x) ly_c_symbol_p(x)
+inline bool ly_c_boolean_p (SCM x) { return SCM_BOOLP (x); }
+#define scm_is_bool(x) ly_c_boolean_p(
+inline bool ly_c_eq_p (SCM x, SCM y) { return SCM_EQ_P (x, y); }
+#define scm_is_eq(x,y) (SCM_EQ_P (x, y));
inline double ly_scm2double (SCM x) { return scm_num2dbl (x, "ly_scm2double"); }
#define scm_to_double(x) (ly_scm2double(x))
#define scm_from_double(x) (scm_make_real(x))
+
+
#endif /* SCM_MINOR_VERSION < 7 */
#ifndef SMOB_FREE_RETURN_VAL
return scm_acons(key, val, scm_assoc_remove_x (alist, key));
}
inline bool ly_c_pair_p (SCM x) { return SCM_NFALSEP (scm_pair_p (x)); }
-inline bool ly_c_symbol_p (SCM x) { return SCM_SYMBOLP (x); }
-inline bool ly_c_boolean_p (SCM x) { return SCM_BOOLP (x); }
inline bool ly_c_char_p (SCM x) { return SCM_CHARP (x); }
-inline bool ly_c_number_p (SCM x) { return SCM_NUMBERP (x); }
-inline bool ly_c_string_p (SCM x) { return scm_is_string (x); }
inline bool ly_c_vector_p (SCM x) { return SCM_VECTORP (x); }
inline bool ly_c_list_p (SCM x) { return SCM_NFALSEP (scm_list_p (x)); }
inline bool ly_c_procedure_p (SCM x) { return SCM_NFALSEP (scm_procedure_p (x)); }
-inline bool ly_c_eq_p (SCM x, SCM y) { return SCM_EQ_P (x, y); }
inline bool ly_c_equal_p (SCM x, SCM y) {
return SCM_NFALSEP (scm_equal_p (x, y));
}
{
void create_key (bool);
void read_ev (Music const * r);
- Music * key_ev_;
- Item * item_;
+ Music *key_ev_;
+ Item *item_;
+ Item *cancellation_;
public:
TRANSLATOR_DECLARATIONS (Key_engraver);
{
key_ev_ = 0;
item_ = 0;
+ cancellation_ = 0;
}
item_->set_property ("c0-position",
get_property ("middleCPosition"));
+
+ SCM last = get_property ("lastKeySignature");
+ SCM key = get_property ("keySignature");
+ if (to_boolean (get_property ("printKeyCancellation"))
+ && !scm_is_eq (last, key))
+ {
+ cancellation_ = make_item ("KeyCancellation", key_ev_ ? key_ev_->self_scm () : SCM_EOL);
+ cancellation_->set_property ("old-accidentals",last);
+ cancellation_->set_property ("c0-position",
+ get_property ("middleCPosition"));
- if (to_boolean (get_property ("printKeyCancellation")))
- item_->set_property ("old-accidentals", get_property ("lastKeySignature"));
- item_->set_property ("new-accidentals", get_property ("keySignature"));
+ }
+ item_->set_property ("new-accidentals", key);
}
if (!def)
{
item_ = 0;
context ()->set_property ("lastKeySignature", get_property ("keySignature"));
+ cancellation_ = 0;
}
SCM scm_style = me->get_property ("style");
String style;
- if (ly_c_symbol_p (scm_style))
+ if (scm_is_symbol (scm_style))
{
style = ly_symbol2string (scm_style);
}
SCM c0s = me->get_property ("c0-position");
int c0p = 0;
- if (ly_c_number_p (c0s))
+ if (scm_is_number (c0s))
c0p = scm_to_int (c0s);
/*
{
SCM old = me->get_property ("old-accidentals");
- /*
- Add half a space between cancellation and key sig.
-
- As suggested by [Ross], p.148.
- */
- Interval x (0, inter);
- Interval y (0,0);
-
- mol.add_at_edge (X_AXIS, LEFT, Lookup::blank (Box (x,y)), 0, 0);
-
Stencil natural;
if (ly_c_pair_p (old))
natural=Font_interface::get_default_font (me)->
find_by_name (String ("accidentals-") + style + String ("0"));
+
+ int last_pos = -100;
for (; ly_c_pair_p (old); old = ly_cdr (old))
{
SCM found = scm_assoc (ly_caar (old), newas);
has vertical edges on both sides. A little padding is
needed to prevent collisions.
*/
- Real padding = 0.1 ;
+ Real padding = 0.0;
+ if (last_pos < pos + 2
+ && last_pos> pos - 6)
+ padding = 0.3;
+
mol.add_at_edge (X_AXIS, LEFT, m, padding, 0);
+ last_pos = pos;
}
}
}
String str (YYText () + 1);
SCM s = lookup_markup_command (str);
- if (ly_c_pair_p (s) && ly_c_symbol_p (ly_cdr (s)) ) {
+ if (ly_c_pair_p (s) && scm_is_symbol (ly_cdr (s)) ) {
yylval.scm = ly_car(s);
SCM tag = ly_cdr(s);
if (tag == ly_symbol2scm("markup0"))
yylval.scm = ly_cdr (handle);
if (unsmob_pitch (yylval.scm))
return (YYSTATE == notes) ? NOTENAME_PITCH : TONICNAME_PITCH;
- else if (ly_c_symbol_p (yylval.scm))
+ else if (scm_is_symbol (yylval.scm))
return DRUM_PITCH;
}
else if ((handle = scm_hashq_get_handle (chordmodifier_tab_, sym))!= SCM_BOOL_F)
"@code{1}, where @code{-1} represents "
"left or down and @code{1} represents right or up.")
{
- if (ly_c_number_p (s))
+ if (scm_is_number (s))
{
int i = scm_to_int (s);
return (i>= -1 && i <= 1) ? SCM_BOOL_T : SCM_BOOL_F;
is_number_pair (SCM p)
{
return ly_c_pair_p (p)
- && ly_c_number_p (ly_car (p)) && ly_c_number_p (ly_cdr (p));
+ && scm_is_number (ly_car (p)) && scm_is_number (ly_cdr (p));
}
typedef void (*Void_fptr) ();
bool
is_direction (SCM s)
{
- if (ly_c_number_p (s))
+ if (scm_is_number (s))
{
int i = scm_to_int (s);
return i>= -1 && i <= 1;
bool
is_axis (SCM s)
{
- if (ly_c_number_p (s))
+ if (scm_is_number (s))
{
int i = scm_to_int (s);
return i== 0 || i == 1;
bool
to_boolean (SCM s)
{
- return ly_c_boolean_p (s) && ly_scm2bool (s);
+ return scm_is_bool (s) && ly_scm2bool (s);
}
/* Appendable list L: the cdr contains the list, the car the last cons
1, 0, 0, (SCM s),
"Convert @var{num} to a string without generating many decimals.")
{
- SCM_ASSERT_TYPE (ly_c_number_p (s), s, SCM_ARG1, __FUNCTION__, "number");
+ SCM_ASSERT_TYPE (scm_is_number (s), s, SCM_ARG1, __FUNCTION__, "number");
char str[400]; // ugh.
if (val == SCM_EOL || val == SCM_BOOL_F)
return ok;
- if (!ly_c_symbol_p (sym))
+ if (!scm_is_symbol (sym))
#if 0
return false;
#else
Slice s;
s.set_empty ();
for (; ly_c_pair_p (l); l = ly_cdr (l))
- if (ly_c_number_p (ly_car (l)))
+ if (scm_is_number (ly_car (l)))
s.add_point (scm_to_int (ly_car (l)));
return s;
}
Real
robust_scm2double (SCM k, double x)
{
- if (ly_c_number_p (k))
+ if (scm_is_number (k))
x = scm_to_double (k);
return x;
}
if (scm_is_string (name))
sym = scm_string_to_symbol (name);
- if (ly_c_symbol_p (sym))
+ if (scm_is_symbol (sym))
{
if (lookup_keyword (ly_symbol2string (sym)) >= 0)
{
"Bind SYMBOL to VAL in PARSER_SMOB's module.")
{
Lily_parser *parser = unsmob_my_lily_parser (parser_smob);
- SCM_ASSERT_TYPE (ly_c_symbol_p (symbol), symbol, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (symbol), symbol, SCM_ARG2, __FUNCTION__, "symbol");
SCM_ASSERT_TYPE (parser, parser_smob, SCM_ARG2, __FUNCTION__, "parser");
parser->lexer_->set_identifier (scm_symbol_to_string (symbol), val);
{
Lily_parser *parser = unsmob_my_lily_parser (parser_smob);
- SCM_ASSERT_TYPE (ly_c_symbol_p (symbol), symbol, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (symbol), symbol, SCM_ARG2, __FUNCTION__, "symbol");
SCM_ASSERT_TYPE (parser, parser_smob, SCM_ARG2, __FUNCTION__, "parser");
SCM val= parser->lexer_->lookup_identifier (ly_scm2string (scm_symbol_to_string (symbol)));
SCM type = me->get_property ("style");
SCM dash_fraction = me->get_property ("dash-fraction");
- if (ly_c_number_p (dash_fraction) || type == ly_symbol2scm ("dotted-line"))
+ if (scm_is_number (dash_fraction) || type == ly_symbol2scm ("dotted-line"))
{
Real fraction
{
Offset dz = to -from ;
SCM type = me->get_property ("style");
- if (ly_c_symbol_p (type)
+ if (scm_is_symbol (type)
&& (type == ly_symbol2scm ("line")
|| type == ly_symbol2scm ("dashed-line")
|| type == ly_symbol2scm ("dotted-line")
? zigzag_stencil (me, from, to)
: Line_interface::line (me, from, to);
}
- else if (ly_c_symbol_p (type)
+ else if (scm_is_symbol (type)
&& type == ly_symbol2scm ("trill"))
{
SCM alist_chain = Font_interface::text_font_alist_chain (me);
{
SCM_ASSERT_TYPE (is_axis (a), a, SCM_ARG1, __FUNCTION__, "axis") ;
SCM_ASSERT_TYPE (is_number_pair (iv), iv, SCM_ARG2, __FUNCTION__, "number pair") ;
- SCM_ASSERT_TYPE (ly_c_number_p (t), a, SCM_ARG3, __FUNCTION__, "number") ;
- SCM_ASSERT_TYPE (ly_c_number_p (p), a, SCM_ARG4, __FUNCTION__, "number") ;
+ SCM_ASSERT_TYPE (scm_is_number (t), a, SCM_ARG3, __FUNCTION__, "number") ;
+ SCM_ASSERT_TYPE (scm_is_number (p), a, SCM_ARG4, __FUNCTION__, "number") ;
return Lookup::bracket ((Axis)scm_to_int (a), ly_scm2interval (iv),
{
SCM_ASSERT_TYPE (is_number_pair (xext), xext, SCM_ARG1, __FUNCTION__, "number pair") ;
SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG2, __FUNCTION__, "number pair") ;
- SCM_ASSERT_TYPE (ly_c_number_p (blot), blot, SCM_ARG3, __FUNCTION__, "number") ;
+ SCM_ASSERT_TYPE (scm_is_number (blot), blot, SCM_ARG3, __FUNCTION__, "number") ;
return Lookup::round_filled_box (Box (ly_scm2interval (xext), ly_scm2interval (yext)),
scm_to_double (blot)).smobbed_copy ();
if (!Text_item::markup_p (m) &&
ly_c_procedure_p (proc))
{
- if (!ly_c_number_p (m))
+ if (!scm_is_number (m))
m = get_property ("rehearsalMark");
if (scm_integer_p (m) == SCM_BOOL_T
scm_int2num (mark_count));
}
- if (ly_c_number_p (m))
+ if (scm_is_number (m))
m = scm_call_2 (proc, m, context ()->self_scm ());
else
warning ("rehearsalMark does not have integer value.");
/*
UGH.
*/
- if (ly_c_symbol_p (coding))
+ if (scm_is_symbol (coding))
coding = scm_symbol_to_string (coding);
String scheme = scm_is_string (coding) ? ly_scm2string (coding) : "";
Box char_box;
- if (!ly_c_symbol_p (sym))
+ if (!scm_is_symbol (sym))
continue;
char const * chars = scm_i_string_chars (scm_symbol_to_string(sym));
{
SCM thres = get_property ("restNumberThreshold");
int t = 1;
- if (ly_c_number_p (thres))
+ if (scm_is_number (thres))
t = scm_to_int (thres);
if (num <= t)
int measures = 0;
SCM m (me->get_property ("measure-count"));
- if (ly_c_number_p (m))
+ if (scm_is_number (m))
{
measures = scm_to_int (m);
}
{
int measures = 0;
SCM m (me->get_property ("measure-count"));
- if (ly_c_number_p (m))
+ if (scm_is_number (m))
{
measures = scm_to_int (m);
}
Music::name () const
{
SCM nm = get_property ("name");
- if (ly_c_symbol_p (nm))
+ if (scm_is_symbol (nm))
{
return ly_symbol2string (nm);
}
Music* m = unsmob_music (s);
SCM nm = m->get_property ("name");
- if (ly_c_symbol_p (nm) || scm_is_string (nm))
+ if (scm_is_symbol (nm) || scm_is_string (nm))
scm_display (nm, p);
else
scm_puts (classname (m),p);
{
Music * sc = unsmob_music (mus);
SCM_ASSERT_TYPE (sc, mus, SCM_ARG1, __FUNCTION__, "music");
- SCM_ASSERT_TYPE (ly_c_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
return sc->internal_get_property (sym);
}
{
Music * sc = unsmob_music (mus);
SCM_ASSERT_TYPE (sc, mus, SCM_ARG1, __FUNCTION__, "music");
- SCM_ASSERT_TYPE (ly_c_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
bool ok = type_check_assignment (sym, val, ly_symbol2scm ("music-type?"));
if (ok)
SCM sh
= clashes[i]->get_property ("horizontal-shift");
- if (ly_c_number_p (sh))
+ if (scm_is_number (sh))
shift.push (scm_to_int (sh));
else
shift.push (0);
Grob * se = unsmob_grob (ly_car (s));
SCM force = se->get_property ("force-hshift");
- if (ly_c_number_p (force))
+ if (scm_is_number (force))
{
tups = scm_cons (scm_cons (se->self_scm (), force),
tups);
SCM s1 = p1->get_property ("horizontal-shift");
SCM s2 = p2->get_property ("horizontal-shift");
- int h1 = (ly_c_number_p (s1))? scm_to_int (s1) :0;
- int h2 = (ly_c_number_p (s2)) ? scm_to_int (s2):0;
+ int h1 = (scm_is_number (s1))? scm_to_int (s1) :0;
+ int h2 = (scm_is_number (s2)) ? scm_to_int (s2):0;
return h1 - h2;
}
Note_column::translate_rests (Grob*me, int dy)
{
Grob * r = unsmob_grob (me->get_property ("rest"));
- if (r && !ly_c_number_p (r->get_property ("staff-position")))
+ if (r && !scm_is_number (r->get_property ("staff-position")))
{
r->translate_axis (dy * Staff_symbol_referencer::staff_space (r)/2.0, Y_AXIS);
}
internal_print (Grob *me)
{
SCM style = me->get_property ("style");
- if (!ly_c_symbol_p (style))
+ if (!scm_is_symbol (style))
{
return Stencil ();
}
if (brewer == Note_head::print_proc)
{
SCM style = me->get_property ("style");
- if (!ly_c_symbol_p (style))
+ if (!scm_is_symbol (style))
{
return 0.0;
}
Note_head::get_balltype (Grob*me)
{
SCM s = me->get_property ("duration-log");
- return ly_c_number_p (s) ? scm_to_int (s) <? 2 : 0;
+ return scm_is_number (s) ? scm_to_int (s) <? 2 : 0;
}
ADD_INTERFACE (Note_head,"note-head-interface",
int pos = pit ? pit->steps () : 0;
SCM c0 = get_property ("middleCPosition");
- if (ly_c_number_p (c0))
+ if (scm_is_number (c0))
pos += scm_to_int (c0);
note->set_property ("staff-position", scm_int2num (pos));
{
Output_def *op = unsmob_output_def (pap);
SCM_ASSERT_TYPE (op, pap, SCM_ARG1, __FUNCTION__, "Output_def");
- SCM_ASSERT_TYPE (ly_c_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
return op->lookup_variable (sym);
}
tag_music (Music *m, SCM tag, Input ip)
{
SCM tags = m->get_property ("tags");
- if (ly_c_symbol_p (tag))
+ if (scm_is_symbol (tag))
tags = scm_cons (tag, tags);
else if (ly_c_list_p (tag))
tags = ly_append2 (tag, tags);
make_simple_markup (SCM encoding, SCM a)
{
SCM simple = ly_scheme_function ("simple-markup");
- if (ly_c_symbol_p (encoding))
+ if (scm_is_symbol (encoding))
return scm_list_3 (ly_scheme_function ("encoded-simple-markup"),
encoding, a);
return scm_list_2 (simple, a);
SCM arts = scm_reverse_x (post, SCM_EOL);
n->set_property ("articulations", arts);
}
- if (ly_c_number_p (check))
+ if (scm_is_number (check))
{
int q = scm_to_int (check);
n->set_property ("absolute-octave", scm_int2num (q-1));
Music *m = unsmob_music ($1);
if ($2) {
SCM salter = m->get_property ("alteration");
- int alter = ly_c_number_p (salter) ? scm_to_int (salter) : 0;
+ int alter = scm_is_number (salter) ? scm_to_int (salter) : 0;
m->set_property ("alteration",
scm_int2num (alter + $2));
} else {
n->set_property ("pitch", $1);
n->set_property ("duration", $5);
- if (ly_c_number_p ($4))
+ if (scm_is_number ($4))
{
int q = scm_to_int ($4);
n->set_property ("absolute-octave", scm_int2num (q-1));
if (scm_is_string (sid)) {
*destination = sid;
return STRING_IDENTIFIER;
- } else if (ly_c_number_p (sid)) {
+ } else if (scm_is_number (sid)) {
*destination = sid;
return NUMBER_IDENTIFIER;
} else if (unsmob_context_def (sid)) {
scm_gc_unprotect_object (m->self_scm ());
csm->set_property ("context-type",
- ly_c_symbol_p (type) ? type : scm_string_to_symbol (type));
+ scm_is_symbol (type) ? type : scm_string_to_symbol (type));
csm->set_property ("property-operations", ops);
if (scm_is_string (id))
solo1 ();
else if (tag == ly_symbol2scm ("solo2"))
solo2 ();
- else if (ly_c_symbol_p (tag))
+ else if (scm_is_symbol (tag))
{
String s = "Unknown split directive: "
- + (ly_c_symbol_p (tag) ? ly_symbol2string (tag) : String ("not a symbol"));
+ + (scm_is_symbol (tag) ? ly_symbol2string (tag) : String ("not a symbol"));
programming_error (s);
}
}
Pitch_squash_engraver::acknowledge_grob (Grob_info i)
{
SCM newpos = get_property ("squashedPosition");
- if (ly_c_number_p (newpos)
+ if (scm_is_number (newpos)
&& Note_head::has_interface (i.grob_))
{
i.grob_->set_property ("staff-position", newpos);
Property_iterator::process (Moment m)
{
SCM sym = get_music ()->get_property ("symbol");
- if (ly_c_symbol_p (sym))
+ if (scm_is_symbol (sym))
{
SCM val = get_music ()->get_property ("value");
bool ok= true;
{
int pos= p->steps ();
SCM c0 = get_property ("middleCPosition");
- if (ly_c_number_p (c0))
+ if (scm_is_number (c0))
pos += scm_to_int (c0);
rest_->set_property ("staff-position", scm_int2num (pos));
Grob* me = unsmob_grob (smob);
SCM balltype_scm = me->get_property ("duration-log");
- if (!ly_c_number_p (balltype_scm))
+ if (!scm_is_number (balltype_scm))
return Stencil ().smobbed_copy ();
int balltype = scm_to_int (balltype_scm);
String style;
SCM style_scm = me->get_property ("style");
- if (ly_c_symbol_p (style_scm))
+ if (scm_is_symbol (style_scm))
style = ly_scm2string (scm_symbol_to_string (style_scm));
Font_metric *fm = Font_interface::get_default_font (me);
Rest::polyphonic_offset_callback (SCM smob, SCM)
{
Grob* me = unsmob_grob (smob);
- if (ly_c_number_p (me->get_property ("staff-position")))
+ if (scm_is_number (me->get_property ("staff-position")))
return scm_make_real (0);
Direction d = get_grob_direction (me);
Rhythmic_head::duration_log (Grob*me)
{
SCM s = me->get_property ("duration-log");
- return ly_c_number_p (s) ? scm_to_int (s) : 0;
+ return scm_is_number (s) ? scm_to_int (s) : 0;
}
ADD_INTERFACE (Rhythmic_head,"rhythmic-head-interface",
void
Scheme_hash_table::set (SCM k, SCM v)
{
- assert (ly_c_symbol_p (k));
+ assert (scm_is_symbol (k));
SCM handle = scm_hashq_create_handle_x (hash_tab_, k, SCM_UNDEFINED);
if (ly_cdr (handle) == SCM_UNDEFINED)
{
lily_1_8_relative = false;
else
{
- if (ly_c_symbol_p (var))
+ if (scm_is_symbol (var))
var = scm_symbol_to_string (var);
warning (_f ("No such internal option: %s", ly_scm2string (var)));
if (m->is_mus_type ("break-event"))
{
SCM pen = command_column_->get_property ("penalty");
- Real total_penalty = ly_c_number_p (pen) ? scm_to_double (pen) : 0.0;
+ Real total_penalty = scm_is_number (pen) ? scm_to_double (pen) : 0.0;
SCM mpen = m->get_property ("penalty");
- if (ly_c_number_p (mpen))
+ if (scm_is_number (mpen))
total_penalty += scm_to_double (mpen);
command_column_->set_property ("penalty", scm_make_real (total_penalty));
forbid_breaks ();
SCM page_pen = command_column_->get_property ("page-penalty");
- Real total_pp = ly_c_number_p (page_pen) ? scm_to_double (page_pen) : 0.0;
+ Real total_pp = scm_is_number (page_pen) ? scm_to_double (page_pen) : 0.0;
SCM mpage_pen = m->get_property ("page-penalty");
- if (ly_c_number_p (mpage_pen))
+ if (scm_is_number (mpage_pen))
total_pp += scm_to_double (mpage_pen);
command_column_->set_property ("page-penalty", scm_make_real (total_pp));
Script_column::add_staff_sided (Grob *me, Item *i)
{
SCM p = i->get_property ("script-priority");
- if (!ly_c_number_p (p))
+ if (!scm_is_number (p))
return;
Pointer_group_interface::add_grob (me, ly_symbol2scm ("scripts"),i);
: ly_symbol2scm ("self-alignment-Y");
SCM align_prop (me->internal_get_property (sym));
- if (!ly_c_number_p (align_prop))
+ if (!scm_is_number (align_prop))
return scm_int2num (0);
Real x = 0.0;
: ly_symbol2scm ("self-alignment-Y");
SCM align (me->internal_get_property (sym));
- if (ly_c_number_p (align))
+ if (scm_is_number (align))
{
Interval ext (me->extent (me, a));
if (ext.is_empty ())
{
Grob * break_item = unsmob_grob (ly_car (s));
- if (!ly_c_symbol_p (break_item->get_property ("break-align-symbol")))
+ if (!scm_is_symbol (break_item->get_property ("break-align-symbol")))
continue;
Interval ext = break_item->extent (col, X_AXIS);
Grob * st = Staff_symbol_referencer::get_staff_symbol (me);
bool include_staff = (st
&& a == Y_AXIS
- && ly_c_number_p (me->get_property ("staff-padding")));
+ && scm_is_number (me->get_property ("staff-padding")));
Interval dim;
if (include_staff)
*/
Grob * st = Staff_symbol_referencer::get_staff_symbol (me);
if (st && a == Y_AXIS
- && ly_c_number_p (me->get_property ("staff-padding")))
+ && scm_is_number (me->get_property ("staff-padding")))
{
Real padding=
Staff_symbol_referencer::staff_space (me)
for (int i = sz; i--; )
{
SCM p = positions->cols_[i]->get_property ( "penalty");
- if (ly_c_number_p (p))
+ if (scm_is_number (p))
{
if (scm_to_double (p) < -9999)
break_satisfy = break_satisfy && (i == 0 || i == sz -1);
SCM accs = g->get_property ("accidentals");
SCM scm_style = g->get_property ("style");
- if (!ly_c_symbol_p (scm_style)
+ if (!scm_is_symbol (scm_style)
&& !parens
&& scm_ilength (accs) == 1)
{
TODO: replace dashed with generic property.
*/
SCM d = me->get_property ("dashed");
- if (ly_c_number_p (d))
+ if (scm_is_number (d))
a = Lookup::dashed_slur (one, thick, thick * robust_scm2double (d, 0));
else
a = Lookup::slur (one, get_grob_direction (me) * base_thick * ss / 10.0,
SCM pos = me->get_property ("staff-position");
Real off = 0.0;
- if (ly_c_number_p (pos))
+ if (scm_is_number (pos))
{
Real space = Staff_symbol_referencer::staff_space (me);
off = scm_to_double (pos) * space / 2.0;
do
{
SCM width_scm = me->get_property ("width");
- if (d == RIGHT && ly_c_number_p (width_scm))
+ if (d == RIGHT && scm_is_number (width_scm))
{
/*
don't multiply by Staff_symbol_referencer::staff_space (me),
Staff_symbol::line_count (Grob*me)
{
SCM c = me->get_property ("line-count");
- if (ly_c_number_p (c))
+ if (scm_is_number (c))
return scm_to_int (c);
else
return 0;
SCM f = get_property ("tremoloFlags");
if (!requested_type)
{
- if (ly_c_number_p (f))
+ if (scm_is_number (f))
requested_type = scm_to_int (f);
else
requested_type = 8;
{
/* FIXME: junk these properties. */
SCM prop = get_property ("stemLeftBeamCount");
- if (ly_c_number_p (prop))
+ if (scm_is_number (prop))
{
Stem::set_beaming (stem_,scm_to_int (prop),LEFT);
context ()->unset_property (ly_symbol2scm ("stemLeftBeamCount"));
}
prop = get_property ("stemRightBeamCount");
- if (ly_c_number_p (prop))
+ if (scm_is_number (prop))
{
Stem::set_beaming (stem_,scm_to_int (prop), RIGHT);
context ()->unset_property (ly_symbol2scm ("stemRightBeamCount"));
int tremolo_flags = 0;
SCM s = me->get_property ("flag-count");
- if (ly_c_number_p (s))
+ if (scm_is_number (s))
tremolo_flags = scm_to_int (s);
if (!tremolo_flags)
Real beamthickness = 0.0;
SCM sbt = (beam) ? beam->get_property ("thickness") : SCM_EOL ;
- if (ly_c_number_p (sbt))
+ if (scm_is_number (sbt))
beamthickness = scm_to_double (sbt) * ss;
Real end_y
{
SCM p = me->get_property ("stem-end-position");
Real pos;
- if (!ly_c_number_p (p))
+ if (!scm_is_number (p))
{
pos = get_default_stem_end_position (me);
me->set_property ("stem-end-position", scm_make_real (pos));
/* WARNING: IN HALF SPACES */
Real length = 7;
SCM scm_len = me->get_property ("length");
- if (ly_c_number_p (scm_len))
+ if (scm_is_number (scm_len))
length = scm_to_double (scm_len);
else
{
Stem::duration_log (Grob *me)
{
SCM s = me->get_property ("duration-log");
- return (ly_c_number_p (s)) ? scm_to_int (s) : 2;
+ return (scm_is_number (s)) ? scm_to_int (s) : 2;
}
void
String flag_style;
SCM flag_style_scm = me->get_property ("flag-style");
- if (ly_c_symbol_p (flag_style_scm))
+ if (scm_is_symbol (flag_style_scm))
flag_style = ly_symbol2string (flag_style_scm);
if (flag_style == "no-flag")
{
Stencil *s = unsmob_stencil (stil);
SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil");
- SCM_ASSERT_TYPE (ly_c_number_p (amount), amount, SCM_ARG2, __FUNCTION__, "number pair");
+ SCM_ASSERT_TYPE (scm_is_number (amount), amount, SCM_ARG2, __FUNCTION__, "number pair");
SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
SCM new_s = s->smobbed_copy ();
Real p = 0.0;
if (padding != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE (ly_c_number_p (padding), padding, SCM_ARG5, __FUNCTION__, "number");
+ SCM_ASSERT_TYPE (scm_is_number (padding), padding, SCM_ARG5, __FUNCTION__, "number");
p = scm_to_double (padding);
}
Real m = 0.0;
if (minimum != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE (ly_c_number_p (minimum), minimum, SCM_ARG6, __FUNCTION__, "number");
+ SCM_ASSERT_TYPE (scm_is_number (minimum), minimum, SCM_ARG6, __FUNCTION__, "number");
m = scm_to_double (minimum);
}
Real p = 0.0;
if (padding != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE (ly_c_number_p (padding), padding, SCM_ARG5, __FUNCTION__, "number");
+ SCM_ASSERT_TYPE (scm_is_number (padding), padding, SCM_ARG5, __FUNCTION__, "number");
p = scm_to_double (padding);
}
Real m = 0.0;
if (minimum != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE (ly_c_number_p (minimum), minimum, SCM_ARG6, __FUNCTION__, "number");
+ SCM_ASSERT_TYPE (scm_is_number (minimum), minimum, SCM_ARG6, __FUNCTION__, "number");
m = scm_to_double (minimum);
}
{
SCM_ASSERT_TYPE (unsmob_stencil (stil), stil, SCM_ARG1, __FUNCTION__, "stencil");
SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
- SCM_ASSERT_TYPE (ly_c_number_p (dir), dir, SCM_ARG3, __FUNCTION__, "number");
+ SCM_ASSERT_TYPE (scm_is_number (dir), dir, SCM_ARG3, __FUNCTION__, "number");
unsmob_stencil (stil)->align_to ((Axis)scm_to_int (axis),
scm_to_double (dir));
SCM scm_pitch = event->get_property ("pitch");
SCM proc = get_property ("tablatureFormat");
SCM min_fret_scm = get_property ("minimumFret");
- int min_fret = ly_c_number_p (min_fret_scm) ? scm_to_int (min_fret_scm) : 0;
+ int min_fret = scm_is_number (min_fret_scm) ? scm_to_int (min_fret_scm) : 0;
while (!string_found)
{
// Hmm
int priority = 200;
SCM s = text->get_property ("script-priority");
- if (ly_c_number_p (s))
+ if (scm_is_number (s))
priority = scm_to_int (s);
/* see script-engraver.cc */
__FUNCTION__, "Paper definition");
SCM_ASSERT_TYPE (scm_is_string (markup), markup, SCM_ARG3,
__FUNCTION__, "string");
- SCM_ASSERT_TYPE (input_encoding == SCM_EOL || ly_c_symbol_p (input_encoding),
+ SCM_ASSERT_TYPE (input_encoding == SCM_EOL || scm_is_symbol (input_encoding),
input_encoding, SCM_ARG2, __FUNCTION__, "symbol");
String str = ly_scm2string (markup);
- if (!ly_c_symbol_p (input_encoding))
+ if (!scm_is_symbol (input_encoding))
{
SCM enc = paper->lookup_variable (ly_symbol2scm ("inputencoding"));
if (scm_is_string (enc))
input_encoding = scm_string_to_symbol (enc);
- else if (ly_c_symbol_p (enc))
+ else if (scm_is_symbol (enc))
input_encoding = enc;
}
{
m = numbered_time_signature (me, n, 0);
}
- else if (ly_c_symbol_p (st))
+ else if (scm_is_symbol (st))
{
m = special_time_signature (me, st, n, d);
}
SCM barn = get_property ("currentBarNumber");
int b = 0;
- if (ly_c_number_p (barn))
+ if (scm_is_number (barn))
{
b = scm_to_int (barn);
}
execute_pushpop_property (Context * trg,
SCM prop, SCM eltprop, SCM val)
{
- if (ly_c_symbol_p (prop) && ly_c_symbol_p (eltprop))
+ if (scm_is_symbol (prop) && scm_is_symbol (eltprop))
{
if (val != SCM_UNDEFINED)
{
SCM
updated_grob_properties (Context * tg, SCM sym)
{
- assert (ly_c_symbol_p (sym));
+ assert (scm_is_symbol (sym));
tg = tg->where_defined (sym);
if (!tg)
SCM lp = me->get_property ("left-position");
SCM rp = me->get_property ("right-position");
- if (!ly_c_number_p (rp) || !ly_c_number_p (lp))
+ if (!scm_is_number (rp) || !scm_is_number (lp))
after_line_breaking (smob);
}
Fixme: the type of this prop is sucky.
*/
SCM bracket = me->get_property ("bracket-visibility");
- if (ly_c_boolean_p (bracket))
+ if (scm_is_bool (bracket))
{
bracket_visibility = ly_scm2bool (bracket);
}
bracket_visibility = !par_beam;
SCM numb = me->get_property ("number-visibility");
- if (ly_c_boolean_p (numb))
+ if (scm_is_bool (numb))
{
number_visibility = ly_scm2bool (numb);
}
SCM lp = me->get_property ("left-position");
SCM rp = me->get_property ("right-position");
- if (ly_c_number_p (lp) && !ly_c_number_p (rp))
+ if (scm_is_number (lp) && !scm_is_number (rp))
{
rp = scm_make_real (scm_to_double (lp) + dy);
}
- else if (ly_c_number_p (rp) && !ly_c_number_p (lp))
+ else if (scm_is_number (rp) && !scm_is_number (lp))
{
lp = scm_make_real (scm_to_double (rp) - dy);
}
- else if (!ly_c_number_p (rp) && !ly_c_number_p (lp))
+ else if (!scm_is_number (rp) && !scm_is_number (lp))
{
lp = scm_make_real (offset);
rp = scm_make_real (offset +dy);
/*
- plet-engraver.cc -- implement Tuplet_engraver
+ tuplet-engraver.cc -- implement Tuplet_engraver
source file of the GNU LilyPond music typesetter
*/
-
-
#include "tuplet-bracket.hh"
#include "note-column.hh"
#include "time-scaled-music.hh"
#include "engraver.hh"
#include "spanner.hh"
+struct Tuplet_description
+{
+ Music *music_;
+ Rational stop_;
+ Rational span_stop_;
+ Spanner *spanner_;
+ Tuplet_description()
+ {
+ music_ = 0;
+ spanner_ = 0;
+ }
+};
+
class Tuplet_engraver : public Engraver
{
public:
TRANSLATOR_DECLARATIONS (Tuplet_engraver);
protected:
- Link_array<Music> time_scaled_musics_;
- /// when does the scaled music stop? Array order is synced with time_scaled_musics_
- Array<Rational> stop_moments_;
- /// when does the current spanner stop? Array order is synced with time_scaled_musics_
- Array<Rational> span_stop_moments_;
-
- /// The spanners. Array order is synced with time_scaled_musics_
- Link_array<Spanner> started_spanners_;
+ Array<Tuplet_description> tuplets_;
virtual void acknowledge_grob (Grob_info);
virtual bool try_music (Music*r);
virtual void start_translation_timestep ();
- virtual void process_acknowledged_grobs ();
+ virtual void process_music ();
};
bool
-Tuplet_engraver::try_music (Music *c)
+Tuplet_engraver::try_music (Music *music)
{
- if (c->is_mus_type ("time-scaled-music"))
+ if (music->is_mus_type ("time-scaled-music"))
{
- Music *el = unsmob_music (c->get_property ("element"));
+ Music *el = unsmob_music (music->get_property ("element"));
if (el && !el->is_mus_type ("event-chord"))
{
- time_scaled_musics_.push (c);
- Rational m = now_mom ().main_part_ + c->get_length ().main_part_;
- stop_moments_.push (m);
-
+ Tuplet_description d;
+ d.music_ = music;
+ d.stop_ = now_mom ().main_part_ + music->get_length ().main_part_;
+ d.span_stop_ = d.stop_;
+
SCM s = get_property ("tupletSpannerDuration");
if (unsmob_moment (s))
- m = m <? (now_mom () + *unsmob_moment (s)).main_part_;
+ d.span_stop_ = d.span_stop_ <? (now_mom () + *unsmob_moment (s)).main_part_;
- span_stop_moments_.push (m);
+ tuplets_.push (d);
}
return true;
}
}
void
-Tuplet_engraver::process_acknowledged_grobs ()
+Tuplet_engraver::process_music ()
{
- for (int i= 0; i < time_scaled_musics_.size (); i++)
+ for (int i= 0; i < tuplets_.size (); i++)
{
- if (i < started_spanners_.size () && started_spanners_[i])
+ if (tuplets_[i].spanner_)
continue;
- Spanner* glep = make_spanner ("TupletBracket", time_scaled_musics_ [i]->self_scm ());
-
- if (i >= started_spanners_.size ())
- started_spanners_.push (glep);
- else
- started_spanners_[i] = glep;
-
+ Spanner* spanner = make_spanner ("TupletBracket",
+ tuplets_[i].music_->self_scm ());
+ tuplets_[i].spanner_ = spanner;
SCM proc = get_property ("tupletNumberFormatFunction");
if (ly_c_procedure_p (proc))
{
- SCM t = scm_apply_0 (proc, scm_list_n (time_scaled_musics_[i]->self_scm (), SCM_UNDEFINED));
- glep->set_property ("text", t);
+ SCM t = scm_apply_0 (proc, scm_list_1 (tuplets_[i].music_->self_scm ()));
+ spanner->set_property ("text", t);
}
-
}
}
{
if (Note_column::has_interface (i.grob_))
{
- for (int j =0; j < started_spanners_.size (); j++)
- if (started_spanners_[j])
- Tuplet_bracket::add_column (started_spanners_[j], dynamic_cast<Item*> (i.grob_));
+ for (int j =0; j < tuplets_.size (); j++)
+ if (tuplets_[j].spanner_)
+ Tuplet_bracket::add_column (tuplets_[j].spanner_,
+ dynamic_cast<Item*> (i.grob_));
}
}
if (unsmob_moment (s))
tsd = unsmob_moment (s)->main_part_;
- for (int i= started_spanners_.size (); i--;)
+ for (int i = tuplets_.size (); i--;)
{
- if (now.main_part_ >= span_stop_moments_[i])
+ if (now.main_part_ >= tuplets_[i].span_stop_)
{
- if (Spanner *sp = started_spanners_[i])
+ if (Spanner *sp = tuplets_[i].spanner_)
{
if (!sp->get_bound (RIGHT))
sp->set_bound (RIGHT, sp->get_bound (LEFT));
- started_spanners_[i] =0;
+ tuplets_[i].spanner_ = 0;
}
if (tsd.to_bool ())
- span_stop_moments_[i] += tsd.main_part_;
+ tuplets_[i].span_stop_ += tsd.main_part_;
}
- if (now.main_part_ >= stop_moments_[i])
+ if (now.main_part_ >= tuplets_[i].span_stop_)
{
- started_spanners_.del (i);
- stop_moments_.del (i);
- span_stop_moments_.del (i);
- time_scaled_musics_.del (i);
+ tuplets_.del (i);
}
}
}
*tail = scm_cons (ly_car (s),SCM_EOL);
tail = SCM_CDRLOC (*tail);
- if (!ly_c_number_p (mag))
+ if (!scm_is_number (mag))
/* Ugh. */
mag = ly_cdr (fm->description_);
Volta_engraver::staff_eligible ()
{
SCM doit =get_property ("voltaOnThisStaff");
- if (ly_c_boolean_p (doit))
+ if (scm_is_bool (doit))
{
return to_boolean (doit);
}
(breakable . #t)
(stacking-dir . 1)
(break-align-orders . #(; end-of-line:
- (instrument-name left-edge ambitus breathing-sign
- clef staff-bar key-signature
- time-signature custos)
+ (instrument-name
+ left-edge ambitus breathing-sign
+ clef key-cancellation staff-bar key-signature
+ time-signature custos)
; unbroken
(instrument-name left-edge ambitus breathing-sign
- clef staff-bar key-signature
+ clef key-cancellation staff-bar key-signature
staff
time-signature custos)
; begin of line
(instrument-name left-edge ambitus breathing-sign
- clef key-signature staff-bar
+ clef key-cancellation key-signature staff-bar
time-signature custos)
))
(break-visibility . ,begin-of-line-visible)
(space-alist . ((ambitus . (extra-space . 2.0))
(staff-bar . (extra-space . 0.7))
+ (key-cancellation . (minimum-space . 4.0))
(key-signature . (minimum-space . 4.0))
(time-signature . (minimum-space . 4.2))
(first-note . (minimum-fixed-space . 5.0))
(first-note . (fixed-space . 1.0))
(right-edge . (extra-space . 0.0))
(key-signature . (extra-space . 0.0))
+ (key-cancellation . (extra-space . 0.0))
+
))
(meta . ((interfaces . (break-aligned-interface item-interface ))))
))
side-position-interface text-interface
break-aligned-interface item-interface ))))
))
-
+ (KeyCancellation
+ . (
+ (print-function . ,Key_signature_interface::print)
+ (space-alist . (
+ (time-signature . (extra-space . 1.25))
+ (staff-bar . (extra-space . 0.6))
+ (right-edge . (extra-space . 0.5))
+ (first-note . (fixed-space . 2.5))
+ ))
+ (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
+ (break-align-symbol . key-cancellation)
+ (break-visibility . ,begin-of-line-invisible)
+ (breakable . #t)
+
+ (meta . ((interfaces . (key-signature-interface font-interface
+ break-aligned-interface item-interface ))))
+ ))
(KeySignature
. (
(print-function . ,Key_signature_interface::print)