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
\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";
\name RhythmicStaff;
\consists "Bar_engraver";
\consists "Time_signature_engraver";
- \consists "Staff_sym_engraver";
+ \consists "Staff_symbol_engraver";
\accepts "Voice";
};
\translator{\RhythmicStaffContext}
};
\translator {\VoiceContext}
-\translator {
+
+GrandStaffContext=\translator{
\type "Line_group_engraver_group";
\name GrandStaff;
\consists "Span_bar_engraver";
minVerticalAlign = 1.5*\staffheight;
\accepts "Staff";
-}
+};
+\translator{\GrandStaffContext}
\translator {
\type "Line_group_engraver_group";
\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";
(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")
# 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
--- /dev/null
+%{
+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
+ }
+ }
+}
Barcheck_req::do_equal_b (Request*r) const
{
Barcheck_req *b = dynamic_cast<Barcheck_req*> (r);
- return r;
+ return b;
}
#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
}
{
space_f_ = 0.0;
hooke_f_ = 0.0;
- left_i_ = -1;
- right_i_ = -1;
+ cols_drul_[LEFT] = cols_drul_[RIGHT] = -1;
}
void
#ifndef IDEALSPACING_HH
#define IDEALSPACING_HH
#include "lily-proto.hh"
+#include "drul-array.hh"
/// ideal spacing between two columns
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;
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;
--- /dev/null
+/*
+ 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 */
+
/*
- 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();
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)
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)
{
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)
{
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
}
// (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;
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++)
{
continue;
String val = *i.val()->access_content_String (false);
- output_def (p, i.key (), val);
+ output_def (p, "mudela" + i.key (), val);
}
}
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);
--- /dev/null
+#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;
+}
+
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())
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_;
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;
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++;
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;
/*
- 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 ());
}
void
-Staff_sym_engraver::do_removal_processing()
+Staff_symbol_engraver::do_removal_processing()
{
Scalar l (get_property ("nolines"));
if (l.isnum_b ())
-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);
(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.
thickbar
} bind def
+/startbar
+{
+ thickbar
+} bind def
+
/startrepeat
{
thickbar
--- /dev/null
+#!/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')
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)
$(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
# 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)
)'
makeflags=$(patsubst %==, %, $(patsubst %----,%,$(MAKEFLAGS:%=--%)))
+# makeflags=$(patsubst %==, %, $(patsubst ----%,%,$($(MAKEFLAGS:%=--%):--unix=)))
diff:
$(PYTHON) $(step-bindir)/package-diff.py --package=$(topdir) $(makeflags)
%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