]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 1.3.13 release/1.3.13
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 18 Dec 1999 17:02:07 +0000 (18:02 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 18 Dec 1999 17:02:07 +0000 (18:02 +0100)
84 files changed:
CHANGES
TODO
VERSION
flower/include/direction.hh
flower/include/offset.hh
flower/include/polynomial.hh [new file with mode: 0644]
flower/offset.cc
flower/polynomial.cc [new file with mode: 0644]
input/bugs/1845390254.ly [new file with mode: 0644]
input/test/GNUmakefile
lily/afm-reader.cc
lily/align-element.cc
lily/all-font-metrics.cc
lily/beam.cc
lily/bezier.cc
lily/bow.cc
lily/break-algorithm.cc
lily/break-align-item.cc
lily/chord.cc
lily/column-x-positions.cc
lily/crescendo.cc
lily/debug.cc
lily/dimension-cache.cc
lily/dots.cc
lily/engraver-group-engraver.cc
lily/font-metric.cc
lily/gourlay-breaking.cc
lily/grace-performer-group.cc
lily/include/afm.hh
lily/include/all-font-metrics.hh
lily/include/beam.hh
lily/include/bezier-bow.hh [new file with mode: 0644]
lily/include/bezier.hh
lily/include/bow.hh
lily/include/break-algorithm.hh
lily/include/column-x-positions.hh
lily/include/curve.hh [deleted file]
lily/include/dimension-cache.hh
lily/include/font-metric.hh
lily/include/global-translator.hh
lily/include/item.hh
lily/include/keyword.hh
lily/include/lily-proto.hh
lily/include/lookup.hh
lily/include/misc.hh
lily/include/note-head-side.hh
lily/include/notename-table.hh
lily/include/scope.hh
lily/include/score-element.hh
lily/include/spanner.hh
lily/include/translator-group.hh
lily/item.cc
lily/leastsquares.cc
lily/lily-guile.cc
lily/local-key-item.cc
lily/lookup.cc
lily/main.cc
lily/misc.cc
lily/molecule.cc
lily/moment.cc
lily/my-lily-lexer.cc
lily/note-column.cc
lily/note-head.cc
lily/notename-table.cc
lily/paper-outputter.cc
lily/paper-score.cc
lily/parser.yy
lily/performer-group-performer.cc
lily/property-engraver.cc
lily/scm-hash.cc
lily/scope.cc
lily/score-element.cc
lily/score-engraver.cc
lily/script-engraver.cc
lily/script.cc
lily/slur.cc
lily/spacing-spanner.cc
lily/spanner.cc
lily/time-description.cc [deleted file]
lily/translator-group.cc
ly/property.ly
make/out/lilypond.lsm
make/out/lilypond.spec
po/nl.po

diff --git a/CHANGES b/CHANGES
index 537ec3f1c40afbf3b158dc0c325a7166cc96e3ee..b248113d9c40910447da8ab6fcc48b6df695ba19 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,13 @@
+pl 12.hwn1
+       - polynomial.hh
+       - bf: generic properties
+       - quantise_iv () fix.
+       - bezier cleanup
+       - class Polynomial 
+       - use smobs for font metric tables/hashes.
+       - nl.po bf
+
+
 pl 11.jcn3
        - small beam fixes (interstaff knees still broken)
 
diff --git a/TODO b/TODO
index a08d5cbf25dcc2948a721f9716f457485a113fb4..128422b0d131ba5148357679b464b4481fd3f706 100644 (file)
--- a/TODO
+++ b/TODO
@@ -28,6 +28,7 @@ Grep -i for TODO, FIXME and ugh/ugr/urg.
        ctor_dict["Score_element"]->create_func ();
 . * acc at tied note after linebreak.
 . * fix font-naming and selecting
+. * sparse ties.
 . * chord tonic: placement of accidental  C#, Cb (from scm and C++)
 . * note head on stem err msg in dutch.
 . * why need to run -C mf twice?
diff --git a/VERSION b/VERSION
index 04cb146bb1d4ebea0fc64db9bf1711a062a7f817..bcb4087ea5ff131c38840a772ba5122d57a4725e 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
-PATCH_LEVEL=12
+PATCH_LEVEL=13
 MY_PATCH_LEVEL=
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
index ffd262f6a825a53fe03ffb0e8621cdde0dfd0ae6..5cce076c0fe8d55c7acfe6c1a828ed11b5b30e96 100644 (file)
@@ -25,8 +25,6 @@ enum Direction
   BIGGER=1,
   START = -1,
   STOP = 1,
-  X=1,
-  Y=-1,
 };
 
 inline Direction
index 428a8fa6b3ca0a9169068b81019f8bed12800c27..0a5a7a10d541887b04124f5e428c895cb102ba6f 100644 (file)
@@ -9,20 +9,21 @@
 
 #include "real.hh"
 #include "axes.hh"
+#include "arithmetic-operator.hh"
+
+struct Offset;
+
+Offset complex_multiply (Offset, Offset);
+Offset complex_exp (Offset);
+
 
 /** 2d vector
     should change to Complex
 */
 struct Offset {
 public:
-
   Real coordinate_a_[NO_AXES];
     
-  Real &y() { return coordinate_a_[Y_AXIS]; }
-  Real &x() { return coordinate_a_[X_AXIS]; }
-  Real y() const { return coordinate_a_[Y_AXIS]; }
-  Real x() const { return coordinate_a_[X_AXIS]; }
-    
   Real &operator[](Axis i) {
     return coordinate_a_[i];
   }
@@ -31,74 +32,62 @@ public:
   }
     
   Offset& operator+=(Offset o) {
-    x()+=o.x ();
-    y()+=o.y ();
+    (*this)[X_AXIS] += o[X_AXIS];
+    (*this)[Y_AXIS] += o[Y_AXIS];
     return *this;
   }
   Offset operator - () const {
     Offset o = *this;
-    o.x () = - o.x ();
-    o.y () = - o.y ();
+    
+    o[X_AXIS]  = - o[X_AXIS];
+    o[Y_AXIS]  = - o[Y_AXIS];
     return o;
   }
   Offset& operator-=(Offset o) {
-    x()-=o.x ();
-    y()-=o.y ();
+    (*this)[X_AXIS] -= o[X_AXIS];
+    (*this)[Y_AXIS] -= o[Y_AXIS];
+
     return *this;
   }
   
   Offset &scale (Offset o) {
-    x()*=o.x ();
-    y()*=o.y ();
+    (*this)[X_AXIS] *= o[X_AXIS];
+    (*this)[Y_AXIS] *= o[Y_AXIS];
+
     return *this;
   }
   Offset &operator *=(Real a) {
-    y() *= a;
-    x() *= a;
+    (*this)[X_AXIS] *= a;
+    (*this)[Y_AXIS] *= a;
+
     return *this;
   }
       
   Offset (Real ix , Real iy) {
-    x()=ix;
-    y()=iy;
+    coordinate_a_[X_AXIS] =ix;
+    coordinate_a_[Y_AXIS] =iy;    
   }
   Offset() {
-    x()=0.0;
-    y()=0.0;
+    coordinate_a_[X_AXIS]=
+      coordinate_a_[Y_AXIS]=
+      0.0;
   }
-#ifndef STANDALONE
+
   String str () const;
-#endif
 
   void mirror (Axis);
   Real  arg () const;
   Real length () const;
-};
-
-Offset complex_multiply (Offset, Offset);
-Offset complex_exp (Offset);
-
-
-inline Offset
-operator* (Offset z1, Offset z2)
-{
-  return complex_multiply (z1,z2);
-}
-
-inline Offset
-operator+ (Offset o1, Offset const& o2)
-{
-  o1 += o2;
-  return o1;
-}
+  Offset operator *=(Offset z2) {
+    *this = complex_multiply (*this,z2);
+    return *this;
+  }
 
-inline Offset
-operator- (Offset o1, Offset const& o2)
-{
-  o1 -= o2;
-  return o1;
-}
+};
 
+IMPLEMENT_ARITHMETIC_OPERATOR(Offset, +);
+IMPLEMENT_ARITHMETIC_OPERATOR(Offset, -);
+IMPLEMENT_ARITHMETIC_OPERATOR(Offset, *);
 
 inline Offset
 operator* (Real o1, Offset o2)
diff --git a/flower/include/polynomial.hh b/flower/include/polynomial.hh
new file mode 100644 (file)
index 0000000..df79274
--- /dev/null
@@ -0,0 +1,85 @@
+
+/*
+ * poly.h -- routines for manipulation of polynomials in one var
+ *
+ * (c) 1993, 1996,1999 Han-Wen Nienhuys
+ */
+
+#ifndef POLY_H
+#define POLY_H
+
+#include "array.hh"
+#include "arithmetic-operator.hh"
+#include "real.hh"
+
+/// structure for a polynomial in one var. 
+struct Polynomial
+{
+  /// degree of polynomial
+  int degree ()const;
+
+  /// coefficients 
+  Array<Real>     coefs_;
+
+  // leading coef
+  Real &lc();
+
+  // leading coef
+  Real lc() const;
+  void print() const ; 
+  Real eval(Real) const ;
+  void print_sols(Array<Real>) const ;
+  void check_sols(Array<Real>) const ;
+  void check_sol(Real x) const;
+  static Polynomial multiply(const Polynomial & p1, const Polynomial & p2);
+  static Polynomial power(int exponent, const Polynomial & src);
+
+  /// chop low coefficients
+  void clean();
+
+  /// eliminate #x#  close to  zero
+  void real_clean();
+  static Polynomial add(const Polynomial & p1, const Polynomial & p2);
+  void scalarmultiply(Real fact);
+  void operator *= (Real f) { scalarmultiply(f); }
+  void operator /= (Real f) { scalarmultiply(1/f); }
+  void operator += (Polynomial const &p2);
+  void operator *= (Polynomial const &p2);
+  void operator -= (Polynomial const &p2);
+  Polynomial (Real a, Real b =0.0);
+  Polynomial (){}
+  static Polynomial subtract(const Polynomial & p1, const Polynomial & p2);
+  void set_negate(const Polynomial & src);
+    
+  /// take the derivative
+  void differentiate();
+  int set_mod(const Polynomial &u, const Polynomial &v);
+
+  void debug_clean();
+
+  Array<Real> solve_quadric()const;
+  Array<Real> solve_cubic()const;
+  Array<Real> solve_linear()const;
+
+  Array<Real> solve () const;
+};
+
+
+IMPLEMENT_ARITHMETIC_OPERATOR(Polynomial, - );
+IMPLEMENT_ARITHMETIC_OPERATOR(Polynomial, + );
+IMPLEMENT_ARITHMETIC_OPERATOR(Polynomial, * );
+
+inline Polynomial
+operator * (Polynomial p, Real a)
+{
+  p *=a;
+  return p;
+}
+inline Polynomial
+operator * (Real a,Polynomial p)
+{
+  p *=a;
+  return p;
+}
+#endif
+
index 4e4e1e3bb0275bd98392d077b1ae03ab2e00ead3..90f70b73a66829e0fa0fb0e718d43dac1a4d34de 100644 (file)
@@ -63,7 +63,7 @@ complex_exp (Offset o)
 Real
 Offset::arg () const
 {
-  return atan2 (y (), x());
+  return atan2 (coordinate_a_[Y_AXIS], coordinate_a_[X_AXIS]);
 }
 
 /**
@@ -72,7 +72,7 @@ Offset::arg () const
 Real
 Offset::length () const
 {
-  return sqrt (sqr (x()) + sqr (y()));
+  return sqrt (sqr (coordinate_a_[X_AXIS]) + sqr (coordinate_a_[Y_AXIS]));
 }
 void
 Offset::mirror (Axis a)
diff --git a/flower/polynomial.cc b/flower/polynomial.cc
new file mode 100644 (file)
index 0000000..7fe77f2
--- /dev/null
@@ -0,0 +1,367 @@
+/*
+   poly.cc -- routines for manipulation of polynomials in one var
+
+   (c) 1993--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ */
+
+
+#include "polynomial.hh"
+
+/*
+   Een beter milieu begint bij uzelf. Hergebruik!
+
+
+   This was ripped from Rayce, a raytracer I once wrote. 
+*/
+
+Real
+Polynomial::eval (Real x)const
+{
+  Real p = 0.0;
+
+  // horner's scheme
+  for (int i = coefs_.size (); i--; )
+    p = x * p + coefs_[i];
+  
+  return p;
+}
+
+
+Polynomial
+Polynomial::multiply(const Polynomial & p1, const Polynomial & p2)
+{
+  Polynomial dest;
+
+  int deg= p1.degree () + p2.degree ();
+  for (int i = 0; i <= deg; i++)
+    {
+      dest.coefs_.push (0);
+      for (int j = 0; j <= i; j++)
+       if (i - j <= p2.degree () && j <= p1.degree ())
+         dest.coefs_.top () += p1.coefs_[j] * p2.coefs_[i - j];
+    }
+    
+  return dest;
+}
+
+void
+Polynomial::differentiate()
+{
+  for (int i = 1; i<= degree (); i++)
+    {
+      coefs_[i-1] = coefs_[i] * i;
+    }
+}
+
+Polynomial
+Polynomial::power(int exponent, const Polynomial & src)
+{
+  int e = exponent;
+  Polynomial dest(1), base(src);
+    
+  // classicint power. invariant: src^exponent = dest * src ^ e
+  // greetings go out to Lex Bijlsma & Jaap vd Woude
+  while (e > 0)
+    {
+      if (e % 2)
+        {
+         dest = multiply(dest, base);
+         e--;
+        } else
+         {
+            base = multiply(base, base);
+            e /= 2;
+         }
+    }
+  return  dest;
+}
+
+const Real FUDGE = 1e-8;
+
+void
+Polynomial::clean()
+{
+  int i;
+  for (i = 0; i <= degree (); i++)
+    {
+      if (abs(coefs_[i]) < FUDGE)
+       coefs_[i] = 0.0;
+    }
+
+  while (degree () > 0 && fabs (coefs_.top ()) < FUDGE * fabs (coefs_.top (1)))
+    coefs_.pop ();
+}
+
+
+Polynomial 
+Polynomial::add(const Polynomial & p1, const Polynomial & p2)
+{
+  Polynomial dest;
+  int tempord =  p2.degree () >? p1.degree ();
+  for (int i = 0; i <= tempord; i++)
+    {
+      Real temp = 0.0;
+      if (i <= p1.degree ())
+       temp += p1.coefs_[i];
+      if (i <= p2.degree ())
+       temp += p2.coefs_[i];
+      dest.coefs_.push (temp);
+    }
+  return dest;
+}
+
+void
+Polynomial::scalarmultiply(Real fact)
+{
+  for (int i = 0; i <= degree (); i++)
+    coefs_[i] *= fact;
+}
+
+Polynomial
+Polynomial::subtract(const Polynomial & p1, const Polynomial & p2)
+{
+  Polynomial dest;
+  int tempord =  p2.degree () >? p1.degree ();
+  
+  for (int i = 0; i <= tempord; i++)
+    {
+      Real temp = 0.0; // can't store result directly.. a=a-b
+      if (i <= p1.degree ())
+       temp += p1.coefs_[i];
+      if (i <= p2.degree ())
+       temp -= p2.coefs_[i];
+      dest.coefs_.push (temp);
+    }
+  return dest;
+  
+}
+
+void
+Polynomial::set_negate(const Polynomial & src)
+{
+  for (int i = 0; i <= src.degree(); i++)
+    coefs_[i] = -src.coefs_[i];
+}
+
+/// mod of #u/v#
+int 
+Polynomial::set_mod(const Polynomial &u, const Polynomial &v)
+{
+  (*this) = u;
+    
+  if (v.lc() < 0.0) {
+    for (int k = u.degree () - v.degree () - 1; k >= 0; k -= 2)
+      coefs_[k] = -coefs_[k];
+
+    for (int k = u.degree () - v.degree (); k >= 0; k--)
+      for (int j = v.degree () + k - 1; j >= k; j--)
+       coefs_[j] = -coefs_[j] - coefs_[v.degree () + k] * v.coefs_[j - k];
+  } else {
+    for (int k = u.degree () - v.degree (); k >= 0; k--)
+      for (int j = v.degree () + k - 1; j >= k; j--)
+       coefs_[j] -= coefs_[v.degree () + k] * v.coefs_[j - k];
+  }
+
+  int k = v.degree () - 1;
+  while (k >= 0 && coefs_[k] == 0.0)
+    k--;
+
+  coefs_.set_size(1+ ( (k < 0) ? 0 : k));
+  return degree();
+}
+
+void
+Polynomial::check_sol(Real x) const 
+{
+  Real f=eval(x);
+  Polynomial p(*this);
+  p.differentiate();
+  Real d = p.eval(x);
+  
+  if( abs(f) > abs(d) * FUDGE)
+    ;
+  /*
+    warning("x=%f is not a root of polynomial\n"
+    "f(x)=%f, f'(x)=%f \n", x, f, d);  */
+}
+       
+void
+Polynomial::check_sols(Array<Real> roots) const
+{
+  for (int i=0; i< roots.size (); i++)
+    check_sol(roots[i]);
+}
+
+Polynomial::Polynomial (Real a, Real b)
+{
+  coefs_.push (a);
+  if (b)
+    coefs_.push (b);
+}
+
+/* cubic root. */
+inline Real cubic_root(Real x)
+{
+  if (x > 0.0)
+    return pow(x, 1.0/3.0) ;
+  else if (x < 0.0)
+    return -pow(-x, 1.0/3.0);
+  else
+    return 0.0;
+}
+
+static bool
+iszero (Real r)
+{
+  return !r;
+}
+
+Array<Real>
+Polynomial::solve_cubic()const
+{
+  Array<Real> sol;
+  
+  /* normal form: x^3 + Ax^2 + Bx + C = 0 */
+  Real A = coefs_[2] / coefs_[3];
+  Real B = coefs_[1] / coefs_[3];
+  Real C = coefs_[0] / coefs_[3];
+
+  /*
+   * substitute x = y - A/3 to eliminate quadric term: x^3 +px + q = 0
+   */
+
+  Real sq_A = A * A;
+  Real p = 1.0 / 3 * (-1.0 / 3 * sq_A + B);
+  Real q = 1.0 / 2 * (2.0 / 27 * A * sq_A - 1.0 / 3 * A * B + C);
+
+  /* use Cardano's formula */
+
+  Real cb_p = p * p * p;
+  Real D = q * q + cb_p;
+
+  if (iszero(D)) {
+    if (iszero(q)) {   /* one triple solution */
+      sol.push (0);
+      sol.push (0);
+      sol.push (0);      
+    } else {           /* one single and one double solution */
+      Real u = cubic_root(-q);
+
+      sol.push (2 * u);
+      sol.push (-u);
+    }
+  } else if (D < 0) {          /* Casus irreducibilis: three real solutions */
+    Real phi = 1.0 / 3 * acos(-q / sqrt(-cb_p));
+    Real t = 2 * sqrt(-p);
+
+    sol.push (t * cos(phi));
+    sol.push (-t * cos(phi + M_PI / 3));
+    sol.push ( -t * cos(phi - M_PI / 3));
+  } else {                     /* one real solution */
+    Real sqrt_D = sqrt(D);
+    Real u = cubic_root(sqrt_D - q);
+    Real v = -cubic_root(sqrt_D + q);
+
+    sol.push ( u + v);
+  }
+
+  /* resubstitute */
+  Real sub = 1.0 / 3 * A;
+
+  for (int i = sol.size (); i--;)
+    {
+      sol[i] -= sub;
+
+      assert (fabs (eval (sol[i]) ) < 1e-8);
+    }
+  
+  return sol;
+}
+
+Real
+Polynomial::lc () const
+{
+  return coefs_.top();
+}
+
+Real&
+Polynomial::lc () 
+{
+  return coefs_.top ();
+}
+
+int
+Polynomial::degree ()const
+{
+  return coefs_.size () -1;
+}
+/*
+   all roots of quadratic eqn.
+ */
+Array<Real>
+Polynomial::solve_quadric()const
+{
+  Array<Real> sol;
+  /* normal form: x^2 + px + q = 0 */
+  Real p = coefs_[1] / (2 * coefs_[2]);
+  Real q = coefs_[0] / coefs_[2];
+
+  Real D = p * p - q;
+
+  if (D>0) {
+    D = sqrt(D);
+
+    sol.push ( D - p);
+    sol.push ( -D - p);
+  }
+  return sol; 
+}
+
+/* solve linear equation */
+Array<Real>
+Polynomial::solve_linear()const
+{
+  Array<Real> s;
+  if (coefs_[1])
+    s.push ( -coefs_[0] / coefs_[1]);
+  return s;
+}
+
+
+Array<Real>
+Polynomial::solve () const
+{
+  Polynomial * me = (Polynomial*) this;
+  me->clean ();
+  
+  switch (degree ())
+    {
+    case 1:
+      return solve_linear ();
+    case 2:
+      return solve_quadric ();
+    case 3:
+      return solve_cubic ();
+    }
+  assert (false);
+  Array<Real> s;
+  return s;
+}
+
+void
+Polynomial:: operator *= (Polynomial const &p2)
+{
+  *this = multiply (*this,p2);
+}  
+
+void
+Polynomial::operator += (Polynomial const &p)
+{
+  *this = add( *this, p);
+}
+
+void
+Polynomial::operator -= (Polynomial const &p)
+{
+  *this = subtract(*this, p);
+}
diff --git a/input/bugs/1845390254.ly b/input/bugs/1845390254.ly
new file mode 100644 (file)
index 0000000..87b066e
--- /dev/null
@@ -0,0 +1,38 @@
+
+% Generated by mudela-book.py; options are center
+\include "paper16.ly"
+\paper  { linewidth = 390.000000 \pt; } 
+
+\header {
+        title = "The river is flowing";
+        composer = "Traditional (?)";
+}
+\include "paper16.ly"
+
+melody = \notes \relative c' {
+        \partial 8;
+        g8 |
+
+}
+
+text = \lyrics {
+        The
+}
+
+accompaniment =\chords {
+        r8
+        c2:3- f:3-.7 d:min es4 c8:min r8
+        c2:min f:min7 g:7^3.5 c:min }
+
+\score {
+        \simultaneous {
+
+          \addlyrics
+            \context Staff = mel {
+              \melody 
+            }
+            \context Lyrics \text
+        }
+%        \midi  { }
+        \paper { linewidth = 10.0\cm; }
+}
index 83bbdcd9ef2fc19b77da96884c4d4250652a63f7..00cddc0806aa24194d8ef3e74561607407e45715 100644 (file)
@@ -1,7 +1,7 @@
 # input/test/Makefile
 
 depth = ../..
