extern int loglevel;
extern bool warning_as_error;
-
/* output messages, in decreasing order of importance */
void error (string s, string location = ""); // Fatal error, exits lilypond!
void programming_error (string s, string location = "");
void expect_warning (string msg);
void check_expected_warnings ();
-
#endif /* WARN_HH */
char const *extensions[] = {"ly", "", 0};
string file = "init";
char cwd[PATH_MAX];
- if (!getcwd (cwd, PATH_MAX)) {
- cerr << "Could not get current work directory\n";
- exit (1);
- }
+ if (!getcwd (cwd, PATH_MAX))
+ {
+ cerr << "Could not get current work directory\n";
+ exit (1);
+ }
string ly_dir = string (getenv ("top-src-dir")) + "/ly";
parse_path (string (1, PATHSEP) + ly_dir);
string file_name = find (file, extensions);
set_loglevel (l);
else
{
- non_fatal_error (_f ("unknown log level `%s', using default (INFO)",
+ non_fatal_error (_f ("unknown log level `%s', using default (INFO)",
level));
set_loglevel (LOGLEVEL_INFO);
}
void check_expected_warnings ()
{
- if (expected_warnings.size () > 0)
+ if (expected_warnings.size () > 0)
{
/* Some expected warning was not triggered, so print out a warning. */
- string msg = _f ("%d expected warning(s) not encountered: ",
+ string msg = _f ("%d expected warning(s) not encountered: ",
expected_warnings.size ());
- for (vsize i = 0; i< expected_warnings.size (); i++)
- msg += "\n " + expected_warnings[i];
-
+ for (vsize i = 0; i < expected_warnings.size (); i++)
+ msg += "\n " + expected_warnings[i];
+
warning (msg);
}
expected_warnings.clear ();
bool is_expected (string s)
{
bool expected = false;
- for (vsize i = 0; i< expected_warnings.size (); i++)
+ for (vsize i = 0; i < expected_warnings.size (); i++)
{
// Compare the msg with the suppressed string; If the beginning matches,
// i.e. the msg can have additional content AFTER the full (exact)
// suppressed message, suppress the warning.
// This is needed for the Input class, where the message contains
// the input file contents after the real message.
- if (s.compare (0, expected_warnings[i].size (), expected_warnings[i]) == 0 ) {
- expected = true;
- expected_warnings.erase (expected_warnings.begin () + i);
- break;
- }
+ if (s.compare (0, expected_warnings[i].size (), expected_warnings[i]) == 0)
+ {
+ expected = true;
+ expected_warnings.erase (expected_warnings.begin () + i);
+ break;
+ }
}
return expected;
}
-
/**
* Helper functions: print_message_part (no newline prepended)
* print_message (always starts on a new line)
message_newline = s[s.length () - 1] == '\n';
}
-
/** The actual output functions to be called in lilypond code.
* Sorted in descending order of importance (errors, warnings, progress, info,
* debug). Each prints a message on a separate line.
print_message (LOG_DEBUG, location, _f ("suppressed programming error: %s", s) + "\n");
else if (warning_as_error)
error (s, location);
- else
+ else
{
print_message (LOG_ERROR, location, _f ("programming error: %s", s) + "\n");
print_message (LOG_ERROR, location, _ ("continuing, cross fingers") + "\n");
print_message (LOG_DEBUG, location, _f ("suppressed warning: %s", s) + "\n");
else if (warning_as_error)
error (s, location);
- else
+ else
print_message (LOG_WARN, location, _f ("warning: %s", s) + "\n");
}
Interval
Axis_group_interface::relative_maybe_bound_group_extent (vector<Grob *> const &elts,
- Grob *common, Axis a, bool bound)
+ Grob *common, Axis a, bool bound)
{
Interval r;
for (vsize i = 0; i < elts.size (); i++)
SCM staff_color = staff->get_property ("color");
Real radius = Staff_symbol_referencer::staff_radius (me);
if (bar_line_color == staff_color && radius)
- result *= (1 - 0.5 * (Staff_symbol_referencer::line_thickness (me) / radius));
+ result *= (1 - 0.5 * (Staff_symbol_referencer::line_thickness (me) / radius));
}
return ly_interval2scm (result);
}
}
// guh.
text_->set_property
- ("text",
- scm_string_concatenate (scm_list_2 (scm_number_to_string (bn, scm_from_int (10)),
- ly_string2scm (text_tag))));
+ ("text",
+ scm_string_concatenate (scm_list_2 (scm_number_to_string (bn, scm_from_int (10)),
+ ly_string2scm (text_tag))));
}
}
}
Real my_y = beams[i]->relative_coordinate (common[Y_AXIS], Y_AXIS);
- Interval beam_width (-1.0,-1.0);
+ Interval beam_width (-1.0, -1.0);
for (vsize j = 0; j < stems.size (); j++)
{
Grob *s = stems[j];
staff_radius_ = Staff_symbol_referencer::staff_radius (beams[i]);
edge_beam_counts_ = Drul_array<int>
- (Stem::beam_multiplicity (stems[0]).length () + 1,
- Stem::beam_multiplicity (stems.back ()).length () + 1);
+ (Stem::beam_multiplicity (stems[0]).length () + 1,
+ Stem::beam_multiplicity (stems.back ()).length () + 1);
// TODO - why are we dividing by staff_space_?
beam_translation_ = Beam::get_beam_translation (beams[i]) / staff_space_;
close_positions.push_back ((int) rint (head_positions_[i][beam_dir]));
far_positions.push_back ((int) rint (head_positions_[i][-beam_dir]));
- }
+ }
Real concaveness = 0.0;
beam_y.distance (collision_y[UP]));
Real scale_free
- = max (parameters_.COLLISION_PADDING - dist, 0.0) /
- parameters_.COLLISION_PADDING;
+ = max (parameters_.COLLISION_PADDING - dist, 0.0)
+ / parameters_.COLLISION_PADDING;
demerits
+= collisions_[i].base_penalty_ *
pow (scale_free, 3) * parameters_.COLLISION_PENALTY;
Grob *fvs = first_normal_stem (me);
Grob *lvs = last_normal_stem (me);
- Interval x_span = robust_scm2interval (me->get_property ("X-positions"), Interval (0,0));
+ Interval x_span = robust_scm2interval (me->get_property ("X-positions"), Interval (0, 0));
Direction feather_dir = to_dir (me->get_property ("grow-direction"));
for (vsize i = 0; i < stems.size (); i++)
Grob *left;
Grob *right;
- if (idx == (vsize)-1 || my_stems.size () == 1)
+ if (idx == (vsize) - 1 || my_stems.size () == 1)
return scm_from_double (amount);
else if (idx == 0)
left = right = my_stems[1];
return scm_from_double (amount);
}
-
bool
Beam::is_knee (Grob *me)
{
#include "warn.hh"
#include "libc-extension.hh"
-Real binomial_coefficient_3[] =
+Real binomial_coefficient_3[]
+=
{
1, 3, 3, 1
};
breaks_ = pscore_->get_break_indices ();
all_ = pscore_->root_system ()->used_columns ();
lines_.resize (breaks_.size (), breaks_.size (), Line_details ());
- vector<Simple_spacer> spacers =
- pscore_->root_system ()->get_simple_spacers(other_lines.length (),
- other_lines.length () - first_line.length (),
- ragged_right_);
+ vector<Simple_spacer> spacers
+ = pscore_->root_system ()->get_simple_spacers (other_lines.length (),
+ other_lines.length () - first_line.length (),
+ ragged_right_);
for (vsize i = 0; i + 1 < breaks_.size (); i++)
{
for (vsize j = i + 1; j < breaks_.size (); j++)
bool ok = true;
bool pc = is_unpure_pure_container (new_value);
SCM vals[] = {pc ? unpure_pure_container_unpure_part (new_value) : new_value,
- pc ? unpure_pure_container_pure_part (new_value) : SCM_BOOL_F};
+ pc ? unpure_pure_container_pure_part (new_value) : SCM_BOOL_F
+ };
for (int i = 0; i < 2; i++)
if (!ly_is_procedure (vals[i])
&& !is_simple_closure (vals[i]))
ok = ok && type_check_assignment (symbol, vals[i],
- ly_symbol2scm ("backend-type?"));
+ ly_symbol2scm ("backend-type?"));
/*
tack onto alist. We can use set_car, since
#if 0
/* TODO: Uncomment. */
- if (!sent)
- warning (_f ("Junking event: %s", ly_symbol2string (class_symbol).c_str ()));
+ if (!sent)
+ warning (_f ("Junking event: %s", ly_symbol2string (class_symbol).c_str ()));
#endif
}
DECLARE_GROB_INTERFACE ();
};
-
-
MAKE_SCHEME_CALLBACK (Flag, width, 1);
SCM
Flag::width (SCM smob)
return scm_from_locale_stringn (contents.c_str (), contents.length ());
}
-
LY_DEFINE (ly_dir_p, "ly:dir?",
1, 0, 0, (SCM s),
"Is @var{s} a direction? Valid directions are @w{@code{-1}},"
continue;
int n1 = robust_scm2int (scm_car (candidate), -1);
int n2 = robust_scm2int (scm_cdr (candidate), -1);
- if ((n1 < 0) || (n2 < 0) || (size_t(n1) >= note_heads.size ()))
+ if ((n1 < 0) || (n2 < 0) || (size_t (n1) >= note_heads.size ()))
continue;
note_column_1.push_back (vsize (n1));
note_column_2.push_back (vsize (n2));
VERTICAL ORDERING
****************************************************************/
-Grob*
+Grob *
get_maybe_root_vertical_alignment (Grob *g, Grob *maybe)
{
if (!g)
}
-Grob*
+Grob *
Grob::get_root_vertical_alignment (Grob *g)
{
return get_maybe_root_vertical_alignment (g, 0);
}
-Grob*
+Grob *
Grob::get_vertical_axis_group (Grob *g)
{
if (!g)
int normal_stem_count_;
Real x_span_;
-
/*
Do stem computations. These depend on YL and YR linearly, so we can
precompute for every stem 2 factors.
static bool is_non_musical (Grob *);
static bool break_visible (Grob *);
- static Item * maybe_find_prebroken_piece (Item *g, Direction d);
+ static Item *maybe_find_prebroken_piece (Item *g, Direction d);
bool is_broken () const;
virtual bool pure_is_visible (int start, int end) const;
int nchars;
Input start_location_;
bool safe_;
- SCM (*func_)(Parse_start *ps);
+ SCM (*func_) (Parse_start *ps);
SCM form_;
Lily_parser *parser_;
Interval accidental_size = g->extent (common[X_AXIS], X_AXIS);
Real d
= linear_combination (Drul_array<Real> (accidental_size[RIGHT],
- head_size[LEFT]),
- 0.0);
+ head_size[LEFT]),
+ 0.0);
Real left_shorten = max (-ledger_size[LEFT] + d, 0.0);
LY_DEFINE (ly_parser_clone, "ly:parser-clone",
1, 1, 0, (SCM parser_smob, SCM closures),
"Return a clone of @var{parser-smob}. An association list"
-" of port positions to closures can be specified in @var{closures}"
-" in order to have @code{$} and @code{#} interpreted in their original"
-" lexical environment.")
+ " of port positions to closures can be specified in @var{closures}"
+ " in order to have @code{$} and @code{#} interpreted in their original"
+ " lexical environment.")
{
LY_ASSERT_SMOB (Lily_parser, parser_smob, 1);
Lily_parser *parser = unsmob_lily_parser (parser_smob);
LY_DEFINE (ly_parse_string_expression, "ly:parse-string-expression",
2, 2, 0, (SCM parser_smob, SCM ly_code, SCM filename,
- SCM line),
+ SCM line),
"Parse the string @var{ly-code} with @var{parser-smob}."
-" Return the contained music expression."
-" @var{filename} and @var{line} are optional source indicators.")
+ " Return the contained music expression."
+ " @var{filename} and @var{line} are optional source indicators.")
{
LY_ASSERT_SMOB (Lily_parser, parser_smob, 1);
Lily_parser *parser = unsmob_lily_parser (parser_smob);
if (!parser->lexer_->is_clean ())
{
parser->parser_error (_ ("ly:parse-string-expression is only valid with a new parser."
- " Use ly:parser-include-string instead."));
+ " Use ly:parser-include-string instead."));
return SCM_UNSPECIFIED;
}
return parser->parse_string_expression (ly_scm2string (ly_code),
- fn, ln);
+ fn, ln);
}
LY_DEFINE (ly_parser_include_string, "ly:parser-include-string",
2, 0, 0, (SCM parser_smob, SCM ly_code),
"Include the string @var{ly-code} into the input stream"
" for @var{parser-smob}. Can only be used in immediate"
- " Scheme expressions (@code{$} instead of @code{#}).")
+ " Scheme expressions (@code{$} instead of @code{#}).")
{
LY_ASSERT_SMOB (Lily_parser, parser_smob, 1);
Lily_parser *parser = unsmob_lily_parser (parser_smob);
SCM
Lily_parser::parse_string_expression (string ly_code, string filename,
- int line)
+ int line)
{
// TODO: use $parser
lexer_->set_identifier (ly_symbol2scm ("parser"),
lexer_->main_input_name_ = filename;
lexer_->is_main_input_ = true;
lexer_->new_input (lexer_->main_input_name_, ly_code, sources_);
- if (line) {
- lexer_->get_source_file ()->set_line (0, line);
- }
+ if (line)
+ {
+ lexer_->get_source_file ()->set_line (0, line);
+ }
SCM mod = lexer_->set_current_scope ();
lexer_->push_extra_token (EMBEDDED_LILY);
do_yyparse ();
SCM result = lexer_->lookup_identifier_symbol (ly_symbol2scm ("parseStringResult"));
// parseStringResult is set in the grammar rule for embedded_lilypond
-
+
scm_set_current_module (mod);
error_level_ = error_level_ | lexer_->error_level_;
case MLP_BREVIS:
duration_log--;
suffix = to_string (duration_log) + color
- + (duration_log < -1 ? "lig" : "") + "mensural";
+ + (duration_log < -1 ? "lig" : "") + "mensural";
index = prefix + "s";
out = fm->find_by_name (index + "r" + suffix);
if (!out.is_empty ()
&& !Staff_symbol_referencer::on_line
- (me,
- robust_scm2int (me->get_property ("staff-position"), 0)))
+ (me,
+ robust_scm2int (me->get_property ("staff-position"), 0)))
index += "r";
out = fm->find_by_name (index + suffix);
break;
SCM duration_logs_list = me->get_property ("usable-duration-logs");
if (to_boolean (scm_null_p (duration_logs_list))
- || !to_boolean (scm_list_p (duration_logs_list)))
+ || !to_boolean (scm_list_p (duration_logs_list)))
{
warning (_ ("usable-duration-logs must be a non-empty list. Falling back to whole rests."));
closest_usable_duration_log = 0;
calc_measure_duration_log (Grob *me)
{
SCM sml = dynamic_cast<Spanner *> (me)->get_bound (LEFT)
- ->get_property ("measure-length");
+ ->get_property ("measure-length");
Rational ml = (unsmob_moment (sml)) ? unsmob_moment (sml)->main_part_
- : Rational (1);
+ : Rational (1);
double measure_duration = ml.Rational::to_double ();
- bool force_round_up = to_boolean (
- scm_list_p (
- scm_member (
- scm_cons (scm_from_int64 (ml.numerator ()),
- scm_from_int64 (ml.denominator ())),
- me->get_property ("round-up-exceptions"))));
+ bool force_round_up = to_boolean (scm_list_p (scm_member (scm_cons (scm_from_int64 (ml.numerator ()),
+ scm_from_int64 (ml.denominator ())),
+ me->get_property ("round-up-exceptions"))));
return calc_closest_duration_log (me, measure_duration, force_round_up);
}
{
LY_ASSERT_TYPE (ly_is_list, signature, 1);
LY_ASSERT_TYPE (ly_is_procedure, func, 2);
- int n=0;
+ int n = 0;
for (SCM p = signature; scm_is_pair (p); p = scm_cdr (p), ++n)
{
SCM proc = scm_car (p);
if (scm_is_pair (proc))
- proc = scm_car (proc);
+ proc = scm_car (proc);
if (scm_is_false (scm_procedure_p (proc)))
- {
- scm_wrong_type_arg_msg ("music-function", n, p,
- "music function predicate");
- }
+ {
+ scm_wrong_type_arg_msg ("music-function", n, p,
+ "music function predicate");
+ }
}
return make_music_function (signature, func);
}
LY_DEFINE (ly_make_music_relative_x, "ly:make-music-relative!",
- 2, 0, 0, (SCM music, SCM pitch),
- "Make @var{music} relative to @var{pitch},"
- " return final pitch.")
+ 2, 0, 0, (SCM music, SCM pitch),
+ "Make @var{music} relative to @var{pitch},"
+ " return final pitch.")
{
LY_ASSERT_TYPE (unsmob_music, music, 1);
LY_ASSERT_TYPE (unsmob_pitch, pitch, 2);
- Pitch start = *unsmob_pitch (pitch);
- Music *m = unsmob_music (music);
- Pitch last = m->to_relative_octave (start);
- if (lily_1_8_relative)
- m->set_property ("last-pitch", last.smobbed_copy ());
+ Pitch start = *unsmob_pitch (pitch);
+ Music *m = unsmob_music (music);
+ Pitch last = m->to_relative_octave (start);
+ if (lily_1_8_relative)
+ m->set_property ("last-pitch", last.smobbed_copy ());
- return last.smobbed_copy ();
+ return last.smobbed_copy ();
}
-
LY_DEFINE (ly_music_duration_length, "ly:music-duration-length", 1, 0, 0,
(SCM mus),
"Extract the duration field from @var{mus} and return the"
#include "page-layout-problem.hh"
LY_DEFINE (ly_get_spacing_spec, "ly:get-spacing-spec", 2, 0, 0,
- (SCM from_scm, SCM to_scm),
- "Return the spacing spec going between the two given grobs,"
+ (SCM from_scm, SCM to_scm),
+ "Return the spacing spec going between the two given grobs,"
" @var{from_scm} and @var{to_scm}.")
{
LY_ASSERT_SMOB (Grob, from_scm, 1);
if (orig->is_broken ())
for (vsize i = 0; i < orig->broken_intos_.size (); i++)
do_numbering = do_numbering
- || to_boolean (orig->broken_intos_[i]->get_property ("automatically-numbered"));
+ || to_boolean (orig->broken_intos_[i]->get_property ("automatically-numbered"));
}
if (do_numbering)
{
Skyline *sky = in_note_direction_ == UP ? &up_skyline : &down_skyline;
sky->set_minimum_height (sky->max_height ()
+ in_note_direction_
- * (in_note_padding_
- + in_note_stencil->extent (Y_AXIS).length ()));
+ * (in_note_padding_
+ + in_note_stencil->extent (Y_AXIS).length ()));
}
/*
*/
Real minimum_distance = up_skyline.distance (bottom_skyline_,
robust_scm2double (sys->get_property ("skyline-horizontal-padding"),
- 0))
+ 0))
+ padding;
Spring spring_copy = spring;
SCM to = scm_ftell (port);
ps->nchars = scm_to_int (to) - scm_to_int (from);
-
- if (!SCM_EOF_OBJECT_P (form)) {
- if (ps->parser_->lexer_->top_input ())
- {
- // Find any precompiled form.
- SCM c = scm_assv_ref (ps->parser_->closures_, from);
- if (scm_is_true (c))
- // Replace form with a call to previously compiled closure
- form = scm_list_1 (c);
- }
- return scm_cons (form, make_input (ps->start_location_));
-}
+ if (!SCM_EOF_OBJECT_P (form))
+ {
+ if (ps->parser_->lexer_->top_input ())
+ {
+ // Find any precompiled form.
+ SCM c = scm_assv_ref (ps->parser_->closures_, from);
+ if (scm_is_true (c))
+ // Replace form with a call to previously compiled closure
+ form = scm_list_1 (c);
+ }
+ return scm_cons (form, make_input (ps->start_location_));
+ }
/* Don't close the port here; if we re-enter this function via a
continuation, then the next time we enter it, we'll get an error.
{
static SCM module = SCM_BOOL_F;
if (module == SCM_BOOL_F)
- {
- SCM function = ly_lily_module_constant ("make-safe-lilypond-module");
- module = scm_gc_protect_object (scm_call_0 (function));
- }
-
+ {
+ SCM function = ly_lily_module_constant ("make-safe-lilypond-module");
+ module = scm_gc_protect_object (scm_call_0 (function));
+ }
+
// We define the parser so trusted Scheme functions can
// access the real namespace underlying the parser.
if (ps->parser_)
- scm_module_define (module, ly_symbol2scm ("parser"),
- ps->parser_->self_scm ());
+ scm_module_define (module, ly_symbol2scm ("parser"),
+ ps->parser_->self_scm ());
return scm_eval (ps->form_, module);
}
return scm_primitive_eval (ps->form_);
}
-
SCM
catch_protected_parse_body (void *p)
{
if (second_iter_)
scm_gc_mark (second_iter_->self_scm ());
- Stream_event *ptrs[] =
+ Stream_event *ptrs[]
+ =
{
unisono_event_,
mmrest_event_,
if (scm_is_number (direction_))
execute_pushpop_property (shared, sym,
- ly_symbol2scm ("direction"), direction_);
+ ly_symbol2scm ("direction"), direction_);
}
/* Handle horizontal shifts for crossing notes */
execute_pushpop_property (one, ly_symbol2scm ("NoteColumn"),
* though), we have to prepend it manually. */
if (g_without_BOM) // conversion to UTF-16be might have failed (shouldn't!)
{
- g = (char*)malloc ( sizeof(char) * (bytes_written + 3));
+ g = (char *)malloc ( sizeof (char) * (bytes_written + 3));
char const *BOM = "\xFE\xFF";
strcpy (g, BOM);
memcpy (&g[2], g_without_BOM, bytes_written + 1); // Copy string + \0
int
Pitch::rounded_semitone_pitch () const
{
- return int (floor (double (tone_pitch () * Rational (2) + Rational (1,2))));
+ return int (floor (double (tone_pitch () * Rational (2) + Rational (1, 2))));
}
int
Pitch::rounded_quartertone_pitch () const
{
- return int (floor (double (tone_pitch () * Rational (4) + Rational (1,2))));
+ return int (floor (double (tone_pitch () * Rational (4) + Rational (1, 2))));
}
void
to the elements of need_pure_heights_from_neighbors_ on either side.
*/
- int pos[2] = {-1, 0};
+ int pos[2] = { -1, 0};
for (vsize i = 0; i < pure_relevants_.size (); i++)
{
if (pos[1] < (int) need_pure_heights_from_neighbors.size ()
{
Grob *me = unsmob_grob (smob);
extract_grob_set ((me->original () && me->original ()->is_live ()
- ? me->original ()
- : me),
- "neighbors",
- elts);
+ ? me->original ()
+ : me),
+ "neighbors",
+ elts);
vector<Grob *> new_elts;
new_elts.insert (new_elts.end (), elts.begin (), elts.end ());
SCM neighbors_scm = me->get_object ("neighbors");
if (Grob_array::unsmob (neighbors_scm))
- {
- vector<Grob *> &arr
- = unsmob_grob_array (neighbors_scm)->array_reference ();
- arr = new_elts;
- }
+ {
+ vector<Grob *> &arr
+ = unsmob_grob_array (neighbors_scm)->array_reference ();
+ arr = new_elts;
+ }
return Axis_group_interface::internal_calc_pure_relevant_grobs (me, "neighbors");
}
if (!position_override)
amount += 2 * ss * get_grob_direction (me);
-
return scm_from_double (amount);
}
scm_gc_mark ((SCM)target);
}
-Listener_function_table listen_closure =
+Listener_function_table listen_closure
+=
{
call_listen_closure, mark_listen_closure
};
&& total_off * dir < minimum_space)
total_off = minimum_space * dir;
-
if (current_offset)
total_off = dir * max (dir * total_off,
dir * (*current_offset));
dist = max (dist, max (start_dist, end_dist));
if (end_dist == dist)
- touch = end;
+ touch = end;
else if (start_dist == dist)
- touch = start;
+ touch = start;
if (i->end_ <= j->end_)
i++;
= get_detail (details, ly_symbol2scm ("close-to-edge-length"));
encompass_object_range_overshoot_
= get_detail (details, ly_symbol2scm ("encompass-object-range-overshoot"));
- }
+}
extra_encompass_infos_ = get_extra_encompass_infos ();
- Interval additional_ys (0.0,0.0);
+ Interval additional_ys (0.0, 0.0);
for (vsize i = 0; i < extra_encompass_infos_.size (); i++)
{
(dir_
* (parameters_.encompass_object_range_overshoot_
+ (y_place - encompass_place)
- * (normalize (extra_encompass_infos_[i].extents_[X_AXIS].center (),
- base_attachments_[RIGHT][X_AXIS],
- base_attachments_[LEFT][X_AXIS])
- + (dir_ == LEFT ? 0 : -1)))));
+ * (normalize (extra_encompass_infos_[i].extents_[X_AXIS].center (),
+ base_attachments_[RIGHT][X_AXIS],
+ base_attachments_[LEFT][X_AXIS])
+ + (dir_ == LEFT ? 0 : -1)))));
while (flip (&d) != LEFT);
}
}
{
int current_line = get_line (pos_str0);
line_offset_ += line - current_line;
-
+
assert (line == get_line (pos_str0));
}
else
Real sum_spacing = 0;
// currently a magic number - what would be a good grob to hold this property?
Real left_padding = 0.15;
- for (vsize j = 0; j < clique_spacing.size (); j++)
+ for (vsize j = 0; j < clique_spacing.size (); j++)
{
sum_tight_spacing += clique_tight_spacing[j];
sum_spacing += clique_spacing[j];
Spanner::spanner_length () const
{
Interval lr = robust_scm2interval (get_property ("X-positions"),
- Interval (1,-1));
+ Interval (1, -1));
if (lr.is_empty ())
{
Direction d = LEFT;
do
lr[d] = robust_scm2double (ly_assoc_get (ly_symbol2scm ("X"),
- bounds[d], SCM_BOOL_F), -d);
+ bounds[d], SCM_BOOL_F), -d);
while (flip (&d) != LEFT);
}
Interval height = me->pure_height (me, 0, INT_MAX);
Real staff_space = Staff_symbol_referencer::staff_space (me);
- Real half_space = staff_space * 0.5;
+ Real half_space = staff_space * 0.5;
height[d] = se * half_space + beam_end_corrective (me);
height[-d] = (height[d] - d
* (0.5 * beam_thickness
- + beam_translation * max (0, (beam_count - 1))
- + stemlet_length));
+ + beam_translation * max (0, (beam_count - 1))
+ + stemlet_length));
}
else if (!stemlet && beam)
height[-d] = height[d];
if (scm_is_pair (s))
length = 2 * scm_to_double (robust_list_ref (durlog - 2, s));
-
/* Stems in unnatural (forced) direction should be shortened,
according to [Roush & Gourlay] */
Interval hp = head_positions (me);
return ly_interval2scm (internal_height (me, true));
}
-Grob*
+Grob *
Stem::get_reference_head (Grob *me)
{
return to_boolean (me->get_property ("avoid-note-head"))
0.0);
Real y2 = dir * robust_scm2double ((calc_beam
- ? me->get_property ("length")
- : me->get_pure_property ("length", 0, INT_MAX)),
- 0.0)
- + y1;
+ ? me->get_property ("length")
+ : me->get_pure_property ("length", 0, INT_MAX)),
+ 0.0)
+ + y1;
Real half_space = Staff_symbol_referencer::staff_space (me) * 0.5;
- Interval stem_y = Interval (min (y1, y2), max (y2, y1)) * half_space;
+ Interval stem_y = Interval (min (y1, y2), max (y2, y1)) * half_space;
return stem_y;
}
Real half_space = Staff_symbol_referencer::staff_space (me) * 0.5;
- Interval stem_y = Interval (min (y1, y2), max (y2, y1)) * half_space;
+ Interval stem_y = Interval (min (y1, y2), max (y2, y1)) * half_space;
stem_y[dir] -= beam_end_corrective (me);
/* If not centered: correct for stem thickness. */
string style = robust_symbol2string (f->get_property ("style"), "default");
if (attach && style != "mensural"
- && style != "neomensural"
- && style != "petrucci")
+ && style != "neomensural"
+ && style != "petrucci")
{
Real rule_thick = thickness (me);
r += -d * rule_thick * 0.5;
return scm_from_bool (is_cross_staff (unsmob_grob (smob)));
}
-Grob*
+Grob *
Stem::flag (Grob *me)
{
return unsmob_grob (me->get_object ("flag"));
bool
grob_2D_less (Grob *g1, Grob *g2)
{
- int sri[] = {0,0};
+ int sri[] = {0, 0};
Grob *gs[] = {g1, g2};
for (int i = 0; i < 2; i++)
if (sri[0] == sri[1])
return Grob::vertical_less (gs[0], gs[1]);
- return sri[0] < sri[1];
+ return sri[0] < sri[1];
}
MAKE_SCHEME_CALLBACK (System, footnotes_before_line_breaking, 1);
pl->set_property ("page-break-penalty", right_bound->get_property ("page-break-penalty"));
pl->set_property ("page-turn-penalty", right_bound->get_property ("page-turn-penalty"));
- if (right_bound->original () == dynamic_cast<System*> (original ())->get_bound (RIGHT))
+ if (right_bound->original () == dynamic_cast<System *> (original ())->get_bound (RIGHT))
pl->set_property ("last-in-score", SCM_BOOL_T);
Interval staff_refpoints;
return pure ? get_pure_bound (d, start, end) : get_bound (d);
}
-enum {
+enum
+{
SPACEABLE_STAVES,
NONSPACEABLE_STAVES,
ALL_STAVES
static SCM
get_maybe_spaceable_staves (SCM smob, int filter)
{
- System *me = dynamic_cast<System*> (unsmob_grob (smob));
+ System *me = dynamic_cast<System *> (unsmob_grob (smob));
Grob *align = me->get_vertical_alignment ();
SCM ret = SCM_EOL;
for (vsize i = 0; i < staves.size (); ++i)
{
bool spaceable = Page_layout_problem::is_spaceable (staves[i]);
- if (staves[i]->is_live () &&
- ((filter == ALL_STAVES)
- || (filter == SPACEABLE_STAVES && spaceable)
- || (filter == NONSPACEABLE_STAVES && !spaceable)))
+ if (staves[i]->is_live ()
+ && ((filter == ALL_STAVES)
+ || (filter == SPACEABLE_STAVES && spaceable)
+ || (filter == NONSPACEABLE_STAVES && !spaceable)))
{
*tail = scm_cons (staves[i]->self_scm (), SCM_EOL);
tail = SCM_CDRLOC (*tail);
return get_maybe_spaceable_staves (smob, NONSPACEABLE_STAVES);
}
-
ADD_INTERFACE (System,
"This is the top-level object: Each object in a score"
" ultimately has a @code{System} object as its X and"
Grob *flag = Stem::flag (stem);
if (flag)
{
- Grob* commony = stem->common_refpoint (flag, Y_AXIS);
+ Grob *commony = stem->common_refpoint (flag, Y_AXIS);
boxes.push_back (Box (flag->extent (x_refpoint_, X_AXIS),
flag->extent (commony, Y_AXIS)));
}
Tie_formatting_problem::get_configuration (int pos, Direction dir, Drul_array<int> columns,
bool tune_dy) const
{
- int key_components[] =
+ int key_components[]
+ =
{
pos, dir, columns[LEFT], columns[RIGHT]
};
Grob *number = unsmob_grob (tuplets[i]->get_object ("tuplet-number"));
if (number)
points.push_back (Offset (number->extent (commonx, X_AXIS).center () - x0,
- number->extent (commony, Y_AXIS)[dir]));
+ number->extent (commony, Y_AXIS)[dir]));
}
*offset = -dir * infinity_f;
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
string s = _ (ly_scm2string (str).c_str ());
-
+
/* Now replace all printf placeholders by scheme placeholders (~a).
* Guile's format syntax is pretty similar to C's printf, only with
* a tilde as the placeholder instead of a percent sign.
// In some cases (%%, %s) we need to do a lookahead. As the C string is
// always \0-terminated the next char is never beyond the end of the
// memory!
- switch (*pos) {
+ switch (*pos)
+ {
case '~':
result += "~~";
break;
case '%':
- if (*(pos+1) == '%') {
- result += "%";
- // Skip the second '%'
- pos++;
- } else if (*(pos+1) == 's' || *(pos+1) == 'd') {
- // %s in C++ corresponds to ~a; ~s would add quotes!
- // ~d is only supported by ice-9, use ~a instead
- result += "~a";
- // Skip the following 's'
- pos++;
- } else
+ if (*(pos + 1) == '%')
+ {
+ result += "%";
+ // Skip the second '%'
+ pos++;
+ }
+ else if (*(pos + 1) == 's' || *(pos + 1) == 'd')
+ {
+ // %s in C++ corresponds to ~a; ~s would add quotes!
+ // ~d is only supported by ice-9, use ~a instead
+ result += "~a";
+ // Skip the following 's'
+ pos++;
+ }
+ else
result += "~";
break;
default:
result += *pos;
- }
+ }
pos++;
}
return ly_string2scm (result);