From: Graham Percival Date: Mon, 12 Dec 2011 07:31:51 +0000 (-0800) Subject: Run astyle 2.02. X-Git-Tag: release/2.15.22-1~16 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0c61221b46addec50e2406e04af44a7d460443d4;p=lilypond.git Run astyle 2.02. --- diff --git a/flower/include/warn.hh b/flower/include/warn.hh index 959a556291..37ddbbfdad 100644 --- a/flower/include/warn.hh +++ b/flower/include/warn.hh @@ -43,7 +43,6 @@ 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 = ""); @@ -66,5 +65,4 @@ void set_loglevel (string level); void expect_warning (string msg); void check_expected_warnings (); - #endif /* WARN_HH */ diff --git a/flower/test-file-path.cc b/flower/test-file-path.cc index 37ff3277ec..99366a1f10 100644 --- a/flower/test-file-path.cc +++ b/flower/test-file-path.cc @@ -10,10 +10,11 @@ TEST (File_path, Find) 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); diff --git a/flower/warn.cc b/flower/warn.cc index 8cdfcb6b99..38ee5d2c53 100644 --- a/flower/warn.cc +++ b/flower/warn.cc @@ -86,7 +86,7 @@ set_loglevel (string level) 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); } @@ -106,14 +106,14 @@ void expect_warning (string msg) 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 (); @@ -122,23 +122,23 @@ void check_expected_warnings () 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) @@ -171,7 +171,6 @@ print_message (int level, string location, string s, bool newline) 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. @@ -193,7 +192,7 @@ programming_error (string s, string location) 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"); @@ -220,7 +219,7 @@ warning (string s, string location) 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"); } diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index de9e48a1b4..3f53773e9e 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -81,7 +81,7 @@ Axis_group_interface::relative_group_extent (vector const &elts, Interval Axis_group_interface::relative_maybe_bound_group_extent (vector const &elts, - Grob *common, Axis a, bool bound) + Grob *common, Axis a, bool bound) { Interval r; for (vsize i = 0; i < elts.size (); i++) diff --git a/lily/bar-line.cc b/lily/bar-line.cc index b9e23a95e4..bfd7936393 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -48,7 +48,7 @@ Bar_line::calc_bar_extent (SCM smob) 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); } diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index 83ff7fed51..e6c401f240 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -152,9 +152,9 @@ Bar_number_engraver::process_music () } // 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)))); } } } diff --git a/lily/beam-quanting.cc b/lily/beam-quanting.cc index 774cf1b02b..57cf25853d 100644 --- a/lily/beam-quanting.cc +++ b/lily/beam-quanting.cc @@ -260,7 +260,7 @@ void Beam_scoring_problem::init_instance_variables (Grob *me, Drul_array y 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]; @@ -301,8 +301,8 @@ void Beam_scoring_problem::init_instance_variables (Grob *me, Drul_array y staff_radius_ = Staff_symbol_referencer::staff_radius (beams[i]); edge_beam_counts_ = Drul_array - (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_; @@ -682,7 +682,7 @@ Beam_scoring_problem::calc_concaveness () 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; @@ -1347,8 +1347,8 @@ Beam_scoring_problem::score_collisions (Beam_configuration *config) const 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; diff --git a/lily/beam.cc b/lily/beam.cc index 5b65768a3f..ea92315939 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -1097,7 +1097,7 @@ Beam::set_stem_lengths (SCM smob) 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++) @@ -1348,7 +1348,7 @@ Beam::pure_rest_collision_callback (SCM smob, 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]; @@ -1370,7 +1370,6 @@ Beam::pure_rest_collision_callback (SCM smob, return scm_from_double (amount); } - bool Beam::is_knee (Grob *me) { diff --git a/lily/bezier.cc b/lily/bezier.cc index a68c03907d..f0197fc0e2 100644 --- a/lily/bezier.cc +++ b/lily/bezier.cc @@ -21,7 +21,8 @@ #include "warn.hh" #include "libc-extension.hh" -Real binomial_coefficient_3[] = +Real binomial_coefficient_3[] += { 1, 3, 3, 1 }; diff --git a/lily/constrained-breaking.cc b/lily/constrained-breaking.cc index 7e5bfadd50..0a185bf39d 100644 --- a/lily/constrained-breaking.cc +++ b/lily/constrained-breaking.cc @@ -436,10 +436,10 @@ Constrained_breaking::initialize () breaks_ = pscore_->get_break_indices (); all_ = pscore_->root_system ()->used_columns (); lines_.resize (breaks_.size (), breaks_.size (), Line_details ()); - vector spacers = - pscore_->root_system ()->get_simple_spacers(other_lines.length (), - other_lines.length () - first_line.length (), - ragged_right_); + vector 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++) diff --git a/lily/context-property.cc b/lily/context-property.cc index f4f5f07b5c..d79e74455a 100644 --- a/lily/context-property.cc +++ b/lily/context-property.cc @@ -116,13 +116,14 @@ execute_override_property (Context *context, 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 diff --git a/lily/dispatcher.cc b/lily/dispatcher.cc index 6a11654e23..e1699e6b6d 100644 --- a/lily/dispatcher.cc +++ b/lily/dispatcher.cc @@ -167,8 +167,8 @@ Dispatcher::dispatch (SCM sev) #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 } diff --git a/lily/flag.cc b/lily/flag.cc index ceab63e0e4..e4621c58a1 100644 --- a/lily/flag.cc +++ b/lily/flag.cc @@ -39,8 +39,6 @@ public: DECLARE_GROB_INTERFACE (); }; - - MAKE_SCHEME_CALLBACK (Flag, width, 1); SCM Flag::width (SCM smob) diff --git a/lily/general-scheme.cc b/lily/general-scheme.cc index 605bf06cfd..8a84062bb6 100644 --- a/lily/general-scheme.cc +++ b/lily/general-scheme.cc @@ -99,7 +99,6 @@ LY_DEFINE (ly_gulp_file, "ly:gulp-file", 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}}," diff --git a/lily/glissando-engraver.cc b/lily/glissando-engraver.cc index bb57bf1fcd..c021521eef 100644 --- a/lily/glissando-engraver.cc +++ b/lily/glissando-engraver.cc @@ -124,7 +124,7 @@ Glissando_engraver::acknowledge_note_column (Grob_info info) 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)); diff --git a/lily/grob.cc b/lily/grob.cc index 567bd0015f..d36a672130 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -598,7 +598,7 @@ Grob::fixup_refpoint () VERTICAL ORDERING ****************************************************************/ -Grob* +Grob * get_maybe_root_vertical_alignment (Grob *g, Grob *maybe) { if (!g) @@ -609,13 +609,13 @@ get_maybe_root_vertical_alignment (Grob *g, Grob *maybe) } -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) diff --git a/lily/include/beam-scoring-problem.hh b/lily/include/beam-scoring-problem.hh index d60c50f0a6..0dc3adc511 100644 --- a/lily/include/beam-scoring-problem.hh +++ b/lily/include/beam-scoring-problem.hh @@ -132,7 +132,6 @@ private: 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. diff --git a/lily/include/item.hh b/lily/include/item.hh index 73b3bc7b3f..cb03811622 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -40,7 +40,7 @@ public: 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; diff --git a/lily/include/parse-scm.hh b/lily/include/parse-scm.hh index 31427f2e44..9d20a9675a 100644 --- a/lily/include/parse-scm.hh +++ b/lily/include/parse-scm.hh @@ -32,7 +32,7 @@ struct Parse_start int nchars; Input start_location_; bool safe_; - SCM (*func_)(Parse_start *ps); + SCM (*func_) (Parse_start *ps); SCM form_; Lily_parser *parser_; diff --git a/lily/ledger-line-spanner.cc b/lily/ledger-line-spanner.cc index 0e46e0d5b8..27388dde21 100644 --- a/lily/ledger-line-spanner.cc +++ b/lily/ledger-line-spanner.cc @@ -295,8 +295,8 @@ Ledger_line_spanner::print (SCM smob) Interval accidental_size = g->extent (common[X_AXIS], X_AXIS); Real d = linear_combination (Drul_array (accidental_size[RIGHT], - head_size[LEFT]), - 0.0); + head_size[LEFT]), + 0.0); Real left_shorten = max (-ledger_size[LEFT] + d, 0.0); diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc index 5f5b5a26fa..180d8527b1 100644 --- a/lily/lily-parser-scheme.cc +++ b/lily/lily-parser-scheme.cc @@ -148,9 +148,9 @@ LY_DEFINE (ly_parser_lexer, "ly:parser-lexer", 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); @@ -215,10 +215,10 @@ LY_DEFINE (ly_parser_parse_string, "ly:parser-parse-string", 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); @@ -237,19 +237,19 @@ LY_DEFINE (ly_parse_string_expression, "ly:parse-string-expression", 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); diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 8159c3dae7..97715dfc3a 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -156,7 +156,7 @@ Lily_parser::parse_string (string ly_code) SCM Lily_parser::parse_string_expression (string ly_code, string filename, - int line) + int line) { // TODO: use $parser lexer_->set_identifier (ly_symbol2scm ("parser"), @@ -165,15 +165,16 @@ Lily_parser::parse_string_expression (string ly_code, string filename, 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_; diff --git a/lily/mensural-ligature.cc b/lily/mensural-ligature.cc index 4fcd9be5d3..3802214068 100644 --- a/lily/mensural-ligature.cc +++ b/lily/mensural-ligature.cc @@ -169,13 +169,13 @@ internal_brew_primitive (Grob *me) 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; diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index d6142b1890..40b727fbd2 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -132,7 +132,7 @@ calc_closest_duration_log (Grob *me, double duration, bool force_round_up) 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; @@ -172,16 +172,13 @@ int calc_measure_duration_log (Grob *me) { SCM sml = dynamic_cast (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); } diff --git a/lily/music-function-scheme.cc b/lily/music-function-scheme.cc index e87872caac..93c7e0fbc4 100644 --- a/lily/music-function-scheme.cc +++ b/lily/music-function-scheme.cc @@ -26,17 +26,17 @@ LY_DEFINE (ly_make_music_function, "ly:make-music-function", 2, 0, 0, { 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); diff --git a/lily/music-scheme.cc b/lily/music-scheme.cc index 34545fa911..26e26092b6 100644 --- a/lily/music-scheme.cc +++ b/lily/music-scheme.cc @@ -160,23 +160,22 @@ LY_DEFINE (ly_music_compress, "ly:music-compress", } 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" diff --git a/lily/page-layout-problem-scheme.cc b/lily/page-layout-problem-scheme.cc index e4c62d3d29..9e976fef5d 100644 --- a/lily/page-layout-problem-scheme.cc +++ b/lily/page-layout-problem-scheme.cc @@ -22,8 +22,8 @@ #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); diff --git a/lily/page-layout-problem.cc b/lily/page-layout-problem.cc index f4e2085218..fe0058ed44 100644 --- a/lily/page-layout-problem.cc +++ b/lily/page-layout-problem.cc @@ -243,7 +243,7 @@ Page_layout_problem::add_footnotes_to_lines (SCM lines, int counter, Paper_book 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) { @@ -561,8 +561,8 @@ Page_layout_problem::append_system (System *sys, Spring const &spring, Real inde 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 ())); } /* @@ -573,7 +573,7 @@ Page_layout_problem::append_system (System *sys, Spring const &spring, Real inde */ Real minimum_distance = up_skyline.distance (bottom_skyline_, robust_scm2double (sys->get_property ("skyline-horizontal-padding"), - 0)) + 0)) + padding; Spring spring_copy = spring; diff --git a/lily/parse-scm.cc b/lily/parse-scm.cc index 81c4ad3a29..6dcf54ae92 100644 --- a/lily/parse-scm.cc +++ b/lily/parse-scm.cc @@ -52,18 +52,18 @@ internal_ly_parse_scm (Parse_start *ps) 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. @@ -81,22 +81,21 @@ internal_ly_eval_scm (Parse_start *ps) { 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) { diff --git a/lily/part-combine-iterator.cc b/lily/part-combine-iterator.cc index 9ab0495ae1..a8471b4158 100644 --- a/lily/part-combine-iterator.cc +++ b/lily/part-combine-iterator.cc @@ -159,7 +159,8 @@ Part_combine_iterator::derived_mark () const if (second_iter_) scm_gc_mark (second_iter_->self_scm ()); - Stream_event *ptrs[] = + Stream_event *ptrs[] + = { unisono_event_, mmrest_event_, @@ -421,7 +422,7 @@ Part_combine_iterator::construct_children () 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"), diff --git a/lily/pdf-scheme.cc b/lily/pdf-scheme.cc index 13e8389ece..c0cfa8d987 100644 --- a/lily/pdf-scheme.cc +++ b/lily/pdf-scheme.cc @@ -58,7 +58,7 @@ LY_DEFINE (ly_encode_string_for_pdf, "ly:encode-string-for-pdf", * 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 diff --git a/lily/pitch.cc b/lily/pitch.cc index facbf5d05d..9e7bb3a5c6 100644 --- a/lily/pitch.cc +++ b/lily/pitch.cc @@ -79,13 +79,13 @@ Pitch::tone_pitch () const 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 diff --git a/lily/pure-from-neighbor-engraver.cc b/lily/pure-from-neighbor-engraver.cc index 506127c50d..32fcfd5603 100644 --- a/lily/pure-from-neighbor-engraver.cc +++ b/lily/pure-from-neighbor-engraver.cc @@ -94,7 +94,7 @@ Pure_from_neighbor_engraver::finalize () 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 () diff --git a/lily/pure-from-neighbor-interface.cc b/lily/pure-from-neighbor-interface.cc index e6bc924aea..afc6d63772 100644 --- a/lily/pure-from-neighbor-interface.cc +++ b/lily/pure-from-neighbor-interface.cc @@ -33,21 +33,21 @@ Pure_from_neighbor_interface::calc_pure_relevant_grobs (SCM smob) { 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 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 &arr - = unsmob_grob_array (neighbors_scm)->array_reference (); - arr = new_elts; - } + { + vector &arr + = unsmob_grob_array (neighbors_scm)->array_reference (); + arr = new_elts; + } return Axis_group_interface::internal_calc_pure_relevant_grobs (me, "neighbors"); } diff --git a/lily/rest.cc b/lily/rest.cc index d86296fada..ddc9bbdd8f 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -54,7 +54,6 @@ Rest::y_offset_callback (SCM smob) if (!position_override) amount += 2 * ss * get_grob_direction (me); - return scm_from_double (amount); } diff --git a/lily/scheme-engraver.cc b/lily/scheme-engraver.cc index e59903086a..3ed25e18be 100644 --- a/lily/scheme-engraver.cc +++ b/lily/scheme-engraver.cc @@ -186,7 +186,8 @@ void mark_listen_closure (void *target) scm_gc_mark ((SCM)target); } -Listener_function_table listen_closure = +Listener_function_table listen_closure += { call_listen_closure, mark_listen_closure }; diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index e2d328d501..1878aadb45 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -58,7 +58,6 @@ finish_offset (Grob *me, Direction dir, Real total_off, Real *current_offset) && total_off * dir < minimum_space) total_off = minimum_space * dir; - if (current_offset) total_off = dir * max (dir * total_off, dir * (*current_offset)); diff --git a/lily/skyline.cc b/lily/skyline.cc index d65e48b573..e04ddcb78d 100644 --- a/lily/skyline.cc +++ b/lily/skyline.cc @@ -558,9 +558,9 @@ Skyline::internal_distance (Skyline const &other, Real horizon_padding, Real *to 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++; diff --git a/lily/slur-score-parameters.cc b/lily/slur-score-parameters.cc index 8d392ff1dc..eec7daaeec 100644 --- a/lily/slur-score-parameters.cc +++ b/lily/slur-score-parameters.cc @@ -78,4 +78,4 @@ Slur_score_parameters::fill (Grob *me) = get_detail (details, ly_symbol2scm ("close-to-edge-length")); encompass_object_range_overshoot_ = get_detail (details, ly_symbol2scm ("encompass-object-range-overshoot")); - } +} diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index 3f753ae1cc..377215eef4 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -268,7 +268,7 @@ Slur_score_state::fill (Grob *me) 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++) { @@ -294,10 +294,10 @@ Slur_score_state::fill (Grob *me) (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); } } diff --git a/lily/source-file.cc b/lily/source-file.cc index 17e01dd453..e6f7a4fb19 100644 --- a/lily/source-file.cc +++ b/lily/source-file.cc @@ -335,7 +335,7 @@ Source_file::set_line (char const *pos_str0, int line) { int current_line = get_line (pos_str0); line_offset_ += line - current_line; - + assert (line == get_line (pos_str0)); } else diff --git a/lily/spacing-loose-columns.cc b/lily/spacing-loose-columns.cc index b73f193d2d..0752a2da24 100644 --- a/lily/spacing-loose-columns.cc +++ b/lily/spacing-loose-columns.cc @@ -192,7 +192,7 @@ set_loose_columns (System *which, Column_x_positions const *posns) 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]; diff --git a/lily/spanner.cc b/lily/spanner.cc index ba44e83e19..5909b49572 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -249,7 +249,7 @@ Real Spanner::spanner_length () const { Interval lr = robust_scm2interval (get_property ("X-positions"), - Interval (1,-1)); + Interval (1, -1)); if (lr.is_empty ()) { @@ -259,7 +259,7 @@ Spanner::spanner_length () const 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); } diff --git a/lily/stem.cc b/lily/stem.cc index 7ef1b93842..568e1846c3 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -129,7 +129,7 @@ Stem::set_stem_positions (Grob *me, Real se) 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); @@ -149,8 +149,8 @@ Stem::set_stem_positions (Grob *me, Real se) 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]; @@ -390,7 +390,6 @@ Stem::internal_calc_stem_end_position (Grob *me, bool calc_beam) 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); @@ -631,7 +630,7 @@ Stem::height (SCM smob) return ly_interval2scm (internal_height (me, true)); } -Grob* +Grob * Stem::get_reference_head (Grob *me) { return to_boolean (me->get_property ("avoid-note-head")) @@ -677,14 +676,14 @@ Stem::internal_height (Grob *me, bool calc_beam) 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; } @@ -798,7 +797,7 @@ Stem::print (SCM smob) 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); @@ -851,8 +850,8 @@ Stem::offset_callback (SCM smob) /* 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; @@ -1047,7 +1046,7 @@ Stem::calc_cross_staff (SCM smob) return scm_from_bool (is_cross_staff (unsmob_grob (smob))); } -Grob* +Grob * Stem::flag (Grob *me) { return unsmob_grob (me->get_object ("flag")); diff --git a/lily/system.cc b/lily/system.cc index cc4cbda549..4e5fc1bb4c 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -336,7 +336,7 @@ System::num_footnotes () 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++) @@ -357,7 +357,7 @@ grob_2D_less (Grob *g1, Grob *g2) 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); @@ -605,7 +605,7 @@ System::get_paper_system () 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 (original ())->get_bound (RIGHT)) + if (right_bound->original () == dynamic_cast (original ())->get_bound (RIGHT)) pl->set_property ("last-in-score", SCM_BOOL_T); Interval staff_refpoints; @@ -984,7 +984,8 @@ System::get_maybe_pure_bound (Direction d, bool pure, int start, int end) return pure ? get_pure_bound (d, start, end) : get_bound (d); } -enum { +enum +{ SPACEABLE_STAVES, NONSPACEABLE_STAVES, ALL_STAVES @@ -993,7 +994,7 @@ enum { static SCM get_maybe_spaceable_staves (SCM smob, int filter) { - System *me = dynamic_cast (unsmob_grob (smob)); + System *me = dynamic_cast (unsmob_grob (smob)); Grob *align = me->get_vertical_alignment (); SCM ret = SCM_EOL; @@ -1005,10 +1006,10 @@ get_maybe_spaceable_staves (SCM smob, int filter) 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); @@ -1040,7 +1041,6 @@ System::get_nonspaceable_staves (SCM smob) 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" diff --git a/lily/tie-formatting-problem.cc b/lily/tie-formatting-problem.cc index 098bf00a11..79efa70146 100644 --- a/lily/tie-formatting-problem.cc +++ b/lily/tie-formatting-problem.cc @@ -174,7 +174,7 @@ Tie_formatting_problem::set_column_chord_outline (vector bounds, 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))); } @@ -443,7 +443,8 @@ Tie_configuration * Tie_formatting_problem::get_configuration (int pos, Direction dir, Drul_array columns, bool tune_dy) const { - int key_components[] = + int key_components[] + = { pos, dir, columns[LEFT], columns[RIGHT] }; diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index b2c67cbb18..c682b67b48 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -652,7 +652,7 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy) 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; diff --git a/lily/warn-scheme.cc b/lily/warn-scheme.cc index 3b917b760e..9e140dcf27 100644 --- a/lily/warn-scheme.cc +++ b/lily/warn-scheme.cc @@ -152,7 +152,7 @@ LY_DEFINE (ly_translate_cpp_warning_scheme, "ly:translate-cpp-warning-scheme", { 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. @@ -167,27 +167,32 @@ LY_DEFINE (ly_translate_cpp_warning_scheme, "ly:translate-cpp-warning-scheme", // 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);