-examples=font20 
+examples=font20  sleur
 LOCALSTEPMAKE_TEMPLATES=mutopia
 
 include $(depth)/make/stepmake.make 
index 7663aab22b392f0902ad1ca7041eb9df1f7eba80..1eb882832bc70119c74851570994a32aa308be30 100644 (file)
@@ -82,11 +82,11 @@ Adobe_font_metric::read_char_metrics (Data_file &input, int size)
 }
 
 #define READSTRING(k)  if (key == #k) { \
-  afm.k ## _ = input.get_line (); continue; }
+  afm->k ## _ = input.get_line (); continue; }
 #define READBOX(b) if (key == #b) { \
-  afm.b ## _ = read_box (input); continue; }
+  afm->b ## _ = read_box (input); continue; }
 #define READREAL(r) if (key == #r) { \
-  afm.r ## _ = read_real (input); continue; }
+  afm->r ## _ = read_real (input); continue; }
 
 Real
 read_real(Data_file &d)
@@ -108,7 +108,7 @@ read_box ( Data_file &d)
   return b;
 }
 
-Adobe_font_metric
+Adobe_font_metric *
 read_afm_file (String fn)
 {
   Data_file input (fn);
@@ -120,11 +120,10 @@ read_afm_file (String fn)
     {}
   int font_size = String_convert::dec2_i(fn.cut_str(i+1,INT_MAX));
 
-  Adobe_font_metric afm;
-
+  Adobe_font_metric *afm = new Adobe_font_metric;
   for (i=0; i < 256; i++)
     {
-      afm.ascii_to_metric_idx_.push (-1);
+      afm->ascii_to_metric_idx_.push (-1);
     }
 
   while (!input.eof_b ())
@@ -157,7 +156,7 @@ read_afm_file (String fn)
       if (key == "StartCharMetrics")
        {
          input.get_line ();
-         afm.read_char_metrics (input, font_size);
+         afm->read_char_metrics (input, font_size);
        }
       if (key == "EndFontMetrics")
        break;
index 5f4080015c39040d4b9a1b3f2f90e4e2c3c47244..fed4065602c52a9b984a867ae860984ce7f49d00 100644 (file)
@@ -43,17 +43,21 @@ Align_element::do_side_processing ()
 
          // todo: fucks up if item both in Halign & Valign. 
          SCM min_dims = e->remove_elt_property ("minimum-space");
-         if (min_dims != SCM_UNDEFINED)
+         if (gh_pair_p (min_dims) &&
+             gh_number_p (gh_car (min_dims))
+             && gh_number_p (gh_cdr (min_dims)))
            {
-             y.unite (Interval (gh_scm2double (SCM_CAR (min_dims)),
-                                gh_scm2double (SCM_CDR (min_dims))));
+             y.unite (Interval (gh_scm2double (gh_car  (min_dims)),
+                                gh_scm2double (gh_cdr (min_dims))));
            }
          
          SCM extra_dims = e->remove_elt_property ("extra-space");
-         if (extra_dims != SCM_UNDEFINED)
+         if (gh_pair_p (extra_dims) &&
+             gh_number_p (gh_car (extra_dims))
+             && gh_number_p (gh_cdr (extra_dims)))
            {
-             y[LEFT] += gh_scm2double (SCM_CAR (extra_dims));
-             y[RIGHT] += gh_scm2double (SCM_CDR (extra_dims));
+             y[LEFT] += gh_scm2double (gh_car  (extra_dims));
+             y[RIGHT] += gh_scm2double (gh_cdr (extra_dims));
            }
 
          elems.push (e);
@@ -96,10 +100,6 @@ Align_element::do_side_processing ()
     
   if (center_f)
     translate_axis ( - center_f, axis ());
-
-
-  //  dim_cache_[axis ()]->invalidate ();
-
 }
 
 Align_element::Align_element()
index eddad21ed05589c5e8efccf885787ca41a85ba6a..89608e47680fd02d5c11f6cabbb509acb3119c4e 100644 (file)
@@ -13,7 +13,6 @@
 #include "warn.hh"
 #include "afm.hh"
 #include "tfm.hh"
-#include "dictionary-iter.hh"
 #include "lily-guile.hh"
 #include "tfm-reader.hh"
 
@@ -27,7 +26,8 @@ All_font_metrics::All_font_metrics (String path)
 Adobe_font_metric *
 All_font_metrics::find_afm (String name)
 {
-  if (!afm_p_dict_.elem_b (name))
+  SCM sname = ly_symbol2scm (name.ch_C ());
+  if (!afm_p_dict_.elem_b (sname))
     {
       String path = name  + ".afm";
       path = search_path_.find (path);
@@ -35,16 +35,17 @@ All_font_metrics::find_afm (String name)
        return 0;
       
       *mlog << "[" << path;
-      Adobe_font_metric
-       * afm_p = new Adobe_font_metric (read_afm_file (path));
+      Adobe_font_metric * afm_p = read_afm_file (path);
 
       afm_p->name_str_ = name;
       
       *mlog << "]" << flush ;
 
-      afm_p_dict_[name] = afm_p;
+      afm_p_dict_[sname] = afm_p->self_scm_;
+      scm_unprotect_object (afm_p->self_scm_);
     }
-  return afm_p_dict_[name];  
+  
+  return dynamic_cast<Adobe_font_metric*> (unsmob_metrics (afm_p_dict_[sname]));
 }
 
 Scaled_font_metric * 
@@ -52,21 +53,28 @@ All_font_metrics::find_scaled (String nm, int m)
 {
   Scaled_font_metric * s=0;
   String index =  nm + "@" + to_str (m);
-  if (!scaled_p_dict_.elem_b (index))
+  SCM sname = ly_symbol2scm (index.ch_C ());
+
+  Font_metric *fm =0;
+  if (!scaled_p_dict_.elem_b (sname))
     {
       Font_metric *f = find_font (nm);
       s = new Scaled_font_metric (f, m);
-      scaled_p_dict_[index] = s;
-      return s;  
+      scaled_p_dict_[sname] = s->self_scm_;
+      fm =  s;
+      scm_unprotect_object (s->self_scm_);
     }
   else
-    return scaled_p_dict_[index];
+    fm = unsmob_metrics (scaled_p_dict_[sname]);
+
+  return dynamic_cast<Scaled_font_metric*> (fm);
 }
 
 Tex_font_metric *
 All_font_metrics::find_tfm (String name)
 {
-  if (!tfm_p_dict_.elem_b (name))
+  SCM sname = ly_symbol2scm (name.ch_C ());  
+  if (!tfm_p_dict_.elem_b (sname))
     {
       String path = name  + ".tfm";
       path = search_path_.find (path);
@@ -79,9 +87,12 @@ All_font_metrics::find_tfm (String name)
 
       *mlog << "]" << flush ;
 
-      tfm_p_dict_[name] = tfm_p;
+      tfm_p_dict_[sname] = tfm_p->self_scm_;
+      scm_unprotect_object (tfm_p->self_scm_);      
     }
-  return tfm_p_dict_[name];  
+    
+  return
+    dynamic_cast<Tex_font_metric*> (unsmob_metrics (tfm_p_dict_[sname]));
 }
 
 
@@ -106,19 +117,40 @@ All_font_metrics::find_font (String name)
   error (_f ("Can't find default font: `%s'", default_font_sz_));
   error (_f ("(search path: `%s'", search_path_.str ()));
   error (_ ("Giving up"));
+
+  return 0;
 }
 
 SCM
 All_font_metrics::font_descriptions () const
 {
-  SCM l = SCM_EOL;
-  for (Dictionary_iter<Adobe_font_metric*> ai(afm_p_dict_); ai.ok (); ai++)
-    l = gh_cons (ai.val ()->description (), l);
-  for (Dictionary_iter<Tex_font_metric*> ai(tfm_p_dict_); ai.ok (); ai++)
-    l = gh_cons(ai.val ()->description (), l);
-
-  for (Dictionary_iter<Scaled_font_metric*> ai(scaled_p_dict_); ai.ok (); ai++)
-    l = gh_cons (ai.val ()->description (),l);
-  
-  return l;
+  SCM l[] = {0,0,0};
+
+  l[0] = afm_p_dict_.to_alist ();
+  l[1] = tfm_p_dict_.to_alist ();
+  l[2] = scaled_p_dict_.to_alist ();  
+
+  SCM list = SCM_EOL;
+  for (int i=0; i < 3; i++)
+    {
+      for (SCM s = l[i];  gh_pair_p (s); s = gh_cdr (s))
+       {
+         Font_metric * fm = unsmob_metrics (gh_cdar (s));
+
+         list = gh_cons (fm->description (), list);
+       }
+    }
+  return list;
+}
+
+Font_metric *
+unsmob_metrics( SCM s)
+{
+  if (SMOB_IS_TYPE_B(Font_metric, s))
+    return SMOB_TO_TYPE(Font_metric, s);
+  else
+    return 0;
 }
+
+#include "ly-smobs.icc"
+IMPLEMENT_SMOBS(Font_metric);
index 152e411cff1ec033224b004e1e96072067dc60be..de137b9a380aa2a05148e620c46f62b941fa9d51 100644 (file)
 
 /*
   [TODO]
-    * center beam symbol
     * less hairy code
     * move paper vars to scm
 
-    */
-
-//#include <math.h>
+*/
 
 #include "beaming.hh"
 #include "dimensions.hh"
@@ -87,7 +84,7 @@ Beam::do_pre_processing ()
     }
 
   if (!get_direction ())
-    set_direction (calc_default_dir ());
+    set_direction (get_default_dir ());
 
   auto_knees ();
   set_stem_directions ();
@@ -99,7 +96,7 @@ Beam::do_pre_processing ()
  FIXME
  */
 Direction
-Beam::calc_default_dir () const
+Beam::get_default_dir () const
 {
   Drul_array<int> total;
   total[UP]  = total[DOWN] = 0;
@@ -529,7 +526,8 @@ Beam::quantise_dy_f (Real dy) const
   allowed_fraction[1] = (beam_f / 2 + staffline_f / 2);
   allowed_fraction[2] = (beam_f + staffline_f);
 
-  Interval iv = quantise_iv (allowed_fraction, interline_f, abs (dy));
+  allowed_fraction.push (interline_f);
+  Interval iv = quantise_iv (allowed_fraction,  abs (dy));
   Real q = (abs (dy) - iv[SMALLER] <= iv[BIGGER] - abs (dy))
     ? iv[SMALLER]
     : iv[BIGGER];
@@ -607,8 +605,9 @@ Beam::quantise_y_f (Real y, Real dy, int quant_dir)
        allowed_position.push (hang);
     }
 
+  allowed_position.push (space);
   Real up_y = get_direction () * y;
-  Interval iv = quantise_iv (allowed_position, space, up_y);
+  Interval iv = quantise_iv (allowed_position, up_y);
 
   Real q = up_y - iv[SMALLER] <= iv[BIGGER] - up_y 
     ? iv[SMALLER] : iv[BIGGER];
index 024db5f7b84b55edfaf2d1398327db84cf6960f9..781220d72ca6080e950ce627af2fc8535d1f8d67 100644 (file)
 
 #include <math.h>
 #include "bezier.hh"
