From 4a5e6e41e8d3f16283f20d37e0420812bf33af71 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 21:29:04 +0000 Subject: [PATCH] lilypond-1.1.4 --- TODO | 4 +- init/engraver.ly | 12 +- init/lily.scm | 26 ++-- input/test/GNUmakefile | 2 +- input/test/stars-and-stripes.ly | 108 +++++++++++++++ lily/command-request.cc | 2 +- lily/idealspacing.cc | 5 +- lily/include/idealspacing.hh | 4 +- lily/include/key-item.hh | 6 - lily/include/simple-spacer.hh | 48 +++++++ lily/include/staff-sym-engraver.hh | 10 +- lily/key-engraver.cc | 25 +++- lily/key-item.cc | 39 ------ lily/lookup.cc | 13 +- lily/paper-def.cc | 4 +- lily/paper-outputter.cc | 9 +- lily/simple-spacer.cc | 124 +++++++++++++++++ lily/spring-spacer.cc | 14 +- lily/staff-sym-engraver.cc | 16 +-- mudela-mode.el | 34 ++--- ps/lilyponddefs.ps | 5 + scripts/mup-to-ly.py | 158 ++++++++++++++++++++++ stepmake/stepmake/executable-targets.make | 12 +- stepmake/stepmake/executable-vars.make | 2 +- stepmake/stepmake/package.make | 1 + tex/lilyponddefs.tex | 6 +- 26 files changed, 551 insertions(+), 138 deletions(-) create mode 100644 input/test/stars-and-stripes.ly create mode 100644 lily/include/simple-spacer.hh create mode 100644 lily/simple-spacer.cc create mode 100644 scripts/mup-to-ly.py diff --git a/TODO b/TODO index ffd01a2797..a94bbad6d9 100644 --- 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 diff --git a/init/engraver.ly b/init/engraver.ly index 47fb08f7fd..aa3a5382be 100644 --- a/init/engraver.ly +++ b/init/engraver.ly @@ -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"; diff --git a/init/lily.scm b/init/lily.scm index 9c38a76bfa..8cd3f0eabe 100644 --- a/init/lily.scm +++ b/init/lily.scm @@ -177,13 +177,12 @@ (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 @@ -379,15 +378,18 @@ (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) @@ -417,15 +419,5 @@ (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") diff --git a/input/test/GNUmakefile b/input/test/GNUmakefile index 74fec0e68d..5af2ecfc95 100644 --- a/input/test/GNUmakefile +++ b/input/test/GNUmakefile @@ -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 index 0000000000..289fc5acdd --- /dev/null +++ b/input/test/stars-and-stripes.ly @@ -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 + } + } +} diff --git a/lily/command-request.cc b/lily/command-request.cc index 9255f63cfb..cddf6c89fd 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -106,7 +106,7 @@ bool Barcheck_req::do_equal_b (Request*r) const { Barcheck_req *b = dynamic_cast (r); - return r; + return b; } diff --git a/lily/idealspacing.cc b/lily/idealspacing.cc index f2638e0603..3966c6ad44 100644 --- a/lily/idealspacing.cc +++ b/lily/idealspacing.cc @@ -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 diff --git a/lily/include/idealspacing.hh b/lily/include/idealspacing.hh index 20ff60fee5..2b2b72aab8 100644 --- a/lily/include/idealspacing.hh +++ b/lily/include/idealspacing.hh @@ -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 cols_drul_; Real energy_f (Real x) const; void print() const; diff --git a/lily/include/key-item.hh b/lily/include/key-item.hh index f8e3747b58..e259c145e7 100644 --- a/lily/include/key-item.hh +++ b/lily/include/key-item.hh @@ -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 const &idx_arr, - Array 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 index 0000000000..1f6fc479c0 --- /dev/null +++ b/lily/include/simple-spacer.hh @@ -0,0 +1,48 @@ +/* + simple-spacer.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ + +#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 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 springs_; + Pointer_list rods_; + + void init (); + Array solve (); + +}; + +#endif /* SIMPLE_SPACER_HH */ + diff --git a/lily/include/staff-sym-engraver.hh b/lily/include/staff-sym-engraver.hh index 0cc98d6283..8235f2aa03 100644 --- a/lily/include/staff-sym-engraver.hh +++ b/lily/include/staff-sym-engraver.hh @@ -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 @@ -15,14 +15,14 @@ /** 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(); diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index e2152e2245..8925a26d08 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -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) diff --git a/lily/key-item.cc b/lily/key-item.cc index 7d519d3b97..0c2476b317 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -26,32 +26,6 @@ Key_item::Key_item () set_c_position (0); } -void -Key_item::set (bool multi_octave_b, - Array const &idx_arr, - Array 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 diff --git a/lily/lookup.cc b/lily/lookup.cc index acb4a7e84b..300439b3dd 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -178,13 +178,12 @@ Lookup::dashed_slur (Array 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; diff --git a/lily/paper-def.cc b/lily/paper-def.cc index c94fe3e8d9..e597ce1f3c 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -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 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); } } diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index bb7d6e3bfb..0618479ff2 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -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 index 0000000000..46ccff03d8 --- /dev/null +++ b/lily/simple-spacer.cc @@ -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 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 +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 stretch_factors; + Array 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 distances; + for (int i=0; i < stretch_factors.size (); i++) + { + distances.push (stretch_factors[i] * springs_[i].space_f_); + } + return distances; +} + diff --git a/lily/spring-spacer.cc b/lily/spring-spacer.cc index b10b0ba8bf..65a7c1336d 100644 --- a/lily/spring-spacer.cc +++ b/lily/spring-spacer.cc @@ -68,7 +68,7 @@ Spring_spacer::handle_loose_cols() Array fixed; for (PCursor 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 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 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 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; diff --git a/lily/staff-sym-engraver.cc b/lily/staff-sym-engraver.cc index 37bb31cff3..f3db413e82 100644 --- a/lily/staff-sym-engraver.cc +++ b/lily/staff-sym-engraver.cc @@ -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 @@ -13,23 +13,23 @@ 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); diff --git a/mudela-mode.el b/mudela-mode.el index 53c8104d93..2bbc8bbddc 100644 --- a/mudela-mode.el +++ b/mudela-mode.el @@ -44,10 +44,10 @@ (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.") @@ -108,7 +108,7 @@ ( ?\_ . "." ) ( ?\' . "w") ( ?\" . "\"" ) - ( ?\% . "<") + ( ?\% . "<") ( ?\n . ">") ; FIXME @@ -118,11 +118,6 @@ ) -(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.") @@ -151,8 +146,15 @@ (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 "%{") @@ -170,17 +172,15 @@ 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. diff --git a/ps/lilyponddefs.ps b/ps/lilyponddefs.ps index b5386d2818..862bc2031b 100644 --- a/ps/lilyponddefs.ps +++ b/ps/lilyponddefs.ps @@ -126,6 +126,11 @@ 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 index 0000000000..1a32f66882 --- /dev/null +++ b/scripts/mup-to-ly.py @@ -0,0 +1,158 @@ +#!/usr/bin/python +#!@PYTHON@ + +# mup-to-ly.py -- +# +# source file of the GNU LilyPond music typesetter +# +# (c) 1998 Jan Nieuwenhuizen + +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') diff --git a/stepmake/stepmake/executable-targets.make b/stepmake/stepmake/executable-targets.make index 3b175b5ad7..65bb377267 100644 --- a/stepmake/stepmake/executable-targets.make +++ b/stepmake/stepmake/executable-targets.make @@ -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 diff --git a/stepmake/stepmake/executable-vars.make b/stepmake/stepmake/executable-vars.make index 1c1209d3a5..203c64be65 100644 --- a/stepmake/stepmake/executable-vars.make +++ b/stepmake/stepmake/executable-vars.make @@ -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) diff --git a/stepmake/stepmake/package.make b/stepmake/stepmake/package.make index 303bc8f0df..4fac9bc0a0 100644 --- a/stepmake/stepmake/package.make +++ b/stepmake/stepmake/package.make @@ -18,6 +18,7 @@ deb: )' makeflags=$(patsubst %==, %, $(patsubst %----,%,$(MAKEFLAGS:%=--%))) +# makeflags=$(patsubst %==, %, $(patsubst ----%,%,$($(MAKEFLAGS:%=--%):--unix=))) diff: $(PYTHON) $(step-bindir)/package-diff.py --package=$(topdir) $(makeflags) diff --git a/tex/lilyponddefs.tex b/tex/lilyponddefs.tex index 4312a117a8..7b5fbabcc8 100644 --- a/tex/lilyponddefs.tex +++ b/tex/lilyponddefs.tex @@ -166,9 +166,9 @@ %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 -- 2.39.5