#define LEFT_and_RIGHT(d) \
Direction d = LEFT; d != CENTER; d = (d == LEFT ? RIGHT : CENTER)
-
/**
if d > 0: the max operator
if d < 0: the min operator
#include <sys/types.h>
#include <unistd.h>
-
int main (int argc, const char *argv[])
{
std::cout << "pid(" << getpid () << ")" << std::endl;
if (unit)
{
Rational const now_unit = e->main_part_ / unit->main_part_;
- if (now_unit.den() > 1)
+ if (now_unit.den () > 1)
{
/*
within a unit - go to the end of that
*/
result = unit->main_part_
- * (Rational (1) - (now_unit - now_unit.trunc_rat ()));
+ * (Rational (1) - (now_unit - now_unit.trunc_rat ()));
}
else
{
}
LY_DEFINE (ly_context_mod_apply_x, "ly:context-mod-apply!",
- 2, 0, 0, (SCM context, SCM mod),
- "Apply the context modification @var{mod} to @var{context}.")
+ 2, 0, 0, (SCM context, SCM mod),
+ "Apply the context modification @var{mod} to @var{context}.")
{
LY_ASSERT_SMOB (Context, context, 1);
LY_ASSERT_SMOB (Context_mod, mod, 2);
apply_property_operations (unsmob_context (context),
- unsmob_context_mod (mod)->get_mods ());
+ unsmob_context_mod (mod)->get_mods ());
scm_remember_upto_here_1 (context);
return SCM_UNSPECIFIED;
}
}
LY_DEFINE (ly_make_event_class, "ly:make-event-class",
- 2, 0, 0, (SCM context, SCM type),
- "Make an event class (a list of types) from the given @var{type}"
- " within the global context containing @var{context}.")
+ 2, 0, 0, (SCM context, SCM type),
+ "Make an event class (a list of types) from the given @var{type}"
+ " within the global context containing @var{context}.")
{
LY_ASSERT_SMOB (Context, context, 1);
LY_ASSERT_TYPE (ly_is_symbol, type, 2);
return scm_from_bool (result);
}
-
LY_DEFINE (ly_broadcast, "ly:broadcast",
2, 0, 0, (SCM disp, SCM ev),
"Send the stream event @var{ev} to the dispatcher @var{disp}.")
static SCM
accumulate_types (void * /* closure */,
- SCM key,
- SCM val,
- SCM result)
+ SCM key,
+ SCM val,
+ SCM result)
{
if (scm_is_pair (val))
return scm_cons (key, result);
if (mus)
{
if (!mus->is_mus_type ("footnote-event"))
- {
- mus->origin ()->programming_error (_ ("Must be footnote-event."));
- return;
- }
+ {
+ mus->origin ()->programming_error (_ ("Must be footnote-event."));
+ return;
+ }
footnotify (info.grob (), mus->to_event (context ())->unprotect ());
string grobname = info.grob ()->name ();
for (vsize i = 0; i < events_.size (); i++)
- {
- SCM name = events_[i]->get_property ("symbol");
- if (scm_is_symbol (name)
- && grobname == ly_symbol2string (name))
- {
- footnotify (info.grob (), events_[i]->self_scm ());
- // Event has exhausted its footnote
- events_[i]->set_property ("symbol", SCM_EOL);
- }
- }
+ {
+ SCM name = events_[i]->get_property ("symbol");
+ if (scm_is_symbol (name)
+ && grobname == ly_symbol2string (name))
+ {
+ footnotify (info.grob (), events_[i]->self_scm ());
+ // Event has exhausted its footnote
+ events_[i]->set_property ("symbol", SCM_EOL);
+ }
+ }
}
}
SCM p = get_property ("EventClasses");
ancestor_lookup_ = scm_make_hash_table (scm_length (p));
- for (;scm_is_pair (p); p = scm_cdr (p))
+ for (; scm_is_pair (p); p = scm_cdr (p))
scm_hashq_set_x (ancestor_lookup_, scm_caar (p), scm_car (p));
accepts_list_ = scm_list_1 (ly_symbol2scm ("Score"));
int hidden_state_;
SCM eval_scm (SCM, char extra_token = 0);
public:
- SCM eval_scm_token (SCM sval) { return eval_scm (sval, '#'); }
+ SCM eval_scm_token (SCM sval) { return eval_scm (sval, '#'); }
SCM extra_tokens_;
YYSTYPE *lexval_;
Input *lexloc_;
static void _ ## T ## _adder () \
{ \
T *t = new T; \
- T::static_description_ = \
- scm_permanent_object (t->static_translator_description ()); \
+ T::static_description_ = \
+ scm_permanent_object (t->static_translator_description ()); \
add_translator (t); \
} \
SCM T::translator_description () const \
{
if (r.is_infinity ())
{
- if (r > Rational(0))
- return scm_inf ();
+ if (r > Rational (0))
+ return scm_inf ();
return scm_difference (scm_inf (), SCM_UNDEFINED);
}
if (scm_is_true (scm_inf_p (r)))
{
if (scm_is_true (scm_positive_p (r)))
- {
- Rational r;
- r.set_infinite (1);
- return r;
- }
+ {
+ Rational r;
+ r.set_infinite (1);
+ return r;
+ }
else
- {
- Rational r;
- r.set_infinite (-1);
- return r;
- }
+ {
+ Rational r;
+ r.set_infinite (-1);
+ return r;
+ }
}
return Rational (scm_to_int64 (scm_numerator (r)),
ly_is_rational (SCM n)
{
return (scm_is_real (n)
- && (scm_is_true (scm_exact_p (n))
- || scm_is_true (scm_inf_p (n))));
+ && (scm_is_true (scm_exact_p (n))
+ || scm_is_true (scm_inf_p (n))));
}
SCM
" a pair of rationals (@var{m},@tie{}@var{g}), where @var{m} is"
" the timing for the main notes, and @var{g} the timing for"
" grace notes. In absence of grace notes, @var{g}@tie{}is zero.\n"
- "\n"
- "For compatibility reasons, it is possible to write two"
- " numbers specifying numerator and denominator instead of"
+ "\n"
+ "For compatibility reasons, it is possible to write two"
+ " numbers specifying numerator and denominator instead of"
" the rationals. These forms cannot be mixed, and the two-"
- "argument form is disambiguated by the sign of the second"
- " argument: if it is positive, it can only be a denominator"
- " and not a grace timing."
-)
+ "argument form is disambiguated by the sign of the second"
+ " argument: if it is positive, it can only be a denominator"
+ " and not a grace timing."
+ )
{
LY_ASSERT_TYPE (ly_is_rational, m, 1);
if (SCM_UNBNDP (g))
{
LY_ASSERT_TYPE (ly_is_rational, g, 2);
if (scm_is_true (scm_positive_p (g)))
- {
- LY_ASSERT_TYPE (scm_is_integer, m, 1);
- LY_ASSERT_TYPE (scm_is_integer, g, 2);
- return Moment (Rational (scm_to_int64 (m),
- scm_to_int64 (g))).smobbed_copy ();
- }
+ {
+ LY_ASSERT_TYPE (scm_is_integer, m, 1);
+ LY_ASSERT_TYPE (scm_is_integer, g, 2);
+ return Moment (Rational (scm_to_int64 (m),
+ scm_to_int64 (g))).smobbed_copy ();
+ }
return Moment (ly_scm2rational (m),
- ly_scm2rational (g)).smobbed_copy ();
+ ly_scm2rational (g)).smobbed_copy ();
}
LY_ASSERT_TYPE (scm_is_integer, m, 1);
return ly_rational2scm (unsmob_moment (mom)->main_part_);
}
-
LY_DEFINE (ly_moment_main_numerator, "ly:moment-main-numerator",
1, 0, 0, (SCM mom),
"Extract numerator from main timing.")
m->transpose (delta);
}
else if (prop == ly_symbol2scm ("elements")
- || prop == ly_symbol2scm ("articulations"))
+ || prop == ly_symbol2scm ("articulations"))
transpose_music_list (val, delta);
else if (prop == ly_symbol2scm ("pitch-alist")
&& scm_is_pair (val))
programming_error ("Not a music type");
Stream_event *e = new Stream_event (c->make_event_class (class_name),
- mutable_property_alist_);
+ mutable_property_alist_);
Moment length = get_length ();
if (length.to_bool ())
e->set_property ("length", length.smobbed_copy ());
full_collide = full_collide || (close_half_collide
&& distant_half_collide)
|| ( distant_half_collide // like full_ for wholes and longer
- && (up_ball_type <= 0 || down_ball_type <= 0));
+ && (up_ball_type <= 0 || down_ball_type <= 0));
/* Determine which chord goes on the left, and which goes right.
Up-stem usually goes on the right, but if chords just 'touch' we can put
{
if (Paper_score *ps = system_specs_[i].pscore_)
{
- vector<Grob*> cols = ps->root_system ()->used_columns ();
+ vector<Grob *> cols = ps->root_system ()->used_columns ();
// No indent, "infinite" line width, ragged.
Column_x_positions pos = get_line_configuration (cols, numeric_limits<Real>::max (), 0, true);
if (sky)
first_skyline.merge ((*sky)[UP]);
first_skyline.shift (indent);
- minimum_distance = first_skyline.distance (bottom_skyline_) - bottom_loose_baseline_ ;
+ minimum_distance = first_skyline.distance (bottom_skyline_) - bottom_loose_baseline_;
}
bottom_skyline_ = down_skyline;
elements_.push_back (Element (elts, minimum_offsets, minimum_distance, padding));
form = scm_list_1 (c);
}
if (multiple)
- form = scm_list_3 (ly_symbol2scm ("apply"),
- ly_symbol2scm ("values"),
- form);
+ form = scm_list_3 (ly_symbol2scm ("apply"),
+ ly_symbol2scm ("values"),
+ form);
return scm_cons (form, make_input (ps->start_location_));
}
if (!mmrest_event_)
{
mmrest_event_ = new Stream_event
- (handles_[in].get_context ()->make_event_class
- (ly_symbol2scm ("multi-measure-rest-event")));
+ (handles_[in].get_context ()->make_event_class
+ (ly_symbol2scm ("multi-measure-rest-event")));
mmrest_event_->set_property ("duration", SCM_EOL);
mmrest_event_->unprotect ();
}
if (!unisono_event_)
{
unisono_event_ = new Stream_event
- (out->make_event_class (ly_symbol2scm ("unisono-event")));
+ (out->make_event_class (ly_symbol2scm ("unisono-event")));
unisono_event_->unprotect ();
}
if (!solo_one_event_)
{
solo_one_event_ = new Stream_event
- (first_iter_->get_outlet ()->make_event_class
- (ly_symbol2scm ("solo-one-event")));
+ (first_iter_->get_outlet ()->make_event_class
+ (ly_symbol2scm ("solo-one-event")));
solo_one_event_->unprotect ();
}
if (!solo_two_event_)
{
solo_two_event_ = new Stream_event
- (second_iter_->get_outlet ()->make_event_class
- (ly_symbol2scm ("solo-two-event")));
+ (second_iter_->get_outlet ()->make_event_class
+ (ly_symbol2scm ("solo-two-event")));
solo_two_event_->unprotect ();
}
void
Phrasing_slur_engraver::derived_mark () const
{
- for (vsize i=start_events_.size(); i--;)
+ for (vsize i = start_events_.size (); i--;)
scm_gc_mark (start_events_[i]->self_scm ());
- for (vsize i=stop_events_.size(); i--;)
+ for (vsize i = stop_events_.size (); i--;)
scm_gc_mark (stop_events_[i]->self_scm ());
}
for (vsize j = stop_events_.size (); --j > i;)
{
if (id == robust_scm2string (stop_events_[j]->get_property ("spanner-id"), ""))
- stop_events_.erase (stop_events_.begin() + j);
+ stop_events_.erase (stop_events_.begin () + j);
}
}
else
Stream_event *c = unsmob_stream_event (slurs_[j]->get_property ("cause"));
- if (!c) {
- slurs_[j]->programming_error ("phrasing slur without a cause");
- continue;
- }
+ if (!c)
+ {
+ slurs_[j]->programming_error ("phrasing slur without a cause");
+ continue;
+ }
Direction slur_dir = to_dir (c->get_property ("direction"));
}
LY_DEFINE (ly_pitch_tones, "ly:pitch-tones",
- 1, 0, 0, (SCM pp),
+ 1, 0, 0, (SCM pp),
"Calculate the number of tones of@tie{}@var{pp} from"
" middle@tie{}C as a rational number.")
{
return ly_rational2scm (unsmob_pitch (pp)->tone_pitch ());
}
-
LY_DEFINE (ly_pitch_quartertones, "ly:pitch-quartertones",
1, 0, 0, (SCM pp),
"Calculate the number of quarter tones of@tie{}@var{pp} from"
for (vsize k = 0;
k < need_pure_heights_from_neighbors[pos[j]].size ();
k++)
- if (!in_same_column(need_pure_heights_from_neighbors[pos[j]][k],
- pure_relevants_[i]))
+ if (!in_same_column (need_pure_heights_from_neighbors[pos[j]][k],
+ pure_relevants_[i]))
Pointer_group_interface::add_grob
- (need_pure_heights_from_neighbors[pos[j]][k],
- ly_symbol2scm ("neighbors"),
- pure_relevants_[i]);
+ (need_pure_heights_from_neighbors[pos[j]][k],
+ ly_symbol2scm ("neighbors"),
+ pure_relevants_[i]);
}
need_pure_heights_from_neighbors_.clear ();
s = robust_scm2string (get_property ("doubleRepeatSegnoType"), ":|S|:");
else // { segno, start }
s = robust_scm2string (get_property ("startRepeatSegnoType"), ".S|:");
- else
- if (end) // { segno, end }
- s = robust_scm2string (get_property ("endRepeatSegnoType"), ":|S");
- else // { segno }
- s = robust_scm2string (get_property ("segnoType"), "S");
- else
- if (start)
- if (end) // { start, end }
- s = robust_scm2string (get_property ("doubleRepeatType"), ":|:");
- else // { start }
- s = robust_scm2string (get_property ("startRepeatType"), "|:");
- else
- if (end) // { end }
- s = robust_scm2string (get_property ("endRepeatType"), ":|");
+ else if (end) // { segno, end }
+ s = robust_scm2string (get_property ("endRepeatSegnoType"), ":|S");
+ else // { segno }
+ s = robust_scm2string (get_property ("segnoType"), "S");
+ else if (start)
+ if (end) // { start, end }
+ s = robust_scm2string (get_property ("doubleRepeatType"), ":|:");
+ else // { start }
+ s = robust_scm2string (get_property ("startRepeatType"), "|:");
+ else if (end) // { end }
+ s = robust_scm2string (get_property ("endRepeatType"), ":|");
/*
TODO: line breaks might be allowed if we set whichBar to "".
for (LEFT_and_RIGHT (d))
vector_sort (ordered_rests[d], rest_shift_less);
-
for (LEFT_and_RIGHT (d))
{
if (ordered_rests[d].size () < 1)
SCM unlistened = SCM_EOL;
for (; scm_is_pair (arts); arts = scm_cdr (arts))
{
- SCM art = scm_car (arts);
+ SCM art = scm_car (arts);
if (c->event_source ()->is_listened_class
- (unsmob_stream_event (art)->get_property ("class")))
+ (unsmob_stream_event (art)->get_property ("class")))
listened = scm_cons (art, listened);
else
unlistened = scm_cons (art, unlistened);
void
Slur_engraver::derived_mark () const
{
- for (vsize i=start_events_.size(); i--;)
+ for (vsize i = start_events_.size (); i--;)
scm_gc_mark (start_events_[i]->self_scm ());
- for (vsize i=stop_events_.size(); i--;)
+ for (vsize i = stop_events_.size (); i--;)
scm_gc_mark (stop_events_[i]->self_scm ());
}
for (vsize j = stop_events_.size (); --j > i;)
{
if (id == robust_scm2string (stop_events_[j]->get_property ("spanner-id"), ""))
- stop_events_.erase (stop_events_.begin() + j);
+ stop_events_.erase (stop_events_.begin () + j);
}
}
else
Stream_event *c = unsmob_stream_event (slurs_[j]->get_property ("cause"));
- if (!c) {
- slurs_[j]->programming_error ("slur without a cause");
- continue;
- }
+ if (!c)
+ {
+ slurs_[j]->programming_error ("slur without a cause");
+ continue;
+ }
Direction slur_dir = to_dir (c->get_property ("direction"));
for (LEFT_and_RIGHT (d))
if (spanned_drul_[d])
scm_gc_mark (spanned_drul_[d]->self_scm ());
- ;
+ ;
for (vsize i = broken_intos_.size (); i--;)
scm_gc_mark (broken_intos_[i]->self_scm ());
void
Staff_symbol_engraver::derived_mark () const
{
- for (LEFT_and_RIGHT (d)) {
- if (span_events_[d])
- scm_gc_mark (span_events_[d]->self_scm ());
- }
+ for (LEFT_and_RIGHT (d))
+ {
+ if (span_events_[d])
+ scm_gc_mark (span_events_[d]->self_scm ());
+ }
}
Staff_symbol_engraver::~Staff_symbol_engraver ()
size.
*/
- Interval staff_span =
- Staff_symbol_referencer::staff_span (details_.staff_symbol_referencer_);
+ Interval staff_span
+ = Staff_symbol_referencer::staff_span (details_.staff_symbol_referencer_);
staff_span.widen (-1);
- bool const within_staff = staff_span.contains(pos);
+ bool const within_staff = staff_span.contains (pos);
if (head_positions_slice (columns[LEFT]).contains (pos)
|| head_positions_slice (columns[RIGHT]).contains (pos)
|| within_staff)
Real top_y = tip_y + conf->dir_ * height;
Real top_pos = 2 * top_y / details_.staff_space_;
Real round_top_pos = rint (top_pos);
- Interval staff_span =
- Staff_symbol_referencer::staff_span (details_.staff_symbol_referencer_);
+ Interval staff_span
+ = Staff_symbol_referencer::staff_span (details_.staff_symbol_referencer_);
if (Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_,
int (round_top_pos))
&& staff_span[UP] * 0.5 > top_y)
Real pos = linepos.front ();
Real dist = fabs (pos - mid);
for (std::vector<Real>::const_iterator
- i = linepos.begin (), e = linepos.end ();
+ i = linepos.begin (), e = linepos.end ();
++i != e;)
{
double const d = fabs (*i - mid);
}
m.translate_axis
- (pos * Staff_symbol_referencer::staff_space (me) / 2, Y_AXIS);
+ (pos * Staff_symbol_referencer::staff_space (me) / 2, Y_AXIS);
}
}
for (SCM s = ev->get_property ("tweaks");
scm_is_pair (s); s = scm_cdr (s))
{
- if (scm_is_pair (scm_caar (s))) {
- if (SCM_UNBNDP (grobname))
- grobname = scm_from_locale_symbol (info.grob ()->name ().c_str ());
- if (scm_is_eq (scm_caaar (s), grobname))
- info.grob ()->set_property (scm_cdaar (s), scm_cdar (s));
- } else if (direct)
- info.grob ()->set_property (scm_caar (s), scm_cdar (s));
+ if (scm_is_pair (scm_caar (s)))
+ {
+ if (SCM_UNBNDP (grobname))
+ grobname = scm_from_locale_symbol (info.grob ()->name ().c_str ());
+ if (scm_is_eq (scm_caaar (s), grobname))
+ info.grob ()->set_property (scm_cdaar (s), scm_cdar (s));
+ }
+ else if (direct)
+ info.grob ()->set_property (scm_caar (s), scm_cdar (s));
}
}
}