-#include "misc.hh"
-
-#ifndef STANDALONE
-#include "dimensions.hh"
-#include "direction.hh"
-#include "paper-def.hh"
-#include "debug.hh"
-#include "main.hh"
-#define BEZIER_BOW_DEBUG_OUT if (flower_dstream && !flower_dstream->silent_b ("Bezier_bow")) cout
-#else
-#define BEZIER_BOW_DEBUG_OUT cerr
-#endif
-
+#include "polynomial.hh"
 
 /*
-  [TODO]
 
-  * better names, esp. for all calc_foo functions
-  * blow_fit vs calc_default (Real) and calc_f (Real)
-  * exact height / tangent calculation
+  Formula of the bezier 3-spline
 
+  sum_{j=0}^3  (3 over j) z_j (1-t)^(3-j)  t^j
  */
 
-
-/*
-  UGH. Remove debugging junk.
-  */
-
-
-void
-Curve::flipy ()
-{
-  for (int i = 0; i < size (); i++)
-    (*this)[i].mirror (Y_AXIS);
-}
-
-int
-Curve::largest_disturbing ()
-{
-  Real alpha = 0;
-  int j = 0;
-  for (int i = 1; i < size (); i++)
-    {
-      if ((*this)[i][Y_AXIS] > 0)
-        {
-         Real phi = (*this)[i][Y_AXIS] / (*this)[i][X_AXIS];
-         if (phi > alpha)
-           {
-             alpha = phi;
-             j = i;
-           }
-       }
-    }
-  return j;
-}
-
-void
-Curve::rotate (Real phi)
-{
-  Offset rot (complex_exp (Offset (0, phi)));
-  for (int i = 0; i < size (); i++)
-    (*this)[i] = complex_multiply (rot, (*this)[i]);
-}
-
-void
-Curve::translate (Offset o)
-{
-  for (int i = 0; i < size (); i++)
-    (*this)[i] += o;
-}
-
 Bezier::Bezier ()
 {
-  control_.set_size (4);
-}
-
-void
-Bezier::calc (int steps)
-{       
-  steps = steps >? 10;
-  curve_.set_size (steps);
-  Real dt = 1.0 / curve_.size ();
-  Offset c = 3.0 * (control_[1] - control_[0]);
-  Offset b = 3.0 * (control_[2] - control_[1]) - c;
-  Offset a = control_[3] - (control_[0] + c + b);
-  Real t = 0.0;
-  for (int i = 0; i < curve_.size (); i++ )
-    {    
-      curve_[i] = ((a * t + b) * t + c) * t + control_[0];
-      t += dt;
-    }
-}
-
-void
-Bezier::print () const
-{
-#ifndef NPRINT
-  if (flower_dstream && !flower_dstream->silent_b ("Bezier_controls"))
-    {
-      if (control_[1].length ())
-        {
-         cout << "Bezier\n";
-         cout << "Controls:  ";
-         for (int i=0; i < control_.size (); i++)
-           cout << control_[i].str () << ", ";
-       }
-    }
-#endif
-}
-
-void
-Bezier::set (Array<Offset> points)
-{       
-  assert (points.size () == 4);
-  control_ = points;
 }
 
 Real
-Bezier::y (Real x)
+Bezier::get_other_coordinate (Axis a,  Real x) const
 {
-  // ugh
-  // bounds func should be templatised to take array of offsets too?
-  Array<Real> positions;
-  for (int i = 0; i < curve_.size (); i++)
-    positions.push (curve_[i][X_AXIS]);
-
-  Slice slice = get_bounds_slice (positions, x);
-  // ugh
-  Offset z1 = curve_[0 >? slice[BIGGER] - 1];
-  Offset z2 = curve_[1 >? slice[BIGGER]];
-  Real multiplier = (x - z2[X_AXIS]) / (z1[X_AXIS] - z2[X_AXIS]);
-  Real y = z1[Y_AXIS] * multiplier + (1.0 - multiplier) * z2[Y_AXIS];
-
-  return y;
-}
-
-
-Bezier_bow::Bezier_bow (Paper_def* paper_l)
-{
-  paper_l_ = paper_l;
-  return_.set_size (4);
-}
-
-void
-Bezier_bow::blow_fit ()
-{
-  Real dy1 = check_fit_f ();
-  if (!dy1)
-    return;
-
-  // be careful not to take too big step
-  Real f = 0.3;
-  Real h1 = dy1 * f;
-  control_[1][Y_AXIS] += h1; 
-  control_[2][Y_AXIS] += h1; 
-  return_[1][Y_AXIS] += h1; 
-  return_[2][Y_AXIS] += h1; 
-
-  calc_bezier ();
-  Real dy2 = check_fit_f ();
-  if (!dy2)
-    return;
-
-#ifndef STANDALONE
-  Real internote_f = paper_l_->get_var ("interline")/2.0;
-#else
-  Real internote_f = STAFFHEIGHT / 8;
-#endif
-
-  Real epsilon = internote_f / 4;
-  if (abs (dy2 - dy1) < epsilon)
-    return;
+  Axis other = Axis ((a +1)%NO_AXES);
+  Array<Real> ts = solve_point (a, x);
   
-  /*
-    Assume 
-      dy = B (h) 
-    with 
-      B (h) = a * h + b;
-
-    Then we get for h : B (h) = 0
-
-     B(0)  = dy1 = a * 0 + b   =>   b = dy1
-     B(h1) = dy2 = a * h1 + b  =>   a * f * dy1 + b = dy2
-
-        =>
-
-     a * dy1 / 2 + dy1 = dy2  =>  a = (dy2 - dy1) / (f * dy1)
-   */
-
-  Real a = (dy2 - dy1) / (f * dy1);
-  Real b = dy1;
-  Real h = -b / a;
-
-  if (sign (h) != sign (h1))
-    return;
-
-  if (sign (h) != sign (h1))
-    return;
-
-  control_[1][Y_AXIS] += -h1 +h; 
-  control_[2][Y_AXIS] += -h1 +h; 
-  return_[1][Y_AXIS] += -h1 +h;
-  return_[2][Y_AXIS] += -h1 +h; 
-}
-
-void
-Bezier_bow::calc_bezier ()
-{
-  Real s = sqrt (control_[3][X_AXIS] * control_[3][X_AXIS] 
-    + control_[1][Y_AXIS] * control_[2][Y_AXIS]);
-#ifndef STANDALONE
-  Real internote = paper_l_->get_var ("interline")/2.0;
-#else
-  Real internote = STAFFHEIGHT / 8;
-#endif
-  int steps = (int)rint (s / internote);
-  Bezier::calc (steps);
+  Offset c = curve_point (ts[0]);
+  assert (fabs (c[a] - x) < 1e-8);
+  
+  return c[other];
 }
 
 Real
-Bezier_bow::calc_f (Real height)
+binomial_coefficient (Real over , int under)
 {
-  transform ();
-  calc_default (height);
-  calc_bezier ();
+  Real x = 1.0;
 
-  Real dy = check_fit_f ();
-  calc_return (0, 0);
+  while (under)
+    {
+      x *= over / Real (under);
 
-  transform_back ();
-  return dy;
+      over  -= 1.0;
+      under --;
+    }
+  return x;
 }
 
-void
-Bezier_bow::calc ()
+Offset
+Bezier::curve_point (Real t)const
 {
-#ifndef NPRINT
-//  if (flower_dstream && !flower_dstream->silent_b ("Bezier_bow_controls"))
-  if (flower_dstream && !(flower_dstream->silent_b ("Bezier_controls")
-    && flower_dstream->silent_b ("Bezier_bow_controls")))
-    {
-      cout << "Before transform*********\n";
-      print ();
-      cout << "************************\n";
-    }
-#endif
-  transform ();
-  print ();
-
-  calc_controls ();
+  Real tj = 1;
+  Real one_min_tj =  (1-t)*(1-t)*(1-t);
 
-  /*
-    duh, this is crude (control-points)
-    perhaps it's even better to check the amount of blow_fit ()
-   */
-  for (int i=0; i < control_.size (); i++)
+  Offset o;
+  for (int j=0 ; j < 4; j++)
     {
-      Real y = control_[i][Y_AXIS];
-      curve_extent_drul_[Y].unite (Interval (y, y));
-      Real x = control_[i][X_AXIS];
-      curve_extent_drul_[X].unite (Interval (x, x));
-    }
+      o += control_[j] * binomial_coefficient (3, j)
+       * pow (t,j) * pow (1-t, 3-j);
 
-  print ();
-  transform_back ();
-#ifndef NPRINT
-//  if (flower_dstream && !flower_dstream->silent_b ("Bezier_bow_controls"))
-  if (flower_dstream && !(flower_dstream->silent_b ("Bezier_controls")
-    && flower_dstream->silent_b ("Bezier_bow_controls")))
-    {
-      cout << "After transform*********\n";
-      print ();
-      cout << "************************\n";
+      tj *= t;
+      if (1-t)
+       one_min_tj /= (1-t);
     }
-#endif
-}
 
-/*
-  [TODO]
-    * see if it works
-    * document in Documentation/fonts.tex
- */
-
-/*
-  Clipping
-
-  This function tries to address two issues:
-    * the tangents of the slur should always point inwards 
-      in the actual slur, i.e.  *after rotating back*.
-
-    * slurs shouldn't be too high 
-      let's try : h <= 1.2 b && h <= 3 staffheight?
+  assert (fabs (o[X_AXIS] - polynomial (X_AXIS).eval (t))< 1e-8);
+  assert (fabs (o[Y_AXIS] - polynomial (Y_AXIS).eval (t))< 1e-8);
 
-  We could calculate the tangent of the bezier curve from
-  both ends going inward, and clip the slur at the point
-  where the tangent (after rotation) points up (or inward
-  with a certain maximum angle).
   
-  However, we assume that real clipping is not the best
-  answer.  We expect that moving the outer control point up 
-  if the slur becomes too high will result in a nicer slur 
-  after recalculation.
+  return o;
+}
 
-  Knowing that the tangent is the line through the first
-  two control points, we'll clip (move the outer control
-  point upwards) too if the tangent points outwards.
- */
 
-bool
-Bezier_bow::calc_clipping ()
+Polynomial
+Bezier::polynomial (Axis a)const
 {
-#ifndef STANDALONE
-  Real clip_height = paper_l_->get_var ("slur_clip_height");
-  Real clip_ratio = paper_l_->get_var ("slur_clip_ratio");
-  Real clip_angle = paper_l_->get_var ("slur_clip_angle");
-#else
-  Real staffsize_f = STAFFHEIGHT;
-  Real clip_height = 3.0 * staffsize_f;
-  Real clip_ratio = 1.2;
-  Real clip_angle = 100;
-#endif
-
-  Real b = control_[3][X_AXIS] - control_[0][X_AXIS];
-  Real clip_h = clip_ratio * b <? clip_height;
-  Real begin_h = control_[1][Y_AXIS] - control_[0][Y_AXIS];
-  Real end_h = control_[2][Y_AXIS] - control_[3][Y_AXIS];
-  Real begin_dy = 0 >? begin_h - clip_h;
-  Real end_dy = 0 >? end_h - clip_h;
-  
-  Real pi = M_PI;
-  Real begin_alpha = (control_[1] - control_[0]).arg () + get_direction () * alpha_;
-  Real end_alpha = pi -  (control_[2] - control_[3]).arg () - get_direction () * alpha_;
-
-  Real max_alpha = clip_angle / 90 * pi / 2;
-  if ((begin_dy < 0) && (end_dy < 0)
-    && (begin_alpha < max_alpha) && (end_alpha < max_alpha))
-    return false;
-
-  transform_back ();
-
-  bool again = true;
-
-  if ((begin_dy > 0) || (end_dy > 0))
+  Polynomial p (0.0);
+  for (int j=0; j <= 3; j++)
     {
-      Real dy = (begin_dy + end_dy) / 4;
-      dy *= cos (alpha_);
-      encompass_[0][Y_AXIS] += get_direction () * dy;
-      encompass_[encompass_.size () - 1][Y_AXIS] += get_direction () * dy;
+      p += control_[j][a]
+       * Polynomial::power (j , Polynomial (0,1))*
+       Polynomial::power (3 - j, Polynomial (1,-1))*
+       binomial_coefficient(3, j);
     }
-  else
-    {
-      //ugh
-      Real c = 0.4;
-      if (begin_alpha >= max_alpha)
-       begin_dy = 0 >? c * begin_alpha / max_alpha * begin_h;
-      if (end_alpha >= max_alpha)
-       end_dy = 0 >? c * end_alpha / max_alpha * end_h;
-
-      encompass_[0][Y_AXIS] += get_direction () * begin_dy;
-      encompass_[encompass_.size () - 1][Y_AXIS] += get_direction () * end_dy;
 
-      Offset delta = encompass_[encompass_.size () - 1] - encompass_[0];
-      alpha_ = delta.arg ();
-    }
-
-  transform ();
-
-  return again;
+  return p;
 }
 
-void
-Bezier_bow::calc_controls ()
+/**
+   Remove all numbers outside [0,1] from SOL
+ */
+Array<Real>
+filter_solutions (Array<Real> sol)
 {
-  for (int i = 0; i < 3; i++)
-    {
-      if (i && !calc_clipping ())
-       return;
-
-      /*
-       why do we always recalc from 0?
-       shouldn't calc_f () be used (too), rather than blow_fit () (only)?
-       */
-      calc_default (0);
-      calc_bezier ();
-      
-      if (check_fit_bo ())
-        {
-         calc_return (0, 0);
-         return;
-       }
-      calc_tangent_controls ();
-
-      blow_fit ();
-      // ugh
-      blow_fit ();
-    }
+  for (int i = sol.size (); i--;)
+    if (sol[i] < 0 || sol[i] >1)
+      sol.del (i);
+  return sol;
 }
 
-void
-Bezier_bow::calc_return (Real begin_alpha, Real end_alpha)
+/**
+   find t such that derivative is proportional to DERIV
+ */
+Array<Real>
+Bezier::solve_derivative (Offset deriv)const
 {
-#ifndef STANDALONE
-  Real thick = paper_l_->get_var ("slur_thickness");
-#else
-  Real thick = 1.8 * 0.4 PT;
-#endif
+  Polynomial xp[2];
 
-  return_[0] = control_[3];
-  return_[3] = control_[0];
-
-  return_[1] = control_[2] - thick * complex_exp (Offset (0, 90 + end_alpha));
-  return_[2] = control_[1] 
-    - thick * complex_exp (Offset (0, 90 - begin_alpha));  
+  xp[X_AXIS] = polynomial (X_AXIS);
+  xp[Y_AXIS] = polynomial (Y_AXIS);    
+  Polynomial combine = xp[X_AXIS] * deriv[Y_AXIS] - xp[Y_AXIS] * deriv [X_AXIS];
+  return filter_solutions (combine.solve ());
 }
