]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.1.4
authorfred <fred>
Tue, 26 Mar 2002 21:29:04 +0000 (21:29 +0000)
committerfred <fred>
Tue, 26 Mar 2002 21:29:04 +0000 (21:29 +0000)
26 files changed:
TODO
init/engraver.ly
init/lily.scm
input/test/GNUmakefile
input/test/stars-and-stripes.ly [new file with mode: 0644]
lily/command-request.cc
lily/idealspacing.cc
lily/include/idealspacing.hh
lily/include/key-item.hh
lily/include/simple-spacer.hh [new file with mode: 0644]
lily/include/staff-sym-engraver.hh
lily/key-engraver.cc
lily/key-item.cc
lily/lookup.cc
lily/paper-def.cc
lily/paper-outputter.cc
lily/simple-spacer.cc [new file with mode: 0644]
lily/spring-spacer.cc
lily/staff-sym-engraver.cc
mudela-mode.el
ps/lilyponddefs.ps
scripts/mup-to-ly.py [new file with mode: 0644]
stepmake/stepmake/executable-targets.make
stepmake/stepmake/executable-vars.make
stepmake/stepmake/package.make
tex/lilyponddefs.tex

diff --git a/TODO b/TODO
index ffd01a279742e2d835e921e14df3dc0e149346cb..a94bbad6d9627b739d057d79052bd782fd11f250 100644 (file)
--- a/TODO
+++ b/TODO
@@ -8,9 +8,9 @@ grep for TODO and ugh/ugr/urg
 
 
 BUGS:
-       * --safe:  disallow backslashes, disallow \include.
+       * latex bla.tex broken (titles / \lilyfooter stuff?)
 
-       * fix fontsize switching
+       * --safe:  disallow backslashes, disallow \include.
 
        * fix rounding stuff in number->string
 
