From: fred Date: Wed, 27 Mar 2002 02:02:58 +0000 (+0000) Subject: lilypond-1.5.12 X-Git-Tag: release/1.5.59~465 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=3f4471f7493c68accc219b6988f72a896e3ec631;p=lilypond.git lilypond-1.5.12 --- diff --git a/lily/align-interface.cc b/lily/align-interface.cc index 6f6321af68..8211c349af 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -123,8 +123,8 @@ Align_interface::align_elements_to_extents (Grob * me, Axis a) SCM thr = me->get_grob_property ("threshold"); if (gh_pair_p (thr)) { - threshold[SMALLER] = gh_scm2double (gh_car (thr)); - threshold[BIGGER] = gh_scm2double (gh_cdr (thr)); + threshold[SMALLER] = gh_scm2double (ly_car (thr)); + threshold[BIGGER] = gh_scm2double (ly_cdr (thr)); } @@ -143,19 +143,19 @@ Align_interface::align_elements_to_extents (Grob * me, Axis a) // todo: fucks up if item both in Halign & Valign. SCM min_dims = e->remove_grob_property ("minimum-space"); if (gh_pair_p (min_dims) && - gh_number_p (gh_car (min_dims)) - && gh_number_p (gh_cdr (min_dims))) + gh_number_p (ly_car (min_dims)) + && gh_number_p (ly_cdr (min_dims))) { y.unite (ly_scm2interval (min_dims)); } SCM extra_dims = e->remove_grob_property ("extra-space"); if (gh_pair_p (extra_dims) && - gh_number_p (gh_car (extra_dims)) - && gh_number_p (gh_cdr (extra_dims))) + gh_number_p (ly_car (extra_dims)) + && gh_number_p (ly_cdr (extra_dims))) { - y[LEFT] += gh_scm2double (gh_car (extra_dims)); - y[RIGHT] += gh_scm2double (gh_cdr (extra_dims)); + y[LEFT] += gh_scm2double (ly_car (extra_dims)); + y[RIGHT] += gh_scm2double (ly_cdr (extra_dims)); } elems.push (e); @@ -245,7 +245,7 @@ Align_interface::align_elements_to_extents (Grob * me, Axis a) Axis Align_interface::axis (Grob*me) { - return Axis (gh_scm2int (gh_car (me->get_grob_property ("axes")))); + return Axis (gh_scm2int (ly_car (me->get_grob_property ("axes")))); } @@ -259,10 +259,10 @@ Align_interface::get_count (Grob*me,Grob*s) int c =0; while (gh_pair_p (e)) { - if (gh_car (e) == s->self_scm ()) + if (ly_car (e) == s->self_scm ()) break; c++; - e = gh_cdr (e); + e = ly_cdr (e); } return c; } diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc index 900949224c..5b0e755577 100644 --- a/lily/arpeggio.cc +++ b/lily/arpeggio.cc @@ -29,9 +29,9 @@ Arpeggio::brew_molecule (SCM smob) Grob *me = unsmob_grob (smob); Grob * common = me; - for (SCM s = me->get_grob_property ("stems"); gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = me->get_grob_property ("stems"); gh_pair_p (s); s = ly_cdr (s)) { - Grob * stem = unsmob_grob (gh_car (s)); + Grob * stem = unsmob_grob (ly_car (s)); common = common->common_refpoint (Staff_symbol_referencer::staff_symbol_l (stem), Y_AXIS); } @@ -47,9 +47,9 @@ Arpeggio::brew_molecule (SCM smob) Interval heads; Real my_y = me->relative_coordinate (common, Y_AXIS); - for (SCM s = me->get_grob_property ("stems"); gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = me->get_grob_property ("stems"); gh_pair_p (s); s = ly_cdr (s)) { - Grob * stem = unsmob_grob (gh_car (s)); + Grob * stem = unsmob_grob (ly_car (s)); Grob * ss = Staff_symbol_referencer::staff_symbol_l (stem); Interval iv =Stem::head_positions (stem); iv *= Staff_symbol::staff_space (ss)/2.0; diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc index 2f29c4be38..32b1b05608 100644 --- a/lily/auto-change-iterator.cc +++ b/lily/auto-change-iterator.cc @@ -85,8 +85,8 @@ Auto_change_iterator::pending_pitch (Moment m) const while (1) { SCM muses = iter->get_music (m); - for (SCM s = muses; gh_pair_p (s); s=gh_cdr (s)) - if (Note_req* nr = dynamic_cast (unsmob_music (gh_car (s)))) + for (SCM s = muses; gh_pair_p (s); s=ly_cdr (s)) + if (Note_req* nr = dynamic_cast (unsmob_music (ly_car (s)))) { ps.push (*unsmob_pitch (nr->get_mus_property ("pitch"))); } diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc index 1a68c4251f..3c16796147 100644 --- a/lily/axis-group-engraver.cc +++ b/lily/axis-group-engraver.cc @@ -65,21 +65,21 @@ Axis_group_engraver::finalize () String type = daddy_grav_l ()->type_str_ ; SCM dims = get_property ("VerticalExtent"); - if (gh_pair_p (dims) && gh_number_p (gh_car (dims)) - && gh_number_p (gh_cdr (dims))) + if (gh_pair_p (dims) && gh_number_p (ly_car (dims)) + && gh_number_p (ly_cdr (dims))) { staffline_p_->set_extent_callback (Grob::preset_extent_proc, Y_AXIS); staffline_p_->set_grob_property ("extent-Y", dims); } dims = get_property ("MinimumVerticalExtent"); - if (gh_pair_p (dims) && gh_number_p (gh_car (dims)) - && gh_number_p (gh_cdr (dims))) + if (gh_pair_p (dims) && gh_number_p (ly_car (dims)) + && gh_number_p (ly_cdr (dims))) staffline_p_->set_grob_property ("minimum-extent-Y", dims); dims = get_property ("ExtraVerticalExtent"); - if (gh_pair_p (dims) && gh_number_p (gh_car (dims)) - && gh_number_p (gh_cdr (dims))) + if (gh_pair_p (dims) && gh_number_p (ly_car (dims)) + && gh_number_p (ly_cdr (dims))) staffline_p_->set_grob_property ("extra-extent-Y", dims); Grob * it = unsmob_grob (get_property ("currentCommandColumn")); diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index c974f3fa76..02960f6aba 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -13,9 +13,9 @@ void Axis_group_interface::add_element (Grob*me,Grob *e) { - for (SCM ax = me->get_grob_property ("axes"); ax != SCM_EOL ; ax = gh_cdr (ax)) + for (SCM ax = me->get_grob_property ("axes"); ax != SCM_EOL ; ax = ly_cdr (ax)) { - Axis a = (Axis) gh_scm2int (gh_car (ax)); + Axis a = (Axis) gh_scm2int (ly_car (ax)); if (!e->parent_l (a)) e->set_parent (me, a); @@ -41,9 +41,9 @@ Interval Axis_group_interface::relative_group_extent (Axis a, Grob *common, SCM elts) { Interval r; - for (SCM s = elts; gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = elts; gh_pair_p (s); s = ly_cdr (s)) { - Grob * se = unsmob_grob (gh_car (s)); + Grob * se = unsmob_grob (ly_car (s)); Interval dims = se->extent (common, a); if (!dims.empty_b ()) r.unite (dims); @@ -60,9 +60,9 @@ Axis_group_interface::group_extent_callback (SCM element_smob, SCM scm_axis) Grob * common = (Grob*) me; - for (SCM s = me->get_grob_property ("elements"); gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = me->get_grob_property ("elements"); gh_pair_p (s); s = ly_cdr (s)) { - Grob * se = unsmob_grob (gh_car (s)); + Grob * se = unsmob_grob (ly_car (s)); common = se->common_refpoint (common, a); } @@ -114,9 +114,9 @@ Axis_group_interface::get_children (Grob*me) if (!has_interface (me)) return childs; - for (SCM ep = me->get_grob_property ("elements"); gh_pair_p (ep); ep = gh_cdr (ep)) + for (SCM ep = me->get_grob_property ("elements"); gh_pair_p (ep); ep = ly_cdr (ep)) { - Grob* e = unsmob_grob (gh_car (ep)); + Grob* e = unsmob_grob (ly_car (ep)); if (e) childs.concat (Axis_group_interface::get_children (e)); } diff --git a/lily/break-align-engraver.cc b/lily/break-align-engraver.cc index a403c4a60e..21551ad5b2 100644 --- a/lily/break-align-engraver.cc +++ b/lily/break-align-engraver.cc @@ -51,20 +51,20 @@ void Break_align_engraver::stop_translation_timestep () { SCM order = get_property ("breakAlignOrder"); - for (; gh_pair_p (order); order = gh_cdr (order)) + for (; gh_pair_p (order); order = ly_cdr (order)) { - SCM p = scm_assoc (gh_car (order), column_alist_); + SCM p = scm_assoc (ly_car (order), column_alist_); if (gh_pair_p (p)) { - add_column (gh_cdr (p)); - column_alist_ = scm_assoc_remove_x (column_alist_, gh_car (order)); + add_column (ly_cdr (p)); + column_alist_ = scm_assoc_remove_x (column_alist_, ly_car (order)); } } - for (SCM p = column_alist_; gh_pair_p (p); p = gh_cdr (p)) + for (SCM p = column_alist_; gh_pair_p (p); p = ly_cdr (p)) { - SCM pair = gh_car (p); - add_column (gh_cdr (pair)); + SCM pair = ly_car (p); + add_column (ly_cdr (pair)); } @@ -136,7 +136,7 @@ Break_align_engraver::acknowledge_grob (Grob_info inf) if (s != SCM_BOOL_F) { - Grob *e = unsmob_grob (gh_cdr (s)); + Grob *e = unsmob_grob (ly_cdr (s)); group = dynamic_cast (e); } else diff --git a/lily/break-align-item.cc b/lily/break-align-item.cc index 28b93b8184..709687ce28 100644 --- a/lily/break-align-item.cc +++ b/lily/break-align-item.cc @@ -129,7 +129,7 @@ Break_align_interface::do_alignment (Grob *me) SCM extra_space; if (e != SCM_BOOL_F) { - extra_space = gh_cdr (e); + extra_space = ly_cdr (e); } else { @@ -139,7 +139,7 @@ Break_align_interface::do_alignment (Grob *me) extra_space = scm_list_n (ly_symbol2scm ("minimum-space"), gh_double2scm (0.0), SCM_UNDEFINED); } - SCM symbol = gh_car (extra_space); + SCM symbol = ly_car (extra_space); Real spc = gh_scm2double (gh_cadr (extra_space)); dists.push (spc); @@ -149,14 +149,14 @@ Break_align_interface::do_alignment (Grob *me) // skip the first sym. - symbol_list = gh_cdr (scm_reverse (symbol_list)); + symbol_list = ly_cdr (scm_reverse (symbol_list)); for (int i=0; i set_grob_property (gh_car (symbol_list), + elems[i]->set_grob_property (ly_car (symbol_list), scm_cons (gh_double2scm (0), gh_double2scm (dists[i+1]))); - symbol_list = gh_cdr (symbol_list); + symbol_list = ly_cdr (symbol_list); } @@ -198,12 +198,12 @@ Break_align_interface::do_alignment (Grob *me) Real stretch_distance =0.; - if (gh_car (symbol_list) == ly_symbol2scm ("extra-space")) + if (ly_car (symbol_list) == ly_symbol2scm ("extra-space")) { spring_len += dists.top (); stretch_distance = dists.top (); } - else if (gh_car (symbol_list) == ly_symbol2scm ("minimum-space")) + else if (ly_car (symbol_list) == ly_symbol2scm ("minimum-space")) { spring_len = spring_len >? dists.top (); stretch_distance = spring_len; diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index 7a4302a912..da58ffaaf1 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -52,10 +52,10 @@ Chord_name_engraver::Chord_name_engraver () void Chord_name_engraver::add_note (Note_req* n) { - SCM pitches = gh_car (chord_); - SCM modifiers = gh_cdr (chord_); - SCM inversion = modifiers == SCM_EOL ? SCM_EOL : gh_car (modifiers); - SCM bass = modifiers == SCM_EOL ? SCM_EOL : gh_cdr (modifiers); + SCM pitches = ly_car (chord_); + SCM modifiers = ly_cdr (chord_); + SCM inversion = modifiers == SCM_EOL ? SCM_EOL : ly_car (modifiers); + SCM bass = modifiers == SCM_EOL ? SCM_EOL : ly_cdr (modifiers); if (n->get_mus_property ("inversion") == SCM_BOOL_T) inversion = n->get_mus_property ("pitch"); @@ -88,13 +88,13 @@ Chord_name_engraver::acknowledge_grob (Grob_info i) void Chord_name_engraver::create_grobs () { - if (!chord_name_p_ && gh_car (chord_) != SCM_EOL) + if (!chord_name_p_ && ly_car (chord_) != SCM_EOL) { chord_name_p_ = new Item (get_property ("ChordName")); chord_name_p_->set_grob_property ("chord", chord_); announce_grob (chord_name_p_, 0); SCM s = get_property ("chordChanges"); - if (to_boolean (s) && gh_car (last_chord_) != SCM_EOL + if (to_boolean (s) && ly_car (last_chord_) != SCM_EOL && gh_equal_p (chord_, last_chord_)) chord_name_p_->set_grob_property ("begin-of-line-visible", SCM_BOOL_T); } @@ -109,7 +109,7 @@ Chord_name_engraver::stop_translation_timestep () } chord_name_p_ = 0; - if (gh_car (chord_) != SCM_EOL) + if (ly_car (chord_) != SCM_EOL) last_chord_ = chord_; chord_ = gh_cons (SCM_EOL, gh_cons (SCM_EOL, SCM_EOL)); } diff --git a/lily/collision.cc b/lily/collision.cc index d0bcf4eec2..27b3363074 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -214,7 +214,7 @@ Collision::do_shifts (Grob* me) Real wid = gh_scm2double (me->get_grob_property ("note-width")); - for (; gh_pair_p (hand); hand =gh_cdr (hand)) + for (; gh_pair_p (hand); hand =ly_cdr (hand)) { Grob * s = unsmob_grob (gh_caar (hand)); Real amount = gh_scm2double (gh_cdar (hand)); @@ -222,7 +222,7 @@ Collision::do_shifts (Grob* me) s->translate_axis (amount *wid, X_AXIS); done.push (s); } - for (; gh_pair_p (autos); autos =gh_cdr (autos)) + for (; gh_pair_p (autos); autos =ly_cdr (autos)) { Grob * s = unsmob_grob (gh_caar (autos)); Real amount = gh_scm2double (gh_cdar (autos)); @@ -245,9 +245,9 @@ Collision::automatic_shift (Grob *me) SCM tups = SCM_EOL; SCM s = me->get_grob_property ("elements"); - for (; gh_pair_p (s); s = gh_cdr (s)) + for (; gh_pair_p (s); s = ly_cdr (s)) { - SCM car = gh_car (s); + SCM car = ly_car (s); Grob * se = unsmob_grob (car); if (Note_column::has_interface (se)) @@ -348,9 +348,9 @@ Collision::forced_shift (Grob *me) SCM tups = SCM_EOL; SCM s = me->get_grob_property ("elements"); - for (; gh_pair_p (s); s = gh_cdr (s)) + for (; gh_pair_p (s); s = ly_cdr (s)) { - Grob * se = unsmob_grob (gh_car (s)); + Grob * se = unsmob_grob (ly_car (s)); SCM force = se->remove_grob_property ("force-hshift"); if (gh_number_p (force)) diff --git a/lily/command-request.cc b/lily/command-request.cc index ce8db7f353..93e1914010 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -27,14 +27,14 @@ Key_change_req::transpose (Pitch p) { SCM newlist = SCM_EOL; SCM pa = get_mus_property ("pitch-alist"); - for (SCM s = pa; gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = pa; gh_pair_p (s); s = ly_cdr (s)) { SCM key = gh_caar (s); SCM alter = gh_cdar (s); if (gh_pair_p (key)) { - Pitch orig (gh_scm2int (gh_car (key)), - gh_scm2int (gh_cdr (key)), + Pitch orig (gh_scm2int (ly_car (key)), + gh_scm2int (ly_cdr (key)), gh_scm2int (alter)); orig.transpose (p); @@ -64,14 +64,14 @@ bool alist_equal_p (SCM a, SCM b) { for (SCM s = a; - gh_pair_p (s); s = gh_cdr (s)) + gh_pair_p (s); s = ly_cdr (s)) { SCM key = gh_caar (s); SCM val = gh_cdar (s); SCM l = scm_assoc (key, b); if (l == SCM_BOOL_F - || !gh_equal_p ( gh_cdr (l), val)) + || !gh_equal_p ( ly_cdr (l), val)) return false; } diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 4ae84934f6..0023760277 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -78,8 +78,8 @@ Dot_column::do_shifts (SCM l) Link_array dots; while (gh_pair_p (l)) { - dots.push (unsmob_grob (gh_car (l))); - l = gh_cdr (l); + dots.push (unsmob_grob (ly_car (l))); + l = ly_cdr (l); } dots.sort (compare_position); diff --git a/lily/duration.cc b/lily/duration.cc index 1a0273850d..6476466774 100644 --- a/lily/duration.cc +++ b/lily/duration.cc @@ -94,7 +94,7 @@ IMPLEMENT_SIMPLE_SMOBS (Duration); int Duration::print_smob (SCM s, SCM port, scm_print_state *) { - Duration *r = (Duration *) gh_cdr (s); + Duration *r = (Duration *) ly_cdr (s); scm_puts ("#str ().ch_C ()), port); @@ -106,8 +106,8 @@ Duration::print_smob (SCM s, SCM port, scm_print_state *) SCM Duration::equal_p (SCM a , SCM b) { - Duration *p = (Duration *) gh_cdr (a); - Duration *q = (Duration *) gh_cdr (b); + Duration *p = (Duration *) ly_cdr (a); + Duration *q = (Duration *) ly_cdr (b); bool eq = p->dots_i_ == q->dots_i_ && p->durlog_i_ == q->durlog_i_ diff --git a/lily/dynamic-performer.cc b/lily/dynamic-performer.cc index f805428f0c..0b5d1b73b0 100644 --- a/lily/dynamic-performer.cc +++ b/lily/dynamic-performer.cc @@ -99,8 +99,8 @@ Dynamic_performer::create_audio_elements () if (gh_pair_p (s)) { Interval iv; - iv[MIN] = gh_scm2double (gh_car (s)); - iv[MAX] = gh_scm2double (gh_cdr (s)); + iv[MIN] = gh_scm2double (ly_car (s)); + iv[MAX] = gh_scm2double (ly_cdr (s)); volume = iv[MIN] + iv.length () * volume; } } diff --git a/lily/engraver-group-engraver.cc b/lily/engraver-group-engraver.cc index 0a47bb8420..3751625199 100644 --- a/lily/engraver-group-engraver.cc +++ b/lily/engraver-group-engraver.cc @@ -28,9 +28,9 @@ void Engraver_group_engraver::create_grobs () { - for (SCM p = simple_trans_list_; gh_pair_p (p); p = gh_cdr (p)) + for (SCM p = simple_trans_list_; gh_pair_p (p); p = ly_cdr (p)) { - Translator * t = unsmob_translator (gh_car (p)); + Translator * t = unsmob_translator (ly_car (p)); Engraver * eng = dynamic_cast (t); if (eng) eng->create_grobs (); @@ -43,9 +43,9 @@ Engraver_group_engraver::acknowledge_grobs () for (int j =0; j < announce_info_arr_.size (); j++) { Grob_info info = announce_info_arr_[j]; - for (SCM p = simple_trans_list_; gh_pair_p (p); p = gh_cdr (p)) + for (SCM p = simple_trans_list_; gh_pair_p (p); p = ly_cdr (p)) { - Translator * t = unsmob_translator (gh_car (p)); + Translator * t = unsmob_translator (ly_car (p)); Engraver * eng = dynamic_cast (t); if (eng && eng!= info.origin_trans_l_) eng->acknowledge_grob (info); @@ -56,9 +56,9 @@ Engraver_group_engraver::acknowledge_grobs () void Engraver_group_engraver::do_announces () { - for (SCM p = trans_group_list_; gh_pair_p (p); p =gh_cdr (p)) + for (SCM p = trans_group_list_; gh_pair_p (p); p =ly_cdr (p)) { - Translator * t = unsmob_translator (gh_car (p)); + Translator * t = unsmob_translator (ly_car (p)); dynamic_cast (t)->do_announces (); } @@ -80,17 +80,17 @@ Engraver_group_engraver::do_announces () void Engraver_group_engraver::process_music () { - for (SCM p = simple_trans_list_; gh_pair_p (p); p =gh_cdr (p)) + for (SCM p = simple_trans_list_; gh_pair_p (p); p =ly_cdr (p)) { - Translator * t = unsmob_translator (gh_car (p)); + Translator * t = unsmob_translator (ly_car (p)); Engraver * eng = dynamic_cast (t); if (eng) eng->process_music (); } - for (SCM p = trans_group_list_; gh_pair_p (p); p =gh_cdr (p)) + for (SCM p = trans_group_list_; gh_pair_p (p); p =ly_cdr (p)) { - Translator * t = unsmob_translator (gh_car (p)); + Translator * t = unsmob_translator (ly_car (p)); Engraver*eng = dynamic_cast (t); if (eng) eng->process_music (); diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index 04112971d3..78e5c2fa04 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -66,6 +66,8 @@ Gourlay_breaking::do_solve () const optimal_paths[0] = first_node; int break_idx=1; + Real worst_force = 0.0; + for (; break_idx< breaks.size (); break_idx++) { /* @@ -94,13 +96,26 @@ Gourlay_breaking::do_solve () const sp->solve (&cp); delete sp; + if (cp.force_f_ > worst_force) + worst_force = cp.force_f_; + + /* + We remember this solution as a "should always work + solution", in case everything fucks up. */ if (start_idx == break_idx - 1) - backup_sol = cp; // in case everything fucks up + backup_sol = cp; if (!cp.satisfies_constraints_b_) - break; - + { + /* + If it doesn't satisfy constraints, we make this one + really unattractive. + */ + cp.force_f_ += worst_force; + cp.force_f_ *= 10; + } Real this_demerits; + if (optimal_paths[start_idx].demerits_f_ >= infinity_f) this_demerits = infinity_f; else @@ -113,6 +128,13 @@ Gourlay_breaking::do_solve () const minimal_sol = cp; minimal_demerits = this_demerits; } + + /* + we couldn't satisfy the constraints, this won't get better + if we add more columns, so we get on with the next one + */ + if (!cp.satisfies_constraints_b_) + break ; } int prev =break_idx - 1; @@ -156,9 +178,14 @@ Gourlay_breaking::do_solve () const if (optimal_paths.top ().demerits_f_ >= infinity_f) warning (_ ("No feasible line breaking found")); - for (int i= final_breaks.size (); i--;) - lines.push (optimal_paths[final_breaks[i]].line_config_); - + for (int i= final_breaks.size (); i--;) + { + Column_x_positions cp (optimal_paths[final_breaks[i]].line_config_); + + lines.push (cp); + if(!cp.satisfies_constraints_b_) + warning ("Could not find line breaking that satisfies constraints."); + } return lines; } diff --git a/lily/include/protected-scm.hh b/lily/include/protected-scm.hh index bfe3cafcdc..10ba29c8e8 100644 --- a/lily/include/protected-scm.hh +++ b/lily/include/protected-scm.hh @@ -10,7 +10,7 @@ #ifndef PROTECTED_SCM_HH #define PROTECTED_SCM_HH -#include +#include /* Mix GUILE GC with C++ ctors and dtors. diff --git a/lily/item.cc b/lily/item.cc index eeed9d86cc..6fae06efb9 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -162,8 +162,8 @@ Item::handle_prebroken_dependencies () { SCM args = scm_list_n (gh_int2scm (break_status_dir ()), SCM_UNDEFINED); SCM result = gh_apply (vis, args); - bool trans = gh_scm2bool (gh_car (result)); - bool empty = gh_scm2bool (gh_cdr (result)); + bool trans = gh_scm2bool (ly_car (result)); + bool empty = gh_scm2bool (ly_cdr (result)); if (empty && trans) suicide (); diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index 8dc62ea994..37b215fbd6 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -156,17 +156,17 @@ Key_engraver::read_req (Key_change_req const * r) SCM n = scm_list_copy (p); SCM accs = SCM_EOL; for (SCM s = get_property ("keyAccidentalOrder"); - gh_pair_p (s); s = gh_cdr (s)) + gh_pair_p (s); s = ly_cdr (s)) { - if (gh_pair_p (scm_member (gh_car (s), n))) + if (gh_pair_p (scm_member (ly_car (s), n))) { - accs = gh_cons (gh_car (s), accs); - n = scm_delete_x (gh_car (s), n); + accs = gh_cons (ly_car (s), accs); + n = scm_delete_x (ly_car (s), n); } } - for (SCM s = n ; gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = n ; gh_pair_p (s); s = ly_cdr (s)) if (gh_scm2int (gh_cdar (s))) - accs = gh_cons (gh_car (s), accs); + accs = gh_cons (ly_car (s), accs); old_accs_ = get_property ("keySignature"); daddy_trans_l_->set_property ("keySignature", accs); diff --git a/lily/key-item.cc b/lily/key-item.cc index b66cd6b490..713ae61e27 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -37,7 +37,7 @@ int alteration_pos (SCM what, int alter, int c0p) { if (gh_pair_p (what)) - return gh_scm2int (gh_car (what)) * 7 + gh_scm2int (gh_cdr (what)) + c0p; + return gh_scm2int (ly_car (what)) * 7 + gh_scm2int (ly_cdr (what)) + c0p; int p = gh_scm2int (what); @@ -101,7 +101,7 @@ Key_item::brew_molecule (SCM smob) */ int c0p = gh_scm2int (me->get_grob_property ("c0-position")); - for (SCM s = newas; gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = newas; gh_pair_p (s); s = ly_cdr (s)) { SCM what = gh_caar (s); int alter = gh_scm2int (gh_cdar (s)); @@ -133,11 +133,11 @@ Key_item::brew_molecule (SCM smob) natural=Font_interface::get_default_font (me)-> find_by_name (String ("accidentals-") + style + String ("0")); - for (; gh_pair_p (old); old = gh_cdr (old)) + for (; gh_pair_p (old); old = ly_cdr (old)) { SCM found = scm_assoc (gh_caar (old), newas); if (found == SCM_BOOL_F - || gh_cdr (found) != gh_cdar (old)) + || ly_cdr (found) != gh_cdar (old)) { SCM what = gh_caar (old); int alter = 0; diff --git a/lily/lexer.ll b/lily/lexer.ll index b44ae5ef9d..e07648fc32 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -547,7 +547,7 @@ My_lily_lexer::scan_escaped_word (String str) if (gh_pair_p (pitch)) { - yylval.scm = gh_cdr (pitch); + yylval.scm = ly_cdr (pitch); return NOTENAME_PITCH; } } @@ -566,11 +566,11 @@ My_lily_lexer::scan_bare_word (String str) if ((YYSTATE == notes) || (YYSTATE == chords)) { SCM pitch = scm_hashq_get_handle (pitchname_tab_, sym); if (gh_pair_p (pitch)) { - yylval.scm = gh_cdr (pitch); + yylval.scm = ly_cdr (pitch); return (YYSTATE == notes) ? NOTENAME_PITCH : TONICNAME_PITCH; } else if ((pitch = scm_hashq_get_handle (chordmodifier_tab_, sym))!= SCM_BOOL_F) { - yylval.scm = gh_cdr (pitch); + yylval.scm = ly_cdr (pitch); return CHORDMODIFIER_PITCH; } } diff --git a/lily/local-key-engraver.cc b/lily/local-key-engraver.cc index ed71c53377..274883c15a 100644 --- a/lily/local-key-engraver.cc +++ b/lily/local-key-engraver.cc @@ -95,7 +95,7 @@ Local_key_engraver::create_grobs () SCM prev = scm_assoc (gh_cons (gh_int2scm (o), gh_int2scm (n)), localsig); if (prev == SCM_BOOL_F) prev = scm_assoc (gh_int2scm (n), localsig); - SCM prev_acc = (prev == SCM_BOOL_F) ? gh_int2scm (0) : gh_cdr (prev); + SCM prev_acc = (prev == SCM_BOOL_F) ? gh_int2scm (0) : ly_cdr (prev); bool different = !gh_equal_p (prev_acc , gh_int2scm (a)); int p = gh_number_p (prev_acc) ? gh_scm2int (prev_acc) : 0; diff --git a/lily/lyric-phrasing-engraver.cc b/lily/lyric-phrasing-engraver.cc index 90a092ebdd..a335ca7f61 100644 --- a/lily/lyric-phrasing-engraver.cc +++ b/lily/lyric-phrasing-engraver.cc @@ -110,7 +110,7 @@ Lyric_phrasing_engraver::lookup_context_id (const String &context_id) // (key . ((alist_entry . old_entry) . previous_entry)) if (to_boolean (gh_cdadr (s))) { // it's an old entry ... make it a new one SCM val = gh_cons (gh_cons (gh_caadr (s), SCM_BOOL_F), gh_cddr (s)); - voice_alist_ = scm_assoc_set_x (voice_alist_, gh_car (s), val); + voice_alist_ = scm_assoc_set_x (voice_alist_, ly_car (s), val); return unsmob_voice_entry (gh_caar (val)); } else { // the entry is current ... return it. @@ -265,7 +265,7 @@ void Lyric_phrasing_engraver::create_grobs () SCM sp = get_property ("phrasingPunctuation"); punc = gh_string_p (sp) ? ly_scm2string (sp) : ".,;:?!\""; - for (SCM v=voice_alist_; gh_pair_p (v); v = gh_cdr (v)) { + for (SCM v=voice_alist_; gh_pair_p (v); v = ly_cdr (v)) { SCM v_entry = gh_cdar (v); // ((current . oldflag) . previous) if (!to_boolean (gh_cdar (v_entry))) { // not an old entry left over from a prior note ... @@ -281,7 +281,7 @@ void Lyric_phrasing_engraver::create_grobs () if (entry->get_melisma ()) { if (entry->lyric_count ()) warning (_ ("Huh? Melismatic note found to have associated lyrics.")); - SCM previous_scm = gh_cdr (v_entry); + SCM previous_scm = ly_cdr (v_entry); if (previous_scm != SCM_EOL) { Syllable_group *previous = unsmob_voice_entry (previous_scm); if (previous->lyric_count ()) @@ -296,7 +296,7 @@ void Lyric_phrasing_engraver::create_grobs () void Lyric_phrasing_engraver::stop_translation_timestep () { - for (SCM v=voice_alist_; gh_pair_p (v); v = gh_cdr (v)) { + for (SCM v=voice_alist_; gh_pair_p (v); v = ly_cdr (v)) { SCM entry_scm = gh_cdar (v); // ((alist_entry . entry_is_old) . previous_entry) Syllable_group * entry = unsmob_voice_entry (gh_caar (entry_scm)); @@ -304,9 +304,9 @@ Lyric_phrasing_engraver::stop_translation_timestep () // set previous_entry, set entry_is_old, and resave it to alist_ // but only change if this current was not old. if (! to_boolean (gh_cdar (entry_scm))) { - Syllable_group * previous_entry = unsmob_voice_entry (gh_cdr (entry_scm)); + Syllable_group * previous_entry = unsmob_voice_entry (ly_cdr (entry_scm)); previous_entry->copy (entry); - entry_scm = gh_cons (gh_cons (gh_caar (entry_scm), SCM_BOOL_T), gh_cdr (entry_scm)); + entry_scm = gh_cons (gh_cons (gh_caar (entry_scm), SCM_BOOL_T), ly_cdr (entry_scm)); voice_alist_ = scm_assoc_set_x (voice_alist_, gh_caar (v), entry_scm); } entry->next_lyric (); diff --git a/lily/main.cc b/lily/main.cc index dfb402ee41..226d054d78 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -309,7 +309,7 @@ format_to_ext (String format) } void -main_prog (int, char**) +main_prog (void * closure, int, char**) { /* need to do this first. Engravers use lily.scm contents. @@ -324,7 +324,7 @@ main_prog (int, char**) all_fonts_global_p = new All_font_metrics (global_path.str ()); init_scheme_code_string += ")"; - gh_eval_str ((char *)init_scheme_code_string.ch_C()); + scm_c_eval_string ((char *)init_scheme_code_string.ch_C()); int p=0; const char *arg = oparser_p_static->get_next_arg (); @@ -486,9 +486,9 @@ main (int argc, char **argv) identify (&cerr); #ifdef WINNT - gh_enter (argc, argv, main_prog); + scm_boot_guile (argc, argv, main_prog, 0); #else - gh_enter (argc, argv, (void (*) (int, char**))main_prog); + scm_boot_guile (argc, argv, (void (*) (void*, int, char**))main_prog, 0); #endif return 0; // unreachable diff --git a/lily/moment.cc b/lily/moment.cc index e75b6880f6..91eea12f12 100644 --- a/lily/moment.cc +++ b/lily/moment.cc @@ -35,7 +35,7 @@ Moment::smobbed_copy () const int Moment::print_smob (SCM s, SCM port, scm_print_state *) { - Moment *r = (Moment *) gh_cdr (s); + Moment *r = (Moment *) ly_cdr (s); scm_puts ("#str ()); diff --git a/lily/music-sequence.cc b/lily/music-sequence.cc index 1df990d42b..2079133314 100644 --- a/lily/music-sequence.cc +++ b/lily/music-sequence.cc @@ -23,7 +23,7 @@ Music_sequence::truncate (int k) { SCM s = l; k--; - for (; gh_pair_p (s) && k--; s = gh_cdr (s)) + for (; gh_pair_p (s) && k--; s = ly_cdr (s)) ; if (gh_pair_p (s)) @@ -59,8 +59,8 @@ Music_sequence::Music_sequence (SCM l) void Music_sequence::transpose (Pitch rq) { - for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) - unsmob_music (gh_car (s))->transpose (rq); + for (SCM s = music_list (); gh_pair_p (s); s = ly_cdr (s)) + unsmob_music (ly_car (s))->transpose (rq); } @@ -72,9 +72,9 @@ Music_sequence::cumulative_length () const Moment cumulative; Moment last_len ; - for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = music_list (); gh_pair_p (s); s = ly_cdr (s)) { - Moment l = unsmob_music (gh_car (s))->length_mom (); + Moment l = unsmob_music (ly_car (s))->length_mom (); if (last_len.grace_part_ && l.main_part_) { last_len.grace_part_ = Rational (0); @@ -100,9 +100,9 @@ Moment Music_sequence::maximum_length () const { Moment dur = 0; - for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = music_list (); gh_pair_p (s); s = ly_cdr (s)) { - Music * m = unsmob_music (gh_car (s)); + Music * m = unsmob_music (ly_car (s)); Moment l = m->length_mom (); dur = dur >? l; } @@ -122,9 +122,9 @@ Music_sequence::do_relative_octave (Pitch p, bool ret_first) int count=0; Pitch last = p; - for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = music_list (); gh_pair_p (s); s = ly_cdr (s)) { - last = unsmob_music (gh_car (s))->to_relative_octave (last); + last = unsmob_music (ly_car (s))->to_relative_octave (last); if (!count ++) retval = last; } @@ -138,8 +138,8 @@ Music_sequence::do_relative_octave (Pitch p, bool ret_first) void Music_sequence::compress (Moment m) { - for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) - unsmob_music (gh_car (s))->compress (m); + for (SCM s = music_list (); gh_pair_p (s); s = ly_cdr (s)) + unsmob_music (ly_car (s))->compress (m); } ADD_MUSIC (Music_sequence); @@ -155,9 +155,9 @@ Music_sequence::minimum_start () const { Moment m; - for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = music_list (); gh_pair_p (s); s = ly_cdr (s)) { - m = m start_mom (); + m = m start_mom (); } return m; } @@ -167,9 +167,9 @@ Music_sequence::first_start () const { Moment m; - for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = music_list (); gh_pair_p (s); s = ly_cdr (s)) { - Music * mus = unsmob_music (gh_car (s)); + Music * mus = unsmob_music (ly_car (s)); Moment l = mus->length_mom (); Moment s = mus->start_mom (); if (l.to_bool () || s.to_bool ()) diff --git a/lily/music.cc b/lily/music.cc index edb75a4899..ca3f8fe813 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -24,7 +24,7 @@ ly_deep_mus_copy (SCM m) } else if (gh_pair_p (m)) { - return gh_cons (ly_deep_mus_copy (gh_car (m)), ly_deep_mus_copy (gh_cdr (m))); + return gh_cons (ly_deep_mus_copy (ly_car (m)), ly_deep_mus_copy (ly_cdr (m))); } else return m; @@ -99,7 +99,7 @@ Music::start_mom () const void print_alist (SCM a, SCM port) { - for (SCM s = a; gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = a; gh_pair_p (s); s = ly_cdr (s)) { scm_display (gh_caar (s), port); scm_puts (" = ", port); @@ -153,10 +153,10 @@ Music::get_mus_property (SCM sym) const { SCM s = scm_sloppy_assq (sym, mutable_property_alist_); if (s != SCM_BOOL_F) - return gh_cdr (s); + return ly_cdr (s); s = scm_sloppy_assq (sym, immutable_property_alist_); - return (s == SCM_BOOL_F) ? SCM_EOL : gh_cdr (s); + return (s == SCM_BOOL_F) ? SCM_EOL : ly_cdr (s); } /* diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index 4a44f5919a..9e699a5e82 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -120,7 +120,7 @@ My_lily_parser::paper_description () SCM al = p->translator_p_dict_p_->to_alist (); SCM l = SCM_EOL; - for (SCM s = al ; gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = al ; gh_pair_p (s); s = ly_cdr (s)) { Translator_def * td = unsmob_translator_def (gh_cdar (s)); l = gh_cons (gh_cons (gh_caar (s), td->to_alist ()), l); diff --git a/lily/new-spacing-spanner.cc b/lily/new-spacing-spanner.cc index 760651efee..3daabc0672 100644 --- a/lily/new-spacing-spanner.cc +++ b/lily/new-spacing-spanner.cc @@ -144,7 +144,7 @@ cout << "params for cols " << Paper_column::rank_i (l) << " " << Paper_column::r access to the note head. */ - for (SCM s = seq; gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = seq; gh_pair_p (s); s = ly_cdr (s)) { Grob *lm = unsmob_grob (gh_caar (s)); Grob *rm = unsmob_grob (gh_cdar (s)); @@ -189,7 +189,7 @@ New_spacing_spanner::breakable_column_spacing (Item* l, Item *r) Real break_dist = 0.0; SCM espace = l->get_grob_property ("extra-space"); if (gh_pair_p (espace)) - break_dist += gh_scm2double (gh_cdr (espace)); + break_dist += gh_scm2double (ly_cdr (espace)); if (!break_dist) break_dist = 1.0; @@ -199,7 +199,7 @@ New_spacing_spanner::breakable_column_spacing (Item* l, Item *r) // todo: naming of "distance" espace = l->get_grob_property ("stretch-distance"); if (gh_pair_p (espace)) - break_stretch += gh_scm2double (gh_cdr (espace)); + break_stretch += gh_scm2double (ly_cdr (espace)); if (!break_stretch) break_stretch = 1.0; @@ -471,8 +471,8 @@ New_spacing_spanner::stem_dir_correction (Grob*me, Grob*l, Grob*r) if (scm_ilength (dl) != 1 || scm_ilength (dr) != 1) return 0.; - dl = gh_car (dl); - dr = gh_car (dr); + dl = ly_car (dl); + dr = ly_car (dr); assert (gh_number_p (dl) && gh_number_p (dr)); int d1 = gh_scm2int (dl); diff --git a/lily/note-column.cc b/lily/note-column.cc index 6cf77b6d5e..9a0cdf8a9b 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -59,9 +59,9 @@ Note_column::head_positions_interval (Grob *me) iv.set_empty (); SCM h = me->get_grob_property ("note-heads"); - for (; gh_pair_p (h); h = gh_cdr (h)) + for (; gh_pair_p (h); h = ly_cdr (h)) { - Grob *se = unsmob_grob (gh_car (h)); + Grob *se = unsmob_grob (ly_car (h)); int j = int (Staff_symbol_referencer::position_f (se)); iv.unite (Slice (j,j)); diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc index 69d16f6c67..3877dad1d0 100644 --- a/lily/note-heads-engraver.cc +++ b/lily/note-heads-engraver.cc @@ -129,9 +129,13 @@ void Note_heads_engraver::start_translation_timestep () { - /* TODO:make this settable? + /* + TODO: make this settable? + + TODO: what if someone wants a line break in a grace note section?? */ - if (note_end_mom_ > now_mom ()) + // if (note_end_mom_ > now_mom ()) + if (note_end_mom_.main_part_ > now_mom ().main_part_) { Score_engraver * e = 0; Translator * t = daddy_grav_l (); diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 0fcdd18fc7..84bb78ff44 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -128,7 +128,7 @@ Paper_def::find_font (SCM fn, Real m) SCM met = scm_assoc (key, scaled_fonts_); if (gh_pair_p (met)) - return unsmob_metrics (gh_cdr (met)); + return unsmob_metrics (ly_cdr (met)); SCM ssc; if (scope_p_->try_retrieve (ly_symbol2scm ("outputscale"), &ssc)) @@ -155,7 +155,7 @@ Paper_def::font_descriptions ()const SCM l = SCM_EOL; - for (SCM s = scaled_fonts_; gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = scaled_fonts_; gh_pair_p (s); s = ly_cdr (s)) { SCM desc = gh_caar (s); SCM mdesc = unsmob_metrics (gh_cdar (s))->description_; diff --git a/lily/part-combine-music-iterator.cc b/lily/part-combine-music-iterator.cc index 65596d0ad3..bd18cb347b 100644 --- a/lily/part-combine-music-iterator.cc +++ b/lily/part-combine-music-iterator.cc @@ -126,9 +126,9 @@ get_music_info (Moment m, Music_iterator* iter, SCM *pitches, SCM *durations) { if (iter->ok ()) { - for (SCM i = iter->get_music (m); gh_pair_p (i); i = gh_cdr (i)) + for (SCM i = iter->get_music (m); gh_pair_p (i); i = ly_cdr (i)) { - Music *m = unsmob_music (gh_car (i)); + Music *m = unsmob_music (ly_car (i)); if (Melodic_req *r = dynamic_cast (m)) *pitches = gh_cons (r->get_mus_property ("pitch"), *pitches); if (Rhythmic_req *r = dynamic_cast (m)) @@ -152,8 +152,8 @@ Part_combine_music_iterator::get_state (Moment) if (!gh_pair_p (s)) return state; - Moment change_mom = *unsmob_moment (gh_car (s)); - Moment diff_mom = *unsmob_moment (gh_cdr (s)); + Moment change_mom = *unsmob_moment (ly_car (s)); + Moment diff_mom = *unsmob_moment (ly_cdr (s)); Moment now = pending_moment (); @@ -206,22 +206,22 @@ Part_combine_music_iterator::get_state (Moment) scm_sort_list_x (second_pitches, scm_primitive_eval (ly_str02scm ("Pitch::less_p"))); - interval = gh_int2scm (unsmob_pitch (gh_car (first_pitches))->steps () - - unsmob_pitch (gh_car (scm_last_pair (second_pitches)))->steps ()); + interval = gh_int2scm (unsmob_pitch (ly_car (first_pitches))->steps () + - unsmob_pitch (ly_car (scm_last_pair (second_pitches)))->steps ()); } if (first_durations != SCM_EOL) { scm_sort_list_x (first_durations, scm_primitive_eval (ly_str02scm ("Duration::less_p"))); - first_mom += unsmob_duration (gh_car (first_durations))->length_mom (); + first_mom += unsmob_duration (ly_car (first_durations))->length_mom (); } if (second_durations != SCM_EOL) { scm_sort_list_x (second_durations, scm_primitive_eval (ly_str02scm ("Duration::less_p"))); - second_mom += unsmob_duration (gh_car (second_durations))->length_mom (); + second_mom += unsmob_duration (ly_car (second_durations))->length_mom (); } if (first_pitches != SCM_EOL && second_pitches == SCM_EOL @@ -280,10 +280,10 @@ Part_combine_music_iterator::get_state (Moment) SCM s = first_translator->get_property (ly_symbol2scm ("splitInterval")); int i = gh_scm2int (interval); if (gh_pair_p (s) - && gh_number_p (gh_car (s)) - && gh_number_p (gh_cdr (s)) - && i >= gh_scm2int (gh_car (s)) - && i <= gh_scm2int (gh_cdr (s))) + && gh_number_p (ly_car (s)) + && gh_number_p (ly_cdr (s)) + && i >= gh_scm2int (ly_car (s)) + && i <= gh_scm2int (ly_cdr (s))) { if (! (state & ~ (SPLIT_INTERVAL | UNIRHYTHM | UNISON))) state |= SPLIT_INTERVAL; diff --git a/lily/performer-group-performer.cc b/lily/performer-group-performer.cc index 96e25b97d8..c13d65505c 100644 --- a/lily/performer-group-performer.cc +++ b/lily/performer-group-performer.cc @@ -28,9 +28,9 @@ Performer_group_performer::announce_element (Audio_element_info info) void Performer_group_performer::create_audio_elements () { - for (SCM p = simple_trans_list_; gh_pair_p (p); p = gh_cdr (p)) + for (SCM p = simple_trans_list_; gh_pair_p (p); p = ly_cdr (p)) { - Translator * t = unsmob_translator (gh_car (p)); + Translator * t = unsmob_translator (ly_car (p)); Performer * eng = dynamic_cast (t); if (eng) eng->create_audio_elements (); @@ -44,9 +44,9 @@ Performer_group_performer::acknowledge_audio_elements () { Audio_element_info info = announce_info_arr_[j]; - for (SCM p = simple_trans_list_; gh_pair_p (p); p = gh_cdr (p)) + for (SCM p = simple_trans_list_; gh_pair_p (p); p = ly_cdr (p)) { - Translator * t = unsmob_translator (gh_car (p)); + Translator * t = unsmob_translator (ly_car (p)); Performer * eng = dynamic_cast (t); if (eng && eng!= info.origin_trans_l_) eng->acknowledge_audio_element (info); @@ -57,9 +57,9 @@ Performer_group_performer::acknowledge_audio_elements () void Performer_group_performer::do_announces () { - for (SCM p = trans_group_list_; gh_pair_p (p); p =gh_cdr (p)) + for (SCM p = trans_group_list_; gh_pair_p (p); p =ly_cdr (p)) { - Translator * t = unsmob_translator (gh_car (p)); + Translator * t = unsmob_translator (ly_car (p)); dynamic_cast (t)->do_announces (); } diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index 0a57fa762c..df3238a635 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -162,7 +162,7 @@ Piano_pedal_engraver::create_grobs () else if (p->req_l_drul_[START]) { p->start_req_l_ = p->req_l_drul_[START]; - s = gh_car (strings); + s = ly_car (strings); } if (gh_string_p (s)) diff --git a/lily/pitch.cc b/lily/pitch.cc index aa7774debc..54d876cfa7 100644 --- a/lily/pitch.cc +++ b/lily/pitch.cc @@ -253,7 +253,7 @@ IMPLEMENT_SIMPLE_SMOBS (Pitch); int Pitch::print_smob (SCM s, SCM port, scm_print_state *) { - Pitch *r = (Pitch *) gh_cdr (s); + Pitch *r = (Pitch *) ly_cdr (s); scm_puts ("#str ().ch_C ()), port); @@ -265,8 +265,8 @@ Pitch::print_smob (SCM s, SCM port, scm_print_state *) SCM Pitch::equal_p (SCM a , SCM b) { - Pitch *p = (Pitch *) gh_cdr (a); - Pitch *q = (Pitch *) gh_cdr (b); + Pitch *p = (Pitch *) ly_cdr (a); + Pitch *q = (Pitch *) ly_cdr (b); bool eq = p->notename_i_ == q->notename_i_ && p->octave_i_ == q->octave_i_ diff --git a/lily/property-engraver.cc b/lily/property-engraver.cc index 6209637314..044f9613c4 100644 --- a/lily/property-engraver.cc +++ b/lily/property-engraver.cc @@ -60,10 +60,10 @@ Property_engraver::initialize () prop_dict_ = new Scheme_hash_table; SCM plist = get_property (ly_symbol2scm ("Generic_property_list")); - for (; gh_pair_p (plist); plist = gh_cdr (plist)) + for (; gh_pair_p (plist); plist = ly_cdr (plist)) { - SCM elt_props = gh_car (plist); - prop_dict_->set (gh_car (elt_props), gh_cdr (elt_props)); + SCM elt_props = ly_car (plist); + prop_dict_->set (ly_car (elt_props), ly_cdr (elt_props)); } } @@ -72,9 +72,9 @@ Property_engraver::acknowledge_grob (Grob_info i) { SCM ifs = i.elem_l_->get_grob_property ("interfaces"); SCM props; - for (; gh_pair_p (ifs); ifs = gh_cdr (ifs)) + for (; gh_pair_p (ifs); ifs = ly_cdr (ifs)) { - if (prop_dict_->try_retrieve (gh_car (ifs), &props)) + if (prop_dict_->try_retrieve (ly_car (ifs), &props)) { apply_properties (props,i.elem_l_, i.origin_trans_l_->daddy_trans_l_); } @@ -90,7 +90,7 @@ Property_engraver::acknowledge_grob (Grob_info i) void Property_engraver::apply_properties (SCM p, Grob *e, Translator_group*origin) { - for (; gh_pair_p (p); p = gh_cdr (p)) + for (; gh_pair_p (p); p = ly_cdr (p)) { /* Try each property in order; earlier descriptions take @@ -98,8 +98,8 @@ Property_engraver::apply_properties (SCM p, Grob *e, Translator_group*origin) they're already set. */ - SCM entry = gh_car (p); - SCM prop_sym = gh_car (entry); + SCM entry = ly_car (p); + SCM prop_sym = ly_car (entry); SCM type_p = gh_cadr (entry); SCM elt_prop_sym = gh_caddr (entry); @@ -121,7 +121,7 @@ Property_engraver::apply_properties (SCM p, Grob *e, Translator_group*origin) warning (_f ("`%s' is deprecated. Use\n \\property %s.%s \\override #'%s = #%s", ly_symbol2string (prop_sym).ch_C (), origin->type_str_.ch_C (), - ly_scm2string (gh_cdr (name)).ch_C (), + ly_scm2string (ly_cdr (name)).ch_C (), ly_symbol2string (elt_prop_sym).ch_C (), ly_scm2string (ly_write2scm (val)).ch_C ())); } diff --git a/lily/repeat-acknowledge-engraver.cc b/lily/repeat-acknowledge-engraver.cc index d4891d97ac..a134dad1ee 100644 --- a/lily/repeat-acknowledge-engraver.cc +++ b/lily/repeat-acknowledge-engraver.cc @@ -75,14 +75,14 @@ Repeat_acknowledge_engraver::process_music () bool volta_found = false; while (gh_pair_p (cs)) { - SCM command = gh_car (cs); + SCM command = ly_car (cs); if (command == ly_symbol2scm ("start-repeat")) start = true; else if (command == ly_symbol2scm ("end-repeat")) end = true; - else if (gh_pair_p (command) && gh_car (command) == ly_symbol2scm ("volta")) + else if (gh_pair_p (command) && ly_car (command) == ly_symbol2scm ("volta")) volta_found = true; - cs = gh_cdr (cs); + cs = ly_cdr (cs); } if (start && end) diff --git a/lily/repeated-music.cc b/lily/repeated-music.cc index 3935cc3a1d..13471ed256 100644 --- a/lily/repeated-music.cc +++ b/lily/repeated-music.cc @@ -40,8 +40,8 @@ Repeated_music::to_relative_octave (Pitch p) Pitch last = p ; if (alternatives ()) - for (SCM s = alternatives ()->music_list (); gh_pair_p (s); s = gh_cdr (s)) - unsmob_music (gh_car (s))->to_relative_octave (p); + for (SCM s = alternatives ()->music_list (); gh_pair_p (s); s = ly_cdr (s)) + unsmob_music (ly_car (s))->to_relative_octave (p); return last; @@ -82,10 +82,10 @@ Repeated_music::alternatives_length_mom (bool fold) const SCM p = alternatives ()->music_list (); while (gh_pair_p (p) && done < repeat_count ()) { - m = m + unsmob_music (gh_car (p))->length_mom (); + m = m + unsmob_music (ly_car (p))->length_mom (); done ++; if (repeat_count () - done < alternatives ()->length_i ()) - p = gh_cdr (p); + p = ly_cdr (p); } return m; } @@ -104,8 +104,8 @@ Repeated_music::alternatives_volta_length_mom () const SCM p = alternatives ()->music_list (); while (gh_pair_p (p)) { - m = m + unsmob_music (gh_car (p))->length_mom (); - p = gh_cdr (p); + m = m + unsmob_music (ly_car (p))->length_mom (); + p = ly_cdr (p); } return m; } diff --git a/lily/request-chord-iterator.cc b/lily/request-chord-iterator.cc index 9cee9ae4f4..e9a1038089 100644 --- a/lily/request-chord-iterator.cc +++ b/lily/request-chord-iterator.cc @@ -53,9 +53,9 @@ Request_chord_iterator::get_music (Moment) const { Music_sequence * ms = dynamic_cast (music_l ()); - for (SCM m = ms->music_list (); gh_pair_p (m); m = gh_cdr (m)) + for (SCM m = ms->music_list (); gh_pair_p (m); m = ly_cdr (m)) { - s = gh_cons (gh_car (m) , s); + s = gh_cons (ly_car (m) , s); } } return s; @@ -67,9 +67,9 @@ Request_chord_iterator::process (Moment m) if (last_processed_mom_ < Moment (0)) { for (SCM s = dynamic_cast (music_l ())->music_list (); - gh_pair_p (s); s = gh_cdr (s)) + gh_pair_p (s); s = ly_cdr (s)) { - Music *mus = unsmob_music (gh_car (s)); + Music *mus = unsmob_music (ly_car (s)); bool gotcha = try_music (mus); if (!gotcha) diff --git a/lily/request-chord.cc b/lily/request-chord.cc index 084042f021..50835d2946 100644 --- a/lily/request-chord.cc +++ b/lily/request-chord.cc @@ -21,9 +21,9 @@ Request_chord::Request_chord () Pitch Request_chord::to_relative_octave (Pitch last) { - for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = music_list (); gh_pair_p (s); s = ly_cdr (s)) { - Music * mus = unsmob_music (gh_car (s)); + Music * mus = unsmob_music (ly_car (s)); if (Melodic_req *m= dynamic_cast (mus)) { Pitch pit = *unsmob_pitch (m->get_mus_property ("pitch")); diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 591d90b386..e81cef8495 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -90,10 +90,10 @@ Rest_collision::do_shift (Grob *me, SCM elts) Link_array rests; Link_array notes; Grob * commony = 0; - for (SCM s = elts; gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = elts; gh_pair_p (s); s = ly_cdr (s)) { - Grob * e = unsmob_grob (gh_car (s)); + Grob * e = unsmob_grob (ly_car (s)); if (!e) continue; diff --git a/lily/scaled-font-metric.cc b/lily/scaled-font-metric.cc index 7077965c8f..cf3bb64db0 100644 --- a/lily/scaled-font-metric.cc +++ b/lily/scaled-font-metric.cc @@ -17,8 +17,8 @@ Scaled_font_metric::Scaled_font_metric (Font_metric* m, Real magn) magnification_f_ = magn; SCM desc = m->description_; - Real total_mag = magn * gh_scm2double (gh_cdr (desc)); - description_ = gh_cons (gh_car (desc), gh_double2scm (total_mag)); + Real total_mag = magn * gh_scm2double (ly_cdr (desc)); + description_ = gh_cons (ly_car (desc), gh_double2scm (total_mag)); orig_l_ = m; } diff --git a/lily/score.cc b/lily/score.cc index 9ab1dbe428..0b6680ae95 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -51,7 +51,7 @@ Score::Score (Score const &s) /* TODO: this is not very elegant.... */ - store_locations_global_b = (gh_eval_str ("point-and-click") != SCM_BOOL_F); + store_locations_global_b = (scm_c_eval_string ("point-and-click") != SCM_BOOL_F); Music * m =unsmob_music (s.music_); music_ = m?m->clone ()->self_scm () : SCM_EOL; diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 17aec42ba0..ef0c8266af 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -69,21 +69,21 @@ Script_engraver::process_music () } // todo -> use result of articulation-to-scriptdef directly as basic prop list. Grob *p =new Item (get_property ("Script")); - art = gh_cdr (art); - p->set_grob_property ("molecule", gh_car (art)); + art = ly_cdr (art); + p->set_grob_property ("molecule", ly_car (art)); - art = gh_cdr (art); - bool follow_staff = gh_scm2bool (gh_car (art)); - art = gh_cdr (art); - SCM relative_stem_dir = gh_car (art); - art = gh_cdr (art); + art = ly_cdr (art); + bool follow_staff = gh_scm2bool (ly_car (art)); + art = ly_cdr (art); + SCM relative_stem_dir = ly_car (art); + art = ly_cdr (art); SCM force_dir = l->get_mus_property ("direction"); if (isdir_b (force_dir) && !to_dir (force_dir)) - force_dir = gh_car (art); + force_dir = ly_car (art); - art = gh_cdr (art); - SCM priority = gh_car (art); + art = ly_cdr (art); + SCM priority = ly_car (art); if (isdir_b (force_dir) && to_dir (force_dir)) p->set_grob_property ("direction", force_dir); diff --git a/lily/script.cc b/lily/script.cc index 2a43afc134..1579f0b97a 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -22,15 +22,15 @@ Script::get_molecule (Grob * me, Direction d) SCM s = me->get_grob_property ("molecule"); assert (gh_pair_p (s)); - SCM key = gh_car (s); + SCM key = ly_car (s); if (key == ly_symbol2scm ("feta")) { return Font_interface::get_default_font (me)->find_by_name ("scripts-" + - ly_scm2string (index_cell (gh_cdr (s), d))); + ly_scm2string (index_cell (ly_cdr (s), d))); } else if (key == ly_symbol2scm ("accordion")) { - return Lookup::accordion (gh_cdr (s), 1.0, Font_interface::get_default_font (me)); + return Lookup::accordion (ly_cdr (s), 1.0, Font_interface::get_default_font (me)); } else assert (false); diff --git a/lily/separating-group-spanner.cc b/lily/separating-group-spanner.cc index 9a1c85d51b..89bceab5d4 100644 --- a/lily/separating-group-spanner.cc +++ b/lily/separating-group-spanner.cc @@ -25,9 +25,9 @@ Separating_group_spanner::find_rods (Item * r, SCM next) This is an inner loop, however, in most cases, the interesting L will just be the first entry of NEXT, making it linear in most of the cases. */ - for(; gh_pair_p (next); next = gh_cdr (next)) + for(; gh_pair_p (next); next = ly_cdr (next)) { - Item *l = dynamic_cast (unsmob_grob (gh_car( next))); + Item *l = dynamic_cast (unsmob_grob (ly_car( next))); Item *lb = l->find_prebroken_piece (RIGHT); if (lb) @@ -77,12 +77,12 @@ Separating_group_spanner::set_spacing_rods (SCM smob) { Grob*me = unsmob_grob (smob); - for (SCM s = me->get_grob_property ("elements"); gh_pair_p (s) && gh_pair_p (gh_cdr (s)); s = gh_cdr (s)) + for (SCM s = me->get_grob_property ("elements"); gh_pair_p (s) && gh_pair_p (ly_cdr (s)); s = ly_cdr (s)) { /* Order of elements is reversed! */ - SCM elt = gh_car (s); + SCM elt = ly_car (s); Item *r = dynamic_cast (unsmob_grob (elt)); if (!r) @@ -91,9 +91,9 @@ Separating_group_spanner::set_spacing_rods (SCM smob) Item *rb = dynamic_cast (r->find_prebroken_piece (LEFT)); - find_rods (r, gh_cdr (s)); + find_rods (r, ly_cdr (s)); if (rb) - find_rods (rb, gh_cdr (s)); + find_rods (rb, ly_cdr (s)); } find_musical_sequences (me); @@ -104,9 +104,9 @@ Separating_group_spanner::set_spacing_rods (SCM smob) /* We've done our job, so we get lost. */ - for (SCM s = me->get_grob_property ("elements"); gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = me->get_grob_property ("elements"); gh_pair_p (s); s = ly_cdr (s)) { - Item * it =dynamic_cast (unsmob_grob (gh_car (s))); + Item * it =dynamic_cast (unsmob_grob (ly_car (s))); if (it && it->broken_b ()) { it->find_prebroken_piece (LEFT) ->suicide (); @@ -133,9 +133,9 @@ Separating_group_spanner::find_musical_sequences (Grob *me) Item *last = 0; Item *llast = 0; for (SCM s = me->get_grob_property ("elements"); - gh_pair_p (s); s = gh_cdr (s)) + gh_pair_p (s); s = ly_cdr (s)) { - Item *it = dynamic_cast (unsmob_grob (gh_car (s))); + Item *it = dynamic_cast (unsmob_grob (ly_car (s))); if (last) { Item *lcol = last->column_l (); @@ -178,12 +178,12 @@ Separating_group_spanner::find_musical_sequences (Grob *me) } Item * left - = dynamic_cast (unsmob_grob (gh_car (between))); + = dynamic_cast (unsmob_grob (ly_car (between))); if(Paper_column::rank_i (left->column_l ()) < rank) gh_set_car_x (between, col->self_scm()); Item * right - = dynamic_cast (unsmob_grob (gh_cdr (between))); + = dynamic_cast (unsmob_grob (ly_cdr (between))); if (Paper_column::rank_i (right->column_l ()) > llrank ) gh_set_cdr_x (between, llcol->self_scm ()); } diff --git a/lily/separation-item.cc b/lily/separation-item.cc index 522cde9ac1..2c48a34771 100644 --- a/lily/separation-item.cc +++ b/lily/separation-item.cc @@ -34,9 +34,9 @@ Separation_item::my_width (Grob *me) Paper_column * pc = item->column_l (); Interval w; - for (SCM s = me->get_grob_property ("elements"); gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = me->get_grob_property ("elements"); gh_pair_p (s); s = ly_cdr (s)) { - SCM elt = gh_car (s); + SCM elt = ly_car (s); if (!unsmob_grob (elt)) continue; diff --git a/lily/sequential-music-iterator.cc b/lily/sequential-music-iterator.cc index f37320caf0..e77983a529 100644 --- a/lily/sequential-music-iterator.cc +++ b/lily/sequential-music-iterator.cc @@ -39,7 +39,7 @@ if (gh_pair_p (cursor_)) - iter_p_->music_l_ == unsmob_music (gh_car (cursor_)) + iter_p_->music_l_ == unsmob_music (ly_car (cursor_)) else iter_p_ == 0; @@ -94,9 +94,9 @@ get_grace_fixups (SCM cursor) Grace_fixup *head = 0; Grace_fixup **tail = &head; - for (; gh_pair_p (cursor); cursor = gh_cdr (cursor)) + for (; gh_pair_p (cursor); cursor = ly_cdr (cursor)) { - Music * mus = unsmob_music (gh_car (cursor)); + Music * mus = unsmob_music (ly_car (cursor)); Moment s = mus->start_mom (); Moment l =mus->length_mom () - s; @@ -130,7 +130,7 @@ Sequential_music_iterator::construct_children () { cursor_ = dynamic_cast (music_l ())->music_list (); - iter_p_ = gh_pair_p (cursor_) ? get_iterator_p (unsmob_music (gh_car (cursor_))) : 0; + iter_p_ = gh_pair_p (cursor_) ? get_iterator_p (unsmob_music (ly_car (cursor_))) : 0; while (iter_p_ && !iter_p_->ok ()) { next_element (); @@ -184,10 +184,10 @@ Sequential_music_iterator::next_element () } delete iter_p_; - cursor_ = gh_cdr (cursor_); + cursor_ = ly_cdr (cursor_); if (gh_pair_p (cursor_)) - iter_p_ = get_iterator_p (unsmob_music (gh_car (cursor_))); + iter_p_ = get_iterator_p (unsmob_music (ly_car (cursor_))); else iter_p_ = 0; } @@ -244,9 +244,9 @@ Sequential_music_iterator::get_music (Moment until)const s = gh_append2 (nm, s); Moment m = 0; - for (SCM i = nm; gh_pair_p (i); i = gh_cdr (i)) + for (SCM i = nm; gh_pair_p (i); i = ly_cdr (i)) { - Music *mus=unsmob_music (gh_car (i)); + Music *mus=unsmob_music (ly_car (i)); m = m >? (mus->length_mom () - mus->start_mom ()); } if (m > Moment (0)) diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 2bef230ec6..00cf117a5f 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -80,17 +80,17 @@ Side_position_interface::general_side_position (Grob * me, Axis a, bool use_exte */ SCM support = me->get_grob_property ("side-support-elements"); // me->remove_grob_property ("side-support-elements"); - for (SCM s = support; s != SCM_EOL; s = gh_cdr (s)) + for (SCM s = support; s != SCM_EOL; s = ly_cdr (s)) { - Grob * e = unsmob_grob (gh_car (s)); + Grob * e = unsmob_grob (ly_car (s)); if (e) common = common->common_refpoint (e, a); } Interval dim; - for (SCM s = support; s != SCM_EOL; s = gh_cdr (s)) + for (SCM s = support; s != SCM_EOL; s = ly_cdr (s)) { - Grob * e = unsmob_grob (gh_car (s)); + Grob * e = unsmob_grob (ly_car (s)); if (e) if (use_extents) dim.unite (e->extent (common, a)); diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index 6671a6edb6..9a28be14ca 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -180,7 +180,7 @@ Simple_spacer::add_columns (Link_array cols) SCM spring_params = SCM_EOL; for (SCM s = cols[i]->get_grob_property ("ideal-distances"); !gh_pair_p (spring_params) && gh_pair_p (s); - s = gh_cdr (s)) + s = ly_cdr (s)) { Grob *other = unsmob_grob (gh_caar (s)); if (other != cols[i+1]) @@ -192,8 +192,8 @@ Simple_spacer::add_columns (Link_array cols) Spring_description desc; if (gh_pair_p (spring_params)) { - desc.ideal_f_ = gh_scm2double (gh_car (spring_params)); - desc.hooke_f_ = gh_scm2double (gh_cdr (spring_params)); + desc.ideal_f_ = gh_scm2double (ly_car (spring_params)); + desc.hooke_f_ = gh_scm2double (ly_cdr (spring_params)); } else { @@ -221,7 +221,7 @@ Simple_spacer::add_columns (Link_array cols) for (int i=0; i < cols.size () - 1; i++) { for (SCM s = Spaceable_grob::get_minimum_distances (cols[i]); - gh_pair_p (s); s = gh_cdr (s)) + gh_pair_p (s); s = ly_cdr (s)) { Grob * other = unsmob_grob (gh_caar (s)); int oi = cols.find_i (other); diff --git a/lily/simultaneous-music-iterator.cc b/lily/simultaneous-music-iterator.cc index d72c81cea1..390849e226 100644 --- a/lily/simultaneous-music-iterator.cc +++ b/lily/simultaneous-music-iterator.cc @@ -52,9 +52,9 @@ Simultaneous_music_iterator::construct_children () Music_sequence const *sim = dynamic_cast (music_l ()); SCM i = sim->music_list (); - for (; gh_pair_p (i); i = gh_cdr (i), j++) + for (; gh_pair_p (i); i = ly_cdr (i), j++) { - Music *mus = unsmob_music (gh_car (i)); + Music *mus = unsmob_music (ly_car (i)); Music_iterator * mi = static_get_iterator_p (mus); /* if separate_contexts_b_ is set, create a new context with the diff --git a/lily/slur-bezier-bow.cc b/lily/slur-bezier-bow.cc index b5f0db22d7..8c1babb399 100644 --- a/lily/slur-bezier-bow.cc +++ b/lily/slur-bezier-bow.cc @@ -154,11 +154,11 @@ Slur_bezier_bow::minimise_enclosed_area (Real beauty, if (fit_factor () > 1.0) blow_fit (); - Real pct_c0 = gh_scm2double (gh_cdr (scm_assoc (ly_symbol2scm ("bezier-pct-c0"), bezier_props))); - Real pct_c3 = gh_scm2double (gh_cdr (scm_assoc (ly_symbol2scm ("bezier-pct-c3"), bezier_props))); - Real pct_in_max = gh_scm2double (gh_cdr (scm_assoc (ly_symbol2scm ("bezier-pct-in-max"), bezier_props))); - Real pct_out_max = gh_scm2double (gh_cdr (scm_assoc (ly_symbol2scm ("bezier-pct-out-max"), bezier_props))); - Real steps = gh_scm2double (gh_cdr (scm_assoc (ly_symbol2scm ("bezier-area-steps"),bezier_props))); + Real pct_c0 = gh_scm2double (ly_cdr (scm_assoc (ly_symbol2scm ("bezier-pct-c0"), bezier_props))); + Real pct_c3 = gh_scm2double (ly_cdr (scm_assoc (ly_symbol2scm ("bezier-pct-c3"), bezier_props))); + Real pct_in_max = gh_scm2double (ly_cdr (scm_assoc (ly_symbol2scm ("bezier-pct-in-max"), bezier_props))); + Real pct_out_max = gh_scm2double (ly_cdr (scm_assoc (ly_symbol2scm ("bezier-pct-out-max"), bezier_props))); + Real steps = gh_scm2double (ly_cdr (scm_assoc (ly_symbol2scm ("bezier-area-steps"),bezier_props))); for (int i=0; i < steps; i++) { diff --git a/lily/slur.cc b/lily/slur.cc index d48c91d7b6..f2035877bd 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -69,7 +69,7 @@ Slur::de_uglyfy (Grob*me, Slur_bezier_bow* bb, Real default_height) Real f = default_height / length; SCM up = me->get_grob_property ("de-uglify-parameters"); - Real c1 = gh_scm2double (gh_car (up)); + Real c1 = gh_scm2double (ly_car (up)); Real c2 = gh_scm2double (gh_cadr (up)); Real c3 = gh_scm2double (gh_caddr (up)); @@ -178,7 +178,7 @@ Slur::set_extremities (Grob *me) if (!gh_symbol_p (index_cell (me->get_grob_property ("attachment"), dir))) { for (SCM s = me->get_grob_property ("extremity-rules"); - s != SCM_EOL; s = gh_cdr (s)) + s != SCM_EOL; s = ly_cdr (s)) { SCM r = gh_call2 (gh_caar (s), me->self_scm (), gh_int2scm ((int)dir)); @@ -201,10 +201,10 @@ Real Slur::get_first_notecolumn_y (Grob *me, Direction dir) { Grob *col = dir == LEFT - ? unsmob_grob (gh_car (scm_reverse (me->get_grob_property + ? unsmob_grob (ly_car (scm_reverse (me->get_grob_property ("note-columns")))) : unsmob_grob - (gh_car (me->get_grob_property ("note-columns"))); + (ly_car (me->get_grob_property ("note-columns"))); Grob *common[] = { @@ -267,7 +267,7 @@ Slur::get_attachment (Grob *me, Direction dir, set_extremities (me); s = me->get_grob_property ("attachment"); } - SCM a = dir == LEFT ? gh_car (s) : gh_cdr (s); + SCM a = dir == LEFT ? ly_car (s) : ly_cdr (s); Spanner*sp = dynamic_cast (me); String str = ly_symbol2string (a); Real staff_space = Staff_symbol_referencer::staff_space ((Grob*)me); @@ -327,7 +327,7 @@ Slur::get_attachment (Grob *me, Direction dir, Hmm, maybe after-line-breaking should set this to loose-end? */ else // if (str == "loose-end") { - SCM other_a = dir == LEFT ? gh_cdr (s) : gh_car (s); + SCM other_a = dir == LEFT ? ly_cdr (s) : ly_car (s); if (ly_symbol2string (other_a) != "loose-end") o = broken_trend_offset (me, dir); } @@ -343,7 +343,7 @@ Slur::get_attachment (Grob *me, Direction dir, if (l != SCM_BOOL_F) { - Offset off = ly_scm2offset (gh_cdr (l)) * staff_space; + Offset off = ly_scm2offset (ly_cdr (l)) * staff_space; off[X_AXIS] *= dir; off[Y_AXIS] *= Directional_element_interface::get (me); o += off; @@ -431,8 +431,8 @@ Slur::get_encompass_offset_arr (Grob *me) Link_array encompass_arr; while (gh_pair_p (eltlist)) { - encompass_arr.push (unsmob_grob (gh_car (eltlist))); - eltlist =gh_cdr (eltlist); + encompass_arr.push (unsmob_grob (ly_car (eltlist))); + eltlist =ly_cdr (eltlist); } encompass_arr.reverse (); @@ -545,8 +545,8 @@ Slur::set_control_points (Grob*me) SCM h_inf_scm = scm_assq (ly_symbol2scm ("height-limit"), details); SCM r_0_scm = scm_assq (ly_symbol2scm ("ratio"), details); - Real r_0 = gh_scm2double (gh_cdr (r_0_scm)); - Real h_inf = staff_space * gh_scm2double (gh_cdr (h_inf_scm)); + Real r_0 = gh_scm2double (ly_cdr (r_0_scm)); + Real h_inf = staff_space * gh_scm2double (ly_cdr (h_inf_scm)); Slur_bezier_bow bb (get_encompass_offset_arr (me), Directional_element_interface::get (me), @@ -565,8 +565,8 @@ Slur::set_control_points (Grob*me) bb.minimise_enclosed_area (sb, details); SCM sbf = scm_assq (ly_symbol2scm ("force-blowfit"), details); Real bff = 1.0; - if (gh_pair_p (sbf) && gh_number_p (gh_cdr (sbf))) - bff = gh_scm2double (gh_cdr (sbf)); + if (gh_pair_p (sbf) && gh_number_p (ly_cdr (sbf))) + bff = gh_scm2double (ly_cdr (sbf)); bb.curve_.control_[1][Y_AXIS] *= bff; bb.curve_.control_[2][Y_AXIS] *= bff; @@ -622,9 +622,9 @@ Slur::get_curve (Grob*me) if (!scm_ilength (me->get_grob_property ("note-columns"))) return b; - for (SCM s= me->get_grob_property ("control-points"); s != SCM_EOL; s = gh_cdr (s)) + for (SCM s= me->get_grob_property ("control-points"); s != SCM_EOL; s = ly_cdr (s)) { - b.control_[i] = ly_scm2offset (gh_car (s)); + b.control_[i] = ly_scm2offset (ly_car (s)); i++; } diff --git a/lily/spaceable-grob.cc b/lily/spaceable-grob.cc index 26bf4e8066..ec1e0430c0 100644 --- a/lily/spaceable-grob.cc +++ b/lily/spaceable-grob.cc @@ -24,12 +24,12 @@ Spaceable_grob::add_rod (Grob *me , Grob * p, Real d) { SCM mins = get_minimum_distances (me); SCM newdist = gh_double2scm (d); - for (SCM s = mins; gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = mins; gh_pair_p (s); s = ly_cdr (s)) { - SCM dist = gh_car (s); - if (gh_car (dist) == p->self_scm ()) + SCM dist = ly_car (s); + if (ly_car (dist) == p->self_scm ()) { - gh_set_cdr_x (dist, scm_max (gh_cdr (dist), + gh_set_cdr_x (dist, scm_max (ly_cdr (dist), newdist)); return ; } @@ -46,10 +46,10 @@ Spaceable_grob::add_spring (Grob*me, Grob * p, Real d, Real strength) SCM newdist= gh_double2scm (d); - for (SCM s = mins; gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = mins; gh_pair_p (s); s = ly_cdr (s)) { - SCM dist = gh_car (s); - if (gh_car (dist) == p->self_scm ()) + SCM dist = ly_car (s); + if (ly_car (dist) == p->self_scm ()) { programming_error ("already have that spring"); return ; diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 472fa6732b..6a0a62806e 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -181,7 +181,7 @@ Spacing_spanner::do_measure (Grob*me, Link_array const & cols) Real left_distance = 0; if (gh_pair_p (hint)) { - left_distance = gh_scm2double (gh_cdr (hint)); + left_distance = gh_scm2double (ly_cdr (hint)); } // 2nd condition should be (i+1 < col_count ()), ie. not the last column in score. FIXME else if (!Paper_column::musical_b (lc) && i+1 < cols.size ()) @@ -218,7 +218,7 @@ Spacing_spanner::do_measure (Grob*me, Link_array const & cols) Real right_dist = 0.0; if (gh_pair_p (next_hint)) { - right_dist += - gh_scm2double (gh_car (next_hint)); + right_dist += - gh_scm2double (ly_car (next_hint)); } else { @@ -247,7 +247,7 @@ Spacing_spanner::do_measure (Grob*me, Link_array const & cols) if (gh_pair_p (next_stretch_hint)) // see regtest spacing-tight - stretch_dist += - gh_scm2double (gh_car (next_stretch_hint)); + stretch_dist += - gh_scm2double (ly_car (next_stretch_hint)); else stretch_dist += right_dist; @@ -524,8 +524,8 @@ Spacing_spanner::stem_dir_correction (Grob*me, Grob*l, Grob*r) if (scm_ilength (dl) != 1 || scm_ilength (dr) != 1) return 0.; - dl = gh_car (dl); - dr = gh_car (dr); + dl = ly_car (dl); + dr = ly_car (dr); assert (gh_number_p (dl) && gh_number_p (dr)); int d1 = gh_scm2int (dl); diff --git a/lily/span-arpeggio-engraver.cc b/lily/span-arpeggio-engraver.cc index 674debdd16..75e3779ab1 100644 --- a/lily/span-arpeggio-engraver.cc +++ b/lily/span-arpeggio-engraver.cc @@ -82,11 +82,11 @@ Span_arpeggio_engraver::stop_translation_timestep () for (int i=0; i < arpeggios_.size (); i ++) { for (SCM s = arpeggios_[i]->get_grob_property ("stems"); - gh_pair_p (s); s = gh_cdr (s)) - Group_interface::add_thing (span_arpeggio_, "stems", gh_car (s)); + gh_pair_p (s); s = ly_cdr (s)) + Group_interface::add_thing (span_arpeggio_, "stems", ly_car (s)); for (SCM s = arpeggios_[i]->get_grob_property ("side-support-elements"); - gh_pair_p (s); s = gh_cdr (s)) - Group_interface::add_thing (span_arpeggio_, "side-support-elements", gh_car (s)); + gh_pair_p (s); s = ly_cdr (s)) + Group_interface::add_thing (span_arpeggio_, "side-support-elements", ly_car (s)); /* we can't kill the children, since we don't want to the diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 61e1f097ea..01020ca626 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -55,9 +55,9 @@ Span_bar::brew_molecule (SCM smobbed_me) // compute common refpoint of elements Grob *refp = me; - for (SCM elts = first_elt; gh_pair_p (elts); elts = gh_cdr (elts)) + for (SCM elts = first_elt; gh_pair_p (elts); elts = ly_cdr (elts)) { - SCM smobbed_staff_bar = gh_car (elts); + SCM smobbed_staff_bar = ly_car (elts); Grob *staff_bar = unsmob_grob (smobbed_staff_bar); refp = staff_bar->common_refpoint (refp, Y_AXIS); } @@ -78,9 +78,9 @@ Span_bar::brew_molecule (SCM smobbed_me) Molecule span_bar_mol; Interval prev_extent; - for (SCM elts = first_elt; gh_pair_p (elts); elts = gh_cdr (elts)) + for (SCM elts = first_elt; gh_pair_p (elts); elts = ly_cdr (elts)) { - SCM smobbed_staff_bar = gh_car (elts); + SCM smobbed_staff_bar = ly_car (elts); Grob *staff_bar = unsmob_grob (smobbed_staff_bar); Interval ext = staff_bar->extent (refp, Y_AXIS); if (ext.empty_b ()) @@ -177,7 +177,7 @@ void Span_bar::evaluate_glyph (Grob*me) { SCM elts = me->get_grob_property ("elements"); - Grob * b = unsmob_grob (gh_car (elts)); + Grob * b = unsmob_grob (ly_car (elts)); SCM glsym =ly_symbol2scm ("glyph"); SCM gl =b ->get_grob_property (glsym); if (!gh_string_p (gl)) diff --git a/lily/spanner.cc b/lily/spanner.cc index 32ae0ed5c1..6f5504a556 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -320,8 +320,8 @@ extend_spanner_over_item (Item *it, SCM extremal_pair) if (!it) return; Item * col = it->column_l (); - Item * i1 = dynamic_cast (unsmob_grob (gh_car (extremal_pair))); - Item * i2 = dynamic_cast (unsmob_grob (gh_cdr (extremal_pair))); + Item * i1 = dynamic_cast (unsmob_grob (ly_car (extremal_pair))); + Item * i2 = dynamic_cast (unsmob_grob (ly_cdr (extremal_pair))); int r = Paper_column::rank_i (col); if (!i1 || r < Paper_column::rank_i (i1->column_l ())) { @@ -341,8 +341,8 @@ extend_spanner_over_elements (SCM value, SCM extremal_pair) { if (gh_pair_p (value)) { - extend_spanner_over_elements (gh_car (value), extremal_pair); - extend_spanner_over_elements (gh_cdr (value), extremal_pair); + extend_spanner_over_elements (ly_car (value), extremal_pair); + extend_spanner_over_elements (ly_cdr (value), extremal_pair); } else if (unsmob_grob (value)) { @@ -375,8 +375,8 @@ extend_spanner_over_elements (Grob*s) SCM pair = gh_cons (s1,s2); extend_spanner_over_elements (sp->mutable_property_alist_, pair); - Grob *p1 = unsmob_grob (gh_car (pair)); - Grob* p2 = unsmob_grob (gh_cdr (pair)); + Grob *p1 = unsmob_grob (ly_car (pair)); + Grob* p2 = unsmob_grob (ly_cdr (pair)); sp->set_bound (LEFT,p1); sp->set_bound (RIGHT, p2); } diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index 7d7cdd5af1..b7b7bfc9c7 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -110,8 +110,8 @@ Text_spanner::brew_molecule (SCM smob) SCM s = me->get_grob_property ("shorten"); if (gh_pair_p (s)) { - shorten[LEFT] = gh_scm2double (gh_car (s)); - shorten[RIGHT] = gh_scm2double (gh_cdr (s)); + shorten[LEFT] = gh_scm2double (ly_car (s)); + shorten[RIGHT] = gh_scm2double (ly_cdr (s)); } width -= shorten[LEFT] + shorten[RIGHT]; diff --git a/lily/tie.cc b/lily/tie.cc index ae2be9fc11..bb011b973d 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -180,8 +180,8 @@ Tie::get_control_points (SCM smob) SCM lim // groetjes aan de chirurgendochter. = scm_assq (ly_symbol2scm ("height-limit"),details); - Real h_inf = gh_scm2double (gh_cdr (lim)) * staff_space; - Real r_0 = gh_scm2double (gh_cdr (scm_assq (ly_symbol2scm ("ratio"),details))); + Real h_inf = gh_scm2double (ly_cdr (lim)) * staff_space; + Real r_0 = gh_scm2double (ly_cdr (scm_assq (ly_symbol2scm ("ratio"),details))); Bezier b = slur_shape (width, h_inf, r_0); @@ -299,9 +299,9 @@ Tie::brew_molecule (SCM smob) Bezier b; int i = 0; - for (SCM s= cp; s != SCM_EOL; s = gh_cdr (s)) + for (SCM s= cp; s != SCM_EOL; s = ly_cdr (s)) { - b.control_[i] = ly_scm2offset (gh_car (s)); + b.control_[i] = ly_scm2offset (ly_car (s)); i++; } diff --git a/lily/time-signature-performer.cc b/lily/time-signature-performer.cc index a8ce824d56..c518f96ed6 100644 --- a/lily/time-signature-performer.cc +++ b/lily/time-signature-performer.cc @@ -49,8 +49,8 @@ Time_signature_performer::create_audio_elements () if (gh_pair_p (fr) && !gh_equal_p (fr, prev_fraction_)) { prev_fraction_ = fr; - int b = gh_scm2int (gh_car (fr)); - int o = gh_scm2int (gh_cdr (fr)); + int b = gh_scm2int (ly_car (fr)); + int o = gh_scm2int (ly_cdr (fr)); audio_p_ = new Audio_time_signature (b,o); Audio_element_info info (audio_p_, 0); diff --git a/lily/time-signature.cc b/lily/time-signature.cc index 8e516e8ccd..2f96d04f7e 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -28,8 +28,8 @@ Time_signature::brew_molecule (SCM smob) int d = 4; if (gh_pair_p (frac)) { - n = gh_scm2int (gh_car (frac)); - d = gh_scm2int (gh_cdr (frac)); + n = gh_scm2int (ly_car (frac)); + d = gh_scm2int (ly_cdr (frac)); } diff --git a/lily/translator-group.cc b/lily/translator-group.cc index b91088d5a0..763bdc8997 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -52,9 +52,9 @@ Translator_group::check_removal () SCM next = SCM_EOL; for (SCM p = trans_group_list_; gh_pair_p (p); p = next) { - next = gh_cdr (p); + next = ly_cdr (p); - Translator_group *trg = dynamic_cast (unsmob_translator (gh_car (p))); + Translator_group *trg = dynamic_cast (unsmob_translator (ly_car (p))); trg->check_removal (); if (trg->removable_b ()) @@ -98,9 +98,9 @@ Translator_group::find_existing_translator_l (String n, String id) return this; Translator_group* r = 0; - for (SCM p = trans_group_list_; !r && gh_pair_p (p); p = gh_cdr (p)) + for (SCM p = trans_group_list_; !r && gh_pair_p (p); p = ly_cdr (p)) { - Translator * t = unsmob_translator (gh_car (p)); + Translator * t = unsmob_translator (ly_car (p)); r = dynamic_cast (t)->find_existing_translator_l (n, id); } @@ -153,9 +153,9 @@ Translator_group::try_music_on_nongroup_children (Music *m) { bool hebbes_b =false; - for (SCM p = simple_trans_list_; !hebbes_b && gh_pair_p (p); p = gh_cdr (p)) + for (SCM p = simple_trans_list_; !hebbes_b && gh_pair_p (p); p = ly_cdr (p)) { - hebbes_b = unsmob_translator (gh_car (p))->try_music (m); + hebbes_b = unsmob_translator (ly_car (p))->try_music (m); } return hebbes_b; } @@ -244,8 +244,8 @@ Translator_group::get_default_interpreter () static void static_each (SCM list, Method_pointer method) { - for (SCM p = list; gh_pair_p (p); p = gh_cdr (p)) - (unsmob_translator (gh_car (p))->*method) (); + for (SCM p = list; gh_pair_p (p); p = ly_cdr (p)) + (unsmob_translator (ly_car (p))->*method) (); } @@ -348,13 +348,13 @@ Translator_group::execute_single_pushpop_property (SCM prop, SCM eltprop, SCM va SCM newprops= SCM_EOL ; while (gh_pair_p (prev) && gh_caar (prev) != eltprop) { - newprops = gh_cons (gh_car (prev), newprops); - prev = gh_cdr (prev); + newprops = gh_cons (ly_car (prev), newprops); + prev = ly_cdr (prev); } if (gh_pair_p (prev)) { - newprops = scm_reverse_x (newprops, gh_cdr (prev)); + newprops = scm_reverse_x (newprops, ly_cdr (prev)); set_property (prop, newprops); } } diff --git a/lily/translator.cc b/lily/translator.cc index 03adb249f9..a2e780f31d 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -59,8 +59,8 @@ Translator::is_alias_b (String s) const bool b = s == type_str_; for (SCM a = unsmob_translator_def (definition_)->type_aliases_; - !b && gh_pair_p (a); a = gh_cdr (a)) - b = b || s == ly_scm2string (gh_car (a)); + !b && gh_pair_p (a); a = ly_cdr (a)) + b = b || s == ly_scm2string (ly_car (a)); return b; } @@ -162,7 +162,7 @@ Translator::mark_smob (SCM sm) int Translator::print_smob (SCM s, SCM port, scm_print_state *) { - Translator *sc = (Translator *) gh_cdr (s); + Translator *sc = (Translator *) ly_cdr (s); scm_puts ("#name (), port); diff --git a/lily/volta-engraver.cc b/lily/volta-engraver.cc index 6feb88b12d..68d849c1c2 100644 --- a/lily/volta-engraver.cc +++ b/lily/volta-engraver.cc @@ -57,10 +57,10 @@ Volta_engraver::process_music () start_str_ = SCM_EOL; while (gh_pair_p (cs)) { - SCM c = gh_car (cs); + SCM c = ly_car (cs); - if (gh_pair_p (c) && gh_car (c) == ly_symbol2scm ("volta") - && gh_pair_p (gh_cdr (c))) + if (gh_pair_p (c) && ly_car (c) == ly_symbol2scm ("volta") + && gh_pair_p (ly_cdr (c))) { if (gh_cadr (c) == SCM_BOOL_F) end = true; @@ -68,7 +68,7 @@ Volta_engraver::process_music () start_str_ = gh_cadr (c); } - cs = gh_cdr (cs); + cs = ly_cdr (cs); } if (volta_span_p_) diff --git a/modules/GNUmakefile b/modules/GNUmakefile index bc69608d14..61cfea23e5 100644 --- a/modules/GNUmakefile +++ b/modules/GNUmakefile @@ -5,7 +5,7 @@ NAME=midi # compile fucks up on without autoconf -I flag. -STEPMAKE_TEMPLATES=c install # python-module +STEPMAKE_TEMPLATES=c install python-module INSTALLATION_FILES=$(outdir)/midi.so INSTALLATION_DIR=$(datadir)/python diff --git a/scripts/midi2ly.py b/scripts/midi2ly.py new file mode 100644 index 0000000000..26476d49a2 --- /dev/null +++ b/scripts/midi2ly.py @@ -0,0 +1,206 @@ +#!@PYTHON@ + +import midi +import sys + +scale_steps =[0,2,4,5,7,9,11] + +def split_channels (track): + chs = {} + for i in range(16): + chs[i] = [] + + for e in track: + data = list (e[1]) + c = data[0] & 0x0f + e = (e[0], tuple ([data[0] & 0xf0] + data[1:])) + chs[c].append (e) + + for i in range (16): + if chs[i] == []: + del chs[i] + + + for v in chs.values (): + ns = notes_on_channel(v) + ns = unthread_notes (ns) + map (dump_thread, ns) + + return chs + + +class Note: + def __init__(self, duration, pitch, velocity): + self.velocity = velocity + self.pitch = pitch + self.duration = duration + + def duration_compare(a,b): + if a.duration < b.duration : + return -1 + elif a.duration > b.duration: + return 1 + else: + return 0 + +def notes_on_channel (channel): + pitches = {} + + nch= [] + for e in channel: + t = e[0] + + if e[1][0] == midi.NOTE_ON: + if not pitches.has_key (e[1][1]): + pitches[e[1][1]] = (t, e[1][2]) + elif e[1][0] == midi.NOTE_OFF: + try: + (lt, vel) = pitches[e[1][1]] + del pitches[e[1][1]] + + nch.append ((t, Note (t-lt, e[1][1], vel))) + + except KeyError: + pass + else: + pass + + return nch + +def unthread_notes (channel): + threads = [] + while channel: + thread = [] + end_busy_t = 0 + start_busy_t = 0 + todo = [] + for e in channel: + t = e[0] + if (t == start_busy_t and e[1].duration + t == end_busy_t) \ + or t >= end_busy_t: + thread.append (e) + start_busy_t = t + end_busy_t = t + e[1].duration + else: + todo.append(e) + threads.append (thread) + channel = todo + + return threads + +def gcd (a,b): + if b == 0: + return a + c = a + while c: + c = a % b + a = b + b = c + return a + +def dump_skip (dt): + wholes = dt / (4*384) + dt = dt % (4*384); + quarters = dt / 384 + + # etc. + if (wholes): + print 's1*%d' % wholes + if quarters: + print 's4*%d' % quarters + + + +def dump_duration (dur): + g = gcd (dur, 384) + sys.stdout.write ('4') + (p,q) = (dur / g, 384 / g) + if (p == 1 and q == 1) : + pass + else: + if p <> 1: + sys.stdout.write ('*%d'% p) + if q <> 1: + sys.stdout.write ('*%d'% q) + + +def dump_note (note): + p = note.pitch + oct = p / 12 + step = p % 12 + + i = 0 + while i < len (scale_steps): + if scale_steps[i] > step: + break + i = i+1 + + i = i-1 + str = chr (i + ord ('a')) + if scale_steps[i] <> step: + str = str + 'is' + + sys.stdout.write (' %s' % str); + dump_duration (note.duration) + +def dump_chord (ch): + if len(ch) == 1: + dump_note (ch[0]) + else: + sys.stdout.write ("<") + map (dump_note, ch) + sys.stdout.write ('>') + +def dump_thread (thread): + last_e = None + chs = [] + ch = [] + + for e in thread: + if last_e and last_e[0] == e[0]: + ch.append (e[1]) + else: + if ch: + chs.append ( (last_e[0], ch)) + + ch = [e[1]] + + last_e = e + + if ch: chs.append ((last_e[0] ,ch)) + t = 0 + last_t = 0 + + for ch in chs: + t = ch[0] + if t - last_t: + dump_skip (t-last_t) + + dump_chord (ch[1]) + last_t = t + ch[1][0].duration + +def dump_notes (channel): + on_hold = [] + for e in channel: + if e[0] <> last_t: + dump_chord (on_hold) + on_hold = [] + last_t = e[0] + + on_hold.append (e) + + + + +def convert_midi (f): + str = open (f).read () + midi_dump = midi.parse (str) + + channels = [] + + for t in midi_dump[1]: + channels.append (split_channels (t)) + + +for f in sys.argv[1:]: + convert_midi (f)