+  
 
 /*
- See Documentation/fonts.tex
- */
-void
-Bezier_bow::calc_tangent_controls ()
+  Find t such that curve_point (t)[AX] == COORDINATE
+*/
+Array<Real> 
+Bezier::solve_point (Axis ax, Real coordinate) const
 {
-  Offset ijk_p (control_[3][X_AXIS] / 2, control_[1][Y_AXIS]);
-  BEZIER_BOW_DEBUG_OUT << "ijk: " << ijk_p[X_AXIS] << ", " << ijk_p[Y_AXIS] << endl;
-
-  Real default_rc = ijk_p[Y_AXIS] / ijk_p[X_AXIS];
-
-  int begin_disturb = encompass_.largest_disturbing ();
-  Offset begin_p = begin_disturb ? Offset (encompass_[begin_disturb][X_AXIS], 
-    encompass_[begin_disturb][Y_AXIS]) : ijk_p;
-  Real begin_rc = begin_p[Y_AXIS] / begin_p[X_AXIS];
-  if (default_rc > begin_rc)
-    {
-      begin_p = ijk_p;
-      begin_rc = default_rc;
-    }
-
-  Curve reversed;
-  reversed.set_size (encompass_.size ());
-  Real b = control_[3][X_AXIS];
-  for (int i = 0; i < encompass_.size (); i++ )
-    {
-      //       b     1  0
-      // r  =     -        *  c 
-      //       0     0 -1   
-      reversed[i][X_AXIS] = b - encompass_[encompass_.size () - i - 1][X_AXIS];
-      reversed[i][Y_AXIS] = encompass_[encompass_.size () - i - 1][Y_AXIS];
-    }
-
-  int end_disturb = reversed.largest_disturbing ();
-  end_disturb = end_disturb ? encompass_.size () - end_disturb - 1 : 0;
-  Offset end_p = end_disturb ? Offset (encompass_[end_disturb][X_AXIS], 
-    encompass_[end_disturb][Y_AXIS]) : ijk_p;
-  Real end_rc = end_p[Y_AXIS] / (control_[3][X_AXIS] - end_p[X_AXIS]);
-  if (default_rc > end_rc)
-    {
-      end_p = ijk_p;
-      end_rc = default_rc;
-    }
-
-  Real height =control_[1][Y_AXIS]; 
-  for (int i = 0; i < encompass_.size (); i++ )
-    height = height >? encompass_[i][Y_AXIS];
-
-  // emperic computer science:
-  //   * tangents somewhat steeper than minimal line
-#ifndef STANDALONE
-  Real internote = paper_l_->get_var ("interline")/2.0;
-  Real rc_correct = paper_l_->get_var ("slur_rc_factor");
-#else
-  Real internote = STAFFHEIGHT / 8;
-  Real rc_correct = 2.4;
-#endif
-
-  begin_rc *= rc_correct;
-  end_rc *= rc_correct;
-  Real rc1 = begin_rc;
-  Real rc2 = -end_rc;
+  Polynomial p(polynomial (ax));
+  p.coefs_[0] -= coordinate;
   
-  Real begin_alpha = atan (begin_rc);
-  Real end_alpha = atan (-end_rc);
-  Real theta = (begin_alpha - end_alpha) / 2;
-
-  Real epsilon = internote / 5;
-
-  // if we have two disturbing points, have height line through those...
-  if (!((abs (begin_p[X_AXIS] - end_p[X_AXIS]) < epsilon)
-    && (abs (begin_p[Y_AXIS] - end_p[Y_AXIS]) < epsilon)))
-      theta = atan (end_p[Y_AXIS] - begin_p[Y_AXIS]) / (end_p[X_AXIS] - begin_p[X_AXIS]);
-
-  Real rc3 = tan (theta);
-  // ugh: be less steep
-  rc3 /= 2*rc_correct;
-
-  Real c2 = -rc2 * control_[3][X_AXIS];
-  Real c3 = begin_p[Y_AXIS] > end_p[Y_AXIS] ? begin_p[Y_AXIS] 
-    - rc3 * begin_p[X_AXIS] : end_p[Y_AXIS] - rc3 * end_p[X_AXIS];
-
-  control_[1][X_AXIS] = c3 / (rc1 - rc3);
-  control_[1][Y_AXIS] = rc1 * control_[1][X_AXIS];
-  control_[2][X_AXIS] = (c3 - c2) / (rc2 - rc3);
-  control_[2][Y_AXIS] = rc2 * control_[2][X_AXIS] + c2;
-
-  calc_return (begin_alpha, end_alpha);
-}
-
-bool
-Bezier_bow::check_fit_bo ()
-{
-  for (int i = 1; i < encompass_.size () - 1; i++)
-    if ((encompass_[i][X_AXIS] > encompass_[0][X_AXIS])
-      && (encompass_[i][X_AXIS] < encompass_[encompass_.size () -1][X_AXIS]))
-      if (encompass_[i][Y_AXIS] > y (encompass_[i][X_AXIS]))
-       return false;
-  return true;
-}
-
-Real
-Bezier_bow::check_fit_f ()
-{
-  Real dy = 0;
-  for (int i = 1; i < encompass_.size () - 1; i++)
-    if ((encompass_[i][X_AXIS] > encompass_[0][X_AXIS])
-      && (encompass_[i][X_AXIS] < encompass_[encompass_.size () -1][X_AXIS]))
-      dy = dy >? (encompass_[i][Y_AXIS] - y (encompass_[i][X_AXIS]));
-  return dy;
+  Array<Real> sol (p.solve ());
+  return filter_solutions (sol);
 }
 
-void
-Bezier_bow::print () const
+Interval
+Bezier::extent (Axis a)const
 {
-#ifndef NPRINT
-  Bezier::print ();
-  if (flower_dstream && !flower_dstream->silent_b ("Bezier_bow_controls"))
+  int o = (a+1)%NO_AXES;
+  Offset d;
+  d[Axis (o)] =1.0;
+  Interval iv;
+  Array<Real> sols (solve_derivative (d));
+  sols.push (1.0);
+  sols.push (0.0);  
+  for (int i= sols.size (); i--;)
     {
-      cout << "Bezier_bow\n";
-      cout << "Encompass: ";
-      for (int i=0; i < encompass_.size (); i++)
-       cout << encompass_[i].str () << ", ";
-//      cout << "\n";
+      Offset o (curve_point (sols[i]));
+      iv.unite (Interval (o[a],o[a]));
     }
-#endif
+  return iv;
 }
 
 void
-Bezier_bow::set (Array<Offset> points, Direction dir)
+Bezier::flip (Axis a)
 {
-  set_direction (dir);
-  encompass_ = points;
+  for (int i = CONTROL_COUNT; i--;)
+    control_[i][a] = - control_[i][a];
 }
 
 void
-Bezier_bow::transform ()
+Bezier::rotate (Real phi)
 {
-  origin_ = encompass_[0];
-  encompass_.translate (-origin_);
-
-  Offset delta = encompass_[encompass_.size () - 1] - encompass_[0];
-  alpha_ = delta.arg ();
-
-  encompass_.rotate (-alpha_);
-
-  if (get_direction () == DOWN)
-    encompass_.flipy ();
+  Offset rot (complex_exp (Offset (0, phi)));
+  for (int i = 0; i < CONTROL_COUNT; i++)
+    control_[i] = complex_multiply (rot, control_[i]);
 }
 
 void
-Bezier_bow::transform_back ()
+Bezier::translate (Offset o)
 {
-  if (get_direction () == DOWN)
-    {
-      control_.flipy ();
-      return_.flipy ();
-      encompass_.flipy ();
-    }
-
-  control_.rotate (alpha_);
-  control_.translate (origin_);
-
-  return_.rotate (alpha_);
-  return_.translate (origin_);
-
-  encompass_.rotate (alpha_);
-  encompass_.translate (origin_);
+  for (int i = 0; i < CONTROL_COUNT; i++)
+    control_[i] += o;
 }
 
-/*
- See Documentation/fonts.tex
- */
 void
-Bezier_bow::calc_default (Real h)
+Bezier::check_sanity () const
 {
-  Real pi = M_PI;
-#ifndef STANDALONE
-  Real height_limit = paper_l_->get_var ("slur_height_limit");
-  Real ratio = paper_l_->get_var ("slur_ratio");
-#else
-  Real staffsize_f = STAFFHEIGHT;
-  Real height_limit = staffsize_f;
-  Real ratio = 1.0/3.0;
-#endif
-
-  Real alpha = height_limit * 2.0 / pi;
-  Real beta = pi * ratio / (2.0 * height_limit);
-
-  Offset delta (encompass_[encompass_.size () - 1][X_AXIS] 
-    - encompass_[0][X_AXIS], 0);
-  Real b = delta.length ();
-  Real indent = alpha * atan (beta * b);
-  Real height = indent + h;
-  Array<Offset> control;
-  control.push (Offset (0, 0));
-  control.push (Offset (indent, height));
-  control.push (Offset (b - indent, height));
-  control.push (Offset (b, 0));
-  Bezier::set (control);
+  for (int i=0; i < CONTROL_COUNT; i++)
+    assert (!isnan (control_[i].length ())
+           && !isinf (control_[i].length ()));
 }
-
-
index 5d44313d0472b6d72aa76e02d46069941aee9478..70ea1719950e1d3b6ac453a92a091311d0c0b11f 100644 (file)
@@ -13,7 +13,7 @@
 #include "paper-def.hh"
 #include "molecule.hh"
 #include "lookup.hh"
-#include "bezier.hh"
+#include "bezier-bow.hh"
 #include "main.hh"
 
 Bow::Bow ()
@@ -65,13 +65,13 @@ Bow::dim_callback (Dimension_cache const* c)
   return iv;
 }
 
-Drul_array<Interval>
-Bow::curve_extent_drul () const
+Interval
+Bow::curve_extent (Axis a) const
 {
   Bezier_bow b (paper_l ());
   b.set (get_encompass_offset_arr (), get_direction ());
   b.calc ();
-  return b.curve_extent_drul_;
+  return b.curve_.extent (a);
 }
 
 Array<Offset>
@@ -81,11 +81,10 @@ Bow::get_controls () const
   b.set (get_encompass_offset_arr (), get_direction ());
   b.calc ();
   Array<Offset> controls;
-  controls.set_size (8);
   for (int i = 0; i < 4; i++)
-    controls[i] = b.control_[i];
+    controls.push (b.curve_.control_[i]);
   for (int i = 0; i < 4; i++)
-    controls[i + 4] = b.return_[i];
+    controls.push (b.return_.control_[i]);
   return controls;
 }
 
index 40d7b84e9717784a763f397231df14dbc48dbfba..9e242d22f0038c99fe6d51527aca58894c7bc104 100644 (file)
@@ -24,7 +24,7 @@
 Array<int>
 Break_algorithm::find_break_indices () const
 {
-  Line_of_cols all (pscore_l_->col_l_arr_);
+  Link_array<Paper_column> all (pscore_l_->col_l_arr_);
   Array<int> retval;
 
   for (int i=0; i < all.size (); i++)
@@ -39,11 +39,11 @@ Break_algorithm::find_break_indices () const
 }
 
 
