include $(depth)/make/stepmake.make
-default: do-doc
+default: local-doc
local-WWW: copy-for-me
include $(depth)/make/stepmake.make
-default: do-doc
+default: local-doc
local-WWW: $(addprefix $(outdir)/, $(addsuffix .txt, $(TEXTS)))
include $(depth)/make/stepmake.make
-default: do-doc dist-plain
+default: local-doc dist-plain
$(outdir)/%.texi: %.texi
m4 -DTOPLEVEL_VERSION=$(TOPLEVEL_VERSION) < $< > $@
@unnumberedsubsec Hackers
-
There are lots of possibilities of improving the program itself. There are
both small projects and big ones. Most of them are listed in the TODO
file. A interesting and very big project is writing a GUI frontend to
LilyPond.
+@unnumberedsubsec Website designers
+
+The current website for LilyPond is neat and simple, but it is not very
+pretty. We would like to have a website with pretty pictures, one that
+looks appealing to new users.
+
@chapter LilyPond internals
make website
@end example
-This does require a fully functioning
+This does require a functioning LilyPond. The binary doesn't have to
+be installed.
If you want to auto-generate Lily's website, you'll need some additional
conversion tools.
@section Comments
LilyPond is a long way from finished and polished. We do appreciate
-criticism, comments, bugreports, patches, etc.
+criticism, comments, bugreports, patches, etc., but please,
@example
Please send your e-mail to one of the MAILING LISTS
@top
-@unnumbered LilyPond -- The @uref{http://www.fsf.org/gnu/gnu-history.html,GNU Project} Music Typesetter
+@unnumbered LilyPond -- The GNU Project Music Typesetter
@html
the GNU Project.
-@c @center
+
+@unnumberedsec Sheet music
+
+
+
@quotation
@mudela[fragment]
\relative c'' { \key es; r8 [c16 b] [c8 g] [as c16 b] [c8 d] | g,4 }
@end mudela
@end quotation
-@c @end center
-
-
-@unnumberedsec Sheet music
-
@itemize @bullet
import time
class My_options:
- def __init__(self):
- self.commentify = None
- self.add_hdr_def = 0
- self.classname = ''
+ def __init__(self):
+ self.commentify = None
+ self.add_hdr_def = 0
+ self.classname = ''
my_options = My_options()
def name():
- return os.environ['USERNAME']
+ return os.environ['USERNAME']
# field 4 of passwd is also used for finger info (phone no., office etc)
# return pwd.getpwuid(os.getuid())[4]
def c_commentify(str):
- return '/* ' + re.sub('^',' ', str) + '\n */';
+ return '/* ' + re.sub('^',' ', str) + '\n */';
def sh_commentify(str):
- return re.sub('^', '# ', str)
+ return re.sub('^', '# ', str)
def tex_commentify(str):
- return re.sub('^', '% ', str)
+ return re.sub('^', '% ', str)
def project_str():
- cwd = os.getcwd()
- if re.search('flower', cwd):
- PROJECT = "the Flower Library"
- elif re.search('mf$', cwd):
- PROJECT = "the Feta (defintively not an abbreviation for Font-En-Tja) music font"
- else:
- PROJECT = "the GNU LilyPond music typesetter"
- return PROJECT
+ cwd = os.getcwd()
+ if re.search('flower', cwd):
+ PROJECT = "the Flower Library"
+ elif re.search('mf$', cwd):
+ PROJECT = "the Feta (defintively not an abbreviation for Font-En-Tja) music font"
+ else:
+ PROJECT = "the GNU LilyPond music typesetter"
+ return PROJECT
def head_str(filename):
- if my_options.add_hdr_def:
- what = "declare "
- else:
- what=" implement "
-
-
- mailaddres = ''
- try:
- mailaddres = '<%s>' % os.environ['MAILADDRESS']
- except KeyError:
- pass
- headstr = '\n%s -- %s\n\nsource file of %s\n\n(c) %d %s %s\n' \
- %(filename, what, project_str(),
- time.localtime (time.time ())[0], name(), mailaddres)
- return headstr
+ if my_options.add_hdr_def:
+ what = "declare "
+ else:
+ what=" implement "
+
+
+ mailaddres = ''
+ try:
+ mailaddres = '<%s>' % os.environ['MAILADDRESS']
+ except KeyError:
+ pass
+ headstr = '\n%s -- %s\n\nsource file of %s\n\n(c) %d %s %s\n' \
+ %(filename, what, project_str(),
+ time.localtime (time.time ())[0], name(), mailaddres)
+ return headstr
def c_include(filename):
- startdef= filename;
- trans = string.maketrans( string.lowercase + '-.', string.uppercase + '__')
- startdef = string.translate(filename, trans)
+ startdef= filename;
+ trans = string.maketrans( string.lowercase + '-.', string.uppercase + '__')
+ startdef = string.translate(filename, trans)
+
+
+ headstr = "\n\n#ifndef %s\n#define %s\n" % (startdef, startdef)
+ terminatestr = "#endif /* %s */\n" % (startdef);
+
+ return headstr+ '\n\n'+ terminatestr;
+
+
+def icc_include (filename):
+ startdef= filename;
+ trans = string.maketrans( string.lowercase + '-.', string.uppercase + '__')
+ startdef = string.translate(filename, trans)
- headstr = "\n\n#ifndef %s\n#define %s\n" % (startdef, startdef)
- terminatestr = "#endif /* %s */\n" % (startdef);
+ headstr = "\n\n#ifndef %s\n#define %s\n" % (startdef, startdef)
+ headstr = headstr + r"""
+#ifndef INLINE
+#define INLINE inline
+#define LOCAL_INLINE_DEF
+#endif
+"""
+ terminatestr = "#endif /* %s */\n" % (startdef);
+
+ terminatestr = r"""
+#ifdef LOCAL_INLINE_DEF
+#undef LOCAL_INLINE_DEF
+#undef INLINE
+#endif
+""" + terminatestr
+ return headstr+ '\n\n'+ terminatestr;
- return headstr+ '\n\n'+ terminatestr;
def help ():
- sys.stdout.write ("Usage: genheader [options] FILENAME\n"
- + "Generate file with header FILENAME\n\n"
- + "Options:\n"
- + " -h, --header generate header\n"
- + " --help print this help\n"
- + " -p, --package=DIR specify package\n"
- )
-
- sys.exit (0)
+ sys.stdout.write ("Usage: genheader [options] FILENAME\n"
+ + "Generate file with header FILENAME\n\n"
+ + "Options:\n"
+ + " -h, --header generate header\n"
+ + " --help print this help\n"
+ + " -p, --package=DIR specify package\n"
+ )
+
+ sys.exit (0)
(options, files) = getopt.getopt(sys.argv[1:], 'tcshp:', ['class', 'package=', 'help'])
for opt in options:
- o = opt[0]
- a = opt[1]
- if o == '-c':
- my_options.commentify = c_commentify
- elif o == '-t':
- my_options.commentify = tex_commentify
- elif o == '-s':
- my_options.commentify = sh_commentify
- elif o == '-h' or o == '--header':
- my_options.add_hdr_def = 1
- elif o == '--class':
- my_options.classname = a
- elif o == '--help':
- help ()
+ o = opt[0]
+ a = opt[1]
+ if o == '-c':
+ my_options.commentify = c_commentify
+ elif o == '-t':
+ my_options.commentify = tex_commentify
+ elif o == '-s':
+ my_options.commentify = sh_commentify
+ elif o == '-h' or o == '--header':
+ my_options.add_hdr_def = 1
+ elif o == '--class':
+ my_options.classname = a
+ elif o == '--help':
+ help ()
# FIXME: should create xxx.cc and include/xxx.hh, with implement/declare Xxx
# in one run
if my_options.classname:
- pass
-
+ pass
+
def do_file(nm):
- s = my_options.commentify(head_str(nm))
- if my_options.add_hdr_def:
- s = s + c_include(nm)
- return s
+ s = my_options.commentify(head_str(nm))
+ if my_options.add_hdr_def:
+ s = s + c_include(nm)
+ return s
def extension(ext,nm):
- ext = '\\.' + ext
- return re.search(ext, nm) <> None
+ ext = '\\.' + ext
+ return re.search(ext, nm) <> None
def c_extension(nm):
- return extension('hh',nm) or extension('cc',nm) \
- or extension('icc', nm) or extension('tcc',nm)
+ return extension('hh',nm) or extension('cc',nm) \
+ or extension('icc', nm) or extension('tcc',nm)
def select_commentification(nm):
- if c_extension (nm):
- return c_commentify
- elif extension('py',nm) or extension('pl',nm) or extension('sh',nm):
- return sh_commentify
- elif extension('mf',nm) or extension('tex',nm) or extension('ly',nm):
- return tex_commentify
- else:
- sys.stderr.write ('unknown extension for file %s\n' % nm)
- raise 'help'
+ if c_extension (nm):
+ return c_commentify
+ elif extension('py',nm) or extension('pl',nm) or extension('sh',nm):
+ return sh_commentify
+ elif extension('mf',nm) or extension('tex',nm) or extension('ly',nm):
+ return tex_commentify
+ else:
+ sys.stderr.write ('unknown extension for file %s\n' % nm)
+ raise 'help'
for nm in files:
- if extension('hh', nm) or extension('icc', nm) or extension('tcc', nm):
- my_options.add_hdr_def = 1
- if my_options.commentify == None:
- my_options.commentify = select_commentification(nm)
- print do_file(nm)
+ if extension('hh', nm) or extension('icc', nm) or extension('tcc', nm):
+ my_options.add_hdr_def = 1
+ if my_options.commentify == None:
+ my_options.commentify = select_commentification(nm)
+ print do_file(nm)
ostream &
operator << (ostream &, Rational);
+const Rational infinity_rat = INT_MAX;
+
#endif // RATIONAL_HH
#include "string.hh"
#include "real.hh"
+#include "protected-scm.hh"
#error
/// Perl -like scalar type.
if (c == '{' && c == '}') // brace open is for not confusing dumb tools.
here_input ().warning (
"Brace found at end of lyric. Did you forget a space?");
- yylval.scm = ly_ch_C_to_scm (YYText());
+ yylval.scm = ly_ch_C_to_scm (s.ch_C ());
DEBUG_OUT << "lyric : `" << s << "'\n";
return STRING;
#endif
#include "proto.hh"
-#include "moment.hh"
+#include "rational.hh"
#include "midi2ly-proto.hh"
struct Midi_parser_info
Byte const* end_byte_L_;
Source_file* source_l_;
Mudela_score* score_l_;
- Moment bar_mom_;
+ Rational bar_mom_;
};
#include "string.hh"
#include "proto.hh"
#include "cons.hh"
-#include "moment.hh"
+#include "rational.hh"
#include "midi2ly-proto.hh"
#include "midi-parser.hh"
Midi_track_parser (Midi_parser_info* info_l, int i);
~Midi_track_parser ();
- Moment at_mom ();
+ Rational at_mom ();
Mudela_staff* parse (Mudela_column* col_l);
private:
Mudela_item* parse_event (Mudela_column* col_l);
void parse_header ();
- Moment at_mom_;
+ Rational at_mom_;
Byte running_byte_;
Cons_list<Mudela_note> open_note_l_list_;
Mudela_staff* mudela_staff_p_;
#include "proto.hh"
#include "midi2ly-proto.hh"
-#include "moment.hh"
+#include "rational.hh"
#include "cons.hh"
/// (mudela_column)
class Mudela_column
{
public:
- Mudela_column (Mudela_score* mudela_score_l, Moment mom);
+ Mudela_column (Mudela_score* mudela_score_l, Rational mom);
void add_item (Mudela_item* mudela_item_l);
- Moment at_mom ();
+ Rational at_mom ();
Cons_list<Mudela_item> mudela_item_l_list_;
- Moment at_mom_;
+ Rational at_mom_;
Mudela_score* mudela_score_l_;
};
#include "midi2ly-proto.hh"
#include "string.hh"
-#include "moment.hh"
+#include "rational.hh"
#include "duration.hh"
// should these:
Mudela_item (Mudela_column* mudela_column_l);
virtual ~Mudela_item ();
- virtual Moment at_mom ();
- virtual Moment duration_mom ();
+ virtual Rational at_mom ();
+ virtual Rational duration_mom ();
void output (Mudela_stream& mudela_stream_r);
virtual String str () = 0;
int den_i ();
int num_i ();
virtual String str ();
- Moment bar_mom ();
+ Rational bar_mom ();
private:
Real sync_f_;
Mudela_note (Mudela_column* mudela_column_l, int channel_i, int pitch_i, int dyn_i);
Duration duration ();
- virtual Moment duration_mom ();
+ virtual Rational duration_mom ();
virtual String str ();
// int const c0_pitch_i_c_ = 60; // huh?
class Mudela_skip : public Mudela_item
{
public:
- Mudela_skip (Mudela_column* mudela_column_l, Moment skip_mom);
+ Mudela_skip (Mudela_column* mudela_column_l, Rational skip_mom);
Duration duration ();
- virtual Moment duration_mom ();
+ virtual Rational duration_mom ();
virtual String str ();
private:
- Moment mom_;
+ Rational mom_;
};
public:
Mudela_tempo (int useconds_per_4_i);
- int get_tempo_i (Moment moment);
+ int get_tempo_i (Rational rational);
virtual String str ();
int useconds_per_4_i ();
private:
int useconds_per_4_i_;
- Moment seconds_per_1_mom_;
+ Rational seconds_per_1_mom_;
};
class Mudela_text : public Mudela_item
void add_item (Mudela_item* mudela_item_p);
void add_staff (Mudela_staff* mudela_staff_p);
- Mudela_column* find_column_l (Moment mom);
- Mudela_column* get_column_l (Moment mom);
+ Mudela_column* find_column_l (Rational mom);
+ Mudela_column* get_column_l (Rational mom);
void output (String filename_str);
void process ();
int number_i_;
private:
- void output_mudela_begin_bar (Mudela_stream& mudela_stream_r, Moment now_mom, int bar_i);
+ void output_mudela_begin_bar (Mudela_stream& mudela_stream_r, Rational now_mom, int bar_i);
Cons_list<Mudela_voice> mudela_voice_p_list_;
Cons_list<Mudela_item> mudela_item_p_list_;
#include "midi2ly-proto.hh"
#include "string.hh"
-#include "scalar.hh"
+//#include "scalar.hh"
/// Lily output
class Mudela_stream {
Mudela_stream (String filename_str);
~Mudela_stream();
- Mudela_stream& operator << (Scalar s);
+ Mudela_stream& operator << (char c);
+ Mudela_stream& operator << (String s);
Mudela_stream& operator << (Mudela_item& mudela_item_r);
private:
(c) 1997--1998 Jan Nieuwenhuizen <janneke@gnu.org>
*/
-#include "moment.hh"
+#include "rational.hh"
#include "source-file.hh"
#include "source.hh"
#include "midi2ly-global.hh"
Midi_score_parser::find_earliest_i (Link_array<Midi_track_parser>& tracks)
{
int earliest_i = 0;
- Moment earliest_mom = infinity_mom;
+ Rational earliest_mom = infinity_rat;
for (int i = 0; i < tracks.size(); i++)
{
if ( tracks [i]->at_mom () < earliest_mom )
{
int current_bar_i = 0;
Mudela_time_signature m4 (4, 2, 24, 8);
- Moment bar4_mom = m4.bar_mom ();
+ Rational bar4_mom = m4.bar_mom ();
Mudela_score* score_p = new Mudela_score( 1, 1, 1 );
info_l_->score_l_ = score_p;
while (tracks.size ())
{
int i = find_earliest_i (tracks);
- Moment at_mom = tracks [i]->at_mom ();
+ Rational at_mom = tracks [i]->at_mom ();
Mudela_column* column_l = score_p->get_column_l (at_mom);
Mudela_staff* staff_p = tracks [i]->parse (column_l);
if ( staff_p )
delete track_info_p_;
}
-Moment
+Rational
Midi_track_parser::at_mom ()
{
return at_mom_;
Mudela_staff*
Midi_track_parser::parse (Mudela_column* col_l)
{
- Moment mom = at_mom ();
+ Rational mom = at_mom ();
while (!eot () && (mom == at_mom ()))
{
Mudela_item* p = parse_event (col_l);
if (eot ())
return;
int delta_i = get_var_i ();
- at_mom_ += Moment (delta_i, info_l_->division_1_i_);
+ at_mom_ += Rational (delta_i, info_l_->division_1_i_);
}
Mudela_item*
#include "mudela-column.hh"
-Mudela_column::Mudela_column (Mudela_score* mudela_score_l, Moment mom)
+Mudela_column::Mudela_column (Mudela_score* mudela_score_l, Rational mom)
{
mudela_score_l_ = mudela_score_l;
at_mom_ = mom;
mudela_item_l_list_.append (new Cons<Mudela_item> (mudela_item_l, 0));
}
-Moment
+Rational
Mudela_column::at_mom()
{
return at_mom_;
{
}
-Moment
+Rational
Mudela_item::at_mom ()
{
return mudela_column_l_->at_mom ();
}
-Moment
+Rational
Mudela_item::duration_mom ()
{
- return Moment (0);
+ return Rational (0);
}
void
clocks_1_i_ = clocks_4_i * 4;
}
-Moment
+Rational
Mudela_time_signature::bar_mom ()
{
Duration d;
d.durlog_i_ = den_i_;
- return Moment (num_i_) * Duration_convert::dur2_mom (d);
+ return Rational (num_i_) * Duration_convert::dur2_mom (d);
}
int
Mudela_note::duration ()
{
assert (end_column_l_);
- Moment mom = end_column_l_->at_mom () - at_mom ();
+ Rational mom = end_column_l_->at_mom () - at_mom ();
return Duration_convert::mom2_dur (mom);
}
-Moment
+Rational
Mudela_note::duration_mom ()
{
assert (end_column_l_);
return str + " ";
}
-Mudela_skip::Mudela_skip (Mudela_column* mudela_column_l, Moment skip_mom)
+Mudela_skip::Mudela_skip (Mudela_column* mudela_column_l, Rational skip_mom)
: Mudela_item (mudela_column_l)
{
mom_ = skip_mom;
return Duration_convert::mom2_dur (mom_);
}
-Moment
+Rational
Mudela_skip::duration_mom ()
{
return Duration_convert::dur2_mom (duration ());
: Mudela_item (0)
{
useconds_per_4_i_ = useconds_per_4_i;
- seconds_per_1_mom_ = Moment(useconds_per_4_i_ *4, 1e6);
+ seconds_per_1_mom_ = Rational(useconds_per_4_i_ *4, 1e6);
}
String
Mudela_tempo::str ()
{
String str = "\\tempo 4=";
- str += to_str (get_tempo_i (Moment (1, 4)));
+ str += to_str (get_tempo_i (Rational (1, 4)));
str += ";\n";
return str;
}
}
int
-Mudela_tempo::get_tempo_i (Moment moment)
+Mudela_tempo::get_tempo_i (Rational rational)
{
- Moment m1 = Moment (60) / moment;
- Moment m2 = seconds_per_1_mom_;
+ Rational m1 = Rational (60) / rational;
+ Rational m2 = seconds_per_1_mom_;
return m1 / m2;
}
// copyright 1997 Jan Nieuwenhuizen <janneke@gnu.org>
#include <assert.h>
-#include "moment.hh"
+#include "rational.hh"
#include "duration.hh"
#include "duration-convert.hh"
#include "midi2ly-global.hh"
format_i_ = format_i;
tracks_i_ = tracks_i;
tempo_i_ = tempo_i;
- column_l_array_.push (new Mudela_column (this, Moment (0)));
+ column_l_array_.push (new Mudela_column (this, Rational (0)));
// mudela_key_l_ = &key_c;
mudela_key_l_ = 0;
mudela_time_signature_l_ = &time_sig_4;
}
Mudela_column*
-Mudela_score::find_column_l (Moment mom)
+Mudela_score::find_column_l (Rational mom)
{
int upper_i = max (0, column_l_array_.size () - 1);
int lower_i = 0;
int i = 0; //upper_i;
while (1)
{
- Moment i_mom = column_l_array_ [i]->at_mom ();
+ Rational i_mom = column_l_array_ [i]->at_mom ();
if (i_mom == mom)
return column_l_array_ [i];
if (mom < i_mom)
}
Mudela_column*
-Mudela_score::get_column_l (Moment mom)
+Mudela_score::get_column_l (Rational mom)
{
int i;
Mudela_column *c=0;
&& (i->car_ == mudela_staff_p_list_.head_->car_))
continue;
mudela_stream << "\\context Staff = \"" << i->car_->id_str () << "\" ";
- mudela_stream << String ("\\" + i->car_->id_str ()) << "\n";
+ mudela_stream << String ("\\" + i->car_->id_str ()) << '\n';
}
if (mudela_staff_p_list_.size_i () > 1)
mudela_stream << ">\n";
LOGOUT (NORMAL_ver) << '\n' << _ ("Quantifying columns...") << endl;
int current_bar_i = 0;
- Moment bar_mom = mudela_time_signature_l_->bar_mom ();
+ Rational bar_mom = mudela_time_signature_l_->bar_mom ();
int n = 5 >? Duration_convert::no_smaller_than_i_s;
n = Duration_convert::type2_i (n);
- Moment s = Moment (1, n);
+ Rational s = Rational (1, n);
for (int i = 0; i < column_l_array_.size (); i++)
{
column_l_array_ [i]->at_mom_ =
- s * Moment ( (int) ( (column_l_array_ [i]->at_mom ()) / s));
+ s * Rational ( (int) ( (column_l_array_ [i]->at_mom ()) / s));
int bar_i = (int) (column_l_array_ [i]->at_mom () / bar_mom) + 1;
if (bar_i > current_bar_i)
int start_i = 0;
int end_i = 0;
- Moment start_mom = 0;
+ Rational start_mom = 0;
Duration smallest_dur;
smallest_dur.durlog_i_ = 6;
- Moment const noise_mom = Duration_convert::dur2_mom (smallest_dur)
- / Moment (2);
+ Rational const noise_mom = Duration_convert::dur2_mom (smallest_dur)
+ / Rational (2);
for (int i = 0; i < n; i++)
{
if (!start_i)
#include <assert.h>
#include <ctype.h>
-#include "moment.hh"
+#include "rational.hh"
#include "duration-convert.hh"
#include "string-convert.hh"
#include "midi2ly-proto.hh"
Mudela_voice* voice_p = new Mudela_voice (this);
mudela_voice_p_list_.append (new Killing_cons<Mudela_voice> (voice_p, 0));
- // Moment mom = items.top ()->at_mom ();
- Moment mom = 0;
+ // Rational mom = items.top ()->at_mom ();
+ Rational mom = 0;
for (Cons<Mudela_item>** pp = &items.head_; *pp;)
{
Cons<Mudela_item>* i = *pp;
if (i->car_->at_mom () > mom)
{
- Moment dur = i->car_->at_mom () - mom;
+ Rational dur = i->car_->at_mom () - mom;
// ugh, need score
Mudela_column* start = mudela_score_l_g->find_column_l (mom);
voice_p->add_item (new Mudela_skip (start, dur));
trackbody += "\\" + voicename + "\n";
- mudela_stream_r << "\n";
+ mudela_stream_r << '\n';
i->car_->output (mudela_stream_r);
c++;
}
}
void
-Mudela_staff::output_mudela_begin_bar (Mudela_stream& mudela_stream_r, Moment now_mom, int bar_i)
+Mudela_staff::output_mudela_begin_bar (Mudela_stream& mudela_stream_r, Rational now_mom, int bar_i)
{
- Moment bar_mom = mudela_time_signature_l_->bar_mom ();
- Moment into_bar_mom = now_mom - Moment (bar_i - 1) * bar_mom;
+ Rational bar_mom = mudela_time_signature_l_->bar_mom ();
+ Rational into_bar_mom = now_mom - Rational (bar_i - 1) * bar_mom;
if (bar_i > 1)
{
if (!into_bar_mom)
#if 0 // not used for now
void
-Mudela_staff::output_mudela_rest (Mudela_stream& mudela_stream_r, Moment begin_mom, Moment end_mom)
+Mudela_staff::output_mudela_rest (Mudela_stream& mudela_stream_r, Rational begin_mom, Rational end_mom)
{
- Moment bar_mom = mudela_time_signature_l_->bar_mom ();
- Moment now_mom = begin_mom;
+ Rational bar_mom = mudela_time_signature_l_->bar_mom ();
+ Rational now_mom = begin_mom;
int begin_bar_i = (int) (now_mom / bar_mom) + 1;
int end_bar_i = (int) (end_mom / bar_mom) + 1;
int bar_i = (int) (now_mom / bar_mom) + 1;
//fill current bar
- Moment begin_bar_mom = Moment (begin_bar_i - 1) * bar_mom;
+ Rational begin_bar_mom = Rational (begin_bar_i - 1) * bar_mom;
if (now_mom > begin_bar_mom)
{
int next_bar_i = (int) (now_mom / bar_mom) + 2;
- Moment next_bar_mom = Moment (next_bar_i - 1) * bar_mom;
+ Rational next_bar_mom = Rational (next_bar_i - 1) * bar_mom;
assert (next_bar_mom <= end_mom);
- Moment remain_mom = next_bar_mom - now_mom;
- if (remain_mom > Moment (0))
+ Rational remain_mom = next_bar_mom - now_mom;
+ if (remain_mom > Rational (0))
{
output_mudela_rest_remain (mudela_stream_r, remain_mom);
now_mom += remain_mom;
// bar_i = check_end_bar_i (now_mom, bar_i);
- Moment remain_mom = end_mom - Moment (end_bar_i - 1) * bar_mom;
- if (remain_mom > Moment (0))
+ Rational remain_mom = end_mom - Rational (end_bar_i - 1) * bar_mom;
+ if (remain_mom > Rational (0))
{
output_mudela_rest_remain (mudela_stream_r, remain_mom);
now_mom += remain_mom;
}
void
-Mudela_staff::output_mudela_rest_remain (Mudela_stream& mudela_stream_r, Moment mom)
+Mudela_staff::output_mudela_rest_remain (Mudela_stream& mudela_stream_r, Rational mom)
{
if (Duration_convert::no_quantify_b_s)
{
header();
}
-Mudela_stream::~Mudela_stream()
+Mudela_stream::~Mudela_stream ()
{
delete os_p_;
if (indent_i_)
}
Mudela_stream&
-Mudela_stream::operator << (Scalar s)
+Mudela_stream::operator << (char c)
+{
+ *this << to_str (c);
+ return *this;
+}
+
+Mudela_stream&
+Mudela_stream::operator << (String s)
{
static String word_sep_str = "{} \t\n";
while (s.length_i())
mudela_stream_r << get_clef () << '\n';
int current_bar_i = 0;
- Moment bar_mom = mudela_staff_l_->mudela_time_signature_l_->bar_mom ();
+ Rational bar_mom = mudela_staff_l_->mudela_time_signature_l_->bar_mom ();
for (Cons<Mudela_item>* i = mudela_item_l_list_.head_; i; i = i->next_)
{
- Moment at_mom = i->car_->mudela_column_l_->at_mom ();
+ Rational at_mom = i->car_->mudela_column_l_->at_mom ();
int bar_i = (int) (at_mom / bar_mom) + 1;
if (bar_i > current_bar_i)
{
if (current_bar_i)
{
- if (at_mom == Moment (bar_i - 1) * bar_mom)
+ if (at_mom == Rational (bar_i - 1) * bar_mom)
mudela_stream_r << "|";
mudela_stream_r << "\n% ";
mudela_stream_r << String_convert::i2dec_str (bar_i, 0, ' ');
############################
if 1: # need new a namespace
- def conv (lines):
+ def conv (str):
if re.search ('\\\\octave', str):
sys.stderr.write ('\nNot smart enough to convert \\octave')
raise FatalConversionError()
if 1: # need new a namespace
- def conv (lines):
- x = re.sub ('\\\\textstyle([^;]+);',
+ def conv (str):
+ str = re.sub ('\\\\textstyle([^;]+);',
'\\\\property Lyrics . textstyle = \\1', str)
- x = re.sub ('\\\\key([^;]+);', '\\\\accidentals \\1;', str)
+ str = re.sub ('\\\\key([^;]+);', '\\\\accidentals \\1;', str)
return str
if 1:
- def conv (lines):
- x = re.sub ('\\\\musical_pitch', '\\\\musicalpitch',str)
- x = re.sub ('\\\\meter', '\\\\time',str)
+ def conv (str):
+ str = re.sub ('\\\\musical_pitch', '\\\\musicalpitch',str)
+ str = re.sub ('\\\\meter', '\\\\time',str)
return str
'\\meter -> \\time'))
if 1:
- def conv (lines):
+ def conv (str):
return lines
conversions.append (
if 1:
- def conv (lines):
- x = re.sub ('\\\\accidentals', '\\\\keysignature',str)
- x = re.sub ('specialaccidentals *= *1', 'keyoctaviation = 0',str)
- x = re.sub ('specialaccidentals *= *0', 'keyoctaviation = 1',str)
+ def conv (str):
+ str = re.sub ('\\\\accidentals', '\\\\keysignature',str)
+ str = re.sub ('specialaccidentals *= *1', 'keyoctaviation = 0',str)
+ str = re.sub ('specialaccidentals *= *0', 'keyoctaviation = 1',str)
return str
'specialaccidentals -> keyoctaviation'))
if 1:
- def conv(lines):
+ def conv(str):
if re.search ('\\\\header', lines):
sys.stderr.write ('\nNot smart enough to convert to new \\header format')
return lines
conversions.append ((1,0,2), conv, '\\header { key = concat + with + operator }')
if 1:
- def conv(lines):
- x = re.sub ('\\\\melodic', '\\\\notes',str)
+ def conv(str):
+ str = re.sub ('\\\\melodic', '\\\\notes',str)
return str
conversions.append ((1,0,3), conv, '\\melodic -> \\notes')
if 1:
- def conv(lines):
- x = re.sub ('default_paper *=', '',str)
- x = re.sub ('default_midi *=', '',x)
+ def conv(str):
+ str = re.sub ('default_paper *=', '',str)
+ str = re.sub ('default_midi *=', '',x)
return str
conversions.append ((1,0,4), conv, 'default_{paper,midi}')
if 1:
- def conv(lines):
- x = re.sub ('ChoireStaff', 'ChoirStaff',str)
- x = re.sub ('\\output', 'output = ',str)
+ def conv(str):
+ str = re.sub ('ChoireStaff', 'ChoirStaff',str)
+ str = re.sub ('\\output', 'output = ',str)
return str
conversions.append ((1,0,5), conv, 'ChoireStaff -> ChoirStaff')
if 1:
- def conv(lines):
+ def conv(str):
if re.search ('[a-zA-Z]+ = *\\translator',str):
sys.stderr.write ('\nNot smart enough to change \\translator syntax')
raise FatalConversionError()
if 1:
- def conv(lines):
- x = re.sub ('\\\\lyric', '\\\\lyrics',str)
+ def conv(str):
+ str = re.sub ('\\\\lyric', '\\\\lyrics',str)
return str
conversions.append ((1,0,7), conv, '\\lyric -> \\lyrics')
if 1:
- def conv(lines):
- x = re.sub ('\\\\\\[/3+', '\\\\times 2/3 { ',str)
- x = re.sub ('\\[/3+', '\\\\times 2/3 { [',str)
- x = re.sub ('\\\\\\[([0-9/]+)', '\\\\times \\1 {',str)
- x = re.sub ('\\[([0-9/]+)', '\\\\times \\1 { [',str)
- x = re.sub ('\\\\\\]([0-9/]+)', '}', str)
- x = re.sub ('\\\\\\]', '}',str)
- x = re.sub ('\\]([0-9/]+)', '] }', str)
+ def conv(str):
+ str = re.sub ('\\\\\\[/3+', '\\\\times 2/3 { ',str)
+ str = re.sub ('\\[/3+', '\\\\times 2/3 { [',str)
+ str = re.sub ('\\\\\\[([0-9/]+)', '\\\\times \\1 {',str)
+ str = re.sub ('\\[([0-9/]+)', '\\\\times \\1 { [',str)
+ str = re.sub ('\\\\\\]([0-9/]+)', '}', str)
+ str = re.sub ('\\\\\\]', '}',str)
+ str = re.sub ('\\]([0-9/]+)', '] }', str)
return str
conversions.append ((1,0,10), conv, '[2/3 ]1/1 -> \\times 2/3 ')
if 1:
- def conv(lines):
+ def conv(str):
return lines
conversions.append ((1,0,12), conv, 'Chord syntax stuff')
if 1:
- def conv(lines):
+ def conv(str):
- x = re.sub ('<([^>~]+)~([^>]*)>','<\\1 \\2> ~', str)
+ str = re.sub ('<([^>~]+)~([^>]*)>','<\\1 \\2> ~', str)
return str
conversions.append ((1,0,13), conv, '<a ~ b> c -> <a b> ~ c')
if 1:
- def conv(lines):
- x = re.sub ('<\\[','[<', str)
- x = re.sub ('\\]>','>]', str)
+ def conv(str):
+ str = re.sub ('<\\[','[<', str)
+ str = re.sub ('\\]>','>]', str)
return str
if 1:
- def conv(lines):
- x = re.sub ('\\\\type','\\\\context', str)
- x = re.sub ('textstyle','textStyle', str)
+ def conv(str):
+ str = re.sub ('\\\\type','\\\\context', str)
+ str = re.sub ('textstyle','textStyle', str)
return str
if 1:
- def conv(lines):
+ def conv(str):
if re.search ('\\\\repeat',str):
sys.stderr.write ('\nNot smart enough to convert \\repeat')
raise FatalConversionError()
'\\repeat NUM Music Alternative -> \\repeat FOLDSTR Music Alternative')
if 1:
- def conv(lines):
- x = re.sub ('SkipBars','skipBars', str)
- x = re.sub ('fontsize','fontSize', str)
- x = re.sub ('midi_instrument','midiInstrument', x)
+ def conv(str):
+ str = re.sub ('SkipBars','skipBars', str)
+ str = re.sub ('fontsize','fontSize', str)
+ str = re.sub ('midi_instrument','midiInstrument', x)
return str
if 1:
- def conv(lines):
- x = re.sub ('tieydirection','tieVerticalDirection', str)
- x = re.sub ('slurydirection','slurVerticalDirection', str)
- x = re.sub ('ydirection','verticalDirection', x)
+ def conv(str):
+ str = re.sub ('tieydirection','tieVerticalDirection', str)
+ str = re.sub ('slurydirection','slurVerticalDirection', str)
+ str = re.sub ('ydirection','verticalDirection', x)
return str
if 1:
- def conv(lines):
- x = re.sub ('hshift','horizontalNoteShift', str)
+ def conv(str):
+ str = re.sub ('hshift','horizontalNoteShift', str)
return str
if 1:
- def conv(lines):
- x = re.sub ('\\\\grouping[^;]*;','', str)
+ def conv(str):
+ str = re.sub ('\\\\grouping[^;]*;','', str)
return str
if 1:
- def conv(lines):
- x = re.sub ('\\\\wheel','\\\\coda', str)
+ def conv(str):
+ str = re.sub ('\\\\wheel','\\\\coda', str)
return str
'\\wheel -> \\coda')
if 1:
- def conv(lines):
- x = re.sub ('keyoctaviation','keyOctaviation', str)
- x = re.sub ('slurdash','slurDash', str)
+ def conv(str):
+ str = re.sub ('keyoctaviation','keyOctaviation', str)
+ str = re.sub ('slurdash','slurDash', str)
return str
'slurdash -> slurDash, keyoctaviation -> keyOctaviation')
if 1:
- def conv(lines):
- x = re.sub ('\\\\repeat *\"?semi\"?','\\\\repeat "volta"', str)
+ def conv(str):
+ str = re.sub ('\\\\repeat *\"?semi\"?','\\\\repeat "volta"', str)
return str
if 1:
- def conv(lines):
- x = re.sub ('\"?beamAuto\"? *= *\"?0?\"?','noAutoBeaming = "1"', str)
+ def conv(str):
+ str = re.sub ('\"?beamAuto\"? *= *\"?0?\"?','noAutoBeaming = "1"', str)
return str
'beamAuto -> noAutoBeaming')
if 1:
- def conv(lines):
- x = re.sub ('automaticMelismas', 'automaticMelismata', str)
+ def conv(str):
+ str = re.sub ('automaticMelismas', 'automaticMelismata', str)
return str
'automaticMelismas -> automaticMelismata')
if 1:
- def conv(lines):
- x = re.sub ('dynamicDir', 'dynamicDirection', str)
+ def conv(str):
+ str = re.sub ('dynamicDir', 'dynamicDirection', str)
return str
conv_list = get_conversions (from_version, to_version)
sys.stderr.write ('Applying conversions: ')
- str = infile.read (-1)
+ str = infile.read ()
last_conversion = ()
try:
for x in conv_list:
if last_conversion:
sys.stderr.write ('\n')
new_ver = '\\\\version \"%s\"' % tup_to_str (last_conversion)
- if re.search (mudela_version_re_str):
+ if re.search (mudela_version_re_str, str):
str = re.sub (mudela_version_re_str,new_ver , str)
else:
str = new_ver + '\n' + str
outfile.write(str)
+ return last_conversion
+
class UnknownVersion:
pass
else:
outfile = sys.stdout
-
- do_conversion (infile, from_version, outfile, to_version)
+ touched = do_conversion (infile, from_version, outfile, to_version)
if infile_name:
infile.close ()
if outfile_name:
outfile.close ()
- if __main__.edit:
+ if __main__.edit and touched:
try:
os.remove(infile_name + '~')
except:
#
# source file of the GNU LilyPond music typesetter
#
-# (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+# (c) 1998, 1999 Jan Nieuwenhuizen <janneke@gnu.org>
# TODO: regex -> re.
last_name = name
else:
name = last_name
+ name = lstrip (name)
+ name = rstrip (name)
+ if name == "ms":
+ name = "s"
+ duration = 1
if duration:
last_duration = duration
else:
name = regsub.sub ("#", "is", name)
name = regsub.sub ("+", "'", name)
name = regsub.sub ("-", ",", name)
- name = regsub.sub ("ms", "s1", name)
+ #name = regsub.sub ("ms", "s1", name)
notes = notes + " %s%s" % (name, duration)
return notes
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))
+ lyfile.write ("\\context 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")
# Yolily_topdoc_targets.make
-default: do-doc
+default: local-doc
# urg
$(outdir)/%.html: %.yo