summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Nieuwenhuizen <janneke@gnu.org>1999-04-08 01:48:49 +0300
committerJan Nieuwenhuizen <janneke@gnu.org>1999-04-08 01:48:49 +0300
commit41c075bc0a4419c0e3646b7d554b1677b71f5a43 (patch)
tree26840ca4ecd3586baa624fad6d009e2ed3bd4178
parent20faee98e6dcd976d05f02a63d485b4a50520637 (diff)
patch::: 1.1.38.jcn1: Cons
-rw-r--r--VERSION2
-rw-r--r--flower/include/cons.hh166
-rw-r--r--flower/include/killing-cons.tcc10
-rw-r--r--lib/source.cc6
-rw-r--r--lily/midi-item.cc4
-rw-r--r--lily/molecule.cc4
-rw-r--r--lily/music-list.cc24
-rw-r--r--lily/music-sequence.cc8
-rw-r--r--lily/paper-outputter.cc4
-rw-r--r--lily/performance.cc4
-rw-r--r--lily/repeat-engraver.cc16
-rw-r--r--lily/request-iterator.cc8
-rw-r--r--lily/sequential-music-iterator.cc8
-rw-r--r--lily/simultaneous-music-iterator.cc22
-rw-r--r--lily/spring-spacer.cc22
-rw-r--r--lily/translator-group.cc32
-rw-r--r--mi2mu/include/midi-track-parser.hh4
-rw-r--r--mi2mu/include/mudela-column.hh6
-rw-r--r--mi2mu/include/mudela-item.hh112
-rw-r--r--mi2mu/include/mudela-score.hh48
-rw-r--r--mi2mu/include/mudela-staff.hh17
-rw-r--r--mi2mu/include/mudela-voice.hh19
-rw-r--r--mi2mu/midi-track-parser.cc23
-rw-r--r--mi2mu/mudela-column.cc2
-rw-r--r--mi2mu/mudela-score.cc149
-rw-r--r--mi2mu/mudela-staff.cc117
-rw-r--r--mi2mu/mudela-voice.cc36
-rw-r--r--mi2mu/template9.cc32
28 files changed, 459 insertions, 446 deletions
diff --git a/VERSION b/VERSION
index cf74e47cf8..1aa2572085 100644
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
MAJOR_VERSION=1
MINOR_VERSION=1
PATCH_LEVEL=38
-MY_PATCH_LEVEL=uu1
+MY_PATCH_LEVEL=jcn1
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
diff --git a/flower/include/cons.hh b/flower/include/cons.hh
index 6e62c4c865..1d59e98ec0 100644
--- a/flower/include/cons.hh
+++ b/flower/include/cons.hh
@@ -10,26 +10,28 @@
#ifndef CONS_HH
#define CONS_HH
+#include <assert.h>
+#define TAIL
template<class T>
class Cons
{
public:
- T * car_;
- Cons * next_;
+ T * car_p_;
+ Cons * next_cons_p_;
Cons ()
{
- car_=0;
- next_ =0;
+ car_p_=0;
+ next_cons_p_ =0;
}
Cons (T*t, Cons<T>*c)
{
- car_ = t;
- next_ = c;
+ car_p_ = t;
+ next_cons_p_ = c;
}
virtual ~Cons ()
{
- delete next_;
+ delete next_cons_p_;
}
};
@@ -47,55 +49,146 @@ public:
/// remove the link pointed to by *p.
template<class T>
-Cons<T> *remove_cons (Cons<T> **pp)
+Cons<T> *remove_cons_p (Cons<T> **pp)
{
Cons<T> *knip = *pp;
- *pp = (*pp)->next_;
- knip->next_ = 0;
+ *pp = (*pp)->next_cons_p_;
+ knip->next_cons_p_ = 0;
return knip;
}
+
+template<class T> int cons_list_size_i (Cons<T> *l)
+{
+ int i=0;
+ while (l)
+ {
+ l = l->next_cons_p_;
+ i++;
+ }
+ return i;
+}
+
/**
Invariants:
- (*tail_) is either the head_ pointer, or a next_ pointer from the list.
+ (*loose_cons_p_p_) is either the head_cons_p_ pointer, or a next_cons_p_ pointer from the list.
- **tail_ == NULL
+ **loose_cons_p_p_ == NULL
*/
template<class T>
class Cons_list
{
+#ifdef TAIL
+private:
+ // find tail helper; is this handy?
+ Cons<T> * tail_cons_l_;
+#endif
+
public:
- Cons<T> * head_;
- Cons<T> ** tail_;
- Cons_list () { init_list (); }
- void init_list () {head_ =0; tail_ = &head_; }
+ // make these private?
+ Cons<T> * head_cons_p_;
+ Cons<T> ** loose_cons_p_p_;
+
+
+ Cons_list ()
+ {
+ init ();
+ }
+ void init ()
+ {
+ head_cons_p_ = 0;
+ loose_cons_p_p_ = &head_cons_p_;
+#ifdef TAIL
+ tail_cons_l_ = 0;
+#endif
+ }
void append (Cons<T> *c)
{
- assert (!c->next_);
- *tail_ = c;
- while (*tail_)
- tail_ = &(*tail_)->next_;
+ assert (!c->next_cons_p_);
+#ifndef TAIL
+ *loose_cons_p_p_ = c;
+ while (*loose_cons_p_p_)
+ loose_cons_p_p_ = &(*loose_cons_p_p_)->next_cons_p_;
+#else
+ *loose_cons_p_p_ = c;
+ tail_cons_l_ = *loose_cons_p_p_;
+ while (tail_cons_l_->next_cons_p_)
+ tail_cons_l_ = tail_cons_l_->next_cons_p_;
+ loose_cons_p_p_ = &tail_cons_l_->next_cons_p_;
+#endif
+ }
+ Cons<T>* tail_cons_l ()
+ {
+ assert (!empty_b ());
+#ifndef TAIL
+ Cons<T>* tail_cons_l = head_cons_p_;
+ while (tail_cons_l->next_cons_p_)
+ tail_cons_l = tail_cons_l->next_cons_p_;
+ return tail_cons_l;
+#else
+ return tail_cons_l_;
+#endif
}
/**
- PRE: *pp should either be the head_ pointer, or the next_ pointer
- from a list cell.
+ PRE: *pp should either be the head_cons_p_ pointer,
+ or the next_cons_p_ pointer from a list cell.
*/
- Cons<T> *remove_cons (Cons<T> **pp)
+ Cons<T> *remove_cons_p (Cons<T> **pp)
{
- if (&(*pp)->next_ == tail_)
- tail_ = pp;
-
- return ::remove_cons (pp);
+#ifndef TAIL
+ if (&(*pp)->next_cons_p_ == loose_cons_p_p_)
+ loose_cons_p_p_ = pp;
+#else
+ if (*pp == tail_cons_l_)
+ {
+ //either here
+ tail_cons_l_ = tail_cons_l ();
+ loose_cons_p_p_ = pp;
+ }
+#endif
+
+ return ::remove_cons_p (pp);
+ }
+ bool empty_b ()
+ {
+ return !head_cons_p_;
+ }
+ int size_i ()
+ {
+ return cons_list_size_i (head_cons_p_);
+ }
+ T* head_car_l ()
+ {
+ assert (!empty_b ());
+ return head_cons_p_->car_p_;
+ }
+ T* car_l ()
+ {
+ assert (!empty_b ());
+ return head_cons_p_->car_p_;
+ }
+ T* tail_car_l ()
+ {
+ assert (!empty_b ());
+ // or here?
+#ifndef TAIL
+ return tail_cons_l ()->car_p_;
+#else
+ return tail_cons_l_->car_p_;
+#endif
}
void junk ()
{
- delete head_;
- head_ =0;
+ delete head_cons_p_;
+ init ();
+ }
+ ~Cons_list ()
+ {
+ junk ();
}
- ~Cons_list () { junk (); }
};
@@ -105,19 +198,6 @@ template<class T>
void
clone_killing_cons_list (Cons_list<T>&, Cons<T> *src);
-template<class T> int cons_list_size_i (Cons<T> *l)
-{
- int i=0;
- while (l)
- {
- l = l->next_;
- i++;
- }
- return i;
-}
-
-
-
#endif /* CONS_HH */
diff --git a/flower/include/killing-cons.tcc b/flower/include/killing-cons.tcc
index f6fcff7bd1..8c6c04e998 100644
--- a/flower/include/killing-cons.tcc
+++ b/flower/include/killing-cons.tcc
@@ -15,16 +15,16 @@
template<class T>
Killing_cons<T>::~Killing_cons ()
{
- delete car_;
+ delete car_p_;
}
template<class T>
void
copy_killing_cons_list (Cons_list<T> &dest, Cons<T> *src)
{
- for (; src; src = src->next_)
+ for (; src; src = src->next_cons_p_)
{
- T *t = new T(*src->car_);
+ T *t = new T(*src->car_p_);
dest.append ( new Killing_cons<T> (t, 0));
}
}
@@ -33,9 +33,9 @@ template<class T>
void
clone_killing_cons_list (Cons_list<T> & dest, Cons<T> *src)
{
- for (; src; src = src->next_)
+ for (; src; src = src->next_cons_p_)
{
- T *t = src->car_->clone ();
+ T *t = src->car_p_->clone ();
dest.append (new Killing_cons<T> (t, 0));
}
}
diff --git a/lib/source.cc b/lib/source.cc
index 66372945de..850b32ec0b 100644
--- a/lib/source.cc
+++ b/lib/source.cc
@@ -73,9 +73,9 @@ Source_file*
Sources::sourcefile_l (char const* ch_C)
{
- for (Cons<Source_file> *i = sourcefile_p_list_; i; i = i->next_)
- if (i->car_->in_b (ch_C))
- return i->car_;
+ for (Cons<Source_file> *i = sourcefile_p_list_; i; i = i->next_cons_p_)
+ if (i->car_p_->in_b (ch_C))
+ return i->car_p_;
return 0;
}
diff --git a/lily/midi-item.cc b/lily/midi-item.cc
index ccb0a5ae90..e52027345c 100644
--- a/lily/midi-item.cc
+++ b/lily/midi-item.cc
@@ -552,9 +552,9 @@ Midi_track::data_str () const
String str = Midi_chunk::data_str ();
if (check_debug && !monitor->silent_b ("Midistrings"))
str += "\n";
- for (Cons<Midi_event> *i=event_p_list_.head_; i; i = i->next_)
+ for (Cons<Midi_event>* i = event_p_list_.head_cons_p_; i; i = i->next_cons_p_)
{
- str += i->car_->str ();
+ str += i->car_p_->str ();
if (check_debug && !monitor->silent_b ("Midistrings"))
str += "\n";
}
diff --git a/lily/molecule.cc b/lily/molecule.cc
index 33ff218833..f874394880 100644
--- a/lily/molecule.cc
+++ b/lily/molecule.cc
@@ -24,10 +24,10 @@
#define UNBOX_PTR(a) SCM_CAR(a)
#else
#define MOL_EOL 0
-#define NEXT_CELL(a) ptr->next_
+#define NEXT_CELL(a) ptr->next_cons_p_
#define CELLTYPE Cons<Atom>*
#define UNBOX_ATOM(a) a
-#define UNBOX_PTR(a) a->car_
+#define UNBOX_PTR(a) a->car_p_
#define BOX_ATOM(a) a
#define NEWCELL(a,b) new Killing_cons<Atom>(a,b)
#endif
diff --git a/lily/music-list.cc b/lily/music-list.cc
index 0324d8af6c..a17fad69cf 100644
--- a/lily/music-list.cc
+++ b/lily/music-list.cc
@@ -17,8 +17,8 @@ Moment
Simultaneous_music::length_mom () const
{
Moment dur = 0;
- for (Cons<Music> *i = music_p_list_p_->head_; i; i = i->next_)
- dur = dur >? i->car_->length_mom ();
+ for (Cons<Music> *i = music_p_list_p_->head_cons_p_; i; i = i->next_cons_p_)
+ dur = dur >? i->car_p_->length_mom ();
return dur;
}
@@ -27,8 +27,8 @@ void
Music_sequence::compress (Moment m)
{
- for (Cons<Music> *i = music_p_list_p_->head_; i; i = i->next_)
- i->car_->compress (m);
+ for (Cons<Music> *i = music_p_list_p_->head_cons_p_; i; i = i->next_cons_p_)
+ i->car_p_->compress (m);
}
Simultaneous_music::Simultaneous_music(Music_list *p)
@@ -46,9 +46,9 @@ Moment
Sequential_music::length_mom () const
{
Moment last=0;
- for (Cons<Music> *i = music_p_list_p_->head_; i; i = i->next_)
+ for (Cons<Music> *i = music_p_list_p_->head_cons_p_; i; i = i->next_cons_p_)
{
- last += i->car_->length_mom ();
+ last += i->car_p_->length_mom ();
}
return last;
}
@@ -76,9 +76,9 @@ Music_list::do_relative_octave (Musical_pitch last, bool ret_first)
{
Musical_pitch retval;
int count=0;
- for (Cons<Music> *i = head_; i ; i = i->next_)
+ for (Cons<Music> *i = head_cons_p_; i ; i = i->next_cons_p_)
{
- last = i->car_->to_relative_octave (last);
+ last = i->car_p_->to_relative_octave (last);
if (!count ++ )
retval = last;
}
@@ -93,8 +93,8 @@ Music_list::do_relative_octave (Musical_pitch last, bool ret_first)
Music_list::Music_list (Music_list const &s)
: Cons_list<Music> (s)
{
- init_list ();
- clone_killing_cons_list (*this, s.head_);
+ init ();
+ clone_killing_cons_list (*this, s.head_cons_p_);
}
@@ -116,9 +116,9 @@ Request_chord::Request_chord()
Musical_pitch
Request_chord::to_relative_octave (Musical_pitch last)
{
- for (Cons<Music> *i = music_p_list_p_->head_; i ; i = i->next_)
+ for (Cons<Music> *i = music_p_list_p_->head_cons_p_; i ; i = i->next_cons_p_)
{
- if (Melodic_req *m= dynamic_cast <Melodic_req *> (i->car_))
+ if (Melodic_req *m= dynamic_cast <Melodic_req *> (i->car_p_))
{
Musical_pitch &pit = m->pitch_;
pit.to_relative_octave (last);
diff --git a/lily/music-sequence.cc b/lily/music-sequence.cc
index 6f50bd56b7..52ed3fecce 100644
--- a/lily/music-sequence.cc
+++ b/lily/music-sequence.cc
@@ -26,16 +26,16 @@ Music_sequence::Music_sequence(Music_list *mlist_p)
void
Music_sequence::transpose (Musical_pitch rq)
{
- for (Cons<Music> *i = music_p_list_p_->head_; i; i = i->next_)
- i->car_->transpose (rq);
+ for (Cons<Music> *i = music_p_list_p_->head_cons_p_; i; i = i->next_cons_p_)
+ i->car_p_->transpose (rq);
}
void
Music_sequence::do_print() const
{
#ifndef NPRINT
- for (Cons<Music> *i = music_p_list_p_->head_; i; i = i->next_)
- i->car_->print();
+ for (Cons<Music> *i = music_p_list_p_->head_cons_p_; i; i = i->next_cons_p_)
+ i->car_p_->print();
#endif
}
diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc
index 308c07734d..5a46415e69 100644
--- a/lily/paper-outputter.cc
+++ b/lily/paper-outputter.cc
@@ -99,9 +99,9 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm)
{
Atom *i = Atom::atom_l (SCM_CAR(ptr));
#else
- for (Cons<Atom> *ptr = m->atom_list_; ptr; ptr = ptr->next_)
+ for (Cons<Atom> *ptr = m->atom_list_; ptr; ptr = ptr->next_cons_p_)
{
- Atom * i = ptr->car_;
+ Atom * i = ptr->car_p_;
#endif
Offset a_off = i->off_;
a_off += o;
diff --git a/lily/performance.cc b/lily/performance.cc
index f25b63eea1..c9b1909b25 100644
--- a/lily/performance.cc
+++ b/lily/performance.cc
@@ -125,8 +125,8 @@ Performance::print() const
#ifndef NPRINT
DOUT << "Performance { ";
DOUT << "Items: ";
- for (Cons<Audio_element>* i =audio_elem_p_list_; i; i = i->next_)
- i->car_->print ();
+ for (Cons<Audio_element>* i =audio_elem_p_list_; i; i = i->next_cons_p_)
+ i->car_p_->print ();
DOUT << "}";
#endif
}
diff --git a/lily/repeat-engraver.cc b/lily/repeat-engraver.cc
index 8a3cbdf597..06a033696c 100644
--- a/lily/repeat-engraver.cc
+++ b/lily/repeat-engraver.cc
@@ -45,9 +45,9 @@ Repeat_engraver::do_try_music (Music* m)
Moment alt_mom = now_mom () + repeat_length_mom;
if (repeat_length_mom)
{
- for (Cons<Music> *i (alt->music_p_list_p_->head_); i && i->next_; i = i->next_)
+ for (Cons<Music> *i (alt->music_p_list_p_->head_cons_p_); i && i->next_cons_p_; i = i->next_cons_p_)
{
- stop_mom += i->car_->length_mom ();
+ stop_mom += i->car_p_->length_mom ();
if (dynamic_cast<Simultaneous_music *> (alt))
break;
}
@@ -71,23 +71,23 @@ Repeat_engraver::do_try_music (Music* m)
if (prop.length_i ())
span_mom = prop.to_rat ();
- int alt_i = r->repeats_i_ + 1 - cons_list_size_i (alt->music_p_list_p_->head_ ) >? 1;
- for (Cons<Music> *i = alt->music_p_list_p_->head_; i ; i = i->next_)
+ int alt_i = r->repeats_i_ + 1 - cons_list_size_i (alt->music_p_list_p_->head_cons_p_ ) >? 1;
+ for (Cons<Music> *i = alt->music_p_list_p_->head_cons_p_; i ; i = i->next_cons_p_)
{
- alternative_music_arr_.push (i->car_);
+ alternative_music_arr_.push (i->car_p_);
alternative_start_mom_arr_.push (alt_mom);
if (span_mom)
alternative_stop_mom_arr_.push (alt_mom + span_mom);
else
- alternative_stop_mom_arr_.push (alt_mom + i->car_->length_mom ());
+ alternative_stop_mom_arr_.push (alt_mom + i->car_p_->length_mom ());
String str;
- if ((alt_i != 1) && (alt_i != r->repeats_i_) && (i == alt->music_p_list_p_->head_))
+ if ((alt_i != 1) && (alt_i != r->repeats_i_) && (i == alt->music_p_list_p_->head_cons_p_))
str = "1.-";
str += to_str (alt_i) + ".";
alt_i++;
alternative_str_arr_.push (str);
if (!dynamic_cast<Simultaneous_music *> (alt))
- alt_mom += i->car_->length_mom ();
+ alt_mom += i->car_p_->length_mom ();
}
return true;
}
diff --git a/lily/request-iterator.cc b/lily/request-iterator.cc
index ca103ee062..0aacb6ce04 100644
--- a/lily/request-iterator.cc
+++ b/lily/request-iterator.cc
@@ -63,17 +63,17 @@ Request_chord_iterator::do_process_and_next (Moment mom)
{
if (first_b_)
{
- for (Cons<Music> *i = elt_l ()->music_p_list_p_->head_; i; i = i->next_)
+ for (Cons<Music> *i = elt_l ()->music_p_list_p_->head_cons_p_; i; i = i->next_cons_p_)
{
- if (Request * req_l = dynamic_cast<Request*> (i->car_))
+ if (Request * req_l = dynamic_cast<Request*> (i->car_p_))
{
bool gotcha = report_to_l()->try_music (req_l);
if (!gotcha)
req_l->warning (_f ("junking request: `%s\'", classname( req_l)));
}
else
- i->car_->warning (_f ("Huh? Not a Request: `%s\'",
- classname (i->car_)));
+ i->car_p_->warning (_f ("Huh? Not a Request: `%s\'",
+ classname (i->car_p_)));
}
first_b_ = false;
}
diff --git a/lily/sequential-music-iterator.cc b/lily/sequential-music-iterator.cc
index b1a9ab6198..3a32f9b0a6 100644
--- a/lily/sequential-music-iterator.cc
+++ b/lily/sequential-music-iterator.cc
@@ -28,7 +28,7 @@ Sequential_music_iterator::Sequential_music_iterator ()
void
Sequential_music_iterator::construct_children()
{
- cursor_ = dynamic_cast<Sequential_music const*> (music_l_)->music_p_list_p_->head_;
+ cursor_ = dynamic_cast<Sequential_music const*> (music_l_)->music_p_list_p_->head_cons_p_;
while (cursor_)
{
@@ -50,16 +50,16 @@ Sequential_music_iterator::leave_element()
{
delete iter_p_;
iter_p_ =0;
- Moment elt_time = cursor_->car_->length_mom ();
+ Moment elt_time = cursor_->car_p_->length_mom ();
here_mom_ += elt_time;
- cursor_ =cursor_->next_;
+ cursor_ =cursor_->next_cons_p_;
}
void
Sequential_music_iterator::start_next_element()
{
assert (!iter_p_);
- iter_p_ = get_iterator_p (cursor_->car_);
+ iter_p_ = get_iterator_p (cursor_->car_p_);
}
void
diff --git a/lily/simultaneous-music-iterator.cc b/lily/simultaneous-music-iterator.cc
index b83e5eaee8..8872bd1ebe 100644
--- a/lily/simultaneous-music-iterator.cc
+++ b/lily/simultaneous-music-iterator.cc
@@ -27,9 +27,9 @@ Simultaneous_music_iterator::construct_children()
int j = 0;
Simultaneous_music const *sim = dynamic_cast<Simultaneous_music const*> (music_l_);
- for (Cons<Music> *i = sim->music_p_list_p_->head_; i; i = i->next_, j++)
+ for (Cons<Music> *i = sim->music_p_list_p_->head_cons_p_; i; i = i->next_cons_p_, j++)
{
- Music_iterator * mi = get_iterator_p (i->car_);
+ Music_iterator * mi = get_iterator_p (i->car_p_);
if (mi->ok())
{
if (sim->translator_type_str_.empty_b ())
@@ -46,25 +46,25 @@ void
Simultaneous_music_iterator::do_print() const
{
#ifndef NPRINT
- for (Cons<Music_iterator> *p = children_p_list_.head_; p; p = p->next_)
- p->car_->print();
+ for (Cons<Music_iterator> *p = children_p_list_.head_cons_p_; p; p = p->next_cons_p_)
+ p->car_p_->print();
#endif
}
void
Simultaneous_music_iterator::do_process_and_next (Moment until)
{
- for (Cons<Music_iterator> **pp = &children_p_list_.head_; *pp; )
+ for (Cons<Music_iterator> **pp = &children_p_list_.head_cons_p_; *pp; )
{
- Music_iterator * i = (*pp)->car_;
+ Music_iterator * i = (*pp)->car_p_;
if (i->next_moment() == until)
{
i->process_and_next (until);
}
if (!i->ok())
- delete children_p_list_.remove_cons (pp);
+ delete children_p_list_.remove_cons_p (pp);
else
- pp = &(*pp)->next_;
+ pp = &(*pp)->next_cons_p_;
}
Music_iterator::do_process_and_next (until);
}
@@ -78,8 +78,8 @@ Simultaneous_music_iterator::next_moment() const
Moment next;
next.set_infinite (1);
- for (Cons<Music_iterator> *p = children_p_list_.head_; p; p = p->next_)
- next = next <? p->car_->next_moment() ;
+ for (Cons<Music_iterator> *p = children_p_list_.head_cons_p_; p; p = p->next_cons_p_)
+ next = next <? p->car_p_->next_moment() ;
return next;
}
@@ -88,6 +88,6 @@ Simultaneous_music_iterator::next_moment() const
bool
Simultaneous_music_iterator::ok() const
{
- return children_p_list_.head_;
+ return children_p_list_.head_cons_p_;
}
diff --git a/lily/spring-spacer.cc b/lily/spring-spacer.cc
index bd12477582..4b7c39b5b5 100644
--- a/lily/spring-spacer.cc
+++ b/lily/spring-spacer.cc
@@ -68,9 +68,9 @@ Spring_spacer::handle_loose_cols()
Union_find connected (cols_.size());
Array<int> fixed;
- for (Cons<Idealspacing> *i = ideal_p_list_; i; i = i->next_)
+ for (Cons<Idealspacing> *i = ideal_p_list_; i; i = i->next_cons_p_)
{
- connected.connect (i->car_->cols_drul_[LEFT],i->car_->cols_drul_[RIGHT]);
+ connected.connect (i->car_p_->cols_drul_[LEFT],i->car_p_->cols_drul_[RIGHT]);
}
for (int i = 0; i < cols_.size(); i++)
if (cols_[i].fixed_b())
@@ -240,9 +240,9 @@ Spring_spacer::make_matrices (Matrix &quad, Vector &lin, Real &c) const
lin.fill (0);
c = 0;
- for (Cons<Idealspacing> *p =ideal_p_list_; p; p = p->next_)
+ for (Cons<Idealspacing> *p =ideal_p_list_; p; p = p->next_cons_p_)
{
- Idealspacing *i = p->car_;
+ Idealspacing *i = p->car_p_;
int l = i->cols_drul_[LEFT];
int r = i->cols_drul_[RIGHT];
@@ -296,9 +296,9 @@ Real
Spring_spacer::calculate_energy_f (Vector solution) const
{
Real e = 0.0;
- for (Cons<Idealspacing>*p =ideal_p_list_; p; p = p->next_)
+ for (Cons<Idealspacing>*p =ideal_p_list_; p; p = p->next_cons_p_)
{
- Idealspacing * i = p->car_;
+ Idealspacing * i = p->car_p_;
e += i->energy_f(solution(i->cols_drul_[RIGHT]) - solution(i->cols_drul_[LEFT]));
}
@@ -421,14 +421,14 @@ Spring_spacer::loosen_column (int idx)
while (*pp)
{
- Idealspacing *j = (*pp)->car_;
+ Idealspacing *j = (*pp)->car_p_;
if (j->cols_drul_[LEFT] == idx|| j->cols_drul_[RIGHT] == idx)
{
- delete remove_cons (pp);
+ delete remove_cons_p (pp);
}
else
{
- pp = &(*pp)->next_;
+ pp = &(*pp)->next_cons_p_;
}
}
c.ugh_b_ = true;
@@ -453,9 +453,9 @@ Spring_spacer::print() const
cols_[i].print();
}
- for (Cons<Idealspacing> *p =ideal_p_list_; p; p = p->next_)
+ for (Cons<Idealspacing> *p =ideal_p_list_; p; p = p->next_cons_p_)
{
- p->car_->print();
+ p->car_p_->print();
}
#endif
}
diff --git a/lily/translator-group.cc b/lily/translator-group.cc
index a3fec11395..fcb11f859b 100644
--- a/lily/translator-group.cc
+++ b/lily/translator-group.cc
@@ -91,9 +91,9 @@ Translator_group::set_element (String s, bool add)
bool
Translator_group::removable_b() const
{
- for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
+ for (Cons<Translator> *p = trans_p_list_.head_cons_p_; p; p = p->next_cons_p_)
{
- if (dynamic_cast <Translator_group *> (p->car_))
+ if (dynamic_cast <Translator_group *> (p->car_p_))
return false;
}
@@ -224,10 +224,10 @@ Link_array<Translator_group>
Translator_group::group_l_arr () const
{
Link_array<Translator_group> groups;
- for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
+ for (Cons<Translator> *p = trans_p_list_.head_cons_p_; p; p = p->next_cons_p_)
{
- if (dynamic_cast <Translator_group *> (p->car_))
- groups.push (dynamic_cast <Translator_group *> (p->car_));
+ if (dynamic_cast <Translator_group *> (p->car_p_))
+ groups.push (dynamic_cast <Translator_group *> (p->car_p_));
}
return groups;
}
@@ -236,10 +236,10 @@ Link_array<Translator>
Translator_group::nongroup_l_arr () const
{
Link_array<Translator> groups;
- for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
+ for (Cons<Translator> *p = trans_p_list_.head_cons_p_; p; p = p->next_cons_p_)
{
- if (!dynamic_cast <Translator_group *> (p->car_))
- groups.push (p->car_);
+ if (!dynamic_cast <Translator_group *> (p->car_p_))
+ groups.push (p->car_p_);
}
return groups;
}
@@ -266,11 +266,11 @@ Translator_group::remove_translator_p (Translator*trans_l)
{
assert (trans_l);
- for (Cons<Translator> **pp = &trans_p_list_.head_; *pp; pp = &(*pp)->next_)
- if ((*pp)->car_ == trans_l)
+ for (Cons<Translator> **pp = &trans_p_list_.head_cons_p_; *pp; pp = &(*pp)->next_cons_p_)
+ if ((*pp)->car_p_ == trans_l)
{
- Cons<Translator> *r = trans_p_list_.remove_cons (pp);
- r->car_ =0;
+ Cons<Translator> *r = trans_p_list_.remove_cons_p (pp);
+ r->car_p_ =0;
trans_l->daddy_trans_l_ =0;
delete r;
return trans_l;
@@ -328,16 +328,16 @@ Translator_group::get_default_interpreter()
void
Translator_group::each (Method_pointer method)
{
- for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
- (p->car_->*method) ();
+ for (Cons<Translator> *p = trans_p_list_.head_cons_p_; p; p = p->next_cons_p_)
+ (p->car_p_->*method) ();
}
void
Translator_group::each (Const_method_pointer method) const
{
- for (Cons<Translator> *p = trans_p_list_.head_; p; p = p->next_)
- (p->car_->*method) ();
+ for (Cons<Translator> *p = trans_p_list_.head_cons_p_; p; p = p->next_cons_p_)
+ (p->car_p_->*method) ();
}
void
diff --git a/mi2mu/include/midi-track-parser.hh b/mi2mu/include/midi-track-parser.hh
index 3679ef6007..d873e198df 100644
--- a/mi2mu/include/midi-track-parser.hh
+++ b/mi2mu/include/midi-track-parser.hh
@@ -11,7 +11,7 @@
#define MIDI_TRACK_PARSER_HH
#include "proto.hh"
-#include "plist.hh"
+#include "cons.hh"
#include "moment.hh"
#include "mi2mu-proto.hh"
#include "midi-parser.hh"
@@ -36,7 +36,7 @@ private:
Moment at_mom_;
Byte running_byte_;
- Link_list<Mudela_note*> open_note_l_list_;
+ Cons_list<Mudela_note> open_note_l_list_;
Mudela_staff* mudela_staff_p_;
Midi_parser_info* track_info_p_;
};
diff --git a/mi2mu/include/mudela-column.hh b/mi2mu/include/mudela-column.hh
index b1ab97c24b..a09cebb469 100644
--- a/mi2mu/include/mudela-column.hh
+++ b/mi2mu/include/mudela-column.hh
@@ -9,7 +9,7 @@
#include "proto.hh"
#include "mi2mu-proto.hh"
#include "moment.hh"
-#include "plist.hh"
+#include "cons.hh"
/// (mudela_column)
class Mudela_column
@@ -18,9 +18,9 @@ public:
Mudela_column (Mudela_score* mudela_score_l, Moment mom);
void add_item (Mudela_item* mudela_item_l);
- Moment at_mom();
+ Moment at_mom ();
- Link_list<Mudela_item*> mudela_item_l_list_;
+ Cons_list<Mudela_item> mudela_item_l_list_;
Moment at_mom_;
Mudela_score* mudela_score_l_;
};
diff --git a/mi2mu/include/mudela-item.hh b/mi2mu/include/mudela-item.hh
index 6dce94333d..e1b52b7368 100644
--- a/mi2mu/include/mudela-item.hh
+++ b/mi2mu/include/mudela-item.hh
@@ -21,109 +21,109 @@
class Mudela_item
{
public:
- Mudela_item (Mudela_column* mudela_column_l);
- virtual ~Mudela_item ();
+ Mudela_item (Mudela_column* mudela_column_l);
+ virtual ~Mudela_item ();
- virtual Moment at_mom();
- virtual Moment duration_mom();
- void output (Mudela_stream& mudela_stream_r);
- virtual String str() = 0;
+ virtual Moment at_mom ();
+ virtual Moment duration_mom ();
+ void output (Mudela_stream& mudela_stream_r);
+ virtual String str () = 0;
- Mudela_column* mudela_column_l_;
+ Mudela_column* mudela_column_l_;
};
class Mudela_key : public Mudela_item
{
public:
- Mudela_key (int accidentals_i, int minor_i);
+ Mudela_key (int accidentals_i, int minor_i);
- String notename_str (int pitch_i);
- virtual String str();
+ String notename_str (int pitch_i);
+ virtual String str ();
-//private:
- int accidentals_i_;
- int minor_i_;
+ //private:
+ int accidentals_i_;
+ int minor_i_;
};
class Mudela_time_signature : public Mudela_item
{
public:
- Mudela_time_signature (int num_i, int den_i, int division_4_i, int count_32_i);
+ Mudela_time_signature (int num_i, int den_i, int division_4_i, int count_32_i);
- Duration i2_dur (int time_i, int division_1_i);
- int clocks_1_i();
- int den_i();
- int num_i();
- virtual String str();
- Moment bar_mom();
+ Duration i2_dur (int time_i, int division_1_i);
+ int clocks_1_i ();
+ int den_i ();
+ int num_i ();
+ virtual String str ();
+ Moment bar_mom ();
private:
- Real sync_f_;
- Duration sync_dur_;
- int clocks_1_i_;
- int num_i_;
- int den_i_;
+ Real sync_f_;
+ Duration sync_dur_;
+ int clocks_1_i_;
+ int num_i_;
+ int den_i_;
};
class Mudela_note : public Mudela_item
{
public:
- Mudela_note (Mudela_column* mudela_column_l, int channel_i, int pitch_i, int dyn_i);
+ Mudela_note (Mudela_column* mudela_column_l, int channel_i, int pitch_i, int dyn_i);
- Duration duration();
- virtual Moment duration_mom();
- virtual String str();
+ Duration duration ();
+ virtual Moment duration_mom ();
+ virtual String str ();
-// int const c0_pitch_i_c_ = 60; // huh?
- static int const c0_pitch_i_c_ = 48;
+ // int const c0_pitch_i_c_ = 60; // huh?
+ static int const c0_pitch_i_c_ = 48;
- static bool const simple_plet_b_s = false;
- int channel_i_;
- int pitch_i_;
- Mudela_column* end_column_l_;
+ static bool const simple_plet_b_s = false;
+ int channel_i_;
+ int pitch_i_;
+ Mudela_column* end_column_l_;
};
class Mudela_skip : public Mudela_item
{
public:
- Mudela_skip (Mudela_column* mudela_column_l, Moment skip_mom);
+ Mudela_skip (Mudela_column* mudela_column_l, Moment skip_mom);
- Duration duration();
- virtual Moment duration_mom();
- virtual String str();
+ Duration duration ();
+ virtual Moment duration_mom ();
+ virtual String str ();
private:
- Moment mom_;
+ Moment mom_;
};
class Mudela_tempo : public Mudela_item
{
public:
- Mudela_tempo (int useconds_per_4_i);
+ Mudela_tempo (int useconds_per_4_i);
- int get_tempo_i (Moment moment);
- virtual String str();
- int useconds_per_4_i();
+ int get_tempo_i (Moment moment);
+ virtual String str ();
+ int useconds_per_4_i ();
private:
- int useconds_per_4_i_;
- Moment seconds_per_1_mom_;
+ int useconds_per_4_i_;
+ Moment seconds_per_1_mom_;
};
class Mudela_text : public Mudela_item
{
public:
- enum Type {
- TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC,
- MARKER, CUE_POINT
- };
- Mudela_text (Mudela_text::Type type, String str);
- virtual String str();
-
-//private:
- Type type_;
- String text_str_;
+ enum Type {
+ TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC,
+ MARKER, CUE_POINT
+ };
+ Mudela_text (Mudela_text::Type type, String str);
+ virtual String str ();
+
+ //private:
+ Type type_;
+ String text_str_;
};
#endif // MUDELA_ITEM_HH
diff --git a/mi2mu/include/mudela-score.hh b/mi2mu/include/mudela-score.hh
index 4d0992b35c..87e901b709 100644
--- a/mi2mu/include/mudela-score.hh
+++ b/mi2mu/include/mudela-score.hh
@@ -8,45 +8,43 @@
#include "mi2mu-proto.hh"
#include "proto.hh"
-#include "plist.hh"
+#include "cons.hh"
#include "parray.hh"
/// (mudela_score)
class Mudela_score {
public:
- Mudela_score (int format_i, int tracks_i, int tempo_i);
- ~Mudela_score();
+ Mudela_score (int format_i, int tracks_i, int tempo_i);
+ ~Mudela_score ();
- void add_item (Mudela_item* mudela_item_p);
- void add_staff (Mudela_staff* mudela_staff_p);
+ void add_item (Mudela_item* mudela_item_p);
+ void add_staff (Mudela_staff* mudela_staff_p);
- Mudela_column* find_column_l (Moment mom);
- Mudela_column* get_column_l (Moment mom);
+ Mudela_column* find_column_l (Moment mom);
+ Mudela_column* get_column_l (Moment mom);
- void output (String filename_str);
- void process();
+ void output (String filename_str);
+ void process ();
- // ugh
- Mudela_key* mudela_key_l_;
- Mudela_time_signature* mudela_time_signature_l_;
- Mudela_tempo* mudela_tempo_l_;
+ // ugh
+ Mudela_key* mudela_key_l_;
+ Mudela_time_signature* mudela_time_signature_l_;
+ Mudela_tempo* mudela_tempo_l_;
private:
- void filter_tempo();
- void quantify_columns();
- void quantify_durations();
- void settle_columns();
+ void filter_tempo ();
+ void quantify_columns ();
+ void quantify_durations ();
+ void settle_columns ();
- Pointer_list<Mudela_staff*> mudela_staff_p_list_;
- // wants Pointer_array!
-// Pointer_list<Mudela_column*> mudela_column_p_list_;
- Link_array<Mudela_column> column_l_array_;
+ Cons_list<Mudela_staff> mudela_staff_p_list_;
+ Link_array<Mudela_column> column_l_array_;
-// ugh, ugh, ugh
+ // ugh, ugh, ugh
public:
- int format_i_;
- int tracks_i_;
- int tempo_i_;
+ int format_i_;
+ int tracks_i_;
+ int tempo_i_;
};
#endif // MUDELA_SCORE_HH
diff --git a/mi2mu/include/mudela-staff.hh b/mi2mu/include/mudela-staff.hh
index 4b4fd75c60..8c0afa044a 100644
--- a/mi2mu/include/mudela-staff.hh
+++ b/mi2mu/include/mudela-staff.hh
@@ -8,20 +8,21 @@
#include "mi2mu-proto.hh"
#include "proto.hh"
-#include "plist.hh"
+#include "cons.hh"
#include "string.hh"
/// (mudela_staff)
-class Mudela_staff {
+class Mudela_staff
+{
public:
Mudela_staff (int number_i, String copyright_str, String track_name_str, String instrument_str);
void add_item (Mudela_item* mudela_item_p);
- void eat_voice (Link_list<Mudela_item*>& items);
- String id_str();
- String name_str();
+ void eat_voice (Cons_list<Mudela_item>& items);
+ String id_str ();
+ String name_str ();
void output (Mudela_stream& mudela_stream_r);
- void process();
+ void process ();
String copyright_str_;
String instrument_str_;
@@ -34,8 +35,8 @@ public:
private:
void output_mudela_begin_bar (Mudela_stream& mudela_stream_r, Moment now_mom, int bar_i);
- Pointer_list<Mudela_voice*> mudela_voice_p_list_;
- Pointer_list<Mudela_item*> mudela_item_p_list_;
+ Cons_list<Mudela_voice> mudela_voice_p_list_;
+ Cons_list<Mudela_item> mudela_item_p_list_;
};
#endif // MUDELA_STAFF_HH
diff --git a/mi2mu/include/mudela-voice.hh b/mi2mu/include/mudela-voice.hh
index 28b4efcdb9..a861201368 100644
--- a/mi2mu/include/mudela-voice.hh
+++ b/mi2mu/include/mudela-voice.hh
@@ -7,22 +7,23 @@
#define MUDELA_VOICE_HH
#include "mi2mu-proto.hh"
-#include "plist.hh"
+#include "cons.hh"
/// (mudela_voice)
-class Mudela_voice {
+class Mudela_voice
+{
public:
- Mudela_voice (Mudela_staff* mudela_staff_l);
+ Mudela_voice (Mudela_staff* mudela_staff_l);
- void add_item (Mudela_item* mudela_item_l);
- Moment begin_mom();
- Moment end_mom();
+ void add_item (Mudela_item* mudela_item_l);
+ Moment begin_mom ();
+ Moment end_mom ();
- void output (Mudela_stream& mudela_stream_r);
+ void output (Mudela_stream& mudela_stream_r);
private:
- Mudela_staff* mudela_staff_l_;
- Link_list<Mudela_item*> mudela_item_l_list_;
+ Mudela_staff* mudela_staff_l_;
+ Cons_list<Mudela_item> mudela_item_l_list_;
};
#endif // MUDELA_VOICE_HH
diff --git a/mi2mu/midi-track-parser.cc b/mi2mu/midi-track-parser.cc
index ff7d4453d4..2b34868c47 100644
--- a/mi2mu/midi-track-parser.cc
+++ b/mi2mu/midi-track-parser.cc
@@ -53,19 +53,17 @@ Midi_track_parser::note_end (Mudela_column* col_l, int channel_i, int pitch_i, i
assert (col_l);
- for (PCursor<Mudela_note*> i (open_note_l_list_.top ()); i.ok (); )
+ for (Cons<Mudela_note>** pp = &open_note_l_list_.head_cons_p_; *pp;)
{
- if ((i->pitch_i_ == pitch_i) && (i->channel_i_ == channel_i))
+ Cons<Mudela_note>* i = *pp;
+ if ((i->car_p_->pitch_i_ == pitch_i) && (i->car_p_->channel_i_ == channel_i))
{
- i->end_column_l_ = col_l;
- // LOGOUT(DEBUG_ver) << "Note: " << pitch_i;
- // LOGOUT(DEBUG_ver) << "; " << i->mudela_column_l_->at_mom_;
- // LOGOUT(DEBUG_ver) << ", " << i->end_column_l_->at_mom_ << '\n';
- i.remove_p();
+ i->car_p_->end_column_l_ = col_l;
+ delete open_note_l_list_.remove_cons_p (pp);
return;
}
else
- i++;
+ pp = &i->next_cons_p_;
}
warning (_f ("junking note-end event: channel = %d, pitch = %d",
channel_i, pitch_i));
@@ -76,11 +74,11 @@ Midi_track_parser::note_end_all (Mudela_column* col_l)
{
// find
assert (col_l);
- for (PCursor<Mudela_note*> i (open_note_l_list_.top ()); i.ok (); )
+ for (Cons<Mudela_note>* i = open_note_l_list_.head_cons_p_; i; i = i->next_cons_p_)
{
- i->end_column_l_ = col_l;
- i.remove_p ();
+ i->car_p_->end_column_l_ = col_l;
}
+ open_note_l_list_.init ();
}
Mudela_staff*
@@ -169,13 +167,14 @@ Midi_track_parser::parse_event (Mudela_column* col_l)
{
Mudela_note* p = new Mudela_note (col_l, channel_i, pitch_i, dyn_i);
item_p = p;
- open_note_l_list_.bottom ().add (p);
+ open_note_l_list_.append (new Cons<Mudela_note> (p, 0));
}
else
{
note_end (col_l, channel_i, pitch_i, dyn_i);
}
}
+
// POLYPHONIC_AFTERTOUCH [\xa0-\xaf]
else if ((byte >= 0xa0) && (byte <= 0xaf))
{
diff --git a/mi2mu/mudela-column.cc b/mi2mu/mudela-column.cc
index 5a00e88310..833b351f81 100644
--- a/mi2mu/mudela-column.cc
+++ b/mi2mu/mudela-column.cc
@@ -14,7 +14,7 @@ Mudela_column::Mudela_column (Mudela_score* mudela_score_l, Moment mom)
void
Mudela_column::add_item (Mudela_item* mudela_item_l)
{
- mudela_item_l_list_.bottom().add (mudela_item_l);
+ mudela_item_l_list_.append (new Cons<Mudela_item> (mudela_item_l, 0));
}
Moment
diff --git a/mi2mu/mudela-score.cc b/mi2mu/mudela-score.cc
index a18fe02d92..9ec6f46dc8 100644
--- a/mi2mu/mudela-score.cc
+++ b/mi2mu/mudela-score.cc
@@ -14,9 +14,7 @@
#include "mudela-staff.hh"
#include "mudela-stream.hh"
-// ugh, cygnus' b19 gcc
-#include "list.tcc"
-#include "cursor.tcc"
+#include "killing-cons.tcc"
//static Mudela_key key_c (0, 0);
static Mudela_time_signature time_sig_4 (4, 2, 24, 8);
@@ -35,32 +33,25 @@ Mudela_score::Mudela_score (int format_i, int tracks_i, int tempo_i)
mudela_tempo_l_ = &tempo_60;
}
-Mudela_score::~Mudela_score()
+Mudela_score::~Mudela_score ()
{
}
void
Mudela_score::add_item (Mudela_item* mudela_item_p)
{
- mudela_staff_p_list_.bottom()->add_item (mudela_item_p);
+ mudela_staff_p_list_.tail_car_l ()->add_item (mudela_item_p);
}
void
Mudela_score::add_staff (Mudela_staff* mudela_staff_p)
{
- mudela_staff_p_list_.bottom().add (mudela_staff_p);
+ mudela_staff_p_list_.append (new Killing_cons<Mudela_staff> (mudela_staff_p, 0));
}
Mudela_column*
Mudela_score::find_column_l (Moment mom)
{
-#if 0
- // should do binary search
- for (int i = 0; i < column_l_array_.size (); i++ )
- if ( column_l_array_[i]->at_mom () == mom )
- return column_l_array_[i];
- return 0;
-#else
int upper_i = max (0, column_l_array_.size () - 1);
int lower_i = 0;
int i = 0; //upper_i;
@@ -73,7 +64,7 @@ Mudela_score::find_column_l (Moment mom)
upper_i = i;
else
lower_i = i;
- if ((upper_i == lower_i) || (i == column_l_array_.size () - 1))
+ if ( (upper_i == lower_i) || (i == column_l_array_.size () - 1))
{
// we don't do inserts
assert (0);
@@ -85,7 +76,6 @@ Mudela_score::find_column_l (Moment mom)
}
assert (0);
return 0;
-#endif
}
Mudela_column*
@@ -93,7 +83,7 @@ Mudela_score::get_column_l (Moment mom)
{
int i;
Mudela_column *c=0;
- for (i=column_l_array_.size() - 1; !c && i >=0; i--)
+ for (i=column_l_array_.size () - 1; !c && i >=0; i--)
{
if (column_l_array_ [i]->at_mom () == mom )
c = column_l_array_[i];
@@ -114,115 +104,97 @@ Mudela_score::get_column_l (Moment mom)
void
Mudela_score::output (String filename_str)
{
- LOGOUT(NORMAL_ver) << _f ("Lily output to %s...", filename_str) << endl;
+ LOGOUT (NORMAL_ver) << _f ("Lily output to %s...", filename_str) << endl;
// ugh, ugly midi type 1 fix
- if ( (mudela_staff_p_list_.size() == 1) && !mudela_staff_p_list_.top()->number_i_)
- mudela_staff_p_list_.top()->number_i_ = 1;
+ if ( (mudela_staff_p_list_.size_i () == 1)
+ && !mudela_staff_p_list_.car_l ()->number_i_)
+ mudela_staff_p_list_.car_l ()->number_i_ = 1;
int track_i = 0;
Mudela_stream mudela_stream (filename_str);
- for (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++)
+ for (Cons<Mudela_staff>* i = mudela_staff_p_list_.head_cons_p_; i; i = i->next_cons_p_)
{
- LOGOUT(NORMAL_ver) << _ ("track ") << track_i++ << ": " << flush;
- i->output (mudela_stream);
+ LOGOUT (NORMAL_ver) << _ ("track ") << track_i++ << ": " << flush;
+ i->car_p_->output (mudela_stream);
mudela_stream << '\n';
- LOGOUT(NORMAL_ver) << endl;
+ LOGOUT (NORMAL_ver) << endl;
}
mudela_stream << "\\score{\n";
- if (mudela_staff_p_list_.size() > 1)
+ if (mudela_staff_p_list_.size_i () > 1)
mudela_stream << "< \n";
- for (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++)
+ for (Cons<Mudela_staff>* i = mudela_staff_p_list_.head_cons_p_; i; i = i->next_cons_p_)
{
- if ( (mudela_staff_p_list_.size() != 1)
- && (i == mudela_staff_p_list_.top()))
+ if ( (mudela_staff_p_list_.size_i () != 1)
+ && (i->car_p_ == mudela_staff_p_list_.car_l ()))
continue;
- mudela_stream << "\\type Staff = \"" << i->id_str() << "\" ";
- mudela_stream << String ("\\" + i->id_str ()) << "\n";
+ mudela_stream << "\\type Staff = \"" << i->car_p_->id_str () << "\" ";
+ mudela_stream << String ("\\" + i->car_p_->id_str ()) << "\n";
}
- if (mudela_staff_p_list_.size() > 1)
+ if (mudela_staff_p_list_.size_i () > 1)
mudela_stream << ">\n";
-#if 0
mudela_stream << "\\paper{}\n";
-#else
- /*
- let's put some auto-beam stuff in place as long as it's optional
- */
- mudela_stream << "\\paper{\n";
- mudela_stream << "\\translator{\n";
- mudela_stream << "\\VoiceContext\n";
- mudela_stream << "\\consists \"Auto_beam_engraver\";\n";
- mudela_stream << "beamAuto = 1.;\n";
- mudela_stream << "beamAutoEnd8 = \"2/4\";\n";
- mudela_stream << "beamAutoEnd16 = \"1/4\";\n";
- mudela_stream << "beamAutoEnd32 = \"1/4\";\n";
- mudela_stream << "}\n";
- mudela_stream << "}\n";
-#endif
mudela_stream << "\\midi{\n";
// let's not use silly 0 track
- mudela_staff_p_list_.bottom()->mudela_tempo_l_->output (mudela_stream);
+ mudela_staff_p_list_.tail_car_l ()->mudela_tempo_l_->output (mudela_stream);
mudela_stream << "}\n";
mudela_stream << "}\n";
}
void
-Mudela_score::process()
+Mudela_score::process ()
{
- LOGOUT(NORMAL_ver) << '\n' << _ ("Processing...") << endl;
+ LOGOUT (NORMAL_ver) << '\n' << _ ("Processing...") << endl;
- LOGOUT(DEBUG_ver) << "columns\n";
- // for (PCursor<Mudela_column*> i (mudela_column_p_list_); i.ok(); i++)
- // LOGOUT(DEBUG_ver) << "At: " << i->at_mom() << '\n';
+ LOGOUT (DEBUG_ver) << "columns\n";
- settle_columns();
- filter_tempo();
- quantify_columns();
- quantify_durations();
+ settle_columns ();
+ filter_tempo ();
+ quantify_columns ();
+ quantify_durations ();
- LOGOUT(NORMAL_ver) << '\n' << _ ("Creating voices...") << endl;
+ LOGOUT (NORMAL_ver) << '\n' << _ ("Creating voices...") << endl;
int track_i = 0;
- for (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++)
+ for (Cons<Mudela_staff>* i = mudela_staff_p_list_.head_cons_p_; i; i = i->next_cons_p_)
{
- LOGOUT(NORMAL_ver) << _ ("track ") << track_i++ << ": " << flush;
- i->process();
- LOGOUT(NORMAL_ver) << endl;
+ LOGOUT (NORMAL_ver) << _ ("track ") << track_i++ << ": " << flush;
+ i->car_p_->process ();
+ LOGOUT (NORMAL_ver) << endl;
}
}
void
-Mudela_score::filter_tempo()
+Mudela_score::filter_tempo ()
{
- LOGOUT(NORMAL_ver) << '\n' << _ ("NOT Filtering tempo...") << endl;
+ LOGOUT (NORMAL_ver) << '\n' << _ ("NOT Filtering tempo...") << endl;
}
void
-Mudela_score::quantify_columns()
+Mudela_score::quantify_columns ()
{
// ugh
- if (Duration_convert::no_quantify_b_s)
+ if (Duration_convert::no_quantify_b_s)
{
- LOGOUT(NORMAL_ver) << '\n' << _("NOT Quantifying columns...") << endl;
+ LOGOUT (NORMAL_ver) << '\n' << _ ("NOT Quantifying columns...") << endl;
return;
}
- LOGOUT(NORMAL_ver) << '\n' << _("Quantifying columns...") << endl;
+ LOGOUT (NORMAL_ver) << '\n' << _ ("Quantifying columns...") << endl;
int current_bar_i = 0;
- Moment bar_mom = mudela_time_signature_l_->bar_mom();
+ Moment bar_mom = mudela_time_signature_l_->bar_mom ();
int n = 5 >? Duration_convert::no_smaller_than_i_s;
n = Duration_convert::type2_i (n);
Moment s = Moment (1, n);
- Moment sh = Moment (1, 2 * n);
- for (int i = 0; i < column_l_array_.size(); i++)
+ for (int i = 0; i < column_l_array_.size (); i++)
{
column_l_array_ [i]->at_mom_ =
- s * Moment( (int) ( (column_l_array_ [i]->at_mom()) / s));
+ s * Moment ( (int) ( (column_l_array_ [i]->at_mom ()) / s));
int bar_i = (int) (column_l_array_ [i]->at_mom () / bar_mom) + 1;
if (bar_i > current_bar_i)
@@ -231,32 +203,21 @@ Mudela_score::quantify_columns()
current_bar_i = bar_i;
}
}
- LOGOUT(NORMAL_ver) << endl;
+ LOGOUT (NORMAL_ver) << endl;
}
void
-Mudela_score::quantify_durations()
+Mudela_score::quantify_durations ()
{
- // LOGOUT(NORMAL_ver) << '\n' << "Quantifying durations..." << endl;
+ // LOGOUT (NORMAL_ver) << '\n' << "Quantifying durations..." << endl;
}
void
-Mudela_score::settle_columns()
+Mudela_score::settle_columns ()
{
- // LOGOUT(NORMAL_ver) << '\n' << "NOT Settling columns..." << endl;
- // return;
- LOGOUT(NORMAL_ver) << '\n' << _("Settling columns...") << endl;
-
-#if 0
- assert (!column_l_array_.size());
- int n = mudela_column_p_list_.size();
- // huh?
- // column_l_array_.set_size (n);
- for (PCursor<Mudela_column*> i (mudela_column_p_list_); i.ok(); i++)
- column_l_array_.push (*i);
-#endif
+ LOGOUT (NORMAL_ver) << '\n' << _ ("Settling columns...") << endl;
- int n = column_l_array_.size();
+ int n = column_l_array_.size ();
int start_i = 0;
int end_i = 0;
@@ -265,22 +226,22 @@ Mudela_score::settle_columns()
smallest_dur.durlog_i_ = 6;
Moment const noise_mom = Duration_convert::dur2_mom (smallest_dur)
/ Moment (2);
- for (int i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
{
- if (!start_i)
+ if (!start_i)
{
start_i = end_i = i;
- start_mom = column_l_array_ [i]->at_mom();
+ start_mom = column_l_array_ [i]->at_mom ();
continue;
}
// find all columns within noise's distance
- while ( (i < n)
- && (column_l_array_ [i]->at_mom() - start_mom < noise_mom))
+ while ( (i < n)
+ && (column_l_array_ [i]->at_mom () - start_mom < noise_mom))
end_i = ++i;
// bluntly set all to time of first in group
- for (int j = start_i; j < end_i; j++)
+ for (int j = start_i; j < end_i; j++)
column_l_array_ [j]->at_mom_ = start_mom;
start_i = end_i = 0;
diff --git a/mi2mu/mudela-staff.cc b/mi2mu/mudela-staff.cc
index 3c92577895..4f9964250d 100644
--- a/mi2mu/mudela-staff.cc
+++ b/mi2mu/mudela-staff.cc
@@ -17,6 +17,8 @@
#include "mudela-voice.hh"
#include "mudela-score.hh"
+#include "killing-cons.tcc"
+
extern Mudela_score* mudela_score_l_g;
Mudela_staff::Mudela_staff (int number_i, String copyright_str, String track_name_str, String instrument_str)
@@ -33,51 +35,53 @@ Mudela_staff::Mudela_staff (int number_i, String copyright_str, String track_nam
void
Mudela_staff::add_item (Mudela_item* mudela_item_p)
{
- mudela_item_p_list_.bottom().add (mudela_item_p);
- if (mudela_item_p->mudela_column_l_)
+ mudela_item_p_list_.append (new Killing_cons <Mudela_item> (mudela_item_p, 0));
+ if (mudela_item_p->mudela_column_l_)
mudela_item_p->mudela_column_l_->add_item (mudela_item_p);
}
void
-Mudela_staff::eat_voice (Link_list<Mudela_item*>& items)
+Mudela_staff::eat_voice (Cons_list<Mudela_item>& items)
{
Mudela_voice* voice_p = new Mudela_voice (this);
- mudela_voice_p_list_.bottom().add (voice_p);
+ mudela_voice_p_list_.append (new Killing_cons<Mudela_voice> (voice_p, 0));
- // Moment mom = items.top()->at_mom();
+ // Moment mom = items.top ()->at_mom ();
Moment mom = 0;
- for (PCursor<Mudela_item*> i (items); i.ok();)
+ for (Cons<Mudela_item>** pp = &items.head_cons_p_; *pp;)
{
- LOGOUT(DEBUG_ver) << "At: " << i->at_mom ().str () << "; ";
- LOGOUT(DEBUG_ver) << "dur: " << i->duration_mom ().str () << "; ";
- LOGOUT(DEBUG_ver) << "mom: " << mom.str () << " -> ";
- if (i->at_mom() > mom)
+ Cons<Mudela_item>* i = *pp;
+ LOGOUT (DEBUG_ver) << "At: " << i->car_p_->at_mom ().str () << "; ";
+ LOGOUT (DEBUG_ver) << "dur: " << i->car_p_->duration_mom ().str () << "; ";
+ LOGOUT (DEBUG_ver) << "mom: " << mom.str () << " -> ";
+ if (i->car_p_->at_mom () > mom)
{
- Moment dur = i->at_mom() - mom;
+ Moment dur = i->car_p_->at_mom () - mom;
// ugh, need score
Mudela_column* start = mudela_score_l_g->find_column_l (mom);
voice_p->add_item (new Mudela_skip (start, dur));
- mom = i->at_mom();
+ mom = i->car_p_->at_mom ();
}
- if (i->at_mom() == mom)
+ if (i->car_p_->at_mom () == mom)
{
- mom = i->at_mom() + i->duration_mom();
- voice_p->add_item (i.remove_p());
- // ugh
+ mom = i->car_p_->at_mom () + i->car_p_->duration_mom ();
+ Cons<Mudela_item>* c = items.remove_cons_p (pp);
+ voice_p->add_item (c->car_p_);
+ delete c;
}
- else if (i.ok())
- i++;
- LOGOUT(DEBUG_ver) << "mom: " << mom.str () << '\n';
+ else if (*pp)
+ pp = &i->next_cons_p_;
+ LOGOUT (DEBUG_ver) << "mom: " << mom.str () << '\n';
}
}
String
-Mudela_staff::id_str()
+Mudela_staff::id_str ()
{
String id (name_str ());
char *cp = id.ch_l ();
- char *end = cp + id.length_i();
+ char *end = cp + id.length_i ();
for (;cp < end; cp++)
{
if (!isalpha (*cp))
@@ -89,9 +93,9 @@ Mudela_staff::id_str()
}
String
-Mudela_staff::name_str()
+Mudela_staff::name_str ()
{
- if (name_str_.length_i())
+ if (name_str_.length_i ())
return name_str_;
return String ("track") + to_str (char ('A' - 1 + number_i_));
}
@@ -101,40 +105,40 @@ Mudela_staff::name_str()
void
Mudela_staff::output (Mudela_stream& mudela_stream_r)
{
- mudela_stream_r << id_str() << " = \\notes";
- mudela_stream_r << (mudela_voice_p_list_.size() > 1 ? "<" : "{");
+ mudela_stream_r << id_str () << " = \\notes";
+ mudela_stream_r << (mudela_voice_p_list_.size_i () > 1 ? "<" : "{");
mudela_stream_r << '\n';
mudela_stream_r << _ ("% midi copyright:") << copyright_str_ << '\n';
mudela_stream_r << _ ("% instrument:") << instrument_str_ << '\n';
// don't use last duration mode
// mudela_stream_r << "\\duration 4;\n";
- if (mudela_voice_p_list_.size() == 1)
- mudela_voice_p_list_.top()->output (mudela_stream_r);
+ if (mudela_voice_p_list_.size_i () == 1)
+ mudela_voice_p_list_.car_l ()->output (mudela_stream_r);
else
- for (PCursor<Mudela_voice*> i (mudela_voice_p_list_); i.ok(); i++)
+ for (Cons<Mudela_voice>* i = mudela_voice_p_list_.head_cons_p_; i; i = i->next_cons_p_)
{
mudela_stream_r << "{ ";
- i->output (mudela_stream_r);
+ i->car_p_->output (mudela_stream_r);
mudela_stream_r << "} ";
}
- mudela_stream_r << (mudela_voice_p_list_.size() > 1 ? "\n>" : "\n}");
- mudela_stream_r << " % " << name_str() << '\n';
+ mudela_stream_r << (mudela_voice_p_list_.size_i () > 1 ? "\n>" : "\n}");
+ mudela_stream_r << " % " << name_str () << '\n';
}
void
Mudela_staff::output_mudela_begin_bar (Mudela_stream& mudela_stream_r, Moment now_mom, int bar_i)
{
- Moment bar_mom = mudela_time_signature_l_->bar_mom();
+ Moment bar_mom = mudela_time_signature_l_->bar_mom ();
Moment into_bar_mom = now_mom - Moment (bar_i - 1) * bar_mom;
- if (bar_i > 1)
+ if (bar_i > 1)
{
- if (!into_bar_mom)
+ if (!into_bar_mom)
mudela_stream_r << "|\n";
}
mudela_stream_r << "% " << String_convert::i2dec_str (bar_i, 0, ' ');
- if (into_bar_mom)
+ if (into_bar_mom)
mudela_stream_r << ":" << Duration_convert::dur2_str (Duration_convert::mom2_dur (into_bar_mom));
mudela_stream_r << '\n';
}
@@ -144,13 +148,13 @@ Mudela_staff::output_mudela_begin_bar (Mudela_stream& mudela_stream_r, Moment no
void
Mudela_staff::output_mudela_rest (Mudela_stream& mudela_stream_r, Moment begin_mom, Moment end_mom)
{
- Moment bar_mom = mudela_time_signature_l_->bar_mom();
+ Moment bar_mom = mudela_time_signature_l_->bar_mom ();
Moment now_mom = begin_mom;
int begin_bar_i = (int) (now_mom / bar_mom) + 1;
int end_bar_i = (int) (end_mom / bar_mom) + 1;
- if (end_bar_i == begin_bar_i)
+ if (end_bar_i == begin_bar_i)
{
output_mudela_rest_remain (mudela_stream_r, end_mom - begin_mom);
return;
@@ -161,14 +165,14 @@ Mudela_staff::output_mudela_rest (Mudela_stream& mudela_stream_r, Moment begin_m
//fill current bar
Moment begin_bar_mom = Moment (begin_bar_i - 1) * bar_mom;
- if (now_mom > begin_bar_mom)
+ if (now_mom > begin_bar_mom)
{
int next_bar_i = (int) (now_mom / bar_mom) + 2;
Moment next_bar_mom = Moment (next_bar_i - 1) * bar_mom;
assert (next_bar_mom <= end_mom);
Moment remain_mom = next_bar_mom - now_mom;
- if (remain_mom > Moment (0))
+ if (remain_mom > Moment (0))
{
output_mudela_rest_remain (mudela_stream_r, remain_mom);
now_mom += remain_mom;
@@ -179,28 +183,28 @@ Mudela_staff::output_mudela_rest (Mudela_stream& mudela_stream_r, Moment begin_m
// fill whole bars
int count_i = end_bar_i - bar_i;
- for (int i = 0; i < count_i; i++)
+ for (int i = 0; i < count_i; i++)
{
int begin_bar_i = check_begin_bar_i (now_mom, bar_i);
- if (begin_bar_i)
+ if (begin_bar_i)
output_mudela_begin_bar (mudela_stream_r, now_mom, begin_bar_i);
mudela_stream_r << "r1 ";
// *mudela_stream_r.os_p_ << flush;
- if (begin_bar_i)
- LOGOUT(NORMAL_ver) << begin_bar_i << flush;
+ if (begin_bar_i)
+ LOGOUT (NORMAL_ver) << begin_bar_i << flush;
bar_i = check_end_bar_i (now_mom, bar_i);
now_mom += bar_mom;
}
// use "int i" here, and gcc 2.7.2 hits internal compiler error
int ii = check_begin_bar_i (now_mom, bar_i);
- if (ii)
+ if (ii)
output_mudela_begin_bar (mudela_stream_r, now_mom, ii);
// bar_i = check_end_bar_i (now_mom, bar_i);
Moment remain_mom = end_mom - Moment (end_bar_i - 1) * bar_mom;
- if (remain_mom > Moment (0))
+ if (remain_mom > Moment (0))
{
output_mudela_rest_remain (mudela_stream_r, remain_mom);
now_mom += remain_mom;
@@ -211,24 +215,24 @@ Mudela_staff::output_mudela_rest (Mudela_stream& mudela_stream_r, Moment begin_m
void
Mudela_staff::output_mudela_rest_remain (Mudela_stream& mudela_stream_r, Moment mom)
{
- if (Duration_convert::no_quantify_b_s)
+ if (Duration_convert::no_quantify_b_s)
{
Duration dur = Duration_convert::mom2_dur (mom);
- mudela_stream_r << "r" << dur.str() << " ";
- // assert (mom == dur.mom());
- assert (mom == dur.length());
+ mudela_stream_r << "r" << dur.str () << " ";
+ // assert (mom == dur.mom ());
+ assert (mom == dur.length ());
return;
}
Duration dur = Duration_convert::mom2standardised_dur (mom);
- if (dur.type_i_>-10)
- mudela_stream_r << "r" << dur.str() << " ";
+ if (dur.type_i_>-10)
+ mudela_stream_r << "r" << dur.str () << " ";
}
#endif
void
-Mudela_staff::process()
+Mudela_staff::process ()
{
/*
group items into voices
@@ -239,10 +243,11 @@ Mudela_staff::process()
mudela_time_signature_l_ = mudela_score_l_g->mudela_time_signature_l_;
mudela_tempo_l_ = mudela_score_l_g->mudela_tempo_l_;
- Link_list<Mudela_item*> items;
- for (PCursor<Mudela_item*> i (mudela_item_p_list_); i.ok(); i++)
- items.bottom().add (*i);
+ Cons_list<Mudela_item> items;
+ for (Cons<Mudela_item>* i = mudela_item_p_list_.head_cons_p_; i; i = i->next_cons_p_)
+ //items.bottom ().add (*i);
+ items.append (new Cons<Mudela_item> (i->car_p_, 0));
- while (items.size())
+ while (!items.empty_b ())
eat_voice (items);
}
diff --git a/mi2mu/mudela-voice.cc b/mi2mu/mudela-voice.cc
index 6f92d03f22..92c9b2ef3e 100644
--- a/mi2mu/mudela-voice.cc
+++ b/mi2mu/mudela-voice.cc
@@ -19,21 +19,21 @@ Mudela_voice::Mudela_voice (Mudela_staff* mudela_staff_l)
void
Mudela_voice::add_item (Mudela_item* mudela_item_l)
{
- mudela_item_l_list_.bottom().add (mudela_item_l);
+ mudela_item_l_list_.append (new Cons<Mudela_item> (mudela_item_l, 0));
}
Moment
-Mudela_voice::begin_mom()
+Mudela_voice::begin_mom ()
{
- return mudela_item_l_list_.size() ?
- mudela_item_l_list_.top()->at_mom() : Moment (0);
+ return !mudela_item_l_list_.empty_b () ?
+ mudela_item_l_list_.car_l ()->at_mom () : Moment (0);
}
Moment
-Mudela_voice::end_mom()
+Mudela_voice::end_mom ()
{
- return mudela_item_l_list_.size() ?
- mudela_item_l_list_.bottom()->at_mom() : Moment (0);
+ return !mudela_item_l_list_.empty_b () ?
+ mudela_item_l_list_.tail_car_l ()->at_mom () : Moment (0);
}
static int const FAIRLY_LONG_VOICE_i = 6;
@@ -41,37 +41,37 @@ static int const FAIRLY_LONG_VOICE_i = 6;
void
Mudela_voice::output (Mudela_stream& mudela_stream_r)
{
- if (!mudela_item_l_list_.size())
+ if (mudela_item_l_list_.empty_b ())
return;
- if (mudela_item_l_list_.size() > FAIRLY_LONG_VOICE_i)
+ if (mudela_item_l_list_.size_i () > FAIRLY_LONG_VOICE_i)
mudela_stream_r << '\n';
int current_bar_i = 0;
- Moment bar_mom = mudela_staff_l_->mudela_time_signature_l_->bar_mom();
+ Moment bar_mom = mudela_staff_l_->mudela_time_signature_l_->bar_mom ();
- for (PCursor<Mudela_item*> i (mudela_item_l_list_); i.ok(); i++)
+ for (Cons<Mudela_item>* i = mudela_item_l_list_.head_cons_p_; i; i = i->next_cons_p_)
{
- Moment at_mom = i->mudela_column_l_->at_mom();
+ Moment at_mom = i->car_p_->mudela_column_l_->at_mom ();
int bar_i = (int) (at_mom / bar_mom) + 1;
- if (bar_i > current_bar_i)
+ if (bar_i > current_bar_i)
{
- if (current_bar_i)
+ if (current_bar_i)
{
- if (at_mom == Moment (bar_i - 1) * bar_mom)
+ if (at_mom == Moment (bar_i - 1) * bar_mom)
mudela_stream_r << "|";
mudela_stream_r << "\n% ";
mudela_stream_r << String_convert::i2dec_str (bar_i, 0, ' ');
mudela_stream_r << '\n';
}
- LOGOUT(NORMAL_ver) << "[" << bar_i << "]" << flush;
+ LOGOUT (NORMAL_ver) << "[" << bar_i << "]" << flush;
current_bar_i = bar_i;
}
- mudela_stream_r << **i;
+ mudela_stream_r << *i->car_p_;
}
- if (mudela_item_l_list_.size() > FAIRLY_LONG_VOICE_i)
+ if (mudela_item_l_list_.size_i () > FAIRLY_LONG_VOICE_i)
mudela_stream_r << '\n';
}
diff --git a/mi2mu/template9.cc b/mi2mu/template9.cc
index 7d99a4b920..e69de29bb2 100644
--- a/mi2mu/template9.cc
+++ b/mi2mu/template9.cc
@@ -1,32 +0,0 @@
-//
-// template.cc -- implementemplate
-// ugh: must have unique name for Cygnus' gcc:
-// liblily.a(template.o): In function `GLOBAL_$I$template.cc':
-// template.cc:28: multiple definition of `global constructors keyed to template.cc'
-//
-// copyright 1997 Jan Nieuwenhuizen <janneke@gnu.org>
-
-#include "proto.hh"
-#include "list.hh"
-#include "list.tcc"
-#include "cursor.tcc"
-
-class istream;
-class ostream;
-
-#include "mudela-item.hh"
-#include "mudela-column.hh"
-#include "mudela-staff.hh"
-#include "mudela-voice.hh"
-#include "mudela-staff.hh"
-#include "mudela-score.hh"
-#include "pcursor.hh"
-#include "plist.hh"
-#include "pcursor.tcc"
-#include "plist.tcc"
-
-POINTERLIST_INSTANTIATE(Mudela_item);
-POINTERLIST_INSTANTIATE(Mudela_staff);
-POINTERLIST_INSTANTIATE(Mudela_voice);
-POINTERLIST_INSTANTIATE(Mudela_column);
-POINTERLIST_INSTANTIATE(Mudela_score);