-Line_of_cols
+Link_array<Paper_column>
 Break_algorithm::find_breaks () const
 {
-  Line_of_cols all (pscore_l_->col_l_arr_);
-  Line_of_cols retval;
+  Link_array<Paper_column> all (pscore_l_->col_l_arr_);
+  Link_array<Paper_column> retval;
 
   for (int i=0; i < all.size (); i++)
     if (all[i]->breakable_b ())
@@ -58,7 +58,7 @@ Break_algorithm::find_breaks () const
 
 
 Simple_spacer*
-Break_algorithm::generate_spacing_problem (Line_of_cols curline, Interval line) const
+Break_algorithm::generate_spacing_problem (Link_array<Paper_column> curline, Interval line) const
 {
   Simple_spacer * sp =  new Simple_spacer;
   Paper_def * d = pscore_l_->paper_l_;
index c4b6963bbcbfeb359ea169c6b45e9dfd3ba12f50..7a5b9f9f0985d42b1d53094a1ac4f56ec3ada210 100644 (file)
@@ -70,7 +70,7 @@ Break_align_item::do_pre_processing()
       SCM extra_space
        = scm_eval (scm_listify (ly_symbol2scm ("break-align-spacer"),
                                 current_origin, next_origin, SCM_UNDEFINED)); 
-      SCM symbol = SCM_CAR (extra_space);
+      SCM symbol = gh_car  (extra_space);
       Real spc = gh_scm2double (SCM_CADR(extra_space));
       spc *= interline;
 
@@ -81,15 +81,15 @@ Break_align_item::do_pre_processing()
 
 
   // skip the first sym.
-  symbol_list  = SCM_CDR (scm_reverse (symbol_list));
+  symbol_list  = gh_cdr (scm_reverse (symbol_list));
   for (int i=0; i <elems.size()-1; i++)
     {
-      String sym_str = ly_scm2string (SCM_CAR (symbol_list));
+      String sym_str = ly_scm2string (gh_car  (symbol_list));
       elems[i]->set_elt_property (sym_str,
                                  scm_cons (gh_double2scm (0),
                                            gh_double2scm (dists[i+1])));
 
-      symbol_list = SCM_CDR (symbol_list);
+      symbol_list = gh_cdr (symbol_list);
     }
 
 
@@ -113,12 +113,12 @@ Break_align_item::do_pre_processing()
   
   Real stretch_distance =0.;
   
-  if (SCM_CAR (symbol_list) == ly_symbol2scm ("extra-space"))
+  if (gh_car  (symbol_list) == ly_symbol2scm ("extra-space"))
     {
       spring_len += dists.top ();
       stretch_distance = dists.top ();
     }
-  else if (SCM_CAR (symbol_list) == ly_symbol2scm ("minimum-space"))
+  else if (gh_car  (symbol_list) == ly_symbol2scm ("minimum-space"))
     {
       spring_len = spring_len >? dists.top ();
       stretch_distance = spring_len;
index 30a5ae9300b08cd522abdee35a430d4f53ae9626..9f45be7e6344339c4142438afd9a28e684874b3f 100644 (file)
@@ -220,8 +220,6 @@ Chord::~Chord ()
 {
   delete inversion_p_;
   delete bass_p_;
-  // AAARGH, why doesn't Score_elt do this?
-  unsmobify_self ();
 }
 
 Array<Musical_pitch>
@@ -539,7 +537,7 @@ Chord::user_chord_name (Array<Musical_pitch> pitch_arr, Chord_name* name_p) cons
     chord = gh_cons (pitch2scm (chord_type[i]), chord);
 
   SCM name = scm_eval (gh_list (ly_symbol2scm ("user-chord-name"), ly_quote_scm (chord), SCM_UNDEFINED));
-  if (name != SCM_UNSPECIFIED)
+  if (gh_pair_p (name))
     {
       name_p->modifier_mol = ly_text2molecule (gh_car (name));
       name_p->addition_mol = ly_text2molecule (gh_cdr (name));
index 25326109730a7a0a96ccbbc1d8cbea88b4ff19ec..8c5c6186d7082e923f076188412c456494151d36 100644 (file)
@@ -17,19 +17,6 @@ Column_x_positions::Column_x_positions()
   force_f_ = 0;
 }
 
-Column_x_positions::~Column_x_positions()
-{
-}
-
-
-void
-Column_x_positions::print() const
-{
-#ifndef NPRINT
-  DEBUG_OUT << "energy : " << energy_f_ << '\n';
-  DEBUG_OUT << "line of " << config_.size() << " cols\n";
-#endif
-}
 
 
 
index ccd2e91b80442cb7873eddc1f39218f2a6e9bdb7..ebaf874cf0729996233be6bfced7f623a24ec95c 100644 (file)
@@ -13,6 +13,7 @@
 #include "paper-def.hh"
 #include "debug.hh"
 #include "score-column.hh"
+#include "atom.hh"
 
 Crescendo::Crescendo ()
 {
@@ -20,24 +21,34 @@ Crescendo::Crescendo ()
   dyn_b_drul_[LEFT] = dyn_b_drul_[RIGHT] =false;
 }
 
-Molecule
-Crescendo::get_symbol () const
+
+
+Molecule*
+Crescendo::do_brew_molecule_p () const
 {
-  Real w_dim = spanner_length()- get_broken_left_end_align ();
   Real absdyn_dim = paper_l ()-> get_var ("crescendo_shorten");
+  Real extra_left =  get_broken_left_end_align ();
+
+  if (dyn_b_drul_[LEFT])
+    extra_left += absdyn_dim;
+
+  
+
+  Real width = spanner_length()- get_broken_left_end_align ();
+
   if (dyn_b_drul_[LEFT])
     {
-      w_dim -= absdyn_dim;
+      width -= absdyn_dim;
     }
   if (dyn_b_drul_[RIGHT])
     {
-      w_dim -= absdyn_dim;
+      width -= absdyn_dim;
     }
 
-  if (w_dim < 0)
+  if (width < 0)
     {
       warning (_ ("crescendo") + " " + _ ("too small"));
-      w_dim = 0;
+      width = 0;
     }
 
   Drul_array<bool> broken;
@@ -52,24 +63,22 @@ Crescendo::get_symbol () const
   Real height = paper_l()->get_var ("crescendo_height");
   Real thick = paper_l ()->get_var ("crescendo_thickness");
 
-  return Molecule (lookup_l ()->hairpin (w_dim, height, thick, grow_dir_ < 0, continued));
-}
-
-Molecule*
-Crescendo::do_brew_molecule_p () const
-{
-  Molecule* m_p =0;
-  Real absdyn_dim = paper_l ()-> get_var ("crescendo_shorten");
-  Real x_off_dim =  get_broken_left_end_align ();
-
-  if (dyn_b_drul_[LEFT])
-    x_off_dim += absdyn_dim;
-
-  m_p = new Molecule;
-  Molecule s (get_symbol ());
-  m_p->add_molecule (s);
-  m_p->translate_axis (x_off_dim, X_AXIS);
-  return m_p;
+  const char* hairpin = (grow_dir_ < 0)? "decrescendo" :  "crescendo";
+  Atom at  (gh_list (ly_symbol2scm (hairpin),
+                    gh_double2scm (thick),
+                    gh_double2scm (width),
+                    gh_double2scm (height),
+                    gh_double2scm (continued ? height/2 : 0.0),
+                    SCM_UNDEFINED));
+  Molecule * m
+    = new Molecule;
+  
+  m->dim_.x () = Interval (0, width);
+  m->dim_.y () = Interval (-2*height, 2*height);
+  m->add_atom (&at);
+  
+  m->translate_axis (extra_left, X_AXIS);
+  return m;
 }
 
 
index 35a32a7a288d1521d9ffb4616a9ff58d9f80140d..9edbf4ac6b2e0ce4b7aa89795e120732a9de977f 100644 (file)
@@ -6,6 +6,7 @@
   (c) 1996,98 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
+
 #include <fstream.h>
 #include <signal.h>
 
@@ -39,59 +40,6 @@ debug_init()
 
 bool check_malloc_b = false;
 
-// #define MEMORY_PARANOID
-
-#ifdef MEMORY_PARANOID
-
-#include <malloc.h>
-
-void
-frobnify (void *p, size_t s)
-{
-  char *cp = (char*)p;
-  char *e  = cp + s;
-  while (cp < e)
-    {
-      *cp++ ^=42;
-    }
-}
-
-
-void *
-operator new (size_t size)
-{
-  void *result;
-  result = malloc (size);
-  if (check_malloc_b)
-    frobnify (result, size);
-  return result;
-}
-
-void *to_frob; int frob_size;
-
-void
-set_frobnify (void * p, size_t sz)
-{
-  to_frob = p;
-  frob_size = sz;
-}
-
-void 
-operator delete (void *p)
-{
-  if (!p)
-    return ;
-  if (p == to_frob)
-    {
-      frobnify (p, frob_size);
-      to_frob = 0;
-      frob_size=0;
-    }
-
-  free (p);
-}
-#endif // MEMORY_PARANOID
-
 void
 set_debug (bool b)
 {
index ce851df2bd92b9f3f7d484f71c554827f440116c..f7757ee82039a8224bf093ec0dbfb7d4f786497a 100644 (file)
@@ -31,7 +31,6 @@ void
 Dimension_cache::init()
 {
   callback_l_ =0;
-
   basic_offset_ =0.0;
   extra_offset_ =0.0;
   
@@ -43,27 +42,6 @@ Dimension_cache::init()
 }
 
 
-void
-Dimension_cache::invalidate ()
-{
-  /*  off_valid_b_ =false;
-      valid_b_ = false;*/
-}
-
-
-void
-Dimension_cache::set_offset (Real x)
-{
-  // ugh!
-  /*
-
-    UGH ! UGH !
-    
-   */
-  
-  extra_offset_ = x;
-}
-
 void
 Dimension_cache::translate (Real x)
 {
@@ -141,7 +119,6 @@ Dimension_cache::get_dim () const
     }
   else if (!valid_b_)
     {
-
       nc->dim_= (*callback_l_ ) (nc);
       nc->valid_b_ = true;
     }
index 92d564478ed1f4f93651a13da17a1afa733d3ebc..fc3c57e0dd0c93c5575e30cbfdbd664c39912f80 100644 (file)
@@ -32,7 +32,7 @@ Dots::do_post_processing ()
        set_direction (UP);
 
       Staff_symbol_referencer_interface si (this);
-      int p = si.position_f ();
+      int p = int (si.position_f ());
       if (!(p % 2))
        si.set_position (p  + get_direction ());
     }
index 8420c7fa3b08acc3bf2e3b345fb4f3f76d7b288c..610b9890ec062c21ca82fb4b8aa3d5e2bad1b968 100644 (file)
@@ -26,19 +26,14 @@ Engraver_group_engraver::announce_element (Score_element_info info)
 void
 Engraver_group_engraver::do_announces()
 {
-  Link_array<Translator_group> groups = group_l_arr ();
-  for (int i=0; i < groups.size(); i++) 
+  for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
     {
-      Engraver_group_engraver * group = dynamic_cast<Engraver_group_engraver*> (groups[i]);
-      if (group)
-       {
-         group->do_announces();
-       }
+      if (Engraver_group_engraver *trg =  dynamic_cast <Engraver_group_engraver *> (p->car_))
+       trg->do_announces ();
     }
-  
+
   Request dummy_req;
 
-  Link_array<Translator> nongroups = nongroup_l_arr ();
   while (announce_info_arr_.size ())
     {
       for (int j =0; j < announce_info_arr_.size(); j++)
@@ -47,21 +42,28 @@ Engraver_group_engraver::do_announces()
          
          if (!info.req_l_)
            info.req_l_ = &dummy_req;
-         for (int i=0; i < nongroups.size(); i++) 
-           {   // Is this good enough?
-             Engraver * eng = dynamic_cast<Engraver*> (nongroups[i]);
-             if (eng && eng!= info.origin_trans_l_arr_[0])
-               eng->acknowledge_element (info);
+
+         for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
+           {
+             if (!dynamic_cast <Engraver_group_engraver *> (p->car_))
+               {
+                 Engraver * eng = dynamic_cast<Engraver*> (p->car_);
+                 if (eng && eng!= info.origin_trans_l_arr_[0])
+                   eng->acknowledge_element (info);
+               }                 
            }
        }
+      
       announce_info_arr_.clear ();
-      for (int i=0; i < nongroups.size(); i++)
+      for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
        {
-         Engraver * eng = dynamic_cast<Engraver*> (nongroups[i]);
-         if (eng)
-           eng->process_acknowledged ();
+         if (!dynamic_cast <Engraver_group_engraver *> (p->car_))
+           {
+             Engraver * eng = dynamic_cast<Engraver*> (p->car_);
+             if (eng)
+               eng->process_acknowledged ();
+           }
        }
-
     }
 }
 
@@ -71,12 +73,14 @@ Engraver_group_engraver::get_staff_info() const
 {
   Staff_info inf = Engraver::get_staff_info();
 
-  Link_array<Translator> simple_translators = nongroup_l_arr (); 
-  for (int i=0; i < simple_translators.size(); i++)
+  for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
     {
-    Engraver * eng = dynamic_cast<Engraver*> (simple_translators[i]);
-    if (eng)
-      eng->fill_staff_info (inf);
+      if (!dynamic_cast <Engraver_group_engraver *> (p->car_))
+       {
+         Engraver * eng = dynamic_cast<Engraver*> (p->car_);
+         if (eng)
+           eng->fill_staff_info (inf);
+       }
     }
   return inf;
 }
index 8c8a8e31a7f28e6062ff505971fc5ab0da123f12..e542a73cfef7be6909798cb7caf474593726f48c 100644 (file)
@@ -65,6 +65,17 @@ Character_metric::dimensions () const
 }
 
 Font_metric::~Font_metric ()
+{
+  unsmobify_self ();
+}
+
+Font_metric::Font_metric ()
+{
+  self_scm_ = SCM_EOL;
+  smobify_self ();
+}
+
+Font_metric::Font_metric (Font_metric const &)
 {
 }
 
@@ -98,3 +109,27 @@ Scaled_font_metric::description () const
   gh_set_cdr_x (od, gh_int2scm (magstep_i_));
   return od;
 }
+
+
+void
+Font_metric::do_smobify_self ()
+{
+}
+
+SCM
+Font_metric::mark_smob (SCM s)
+{
+  return SCM_EOL;
+}
+
+int
+Font_metric::print_smob (SCM s, SCM port, scm_print_state * )
+{
+  scm_puts ("#<Font_metric>", port);
+  
+  return 1;
+}
+
+
+
+
index 130f1a0821c67954695efb93b06f1ee28864510f..9ea2b8259e319edc2ddc4ccf117a96381de56e1c 100644 (file)
@@ -51,7 +51,7 @@ Array<Column_x_positions>
 Gourlay_breaking::do_solve () const
 {
   Array<Break_node> optimal_paths;
-  Line_of_cols all = pscore_l_->col_l_arr_ ;
+  Link_array<Paper_column> all = pscore_l_->col_l_arr_ ;
   Array<int> breaks = find_break_indices ();
   
   optimal_paths.set_size (breaks.size ());
@@ -76,7 +76,7 @@ Gourlay_breaking::do_solve () const
 
       for (int start_idx = break_idx; start_idx--;)
        {
-         Line_of_cols line = all.slice (breaks[start_idx], breaks[break_idx]+1);
+         Link_array<Paper_column> line = all.slice (breaks[start_idx], breaks[break_idx]+1);
   
          line[0] = dynamic_cast<Paper_column*>(line[0]->find_broken_piece (RIGHT));
          line.top () =  dynamic_cast<Paper_column*>(line.top ()->find_broken_piece (LEFT));
index da7b622c3f0565bdc3f1c90a4f3f0bfa3025f07a..45c47ca37f38aaf007657235e1263d967ddfe0e0 100644 (file)
@@ -100,13 +100,6 @@ Grace_performer_group::each (Const_method_pointer method) const
 bool
 Grace_performer_group::do_try_music (Music *m)
 {
-  bool hebbes_b =false;
-
-  Link_array<Translator> nongroups (nongroup_l_arr ());
-  
-  for (int i =0; !hebbes_b && i < nongroups.size() ; i++)
-    hebbes_b =nongroups[i]->try_music (m);
-
-  return hebbes_b;
+  return try_music_on_nongroup_children (m);
 }
 
index 263deb8b62229ccd1d797642e59a46f87171405e..8c5c0ed9ca92cfc2c59be124c3e8f705d13a3a20 100644 (file)
@@ -58,7 +58,7 @@ struct Adobe_font_metric : Font_metric {
   Character_metric const *get_char (int, bool) const;
 };
 
-Adobe_font_metric read_afm_file (String fn);
+Adobe_font_metric *read_afm_file (String fn);
 
 
 
index 432da7ea4c424e2164d2956f60be6af586172977..f581d65e9e1f05244f90153b717bad504aac43e4 100644 (file)
 #include "file-path.hh"
 #include "lily-proto.hh"
 #include "font-metric.hh"
-#include "lily-guile.hh"
+#include "scm-hash.hh"
 
 /**
    Interface to all .afm files living in the filesystem.
  */
 class All_font_metrics
 {
-  Dictionary<Adobe_font_metric*> afm_p_dict_;
-  Dictionary<Tex_font_metric*> tfm_p_dict_;
-  Dictionary<Scaled_font_metric*> scaled_p_dict_;
+  Scheme_hash_table afm_p_dict_;
+  Scheme_hash_table tfm_p_dict_;
+  Scheme_hash_table scaled_p_dict_;
+  
   File_path search_path_;
 public:
   
@@ -37,7 +38,7 @@ public:
   SCM font_descriptions () const;
 };
 
-
+Font_metric * unsmob_metrics (SCM s);
 
 
 #endif /* ALL_FONTS_HH */
index ff53282f52661eaf11fa9b0d8e2507c15a89f6e7..13e3421f0c8fcf58ac47d7721edbd7985ddbc9d1 100644 (file)
@@ -36,14 +36,6 @@ public:
   Stem* first_visible_stem () const;
   Stem* last_visible_stem () const;
 
-  /**
-     the slope of the beam in dy/dx
-   */
-  Real dydx_f_;
-
-  /// position of leftmost end of beam  
-  Real left_y_;
-
   Beam ();
   void add_stem (Stem*);
   void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current);
@@ -61,7 +53,7 @@ protected:
 
   Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const;
 private:
-  Direction calc_default_dir () const;
+  Direction get_default_dir () const;
   void set_stem_directions ();
   void auto_knees ();
   bool auto_knee (String gap_str, bool interstaff_b);
@@ -75,7 +67,6 @@ private:
   Real quantise_dy_f (Real dy) const;
   Real quantise_y_f (Real y, Real dy, int quant_dir);
   int forced_stem_count () const;
-
 };
 
 #endif // BEAM_HH
diff --git a/lily/include/bezier-bow.hh b/lily/include/bezier-bow.hh
new file mode 100644 (file)
index 0000000..75acd8e
--- /dev/null
@@ -0,0 +1,58 @@
+/*   
+  bezier-bow.hh -- declare Bezier_bow
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#ifndef BEZIER_BOW_HH
+#define BEZIER_BOW_HH
+
+#include "bezier.hh"
+#include "lily-proto.hh"
+
+
+/**
+  Implement bow specific bezier curve
+ */
+class Bezier_bow
+{
+public:
+  Bezier_bow (Paper_def* paper_l);
+
+  /**
+   Calculate bezier curve for bow from bow paratime_signatures.
+   */
+  void blow_fit ();
+  void calc ();
+  Real calc_f (Real height);
+  void calc_bezier ();
+  bool calc_clipping ();
+  void calc_controls ();
+  void check_sanity () const;
+  void calc_default (Real h);
+  void calc_return (Real begin_alpha, Real end_alpha);
+  void calc_tangent_controls ();
+  bool check_fit_b () const;
+  Real check_fit_f () const;
+  void set (Array<Offset> points, Direction dir);
+  void transform ();
+  void transform_back ();
+
+  Array<Offset> encompass_;
+
+  Paper_def* paper_l_;
+  Direction dir_;
+  Real alpha_;
+  Offset origin_;
+
+
+  Bezier curve_;
+  Bezier return_;
+};
+
+
+#endif /* BEZIER_BOW_HH */
+
index 73b6079104f7411e3f5d515610c03f880830017a..a2c5df48c84534bde2c408433da1b99f2c6ce612 100644 (file)
@@ -7,14 +7,14 @@
 #ifndef BEZIER_HH
 #define BEZIER_HH
 
-#ifndef STANDALONE
-#include "lily-proto.hh"
-#endif
 
 #include "real.hh"
-#include "curve.hh"
 #include "drul-array.hh"
 #include "interval.hh"
+#include "axes.hh"
+#include "offset.hh"
+#include "array.hh"
+#include "polynomial.hh"
 
 /**
   Simple bezier curve
@@ -24,60 +24,19 @@ class Bezier
 public:
   Bezier ();
 
-  /**
-  Calculate bezier curve into Offset (x,y) array.
-  */
-  void calc (int steps);
-  void print () const;
-
-  void set (Array<Offset> points);
-
-  /**
-  Return y that goes with x by interpolation.
-  */
-  Real y (Real x);
-
-  Curve curve_;
-  Curve control_;
-};
-
-/**
-  Implement bow specific bezier curve
- */
-class Bezier_bow : public Bezier
-{
-public:
-  Bezier_bow (Paper_def* paper_l);
-
-  /**
-   Calculate bezier curve for bow from bow paratime_signatures.
-   */
-  void blow_fit ();
-  void calc ();
-  Real calc_f (Real height);
-  void calc_bezier ();
-  bool calc_clipping ();
-  void calc_controls ();
-  void calc_default (Real h);
-  void calc_return (Real begin_alpha, Real end_alpha);
-  void calc_tangent_controls ();
-  bool check_fit_bo ();
-  Real check_fit_f ();
-  void print () const;
-  void set (Array<Offset> points, Direction dir);
-  void transform ();
-  void transform_back ();
-
-  Paper_def* paper_l_;
-  Curve encompass_;
-  Direction dir_;
-  void set_direction (Direction d ) { dir_ =  d; }
-  Direction get_direction () const { return dir_; }
-
-  Real alpha_;
-  Offset origin_;
-  Curve return_;
-  Drul_array<Interval> curve_extent_drul_;
+  void rotate (Real);
+  void translate (Offset);
+  void flip (Axis);
+  void check_sanity () const;
+  Real get_other_coordinate (Axis a, Real x) const;
+  Array<Real> solve_point (Axis, Real coordinate) const;
+  Array<Real> solve_derivative (Offset) const;
+  Interval extent (Axis)const;
+  Polynomial polynomial (Axis)const;
+  Offset curve_point (Real t) const;
+
+  static const int CONTROL_COUNT = 4;
+  Offset control_[CONTROL_COUNT];
 };
 
 
index 132ae263a69141fffb6e252a4624382e54ea3cf3..99de88b237e3fb06db9f133282beea8d7687b97c 100644 (file)
@@ -11,7 +11,6 @@
 #define BOW_HH
 
 #include "directional-spanner.hh"
-#include "curve.hh"
 
 /**
   Base class for anything that looks like a slur.
@@ -33,7 +32,7 @@ protected:
   Array<Offset> get_controls () const;
   virtual Array<Offset> get_encompass_offset_arr () const;
   static Interval dim_callback (Dimension_cache const*);
-  Drul_array<Interval> curve_extent_drul () const;
+  Interval curve_extent (Axis) const;
 
   Drul_array<Real> dy_f_drul_;
   Drul_array<Real> dx_f_drul_;
index 8a25d7b554d2df85207f93897156e645c7646d21..50521bbca6694940b95f60ea2a3bc6b3c6207c1e 100644 (file)
@@ -28,7 +28,7 @@ protected:
   Real linewidth_f_;
 
   /// search all pcols which are breakable.
-  Line_of_cols find_breaks() const;
+  Link_array<Paper_column> find_breaks() const;
 
   Array<int> find_break_indices() const;
     
@@ -40,10 +40,10 @@ protected:
   void approximate_solve_line (Column_x_positions*) const;
 
   /// does curline fit on the paper?    
-  bool feasible (Line_of_cols) const;
+  bool feasible (Link_array<Paper_column>) const;
     
 
-  Simple_spacer* generate_spacing_problem (Line_of_cols, Interval) const;
+  Simple_spacer* generate_spacing_problem (Link_array<Paper_column>, Interval) const;
 
   virtual Array<Column_x_positions> do_solve() const=0;
   virtual void do_set_pscore();
index d124535153129c2ac9d94f0d8d050f4b49842967..30ee56c2b28f2bf676814a177c7a9cb4a6df6b4f 100644 (file)
 #include "parray.hh"
 #include "lily-proto.hh"
 
-typedef Link_array<Paper_column>  Line_of_cols;
 
-struct Column_x_positions {
-
-  Line_of_cols cols_;
+struct Column_x_positions
+{
+  Link_array<Paper_column> cols_;
   Array<Real> config_;
   
   Real force_f_;
   Real energy_f_;
   bool satisfies_constraints_b_;
 
-  ~Column_x_positions();
   Column_x_positions();
-  void print() const;
 };
 
 
diff --git a/lily/include/curve.hh b/lily/include/curve.hh
deleted file mode 100644 (file)
index a311603..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-  curve.hh -- declare point and curve
-
-  (c) 1998--1999 Jan Nieuwenhuizen <janneke@gnu.org>
-*/
-
-#ifndef CURVE_HH
-#define CURVE_HH
-
-#ifndef STANDALONE
-#include "lily-proto.hh"
-#endif
-
-#include "real.hh"
-
-#include "offset.hh"
-#include "array.hh"
-
-class Curve : public Array<Offset>
-{
-public:
-  void flipy ();
-  int largest_disturbing ();
-  void rotate (Real phi);
-  void translate (Offset o);
-
-  void operator = (Array<Offset> const & src) 
-  {
-    Array<Offset>::operator =(src);    
-  }
-  void operator = (Curve const & src) 
-  {
-    Array<Offset>::operator =((Array<Offset>)src);     
-  }
-};
-
-#endif // CURVE_HH
-
index 0a61bc2d74a79ddbbcd0eb2ff40356a492ce7723..7db6f94a5621388228a43e788c63aa2cb63b3f57 100644 (file)
@@ -55,9 +55,6 @@ public:
 
   Score_element *element_l () const { return elt_l_; }
 
