From: Han-Wen Nienhuys Date: Wed, 20 Nov 2002 00:17:09 +0000 (+0000) Subject: * lily/beam-engraver.cc (stop_translation_timestep): reset now_stop_ev_ X-Git-Tag: release/1.7.9~44 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a42c6862d08f8b65c4fe3a87d7b443302e7c2c58;p=lilypond.git * lily/beam-engraver.cc (stop_translation_timestep): reset now_stop_ev_ * lily/scm-option.cc: add parse-protect to ly:set-option * lily/lexer.ll: set errorlevel if GUILE fails during parse. --- diff --git a/ChangeLog b/ChangeLog index ab83c99a01..1905373d57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2002-11-20 Han-Wen Nienhuys + + * lily/beam-engraver.cc (stop_translation_timestep): reset now_stop_ev_ + + * lily/scm-option.cc: add parse-protect to ly:set-option + + * lily/lexer.ll: set errorlevel if GUILE fails during parse. + +2002-11-19 Han-Wen Nienhuys + + * lily/include/ligature-bracket.hh: removed + * lily/ligature-bracket.cc: removed + + * lilypond-mode.el (LilyPond-expand-alist): set LaTeX extension to .tex + + * lily/beam.cc (set_beaming): don't change beam count on rests. + (brew_molecule): always set flag-width > 0. + 2002-11-19 Heikki Junes * lilypond-mode.el: LilyPond-imenu-generic-re: only alphabetic chars, diff --git a/input/regression/beam-rest.ly b/input/regression/beam-rest.ly new file mode 100644 index 0000000000..d56c49f943 --- /dev/null +++ b/input/regression/beam-rest.ly @@ -0,0 +1,12 @@ +\header { + texidoc = "The number of beams doesn't change on a rest." +} + +\version "1.7.7" + +\score { \notes \relative c, { + \clef bass + [e8 r16 f d'8 e16 e16] [c8 c16 r16 bes8 r16 c16-] | + } +\paper { linewidth = -1.0 } +} diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 09c8ad5039..9610d36fd1 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -235,6 +235,7 @@ Beam_engraver::stop_translation_timestep () finished_beam_ = beam_; finished_beam_info_ = beam_info_; + now_stop_ev_ = 0; beam_ = 0; beam_info_ = 0; typeset_beam(); diff --git a/lily/beam.cc b/lily/beam.cc index b30abf4492..8498264468 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -335,6 +335,7 @@ Beam::brew_molecule (SCM grob) SCM gap = me->get_grob_property ("gap"); Molecule the_beam; Real lt = me->get_paper ()->get_var ("linethickness"); + for (int i = 0; i< stems.size(); i++) { Grob * st =stems[i]; @@ -343,6 +344,11 @@ Beam::brew_molecule (SCM grob) Real xposn = st->relative_coordinate (xcommon, X_AXIS); Real stem_width = gh_scm2double (st->get_grob_property ("thickness")) *lt; + /* + We do the space left of ST, with lfliebertjes pointing to the + right from the left stem, and rfliebertjes pointing left from + right stem. + */ if (i > 0) { SCM left = gh_cdr (last_beaming); @@ -408,18 +414,14 @@ Beam::brew_molecule (SCM grob) if (lfliebertjes.size() || rfliebertjes.size()) { - Real nw_f; - if (!Stem::first_head (st)) - nw_f = 0; - else - { - int t = Stem::duration_log (st); - SCM proc = me->get_grob_property ("flag-width-function"); - SCM result = gh_call1 (proc, scm_int2num (t)); - nw_f = gh_scm2double (result); - } + int t = Stem::duration_log (st); + + SCM proc = me->get_grob_property ("flag-width-function"); + SCM result = gh_call1 (proc, scm_int2num (t)); + nw_f = gh_scm2double (result); + /* Half beam should be one note-width, but let's make sure two half-beams never touch */ @@ -1273,13 +1275,18 @@ Beam::set_beaming (Grob *me, Beaming_info_list *beaming) ||(d == RIGHT && i == stems.size () -1)) continue; - - SCM beaming_prop = stems[i]->get_grob_property ("beaming"); + Grob *st = stems[i]; + SCM beaming_prop = st->get_grob_property ("beaming"); if (beaming_prop == SCM_EOL || index_get_cell (beaming_prop, d) == SCM_EOL) { int b = beaming->infos_.elem (i).beams_i_drul_[d]; - Stem::set_beaming (stems[i], b, d); + if (i>0 + && i < stems.size() -1 + && Stem::invisible_b (st)) + b = b infos_.elem(i).beams_i_drul_[-d]; + + Stem::set_beaming (st, b, d); } } while (flip (&d) != LEFT); diff --git a/lily/include/ligature-bracket.hh b/lily/include/ligature-bracket.hh deleted file mode 100644 index 696e9fbe49..0000000000 --- a/lily/include/ligature-bracket.hh +++ /dev/null @@ -1,22 +0,0 @@ -/* - ligature-bracket.hh -- part of GNU LilyPond - - source file of the GNU LilyPond music typesetter - - (c) 2002 Juergen Reuter -*/ - -#ifndef LIGATURE_BRACKET_HH -#define LIGATURE_BRACKET_HH - -#include "lily-proto.hh" -#include "lily-guile.hh" - -struct Ligature_bracket -{ - DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM )); - static bool has_interface (Grob*); -}; - -#endif /* LIGATURE_BRACKET_HH */ - diff --git a/lily/include/parse-scm.hh b/lily/include/parse-scm.hh index 3a51130e0a..896559ea02 100644 --- a/lily/include/parse-scm.hh +++ b/lily/include/parse-scm.hh @@ -5,6 +5,8 @@ #include "input.hh" #include "lily-guile.hh" +extern bool parse_protect_global; + struct Parse_start { char const* str; diff --git a/lily/lexer.ll b/lily/lexer.ll index de7da49658..dd55bf7b7e 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -261,6 +261,11 @@ HYPHEN -- return SCM_T; } SCM sval = ly_parse_scm (s, &n, here_input()); + if (sval == SCM_UNDEFINED) + { + sval = SCM_UNSPECIFIED; + errorlevel_ = 1; + } for (int i=0; i < n; i++) { diff --git a/lily/ligature-bracket.cc b/lily/ligature-bracket.cc deleted file mode 100644 index b05af4095f..0000000000 --- a/lily/ligature-bracket.cc +++ /dev/null @@ -1,149 +0,0 @@ -/* - ligature-bracket.cc -- implement Ligature_bracket - - source file of the GNU LilyPond music typesetter - - (c) 2002 Juergen Reuter -*/ - -#include "ligature-bracket.hh" -#include "item.hh" -#include "paper-def.hh" -#include "spanner.hh" -#include "staff-symbol-referencer.hh" -#include "lookup.hh" -#include "box.hh" - -static Molecule -brew_edge (Direction dir, Real thickness, Real width, Real height, - Real blotdiameter) -{ - Molecule hline = Lookup::roundfilledbox (Box (Interval (0, width), - Interval (0, thickness)), - blotdiameter); - hline.translate_axis (height - thickness, Y_AXIS); - - Molecule vline = Lookup::roundfilledbox (Box (Interval (0, thickness), - Interval (0, height)), - blotdiameter); - if (dir == RIGHT) - { - vline.translate_axis (width - thickness, X_AXIS); - } - - Molecule edge = Molecule (); - edge.add_molecule (hline); - edge.add_molecule (vline); - return edge; -} - -MAKE_SCHEME_CALLBACK (Ligature_bracket, brew_molecule, 1); -SCM -Ligature_bracket::brew_molecule (SCM smob) -{ - Grob *me = unsmob_grob (smob); - Spanner *spanner = dynamic_cast (me); - Real blotdiameter = me->get_paper ()->get_var ("blotdiameter"); - Real staff_space = Staff_symbol_referencer::staff_space (me); - - Real thickness = me->get_paper ()->get_var ("linethickness"); - SCM grob_thickness = me->get_grob_property ("thickness"); - if (gh_number_p (grob_thickness)) - thickness *= gh_scm2double (grob_thickness); - - SCM edge_width_scm = me->get_grob_property ("width"); - Real edge_width; - if (gh_number_p (edge_width_scm)) - { - edge_width = gh_scm2double (edge_width_scm); - } - else - { - edge_width = 0.75; - } - edge_width *= staff_space; - - SCM edge_height_scm = me->get_grob_property ("height"); - Real edge_height; - if (gh_number_p (edge_height_scm)) - { - edge_height = gh_scm2double (edge_height_scm); - } - else - { - edge_height = 0.5; - } - edge_height *= staff_space; - - Item* left_bound = spanner->get_bound (LEFT); - Item* right_bound = spanner->get_bound (RIGHT); - - Molecule bracket = Molecule (); - - Real y_min_offs = - 0.5 * Staff_symbol_referencer::line_count (me) * staff_space; - Real y_left_offs = y_min_offs; - Real y_right_offs = y_min_offs; - - Real left_bound_left_extent = 0; - - if (left_bound) - { - Molecule left_edge = - brew_edge (LEFT, thickness, edge_width, edge_height, blotdiameter); - Grob *left_common_x = me->common_refpoint (left_bound, X_AXIS); - left_bound_left_extent = - left_bound->extent (left_common_x, X_AXIS)[LEFT]; - left_edge.translate_axis (left_bound_left_extent, X_AXIS); - bracket.add_molecule (left_edge); - Grob *left_common_y = me->common_refpoint (left_bound, Y_AXIS); - y_left_offs = - max(y_left_offs, left_bound->extent (left_common_y, Y_AXIS)[UP]); - } - else - { - me->warning (_ ("no left bound")); - } - - if (right_bound) - { - Molecule right_edge = - brew_edge (RIGHT, thickness, edge_width, edge_height, blotdiameter); - Grob *staff_symbol = Staff_symbol_referencer::get_staff_symbol (me); - Grob *right_common_bound_x = - right_bound->common_refpoint (staff_symbol, X_AXIS); - - Real left_offs = 0; - if (left_bound) - { - Grob *left_common_bound_x = - left_bound->common_refpoint (staff_symbol, X_AXIS); - left_offs = left_bound->extent (left_common_bound_x, X_AXIS)[LEFT]; - } - - Real right_offs = - right_bound->extent (right_common_bound_x, X_AXIS)[RIGHT]; - - right_edge.translate_axis (+ right_offs - - left_offs - + left_bound_left_extent - - edge_width, - X_AXIS); - bracket.add_molecule (right_edge); - Grob *right_common_y = me->common_refpoint (right_bound, Y_AXIS); - y_right_offs = - max(y_right_offs, right_bound->extent (right_common_y, Y_AXIS)[UP]); - } - else - { - me->warning (_ ("no left bound")); - } - - bracket.translate_axis (max (y_left_offs, y_right_offs), Y_AXIS); - - return bracket.smobbed_copy (); -} - -ADD_INTERFACE (Ligature_bracket, "ligature-bracket-interface", - "A bracket indicating a ligature in the original edition", - "width thickness height ligature-primitive-callback"); diff --git a/lily/parse-scm.cc b/lily/parse-scm.cc index 5780e7360e..f9c972bfb9 100644 --- a/lily/parse-scm.cc +++ b/lily/parse-scm.cc @@ -87,7 +87,7 @@ parse_handler (void * data, SCM tag, SCM args) */ ps->nchars = 1; - return SCM_EOL; + return SCM_UNDEFINED; } /* @@ -109,20 +109,9 @@ protected_ly_parse_scm (Parse_start *ps) &catch_protected_parse_body, (void*)ps, &parse_handler, (void*)ps); - } - -static bool protect = true; - -LY_DEFINE(set_parse_protect, "ly:set-parse-protect", - 1,0,0, (SCM t), - "If protection is switched on, errors in inline scheme are caught. -If off, GUILE will halt on errors, and give a stack trace. Default is protected evaluation.") -{ - protect = (t == SCM_BOOL_T); - return SCM_UNSPECIFIED; -} +bool parse_protect_global = true; SCM ly_parse_scm (char const* s, int *n, Input i) @@ -132,9 +121,10 @@ ly_parse_scm (char const* s, int *n, Input i) ps.str = s; ps.start_location_ = i; - SCM ans = protect ? protected_ly_parse_scm (&ps) + SCM ans = parse_protect_global ? protected_ly_parse_scm (&ps) : internal_ly_parse_scm (&ps); *n = ps.nchars; + return ans; } diff --git a/lily/scm-option.cc b/lily/scm-option.cc index da339c2acd..bded4946d7 100644 --- a/lily/scm-option.cc +++ b/lily/scm-option.cc @@ -8,6 +8,7 @@ */ #include +#include "parse-scm.hh" #include "string.hh" #include "lily-guile.hh" #include "scm-option.hh" @@ -56,6 +57,7 @@ LY_DEFINE (ly_option_usage, "ly:option-usage", 0, 0, 0, (SCM), printf ( " help ANY-SYMBOL\n" " internal-type-checking BOOLEAN\n" " midi-debug BOOLEAN\n" + " parse-protect BOOLEAN\n" " testing-level INTEGER\n"); exit (0); @@ -69,22 +71,23 @@ don't timestamp the output @item -t,--test Switch on any experimental features. Not for general public use. */ - LY_DEFINE (ly_set_option, "ly:set-option", 2, 0, 0, (SCM var, SCM val), - "Set a global option value. Supported options include - -@table @code -@item help -List all options. -@item midi-debug -If set to true, generate human readable MIDI -@item internal-type-checking -Set paranoia for property assignments -@end table - -This function is useful to call from the command line: @code{lilypond -e -\"(ly-set-option 'midi-debug #t)\"}. -") + "Set a global option value. Supported options include\n" +"\n" +"@table @code\n" +"@item help\n" +"List all options.\n" +"@item midi-debug\n" +"If set to true, generate human readable MIDI\n" +"@item internal-type-checking\n" +"Set paranoia for property assignments\n" +"@item parse-protect\n" +"If protection is switched on, errors in inline scheme are caught in the parser. \n" +"If off, GUILE will halt on errors, and give a stack trace. Default is protected evaluation. \n" +"@end table\n" +"\n" +"This function is useful to call from the command line: @code{lilypond -e\n" +"\"(ly-set-option 'midi-debug #t)\"}.\n") { if (var == ly_symbol2scm ("help")) { @@ -99,6 +102,10 @@ This function is useful to call from the command line: @code{lilypond -e { testing_level_global = gh_scm2int (val); } + else if (var == ly_symbol2scm ("parse-protect" )) + { + parse_protect_global = to_boolean(val); + } else if (var == ly_symbol2scm ("internal-type-checking")) { internal_type_checking_global_b = to_boolean (val); diff --git a/lilypond-mode.el b/lilypond-mode.el index f95098542b..2bdb32483d 100644 --- a/lilypond-mode.el +++ b/lilypond-mode.el @@ -216,7 +216,7 @@ LilyPond-expand-list. ("%t" . ".tex") ("%d" . ".dvi") ("%p" . ".ps") - ("%l" . ".latex") + ("%l" . ".tex") ("%x" . ".tely") ("%m" . ".midi") ) diff --git a/scm/grob-description.scm b/scm/grob-description.scm index 4e19b91a22..843d127f16 100644 --- a/scm/grob-description.scm +++ b/scm/grob-description.scm @@ -436,12 +436,6 @@ (meta . ((interfaces . (key-signature-interface font-interface break-aligned-interface item-interface )))) )) - (Ligature - . ( - (molecule-callback . ,Ligature_bracket::brew_molecule) - (meta . ((interfaces . (ligature-interface)))) - )) - (LigatureBracket . ( (ligature-primitive-callback . ,Note_head::brew_molecule) diff --git a/scm/interface-description.scm b/scm/interface-description.scm index e87ae0c5ef..67dad51a1d 100644 --- a/scm/interface-description.scm +++ b/scm/interface-description.scm @@ -31,6 +31,12 @@ '() ) +(ly:add-interface + 'ligature-bracket-interface + "A bracket indicating a ligature in the original edition" + '(width thickness height ligature-primitive-callback)) + + (ly:add-interface 'mark-interface "a rehearsal mark"