index 47fb08f7fd8734ca8dee631ae3ea51ed8bd23660..aa3a5382bec85b4b98866e9f45bb5d598cc0105e 100644 (file)
@@ -20,7 +20,7 @@ StaffContext=\translator {
        \consists "Key_engraver";
        \consists "Local_key_engraver";
        \consists "Time_signature_engraver";
-       \consists "Staff_sym_engraver";
+       \consists "Staff_symbol_engraver";
        \consists "Collision_engraver";
        \consists "Rest_collision_engraver";
        \consists "Tuplet_engraver";
@@ -77,7 +77,7 @@ RhythmicStaffContext=\translator{
        \name RhythmicStaff;
        \consists "Bar_engraver";
        \consists "Time_signature_engraver";
-       \consists "Staff_sym_engraver";
+       \consists "Staff_symbol_engraver";
        \accepts "Voice";
 };
 \translator{\RhythmicStaffContext}
@@ -103,7 +103,8 @@ VoiceContext = \translator {
 };
 
 \translator {\VoiceContext}
-\translator {
+
+GrandStaffContext=\translator{
        \type "Line_group_engraver_group";
        \name GrandStaff;
        \consists "Span_bar_engraver";
@@ -112,7 +113,8 @@ VoiceContext = \translator {
        minVerticalAlign = 1.5*\staffheight;
 
        \accepts "Staff";
-}
+};
+\translator{\GrandStaffContext}
 
 \translator {
        \type "Line_group_engraver_group";
@@ -206,7 +208,7 @@ HaraKiriStaffContext = \translator {
        \consists "Key_engraver";
        \consists "Time_signature_engraver";
        \consists "Local_key_engraver";
-       \consists "Staff_sym_engraver";
+       \consists "Staff_symbol_engraver";
        \consists "Collision_engraver";
        \consists "Rest_collision_engraver";
        \consists "Staff_margin_engraver";
index 9c38a76bfa0113f7d3d6e99cd897c7bf6d3665e3..8cd3f0eabe68fd60bdaed30ffe42c79c36c35af7 100644 (file)
 (define 
   (font-def o i s) 
   ((invoke-output o "font-def") i s))
-;  (empty o))
 
 (define 
   (font-def-ps i s)
   (string-append
    "\n/" (font i) " {/" 
-   (substring s 0 (- (string-length s) 3))
+   (substring s 0 (- (string-length s) 4))
    " findfont 12 scalefont setfont} bind def\n"))
 
 (define 
 
 (define 
   (start-line-ps) 
-  (string-append
-   (urg-fix-font-ps)
-   "\nstart_line {\n"))
+   "\nstart_line {\n")
 
 (define 
   (start-line-tex) 
   (string-append 
-   (urg-fix-font-tex)
-   "\\hbox{%\n"))
+   "\\hbox{%\n")
+  )
+
+
+(define
+  (startbar o h)
+  ((invoke-output o "invoke-dim1") "startbar" h))
 
 (define
   (startrepeat o h)
   (text-tex f s)
   (string-append "\\set" f "{" s "}"))
 
-(define
-  (urg-fix-font-ps)
-  "/fontA { /feta20 findfont 12 scalefont setfont} bind def fontA\n")
-
-(define
-  (urg-fix-font-tex)
-  "\\font\\fontA=feta20.afm\\fontA\n")
 
-(define 
-  (urg-font-switch-ps i)
-  "\n/feta20 findfont 12 scalefont setfont \n")
 
index 74fec0e68da9f5e35d540994dca3c925ac4ccd24..5af2ecfc95a9180d61595807eed3578e906018af 100644 (file)
@@ -1,7 +1,7 @@
 # input/test/Makefile
 
 depth = ../..
-examples=font20 hara-kiri grace mark denneboom
+examples=font20 hara-kiri grace mark denneboom stars-and-stripes
 LOCALSTEPMAKE_TEMPLATES=mutopia
 
 include $(depth)/make/stepmake.make 
diff --git a/input/test/stars-and-stripes.ly b/input/test/stars-and-stripes.ly
new file mode 100644 (file)
index 0000000..289fc5a
--- /dev/null
@@ -0,0 +1,108 @@
+%{
+Converted from star.mup with the aid of mup-to-ly.py
+http://www.Arkkra.com/.../star.ps
+%}
+\header{
+title="The Star Spangled Banner";
+subtitle="(The United States National Anthem)";
+poet="Text by Francis Scott Key";
+composer="J. S. Smith";
+arranger="Arranged by William J. Krauss";
+enteredby="jcn";
+copyright="public domain";
+}
+
+$staff1_voice_1 = \notes {
+  [a8.()fis16] d4 fis4 a4 d'2 [fis'8. e'16] d'4 fis4 gis4 a2 [a8 a8] fis'4.  e'8
+  d'4 cis'2 [b8. cis'16] d'4 d'4 a4 fis4 d4 [a8. fis16] fis4 d4 [fis'8.
+  fis'16] fis'4 g'4 a'4 a'2 [g'8 fis'8] e'4 fis'4 g'4 g'2 g'4 fis'4. e'8 d'4
+  cis'2 [b8. cis'16] d'4 fis4 gis4 a2 a4 d'4 d'4 [d'8()cis'8] b4 b4 b4 e'4 [g'8
+()fis'8] [e'8()d'8] d'4~cis'4 [a8. a16] d'4.~e'8 [fis'8 g'8] a'2 [d'8 e'8]
+  fis'4. g'8 e'4 d'2 s4 }
+
+$staff1_voice_2 = \notes { 
+  [a8.()fis16] a,4 d4 e4 d4~fis4 [fis8. fis16] fis4 d4 d4 cis2 [e8 e8] a4. a8
+  a4 a2 [a8. a16] a4 a4 a4 fis4 d4 [a8. fis16] fis4 d4 r4 a4 a4 d'4 d'2
+  [a8 a8] cis'4 cis'4 cis'4 cis'2 a4 a4. a8 a4 a2 [a8. a16] d4 d4 d4
+  cis2 e4 fis4 e4 d4 d4 d4 dis4 g4 [g8()dis8] e4 e2 [e8. e16] d4.~a8 [a8 a8]
+  a2 [g8 g8] a4. a8 g4 fis2 s4 }
+
+$staff2_voice_1 = \notes { 
+  r4 fis4 a4 a4 b2 [cis'8. cis'16] b4 b4 b4 a2 [cis'8 cis'8] d'4. cis'8
+  d'4 e'2 [e'8. e'16] d'4 d'4 a4 fis4 d4 r4 fis4 d4 r4 d4 e4 fis4 fis'2
+  [e'8 d'8] e'4 e'4 e'4 e'2 cis'4  d'4. cis'8 d'4 e'2 [e'8. e'16] a4 a4
+  e4 e2 cis'4 a4 a4 a4 g4 g4 b4 b4 b4 b4 a2 [cis'8. cis'16] a4.~cis'8
+  [d'8 d'8] d'2 [d'8 d'8] d'4. d'8 cis'4 a2 s4 }
+
+$staff2_voice_2 = \notes { 
+  r4 d4 d4 cis4 b,2 [ais,8. ais,16] b,4 b,4 e4 a,2 [a8 a8] d4. e8 [fis8 g8]
+  a2 [g8. g16] fis4 fis4 a4 fis4 d4 r4 fis4 d4 r4 d4 d4 d4 d2 [d8 d8] a4
+  a4 a4 a2 a,4 d4. e8 [fis8 g8] a2 [g8. g16] fis4 d4 e4 a,2 a4 d4 e4 fis4
+  g4 g4 fis4 e4 [e8()fis8] [g8()gis8] a2 [g8. g16] fis4.~a,8 [d8 e8] fis2 [b8 b8]
+  a4. a8 a,4 d2 s4 }
+
+$text1 = \lyrics{
+  Oh say. can you see, by the dawn's ear- ly light What_so proud- ly we hailed,
+  At the twi- light's last gleam- ing. Whose broad
+}
+
+$text2 = \lyrics{
+  _ stripes and bright stars, through the per- il- ous fight, O'er the ram- parts
+  we watched, were so gal- lant- ly _ _ _
+}
+
+$text3 = \lyrics{
+  stream- ing. And the rock- ets' red glare, the bombs burst- ing in air, gave
+  proof through the night that our flag was still there, _ Oh say, does that
+  star- span- gled ban- ner yet wave, _ O'er the land _ of_the free and_the
+  home of the brave.  
+}
+
+global = \notes {
+       \time 3/4;
+       \key D;
+       \partial 4;
+       \skip 4;
+       \bar "|:";
+       \skip 2.*8;
+       \bar ":|";
+       \skip 2.*16;
+       \skip 2.;
+       \bar "|.";
+       }
+
+\include "paper16.ly";
+
+\score{ 
+       \type GrandStaff < 
+               \type Staff=staffA < 
+                       \global
+                       \notes \transpose c'' {\voiceone \$staff1_voice_1 } 
+                       \notes \transpose c'' {\voicetwo \$staff1_voice_2 } 
+               >
+               \type Lyrics = one \lyrics <
+% urg, too much distance between two texts; fixme first
+%                      \$text1
+%                      { \$text2 \$text3 }
+                       { \$text1 \$text3 }
+               >
+               \type Staff=staffB < 
+                       \global
+                       \clef bass;
+                       {\voiceone \$staff2_voice_1 } 
+                       {\voicetwo \$staff2_voice_2 } 
+               >
+       >
+       \paper{
+               \paper_sixteen;
+               textheight = 230.\mm;
+               linewidth= 180.\mm;
+               \translator {
+                               \GrandStaffContext
+                               \accepts "Lyrics";
+               }
+               \translator {
+                               \BarNumberingStaffContext
+               }
+       }
+}
index 9255f63cfb60ea1b05f52ea80d698351c381cf0e..cddf6c89fd0c1a8d9d457071a09b5a984e3431d1 100644 (file)
@@ -106,7 +106,7 @@ bool
 Barcheck_req::do_equal_b (Request*r) const
 {
   Barcheck_req *b = dynamic_cast<Barcheck_req*> (r);
-  return r;
+  return b;
 }
 
 
index f2638e0603e13cc6f8a9e6641e2ec1f70cf609a5..3966c6ad44119c8837c30f59156c7ed1ef0aea6b 100644 (file)
@@ -17,7 +17,7 @@ Idealspacing::print() const
 #ifndef NPRINT
   DOUT << "idealspacing {" ;
   DOUT << "distance " << space_f_ << " strength " << hooke_f_;
-  DOUT << "left " << left_i_ << " right " << right_i_ << "}\n";
+  DOUT << "left " << cols_drul_[LEFT] << " right " << cols_drul_[RIGHT] << "}\n";
 #endif
 }
 
@@ -25,8 +25,7 @@ Idealspacing::Idealspacing()
 {
   space_f_ = 0.0;
   hooke_f_ = 0.0;
-  left_i_ = -1;
-  right_i_ = -1;
+  cols_drul_[LEFT] = cols_drul_[RIGHT] = -1;
 }
 
 void
index 20ff60fee5bf6f8673c096d13c0e9f5779f287b5..2b2b72aab82550bffe1415af7535702dc8e930f0 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef IDEALSPACING_HH
 #define IDEALSPACING_HH
 #include "lily-proto.hh"
+#include "drul-array.hh"
 
 /// ideal spacing between two columns
 struct Idealspacing {
@@ -18,8 +19,7 @@ struct Idealspacing {
   Real hooke_f_;
 
   /// the two columns
-  int left_i_;
-  int right_i_;
+  Drul_array<int> cols_drul_;
     
   Real energy_f (Real x) const;
   void print() const;
index f8e3747b58cba51b4ae719f56dd7751e6980a426..e259c145e7400f2c797fcbdc767fbe17d1612550 100644 (file)
@@ -30,13 +30,7 @@ struct Key_item : Item {
 
   Key_item ();
   void add (int pitch, int acc);
-  void add (const Musical_pitch&);
   void add_old (int pitch, int acc);
-  void add_old (const Musical_pitch&);
-  void set (bool multi_octave_b,
-           Array<Musical_pitch> const &idx_arr,
-           Array<Musical_pitch> const &old_idx_arr);
-
   void set_c_position (int);
   int Key_item::calculate_position(int p, int a) const;
 
diff --git a/lily/include/simple-spacer.hh b/lily/include/simple-spacer.hh
new file mode 100644 (file)
index 0000000..1f6fc47
--- /dev/null
@@ -0,0 +1,48 @@
+/*   
+  simple-spacer.hh -- declare 
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#ifndef SIMPLE_SPACER_HH
+#define SIMPLE_SPACER_HH
+
+#include "real.hh"
+#include "array.hh"
+#include "lily-proto.hh"
+#include "list.hh"
+#include "drul-array.hh"
+
+struct Rod_info {
+  Real distance_f_;
+  Drul_array<int> cols_;
+};
+
+struct Spring_info {
+  /// the ideal distance
+  Real space_f_;
+
+  /// Hooke's constant: how strong are the "springs" attached to columns
+  Real hooke_f_;
+
+  Real blocking_stretch_f_;
+  Rod_info * blocking_rod_l_;
+  void set (Idealspacing *);
+  Spring_info();
+};
+
+
+class Simple_spring_spacer {
+  Array<Spring_info> springs_;
+  Pointer_list<Rod_info*> rods_;
+
+  void init ();
+  Array<Real> solve ();
+  
+};
+
+#endif /* SIMPLE_SPACER_HH */
+
index 0cc98d62837979fdb884d813dd44f42dabfe70aa..8235f2aa03344e718dd1f55ca2940b218bac7982 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  staff-sym-engraver.hh -- declare Staff_sym_engraver
+  staff-sym-engraver.hh -- declare Staff_symbol_engraver
 
   source file of the GNU LilyPond music typesetter
 
 /**
   Manage the staff symbol.
  */
-class Staff_sym_engraver : public Engraver { 
+class Staff_symbol_engraver : public Engraver { 
     Staff_symbol *span_p_;
 public:
-  TRANSLATOR_CLONE(Staff_sym_engraver);
-  Staff_sym_engraver();
+  TRANSLATOR_CLONE(Staff_symbol_engraver);
+  Staff_symbol_engraver();
   DECLARE_MY_RUNTIME_TYPEINFO;
 protected:
-  virtual ~Staff_sym_engraver();
+  virtual ~Staff_symbol_engraver();
   virtual void fill_staff_info (Staff_info&);
   virtual void do_removal_processing();
   virtual void do_creation_processing();
index e2152e224545fcd89d368dbc6397e044c925d1da..8925a26d08b7a1a65499af5bfad492420d83f469 100644 (file)
@@ -29,9 +29,30 @@ Key_engraver::create_key ()
       kit_p_ = new Key_item;
       kit_p_->break_priority_i_ = -1; // ugh
       announce_element (Score_element_info (kit_p_,keyreq_l_));
-      kit_p_->set (key_.multi_octave_b_, accidental_idx_arr_, old_accidental_idx_arr_);
+
+
+      for (int i = 0; i < accidental_idx_arr_.size(); i++) 
+       {
+         Musical_pitch m_l =accidental_idx_arr_[i];
+         int a =m_l.accidental_i_;      
+         if (key_.multi_octave_b_)
+           kit_p_->add (m_l.steps (), a);
+         else
+           kit_p_->add (m_l.notename_i_, a);
+       }
+
+      for (int i = 0 ; i< old_accidental_idx_arr_.size(); i++) 
+       {
+         Musical_pitch m_l =old_accidental_idx_arr_[i];
+         int a =m_l.accidental_i_;
+         if (key_.multi_octave_b_)
+           kit_p_->add_old (m_l.steps  (), a);
+         else
+           kit_p_->add_old (m_l.notename_i_, a);
+       }
     }
-}
+}      
+
 
 bool
 Key_engraver::do_try_request (Request * req_l)
index 7d519d3b97a025ec6399f33927a21ee0f6c92e3b..0c2476b3170cb2374f82dd13e2e6c0359f9f02f5 100644 (file)
@@ -26,32 +26,6 @@ Key_item::Key_item ()
   set_c_position (0);
 }
 
-void
-Key_item::set (bool multi_octave_b,
-              Array<Musical_pitch> const &idx_arr,
-              Array<Musical_pitch> const &old_idx_arr)
-{
-  multi_octave_b_ =multi_octave_b;
-
-  for (int i = 0; i < idx_arr.size(); i++) 
-    {
-      Musical_pitch m_l =idx_arr[i];
-      if (multi_octave_b_)
-       add (m_l);
-      else
-       add (m_l.notename_i_, m_l.accidental_i_);
-    }
-
-  for (int i = 0 ; i< old_idx_arr.size(); i++) 
-    {
-      Musical_pitch m_l =old_idx_arr[i];
-      if (multi_octave_b_)
-        add_old (m_l);
-      else
-       add_old (m_l.notename_i_, m_l.accidental_i_);
-    }
-}
-
 void 
 Key_item::set_c_position (int c0)
 {
@@ -71,13 +45,6 @@ Key_item::add (int p, int a)
   acc_arr_.push (a);
 }
 
-void
-Key_item::add (const Musical_pitch& pitch_r)
-{
-  pitch_arr_.push (pitch_r.steps());
-  acc_arr_.push (pitch_r.accidental_i_);
-}
-
 void
 Key_item::add_old (int p, int a)
 {
@@ -85,12 +52,6 @@ Key_item::add_old (int p, int a)
   old_acc_arr_.push (a);
 }
 
-void
-Key_item::add_old (const Musical_pitch& pitch_r)
-{
-  old_pitch_arr_.push (pitch_r.steps());
-  old_acc_arr_.push (pitch_r.accidental_i_);
-}
 
 int
 Key_item::calculate_position(int p, int a) const
index acb4a7e84b2fd1fcd995c4c8f93515fa311403fe..300439b3dd0bec0cd7e4cc13e351ba51ad9c61ac 100644 (file)
@@ -178,13 +178,12 @@ Lookup::dashed_slur (Array<Offset> controls, Real thick, Real dash) const
     }
 
   // (lambda (o) (dashed-slur o thick dash '(stuff))
-  a.lambda_ = gh_list (gh_append3 (ly_lambda_o (),
-                                 ly_func_o ("dashed-slur"),
-                                 gh_list (gh_double2scm (thick),
-                                          gh_double2scm (dash),
-                                          ly_quote_scm (gh_list (sc[0], sc[1], sc[2], sc[3], SCM_UNDEFINED)),
-                                          SCM_UNDEFINED)
-                                 ), SCM_UNDEFINED);
+  a.lambda_ = 
+    ly_append (ly_lambda_o (),
+    ly_list1 (ly_append (ly_func_o ("dashed-slur"),
+    gh_cons (gh_double2scm (thick), 
+    gh_cons (gh_double2scm (dash),
+    ly_list1 (ly_quote_scm (gh_list (sc[0], sc[1], sc[2], sc[3], SCM_UNDEFINED))))))));
 
   a.str_ = "dashed_slur";
   return a;
index c94fe3e8d9389112f87654ca5b0e68d4d218fb0c..e597ce1f3cec6c2489f744536f45c4a5868f8689 100644 (file)
@@ -243,7 +243,7 @@ output_header (Paper_outputter* p, Scope *head)
     id_str += ".";
   else
     id_str += String (", ") + lily_version_number_sz ();
-  output_def (p, "lily_id_string", id_str);
+  output_def (p, "LilyIdString", id_str);
   
   for (Dictionary_iter<Identifier*> i (*head); i.ok (); i++)
     {
@@ -251,7 +251,7 @@ output_header (Paper_outputter* p, Scope *head)
        continue;
       
       String val = *i.val()->access_content_String (false);
-      output_def (p, i.key (), val);
+      output_def (p, "mudela" + i.key (), val);
     }
 }
 
