]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/beam-engraver.cc (stop_translation_timestep): reset now_stop_ev_
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 20 Nov 2002 00:17:09 +0000 (00:17 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 20 Nov 2002 00:17:09 +0000 (00:17 +0000)
* lily/scm-option.cc: add parse-protect to ly:set-option

* lily/lexer.ll: set errorlevel if GUILE fails during parse.

13 files changed:
ChangeLog
input/regression/beam-rest.ly [new file with mode: 0644]
lily/beam-engraver.cc
lily/beam.cc
lily/include/ligature-bracket.hh [deleted file]
lily/include/parse-scm.hh
lily/lexer.ll
lily/ligature-bracket.cc [deleted file]
lily/parse-scm.cc
lily/scm-option.cc
lilypond-mode.el
scm/grob-description.scm
scm/interface-description.scm

index ab83c99a01280f62a7c6a6fa2878717b886a58f5..1905373d57069e362f74c0ea0abc70428c74f571 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2002-11-20  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * 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  <hanwen@cs.uu.nl>
+
+       * 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 <hjunes@cc.hut.fi>
 
        * 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 (file)
index 0000000..d56c49f
--- /dev/null
@@ -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 }
+}
index 09c8ad50396dda08a5b99e95fc3c8c7b2331f3b3..9610d36fd1d4642e4783c75df83d12faa35a1cff 100644 (file)
@@ -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();
index b30abf449258dbf41bf79890aec4afa24aa08900..849826446834a8ac5337e67af890c922b30df372 100644 (file)
@@ -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 <? beaming->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 (file)
index 696e9fb..0000000
+++ /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 <reuter@ipd.uka.de>
-*/
-
-#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 */
-
index 3a51130e0a5a8e195b740213aba9e561aa427c8f..896559ea022f16172a01e1fe2a1ac38f64a70f11 100644 (file)
@@ -5,6 +5,8 @@
 #include "input.hh"
 #include "lily-guile.hh"
 
+extern bool parse_protect_global;
+
 struct Parse_start
 {
   char const* str;
index de7da4965861615dcf4eb7e7e8dc7dad0f0ed1d9..dd55bf7b7e2a49c4a15e6853003f1edb85ced9ca 100644 (file)
@@ -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 (file)
index b05af40..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
-  ligature-bracket.cc -- implement Ligature_bracket
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 2002 Juergen Reuter <reuter@ipd.uka.de>
-*/
-
-#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<Spanner*> (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");
index 5780e7360edd338ee712f62206c5e17a2a73fcc0..f9c972bfb9a263afd60d125fc7bd3c0aa9d76c61 100644 (file)
@@ -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;  
 }
 
index da339c2acd77991be6f76335a62200b7aaadba98..bded4946d7b4e88b18e39cf3ffbf5d1cec88bdbb 100644 (file)
@@ -8,6 +8,7 @@
  */
 #include <stdio.h>
 
+#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); 
index f95098542b342ffe248029c16dacac37e6e0e6b7..2bdb32483d88ccd6fa2f06628a9ac82aef26a96c 100644 (file)
@@ -216,7 +216,7 @@ LilyPond-expand-list.
     ("%t" . ".tex")
     ("%d" . ".dvi")
     ("%p" . ".ps")
-    ("%l" . ".latex")
+    ("%l" . ".tex")
     ("%x" . ".tely")
     ("%m" . ".midi")
     )
index 4e19b91a2251998ef71598b28231a8d0a526be67..843d127f163cc23934475cca62b04dc3477774bf 100644 (file)
        (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)
index e87ae0c5ef9e3aaa1bacca04fa7c1b51659786da..67dad51a1d21fa4eb78a44344bcda50742a48634 100644 (file)
  '()
  )
 
+(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"