From c8989177a23864cfa3d44e013585e719b816acfd Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 21 Apr 1997 09:28:06 +0200 Subject: [PATCH] release: 0.0.53 --- .dstreamrc | 4 +- .version | 2 +- Documentation/AUTHORS.pod | 31 ++++++++ Documentation/INSTALL.pod | 16 +++- Documentation/convert-mudela.pod | 42 ++++++++++ Documentation/index.pod | 16 ++++ Documentation/lilypond.pod | 9 +-- Documentation/mudela.pod | 2 +- INSTALL.text | 80 +++++++++++++++++-- NEWS | 12 +++ TODO | 9 ++- bin/Makefile | 7 ++ bin/convert-mudela | 115 ++++++++++++++++------------ bin/release | 2 +- flower/.version | 2 +- flower/NEWS | 6 +- flower/include/cursor.hh | 11 ++- flower/include/cursor.icc | 35 +++++++-- flower/include/fproto.hh | 2 +- flower/include/iterate.hh | 2 + flower/include/pcursor.hh | 2 +- flower/include/pqueue.hh | 127 ++++++++++++++++++++----------- flower/include/priorities.hh | 35 +++++++++ flower/include/varray.hh | 21 +++-- flower/test/Makefile | 3 +- flower/test/flower-test.hh | 23 ++++++ flower/test/main.cc | 20 +++++ flower/test/pqtest.cc | 26 +++++++ flower/test/stringtest.cc | 16 ++-- init/dutch.ini | 3 + init/symbol.ini | 13 ++-- input/error.ly | 7 +- input/kortjakje.ly | 2 +- input/martien.ly | 8 +- input/scsii-menuetto.ly | 2 +- input/standchen.ly | 4 +- input/wohltemperirt.ly | 2 +- lily/.version | 2 +- lily/Stable.make | 2 +- lily/calcideal.cc | 12 ++- lily/complex-walker.cc | 3 +- lily/include/key.hh | 1 - lily/include/lily-proto.hh | 7 +- lily/include/midi-output.hh | 2 +- lily/include/midi-walker.hh | 14 +++- lily/include/musical-request.hh | 3 + lily/include/my-lily-parser.hh | 5 +- lily/include/pulk-voice.hh | 40 ++++++++++ lily/include/pulk-voices.hh | 47 ++++++++++++ lily/include/request-column.hh | 33 ++++++++ lily/include/score.hh | 3 + lily/include/staff-column.hh | 15 ++-- lily/include/staff.hh | 15 +--- lily/include/voice-element.hh | 2 +- lily/include/voice.hh | 4 +- lily/input-music.cc | 14 ++-- lily/input-score.cc | 2 +- lily/key-item.cc | 2 +- lily/key-reg.cc | 7 +- lily/key.cc | 7 +- lily/lexer.l | 4 +- lily/linespace.cc | 4 +- lily/local-key-reg.cc | 12 ++- lily/midi-output.cc | 4 +- lily/midi-walker.cc | 45 ++++++----- lily/my-lily-lexer.cc | 1 + lily/my-lily-parser.cc | 23 +++--- lily/parser.y | 16 +++- lily/pulk-voice.cc | 76 ++++++++++++++++++ lily/pulk-voices.cc | 84 ++++++++++++++++++++ lily/request-column.cc | 53 +++++++++++++ lily/score-walker.cc | 5 -- lily/score.cc | 85 +++++++++------------ lily/staff-column.cc | 52 +++++++------ lily/staff-info.cc | 4 +- lily/staff.cc | 85 +++------------------ lily/template7.cc | 14 ++++ lily/template8.cc | 6 ++ lily/voice-element.cc | 14 ++-- lily/voice.cc | 29 +++---- make/Makefile | 18 ++++- make/Variables.make | 1 + make/lilypond.lsm | 21 +++++ make/lilypond.lsm.in | 3 + make/lilypond.spec | 6 +- tex/dimen.tex | 4 +- 86 files changed, 1194 insertions(+), 436 deletions(-) create mode 100644 Documentation/AUTHORS.pod create mode 100644 Documentation/convert-mudela.pod create mode 100644 flower/include/priorities.hh create mode 100644 flower/test/flower-test.hh create mode 100644 flower/test/main.cc create mode 100644 flower/test/pqtest.cc create mode 100644 lily/include/pulk-voice.hh create mode 100644 lily/include/pulk-voices.hh create mode 100644 lily/include/request-column.hh create mode 100644 lily/pulk-voice.cc create mode 100644 lily/pulk-voices.cc create mode 100644 lily/request-column.cc create mode 100644 lily/template7.cc create mode 100644 lily/template8.cc create mode 100644 make/lilypond.lsm diff --git a/.dstreamrc b/.dstreamrc index 4e1e791e3e..c992908ec4 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -2,7 +2,7 @@ Dstream 1 File_path 1 -My_lily_lexer 0 +My_lily_lexer 1 PCol 1 Score_column 1 Ineq_constrained_qp 1 @@ -14,7 +14,7 @@ Idealspacing 1 # yydebug InitParser 1 -Parser 0 +Parser 1 InitDeclarations 1 Declarations 1 # FlexLexer debug diff --git a/.version b/.version index 1457d1972e..09683a7054 100644 --- a/.version +++ b/.version @@ -1,6 +1,6 @@ TOPLEVEL_MAJOR_VERSION = 0 TOPLEVEL_MINOR_VERSION = 0 -TOPLEVEL_PATCH_LEVEL = 52 +TOPLEVEL_PATCH_LEVEL = 53 # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf diff --git a/Documentation/AUTHORS.pod b/Documentation/AUTHORS.pod new file mode 100644 index 0000000000..c11a911b6c --- /dev/null +++ b/Documentation/AUTHORS.pod @@ -0,0 +1,31 @@ +=head1 NAME + +AUTHORS - who did what on LilyPond? + +=head1 DESCRIPTION + +This file lists authors of LilyPond, and what they wrote. + +=over 4 + +=item * + +Han-Wen Nienhuys + +Main author, all files files except mentioned below + +=item * + +Jan Nieuwenhuizen + +lily/midi-*, mi2mu/*, flower/string.cc, make/*.make, Documentation/mudela.pod +lib/*source-file*, lib/duration.cc, lib/source, flower/*list* + +and corresponding header files. + +=item * + +Mats Bengtsson , parts of clef-reg.cc, clef-item.cc +testing, general comments. + +=back diff --git a/Documentation/INSTALL.pod b/Documentation/INSTALL.pod index 26343b17e0..d5920a70ab 100644 --- a/Documentation/INSTALL.pod +++ b/Documentation/INSTALL.pod @@ -126,6 +126,15 @@ everything will be compiled, but nothing will be installed. The resulting binaries can be found in the subdirectory F. +=head1 INSTALLING + +If you have done a successful C, then a simple + + make install + +should do the trick. Install the musixtex fonts in a directory which +TeX and MF knows. Do not forget to rehash TeX (if applicable) + =head1 RUNNING GNU LilyPond does use a lot of resources. For operation you need the following: @@ -134,16 +143,19 @@ GNU LilyPond does use a lot of resources. For operation you need the following: =over 5 =item * + A fast computer (a full page of music typically takes 1 minute on my 486/66, using the B<--enable-checking> compile. It's lot slower than most MusiXTeX preprocessors) =item * + TeX =item * -The MusixTeX fonts. (I use those found in MusixTeX -T.59) + +The MusixTeX fonts. (I use those found in MusixTeX T.59). Beware, the +clef symbol has changed position in recent versions of MusixTeX) =back diff --git a/Documentation/convert-mudela.pod b/Documentation/convert-mudela.pod new file mode 100644 index 0000000000..34e5bc8fa9 --- /dev/null +++ b/Documentation/convert-mudela.pod @@ -0,0 +1,42 @@ +=head1 NAME + +convert-mudela - convert mudela to newer versions + +=head1 SYNOPSIS + + convert-mudela [options] [files] + +=head1 DESCRIPTION + +convert-mudela sequentially applies different mudela-conversions to +upgrade a Mudela input file from FROM_PATCHLEVEL to TO_PATCHLEVEL. +If no files are given, the standard input and output are used + +=head1 OPTIONS + +=over 4 + +=item B<--output> + +The output file to write + +=item B<--edit> + +Do an inline edit of the input file. override B<--output> + +=item B<--show-rules> + +shows all known conversions. + +=item B<--from>=FROM_PATCHLEVEL + +Set the level to convert from. If this is not set, convert-mudela will +guess this, on the basis of C<\version> strings in the file + +=item B<--to>=TO_PATCHLEVEL + +Set the goal version of the conversion. It defaults to the latest +available version. + +=back + diff --git a/Documentation/index.pod b/Documentation/index.pod index b67f1543ff..7a09c8d1d2 100644 --- a/Documentation/index.pod +++ b/Documentation/index.pod @@ -34,6 +34,14 @@ Design criteria +=item * + +AUTHORS + + + =item * @@ -55,6 +63,14 @@ Mudela, the input format +=item * + +The mudela convertor: convert-mudela + + + =item * diff --git a/Documentation/lilypond.pod b/Documentation/lilypond.pod index 555c0eeb0e..329fe3b5b4 100644 --- a/Documentation/lilypond.pod +++ b/Documentation/lilypond.pod @@ -123,7 +123,10 @@ the GNU General Public License, which is in the file F =head1 AUTHORS -=over 5 +Please consult the documentation file AUTHORS for more detailed +information, and small contributions. + +=over 4 =item * @@ -138,10 +141,6 @@ Jan Nieuwenhuizen , http://www.digicash.com/~jan. Context errors, Lyrics, mi2mu, MIDI stuff, make structure, bits of FlowerLib, general comments, Mudela design. -=item * - -Mats Bengtsson , bugfixes, testing, general comments. - =back Your name could be here! If you want to help, then take a look at the diff --git a/Documentation/mudela.pod b/Documentation/mudela.pod index f66180e238..7fb25b38a4 100644 --- a/Documentation/mudela.pod +++ b/Documentation/mudela.pod @@ -30,7 +30,7 @@ file, as this document does not cover every aspect of mudela yet. The de-facto extension of Mudela is F<.ly>. Files may be included by entering C at the start of a line: - include "a_file.ly" + \include "a_file.ly" =head2 Comments diff --git a/INSTALL.text b/INSTALL.text index 78b8576cfa..46c552aeb5 100644 --- a/INSTALL.text +++ b/INSTALL.text @@ -61,7 +61,7 @@ CCCCOOOONNNNFFFFIIIIGGGGUUUURRRRIIIINNNNGGGG a -17/Apr/97 LilyPond 0.0.52 1 +21/Apr/97 LilyPond 0.0.53 1 @@ -127,7 +127,7 @@ INSTALL(1) LilyPond documentation INSTALL(1) -17/Apr/97 LilyPond 0.0.52 2 +21/Apr/97 LilyPond 0.0.53 2 @@ -139,18 +139,29 @@ INSTALL(1) LilyPond documentation INSTALL(1) installed. The resulting binaries can be found in the subdirectory _b_i_n_/. +IIIINNNNSSSSTTTTAAAALLLLLLLLIIIINNNNGGGG + If you have done a successful make, then a simple + + make install + + should do the trick. Install the musixtex fonts in a + directory which TeX and MF knows. Do not forget to rehash + TeX (if applicable) + RRRRUUUUNNNNNNNNIIIINNNNGGGG GNU LilyPond does use a lot of resources. For operation you need the following: - +o A fast computer (a full page of music typically takes 1 - minute on my 486/66, using the --------eeeennnnaaaabbbblllleeee----cccchhhheeeecccckkkkiiiinnnngggg + +o A fast computer (a full page of music typically takes + 1 minute on my 486/66, using the --------eeeennnnaaaabbbblllleeee----cccchhhheeeecccckkkkiiiinnnngggg compile. It's lot slower than most MusiXTeX preprocessors) - +o TeX + +o TeX - +o The MusixTeX fonts. (I use those found in MusixTeX T.59) + +o The MusixTeX fonts. (I use those found in MusixTeX + T.59). Beware, the clef symbol has changed position + in recent versions of MusixTeX) Please refer to the man page for more information. @@ -176,6 +187,21 @@ PPPPLLLLAAAATTTTFFFFOOOORRRRMMMMSSSS GNU LilyPond (pl 0.0.39) is known to compile on the following platforms: + + + + + + +21/Apr/97 LilyPond 0.0.53 3 + + + + + +INSTALL(1) LilyPond documentation INSTALL(1) + + * linux 2.0.x, g++ 2.7.2[.1] * aix 4.1, g++ 2.7.2 * windows-nt 4.0, cygnus gnu-win32 beta17.1 (~=g++ 2.7.2) @@ -193,6 +219,46 @@ AAAAUUUUTTTTHHHHOOOORRRRSSSS -17/Apr/97 LilyPond 0.0.52 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +21/Apr/97 LilyPond 0.0.53 4 diff --git a/NEWS b/NEWS index 9e64e93bb6..c59f0320f3 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,16 @@ +pl 53 + - spurious accidental bug. + - simultaneity check. + - added AUTHORS.pod + - convert-mudela auto from guess + - include -> \include + - change order of opening parse/init file + - Pulk_voice, Pulk_voices + - Request_column + - revised request-from-voice extraction. Now much faster + ****** +april 17 pl 52 - Buildroot RPM - tex-prefix and tex-dir sep'd (here you are jan) diff --git a/TODO b/TODO index 805651b355..cf48d74f4c 100644 --- a/TODO +++ b/TODO @@ -10,8 +10,9 @@ IMPORTANT * slur direction - * problems with empty staff.->revise staff-column/score-walker. + * use own fonts/update musixtex fonts + * check return status in make_website This is an assorted collection of stuff that will be done, might be done, or is an idea that I want to think about @@ -55,8 +56,6 @@ INPUTLANGUAGE * figured bass? - * transposition - * rest name configurable * Raw request syntax @@ -70,6 +69,8 @@ SMALLISH PROJECTS * bugreport to doc++ devel: struct not in class hier; public virtual baseclasses + * cleanup lily-proto.hh and proto.hh + * half-sharps, half-flats * key undo @@ -149,6 +150,8 @@ DOC FUTURE + * tie a ~ b, move slur reg into voice-group. + * Reg_configure_request * bring Collision::do_pre_processing to haircutter diff --git a/bin/Makefile b/bin/Makefile index bf5b107ce9..05214b0b58 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -11,3 +11,10 @@ SCRIPTS = clearlily cpgento genheader make_patch \ EXTRA_DISTFILES = $(SCRIPTS) # + +localinstall: all + $(INSTALL) -d $(bindir) + $(INSTALL) -m 755 convert-mudela $(bindir) + +localuninstall: + rm -f $(bindir)/convert-mudela diff --git a/bin/convert-mudela b/bin/convert-mudela index ff7b4c2864..2ead27d9b9 100755 --- a/bin/convert-mudela +++ b/bin/convert-mudela @@ -1,42 +1,5 @@ #!/usr/bin/perl -w -=head1 NAME - -convert-mudela - convert mudela to newer versions - -=head1 SYNOPSIS - - convert-mudela --from=FROM_PATCHLEVEL --to=TO_PATCHLEVEL - -=head1 DESCRIPTION - -convert-mudela sequentially applies different mudela-conversions to -upgrade a Mudela input file from FROM_PATCHLEVEL to TO_PATCHLEVEL - -=head1 OPTIONS - -=over 4 - -=item B<--output> - -The output file to write - -=item B<--edit> - -Do an inline edit of the input file. override B<--output> - -=item B<--show-rules> - -shows all known conversions. - -=item B<--from>=FROM_PATCHLEVEL - -=item B<--to>=TO_PATCHLEVEL - -=back - -=cut - use Getopt::Long; sub @@ -46,27 +9,48 @@ sub s/\version \"0.0.$from_version\"/\version \"0.0.$to_version\"/g; } +################################################################ + sub conv_pl0_0_50_pl0_0_52 { } +sub conv_pl52_pl53 +{ + + s/include \"/$1\\include \"/g; +} + + +############################################################### + + + + sub usage { - print STDERR "Usage: convert-mudela --from=XX --to=XX\n"; + print STDERR "Usage: convert-mudela\n"; print STDERR "other options: --edit --output=FILE --show-rules\n"; exit 2; } -my %minor_conversions = ("50" => \&no_conv, - "52" => \&conv_pl0_0_50_pl0_0_52); +my %minor_conversions = (50 => \&no_conv, + 52 => \&conv_pl0_0_50_pl0_0_52, + 53 => \&conv_pl52_pl53 + ); +sub versions +{ + return (sort keys %minor_conversions); +} + sub show_rules { - print "Rules: ", join(", ", keys %minor_conversions), "\n"; + print "Rules: ", join(", ", sort keys %minor_conversions), "\n"; } @@ -79,8 +63,8 @@ sub my @mudela_levels; die "This is too old to convert " if $from < 50; - - foreach $a (sort keys %minor_conversions) { + my @v = versions; + foreach $a (@v) { if ($a > $from && $a <= $to ){ push @applicable_conversion, $minor_conversions{$a}; push @mudela_levels, $a; @@ -99,10 +83,27 @@ sub print OUTLY; } } - +sub set_auto_from +{ + my ($fn)=@_; + my ($ver); + open INLY, $fn || die "Can't open"; -sub - set_files + while () { + s/^.*\\version \"([^\"]*)\".*$//; + if (defined ($1)) { + print STDERR "Guessing version: ", $1, ".. "; + $ver = $1; + last; + } + } + die "can't determine mudela version." unless (defined($ver)); + $ver =~ s/0\.0\.// ; + close INLY; + return $ver; +} + +sub set_files { $infile = "-"; $outfile = "-"; @@ -111,12 +112,15 @@ sub if ($ARGV [0]) { $infile = $ARGV[0]; } + if (( ! -f $infile) && (! $infile =~ /\\.ly$/s ) ){ + $infile .= ".ly"; + print STDERR "trying $infile"; + } if ($opt_edit && $infile ne "-") { $opt_edit = 1; - rename $infile, "$infile~"; - $outfile = $infile; - $infile = "$infile~"; + $outfile = "$infile.NEW"; + $infile = "$infile"; } } @@ -128,10 +132,16 @@ if ($opt_show_rules) { exit 0; } -usage if (!defined($opt_from) || !defined($opt_to)); local ( $infile,$outfile); set_files; + +($opt_from = set_auto_from $infile) unless defined($opt_from); + +my @v = versions; +($opt_to = pop @v) unless (defined($opt_to)); + + die "can't open \`$infile\'" unless open INLY,$infile ; die "can't open \`$outfile\'" unless open OUTLY, ">$outfile"; @@ -139,3 +149,8 @@ do_conversion $opt_from, $opt_to; close INLY; close OUTLY; +if ($opt_edit) { + rename $infile, "$infile~"; + rename $outfile, "$infile"; +} + diff --git a/bin/release b/bin/release index 69fa7d4fec..7fb658c7cb 100755 --- a/bin/release +++ b/bin/release @@ -33,7 +33,7 @@ heredir=`pwd` mv {lilypond-,patch-}*.gz ../ cd .. tar cf updeet {lily,patch-}*.gz - +tar tfv updeet mv patch-*gz patches/ mv lilypond*tar.gz releases/ diff --git a/flower/.version b/flower/.version index 8b50ae31c5..2e73ca7ca9 100644 --- a/flower/.version +++ b/flower/.version @@ -1,6 +1,6 @@ MAJOR_VERSION = 1 MINOR_VERSION = 1 -PATCH_LEVEL = 12 +PATCH_LEVEL = 13 # use to send patches, always empty for released version: MY_PATCH_LEVEL = # include separator: "-1" or ".a" # diff --git a/flower/NEWS b/flower/NEWS index d0c64e59dd..934256a78b 100644 --- a/flower/NEWS +++ b/flower/NEWS @@ -1,4 +1,8 @@ -pl 1.1.11.jcn1 +pl 1.1.13 + - better test-bed + - Heap PQueue implementation + +pl 1.1.12 - No path search for "" and "-" pl 1.1.11 diff --git a/flower/include/cursor.hh b/flower/include/cursor.hh index 168ee50393..c1fb23c183 100644 --- a/flower/include/cursor.hh +++ b/flower/include/cursor.hh @@ -21,7 +21,10 @@ class Cursor /** create cursor, set at top. The const part isn't true, actually, #list# surely isn't const, but I get tired of the warning messages. */ Cursor( const List& list, Link* pointer = 0 ); - + /** + Create an invalid cursor (pointing to nothing, associated with no list.) + */ + Cursor(); Cursor( const Cursor& cursor ); T& thing(); @@ -47,13 +50,13 @@ class Cursor Cursor operator --( int ); /// point to link? - bool ok(); + bool ok()const; /// ++ items left? - bool forward(); + bool forward()const; /// -- items left? - bool backward(); + bool backward()const; /** put (copy) after me in List. analogously to editor. ok() interpreted as at end diff --git a/flower/include/cursor.icc b/flower/include/cursor.icc index e103c88e43..3390d69026 100644 --- a/flower/include/cursor.icc +++ b/flower/include/cursor.icc @@ -1,8 +1,28 @@ - // cursor.icc -*-c++-*- -#ifndef CURSOR_INL -#define CURSOR_INL +/* + cursor.icc -- implement Cursor + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef CURSOR_ICC +#define CURSOR_ICC + + + #include +// untested +template +inline +Cursor::Cursor( ) + : list_(*(List *)0) // ugh +{ + pointer_ = 0; +} + template inline @@ -70,21 +90,21 @@ Cursor::pointer() template inline bool -Cursor::backward() +Cursor::backward()const { return ( pointer_ != 0 ); } template inline bool -Cursor::forward() +Cursor::forward()const { return ( pointer_ != 0 ); } template inline bool -Cursor::ok() +Cursor::ok()const { return ( pointer_ != 0 ); } @@ -110,4 +130,5 @@ Cursor::operator --( int ) return r; } -#endif + +#endif // CURSOR_ICC diff --git a/flower/include/fproto.hh b/flower/include/fproto.hh index 030157cbe4..5f3bdfcff4 100644 --- a/flower/include/fproto.hh +++ b/flower/include/fproto.hh @@ -28,7 +28,7 @@ template struct PCursor; template struct Link; template struct Handle; template struct Interval_t; -template struct PQueue; +template struct PQueue; #include "real.hh" diff --git a/flower/include/iterate.hh b/flower/include/iterate.hh index 1e924f0790..9aee1ec550 100644 --- a/flower/include/iterate.hh +++ b/flower/include/iterate.hh @@ -15,6 +15,8 @@ #define iterator(set) typeof((set).top()) #define iterator_bot(set) typeof((set).bottom()) +#define iter(init, var) typeof(init) var(init) + // should use top() #define iter_top(set,var) iterator(set) var(set) #define iter_bot(set,var) iterator(set) var(set.bottom()) diff --git a/flower/include/pcursor.hh b/flower/include/pcursor.hh index 37512d553b..459977a471 100644 --- a/flower/include/pcursor.hh +++ b/flower/include/pcursor.hh @@ -44,7 +44,7 @@ public: PCursor operator -(int no) const { return Cursor::operator-(no);} int operator -(PCursor op) const { return Cursor::operator-(op);} PCursor operator +( int no) const {return Cursor::operator+(no);} PCursor(const PointerList & l) : Cursor (l) {} - + PCursor() : Cursor () {} PCursor( const Cursor& cursor ) : Cursor(cursor) { } void* vptr() const { return *((Cursor &) *this); } diff --git a/flower/include/pqueue.hh b/flower/include/pqueue.hh index c8dfe1bea6..dac5be52f3 100644 --- a/flower/include/pqueue.hh +++ b/flower/include/pqueue.hh @@ -1,7 +1,7 @@ /* - pqueue.hh -- declare + pqueue.hh -- declare PQueue_ent and PQueue - source file of the LilyPond music typesetter + source file of the Flower Library (c) 1997 Han-Wen Nienhuys */ @@ -9,64 +9,99 @@ #ifndef PQUEUE_HH #define PQUEUE_HH - #include "varray.hh" + +template +struct PQueue_ent +{ + T val; + K key; +}; + +template +int compare (PQueue_ent const &e1 , PQueue_ent const &e2) { + return compare(e1.key , e2.key); +} + /** - Stupid Prioq. Should use Lists and STL. - Smallest is put at the front. + Priority queue using a (variable size) in-situ heap. -Actually, this sux. Should use a template struct PQuee_ent + Hungarian postfix pq + */ +template +class PQueue { + Array heap_arr_; + T &elt(int i) { + return heap_arr_[i-1]; + } + T const&elt(int i) const { + return heap_arr_[i-1]; + } +public: + /** acces an heap element. Careful with this, as changing the + priority might fuck up the invariants -template -struct PQueue -{ - Array value_arr_; - Array indices_arr_; - void OK() const + @param 1 <= i < size() */ + T& operator[](int i) { return heap_arr_[i]; } + T operator[](int i) const { return heap_arr_[i]; } + void OK() const { - - assert(value_arr_.size() == indices_arr_.size()); +#ifndef NDEBUG + for (int i =2; i <= size(); i++) + assert(compare (elt(i/2), elt(i)) <= 0); +#endif } - - void enter(V v, I idx) { - int j=0; - for (; j < value_arr_.size(); j++) - if (indices_arr_[j] > idx) + T front () const { return elt(1); } + int size() const { return heap_arr_.size(); } + void insert(T v) { + heap_arr_.push(v); + int i = heap_arr_.size(); + int j = i / 2 ; + while (j) { + if (compare(elt(j), v) > 0) { + elt(i) = elt(j); + i = j; + j = i/2; + } else { break; - - insert(j,v,idx); - + } + } + elt(i) = v; + OK(); } - int size() { return value_arr_.size(); } - V front_val() { return value_arr_[0]; } - I front_idx() { return indices_arr_[0]; } - void del(int i) - { - value_arr_.del(i); - indices_arr_.del(i); + T max() const { + int first_leaf_i = size(); + T max_t; + return max_t; } - int size() const - { + void delmin( ) { + assert(size()); + T last = heap_arr_.top(); + + int mini=2; + int lasti=1; + + while ( mini < size() ) { + if (compare(elt(mini + 1), elt(mini)) <0) + mini++; + if (compare(last,elt(mini) ) < 0) + break; + elt(lasti) = elt(mini); + lasti = mini; + mini *= 2; + } + elt(lasti) = last; + heap_arr_.pop(); OK(); - return value_arr_.size(); } - - - void insert(int j, V v, I idx) - { - value_arr_.insert(v, j); - indices_arr_.insert(idx, j); + T get() { + T t = front(); + delmin(); + return t; } - +}; - V get() { - V retval = front_val(); - del(0); - return retval; - } - -}; #endif // PQUEUE_HH diff --git a/flower/include/priorities.hh b/flower/include/priorities.hh new file mode 100644 index 0000000000..8b12766240 --- /dev/null +++ b/flower/include/priorities.hh @@ -0,0 +1,35 @@ +/* + priorities.hh -- declare Priorities + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef PRIORITIES_HH +#define PRIORITIES_HH + +#include "varray.hh" + +/** + A sorted (uni)set. Should connect with PQueue + */ +template +struct Priorities : Array +{ + void insert(K k) + { + int i=0; + for (; i < size(); i++) { + if(elem(i) == k) + return; + if (elem(i) > k ) + break; + } + Array::insert(k, i); + } +}; +#endif // PRIORITIES_HH + + diff --git a/flower/include/varray.hh b/flower/include/varray.hh index b7400bb501..b9b1a24b6b 100644 --- a/flower/include/varray.hh +++ b/flower/include/varray.hh @@ -1,5 +1,5 @@ /* - (c) Han-Wen Nienhuys 1995,96 + (c) Han-Wen Nienhuys 1995,96,97 Distributed under GNU GPL */ @@ -21,11 +21,13 @@ inline void arrcpy(T*dest, T*src, int count) { This template implements a scaleable vector. With (or without) range - checking. It may be flaky for objects with complicated con- and - destructors. The type T should have a default constructor. It is + checking. The type T should have a default constructor. It is best suited for simple types, such as int, double or String, it provides a paranoidly safe replacement for the new T[int] construct. + You should \bf{never} store pointers to objects in an Array (since + the array may be relocated without the pointer knowing it). + It uses stack terminology, (push, pop, top), and can be used as a stack. @@ -99,9 +101,18 @@ public: /// tighten array size_. void precompute () { remax(size_); } + - /// this makes Array behave like an array - T &operator[] (const int i) const { + /// access element + T &operator[] (int i) { + return elem(i); + } + /// access element + T const & operator[] (int i) const { + return elem(i); + } + /// access element + T &elem( int i) const { assert(i >=0&&i $(outdir)/result cmp $(outdir)/result result diff --git a/flower/test/flower-test.hh b/flower/test/flower-test.hh new file mode 100644 index 0000000000..b03a48ff20 --- /dev/null +++ b/flower/test/flower-test.hh @@ -0,0 +1,23 @@ +/* + flower-test.hh -- declare + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef FLOWER_TEST_HH +#define FLOWER_TEST_HH +#include + +#define ADD_TEST(f) \ +struct f ## Init {\ + f ## Init () { reg_test(f); }\ +} f ## init\ + +typedef void (*fptr)(void); + +void reg_test (fptr f); + +#endif // FLOWER_TEST_HH diff --git a/flower/test/main.cc b/flower/test/main.cc new file mode 100644 index 0000000000..85c4cbce27 --- /dev/null +++ b/flower/test/main.cc @@ -0,0 +1,20 @@ +#include "flower-test.hh" +#include "varray.hh" + +Array< fptr > *test_arr_p; + +void reg_test (fptr f) +{ + if (!test_arr_p) + test_arr_p = new Array; + test_arr_p->push(f); +} + +int +main() +{ + if (test_arr_p) { + for (int i=0; i < test_arr_p->size(); i++) + (*test_arr_p)[i] (); + } +} diff --git a/flower/test/pqtest.cc b/flower/test/pqtest.cc new file mode 100644 index 0000000000..0e086ab0ef --- /dev/null +++ b/flower/test/pqtest.cc @@ -0,0 +1,26 @@ +#include "flower-test.hh" +#include "pqueue.hh" +#include + +int compare(int i, int j) +{ + return i-j; +} + +void +pqtest() +{ + PQueue pq; + + for (int i=0; i < 10; i++) { + int r = rand()/10000; + pq.insert(r); + cout << "adding: " << r<< endl; + } + while (pq.size()) { + cout << "getting : "<< flush; + cout << pq.get() << "\n"; + } +} + +ADD_TEST(pqtest); diff --git a/flower/test/stringtest.cc b/flower/test/stringtest.cc index cc652a5405..163b3bbb9c 100644 --- a/flower/test/stringtest.cc +++ b/flower/test/stringtest.cc @@ -2,10 +2,10 @@ stupid test program to verify stringlib stringtest.cc */ -#include #include "string.hh" #include "varray.hh" #include "string-convert.hh" +#include "flower-test.hh" void ctors() @@ -89,8 +89,8 @@ test_empty_b( String str ) return false; } -int -main() +void +stringtest() { ctors(); cmp(); @@ -109,11 +109,12 @@ main() cout << "up: " << str.upper_str() << " down: " << str.lower_str()<used_b()); + if (!i->used_b()) + continue; + PCursor j(i+1); + if (i->musical_b()) { assert(j.ok()); for (int n=0; n < i->durations.size(); n++) { @@ -28,14 +31,19 @@ Score::calc_idealspacing() Real strength = i->durations[0]/i->durations[n]; assert(strength <= 1.0); - while (j->when() < d + i->when()) + while (j.ok()) { + if (j->used_b() && j->when() >= d + i->when() ) + break; j++; + } Moment delta_desired = j->when() - (d+i->when()); dist += paper_p_->duration_to_dist(delta_desired); pscore_p_->connect(i->pcol_l_, j->pcol_l_, dist, strength); } } else if (j.ok()) { + while (!j->used_b()) + j++; /* attach i to the next column in use. This exists, since the last col is breakable, and therefore in use diff --git a/lily/complex-walker.cc b/lily/complex-walker.cc index ba7be37cd1..134a4705a7 100644 --- a/lily/complex-walker.cc +++ b/lily/complex-walker.cc @@ -5,6 +5,7 @@ (c) 1997 Han-Wen Nienhuys */ + #include "staff-column.hh" #include "voice.hh" #include "p-score.hh" @@ -37,9 +38,7 @@ Complex_walker::try_request(Request*req) { bool b =walk_regs_p_->try_request(req); if (!b) - req->warning("junking request: " + String(req->name())); - } void diff --git a/lily/include/key.hh b/lily/include/key.hh index 38885f4a18..d3d34a01ae 100644 --- a/lily/include/key.hh +++ b/lily/include/key.hh @@ -31,7 +31,6 @@ public: bool multi_octave_b_; Octave_key&oct(int); - Octave_key oct(int) const; void set(int name, int acc); void set(int oct, int name, int acc); Key(); diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index 3864ace146..7db99e41ca 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -1,6 +1,5 @@ - /* - lily-proto.hh -- declare + lily-proto.hh -- declare class names. source file of the LilyPond music typesetter @@ -10,6 +9,7 @@ #ifndef LILY_PROTO_HH #define LILY_PROTO_HH +#include "proto.hh" struct My_lily_lexer; struct My_lily_parser; @@ -39,8 +39,11 @@ struct Command_req; struct Collision_register; struct Collision; struct Note_req; +struct Pulk_voices; +struct Pulk_voice; struct Plet_req; struct Partial_measure_req; +struct Request_column; struct Rest_req; struct Rhythmic_grouping_req; struct Rhythmic_req; diff --git a/lily/include/midi-output.hh b/lily/include/midi-output.hh index d5e9481f25..11e5cb5f7d 100644 --- a/lily/include/midi-output.hh +++ b/lily/include/midi-output.hh @@ -9,7 +9,7 @@ #ifndef MIDIOUTPUT_HH #define MIDIOUTPUT_HH -#include "p-score.hh" +#include "lily-proto.hh" struct Midi_output { Midi_output(Score* score_l, Midi_def* ); diff --git a/lily/include/midi-walker.hh b/lily/include/midi-walker.hh index fcfcb0c6e0..30ad18fe90 100644 --- a/lily/include/midi-walker.hh +++ b/lily/include/midi-walker.hh @@ -12,17 +12,27 @@ #include "staff-walker.hh" #include "pcursor.hh" #include "pqueue.hh" +struct Note_event : PQueue_ent +{ + bool ignore_b_; + Note_event() { + ignore_b_ = false; + } +}; +int compare(Note_event const&, Note_event const&); /** a simple walker which collects midi stuff, and then outputs. Should derive from Staff_walker */ -class Midi_walker : public PCursor { +class Midi_walker : public PCursor +{ Midi_track *track_l_; - PQueue stop_notes; + PQueue< Note_event > stop_notes; + Moment last_moment_; /* *************** */ diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 50ec8e8c9c..029579056d 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -37,6 +37,7 @@ public: virtual Moment duration() const; REQUESTMETHODS(Skip_req, skip); }; + /** a request with a duration. This request is used only a base class. */ @@ -74,6 +75,7 @@ public: int dir_i_; /// the characteristics of the text Text_def *tdef_p_; + /* *************** */ Text_req(int d, Text_def*); ~Text_req(); @@ -222,6 +224,7 @@ public: */ class Subtle_req : public virtual Musical_req { public: + /// the time relative to Voice_element start. Moment subtime_; REQUESTMETHODS(Subtle_req, subtle); }; diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh index cd27e9b574..9b208a2aac 100644 --- a/lily/include/my-lily-parser.hh +++ b/lily/include/my-lily-parser.hh @@ -23,7 +23,7 @@ class My_lily_parser { char const* here_ch_C()const; Array define_spot_array_; - + String init_str_; void add_requests( Voice_element*v); @@ -37,7 +37,7 @@ public: int default_octave_i_; Duration default_duration_; String textstyle_str_; - + bool first_b_; bool last_duration_mode ; Array pre_reqs, post_reqs; int fatal_error_i_; @@ -64,6 +64,7 @@ public: void print_declarations(); bool ignore_version_b_; public: + void do_init_file(); void parse_file ( String init_str, String file_str); My_lily_parser(Sources * sources_l); ~My_lily_parser(); diff --git a/lily/include/pulk-voice.hh b/lily/include/pulk-voice.hh new file mode 100644 index 0000000000..3b90063050 --- /dev/null +++ b/lily/include/pulk-voice.hh @@ -0,0 +1,40 @@ +/* + pulk-voice.hh -- declare Pulk_voice + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef PULK_VOICE_HH +#define PULK_VOICE_HH + +#include "proto.hh" +#include "lily-proto.hh" +#include "moment.hh" +#include "priorities.hh" +#include "pcursor.hh" + +/** + Align requests with starting time. + */ +class Pulk_voice +{ + PCursor cur_; + Moment elt_mom_; + Priorities subtle_moment_priorities_; + int subtle_idx_; + void set_subtle(); + void next(); +public: + int staff_idx_; + + Moment when()const; + bool ok()const { return cur_.ok() ; } + + Pulk_voice(Voice*, int staff_idx); + Array get_req_l_arr(); +}; + +#endif // PULK_VOICE_HH diff --git a/lily/include/pulk-voices.hh b/lily/include/pulk-voices.hh new file mode 100644 index 0000000000..29fc48bed2 --- /dev/null +++ b/lily/include/pulk-voices.hh @@ -0,0 +1,47 @@ +/* + pulk-voices.hh -- declare Pulk_voices + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef PULK_VOICES_HH +#define PULK_VOICES_HH +#include "pqueue.hh" +#include "plist.hh" +#include "moment.hh" +#include "proto.hh" +#include "lily-proto.hh" +#include "voice.hh" + + + +struct Voice_l { + Voice *l_; + int staff_idx_; + Voice_l(Voice*v, int i){ l_ = v; + staff_idx_ = i; + } + Voice_l() { l_ = 0; staff_idx_ =0; } +}; +int compare(Voice_l const &p1, Voice_l const &p2); + +class Pulk_voices +{ +PQueue< Voice_l > voice_pq_; + IPointerList< Pulk_voice * > pulk_p_list_; + PointerList staff_l_list_; + Moment next_mom_; + +public: + Moment last_; + bool ok() const; + Moment next_mom() { return next_mom_; } + Pulk_voices(PointerList const&); + void get_aligned_request(Request_column *col_l ); +}; + + +#endif // PULK_VOICES_HH diff --git a/lily/include/request-column.hh b/lily/include/request-column.hh new file mode 100644 index 0000000000..32a6f63773 --- /dev/null +++ b/lily/include/request-column.hh @@ -0,0 +1,33 @@ +/* + request-column.hh -- declare Request_column + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef REQUEST_COLUMN_HH +#define REQUEST_COLUMN_HH +#include "plist.hh" +#include "lily-proto.hh" +#include "moment.hh" +#include "varray.hh" +/** + Like staff_column, but Score wide. One per when(). + */ +class Request_column +{ + IPointerList staff_cols_; + Array staff_col_l_arr_; + +public: + Score_column *musical_column_l_, *command_column_l_; + Request_column(PointerList const& ); + bool used_b()const; + Moment when(); + void add_reqs(int staff_idx, Array const&); + void set_score_cols(Score_column*, Score_column*); +}; + +#endif // REQUEST_COLUMN_HH diff --git a/lily/include/score.hh b/lily/include/score.hh index 32b57bf01f..e83540533b 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -17,6 +17,7 @@ #include "assoc.hh" #include "string.hh" #include "input.hh" +#include "lily-proto.hh" /// the total music def of one movement struct Score { @@ -26,6 +27,8 @@ struct Score { IPointerList staffs_; /// "runtime" fields for setting up spacing + IPointerList rcols_; + IPointerList cols_; PScore *pscore_p_; diff --git a/lily/include/staff-column.hh b/lily/include/staff-column.hh index 2aa4b8166b..b0624664be 100644 --- a/lily/include/staff-column.hh +++ b/lily/include/staff-column.hh @@ -6,7 +6,8 @@ #ifndef STAFFCOLUMN_HH #define STAFFCOLUMN_HH -#include "proto.hh" + +#include "lily-proto.hh" #include "varray.hh" #include "moment.hh" @@ -20,18 +21,18 @@ public: Array musicalreq_l_arr_; Array commandreq_l_arr_; Staff * staff_l_; - + Request_column * req_col_l_; /// fields to collect timing data vertically. Array timing_req_l_arr_; - Score_column *musical_column_l_, *command_column_l_; /* *************** */ - - Staff_column(); + Staff_column(); + Score_column* command_column_l(); + Score_column* musical_column_l(); Moment when() const; - void set_cols(Score_column *c1, Score_column *c2); - void add(Voice_element*ve, PQueue &subtle_req_pq ); + void set_req_col(Request_column *c1); + void add_reqs (Array req_l_arr); void OK() const; ~Staff_column(); void typeset_breakable_items(Array &pre_p_arr, diff --git a/lily/include/staff.hh b/lily/include/staff.hh index 2ceeb237fd..e0613136f2 100644 --- a/lily/include/staff.hh +++ b/lily/include/staff.hh @@ -17,15 +17,12 @@ class Staff { Staff(const Staff&src); - /// synchronous horizontal stuff - IPointerList voice_list_; - Staff_column *get_col(Moment, PCursor * last= 0); - public: Input_register * ireg_p_; + PointerList voice_list_; /// runtime field - IPointerList cols_; + PointerList cols_; Score *score_l_; PScore *pscore_l_; @@ -35,20 +32,15 @@ public: void add(const PointerList &s); - void add_voice(Voice *v); + void add_voice(Voice *v_p); Paper_def*paper()const; - void setup_staffcols(); - void OK() const; void print() const; /// when does the last *musical* element finish? Moment last() const; -// /// extract midi info -// Midi_track* midi_track_p(); - /// remove unused cols void clean_cols() ; Staff(); @@ -56,6 +48,7 @@ public: virtual void set_output(PScore * destination)=0; virtual Staff_walker *get_walker_p()=0; virtual ~Staff() { } + void add_col(Staff_column*); protected: }; diff --git a/lily/include/voice-element.hh b/lily/include/voice-element.hh index 29a41d4658..b1087e41b7 100644 --- a/lily/include/voice-element.hh +++ b/lily/include/voice-element.hh @@ -24,7 +24,7 @@ public: Voice_element */ Moment duration_; Voice const *voice_C_; - IPointerList reqs; + IPointerList req_p_list_; /* *************** */ void transpose(Melodic_req const &)const; diff --git a/lily/include/voice.hh b/lily/include/voice.hh index f5a950a2c9..5ddcc91933 100644 --- a/lily/include/voice.hh +++ b/lily/include/voice.hh @@ -18,8 +18,8 @@ struct Voice { /** the elements, earliest first. Please use the member #add()# to add a new element */ - IPointerList elts; - Moment start; + IPointerList elts_; + Moment start_; /* *************** */ Voice(); diff --git a/lily/input-music.cc b/lily/input-music.cc index 9ba6838179..840b180c34 100644 --- a/lily/input-music.cc +++ b/lily/input-music.cc @@ -8,7 +8,7 @@ void Input_music::check_plet(Voice_element* velt_l) { - for (iter_top(velt_l->reqs,i); i.ok(); i++) + for (iter_top(velt_l->req_p_list_,i); i.ok(); i++) if ( i->plet() ) { Moment start_moment = 0; if ( !find_plet_start_b( i->plet()->type_c_, start_moment ) ) { @@ -42,7 +42,7 @@ Simple_music::length()const void Simple_music::translate_time(Moment t) { - voice_.start += t; + voice_.start_ += t; } Voice_list @@ -50,12 +50,14 @@ Simple_music::convert()const { Voice_list l; Voice * v_p = new Voice(voice_); - PCursor i= v_p->elts.bottom(); - // need-to-have, otherwise memory will be filled up with regs. + PCursor i= v_p->elts_.bottom(); + if (!i.ok() || i->duration_) { v_p->add ( new Voice_element); - i=v_p->elts.bottom(); + i=v_p->elts_.bottom(); } + + // need-to-have, otherwise memory will be filled up with regs. i->add(new Terminate_voice_req); l.bottom().add(v_p); return l; @@ -271,6 +273,6 @@ void Voice_list::translate_time(Moment x) { for (iter_top(*this,i); i.ok(); i++) - i->start += x; + i->start_ += x; } diff --git a/lily/input-score.cc b/lily/input-score.cc index a2dacc048e..7c0c92abd9 100644 --- a/lily/input-score.cc +++ b/lily/input-score.cc @@ -13,7 +13,7 @@ #include "score.hh" #include "paper-def.hh" #include "midi-def.hh" -#include "staff.hh" + void diff --git a/lily/key-item.cc b/lily/key-item.cc index 1054fc2c73..5de86a91a0 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -24,7 +24,7 @@ Key_item::read(Key_register const & key_reg_r) const Array &idx_arr =key_reg_r.accidental_idx_arr_; for (int i = 0 ; i< idx_arr.size(); i++) { int note = idx_arr[i]; - int acc = key_reg_r.key_.oct(0).acc(note); + int acc = ((Key &) key_reg_r.key_).oct(0).acc(note); add(note, acc); } diff --git a/lily/key-reg.cc b/lily/key-reg.cc index dbff99f0a1..82b196e2c7 100644 --- a/lily/key-reg.cc +++ b/lily/key-reg.cc @@ -16,6 +16,7 @@ #include "musical-request.hh" #include "local-key-item.hh" #include "bar.hh" +#include "time-description.hh" Key_register::Key_register() { @@ -65,8 +66,8 @@ Key_register::process_requests() void Key_register::pre_move_processing() { - - if (! default_key_b_ && ! change_key_b_ ) { + Time_description const * time_C_ = get_staff_info().time_C_; + if ( time_C_->whole_in_measure_&& default_key_b_ && ! change_key_b_ ) { delete kit_p_ ; kit_p_ =0; } @@ -90,7 +91,7 @@ Key_register::read_req(Key_change_req * r) accidental_idx_arr_.set_size(0); for (int i = 0; i < r->melodic_p_arr_.size(); i ++) { Melodic_req * m_l =r->melodic_p_arr_[i]; - int n_i=m_l->notename_i_; + int n_i =m_l->notename_i_; int a_i = m_l->accidental_i_; int o_i = m_l->octave_i_; if (r->multi_octave_b_) diff --git a/lily/key.cc b/lily/key.cc index 0f02ef845d..5abfc51393 100644 --- a/lily/key.cc +++ b/lily/key.cc @@ -22,17 +22,12 @@ Key::oct(int i) return octaves[i+ZEROOCTAVE]; } -Octave_key -Key::oct(int i)const -{ - return octaves[i+ZEROOCTAVE]; -} void Octave_key::set(int i, int a) { assert(a > -3 && a < 3); - accidental_i_arr_[i]=a; + accidental_i_arr_[i]=a; } void diff --git a/lily/lexer.l b/lily/lexer.l index 81dc336101..3a5631770c 100644 --- a/lily/lexer.l +++ b/lily/lexer.l @@ -68,7 +68,7 @@ COMMENT %.*\n -include { +\\include { yy_push_state(incl); } {WHITE}* { /* eat the whitespace */ } @@ -283,10 +283,12 @@ My_lily_lexer::scan_escaped_word(String str) yylval.id = id; return id->token_code_i_; } + mtor << "(string)"; String *sp = new String( str); yylval.string=sp; return STRING; } + int My_lily_lexer::scan_bare_word(String str) { diff --git a/lily/linespace.cc b/lily/linespace.cc index 3d8637b6dc..4f3f69a62e 100644 --- a/lily/linespace.cc +++ b/lily/linespace.cc @@ -190,12 +190,14 @@ Spacing_problem::solve() const return posns; } -/* +/** add one column to the problem. */ void Spacing_problem::add_column(PCol const *col, bool fixed, Real fixpos) { + if (!col->used_b() ) + return; Colinfo c(col,(fixed)? &fixpos : 0); cols.push(c); } diff --git a/lily/local-key-reg.cc b/lily/local-key-reg.cc index 6af18c1c8b..84ec5baf69 100644 --- a/lily/local-key-reg.cc +++ b/lily/local-key-reg.cc @@ -27,6 +27,7 @@ Local_key_register::pre_move_processing() key_item_p_ = 0; } } + void Local_key_register::acknowledge_element(Staff_elem_info info) { @@ -48,12 +49,16 @@ Local_key_register::acknowledge_element(Staff_elem_info info) local_key_.oct(note_l_->octave_i_) .set(note_l_->notename_i_, note_l_->accidental_i_); } - } else if (info.elem_l_->name()==Key_item::static_name()) { + } else if (info.req_l_->command() && info.req_l_->command()->keychange()) { Key_register * key_reg_l = (Key_register*)info.origin_reg_l_arr_[0]; key_C_ = &key_reg_l->key_; local_key_ = *key_C_; - } + } else if (info.elem_l_->name() == Key_item::static_name()) { + Key_register * key_reg_l = + (Key_register*)info.origin_reg_l_arr_[0]; + key_C_ = &key_reg_l->key_; + } } void @@ -61,11 +66,12 @@ Local_key_register::process_requests() { Time_description const * time_C_ = get_staff_info().time_C_; if (! time_C_->whole_in_measure_){ - if (key_C_) + if (key_C_) local_key_= *key_C_; else if( time_C_->when_ >Moment(0)) warning ("Help me! can't figure current key"); } } + IMPLEMENT_STATIC_NAME(Local_key_register); ADD_THIS_REGISTER(Local_key_register); diff --git a/lily/midi-output.cc b/lily/midi-output.cc index c239e82af5..7703f65a6c 100644 --- a/lily/midi-output.cc +++ b/lily/midi-output.cc @@ -6,7 +6,6 @@ (c) 1997 Han-Wen Nienhuys , Jan Nieuwenhuizen */ -// "" huh? #include "time.h" #include "main.hh" #include "source.hh" @@ -25,7 +24,7 @@ #include "midi-item.hh" #include "staff-column.hh" #include "musical-request.hh" - +#include "p-score.hh" Midi_output::Midi_output(Score* score_l, Midi_def* midi_l ) { @@ -101,6 +100,7 @@ Midi_output::header() // ugh, to please lily when reparsing mi2mu output. // lily currently barfs when no meter present. + /* are you sure? init is to 4/4 HWN */ Midi_time midi_time( 4, 4, 18 ); midi_track.add( Moment( 0.0 ), &midi_time ); diff --git a/lily/midi-walker.cc b/lily/midi-walker.cc index a024458349..3f24638236 100644 --- a/lily/midi-walker.cc +++ b/lily/midi-walker.cc @@ -29,9 +29,13 @@ Midi_walker::Midi_walker(Staff *st_l, Midi_track* track_l) void Midi_walker::do_stop_notes(Moment max_moment) { - while (stop_notes.size() && stop_notes.front_idx() <= max_moment) { - Moment stop_moment = stop_notes.front_idx(); - Melodic_req * req_l = stop_notes.get(); + while (stop_notes.size() && stop_notes.front().key <= max_moment) { + Note_event ent=stop_notes.get(); + if (ent.ignore_b_) + continue; + + Moment stop_moment = ent.key; + Melodic_req * req_l = ent.val; Midi_note note(req_l, track_l_->number_i_, false); output_event(note, stop_moment); @@ -43,21 +47,23 @@ Midi_walker::do_stop_notes(Moment max_moment) void Midi_walker::do_start_note(Note_req*note_l) { - Moment stop=note_l->duration() + ptr()->when(); - for(int i=0; i < stop_notes.size(); i++) - if (stop_notes.value_arr_[i]->melodic()->pitch() == + Moment stop = note_l->duration() + ptr()->when(); + for(int i=0; i < stop_notes.size(); i++) { + if (stop_notes[i].val->melodic()->pitch() == note_l->pitch()) { - if ( stop_notes.indices_arr_[i] < stop){ - - stop_notes.del(i); - return ; // removing this gives a feature ( ${c2 c4}$ output correctly) - } - else - return; // skip the stop note - break;// do the stop note + if ( stop_notes[i].key < stop){ + stop_notes[i].ignore_b_=true; + } + else + return; // skip the stop note } + } + Note_event e; + e.val = note_l; + e.key = stop; + + stop_notes.insert(e); - stop_notes.enter(note_l, stop); Midi_note note(note_l, track_l_->number_i_, true); output_event(note, ptr()->when()); } @@ -94,7 +100,6 @@ Midi_walker::process_requests() } for ( int i = 0; i < ptr()->musicalreq_l_arr_.size(); i++ ) { - Rhythmic_req *n = ptr()->musicalreq_l_arr_[i]->rhythmic(); if ( !n) continue; @@ -102,7 +107,6 @@ Midi_walker::process_requests() if (!note_l) continue; do_start_note(note_l); - } } @@ -110,3 +114,10 @@ Midi_walker::~Midi_walker() { do_stop_notes( last_moment_ + Moment(10,1)); // ugh } + + +int +compare(Note_event const&e1, Note_event const&e2) +{ + return sign(e1.key - e2.key); +} diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index f1f7cb0cfd..8e14e791d2 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -32,6 +32,7 @@ static Keyword_ent the_key_tab[]={ {"geometric", GEOMETRIC}, {"hshift", HSHIFT}, {"in", IN_T}, + {"init_end", INIT_END}, {"inputregister", INPUT_REGS}, {"lyric", LYRIC}, {"key", KEY}, diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index ce375484ed..73761360f9 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -49,24 +49,24 @@ My_lily_parser::print_declarations() #endif } +void +My_lily_parser::do_init_file() +{ + init_parse_b_ = true; + set_debug(); + lexer_p_->new_input(init_str_, source_l_); +} + void My_lily_parser::parse_file(String init, String s) { *mlog << "Parsing ... "; lexer_p_ = new My_lily_lexer; - - set_debug(); - init_parse_b_ = true; - - lexer_p_->new_input(init, source_l_); - do_yyparse(); - print_declarations(); - - init_parse_b_ = false; - set_debug(); + init_str_ = init; + lexer_p_->new_input(s, source_l_); do_yyparse(); - + print_declarations(); if(!define_spot_array_.empty()) warning("Braces don't match."); @@ -227,6 +227,7 @@ My_lily_parser::get_parens_request(char c) My_lily_parser::My_lily_parser(Sources * source_l) { + first_b_ = true; source_l_ = source_l; lexer_p_ = 0; default_duration_.type_i_ = 4; diff --git a/lily/parser.y b/lily/parser.y index 3d6f86b57c..fdde1c198e 100644 --- a/lily/parser.y +++ b/lily/parser.y @@ -1,7 +1,7 @@ %{ // -*-Fundamental-*- #include -#define MUDELA_VERSION "0.0.52" +#define MUDELA_VERSION "0.0.53" #include "script-def.hh" #include "symtable.hh" @@ -83,6 +83,12 @@ yylex(YYSTYPE *s, void * v_l) { My_lily_parser *pars_l = (My_lily_parser*) v_l; My_lily_lexer * lex_l = pars_l->lexer_p_; + + if (pars_l->first_b_) { + pars_l->first_b_ = false; + pars_l->do_init_file(); + } + lex_l->lexval_l = (void*) s; return lex_l->yylex(); } @@ -108,6 +114,7 @@ yylex(YYSTYPE *s, void * v_l) %token INPUT_REGS %token HSHIFT %token IN_T +%token INIT_END %token LYRIC %token KEY %token MELODIC @@ -216,8 +223,15 @@ mudela: /* empty */ | mudela error | mudela check_version { } | mudela add_notenames { } + | mudela init_end {} ; +init_end: INIT_END ';' { + THIS->print_declarations(); + THIS->init_parse_b_ = false; + THIS->set_debug(); + } + ; check_version: VERSION STRING ';' { if (*$2 != MUDELA_VERSION) { diff --git a/lily/pulk-voice.cc b/lily/pulk-voice.cc new file mode 100644 index 0000000000..31e931a9f3 --- /dev/null +++ b/lily/pulk-voice.cc @@ -0,0 +1,76 @@ +/* + pulk-voices.cc -- implement Pulk_voice + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ +#include "pulk-voice.hh" +#include "voice.hh" +#include "musical-request.hh" +#include "voice-element.hh" + +Pulk_voice::Pulk_voice(Voice*voice_l, int idx) + : cur_(voice_l->elts_) +{ + elt_mom_ = voice_l->start_; + staff_idx_= idx; + set_subtle(); +} + +Array +Pulk_voice::get_req_l_arr() return req_l_arr; +{ + Moment w = when(); + do { + Moment sub = subtle_moment_priorities_[subtle_idx_]; + for (PCursor i(cur_->req_p_list_); i.ok(); i++) { + Musical_req* m_l = i->musical(); + if (!sub) { + if (!(m_l && m_l->subtle() && m_l->subtle()->subtime_ )) + req_l_arr.push(i); + } else { + if (m_l && m_l->subtle() && m_l->subtle()->subtime_ == sub) + req_l_arr.push(i); + } + } + next(); + } while ( ok() && when () == w); +} + +void +Pulk_voice::set_subtle() +{ + subtle_idx_ =0; + + subtle_moment_priorities_.set_size(0); + if (!cur_.ok()) + return; + for (PCursor i(cur_->req_p_list_); i.ok(); i++) { + Musical_req* m_l = i->musical(); + if (m_l&&m_l->subtle()){ + Moment sub = m_l->subtle()->subtime_; + subtle_moment_priorities_.insert(sub); + } else { + subtle_moment_priorities_.insert(0); + } + } +} + +void +Pulk_voice::next() +{ + assert(ok()); + subtle_idx_++; + if (subtle_idx_ == subtle_moment_priorities_.size()) { + elt_mom_ += cur_->duration_; + cur_ ++; + set_subtle(); + } +} + +Moment +Pulk_voice::when()const +{ + return elt_mom_ + subtle_moment_priorities_[subtle_idx_]; +} diff --git a/lily/pulk-voices.cc b/lily/pulk-voices.cc new file mode 100644 index 0000000000..63462ca1d3 --- /dev/null +++ b/lily/pulk-voices.cc @@ -0,0 +1,84 @@ +/* + pulk-voices.cc -- implement Pulk_voices + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "pulk-voice.hh" +#include "pulk-voices.hh" +#include "staff.hh" +#include "voice.hh" +#include "request-column.hh" +#include "debug.hh" + +Pulk_voices::Pulk_voices(PointerList const& l) + : staff_l_list_(l) +{ + int staff_i = 0; + last_= 0; + Moment min_staff_last_mom=1e8; // UGH + for (iter_top(l, i); i.ok(); i++, staff_i++) { + Moment staff_last=0; + for (iter_top(i->voice_list_,j); j.ok(); j++) { + if (j->elts_.size()) { + staff_last = staff_last >? j->last(); + voice_pq_.insert(Voice_l(j, staff_i)); + } + } + min_staff_last_mom = min_staff_last_mom ? staff_last; + } + next_mom_ = voice_pq_.front().l_->start_; + + + if (last_ != min_staff_last_mom) + warning("Not all staffs end simultaneously"); +} + +void +Pulk_voices::get_aligned_request(Request_column* col_l) +{ + while (voice_pq_.size() && voice_pq_.front().l_->start_ == next_mom_) { + Voice_l v = voice_pq_.get(); + pulk_p_list_.bottom().add( new Pulk_voice ( v.l_, v.staff_idx_ )); + } + + /* hairy. #i# is a cursor which points to Pulk_voice (which a + cursor, essentially) */ + + Moment new_next_mom = last_; + iter(pulk_p_list_.top() , i); + while ( i.ok() ) { + mtor << "considering staff"<< i->staff_idx_ << "at " << i->when() << "\n"; + assert (i->when() >= next_mom_); + if (i->when() == next_mom_) { + col_l->add_reqs(i->staff_idx_, i->get_req_l_arr() ); + + if (!i->ok()) { + i.del(); + continue; + } + } + new_next_mom = new_next_mom when(); + i++; + } + + if (voice_pq_.size() ) + new_next_mom = new_next_mom start_; + next_mom_ = new_next_mom; +} + + +bool +Pulk_voices::ok() const +{ + return pulk_p_list_.size() || voice_pq_.size(); +} + +int compare(Voice_l const& v1, Voice_l const& v2) +{ + return sign(v1.l_->start_ - v2.l_->start_); +} + diff --git a/lily/request-column.cc b/lily/request-column.cc new file mode 100644 index 0000000000..4fd9d53ab9 --- /dev/null +++ b/lily/request-column.cc @@ -0,0 +1,53 @@ +/* + request-column.cc -- implement Request_column + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ +#include "score-column.hh" +#include "request-column.hh" +#include "staff-column.hh" +#include "staff.hh" + +Moment +Request_column::when() +{ + + return(command_column_l_)? command_column_l_->when(): musical_column_l_->when(); +} + +void +Request_column::add_reqs(int idx , Array const & req_l_arr) +{ + staff_col_l_arr_[idx]->add_reqs(req_l_arr); +} + +Request_column::Request_column(PointerList const& list ) +{ + musical_column_l_ = command_column_l_ =0; + iter(list.top(), j); + for (int i=0; i < list.size(); i++,j++) { + Staff_column * col_p = new Staff_column; + col_p->set_req_col(this); + staff_col_l_arr_.push(col_p); + staff_cols_.bottom().add(col_p); + j->add_col(col_p); + } +} +void +Request_column::set_score_cols(Score_column* c1, Score_column *c2) +{ + command_column_l_ = c1; + musical_column_l_ = c2; +} +bool +Request_column::used_b() const +{ + bool b = false; + if (command_column_l_) + b |= command_column_l_->used_b(); + if (musical_column_l_) + b |= command_column_l_->used_b(); + return b; +} diff --git a/lily/score-walker.cc b/lily/score-walker.cc index 6d6aed4743..0354cdceaa 100644 --- a/lily/score-walker.cc +++ b/lily/score-walker.cc @@ -24,10 +24,6 @@ Score_walker::Score_walker(Score *s) walker_p_arr_.push(w_p); } - if(ok()) { - s->find_col(0, false)->set_breakable(); - s->find_col(s->last(), false)->set_breakable(); - } reinit(); breaks_i_=0; } @@ -115,7 +111,6 @@ Score_walker::~Score_walker() *mlog << "[" <find_col(score_l_->last(), true)->used_b()); } diff --git a/lily/score.cc b/lily/score.cc index 88f7dee6df..30514a7c5f 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -18,6 +18,8 @@ #include "score-walker.hh" #include "midi-output.hh" #include "midi-def.hh" +#include "pulk-voices.hh" +#include "request-column.hh" extern String default_out_fn; @@ -25,13 +27,33 @@ void Score::setup_music() { *mlog << "\nSetting up music ..." << flush; - if (last() == Moment(0)) { + + Pulk_voices pulk(staffs_); + + Moment l_mom = pulk.last_; + if (l_mom == Moment(0)) { errorlevel_i_ |= 1; input_.error("Need to have music in a score."); } - - for (iter_top(staffs_,i); i.ok(); i++) { - i->setup_staffcols(); + + while (pulk.ok()) { + Moment w= pulk.next_mom(); + Request_column* rcol_p = new Request_column( staffs_ ); + + Score_column* c1 = new Score_column(w); + Score_column* c2 = new Score_column(w); + if (w == Moment(0) || w == l_mom) { + c1->set_breakable(); + } + + c1->musical_b_ = false; + c2->musical_b_ = true; + + cols_.bottom().add(c1); + cols_.bottom().add(c2); + rcol_p->set_score_cols(c1, c2); + rcols_.bottom().add(rcol_p); + pulk.get_aligned_request( rcol_p ); } } @@ -60,9 +82,6 @@ Score::paper() return; pscore_p_ = new PScore(paper_p_); - - find_col(0, false)->set_breakable(); // ugh - find_col(last(), false)->set_breakable(); do_cols(); for (iter_top(staffs_,i); i.ok(); i++) @@ -90,9 +109,18 @@ Score::paper() void Score::clean_cols() { +#if 1 for (iter_top(staffs_,i); i.ok(); i++) i->clean_cols(); + for (iter_top(rcols_,i); i.ok(); i++) { + if (!i->command_column_l_->used_b()) { + i->command_column_l_ = 0; + } + if (!i->musical_column_l_->used_b()) + i->musical_column_l_ = 0; + } + for (iter_top(cols_,c); c.ok(); ) { if (!c->pcol_l_->used_b()) { delete c.remove_p(); @@ -101,44 +129,7 @@ Score::clean_cols() c++; } } -} - -/** Create columns at time #w#. This sux. We should have - Score_column create the appropriate PCol. Unfortunately, PCols - don't know about their position. - - @return cursor pointing to the nonmusical (first) column */ -PCursor -Score::create_cols(Moment w, PCursor &i) -{ - Score_column* c1 = new Score_column(w); - Score_column* c2 = new Score_column(w); - - c1->musical_b_ = false; - c2->musical_b_ = true; - - if (i.ok()) { - i --; - } - if ( !i.ok() ) { - i = cols_.top(); - } - for (; i.ok(); i++) { - if (i->when() > w) - break; - } - - if (!i.ok()) { - cols_.bottom().add(c1); - cols_.bottom().add(c2); - i = cols_.bottom(); - i --; - } else { - i.insert(c1); - i.insert(c2); - i -= 2; - } - return i; +#endif } PCursor @@ -152,9 +143,7 @@ Score::find_col(Moment w, bool mus) if (i->when() > w) break; } - i = create_cols(w,i); - if (mus) - i++; + assert(false); return i; } diff --git a/lily/staff-column.cc b/lily/staff-column.cc index 96c837fb57..31454230ce 100644 --- a/lily/staff-column.cc +++ b/lily/staff-column.cc @@ -18,30 +18,27 @@ #include "p-score.hh" #include "item.hh" #include "p-col.hh" -#include "voice-element.hh" -#include "pqueue.hh" +#include "request-column.hh" void Staff_column::OK() const { #ifndef NDEBUG - assert (command_column_l_->when() == musical_column_l_->when()); + #endif } Moment Staff_column::when() const { - return (command_column_l_)? - command_column_l_->when(): - musical_column_l_->when(); + return req_col_l_->when(); } void -Staff_column::add(Voice_element*ve, - PQueue &subtle_req_pq ) +Staff_column::add_reqs(Array req_l_arr) { - for (iter_top(ve->reqs,j); j.ok(); j++) { + for (int i=0; i < req_l_arr.size(); i++) { + Request * j = req_l_arr[i]; if (j->command()) { Command_req * c_l = j->command(); if (c_l->timing()) { @@ -51,20 +48,15 @@ Staff_column::add(Voice_element*ve, creationreq_l_arr_.push(c_l); else if (!c_l->barcheck() && !c_l->partial() && !c_l->measuregrouping()) - setup_one_request(j); // no need to bother children + setup_one_request(j); } else { if (j->rhythmic()) { - musical_column_l_->add_duration(j->rhythmic()->duration()); + req_col_l_->musical_column_l_->add_duration(j->rhythmic()->duration()); } if (j->musical()) { Musical_req*m = j->musical(); if(m->skip()) continue; - Subtle_req * s = m->subtle() ; - if (s&& s->subtime_) { - subtle_req_pq.enter(s, s->subtime_ + when()); - continue ; - } } setup_one_request(j); } @@ -73,8 +65,6 @@ Staff_column::add(Voice_element*ve, Staff_column::Staff_column() { - musical_column_l_ = 0; - command_column_l_ = 0; staff_l_ = 0; } @@ -86,10 +76,9 @@ Staff_column::~Staff_column() } void -Staff_column::set_cols(Score_column*c1, Score_column*c2) +Staff_column::set_req_col(Request_column *col_l) { - command_column_l_ = c1; - musical_column_l_ = c2; + req_col_l_ = col_l; } void @@ -105,8 +94,8 @@ void Staff_column::typeset_musical_item(Item*i) { assert(i); - Score_column * scorecolumn_l = musical_column_l_; - musical_column_l_->pcol_l_->pscore_l_->typeset_item(i, scorecolumn_l->pcol_l_, + Score_column * scorecolumn_l = req_col_l_->musical_column_l_; + scorecolumn_l->pcol_l_->pscore_l_->typeset_item(i, scorecolumn_l->pcol_l_, staff_l_->pstaff_l_); } @@ -147,8 +136,9 @@ Staff_column::typeset_breakable_items(Array &pre_p_arr, Array &nobreak_p_arr, Array &post_p_arr) { - PCol * c= command_column_l_->pcol_l_; - PScore *ps_l=command_column_l_->pcol_l_->pscore_l_; + Score_column * scol_l= req_col_l_->command_column_l_; + PCol * c= scol_l->pcol_l_; + PScore *ps_l=scol_l->pcol_l_->pscore_l_; if (!c->breakable_b()) { for (int i =0; i < pre_p_arr.size(); i++) @@ -180,3 +170,15 @@ Staff_column::typeset_breakable_items(Array &pre_p_arr, post_p_arr.set_size(0); nobreak_p_arr.set_size(0); } + +Score_column* +Staff_column::command_column_l() +{ + return req_col_l_->command_column_l_; +} + +Score_column* +Staff_column::musical_column_l() +{ + return req_col_l_->musical_column_l_; +} diff --git a/lily/staff-info.cc b/lily/staff-info.cc index b2b1e72504..e86900bb07 100644 --- a/lily/staff-info.cc +++ b/lily/staff-info.cc @@ -41,13 +41,13 @@ Staff_info::column_l() Score_column* Staff_info::musical_l() { - return column_l() -> musical_column_l_; + return column_l() -> musical_column_l(); } Score_column* Staff_info::command_l() { - return column_l() -> command_column_l_; + return column_l() -> command_column_l(); } PCol* Staff_info::command_pcol_l() diff --git a/lily/staff.cc b/lily/staff.cc index d9623fe436..a533c32f1a 100644 --- a/lily/staff.cc +++ b/lily/staff.cc @@ -16,7 +16,6 @@ #include "debug.hh" #include "musical-request.hh" #include "command-request.hh" // todo -#include "pqueue.hh" void @@ -35,6 +34,7 @@ Staff::paper() const void Staff::clean_cols() { +#if 0 // TODO iter_top(cols_,i); for(; i.ok(); ){ if (!i->musical_column_l_->used_b()) @@ -47,83 +47,9 @@ Staff::clean_cols() else i++; } +#endif } -Staff_column * -Staff::get_col(Moment w, PCursor *last) -{ - iter_top(cols_,i); - if (last && last->ok() && (*last)->when() <= w) - i = *last; - - for (; i.ok(); i++) { - if (i->when() == w) { - if (last) - *last = i; - return i; - } else if (i->when() > w) - break; - } - - - PCursor scorecolumns(score_l_->find_col(w, false)); - Staff_column* staffcolumn_p = new Staff_column; - staffcolumn_p->staff_l_ = this; - Score_column* comcol_l = scorecolumns++; - staffcolumn_p->set_cols(comcol_l, scorecolumns); - - if (!i.ok()) { - cols_.bottom().add( staffcolumn_p); - i = cols_.bottom(); - } else { - i.insert(staffcolumn_p); - i--; - } - if (last) - *last = i; - return i; -} - -/** put all stuff grouped vertically in the Staff_cols. Do the - preprarations for walking the cols. not virtual */ -void -Staff::setup_staffcols() -{ - PQueue subtle_req_pq; - PCursor last(cols_); - - for (iter_top(voice_list_,i); i.ok(); i++) { - Moment now = i->start; - iter_top(i->elts,j); - while( j.ok()) { - - Moment next = now; - if (subtle_req_pq.size()) - next = next when()) { - s_l->setup_one_request(subtle_req_pq.get()); // ugh! - } - if(next == now) { - s_l->add(j, subtle_req_pq); - now += j->duration_; - j++; - } - } - - } - last = cols_.top(); - while (subtle_req_pq.size()) { - Moment front =subtle_req_pq.front_idx(); - Staff_column *s_l = get_col(front, &last); - while(subtle_req_pq.size() && subtle_req_pq.front_idx() == front) - s_l->setup_one_request(subtle_req_pq.get()); // ugh! - } - -} void Staff::OK() const @@ -172,3 +98,10 @@ Staff::Staff() pscore_l_ =0; pstaff_l_ =0; } + +void +Staff::add_col(Staff_column*c_l) +{ + cols_.bottom().add(c_l); + c_l->staff_l_ = this; +} diff --git a/lily/template7.cc b/lily/template7.cc new file mode 100644 index 0000000000..793280a024 --- /dev/null +++ b/lily/template7.cc @@ -0,0 +1,14 @@ +#/* + template7.cc -- instantiate Request_column + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "staff-column.hh" +#include "request-column.hh" +#include "plist.tcc" +#include "pcursor.tcc" + +IPL_instantiate(Request_column); diff --git a/lily/template8.cc b/lily/template8.cc new file mode 100644 index 0000000000..09da3b6ec7 --- /dev/null +++ b/lily/template8.cc @@ -0,0 +1,6 @@ +#include "pulk-voice.hh" + +#include "plist.tcc" +#include "pcursor.tcc" + +IPL_instantiate(Pulk_voice); diff --git a/lily/voice-element.cc b/lily/voice-element.cc index b499e3d727..03811ff063 100644 --- a/lily/voice-element.cc +++ b/lily/voice-element.cc @@ -18,7 +18,7 @@ void Voice_element::transpose(Melodic_req const&d)const { - for (iter_top(reqs,i); i.ok(); i++) { + for (iter_top(req_p_list_,i); i.ok(); i++) { i->transpose(d); } } @@ -28,7 +28,7 @@ Voice_element::print() const { #ifndef NPRINT mtor << "voice_element { dur :"<< duration_ <<"\n"; - for (iter_top(reqs,rc); rc.ok(); rc++) { + for (iter_top(req_p_list_,rc); rc.ok(); rc++) { rc->print(); } mtor << "}\n"; @@ -44,7 +44,7 @@ Voice_element::add(Request*r) } r->elt_l_ = this; - reqs.bottom().add(r); + req_p_list_.bottom().add(r); } @@ -59,7 +59,7 @@ Voice_element::Voice_element(Voice_element const&src) { voice_C_=0; - for (iter_top(src.reqs, i); i.ok(); i++) + for (iter_top(src.req_p_list_, i); i.ok(); i++) add(i->clone()); } @@ -68,7 +68,7 @@ Voice_element::find_plet_start_b(char c, Moment& moment_r)// b unused? { assert( c == ']' ); moment_r += duration_; - for ( PCursor i( reqs.top() ); i.ok(); i++ ) { + for ( PCursor i( req_p_list_.top() ); i.ok(); i++ ) { if (i->beam() && i->beam()->spantype == Span_req::START ) return true; } @@ -78,7 +78,7 @@ Voice_element::find_plet_start_b(char c, Moment& moment_r)// b unused? void Voice_element::set_default_group(String s) { - for (iter_top(reqs, i); i.ok(); i++) + for (iter_top(req_p_list_, i); i.ok(); i++) if (i->command() &&i->command()->groupchange()) return ; Group_change_req *greq = new Group_change_req; @@ -93,7 +93,7 @@ Voice_element::set_plet_backwards(Moment& now_moment_r, now_moment_r += duration_; if ( now_moment_r > until_moment ) return; - for ( PCursor i( reqs.top() ); i.ok(); i++ ) { + for ( PCursor i( req_p_list_.top() ); i.ok(); i++ ) { if (i->beam() && i->beam()->spantype == Span_req::START ) i->beam()->nplet = den_i; if (i->rhythmic()) { diff --git a/lily/voice.cc b/lily/voice.cc index a5e10f7fd9..9b10dfcd25 100644 --- a/lily/voice.cc +++ b/lily/voice.cc @@ -19,20 +19,20 @@ void Voice::transpose(Melodic_req const & d)const { - for (iter_bot(elts, i); i.ok(); i--) + for (iter_bot(elts_, i); i.ok(); i--) i->transpose(d); } void Voice::set_default_group(String s) { - elts.top()->set_default_group(s); + elts_.top()->set_default_group(s); } bool Voice::find_plet_start_b(char c, Moment& moment_r) { - for (iter_bot(elts, i); i.ok(); i--) + for (iter_bot(elts_, i); i.ok(); i--) if ( i->find_plet_start_b(c, moment_r) ) return true; return false; @@ -42,7 +42,7 @@ void Voice::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i) { - for (iter_bot(elts, i); i.ok(); i--) + for (iter_bot(elts_, i); i.ok(); i--) if ( now_moment_r <= until_moment ) i->set_plet_backwards(now_moment_r, until_moment, num_i, den_i); else @@ -51,43 +51,46 @@ Voice::set_plet_backwards(Moment& now_moment_r, Moment until_moment, Voice::Voice(Voice const&src) { - for (iter_top(src.elts, i); i.ok(); i++) + for (iter_top(src.elts_, i); i.ok(); i++) add(new Voice_element(**i)); - start = src.start; + start_ = src.start_; } Voice::Voice() { - start = 0; + start_ = 0; } void Voice::add(Voice_element*v) { v->voice_C_ = this; - elts.bottom().add(v); + elts_.bottom().add(v); } void Voice::print() const { #ifndef NPRINT - mtor << "Voice { start: "<< start<print(); mtor << "}\n"; #endif } +/** + @return The moment at which last element stops. + */ Moment Voice::last() const { Moment l =0; - if (elts.size()) - l = start; + if (elts_.size()) + l = start_; - for (iter_top(elts,i); i.ok(); i++) + for (iter_top(elts_,i); i.ok(); i++) l += i->duration_; return l; } diff --git a/make/Makefile b/make/Makefile index c0b3f8f25d..d02cd493bb 100644 --- a/make/Makefile +++ b/make/Makefile @@ -19,8 +19,11 @@ NAME = make # list of distribution files: -# -EXTRA_DISTFILES = Configure_variables.make.in lilypond.spec.in Toplevel.make.in lilypond.lsm.in $(outdir)/lilypond.spec + +# two outdir files are distributed, since they make sense to have without running +# configure and make. +EXTRA_DISTFILES = Configure_variables.make.in lilypond.spec.in Toplevel.make.in \ + lilypond.lsm.in $(outdir)/lilypond.spec $(outdir)/lilypond.lsm # # generic variables: @@ -37,6 +40,13 @@ include ./$(depth)/make/Rules.make spec: $(outdir)/lilypond.spec -rpm-docs=$(addprefix Documentation/out/, $(notdir $(shell ls $(depth)/Documentation/$(outdir)/*.text))) +rpmdocs=$(addprefix Documentation/out/, $(notdir $(shell ls $(depth)/Documentation/$(outdir)/*.text))) +sed-version= sed 's!@TOPLEVEL_VERSION@!${TOPLEVEL_VERSION}!g' +sed-date=sed 's!@DATE@!${date}!g' +sed-docs=sed 's!@TEXT_DOCS@!${rpmdocs}!g' + $(outdir)/lilypond.spec: lilypond.spec.in $(depth)/.version - cat $< | sed 's/@TOPLEVEL_VERSION@/${TOPLEVEL_VERSION}/g'|sed 's#@TEXT_DOCS@#$(rpm-docs)#g' > $@ + cat $< | $(sed-version) | $(sed-docs) > $@ + +$(outdir)/lilypond.lsm: lilypond.lsm.in $(depth)/.version + cat $< | $(sed-version) | $(sed-date) > $@ diff --git a/make/Variables.make b/make/Variables.make index 07e9b196d0..87656c81b1 100644 --- a/make/Variables.make +++ b/make/Variables.make @@ -96,6 +96,7 @@ DUMMYDEPS=\ ERROR_LOG = 2> /dev/null SILENT_LOG = >& /dev/null allexe = $(lily_bindir)/lilypond $(lily_bindir)/mi2mu +date = $(shell date +%x) allhh := $(shell $(FIND) -name "*.hh" $(ERROR_LOG)) allcc := $(shell $(FIND) -name "*.cc" $(ERROR_LOG)) allobs := $(shell $(FIND) $(outdir) -name "*.o" $(ERROR_LOG)) diff --git a/make/lilypond.lsm b/make/lilypond.lsm new file mode 100644 index 0000000000..5e09dc7878 --- /dev/null +++ b/make/lilypond.lsm @@ -0,0 +1,21 @@ +[This lsm-entry is not in the LSM yet.] + +Begin3 +Title: LilyPond +Version: 0.0.53 +Entered-date: 04/21/97 +Description: LilyPond is a program which converts a music-script (mudela) into +TeX output, or MIDI to produce multi-staff scores. Features include multiple +meters, clefs, keys, lyrics, versatile input-language, cadenzas +beams, slurs, triplets. +Keywords: music typesetting midi notation +Author: hanwen@stack.nl (Han-Wen Nienhuys) + jan@digicash.com (Jan Nieuwenhuizen) +Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) +Primary-site: pcnov095.win.tue.nl /pub/lilypond/ + 300k lilypond-0.0.53.tar.gz +Alternate-site: +Original-site: +Platform: unix/win32, GNU C++ +Copying-policy: GPL +End diff --git a/make/lilypond.lsm.in b/make/lilypond.lsm.in index 2eee0386f5..47222cc126 100644 --- a/make/lilypond.lsm.in +++ b/make/lilypond.lsm.in @@ -1,3 +1,5 @@ +[This lsm-entry is not in the LSM yet.] + Begin3 Title: LilyPond Version: @TOPLEVEL_VERSION@ @@ -8,6 +10,7 @@ meters, clefs, keys, lyrics, versatile input-language, cadenzas beams, slurs, triplets. Keywords: music typesetting midi notation Author: hanwen@stack.nl (Han-Wen Nienhuys) + jan@digicash.com (Jan Nieuwenhuizen) Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) Primary-site: pcnov095.win.tue.nl /pub/lilypond/ 300k lilypond-@TOPLEVEL_VERSION@.tar.gz diff --git a/make/lilypond.spec b/make/lilypond.spec index 3928426799..bd7f88d2f7 100644 --- a/make/lilypond.spec +++ b/make/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 0.0.52 +Version: 0.0.53 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.0.52.tar.gz +Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.0.53.tar.gz Summary: A preprocessor to make TeX typeset music. URL: http://www.stack.nl/~hanwen/lilypond Packager: Han-Wen Nienhuys @@ -25,7 +25,7 @@ make all strip bin/lilypond bin/mi2mu make prefix="$RPM_BUILD_ROOT/usr" install %files -%doc Documentation/out/CodingStyle.text Documentation/out/INSTALL.text Documentation/out/MANIFESTO.text Documentation/out/error.text Documentation/out/examples.text Documentation/out/faq.text Documentation/out/index.text Documentation/out/language.text Documentation/out/lilygut.text Documentation/out/lilypond.text Documentation/out/mudela.text Documentation/lelie_logo.gif +%doc Documentation/out/AUTHORS.text Documentation/out/CodingStyle.text Documentation/out/INSTALL.text Documentation/out/MANIFESTO.text Documentation/out/convert-mudela.text Documentation/out/error.text Documentation/out/examples.text Documentation/out/faq.text Documentation/out/index.text Documentation/out/language.text Documentation/out/lilygut.text Documentation/out/lilypond.text Documentation/out/mudela.text Documentation/lelie_logo.gif /usr/bin/lilypond /usr/bin/mi2mu /usr/man/man1/lilypond.1 diff --git a/tex/dimen.tex b/tex/dimen.tex index e53263181d..f4aa216f12 100644 --- a/tex/dimen.tex +++ b/tex/dimen.tex @@ -1,4 +1,4 @@ -\font\musicfont=musixsps +\font\musicfont=musix20 \font\slurfont=xslu16 \def\thefont{\musicfont} @@ -46,4 +46,4 @@ \charn -\bye \ No newline at end of file +\bye -- 2.39.2