index bb7d6e3bfb8305e4cda9edbad140c27541e86cd4..0618479ff278246348401b86cceed50e99b514ab 100644 (file)
@@ -174,19 +174,16 @@ Paper_outputter::output_string (String str)
 void
 Paper_outputter::switch_to_font (String fontname)
 {
-  if (fontname.length_i () && (fontname != current_font_))
+  if (fontname.length_i () && fontname != current_font_)
     {
       current_font_ = fontname;
       int i=0;
-      bool new_b = false;
+
       for (; i< font_arr_.size (); i++)
        if (font_arr_[i] == fontname)
-         {
-           new_b = true;
            break;
-         }
 
-      if (new_b)
+      if (i == font_arr_.size ())
        {
          font_arr_.push (fontname);
          output_font_def (i, fontname);
diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc
new file mode 100644 (file)
index 0000000..46ccff0
--- /dev/null
@@ -0,0 +1,124 @@
+#include "simple-spacer.hh"
+#include "idealspacing.hh"
+// #include ""
+
+
+void
+Spring_info::set(Idealspacing *i)
+{
+  space_f_ = i->space_f_;
+  hooke_f_ = i->hooke_f_;
+}
+
+Spring_info::Spring_info()
+{
+  space_f_ = 0.0;
+  hooke_f_ = 1.0;
+  blocking_stretch_f_ = infinity_f;
+  blocking_rod_l_ = 0;
+}
+
+  
+
+void
+Simple_spring_spacer::init ()
+{
+  for (PCursor<Rod_info*> i(rods_.top()); i.ok (); i++)
+    {
+      Real hooke=0.0;
+      Real dist= i->distance_f_;
+
+      hooke =0.0;
+      
+      for (int j = i->cols_[LEFT]; j < i->cols_[RIGHT]; j++)
+       {
+         hooke += 1/springs_[j].hooke_f_;
+         dist -= springs_[j].space_f_;
+       }
+      
+      hooke = 1/hooke;
+
+      for (int j = i->cols_[LEFT]; j < i->cols_[RIGHT]; j++)
+       {
+         Real block_stretch = hooke * dist / (springs_[j].space_f_ *
+                                              springs_[j].hooke_f_ );
+
+         if (block_stretch < springs_[j].blocking_stretch_f_)
+           {
+             springs_[j].blocking_stretch_f_ = block_stretch;
+             springs_[j].blocking_rod_l_ = i.ptr ();
+           }
+       }
+    }
+}
+
+Array<Real>
+Simple_spring_spacer::solve ()
+{
+  Real start_force = 0.0;
+
+  for (int i=0; i< springs_.size (); i++)
+    {
+      start_force = start_force >?
+       springs_[i].blocking_stretch_f_ * springs_[i].hooke_f_;
+    }
+
+  Array<Real> stretch_factors;
+  Array<bool> blocked;
+  int blocked_count=0; 
+  Real current_len =0.0;
+  for (int i=0; i < springs_.size (); i++)
+    {
+      Real stretch = start_force / (springs_[i].hooke_f_ * springs_[i].space_f_);
+      stretch_factors.push (stretch);
+      current_len += (1  + stretch) * springs_[i].space_f_;
+      blocked.push(false);
+    }
+
+  while (blocked_count < blocked.size ())
+    {
+      Real      next_stretch = -1.0;
+      int block_index;
+      for (int i=0; i< stretch_factors.size (); i++)
+       {
+         if (!blocked[i])
+           {
+             next_stretch = next_stretch >? springs_[i].blocking_stretch_f_;
+
+             if (next_stretch < springs_[i].blocking_stretch_f_)
+               {
+                 next_stretch = springs_[i].blocking_stretch_f_;
+                 block_index = i;
+               }
+           }
+       }
+      current_len = 0.0;
+
+      Real force = next_stretch * (springs_[block_index].space_f_* springs_[block_index].hooke_f_);
+      for (int i=0; i< stretch_factors.size (); i++)
+       {
+         if (!blocked[i])
+           {
+             stretch_factors[i] = force / (springs_[i].space_f_ * springs_[i].hooke_f_);
+           }
+         current_len += (1.0 + stretch_factors[i]) * springs_[i].space_f_;
+       }
+
+      Rod_info *blockrod = springs_[block_index].blocking_rod_l_;
+      for (int j = blockrod->cols_ [LEFT]; j < blockrod->cols_ [RIGHT]; j++)
+       {
+         blocked[j] = true;
+         blocked_count ++;
+       }
+    }
+
+
+  Array<Real> distances;
+  for (int i=0; i < stretch_factors.size (); i++)
+    {
+      distances.push (stretch_factors[i] * springs_[i].space_f_);
+    }
+  return distances;
+}
+
index b10b0ba8bf8caca3bb6a687c3d6d995abc593866..65a7c1336d352478733c7d8d3002ffd0b4035201 100644 (file)
@@ -68,7 +68,7 @@ Spring_spacer::handle_loose_cols()
   Array<int> fixed;
   for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++)
     {
-      connected.connect (i->left_i_,i->right_i_);
+      connected.connect (i->cols_drul_[LEFT],i->cols_drul_[RIGHT]);
     }
   for (int i = 0; i < cols_.size(); i++)
     if (cols_[i].fixed_b())
@@ -240,8 +240,8 @@ Spring_spacer::make_matrices (Matrix &quad, Vector &lin, Real &c) const
 
   for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++)
     {
-      int l = i->left_i_;
-      int r = i->right_i_;
+      int l = i->cols_drul_[LEFT];
+      int r = i->cols_drul_[RIGHT];
 
       quad (r,r) += i->hooke_f_;
       quad (r,l) -= i->hooke_f_;
@@ -295,7 +295,7 @@ Spring_spacer::calculate_energy_f (Vector solution) const
   Real e = 0.0;
   for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok(); i++)
     {
-      e += i->energy_f(solution(i->right_i_) - solution(i->left_i_));
+      e += i->energy_f(solution(i->cols_drul_[RIGHT]) - solution(i->cols_drul_[LEFT]));
     }
 
   return e;
@@ -411,7 +411,7 @@ Spring_spacer::loosen_column (int i)
   Column_info c=cols_.get (i);
   for (PCursor<Idealspacing*> j (ideal_p_list_.top()); j.ok (); j++)
     {
-      if (j->left_i_ == i|| j->right_i_ == i)
+      if (j->cols_drul_[LEFT] == i|| j->cols_drul_[RIGHT] == i)
        j.del();
       else
        j++;
@@ -453,8 +453,8 @@ Spring_spacer::connect (int i, int j, Real d, Real h)
 
   Idealspacing * s = new Idealspacing;
 
-  s->left_i_ = i ;
-  s->right_i_ = j;
+  s->cols_drul_[LEFT] = i ;
+  s->cols_drul_[RIGHT] = j;
   s->space_f_ = d;
   s->hooke_f_ = h;
 
index 37bb31cff338a4ba3ad17fa2e3385144f39e5c02..f3db413e82fbece411ff2a7eca1a141c3fc223ee 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  staff-sym-reg.cc -- implement Staff_sym_engraver
+  staff-sym-reg.cc -- implement Staff_symbol_engraver
 
   source file of the GNU LilyPond music typesetter
 
 
 
 void
-Staff_sym_engraver::fill_staff_info (Staff_info&i)
+Staff_symbol_engraver::fill_staff_info (Staff_info&i)
 {
   i.staff_sym_l_ = span_p_;
 }
 
-Staff_sym_engraver::~Staff_sym_engraver()
+Staff_symbol_engraver::~Staff_symbol_engraver()
 {
   assert (!span_p_);
 }
 
-Staff_sym_engraver::Staff_sym_engraver()
+Staff_symbol_engraver::Staff_symbol_engraver()
 {
    span_p_ = 0;
 }
 
 void
-Staff_sym_engraver::do_creation_processing()
+Staff_symbol_engraver::do_creation_processing()
 {
   span_p_ = new Staff_symbol;
   span_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ());
@@ -37,7 +37,7 @@ Staff_sym_engraver::do_creation_processing()
 }
 
 void
-Staff_sym_engraver::do_removal_processing()
+Staff_symbol_engraver::do_removal_processing()
 {
   Scalar l (get_property ("nolines"));
   if (l.isnum_b ())
@@ -52,5 +52,5 @@ Staff_sym_engraver::do_removal_processing()
 
 
 
-IMPLEMENT_IS_TYPE_B1(Staff_sym_engraver,Engraver);
-ADD_THIS_TRANSLATOR(Staff_sym_engraver);
+IMPLEMENT_IS_TYPE_B1(Staff_symbol_engraver,Engraver);
+ADD_THIS_TRANSLATOR(Staff_symbol_engraver);
index 53c8104d9340f9350119efdef99726df1fa6b942..2bbc8bbddc35a8a9a2f768aba18d3d87a3d36c64 100644 (file)
        (kwregex (mapconcat (lambda (x) (concat "\\\\" x))  keywords "\\|")))
 
     (list 
-     (cons (concat ".\\(" kwregex "\\)[^a-zA-Z]") 1)
-     (cons (concat "^\\(" kwregex "\\)[^a-zA-Z]") 1)
-     '(".\\(\\\\[a-zA-Z][a-zA-Z]*\\)" 1 font-lock-variable-name-face)
-     '("^[\t ]*\\([a-zA-Z][_a-zA-Z]*\\) *=" 1 font-lock-variable-name-face)     
+      (concat ".\\(" kwregex "\\)[^a-zA-Z]")
+      (concat "^\\(" kwregex "\\)[^a-zA-Z]")
+      '(".\\(\\\\[a-zA-Z][a-zA-Z]*\\)" 1 font-lock-variable-name-face)
+      '("^[\t ]*\\([a-zA-Z][_a-zA-Z]*\\) *=" 1 font-lock-variable-name-face)     
     ))
   "Additional expressions to highlight in Mudela mode.")
 
            ( ?\_ . "." )       
            ( ?\' . "w")        
            ( ?\" . "\"" )
-           ( ?\% . "<")        
+           ( ?\% . "<")
            ( ?\n . ">")
 
 ; FIXME
 
   )    
 