-  void invalidate ();
-  void invalidate_dependencies ();
-  
   Dimension_cache(Dimension_cache const&);
   Dimension_cache ();
 
@@ -74,9 +71,6 @@ public:
   void set_empty (bool);
   void translate (Real);
 
-  // junkme.
-  void set_offset (Real);
-
   bool valid_b () const { return valid_b_; }
   bool empty_b() const;
   Interval get_dim () const;
index 03152c7be85c7a596000636606ad63b5a5fe11a9..a26c2e565c13b5ec11342dec2395cf7c44ad45dd 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "box.hh"
 #include "lily-guile.hh"
+#include "smobs.hh"
 
 struct Character_metric
 {
@@ -21,11 +22,16 @@ struct Character_metric
 
 struct Font_metric
 {
+  Font_metric ();
   String name_str_;
   virtual SCM description () const;
   virtual Character_metric const *get_char (int ascii, bool warn) const; 
   virtual ~Font_metric ();
   virtual Box text_dimension (String) const;
+
+  DECLARE_SMOBS;
+private:
+  Font_metric (Font_metric const&); // no copy.
 };
 
 
index fbb8f8d37e8d26237ef7cca8173a1d4633b5848b..674b2af139af0f418028bb1e2cd22c3ebc96e8ab 100644 (file)
@@ -15,9 +15,6 @@
 #include "pqueue.hh"
 
 
-class Iteration_interface_translator : public virtual Translator_group {
-};
-
 class Global_translator : public virtual Translator_group{
   PQueue<Moment> extra_mom_pq_;
 public:
index 1c6135d999cbdbb3ff5fb1b187a18ac4a4893d8c..b9e2fd8130642db0d8057f07e13579105683d19d 100644 (file)
@@ -65,8 +65,6 @@ public:
   Item (Item const &);
 protected:
   virtual void do_breakable_col_processing();
-  virtual void handle_prebroken_dependencies();
-  //virtual void handle_prebroken_dependents ();
 
   void copy_breakable_items();
 };
index eec7c6f86ee641fc0111c55538c353b4cfa72fed..74bcc33c48427d6868021452570ee4a1617c4004 100644 (file)
 /* for the keyword table */
 struct Keyword_ent
 {
-    char const *name;
-    int     tokcode;
+  char const *name;
+  int     tokcode;
 };
 
 struct Keyword_table
 {
-    Keyword_ent *table;
-    int     maxkey;
-    Keyword_table (Keyword_ent *);
-    int     lookup (char const *s) const;
+  Keyword_ent *table;
+  int     maxkey;
+  Keyword_table (Keyword_ent *);
+  int     lookup (char const *s) const;
 };
 
 
index fae4e4d39827bde6f7f62edec2cf78fe337dd684..794c6e7087a6e1ccbda3643a3b616053464c8f3c 100644 (file)
@@ -168,6 +168,7 @@ struct Note_req;
 struct Notename_table;
 struct Offset;
 struct Paper_column;
+struct Polynomial;
 struct Paper_def;
 struct Paper_outputter;
 struct Paper_score;
index f49115097c826d96bb340a99bd081f8f68a8c71f..2e9399958e6520087403a6663e2abad20bf175dd 100644 (file)
@@ -34,7 +34,6 @@ public:
   Molecule ledger_line (Interval) const;
   Molecule fill (Box b) const;
   Molecule filledbox (Box b) const;  
-  Molecule hairpin (Real width, Real height, Real thick, bool decresc, bool continued) const;
   Molecule tuplet_bracket (Real dy, Real dx, Real gap, Real thick,Real height, Direction dir) const;
   Molecule accordion (SCM arg, Real interline_f) const;
   Molecule slur (Array<Offset> controls, Real thick) const;
index d45eabe840e958dfd34685f0b08835fc08f9fdb2..917c66a6b67163a6639c361946e18ccb0dfe97b6 100644 (file)
 double log_2(double x) ;
 int intlog2(int d);
 
-#if 0
-                               // defined in real.hh
 inline int
-abs (int i){
-    return (i < 0)?-i:i;
+sign (int i)
+{
+  if (i<0)
+    return -1;
+  else if (i)
+    return 1;
+  else return 0;
 }
-#endif
-
-inline int
-sign (int i) {
-    if (i<0) return -1;
-    else if (i) return 1;
-    else return 0;
-}
-
-#ifndef STANDALONE
-#include "lily-proto.hh"
-Interval itemlist_width (const Link_array<Item> &its);
-#endif
 
-void set_frobnify (void*, size_t);
-int get_lower_bound (Array<Real> const& positions, Real x);
-Slice get_bounds_slice (Array<Real> const& positions, Real x);
-Interval get_bounds_iv (Array<Real> const& positions, Real x);
-Interval quantise_iv (Array<Real> const& positions, Real period, Real x);
+Interval quantise_iv (Array<Real> positions, Real x);
 
 #endif
 
index 1c0eed80db4b5473b701984784b8439c8d951e7b..b30271855f7728651b958901a97b0f800df99eeb 100644 (file)
@@ -15,8 +15,6 @@
 
 /**
    be next to noteheads.
-
-   UGH. another reduplication of Staff_side
    */
 class Note_head_side: public virtual Item, public virtual Directional_element
 {
index d53d374365bfbdc2a2616a638a24e6f9a5e574fb..2bbb8e175a79f7e613a7ced7be0cf0b3963b89e4 100644 (file)
 #ifndef NOTENAME_TABLE_HH
 #define NOTENAME_TABLE_HH
 
-#include "pointer.hh"
 #include "string.hh"
 #include "lily-proto.hh"
-#include "dictionary.hh"
-#include "musical-pitch.hh"
 
-class Notename_table :   public Dictionary<Musical_pitch>{
+class Notename_table {
+  Dictionary<Musical_pitch> *pitch_dict_;
 public:
+  Notename_table ();
+  ~Notename_table ();
+  Notename_table (Notename_table const&);
+  Musical_pitch get_pitch(String s) const;
+  void add_note_name (String, Musical_pitch const *p);
   String get_name (Musical_pitch) const;
+  bool elem_b (String )const;
 };
   
 #endif // NOTENAME_TABLE_HH
index 29ba4a0a4e8c0e95e1ce7ea678b470576b93abc7..3699953bbb375ec167bc1acba1fbefbc870bfdb2 100644 (file)
 #ifndef SCOPE_HH
 #define SCOPE_HH
 
-#include "dictionary.hh"
 #include "lily-proto.hh"
 #include "lily-guile.hh"
-#include "dictionary-iter.hh"
-#include "protected-scm.hh"
 
-class Scope : private Hash_table<Protected_scm,Identifier*> {
+class Protected_scm;
+class Scope {
+  Hash_table<Protected_scm,Identifier*> *id_dict_;
 public:
   void print () const;
   bool elem_b (String ) const;
@@ -30,10 +29,14 @@ public:
   friend class Scope_iter;
 };
 
-class Scope_iter : public Hash_table_iter<Protected_scm,Identifier*> {
+class Scope_iter {
+  Hash_table_iter<Protected_scm,Identifier*> * iter_;
 public:
+  void operator ++(int);
+  bool ok ()const;
   Scope_iter(Scope const&);
   String key () const;
+  Identifier* val () const;
   SCM scm_key () const;
 };
 
index ba75990681f5d286d07d1d2ca1dce534addfade9..a223d5657d9f673b61cbe468655715d7bc7cb167 100644 (file)
@@ -35,6 +35,11 @@ Boolean (true iff defined)
 
 */
 class Score_element  {
+  /**
+     The lookup, determined by the font size. Cache this value.
+   */
+  Lookup * lookup_l_;
+public:
   /**
      properties specific for this element. Destructor will not call
      scm_unprotect, so as to allow more flexible GC arrangements.  The
@@ -43,11 +48,7 @@ class Score_element  {
 
   */
   SCM element_property_alist_;
-  /**
-     The lookup, determined by the font size. Cache this value.
-   */
-  Lookup * lookup_l_;
-public:
+  
   Score_element *original_l_;
 
   /**
@@ -159,7 +160,6 @@ public:
    */
   void set_empty (Axis a);
   bool empty_b (Axis a) const;
-  void invalidate_cache (Axis);
   Interval extent (Axis) const;
  
   /**
index 6ef182fe1324235b25c307b6c82292d83b24d559..ec711110e29df606fca84f7f900275f44c35dc23 100644 (file)
@@ -53,15 +53,8 @@ public:
 protected:
   void set_my_columns ();
   VIRTUAL_COPY_CONS(Score_element);
-
-  /**
-    this is virtual; for instance, Line_of_score overrides it.
-    */
-  virtual void break_into_pieces ();
   Real get_broken_left_end_align () const;
 
-  friend Axis_group_spanner; // UGH
-
   virtual void do_space_processing ();
   virtual void do_break_processing ();
   Real spanner_length () const;
index e1d91d1aeab4c7fa0328b2ae8641e3871205ae97..0846cc9f6dabfcb51b84e97cf52ab4dd19ca39ef 100644 (file)
@@ -35,6 +35,7 @@ class Translator_group : public virtual Translator {
   int iterator_count_;
   friend class Interpretation_context_handle;
 
+protected:
   Cons_list<Translator> trans_p_list_;
 
 public:
@@ -54,11 +55,6 @@ public:
   Translator_group();
   void add_translator (Translator *trans_p);
   
-  Link_array<Translator> nongroup_l_arr () const;
-  Link_array<Translator_group> group_l_arr () const;
-  
-  virtual Global_translator *global_l() { return 0; }
-  
   /// Score_register = 0, Staff_registers = 1, etc)
   Translator_group* ancestor_l (int l=1);
   int depth_i() const;
@@ -68,8 +64,6 @@ public:
   Translator *remove_translator_p (Translator*trans_l);
   void check_removal ();
 
-
-
   Translator *get_simple_translator (String) const;
   Translator_group *find_existing_translator_l (String n, String id);
   Translator_group *find_create_translator_l (String n, String id);
index fc082e41669cb1e3d2c611e0ecc7090a9bc2b752..5417dae3d4fe6c51e3580aade0061ad01e521009 100644 (file)
@@ -155,12 +155,7 @@ Item::find_broken_piece (Direction d) const
     }
 }
 
-void
-Item::handle_prebroken_dependencies()
-{
-  if (original_l_)
-    Score_element::handle_prebroken_dependencies();
-}
+
 
 bool
 Item::broken_original_b () const
index a9bb8df655cf1121f3f9e94a59f0e95e1510b5ab..6856c625b30893f12e3ee7b51736ab9cb9bff83c 100644 (file)
@@ -7,7 +7,7 @@ Least_squares::OK() const
   assert (input.size() > 1);
   Real dx = 0.0;
   for (int i=1; i < input.size(); i++)
-    dx += abs (input[i-1].x() - input[i].x ());
+    dx += abs (input[i-1][X_AXIS] - input[i][X_AXIS]);
 
   assert (dx);
 }
@@ -22,12 +22,12 @@ Least_squares::minimise (Real &coef, Real &offset)
 
   for (int i=0; i < input.size();i++) 
     {
-       Real x=input[i].x();
-       Real y = input[i].y();
-       sx += x;
-       sy += y;
-       sqx += sqr (x);
-       sxy += x*y;
+      Real x=input[i][X_AXIS];
+      Real y = input[i][Y_AXIS];
+      sx += x;
+      sy += y;
+      sqx += sqr (x);
+      sxy += x*y;
     }
   int N = input.size();
 
index 93e1651cc0a4ad55cdc736d51e27902377aab84c..21723f7713c21d21f11371f6e9bec600fabbf953 100644 (file)
@@ -184,7 +184,7 @@ SCM
 index_cell (SCM s, Direction d)
 {
   assert (d);
-  return (d == LEFT) ? SCM_CAR (s) : SCM_CDR (s);
+  return (d == LEFT) ? gh_car  (s) : gh_cdr (s);
 }
 
 SCM
index 72c7104e4abfdf3e856242bbf8937dafbac11e5e..55f17551a7696240c8b9148aa7e1834afe790358 100644 (file)
@@ -95,8 +95,8 @@ Local_key_item::do_brew_molecule_p() const
        * note_distance;
       
       Molecule m (accidental (p.accidental_i_,
-                                 accidental_arr_[i].cautionary_b_,
-                                 accidental_arr_[i].natural_b_));
+                             accidental_arr_[i].cautionary_b_,
+                             accidental_arr_[i].natural_b_));
 
       m.translate_axis (dy, Y_AXIS);
       octave_mol_p->add_at_edge (X_AXIS, RIGHT, m, 0);
index 7f98f45965b1e7e33f48f72c155b898a0ee10b92..c3d2213592630ba3b37ed7cf0e2064683b2cbb44 100644 (file)
@@ -468,24 +468,7 @@ Lookup::staff_brace (Real y, int staff_size) const
   return m;
 }
 
-Molecule
-Lookup::hairpin (Real width, Real height, Real thick, bool decresc, bool continued) const
-{
-  Molecule m;   
-
-  const char* hairpin = decresc ? "decrescendo" :  "crescendo";
-  Atom at  (gh_list (ly_symbol2scm (hairpin),
-                    gh_double2scm (thick),
-                    gh_double2scm (width),
-                    gh_double2scm (height),
-                    gh_double2scm (continued ? height/2 : 0.0),
-                    SCM_UNDEFINED));
-  m.dim_.x () = Interval (0, width);
-  m.dim_.y () = Interval (-2*height, 2*height);
 
-  m.add_atom (&at);
-  return m;
-}
 
 Molecule
 Lookup::tuplet_bracket (Real dy , Real dx, Real thick, Real gap,
@@ -579,8 +562,8 @@ Molecule
 Lookup::accordion (SCM s, Real interline_f) const
 {
   Molecule m;
-  String sym = ly_scm2string(SCM_CAR(s));
-  String reg = ly_scm2string(SCM_CAR(SCM_CDR(s)));
+  String sym = ly_scm2string(gh_car (s));
+  String reg = ly_scm2string(gh_car (gh_cdr(s)));
 
   if (sym == "Discant")
     {
index 246e763587dedb250b34d6b4a411b51395ecce3d..b45226b6e97bef90bb41993aceff9ddbb67c488f 100644 (file)
@@ -10,6 +10,7 @@
 #include <iostream.h>
 #include <assert.h>
 #include <locale.h>
+
 #include "lily-guile.hh"
 #include "lily-version.hh"
 
@@ -178,7 +179,6 @@ notice ()
             "USA.\n");
 }
 
-
 void
 setup_paths ()
 {
@@ -217,12 +217,13 @@ setup_paths ()
 
 
   char *suffixes[] = {"ly", "afm", "scm", "tfm", "cmtfm", "ps", 0};
-  for (char **s = suffixes; *s; s++){
-    if (!prefix_directory.empty_b())
-      global_path.add (prefix_directory + to_str ('/') + String (*s));
-    else
-      global_path.add (String (DIR_DATADIR) + to_str ('/') + String(*s));
-  }
+  for (char **s = suffixes; *s; s++)
+    {
+      if (!prefix_directory.empty_b())
+       global_path.add (prefix_directory + to_str ('/') + String (*s));
+      else
+       global_path.add (String (DIR_DATADIR) + to_str ('/') + String(*s));
+    }
 }
 
 
@@ -233,7 +234,7 @@ main_prog (int, char**)
     need to do this first. Engravers use lily.scm contents.
    */
   init_lily_guile ();
-  read_lily_scm_file ( "lily.scm");
+  read_lily_scm_file ("lily.scm");
   cout << endl;
 
   call_constructors ();
index ab6cceb5f55310b13d0ed221ec6e3d3c3b60cbef..d9c56c4a8da2abd3a2fe5c7b7b4bc13456f2db8e 100644 (file)
@@ -8,15 +8,11 @@
 */
 
 #include <math.h>
-
 #include "misc.hh"
 
-#ifndef STANDALONE
-#include "item.hh"
-#endif
-
 int
-intlog2(int d) {
+intlog2(int d)
+{
   int i=0;
   while (!(d&1)) 
     {
@@ -28,76 +24,41 @@ intlog2(int d) {
 }
 
 double
-log_2(double x) {
-  return log (x)  /log (2.0);
-}
-
-
-/*
-  TODO
-    group in some Array_*
-    make more generic / templatise
- */
-int
-get_lower_bound (Array<Real> const& positions, Real x)
+log_2(double x)
 {
-  if (x < positions[0])
-    return 0;
-  for (int i = 1; i < positions.size (); i++)
-    if (x < positions[i])
-      return i - 1;
-  return positions.size () - 1;
+  return log (x)  /log (2.0);
 }
 
-Slice
-get_bounds_slice (Array<Real> const& positions, Real x)
-{
-  int l = get_lower_bound (positions, x);
-  int u = positions.size () - 1 <? l + 1;
-  if (x < positions[l])
-    u = l;
-  return Slice (l, u);
-}
 
-Interval
-get_bounds_iv (Array<Real> const& positions, Real x)
+static int
+comp (Real const &a, Real const &b)
 {
-  Slice slice = get_bounds_slice (positions, x);
-  return Interval (positions[slice[SMALLER]], positions[slice[BIGGER]]);
+  return sign (a-b);
 }
 
-// silly name
 Interval
-quantise_iv (Array<Real> const& positions, Real period, Real x)
+quantise_iv (Array<Real> positions, Real x)
 {
-  /*
-    ugh
-    assume that 
-      * positions are sorted, 
-      * positions are nonnegative
-      * period starts at zero
-   */
+  positions.sort (comp);
+  Real period = positions.top () - positions[0];
+  
+  int n =  int ((x - positions[0]) / period);
+  Real frac = (x - positions[0] ) -  n * period;
 
-  int n = (int)(x / period);
-  Real frac = (x / period - n) * period;
-  if (frac < 0)
+  while (frac < 0)
     {
       frac += period;
-      n--;
+      n --;
     }
-
-  Slice slice = get_bounds_slice (positions, frac);
-  Interval iv(positions[slice[SMALLER]], positions[slice[BIGGER]]);
-
-  if (slice[SMALLER] == slice[BIGGER])
+  
+  Real px = frac + positions[0];
+  assert ( positions[0] <= px && px <= positions.top ());
+  int i=0;
+  for (; i < positions.size () - 1; i++)
     {
-      if (slice[SMALLER] == 0)
-       iv[SMALLER] = - period + positions.top ();
-      else
-       iv[BIGGER] = period + positions[0];
+      if (positions[i] <= px && px <= positions[i+1])
+       break; 
     }
 
-  iv += period * n;
-
-  return iv;
+  return Interval (positions[i] , positions[i+1]) + period * n;
 }
index 3f148119551a65ed831c59c18c285029ea58035b..710ee8b397298b6bad669b8c3510bb9c8ad46578 100644 (file)
 
 #ifdef ATOM_SMOB
 #define MOL_EOL SCM_EOL
-#define NEXT_CELL(a) SCM_CDR(a)
+#define NEXT_CELL(a) gh_cdr(a)
 #define CELLTYPE SCM
 #define UNBOX_ATOM(a) Atom::atom_l (a)
 #define BOX_ATOM(a) a->make_smob ()
 #define NEWCELL(a,b) gh_cons (a,b)
-#define UNBOX_PTR(a) SCM_CAR(a)
+#define UNBOX_PTR(a) gh_car (a)
 #else
 #define MOL_EOL 0
 #define NEXT_CELL(a) ptr->next_
index 94d65eab45908f2c7505172309927af96bde03fb..0e11977686cc0c144341dcfedb3c1c0a3aa94927 100644 (file)
@@ -27,7 +27,7 @@ Moment::~Moment()
 int
 Moment::print_smob (SCM s, SCM port, scm_print_state *)
 {
-  Moment  *r = (Moment *) SCM_CDR (s);
+  Moment  *r = (Moment *) gh_cdr (s);
      
   scm_puts ("#<Mom ", port);
   String str(r->str());
index b271010fd79048586146ec49f68f5ce46e73246c..3147b6e51721cd6538915b024dc67bcc2a844c53 100644 (file)
@@ -180,13 +180,13 @@ My_lily_lexer::LexerError (char const *s)
 Musical_pitch
 My_lily_lexer::lookup_notename (String s)
 {
-  return (*note_tab_p_)[s];
+  return note_tab_p_->get_pitch (s);
 }
 
 Musical_pitch
 My_lily_lexer::lookup_chordmodifier (String s)
 {
-  return (*chordmodifier_tab_p_)[s];
+  return chordmodifier_tab_p_->get_pitch (s);
 }
 
 bool
index 7ed9936d149ea28b56f03432600942683d5c0a03..7b69a7c65e286ea27cac50cae4dc248fb117769e 100644 (file)
@@ -116,8 +116,6 @@ Note_column::add_head (Rhythmic_head *h)
 void
 Note_column::translate_rests (int dy_i)
 {
-  //  invalidate_cache (Y_AXIS);
-
   SCM s = get_elt_property ("rests");
   for (; gh_pair_p (s); s = gh_cdr (s))
     {
@@ -219,5 +217,4 @@ Note_column::first_head () const
 {
   Stem * st = stem_l ();
   return st?  st->first_head (): 0; 
-
 }
index ae8ec870454d32cb9434228b5685ae7e825474c2..70834c191b000fbd06c16c05bb9d009806b04c02 100644 (file)
@@ -36,7 +36,6 @@ Note_head::do_pre_processing ()
 
   if (Dots *d = dots_l ())
     { // move into Rhythmic_head?
-
       Staff_symbol_referencer_interface si (d);
       Staff_symbol_referencer_interface me (this);      
       
index 0d2201fca46288c37a9793a3f61f4c61abfa2cfd..2063f79ee4b0b92ce6981ea183dbfa96edac94de 100644 (file)
@@ -7,15 +7,14 @@
 */
 
 #include "notename-table.hh"
-#include "pointer.tcc"
-#include "musical-request.hh"
 #include "dictionary-iter.hh"
+#include "dictionary.hh"
+#include "musical-pitch.hh"
 
 String
 Notename_table::get_name (Musical_pitch m) const
 {
-
-  for (Dictionary_iter<Musical_pitch> ai (*this); ai.ok (); ai++)
+  for (Dictionary_iter<Musical_pitch> ai (*pitch_dict_); ai.ok (); ai++)
     {
       if (ai.val () == m)
        return ai.key ();
@@ -23,3 +22,35 @@ Notename_table::get_name (Musical_pitch m) const
   return "r";                  // rest. 
 }
 
+
+void
+Notename_table::add_note_name (String s,
+                              Musical_pitch const *p)
+{
+  pitch_dict_->elem (s) = *p;
+}
+
+Notename_table::Notename_table ()
+{
+  pitch_dict_ = new Dictionary<Musical_pitch>;
+}
+
+Notename_table::~Notename_table()
+{
+  delete pitch_dict_;
+}
+
+Notename_table::Notename_table (Notename_table const &s)
+{
+  pitch_dict_ = new Dictionary<Musical_pitch> (*s.pitch_dict_);
+}
+bool
+Notename_table::elem_b (String s)const
+{
+  return pitch_dict_->elem_b (s);
+}
+Musical_pitch
+Notename_table::get_pitch (String s)const
+{
+  return (*pitch_dict_)[s];
+}
index dea59e6cf18ba29746f85b57368c5696431f4742..fd53025c2c64b6e151d3e8e062fffc102ffac237 100644 (file)
@@ -102,8 +102,8 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm)
        
       SCM box_scm
        = gh_list (ly_symbol2scm ("placebox"),
-                  gh_double2scm (a_off.x ()),
-                  gh_double2scm (a_off.y ()),
+                  gh_double2scm (a_off[X_AXIS]),
+                  gh_double2scm (a_off[Y_AXIS]),
                   SCM(i->func_),
                   SCM_UNDEFINED);
 
index adb3b1f0ca9848ddf030a95b6a41ae2517c755c5..b23d002e55c943a7769189d5764e562cce9bc559 100644 (file)
@@ -49,8 +49,8 @@ Paper_score::typeset_element (Score_element * elem_p)
 {
   elem_p->pscore_l_ = this;
 
-  SCM_CDR(element_smob_list_) = gh_cons (elem_p->self_scm_,
-                                        SCM_CDR (element_smob_list_));
+  gh_set_cdr_x(element_smob_list_,
+              gh_cons (elem_p->self_scm_, gh_cdr (element_smob_list_)));
   elem_p->set_elt_property ("full-name",
                            gh_str02scm((char*)elem_p->name()));
   
@@ -75,10 +75,10 @@ Paper_score::print () const
   DEBUG_OUT << "Paper_score { ";
   DEBUG_OUT << "\n elements: ";
 
-  for (SCM p = SCM_CDR (element_smob_list_);
+  for (SCM p = gh_cdr (element_smob_list_);
        p != SCM_EOL;
-       p = SCM_CDR(p))
-    gh_display (SCM_CAR(p));
+       p = gh_cdr(p))
+    gh_display (gh_car (p));
   DEBUG_OUT << "}\n";
 #endif
 }
index ea6499510e3999919ad00bb22f26d9f700b11a23..0d802fd2ff78f6a6d2a323e419de364018c58f15 100644 (file)
@@ -20,7 +20,6 @@
 #include "midi-def.hh"
 #include "main.hh"
 #include "file-path.hh"
-#include "keyword.hh"
 #include "debug.hh"
 #include "dimensions.hh"
 #include "identifier.hh"
@@ -132,7 +131,6 @@ yylex (YYSTYPE *s,  void * v_l)
 %token ALTERNATIVE
 %token BAR
 %token BREATHE
-%token CADENZA
 %token CHORDMODIFIERS
 %token CHORDS
 %token HYPHEN
@@ -328,8 +326,7 @@ notenames_body:
                $$ = $1-> access_content_Notename_table(true);
        }
        | notenames_body STRING '=' explicit_musical_pitch {
-               (*$$)[ly_scm2string ($2)] = *$4;
-
+               $$->add_note_name (ly_scm2string ($2), $4);
                delete $4;
        }
        ;
index b0278c661d17cc955ba55c49574200fd703acc72..7496881ad0732a1c33f420cd88bc0260379a59e3 100644 (file)
@@ -25,19 +25,15 @@ Performer_group_performer::announce_element (Audio_element_info info)
 void
 Performer_group_performer::do_announces()
 {
-  Link_array<Translator_group> groups = group_l_arr ();
-  for (int i=0; i < groups.size(); i++) 
+   for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
     {
-      Performer_group_performer * group = dynamic_cast<Performer_group_performer*> (groups[i]);
-      if (group)
-       {
-         group->do_announces();
-       }
+      if (Performer_group_performer *trg =  dynamic_cast <Performer_group_performer *> (p->car_))
+       trg->do_announces ();
     }
+
   
   Request dummy_req;
 
-  Link_array<Translator> nongroups = nongroup_l_arr ();
   while (announce_info_arr_.size ())
     {
       for (int j =0; j < announce_info_arr_.size(); j++)
@@ -46,24 +42,32 @@ Performer_group_performer::do_announces()
          
          if (!info.req_l_)
            info.req_l_ = &dummy_req;
-         for (int i=0; i < nongroups.size(); i++) 
-           {   // Is this good enough?
-             Performer * eng = dynamic_cast<Performer*> (nongroups[i]);
-             // urg, huh? core dump?
-             //if (eng && eng!= info.origin_trans_l_arr_[0])
-             if (eng && info.origin_trans_l_arr_.size ()
-                 && eng!= info.origin_trans_l_arr_[0])
-               eng->acknowledge_element (info);
+
+         for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
+           {
+             if (!dynamic_cast <Performer_group_performer *> (p->car_))
+               {
+                 Performer * eng = dynamic_cast<Performer*> (p->car_);
+                 // urg, huh? core dump?
+                 //if (eng && eng!= info.origin_trans_l_arr_[0])
+                 if (eng && info.origin_trans_l_arr_.size ()
+                     && eng!= info.origin_trans_l_arr_[0])
+                   eng->acknowledge_element (info);
+               }
+           }
+         announce_info_arr_.clear ();
+      
+      
+         for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
+           {
+             if (!dynamic_cast <Performer_group_performer *> (p->car_))
+               {
+                 Performer * eng = dynamic_cast<Performer*> (p->car_);
+                 if (eng)
+                   eng->process_acknowledged ();
+               }
            }
        }
-      announce_info_arr_.clear ();
-      for (int i=0; i < nongroups.size(); i++)
-       {
-         Performer * eng = dynamic_cast<Performer*> (nongroups[i]);
-         if (eng)
-           eng->process_acknowledged ();
-       }
-
     }
 }
 
index 268969759bc8e63d07c821a13ed27b5f2e1c5a9a..0c86a3c703b5391f52a01ac330658e23d77e4814 100644 (file)
@@ -53,19 +53,17 @@ Property_engraver::acknowledge_element (Score_element_info i)
 void
 Property_engraver::apply_properties (SCM p, Score_element *e)
 {  
-  for (; SCM_NIMP (p); p = gh_cdr (p))
+  for (; gh_pair_p (p); p = gh_cdr (p))
     {
       SCM entry = gh_car (p);
       SCM prop_sym = gh_car (entry);
       SCM type_p   = gh_cadr (entry);
       SCM elt_prop_name = gh_caddr (entry);
 
-      /*
-       urg scm <-> symbol-string
-       */
-      if (e->get_elt_property (ly_scm2string (elt_prop_name)) != SCM_UNDEFINED)
+      SCM preset = scm_assq(prop_sym, e->element_property_alist_);
+      if (preset != SCM_BOOL_F)
        continue;
-      
+  
       SCM val = get_property (prop_sym, 0);
       if (val != SCM_UNDEFINED
          && gh_apply (type_p, scm_listify (val, SCM_UNDEFINED))
index 043cb23949752bbcac2e9afdaeb1f992423a46f0..4d417416f15ca4226394d99bb8292a8e29dd23d4 100644 (file)
@@ -60,7 +60,7 @@ Scheme_hash_table::Scheme_hash_table (Scheme_hash_table const &src)
 }
 
 int
-Scheme_hash_table::print_smob (SCM s, SCM p, scm_print_state*ps)
+Scheme_hash_table::print_smob (SCM s, SCM p, scm_print_state*)
 {
   assert (SMOB_IS_TYPE_B (Scheme_hash_table, s));
   Scheme_hash_table *me = SMOB_TO_TYPE(Scheme_hash_table,s);
index 5262ea179d8072ff2425693853714ac0ea43c25b..b3e5dc83ab87d47e673a3e80b7d07caaab0c598d 100644 (file)
 #include "dictionary-iter.hh"
 #include "debug.hh"
 #include "identifier.hh"
+#include "dictionary.hh"
+#include "protected-scm.hh"
 
 void
 Scope::print () const
 {
+#ifndef NPRINT
   bool init_b = false;         // ugh
   for (Scope_iter ai (*this);  ai.ok(); ai++)
     {
@@ -24,6 +27,7 @@ Scope::print () const
          ai.val()->print ();
        }
     }
+#endif
 }
 
 Scope::~Scope ()
@@ -33,14 +37,15 @@ Scope::~Scope ()
       DEBUG_OUT << "deleting: " << ai.key() << '\n';
       delete ai.val ();
     }
+  delete id_dict_;
 }
 
 Scope::Scope (Scope const&s)
-  : Hash_table<Protected_scm,Identifier*> (s)
 {
+  id_dict_ = new Hash_table<Protected_scm,Identifier*> (*s.id_dict_);
   for (Scope_iter ai (s); ai.ok(); ai++)
     {
-      (*this)[ai.scm_key ()] = ai.val ()->clone ();
+      id_dict_->elem (ai.scm_key ()) = ai.val ()->clone ();
     }
 }
 
@@ -52,49 +57,68 @@ unsigned int ly_pscm_hash (Protected_scm s)
 
 Scope::Scope ()
 {
-  hash_func_ = ly_pscm_hash;
+  id_dict_ = new Hash_table<Protected_scm,Identifier*>;
+  id_dict_->hash_func_ = ly_pscm_hash;
 }
 
 bool
 Scope::elem_b (String s) const
 {
-  return elem_b (ly_symbol2scm (s.ch_C()));
+  return id_dict_->elem_b (ly_symbol2scm (s.ch_C()));
 }
 
 
 Identifier *&
 Scope::elem (String s) 
 {
-  return elem (ly_symbol2scm (s.ch_C()));
+  return id_dict_->elem (ly_symbol2scm (s.ch_C()));
 }
 
 
 Scope_iter::Scope_iter (Scope const &s)
-  : Hash_table_iter<Protected_scm,Identifier*>(s)
 {
+  iter_ = new Hash_table_iter<Protected_scm,Identifier*>(*s.id_dict_);
 }
 
 String
 Scope_iter::key () const
 {
-  SCM s= Hash_table_iter<Protected_scm,Identifier*>::key ();
+  SCM s= iter_->key ();
   return ly_symbol2string (s);
 }
 
 bool
 Scope::elem_b (SCM s) const
 {
-  return Hash_table<Protected_scm,Identifier*> ::elem_b (s);
+  return id_dict_->elem_b (s);
 }
 
 Identifier* &
 Scope::elem (SCM s)
 {
-  return Hash_table<Protected_scm,Identifier*> ::elem (s);
+  return id_dict_->elem (s);
 }
 
 SCM
 Scope_iter::scm_key () const
 {
-  return Hash_table_iter<Protected_scm,Identifier*>::key ();
+  return iter_->key ();
+}
+
+bool
+Scope_iter::ok () const
+{
+  return iter_->ok();
+}
+
+void
+Scope_iter::operator ++(int)
+{
+  (*iter_) ++;
+}
+
+Identifier*
+Scope_iter::val ()const
+{
+  return iter_->val ();
 }
index 918550d15862f95578f8542db0a4c95460584804..7e0c8e60b10ac4eab8ba28c92be88ef8cdfe3c4e 100644 (file)
@@ -121,7 +121,7 @@ Score_element::get_elt_property (String nm) const
   SCM s = scm_assq(sym, element_property_alist_);
 
   if (s != SCM_BOOL_F)
-    return SCM_CDR (s); 
+    return gh_cdr (s); 
   
   if (pscore_l_)
     {
@@ -415,37 +415,14 @@ Score_element::handle_broken_smobs (SCM s, SCM criterion)
     }
   return s;
 }
-#if 0
-void
-Score_element::recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)())
-{
-  Score_element * sc = unsmob_element ( s);
-  if (sc)
-    {
-      (sc->*meth_ptr) ();
-    }
-  else if (gh_pair_p (s))
-    {
-      recurse_into_smobs (gh_car (s), meth_ptr);
-      recurse_into_smobs (gh_cdr (s), meth_ptr);      
-    }
-}
-#endif
 
 void
 Score_element::handle_broken_dependencies()
 {
   Line_of_score *line  = line_l();
-  
-  SCM rec = get_elt_property ("handle-broken-deps");
-  if (gh_boolean_p (rec) && gh_scm2bool (rec))
-    return;
-  
-  set_elt_property ("handle-broken-deps", SCM_BOOL_T);
   element_property_alist_ = handle_broken_smobs (element_property_alist_,
                                                 line ? line->self_scm_ : SCM_UNDEFINED);
 
-
   if (!line)
     return;
 }
@@ -496,7 +473,7 @@ Score_element::find_broken_piece (Line_of_score*) const
 SCM
 Score_element::mark_smob (SCM ses)
 {
-  void * mp = (void*) SCM_CDR(ses);
+  void * mp = (void*) gh_cdr(ses);
   Score_element * s = (Score_element*) mp;
 
   assert (s->self_scm_ == ses);
@@ -507,7 +484,7 @@ Score_element::mark_smob (SCM ses)
 int
 Score_element::print_smob (SCM s, SCM port, scm_print_state *)
 {
-  Score_element *sc = (Score_element *) SCM_CDR (s);
+  Score_element *sc = (Score_element *) gh_cdr (s);
      
   scm_puts ("#<Score_element ", port);
   scm_puts ((char *)sc->name (), port);
@@ -529,7 +506,7 @@ IMPLEMENT_SMOBS(Score_element);
 SCM
 Score_element::equal_p (SCM a, SCM b)
 {
-  return SCM_CDR(a) == SCM_CDR(b) ? SCM_BOOL_T : SCM_BOOL_F;
+  return gh_cdr(a) == gh_cdr(b) ? SCM_BOOL_T : SCM_BOOL_F;
 }
 
 void
@@ -583,15 +560,6 @@ unsmob_element (SCM s)
 }
 
 
-/*
-  JUNKME
- */
-void
-Score_element::invalidate_cache (Axis a)
-{
-  //  dim_cache_[a]->invalidate ();
-}
-
 Score_element*
 Score_element::parent_l (Axis a) const
 {
index 83d2c47eef16eb8394e4125533a8f62133e3ef86..696acfa4041fce3ff65009ed8ca7cf14e94637c6 100644 (file)
@@ -5,11 +5,9 @@
 
   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
-
+#include "debug.hh"
 #include "dimension-cache.hh"
-#include "super-element.hh"
 #include "line-of-score.hh"
-#include "debug.hh"
 #include "item.hh"
 #include "score-engraver.hh"
 #include "paper-score.hh"
index bb38f2833968f129193f1951791d61280e9f59ff..65317776bbc7e51782b05f665d18a531618e12ee 100644 (file)
@@ -55,16 +55,16 @@ Script_engraver::do_process_requests()
       
       list = gh_cdr (list);
       p->set_elt_property ("molecule",
-                          SCM_CAR(list));
-
-      list = SCM_CDR(list);
-      bool follow_staff = gh_scm2bool (SCM_CAR(list));
-      list = SCM_CDR(list);
-      int relative_stem_dir = gh_scm2int (SCM_CAR(list));
-      list = SCM_CDR(list);
-      int force_dir =gh_scm2int (SCM_CAR(list));
-      list = SCM_CDR(list);
-      SCM priority = SCM_CAR(list);
+                          gh_car (list));
+
+      list = gh_cdr(list);
+      bool follow_staff = gh_scm2bool (gh_car (list));
+      list = gh_cdr(list);
+      int relative_stem_dir = gh_scm2int (gh_car (list));
+      list = gh_cdr(list);
+      int force_dir =gh_scm2int (gh_car (list));
+      list = gh_cdr(list);
+      SCM priority = gh_car (list);
 
       
       if (relative_stem_dir)
index cc5db9d7482c1952807dd8cdf10ae2ff7eb4f5c3..5fb7c6767dd810d2e0b37452b5fc7f0d8698be88 100644 (file)
@@ -21,7 +21,7 @@ Script::get_molecule(Direction d) const
   SCM s = get_elt_property ("molecule");
   assert (s != SCM_UNDEFINED);
 
-  SCM key = SCM_CAR (s);
+  SCM key = gh_car  (s);
   if (key == ly_symbol2scm ("feta"))
     {
       return lookup_l ()->afm_find ("scripts-" +
index 0a351dc2c23f23a3de36e59ffe12ca2d798a2fcd..ce3429f892105637767a0a3056c5891baced6571 100644 (file)
@@ -167,7 +167,9 @@ Slur::do_post_processing ()
   Direction d = LEFT;
   do 
     {
-      dx_f_drul_[d] = dy_f_drul_[d] = 0;
+      dx_f_drul_[d] = 0;
+      dy_f_drul_[d] = 0;
+      
       if ((note_column_drul[d] == spanned_drul_[d])
          && note_column_drul[d]->first_head ()
          && (note_column_drul[d]->stem_l ()))
@@ -319,9 +321,8 @@ Slur::do_post_processing ()
    */
   for (int i = 0; i < 3; i++)
     {
-      Drul_array<Interval> curve_xy_drul = curve_extent_drul ();
-      Real height_f = curve_xy_drul[Y].length ();
-      Real width_f = curve_xy_drul[X].length ();
+      Real height_f = curve_extent (Y_AXIS).length ();
+      Real width_f = curve_extent (X_AXIS).length ();
       
       dy_f = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT];
       if (!fix_broken_b)
index ab8d82ae4a76176eea862e266fe7449211802df0..b7a44615b72a8f75a93aa493efef2690445f9901 100644 (file)
@@ -148,7 +148,7 @@ Spacing_spanner::do_measure (Link_array<Score_column> cols) const
          
          if (next_stretch_hint != SCM_UNDEFINED)
            // see regtest spacing-tight
-           stretch_dist += - gh_scm2double (SCM_CAR (next_stretch_hint));
+           stretch_dist += - gh_scm2double (gh_car  (next_stretch_hint));
          else
            stretch_dist += right_dist;
 
@@ -248,8 +248,8 @@ Spacing_spanner::stem_dir_correction (Score_column*l, Score_column*r) const
   if (scm_ilength (dl) != 1 && scm_ilength (dr) != 1)
     return 0.;
 
-  dl = SCM_CAR(dl);
-  dr = SCM_CAR(dr);
+  dl = gh_car (dl);
+  dr = gh_car (dr);
 
   assert (gh_number_p (dl) && gh_number_p(dr));
   int d1 = gh_scm2int (dl);
index 5fb0da4792f5485a04d89a52c48fbfedd9bac27d..b60fe1cf37e6a8fdb7f7fe285e0a29e24387c5ef 100644 (file)
 #include "break-align-item.hh"
 
 void
-Spanner::break_into_pieces ()
+Spanner::do_break_processing()
 {
+  //break_into_pieces
+  
   if (line_l () || broken_b ())
     return;
   
@@ -99,13 +101,6 @@ Spanner::set_bounds(Direction d, Item*i)
 }
 
 
-
-void
-Spanner::do_break_processing()
-{
-  break_into_pieces ();
-}
-
 Spanner::Spanner ()
 {
   spanned_drul_[LEFT]=0;
@@ -126,8 +121,8 @@ Spanner::spanner_length() const
   Real r = spanned_drul_[RIGHT]->relative_coordinate (0, X_AXIS);
 
   if (r< l)
-    warning (_ ("spanner with negative length"));
-       
+    programming_error ("spanner with negative length");
+
   return r-l;
 }
 
@@ -145,9 +140,6 @@ Spanner::line_l() const
 Score_element*
 Spanner::find_broken_piece (Line_of_score*l) const
 {
-  Spanner* me = (Spanner*) this;
-  me->break_into_pieces ();
-  
   int idx = binsearch_link_array (broken_into_l_arr_,  (Spanner*)l, Spanner::compare);
   
   if (idx < 0)
diff --git a/lily/time-description.cc b/lily/time-description.cc
deleted file mode 100644 (file)
index 2874444..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
-  timing-translator.cc -- implement Timing_translator
-
-  source file of the GNU LilyPond music typesetter
-
-  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "timing-translator.hh"
-#include "translator-group.hh"
-#include "debug.hh"
index e20daeb0aa3ca328ae8897a86bb9ee0ae8fa75f3..fb5d6b449915c385572abe1ff07feb49fdb2e5dd 100644 (file)
@@ -40,13 +40,16 @@ Translator_group::Translator_group()
 void
 Translator_group::check_removal()
 {
-  Link_array<Translator_group> groups (group_l_arr ());
-  
-  for (int i =0; i < groups.size(); i++)
+  Cons<Translator> *next =0;
+  for (Cons<Translator> *p = trans_p_list_.head_; p; p = next)
     {
-      groups[i]->check_removal();
-      if (groups[i]->removable_b())
-       terminate_translator (groups[i]);
+      next = p->next_;
+      if (Translator_group *trg =  dynamic_cast <Translator_group *> (p->car_))
+       {
+         trg->check_removal ();
+         if (trg->removable_b())
+           terminate_translator (trg);
+       }
     }
 }
 
@@ -126,11 +129,12 @@ Translator_group::find_existing_translator_l (String n, String id)
   if (is_alias_b (n) && (id_str_ == id || id.empty_b ()))
     return this;
 
-  Link_array<Translator_group> groups (group_l_arr ());
+
   Translator_group* r = 0;
-  for (int i =0; !r && i < groups.size(); i++)
+  for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
     {
-      r = groups[i]->find_existing_translator_l (n,id);
+      if (Translator_group *trg =  dynamic_cast <Translator_group *> (p->car_))
+       r = trg->find_existing_translator_l (n, id);
     }
 
   return r;
@@ -215,10 +219,13 @@ Translator_group::try_music_on_nongroup_children (Music *m)
 {
   bool hebbes_b =false;
 
-  Link_array<Translator> nongroups (nongroup_l_arr ());
-  
-  for (int i =0; !hebbes_b && i < nongroups.size() ; i++)
-    hebbes_b =nongroups[i]->try_music (m);
+  for (Cons<Translator> *p = trans_p_list_.head_; !hebbes_b && p; p = p->next_)
+    {
+      if (!dynamic_cast <Translator_group *> (p->car_))
+       {
+         hebbes_b = p->car_->try_music (m);
+       }
+    }
   return hebbes_b;
 }
 
@@ -247,32 +254,9 @@ Translator_group::ancestor_l (int level)
   return daddy_trans_l_->ancestor_l (level-1);
 }
 
-Link_array<Translator_group>
-Translator_group::group_l_arr () const
-{
-  Link_array<Translator_group> groups;
-  for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
-    {
-      if (dynamic_cast <Translator_group *> (p->car_))
-       groups.push (dynamic_cast <Translator_group *> (p->car_));
-    }
-  return groups;
-}
 
-Link_array<Translator>
-Translator_group::nongroup_l_arr () const
-{
-  Link_array<Translator> groups;
-  for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
-    {
-      if (!dynamic_cast <Translator_group *> (p->car_))
-       groups.push (p->car_);
-    }
-  return groups;
-}
-/**
-   End translator: call "destructor", remove from hierarchy, and delete
- */
+
+
 
 void
 Translator_group::terminate_translator (Translator*r_l)
@@ -310,11 +294,10 @@ Translator_group::remove_translator_p (Translator*trans_l)
 Translator*
 Translator_group::get_simple_translator (String type) const
 {
-  Link_array<Translator> nongroups (nongroup_l_arr ());
-  for (int i=0; i < nongroups.size(); i++)
+  for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
     {
-      if (classname (nongroups[i]) == type)
-       return nongroups[i];
+      if (classname (p->car_) == type)
+       return p->car_;
     }
   if (daddy_trans_l_)
     return daddy_trans_l_->get_simple_translator (type);
index 9e755f6a1180b64b8571c0b054998892b0719a00..4a28d27368e886ad9b71e034ceecc3879af4165c 100644 (file)
@@ -52,28 +52,28 @@ voicefour = {
 infinity=10000
 
 beamslopeproportional = 
-       \property Score.beamslopedamping = 0
+       \property Score.beamSlopedamping = 0
 
 beamslopedamped = 
-       \property Score.beamslopedamping = 1
+       \property Score.beamSlopedamping = 1
 
 
 beamslopezero = 
-       \property Score.beamslopedamping = \infinity
+       \property Score.beamSlopedamping = \infinity
 
 
 % this sucks, you'd want to pass an array, at least
 % (or embedded code: you still can't dictate the slope / stemlength)
 beamposfree = 
-       \property Score.beamquantisation = 0
+       \property Score.beamQuantisation = 0
 
 
 beamposnormal = 
-       \property Score.beamquantisation = 1
+       \property Score.beamQuantisation = 1
 
 
 beampostraditional = 
-       \property Score.beamquantisation = 2
+       \property Score.beamQuantisation = 2
 
 
 slurnormal = 
index 08483c3b3b4cda40ab9f0781c46efa1ac7cafc71..a590a6ba78b651e90e71b7dec139e75f013a9e55 100644 (file)
@@ -1,15 +1,15 @@
 Begin3
 Title: LilyPond
-Version: 1.3.12
-Entered-date: 16DEC99
+Version: 1.3.13
+Entered-date: 18DEC99
 Description: 
 Keywords: music notation typesetting midi fonts engraving
 Author: hanwen@cs.uu.nl (Han-Wen Nienhuys)
        janneke@gnu.org (Jan Nieuwenhuizen)
 Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
 Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert
-       1000k lilypond-1.3.12.tar.gz 
+       1000k lilypond-1.3.13.tar.gz 
 Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
-       1000k lilypond-1.3.12.tar.gz 
+       1000k lilypond-1.3.13.tar.gz 
 Copying-policy: GPL
 End
index 6215ec84ad0776ed6ac8df8739a7baa9c1c6fc54..e297d6b37a9d033d9b94412626aa0cd883573ca5 100644 (file)
@@ -1,9 +1,9 @@
 Name: lilypond
-Version: 1.3.12
+Version: 1.3.13
 Release: 1
 Copyright: GPL
 Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.12.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.13.tar.gz
 Summary: A program for printing sheet music.
 URL: http://www.cs.uu.nl/~hanwen/lilypond
 # get Packager from (undocumented?) ~/.rpmmacros!
index c9e0fee90034af932ba5e945a8841cf2bca0006d..ad93e68e2f1897377245d6ebac39f84d54f90ad0 100644 (file)
--- a/po/nl.po
+++ b/po/nl.po
@@ -816,7 +816,7 @@ msgstr "Negatieve afstand, zet op 10 mm"
 #: stem-engraver.cc:80
 #, c-format
 msgid "Adding note head to incompatible stem (type = %d)"
-msgstr "Voeg noot bolletje toe aan onverenigbare stok (type = %s)"
+msgstr "Voeg noot bolletje toe aan onverenigbare stok (type = %d)"
 
 #: stem.cc:26
 msgid "stem direction set already!"