Dstream 1
File_path 1
-My_lily_lexer 0
+My_lily_lexer 1
PCol 1
Score_column 1
Ineq_constrained_qp 1
# yydebug
InitParser 1
-Parser 0
+Parser 1
InitDeclarations 1
Declarations 1
# FlexLexer debug
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
--- /dev/null
+=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 <hanwen@stack.nl>
+
+Main author, all files files except mentioned below
+
+=item *
+
+Jan Nieuwenhuizen <jan@digicash.com>
+
+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 <matsb@s3.kth.se>, parts of clef-reg.cc, clef-item.cc
+testing, general comments.
+
+=back
resulting binaries can be found in the subdirectory
F<bin/>.
+=head1 INSTALLING
+
+If you have done a successful C<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)
+
=head1 RUNNING
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
--- /dev/null
+=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
+
</a
>
+=item *
+<a href=AUTHORS.html
+>
+AUTHORS
+</a
+>
+
+
=item *
<a href=lilypond.html
>
</a
>
+=item *
+<a href=convert-mudela.html
+>
+The mudela convertor: convert-mudela
+</a
+>
+
+
=item *
<a href=faq.html
>
=head1 AUTHORS
-=over 5
+Please consult the documentation file AUTHORS for more detailed
+information, and small contributions.
+
+=over 4
=item *
Context errors, Lyrics, mi2mu, MIDI stuff, make structure, bits of
FlowerLib, general comments, Mudela design.
-=item *
-
-Mats Bengtsson <matsb@s3.kth.se>, bugfixes, testing, general comments.
-
=back
Your name could be here! If you want to help, then take a look at the
The de-facto extension of Mudela is F<.ly>. Files may be included by
entering C<include> at the start of a line:
- include "a_file.ly"
+ \include "a_file.ly"
=head2 Comments
-17/Apr/97 LilyPond 0.0.52 1
+21/Apr/97 LilyPond 0.0.53 1
-17/Apr/97 LilyPond 0.0.52 2
+21/Apr/97 LilyPond 0.0.53 2
installed. The resulting binaries can be found in the
subdirectory _\bb_\bi_\bn_\b/.
+I\bI\bI\bIN\bN\bN\bNS\bS\bS\bST\bT\bT\bTA\bA\bA\bAL\bL\bL\bLL\bL\bL\bLI\bI\bI\bIN\bN\bN\bNG\bG\bG\bG
+ 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)
+
R\bR\bR\bRU\bU\bU\bUN\bN\bN\bNN\bN\bN\bNI\bI\bI\bIN\bN\bN\bNG\bG\bG\bG
GNU LilyPond does use a lot of resources. For operation
you need the following:
- +\bo A fast computer (a full page of music typically takes 1
- minute on my 486/66, using the -\b-\b-\b--\b-\b-\b-e\be\be\ben\bn\bn\bna\ba\ba\bab\bb\bb\bbl\bl\bl\ble\be\be\be-\b-\b-\b-c\bc\bc\bch\bh\bh\bhe\be\be\bec\bc\bc\bck\bk\bk\bki\bi\bi\bin\bn\bn\bng\bg\bg\bg
+ +\bo A fast computer (a full page of music typically takes
+ 1 minute on my 486/66, using the -\b-\b-\b--\b-\b-\b-e\be\be\ben\bn\bn\bna\ba\ba\bab\bb\bb\bbl\bl\bl\ble\be\be\be-\b-\b-\b-c\bc\bc\bch\bh\bh\bhe\be\be\bec\bc\bc\bck\bk\bk\bki\bi\bi\bin\bn\bn\bng\bg\bg\bg
compile. It's lot slower than most MusiXTeX
preprocessors)
- +\bo TeX
+ +\bo TeX
- +\bo The MusixTeX fonts. (I use those found in MusixTeX T.59)
+ +\bo 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.
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)
-17/Apr/97 LilyPond 0.0.52 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+21/Apr/97 LilyPond 0.0.53 4
+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)
* 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
* figured bass?
- * transposition
-
* rest name configurable
* Raw request syntax
* 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
FUTURE
+ * tie a ~ b, move slur reg into voice-group.
+
* Reg_configure_request
* bring Collision::do_pre_processing to haircutter
EXTRA_DISTFILES = $(SCRIPTS)
#
+
+localinstall: all
+ $(INSTALL) -d $(bindir)
+ $(INSTALL) -m 755 convert-mudela $(bindir)
+
+localuninstall:
+ rm -f $(bindir)/convert-mudela
#!/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
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";
}
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;
print OUTLY;
}
}
-
+sub set_auto_from
+{
+ my ($fn)=@_;
+ my ($ver);
+ open INLY, $fn || die "Can't open";
-sub
- set_files
+ while (<INLY>) {
+ 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 = "-";
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";
}
}
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";
close INLY;
close OUTLY;
+if ($opt_edit) {
+ rename $infile, "$infile~";
+ rename $outfile, "$infile";
+}
+
mv {lilypond-,patch-}*.gz ../
cd ..
tar cf updeet {lily,patch-}*.gz
-
+tar tfv updeet
mv patch-*gz patches/
mv lilypond*tar.gz releases/
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"
#
-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
/** 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<T>& list, Link<T>* pointer = 0 );
-
+ /**
+ Create an invalid cursor (pointing to nothing, associated with no list.)
+ */
+ Cursor();
Cursor( const Cursor<T>& cursor );
T& thing();
Cursor<T> 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
- // cursor.icc -*-c++-*-
-#ifndef CURSOR_INL
-#define CURSOR_INL
+/*
+ cursor.icc -- implement Cursor
+
+ source file of the Flower Library
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef CURSOR_ICC
+#define CURSOR_ICC
+
+
+
#include <assert.h>
+// untested
+template<class T>
+inline
+Cursor<T>::Cursor( )
+ : list_(*(List<T> *)0) // ugh
+{
+ pointer_ = 0;
+}
+
template<class T>
inline
template<class T>
inline bool
-Cursor<T>::backward()
+Cursor<T>::backward()const
{
return ( pointer_ != 0 );
}
template<class T>
inline bool
-Cursor<T>::forward()
+Cursor<T>::forward()const
{
return ( pointer_ != 0 );
}
template<class T>
inline bool
-Cursor<T>::ok()
+Cursor<T>::ok()const
{
return ( pointer_ != 0 );
}
return r;
}
-#endif
+
+#endif // CURSOR_ICC
template<class T> struct Link;
template<class T> struct Handle;
template<class T> struct Interval_t;
-template<class T,class Q> struct PQueue;
+template<class T> struct PQueue;
#include "real.hh"
#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())
PCursor<T> operator -(int no) const { return Cursor<void*>::operator-(no);}
int operator -(PCursor<T> op) const { return Cursor<void*>::operator-(op);}
PCursor<T> operator +( int no) const {return Cursor<void*>::operator+(no);} PCursor(const PointerList<T> & l) : Cursor<void*> (l) {}
-
+ PCursor() : Cursor<void*> () {}
PCursor( const Cursor<void*>& cursor ) : Cursor<void*>(cursor) { }
void* vptr() const { return *((Cursor<void*> &) *this); }
/*
- 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 <hanwen@stack.nl>
*/
#ifndef PQUEUE_HH
#define PQUEUE_HH
-
#include "varray.hh"
+
+template<class K, class T>
+struct PQueue_ent
+{
+ T val;
+ K key;
+};
+
+template<class K, class T>
+int compare (PQueue_ent<K,T> const &e1 , PQueue_ent<K,T> 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<V,I>
+ Hungarian postfix pq
+
*/
+template<class T>
+class PQueue {
+ Array<T> 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<class V, class I>
-struct PQueue
-{
- Array<V> value_arr_;
- Array<I> 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
--- /dev/null
+/*
+ priorities.hh -- declare Priorities
+
+ source file of the Flower Library
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef PRIORITIES_HH
+#define PRIORITIES_HH
+
+#include "varray.hh"
+
+/**
+ A sorted (uni)set. Should connect with PQueue
+ */
+template<class K>
+struct Priorities : Array<K>
+{
+ void insert(K k)
+ {
+ int i=0;
+ for (; i < size(); i++) {
+ if(elem(i) == k)
+ return;
+ if (elem(i) > k )
+ break;
+ }
+ Array<K>::insert(k, i);
+ }
+};
+#endif // PRIORITIES_HH
+
+
/*
- (c) Han-Wen Nienhuys 1995,96
+ (c) Han-Wen Nienhuys 1995,96,97
Distributed under GNU GPL
*/
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.
/// 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<size_);
return ((T*)thearray)[i];
}
# identify module:
#
-NAME =stringtest
+NAME =flower-test
# include ./$(depth)/$(NAME)/.version
MODULE_NAME = flower
include ./$(depth)/flower/.version
# don't do the exec, as this might fail if flowerlib isn't installed yet.
default: $(BUILDSTRINGTEST)
+
do-stringtest:
$(EXECSTRINGTEST) > $(outdir)/result
cmp $(outdir)/result result
--- /dev/null
+/*
+ flower-test.hh -- declare
+
+ source file of the Flower Library
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef FLOWER_TEST_HH
+#define FLOWER_TEST_HH
+#include <iostream.h>
+
+#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
--- /dev/null
+#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<fptr>;
+ 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] ();
+ }
+}
--- /dev/null
+#include "flower-test.hh"
+#include "pqueue.hh"
+#include <stdlib.h>
+
+int compare(int i, int j)
+{
+ return i-j;
+}
+
+void
+pqtest()
+{
+ PQueue<int> 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);
stupid test program to verify stringlib
stringtest.cc
*/
-#include <iostream.h>
#include "string.hh"
#include "varray.hh"
#include "string-convert.hh"
+#include "flower-test.hh"
void
ctors()
return false;
}
-int
-main()
+void
+stringtest()
{
ctors();
cmp();
cout << "up: " << str.upper_str() << " down: " << str.lower_str()<<endl;
if ( test_empty_b( str ) )
- return 1;
-
+ cout << "failed";
+
String fn = "";
if ( !test_empty_b( fn ) )
- return 1;
+ cout << "failed";
+
fn = "";
fn += "";
cout << String_convert::bin2hex_str( String( (char)0xff ) ) << endl;
cout << "-1:" << String_convert::i2hex_str( -1, 2, '0' );
cout << endl;
- return 0;
+
}
+ADD_TEST(stringtest);
d = \melodic_request { -1 1 0 }
dis = \melodic_request { -1 1 1 }
disis = \melodic_request { -1 1 2 }
+ eeses = \melodic_request { -1 2 -2 }
eses = \melodic_request { -1 2 -2 }
+ ees = \melodic_request { -1 2 -1 }
es = \melodic_request { -1 2 -1 }
e = \melodic_request { -1 2 0 }
eis = \melodic_request { -1 2 1 }
g = \melodic_request { -1 4 0 }
gis = \melodic_request { -1 4 1 }
gisis = \melodic_request { -1 4 2 }
+ aeses = \melodic_request { -1 5 -2 }
ases = \melodic_request { -1 5 -2 }
aes = \melodic_request { -1 5 -1 }
as = \melodic_request { -1 5 -1 }
-\version "0.0.52";
+\version "0.0.53";
-include "register.ini"
-include "dynamic.ini"
-include "dutch.ini" % do not include init/ path
-include "script.ini"
-include "table_sixteen.ini"
+\include "register.ini"
+\include "dynamic.ini"
+\include "dutch.ini" % do not include init/ path
+\include "script.ini"
+\include "table_sixteen.ini"
+\init_end ;
-include "this-is-hopefully-a-nonexisting-file"
+\version "0.0.53";
+
+\include "this-is-hopefully-a-nonexisting-file"
+
mwa = \melodic{
%IOT trap/Abort
% als geen music in staff
-include "this-is-hopefully-a-nonexisting-file"
+\include "this-is-hopefully-a-nonexisting-file"
\score{
\staff{ bla }
\staff{ mwa }
% copyright: None
%
% declare melody (which will be in *one* staff ) for the lead voice
-\version "0.0.52";
+\version "0.0.53";
melodie = \melodic {
% switch Lilypond in note-mode
% \key fis
}
-include "mlalt.ly"
-include "mlvio1.ly"
-include "mlvio2.ly"
-include "mlcello.ly"
+\include "mlalt.ly"
+\include "mlvio1.ly"
+\include "mlvio2.ly"
+\include "mlcello.ly"
\score{
\staff{ melodicregs globalmusic alto }
% The purpose of this file is to demonstrate features of LilyPond.
% (there is an accompanying LaTeX file, scsii-menuetto.tex)
%
-\version "0.0.52";
+\version "0.0.53";
%% Stuff from MPP version
% \lefttitle{Menuetto}
% \tempo{Moderato}
% The purpose of this file is to demonstrate features of LilyPond.
% (there is an accompanying LaTeX file, standchen.tex)
%
+\version "0.0.53";
melodie = \melodic{
\meter 3/4 ;
\score{
\staff{ lyricregs tekstI }
-% sorry. Have to fix
-% \staff{ lyricregs tekstII }
+ \staff{ lyricregs tekstII }
\staff{ melodicregs melodie }
\staff{ melodicregs begeleiding }
%
% Public Domain -- typed by by HWN
%
-\version "0.0.52";
+\version "0.0.53";
global = \melodic{
\meter 4/4 ;
MAJOR_VERSION = 0
MINOR_VERSION = 0
-PATCH_LEVEL = 52
+PATCH_LEVEL = 53
# use to send patches, always empty for released version:
# include separator: ".postfix", "-pl" makes rpm barf
paper-def.cc parser.cc lexer.cc p-staff.cc qlp.cc qlpsolve.cc\
template1.cc template2.cc template3.cc template4.cc\
template5.cc template6.cc version.cc tex-stream.cc tex.cc\
- voice.cc wordwrap.cc spanner.cc \
+ voice.cc spanner.cc \
voice-element.cc identifier.cc note.cc\
iter_top(cols_,i);
for (; i.ok(); i++) {
- assert(i->used_b());
+ if (!i->used_b())
+ continue;
+
PCursor<Score_column*> j(i+1);
+
if (i->musical_b()) {
assert(j.ok());
for (int n=0; n < i->durations.size(); n++) {
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
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
+
#include "staff-column.hh"
#include "voice.hh"
#include "p-score.hh"
{
bool b =walk_regs_p_->try_request(req);
if (!b)
-
req->warning("junking request: " + String(req->name()));
-
}
void
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();
-
/*
- lily-proto.hh -- declare
+ lily-proto.hh -- declare class names.
source file of the LilyPond music typesetter
#ifndef LILY_PROTO_HH
#define LILY_PROTO_HH
+#include "proto.hh"
struct My_lily_lexer;
struct My_lily_parser;
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;
#ifndef MIDIOUTPUT_HH
#define MIDIOUTPUT_HH
-#include "p-score.hh"
+#include "lily-proto.hh"
struct Midi_output {
Midi_output(Score* score_l, Midi_def* );
#include "staff-walker.hh"
#include "pcursor.hh"
#include "pqueue.hh"
+struct Note_event : PQueue_ent<Moment,Melodic_req*>
+{
+ 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<Staff_column*> {
+class Midi_walker : public PCursor<Staff_column*>
+{
Midi_track *track_l_;
- PQueue<Melodic_req*, Moment> stop_notes;
+ PQueue< Note_event > stop_notes;
+
Moment last_moment_;
/* *************** */
virtual Moment duration() const;
REQUESTMETHODS(Skip_req, skip);
};
+
/** a request with a duration.
This request is used only a base class.
*/
int dir_i_;
/// the characteristics of the text
Text_def *tdef_p_;
+
/* *************** */
Text_req(int d, Text_def*);
~Text_req();
*/
class Subtle_req : public virtual Musical_req {
public:
+ /// the time relative to Voice_element start.
Moment subtime_;
REQUESTMETHODS(Subtle_req, subtle);
};
class My_lily_parser {
char const* here_ch_C()const;
Array<Input> define_spot_array_;
-
+ String init_str_;
void add_requests( Voice_element*v);
int default_octave_i_;
Duration default_duration_;
String textstyle_str_;
-
+ bool first_b_;
bool last_duration_mode ;
Array<Request*> pre_reqs, post_reqs;
int fatal_error_i_;
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();
--- /dev/null
+/*
+ pulk-voice.hh -- declare Pulk_voice
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#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<Voice_element*> cur_;
+ Moment elt_mom_;
+ Priorities<Moment> 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<Request*> get_req_l_arr();
+};
+
+#endif // PULK_VOICE_HH
--- /dev/null
+/*
+ pulk-voices.hh -- declare Pulk_voices
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#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 *> staff_l_list_;
+ Moment next_mom_;
+
+public:
+ Moment last_;
+ bool ok() const;
+ Moment next_mom() { return next_mom_; }
+ Pulk_voices(PointerList<Staff*> const&);
+ void get_aligned_request(Request_column *col_l );
+};
+
+
+#endif // PULK_VOICES_HH
--- /dev/null
+/*
+ request-column.hh -- declare Request_column
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#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_column*> staff_cols_;
+ Array<Staff_column*> staff_col_l_arr_;
+
+public:
+ Score_column *musical_column_l_, *command_column_l_;
+ Request_column(PointerList<Staff*> const& );
+ bool used_b()const;
+ Moment when();
+ void add_reqs(int staff_idx, Array<Request*> const&);
+ void set_score_cols(Score_column*, Score_column*);
+};
+
+#endif // REQUEST_COLUMN_HH
#include "assoc.hh"
#include "string.hh"
#include "input.hh"
+#include "lily-proto.hh"
/// the total music def of one movement
struct Score {
IPointerList<Staff*> staffs_;
/// "runtime" fields for setting up spacing
+ IPointerList<Request_column*> rcols_;
+
IPointerList<Score_column*> cols_;
PScore *pscore_p_;
#ifndef STAFFCOLUMN_HH
#define STAFFCOLUMN_HH
-#include "proto.hh"
+
+#include "lily-proto.hh"
#include "varray.hh"
#include "moment.hh"
Array<Request*> musicalreq_l_arr_;
Array<Request*> commandreq_l_arr_;
Staff * staff_l_;
-
+ Request_column * req_col_l_;
/// fields to collect timing data vertically.
Array<Timing_req*> 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 *, Moment> &subtle_req_pq );
+ void set_req_col(Request_column *c1);
+ void add_reqs (Array<Request*> req_l_arr);
void OK() const;
~Staff_column();
void typeset_breakable_items(Array<Item *> &pre_p_arr,
class Staff {
Staff(const Staff&src);
- /// synchronous horizontal stuff
- IPointerList<Voice*> voice_list_;
- Staff_column *get_col(Moment, PCursor<Staff_column*> * last= 0);
-
public:
Input_register * ireg_p_;
+ PointerList<Voice*> voice_list_;
/// runtime field
- IPointerList<Staff_column*> cols_;
+ PointerList<Staff_column*> cols_;
Score *score_l_;
PScore *pscore_l_;
void add(const PointerList<Voice*> &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();
virtual void set_output(PScore * destination)=0;
virtual Staff_walker *get_walker_p()=0;
virtual ~Staff() { }
+ void add_col(Staff_column*);
protected:
};
Voice_element */
Moment duration_;
Voice const *voice_C_;
- IPointerList<Request*> reqs;
+ IPointerList<Request*> req_p_list_;
/* *************** */
void transpose(Melodic_req const &)const;
/** the elements, earliest first.
Please use the member #add()# to add a new element
*/
- IPointerList<Voice_element *> elts;
- Moment start;
+ IPointerList<Voice_element *> elts_;
+ Moment start_;
/* *************** */
Voice();
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 ) ) {
void
Simple_music::translate_time(Moment t)
{
- voice_.start += t;
+ voice_.start_ += t;
}
Voice_list
{
Voice_list l;
Voice * v_p = new Voice(voice_);
- PCursor<Voice_element*> i= v_p->elts.bottom();
- // need-to-have, otherwise memory will be filled up with regs.
+ PCursor<Voice_element*> 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;
Voice_list::translate_time(Moment x)
{
for (iter_top(*this,i); i.ok(); i++)
- i->start += x;
+ i->start_ += x;
}
#include "score.hh"
#include "paper-def.hh"
#include "midi-def.hh"
-#include "staff.hh"
+
void
const Array<int> &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);
}
#include "musical-request.hh"
#include "local-key-item.hh"
#include "bar.hh"
+#include "time-description.hh"
Key_register::Key_register()
{
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;
}
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_)
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
<notes,INITIAL,lyrics>
-include {
+\\include {
yy_push_state(incl);
}
<incl>{WHITE}* { /* eat the whitespace */ }
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)
{
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);
}
key_item_p_ = 0;
}
}
+
void
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
{
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);
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>, Jan Nieuwenhuizen <jan@digicash.com>
*/
-// "" huh?
#include "time.h"
#include "main.hh"
#include "source.hh"
#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 )
{
// 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 );
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);
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());
}
}
for ( int i = 0; i < ptr()->musicalreq_l_arr_.size(); i++ ) {
-
Rhythmic_req *n = ptr()->musicalreq_l_arr_[i]->rhythmic();
if ( !n)
continue;
if (!note_l)
continue;
do_start_note(note_l);
-
}
}
{
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);
+}
{"geometric", GEOMETRIC},
{"hshift", HSHIFT},
{"in", IN_T},
+ {"init_end", INIT_END},
{"inputregister", INPUT_REGS},
{"lyric", LYRIC},
{"key", KEY},
#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.");
My_lily_parser::My_lily_parser(Sources * source_l)
{
+ first_b_ = true;
source_l_ = source_l;
lexer_p_ = 0;
default_duration_.type_i_ = 4;
%{ // -*-Fundamental-*-
#include <iostream.h>
-#define MUDELA_VERSION "0.0.52"
+#define MUDELA_VERSION "0.0.53"
#include "script-def.hh"
#include "symtable.hh"
{
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();
}
%token INPUT_REGS
%token HSHIFT
%token IN_T
+%token INIT_END
%token LYRIC
%token KEY
%token MELODIC
| 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) {
--- /dev/null
+/*
+ pulk-voices.cc -- implement Pulk_voice
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#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<Request*>
+Pulk_voice::get_req_l_arr() return req_l_arr;
+{
+ Moment w = when();
+ do {
+ Moment sub = subtle_moment_priorities_[subtle_idx_];
+ for (PCursor<Request*> 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<Request*> 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_];
+}
--- /dev/null
+/*
+ pulk-voices.cc -- implement Pulk_voices
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#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<Staff*> 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;
+ last_ = last_ >? 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 <? i->when();
+ i++;
+ }
+
+ if (voice_pq_.size() )
+ new_next_mom = new_next_mom <? voice_pq_.front().l_->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_);
+}
+
--- /dev/null
+/*
+ request-column.cc -- implement Request_column
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#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<Request*> const & req_l_arr)
+{
+ staff_col_l_arr_[idx]->add_reqs(req_l_arr);
+}
+
+Request_column::Request_column(PointerList<Staff*> 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;
+}
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;
}
*mlog << "[" <<breaks_i_<<"]"<<flush;
for (int i=0; i < walker_p_arr_.size(); i++)
delete walker_p_arr_[i];
- assert( !score_l_->find_col(score_l_->last(), true)->used_b());
}
#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;
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 );
}
}
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++)
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();
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_column*>
-Score::create_cols(Moment w, PCursor<Score_column*> &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<Score_column*>
if (i->when() > w)
break;
}
- i = create_cols(w,i);
- if (mus)
- i++;
+ assert(false);
return i;
}
#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 *, Moment> &subtle_req_pq )
+Staff_column::add_reqs(Array<Request*> 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()) {
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);
}
Staff_column::Staff_column()
{
- musical_column_l_ = 0;
- command_column_l_ = 0;
staff_l_ = 0;
}
}
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
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_);
}
Array<Item *> &nobreak_p_arr,
Array<Item *> &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++)
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_;
+}
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()
#include "debug.hh"
#include "musical-request.hh"
#include "command-request.hh" // todo
-#include "pqueue.hh"
void
void
Staff::clean_cols()
{
+#if 0 // TODO
iter_top(cols_,i);
for(; i.ok(); ){
if (!i->musical_column_l_->used_b())
else
i++;
}
+#endif
}
-Staff_column *
-Staff::get_col(Moment w, PCursor<Staff_column*> *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<Score_column*> 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 *, Moment> subtle_req_pq;
- PCursor<Staff_column*> 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 <? subtle_req_pq.front_idx();
-
- Staff_column *s_l= get_col(next, &last);
-
- while (subtle_req_pq.size()
- && subtle_req_pq.front_idx() == s_l->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
pscore_l_ =0;
pstaff_l_ =0;
}
+
+void
+Staff::add_col(Staff_column*c_l)
+{
+ cols_.bottom().add(c_l);
+ c_l->staff_l_ = this;
+}
--- /dev/null
+#/*
+ template7.cc -- instantiate Request_column
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "staff-column.hh"
+#include "request-column.hh"
+#include "plist.tcc"
+#include "pcursor.tcc"
+
+IPL_instantiate(Request_column);
--- /dev/null
+#include "pulk-voice.hh"
+
+#include "plist.tcc"
+#include "pcursor.tcc"
+
+IPL_instantiate(Pulk_voice);
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);
}
}
{
#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";
}
r->elt_l_ = this;
- reqs.bottom().add(r);
+ req_p_list_.bottom().add(r);
}
{
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());
}
{
assert( c == ']' );
moment_r += duration_;
- for ( PCursor<Request*> i( reqs.top() ); i.ok(); i++ ) {
+ for ( PCursor<Request*> i( req_p_list_.top() ); i.ok(); i++ ) {
if (i->beam() && i->beam()->spantype == Span_req::START )
return true;
}
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;
now_moment_r += duration_;
if ( now_moment_r > until_moment )
return;
- for ( PCursor<Request*> i( reqs.top() ); i.ok(); i++ ) {
+ for ( PCursor<Request*> 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()) {
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;
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
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<<eol;
- for (iter_top(elts,i); i.ok(); i++)
+ mtor << "Voice { start_: "<< start_<<eol;
+ for (iter_top(elts_,i); i.ok(); i++)
i->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;
}
# 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:
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) > $@
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))
--- /dev/null
+[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
+[This lsm-entry is not in the LSM yet.]
+
Begin3
Title: LilyPond
Version: @TOPLEVEL_VERSION@
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
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 <hanwen@stack.nl>
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
-\font\musicfont=musixsps
+\font\musicfont=musix20
\font\slurfont=xslu16
\def\thefont{\musicfont}
\charn
-\bye
\ No newline at end of file
+\bye