From ae640661a941deaf8584b7c4ae0437305d1a18bf Mon Sep 17 00:00:00 2001 From: hanwen Date: Fri, 24 Sep 2004 18:12:44 +0000 Subject: [PATCH] * lily/hairpin.cc (print): check columns of bounds, not bounds themselves. (print): robustify bound-padding lookup. * scripts/lilypond-book.py (Compile_error.process_include): catch Compile_error exception, and remove output .texi. * lily/parser.yy (Music_list): add error-found to music with errors. --- ChangeLog | 3 +++ lily/hairpin.cc | 11 ++++------- lily/lexer.ll | 6 +++--- lily/parser.yy | 24 ++++++++++++------------ lily/slur-scoring.cc | 1 - ly/book-paper-defaults.ly | 2 +- scripts/lilypond-book.py | 2 +- 7 files changed, 24 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 31fb69a09a..0181fd1eef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2004-09-24 Han-Wen Nienhuys + * lily/hairpin.cc (print): check columns of bounds, not bounds themselves. + (print): robustify bound-padding lookup. + * lily/*: ly_c[ad]+r -> scm_XXX , ly_c_pair_p -> scm_is_pair. * scripts/lilypond-book.py (Compile_error.process_include): catch diff --git a/lily/hairpin.cc b/lily/hairpin.cc index ac4144e597..9fcf79df88 100644 --- a/lily/hairpin.cc +++ b/lily/hairpin.cc @@ -35,9 +35,8 @@ Hairpin::print (SCM smob) } Direction grow_dir = to_dir (s); + Real padding = robust_scm2double (me->get_property ("bound-padding"), 0.5); - Real padding = scm_to_double (me->get_property ("bound-padding")); - Drul_array broken; Drul_array bounds ; Direction d = LEFT; @@ -82,8 +81,8 @@ Hairpin::print (SCM smob) Spanner *pin = unsmob_spanner (scm_car (adj)); if (pin - && (pin->get_bound (LEFT)->get_column() == b - || pin->get_bound (RIGHT)->get_column() == b)) + && (pin->get_bound (LEFT)->get_column() == b->get_column () + || pin->get_bound (RIGHT)->get_column() == b->get_column() )) neighbor_found = true; } @@ -96,18 +95,16 @@ Hairpin::print (SCM smob) x_points[d] = neighbor_found ? e.center() - d * padding / 3 : e[d]; } - } } while (flip (&d) != LEFT); Real width = x_points[RIGHT] - x_points[LEFT]; - if (width < 0) { me->warning (_ ((grow_dir < 0) ? "decrescendo too small" - : "crescendo too small")); + : "crescendo too small")); width = 0; } diff --git a/lily/lexer.ll b/lily/lexer.ll index 975b336fd7..f89f7fa5af 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -499,7 +499,7 @@ HYPHEN -- String str (YYText () + 1); SCM s = lookup_markup_command (str); - if (ly_c_pair_p (s) && scm_is_symbol (scm_cdr (s)) ) { + if (scm_is_pair (s) && scm_is_symbol (scm_cdr (s)) ) { yylval.scm = scm_car(s); SCM tag = scm_cdr(s); if (tag == ly_symbol2scm("markup0")) @@ -727,10 +727,10 @@ Lily_lexer::scan_bare_word (String str) SCM sym = ly_symbol2scm (str.to_str0 ()); if ((YYSTATE == notes) || (YYSTATE == chords)) { SCM handle = SCM_BOOL_F; - if (ly_c_pair_p (pitchname_tab_stack_)) + if (scm_is_pair (pitchname_tab_stack_)) handle = scm_hashq_get_handle (scm_car (pitchname_tab_stack_), sym); - if (ly_c_pair_p (handle)) { + if (scm_is_pair (handle)) { yylval.scm = scm_cdr (handle); if (unsmob_pitch (yylval.scm)) return (YYSTATE == notes) ? NOTENAME_PITCH : TONICNAME_PITCH; diff --git a/lily/parser.yy b/lily/parser.yy index f7885478b8..2ed5effb92 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -119,7 +119,7 @@ is_duration (int t) void set_music_properties (Music *p, SCM a) { - for (SCM k = a; ly_c_pair_p (k); k = scm_cdr (k)) + for (SCM k = a; scm_is_pair (k); k = scm_cdr (k)) p->internal_set_property (scm_caar (k), scm_cdar (k)); } @@ -150,7 +150,7 @@ bool ly_input_procedure_p (SCM x) { return ly_c_procedure_p (x) - || (ly_c_pair_p (x) && ly_c_procedure_p (scm_car (x))); + || (scm_is_pair (x) && ly_c_procedure_p (scm_car (x))); } Music* @@ -611,7 +611,7 @@ context_def_spec_body: | context_def_spec_body GROBDESCRIPTIONS embedded_scm { Context_def*td = unsmob_context_def ($$); - for (SCM p = $3; ly_c_pair_p (p); p = scm_cdr (p)) { + for (SCM p = $3; scm_is_pair (p); p = scm_cdr (p)) { SCM tag = scm_caar (p); /* TODO: should make new tag "grob-definition" ? */ @@ -816,7 +816,7 @@ Music_list: SCM c = scm_cons ($2->self_scm (), SCM_EOL); scm_gc_unprotect_object ($2->self_scm ()); /* UGH */ - if (ly_c_pair_p (scm_cdr (s))) + if (scm_is_pair (scm_cdr (s))) scm_set_cdr_x (scm_cdr (s), c); /* append */ else scm_set_car_x (s, c); /* set first cons */ @@ -833,7 +833,7 @@ Music_list: SCM c = scm_cons (m->self_scm (), SCM_EOL); scm_gc_unprotect_object (m->self_scm ()); /* UGH */ - if (ly_c_pair_p (scm_cdr (s))) + if (scm_is_pair (scm_cdr (s))) scm_set_cdr_x (scm_cdr (s), c); /* append */ else scm_set_car_x (s, c); /* set first cons */ @@ -861,7 +861,7 @@ Repeated_music: { Music *beg = $4; int times = $3; - SCM alts = ly_c_pair_p ($5) ? scm_car ($5) : SCM_EOL; + SCM alts = scm_is_pair ($5) ? scm_car ($5) : SCM_EOL; if (times < scm_ilength (alts)) { unsmob_music (scm_car (alts)) ->origin ()->warning ( @@ -1032,7 +1032,7 @@ Generic_prefix_music: int k = 0; bool ok = true; for (SCM s = sig, t = args; - ok && ly_c_pair_p (s) && ly_c_pair_p (t); + ok && scm_is_pair (s) && scm_is_pair (t); s = scm_cdr (s), t = scm_cdr (t)) { k++; if (scm_call_1 (scm_car (s), scm_car (t)) != SCM_BOOL_T) @@ -1247,7 +1247,7 @@ re_rhythmed_music: Music *all = MY_MAKE_MUSIC ("SimultaneousMusic"); SCM lst = SCM_EOL; - for (SCM s = $2; ly_c_pair_p (s); s = scm_cdr (s)) + for (SCM s = $2; scm_is_pair (s); s = scm_cdr (s)) { Music *music = unsmob_music (scm_car (s)); Music *com = make_lyric_combine_music (name, music); @@ -1462,7 +1462,7 @@ note_chord_element: SCM es = $1->get_property ("elements"); SCM postevs = scm_reverse_x ($3, SCM_EOL); - for (SCM s = es; ly_c_pair_p (s); s = scm_cdr (s)) + for (SCM s = es; scm_is_pair (s); s = scm_cdr (s)) unsmob_music (scm_car (s))->set_property ("duration", dur); es = ly_append2 (es, postevs); @@ -1515,7 +1515,7 @@ chord_body_element: if (ex % 2 || q % 2) n->set_property ("force-accidental", SCM_BOOL_T); - if (ly_c_pair_p (post)) { + if (scm_is_pair (post)) { SCM arts = scm_reverse_x (post, SCM_EOL); n->set_property ("articulations", arts); } @@ -1534,7 +1534,7 @@ chord_body_element: n->set_property ("drum-type", $1); n->set_spot (THIS->here_input ()); - if (ly_c_pair_p ($2)) { + if (scm_is_pair ($2)) { SCM arts = scm_reverse_x ($2, SCM_EOL); n->set_property ("articulations", arts); } @@ -2180,7 +2180,7 @@ simple_element: Music *m = unsmob_music ($1); Input i = THIS->pop_spot (); m->set_spot (i); - for (SCM s = m->get_property ("elements"); ly_c_pair_p (s); s = scm_cdr (s)) + for (SCM s = m->get_property ("elements"); scm_is_pair (s); s = scm_cdr (s)) { unsmob_music (scm_car (s))->set_property ("duration", $2); } diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index a4b1164c18..be448bf0fd 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -1444,7 +1444,6 @@ get_bezier (Grob *me, Real a1 = sqr (len) / 3.0; Real a2 = 0.75 * sqr (indent + len / 3.0); - Real debug_h = sqrt (a1 - a2); Real max_h; if (a1 >= a2) max_h = sqrt (a1 - a2); diff --git a/ly/book-paper-defaults.ly b/ly/book-paper-defaults.ly index 2cb3fc3d05..56b3c0d113 100644 --- a/ly/book-paper-defaults.ly +++ b/ly/book-paper-defaults.ly @@ -34,7 +34,7 @@ % % ugh. hard coded? % - + #(paper-set-staff-size (* 20.0 pt)) % diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index b10c0fa2fe..25b185abda 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -1028,7 +1028,7 @@ def do_file (input_filename): elif process_cmd: - do_process_cmd (chunksg) + do_process_cmd (chunks) ly.progress (_ ("Compiling %s...") % output_filename) output_file.writelines ([s.replacement_text () \ for s in chunks]) -- 2.39.5