-(defconst mu-stringlit-re
-   "\"\\([^\"\n\\]\\|\\\\.\\)*\""      ; double-quoted
-  "Regexp matching a Mudela string literal.")
-
-
 (defconst mu-blank-or-comment-re "[ \t]*\\($\\|%\\)"
   "Regexp matching blank or comment lines.")
 
   (make-local-variable 'paragraph-start)
   (make-local-variable 'require-final-newline)
   (make-local-variable 'comment-start)
-  (setq comment-start "% ")
-  (setq comment-end "")
+  (make-local-variable 'block-comment-start)
+  (make-local-variable 'block-comment-end)  
+
+  (setq comment-end "\n"
+       comment-start          "%"
+       comment-start-skip     "%{? *"
+       block-comment-start     "%{"
+       block-comment-end       "%}"    
+       )
   (make-local-variable 'comment-end)
   (make-local-variable 'comment-start-skip)
   (setf comment-start-skip "%{")
        paragraph-separate     "^[ \t]*$"
        paragraph-start        "^[ \t]*$"
        require-final-newline  t
-       comment-start          "% "
-       comment-start-skip     "% *"
        comment-column         40
        indent-line-function    'indent-relative-maybe
        )
   (use-local-map mu-mode-map)
 
   ;; run the mode hook. mu-mode-hook use is deprecated
-  (if mudela-mode-hook
-      (run-hooks 'mudela-mode-hook)
-    (run-hooks 'mu-mode-hook)))
+  (run-hooks 'mudela-mode-hook)
+)
+
 
 (defun mu-keep-region-active ()
   ;; do whatever is necessary to keep the region active in XEmacs.
index b5386d2818118c1272e9859a101d88987df9a087..862bc2031b004ad67fdc9948351868ef82311f31 100644 (file)
        thickbar
 } bind def
 
+/startbar
+{
+       thickbar
+} bind def
+
 /startrepeat
 {
        thickbar
diff --git a/scripts/mup-to-ly.py b/scripts/mup-to-ly.py
new file mode 100644 (file)
index 0000000..1a32f66
--- /dev/null
@@ -0,0 +1,158 @@
+#!/usr/bin/python
+#!@PYTHON@
+
+# mup-to-ly.py -- 
+# 
+# source file of the GNU LilyPond music typesetter
+# 
+# (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+
+name = 'mup-to-ly'
+version = '0.1'
+
+import os
+import sys
+
+import getopt
+from string import *
+import regex
+import regsub
+import time
+
+def program_id ():
+    return name + ' version ' + version;
+
+def identify ():
+    sys.stdout.write (program_id () + '\n')
+
+def help ():
+    sys.stdout.write ("Usage: %s [options] [files]\n"
+                      "Convert mup to ly\n\n"
+                      + "Options:\n"
+                      + "  -h, --help             print this help\n"
+                      % (program_name)
+                     )
+    sys.exit (0)
+
+identify ()
+(options, files) = getopt.getopt (
+    sys.argv[1:], 'hp:', ['help', 'package'])
+for opt in options:
+    o = opt[0]
+    a = opt[1]
+    if o== '--help' or o == '-h':
+       help ()
+    elif o == '-p' or o == '--package':
+       topdir = a
+    else:
+       print o
+       raise getopt.error
+
+def gulp_file (f):
+       sys.stderr.write ('[%s' % f)
+       try:
+               i = open (f)
+               i.seek (0, 2)
+               n = i.tell ()
+               i.seek (0,0)
+       except:
+               sys.stderr.write ('can\'t open file %s\n ' % f)
+               return ''
+       s = i.read (n)
+       sys.stderr.write (']')
+       if len (s) <= 0:
+               sys.stderr.write ('gulped empty file: %s\n'% f)
+       return s
+
+def line_to_ly (s):
+       notes = ""
+       o = 0
+       i = regex.search (";", s)
+       last_name = "c"
+       last_duration = "4"
+       while i >= 0:
+               note = s[o:o+i]
+               o = o + i
+               i = regex.search (";", s[o+1:])
+               if i >= 0 :
+                       o = o + 1
+               name = regsub.gsub ("[0-9<>\.&]*", "", note)
+               duration = regsub.gsub ("[a-z+<>#+&\-]*", "", note)
+               duration = regsub.gsub (" ", "", duration)
+               if name:
+                       last_name = name
+               else:
+                       name = last_name
+               if duration:
+                       last_duration = duration
+               else:
+                       duration = last_duration
+               name = regsub.sub ("#", "is", name)
+               name = regsub.sub ("+", "'", name)
+               name = regsub.sub ("-", ",", name)
+               name = regsub.sub ("ms", "s1", name)
+               notes = notes + " %s%s" % (name, duration)
+       return notes
+
+def get_voice (staff, s, staffs):
+       voice = len (staffs[staff-1]) + 1
+       tag = "^%d [0-9-]*%d[0-9-]*:" % (staff, voice)
+       notes = ""
+       o = 0
+       i = regex.search (tag, s)
+       while i >= 0:
+               o = o + i
+               n = regex.search ("$", s[o:])
+               line = s[o:o+n]
+               line = regsub.sub (tag, "", line)
+               line = line_to_ly (line)
+               notes = notes + line
+               i = regex.search (tag, s[o+n:])
+               if i >= 0:
+                       i = i + n
+       if notes != "":
+               sys.stderr.write ('%d ' % voice)
+               staffs[staff-1].append (notes)
+       return notes != ""
+
+def get_staff (s, staffs):
+       staff=len (staffs)
+       i=1
+       sys.stderr.write ('Staff %d ( ' % staff)
+       while i: 
+               i = get_voice (staff, s, staffs)
+               if not i:
+                       sys.stderr.write (')\n')
+                       staffs.append ([])
+                       staff = staff + 1
+                       sys.stderr.write ('Staff %d ( ' % staff)
+                       i = get_voice (staff, s, staffs)
+                       if not i:
+                               del staffs[staff-1]
+       return 0
+       
+staffs=[[]]
+mup=files[0]
+ly = os.path.basename (os.path.splitext (mup)[0]) + ".ly"
+s = gulp_file (mup)
+sys.stderr.write ('\n')
+i=1
+while i:
+       i=get_staff (s, staffs)
+sys.stderr.write ('\n')
+sys.stderr.write ('Ly output to: %s...' % ly)
+lyfile = open (ly, "w")
+for i in range (len (staffs)):
+       for v in range (len (staffs[i])):
+               lyfile.write ("$staff%d_voice_%d = \\notes {\n %s\n}\n\n" % (i+1, v+1, staffs[i][v]))
+lyfile.write ("\\score{\n")
+lyfile.write ("\\notes <\n")
+for i in range (len (staffs)):
+       lyfile.write ("\\type Staff=staff%s <\n" % chr(ord('A')+i))
+       for v in range (len (staffs[i])):
+               lyfile.write ("{ \\$staff%d_voice_%d } " % (i+1, v+1))
+       lyfile.write ("\n>\n")
+lyfile.write (">\n")
+lyfile.write ("\n}")
+lyfile.close ()
+sys.stderr.write ('\n')
index 3b175b5ad79d0f345d59894a72b151141cee9623..65bb377267ef58dad768d49daf9293a273434fc0 100644 (file)
@@ -5,8 +5,8 @@
 
 default: $(EXECUTABLE)
 
-$(EXECUTABLE): $(configheader) $(O_FILES) $(outdir)/version.hh $(MODULE_LIBES)
-       $(foreach a, $(MODULE_LIBS), $(MAKE) -C $a && ) true
+$(EXECUTABLE): $(configheader) $(O_FILES) $(outdir)/version.hh
+       $(foreach a, $(MODULE_LIBS), $(MAKE) -C $(a) && ) true
        $(LD_COMMAND) $(O_FILES) $(LOADLIBES)
 
 exe: $(EXECUTABLE)
@@ -30,5 +30,9 @@ uninstallexe:
        $(foreach a, $(SEXECUTABLES), rm -f $(bindir)/$(a) &&) true
 
 
-%/$(outdir)/library.a:
-       $(MAKE) -C $(dir $@)/.. default
+# Piss off.  Use MODULE_LIBS
+#
+# UGH. fucks up if $(outdir) not created.
+#
+#%/$(outdir)/library.a:
+#      $(MAKE) -C $(dir $@)/.. default
index 1c1209d3a544a3d8cb430db4ccaa04dbb94d0d62..203c64be65e085cce15b3fc7273f023564ce0edd 100644 (file)
@@ -1,5 +1,5 @@
 # empty
 LDFLAGS = $(ILDFLAGS) $(USER_LDFLAGS) $(EXTRA_LDFLAGS) $(MODULE_LDFLAGS) $($(PACKAGE)_LDFLAGS)
 
-MODULE_LIBES := $(addsuffix /$(outdir)/library.a, $(MODULE_LIBS)) $(MODULE_LIBES)
+MODULE_LIBES =$(addsuffix /$(outdir)/library.a, $(MODULE_LIBS))
 LOADLIBES = $(MODULE_LIBES) $($(PACKAGE)_LIBES) $(EXTRA_LIBES)
index 303bc8f0df3378a8a1fede219315cec1893aea94..4fac9bc0a0a6f5047a6b90b3a8940d3838389a7b 100644 (file)
@@ -18,6 +18,7 @@ deb:
        )'
 
 makeflags=$(patsubst %==, %, $(patsubst %----,%,$(MAKEFLAGS:%=--%)))
+# makeflags=$(patsubst %==, %, $(patsubst ----%,%,$($(MAKEFLAGS:%=--%):--unix=)))
 
 diff:
        $(PYTHON) $(step-bindir)/package-diff.py --package=$(topdir) $(makeflags)
index 4312a117a8fb2beda1d4d27d5e21c52a579faefb..7b5fbabcc88d48208f1cbfcbfdebe017bc971572 100644 (file)
 %compatibility
 %urg
 \fetdef\repeatcolon{20}
-\def\repeatbar{\repeatstopbar}
-\def\startrepeat{\repeatstartbar}
-\def\repeatbarstartrepeat{\repeatstopstart}
+\def\repeatbar#1{\repeatstopbar}
+\def\startrepeat#1{\repeatstartbar}
+\def\repeatbarstartrepeat#1{\repeatstopstart}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % parametric symbols