summaryrefslogtreecommitdiff
path: root/lily/include
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@xs4all.nl>2000-09-18 15:03:45 +0200
committerHan-Wen Nienhuys <hanwen@xs4all.nl>2000-09-18 15:03:45 +0200
commit287611887cd612ac84dbf10c5fe4e1a44cc56596 (patch)
tree6f5f9d1d182daf9453bc367b9e5280d826c53875 /lily/include
parentc71e50cdade5bfc32c536d538cab8955fb648db3 (diff)
release: 1.3.87
================ * Made fixes to part-combine examples and Coriolan. * Bugfix: don't dump core on unterminated (de)crescendo. * Rolled next (M) also into get_music (M), similar to process (M), so that sequential-music-iterator::get_music (M) returns something useful. * Bugfix: part-combiner still expected Music_sequence, where get_music () now returns plain list of events. 1.3.86.h
Diffstat (limited to 'lily/include')
-rw-r--r--lily/include/auto-change-iterator.hh2
-rw-r--r--lily/include/change-iterator.hh6
-rw-r--r--lily/include/chord-tremolo-iterator.hh5
-rw-r--r--lily/include/command-request.hh2
-rw-r--r--lily/include/folded-repeat-iterator.hh4
-rw-r--r--lily/include/grace-iterator.hh4
-rw-r--r--lily/include/lyric-combine-music-iterator.hh5
-rw-r--r--lily/include/moment.hh13
-rw-r--r--lily/include/music-iterator.hh67
-rw-r--r--lily/include/music-wrapper-iterator.hh8
-rw-r--r--lily/include/part-combine-music-iterator.hh9
-rw-r--r--lily/include/property-iterator.hh14
-rw-r--r--lily/include/request-chord-iterator.hh23
-rw-r--r--lily/include/request-iterator.hh0
-rw-r--r--lily/include/sequential-music-iterator.hh8
-rw-r--r--lily/include/simple-music-iterator.hh8
-rw-r--r--lily/include/simultaneous-music-iterator.hh8
-rw-r--r--lily/include/time-scaled-music-iterator.hh2
-rw-r--r--lily/include/unfolded-repeat-iterator.hh5
19 files changed, 85 insertions, 108 deletions
diff --git a/lily/include/auto-change-iterator.hh b/lily/include/auto-change-iterator.hh
index 5160fac293..72b463c7ef 100644
--- a/lily/include/auto-change-iterator.hh
+++ b/lily/include/auto-change-iterator.hh
@@ -20,7 +20,7 @@ public:
Auto_change_iterator ();
protected:
- virtual void do_process (Moment);
+ virtual void process (Moment);
private:
Direction where_dir_;
diff --git a/lily/include/change-iterator.hh b/lily/include/change-iterator.hh
index f52eb63120..8714801b3f 100644
--- a/lily/include/change-iterator.hh
+++ b/lily/include/change-iterator.hh
@@ -10,15 +10,15 @@
#ifndef CHANGE_ITERATOR_HH
#define CHANGE_ITERATOR_HH
-#include "music-iterator.hh"
+#include "simple-music-iterator.hh"
-class Change_iterator : public Music_iterator
+class Change_iterator : public Simple_music_iterator
{
public:
VIRTUAL_COPY_CONS (Music_iterator);
/* constructor is public */
- virtual void do_process (Moment);
+ virtual void process (Moment);
private:
void error (String);
diff --git a/lily/include/chord-tremolo-iterator.hh b/lily/include/chord-tremolo-iterator.hh
index f83e497a31..3f08463c36 100644
--- a/lily/include/chord-tremolo-iterator.hh
+++ b/lily/include/chord-tremolo-iterator.hh
@@ -20,11 +20,10 @@ public:
protected:
virtual ~Chord_tremolo_iterator ();
- virtual Moment next_moment () const;
+ virtual Moment pending_moment () const;
virtual void construct_children () ;
virtual bool ok () const;
- virtual void do_print () const;
- virtual void do_process (Moment) ;
+ virtual void process (Moment) ;
virtual Music_iterator *try_music_in_children (Music *) const;
private:
diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh
index 7ef86dda91..875024650c 100644
--- a/lily/include/command-request.hh
+++ b/lily/include/command-request.hh
@@ -48,7 +48,7 @@ public:
Tempo_req();
protected:
- virtual void do_print () const;
+ virtual void do_print () const;
VIRTUAL_COPY_CONS(Music);
bool do_equal_b (Request const *) const;
};
diff --git a/lily/include/folded-repeat-iterator.hh b/lily/include/folded-repeat-iterator.hh
index c5f73658df..6217df1bee 100644
--- a/lily/include/folded-repeat-iterator.hh
+++ b/lily/include/folded-repeat-iterator.hh
@@ -24,14 +24,14 @@ public:
~Folded_repeat_iterator ();
virtual void construct_children ();
- virtual Moment next_moment () const;
+ virtual Moment pending_moment () const;
virtual bool ok () const;
protected:
void enter_alternative ();
void leave_body ();
- virtual void do_process (Moment);
+ virtual void process (Moment);
virtual Music_iterator *try_music_in_children (Music *) const;
private:
diff --git a/lily/include/grace-iterator.hh b/lily/include/grace-iterator.hh
index 49db1a9d39..4806037d28 100644
--- a/lily/include/grace-iterator.hh
+++ b/lily/include/grace-iterator.hh
@@ -18,9 +18,9 @@ public:
VIRTUAL_COPY_CONS (Music_iterator);
~Grace_iterator ();
virtual void construct_children () ;
- virtual void do_process (Moment);
+ virtual void process (Moment);
- Moment next_moment () const;
+ Moment pending_moment () const;
};
diff --git a/lily/include/lyric-combine-music-iterator.hh b/lily/include/lyric-combine-music-iterator.hh
index eada524f80..5d519abf66 100644
--- a/lily/include/lyric-combine-music-iterator.hh
+++ b/lily/include/lyric-combine-music-iterator.hh
@@ -21,12 +21,11 @@ public:
protected:
virtual void construct_children ();
- virtual Moment next_moment () const;
- virtual void do_process (Moment);
+ virtual Moment pending_moment () const;
+ virtual void process (Moment);
virtual Music_iterator *try_music_in_children (Music *) const;
virtual bool ok () const;
- virtual void do_print () const;
virtual ~Lyric_combine_music_iterator ();
private:
diff --git a/lily/include/moment.hh b/lily/include/moment.hh
index 0bd535a6d5..55a5c87a81 100644
--- a/lily/include/moment.hh
+++ b/lily/include/moment.hh
@@ -44,18 +44,5 @@ IMPLEMENT_ARITHMETIC_OPERATOR (Moment, % );
INSTANTIATE_COMPARE (Moment const&, Rational::compare);
-/**
- A really big time-moment.
-
- Windhoze-suck-suck-suck-suck-suck-thank-you-cygnus
-
- I get tired of all these incompatibilities. Let's just assume that
- INT_MAX is really, really, really big.
-
- Can't we name this Saint_jut_mom (Sintjuttemis ?) */
-
-/* URG ! WE HAVE TWO RATIONAL INFINITIES! */
-const Moment infinity_mom = INT_MAX;
-
#endif /* MOMENT_HH */
diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh
index 7ea76005a5..2f9c6cf7cc 100644
--- a/lily/include/music-iterator.hh
+++ b/lily/include/music-iterator.hh
@@ -16,14 +16,33 @@
#include "virtual-methods.hh"
#include "interpretation-context-handle.hh"
-/** Walk through music and deliver music to translation units, synced
- in time. This class provides both the implementation of the shared
- code, and the public interface.
-
- Derived classes should only have a public constructor.
- The state of an iterator would be the intersection of the particular music
- construct with one point in musical time.
- */
+/**
+ Conceptually a music-iterator operates on a queue of musical events
+ that are pending. This queue does not actually exist, but it is a
+ way of viewing and traversing music-expressions.
+
+
+ ok () -- events left ?
+
+ pending_mom () -- time tag of the next event to be processed.
+
+ process (M) -- process all at M (Precondition: no events exist before
+ M). Side-effects:
+
+ * This removes all events at M from the pending queue.
+
+ * Typically this reports the music to an interpretation context,
+ thus changing the state of the interpretation context.
+
+ get_music (M) -- return all events starting at M (pre: no events
+ before M). Side effects:
+
+ * This removes all events at M from the pending queue.
+
+ Because next (M) is rolled into process () as a side effect,
+ we need to roll next (M) into get_music too. Urg.
+
+*/
class Music_iterator
{
public:
@@ -52,51 +71,27 @@ public:
static Music_iterator* static_get_iterator_p (Music * mus);
void init_translator (Music *, Translator_group *);
- /// Find the next interesting point in time.
- virtual Moment next_moment () const;
-
-
- ///Are we finished with this piece of music?
+ virtual Moment pending_moment () const;
virtual bool ok () const;
-
- virtual SCM get_music ();
- virtual bool next ();
-
- void process (Moment until);
+ virtual SCM get_music (Moment until)const;
+ virtual void process (Moment until);
/**
Construct sub-iterators, and set the translator to
report to.
*/
virtual void construct_children ();
- void print () const;
protected:
Music * music_l_;
- /// ugh. JUNKME
- bool first_b_;
-
- /**
- Do the actual printing. This should be overriden in derived classes. It
- is called by #print#, in the public interface
- */
- virtual void do_print () const;
-
- /**
- Find a bottom notation context to deliver requests to.
- */
- virtual Translator_group* get_req_translator_l ();
-
/**
Get an iterator for MUS, inheriting the translation unit from THIS.
*/
Music_iterator* get_iterator_p (Music *) const;
- virtual void do_process (Moment);
-
virtual Music_iterator* try_music_in_children (Music *) const;
-
+
private:
Interpretation_context_handle handle_;
};
diff --git a/lily/include/music-wrapper-iterator.hh b/lily/include/music-wrapper-iterator.hh
index edb6b8a4d8..cbe4fa3827 100644
--- a/lily/include/music-wrapper-iterator.hh
+++ b/lily/include/music-wrapper-iterator.hh
@@ -27,14 +27,12 @@ public:
~Music_wrapper_iterator ();
virtual void construct_children () ;
- virtual Moment next_moment () const;
+ virtual Moment pending_moment () const;
virtual bool ok () const;
- virtual SCM get_music ();
- virtual bool next ();
+ virtual SCM get_music (Moment)const;
protected:
- virtual void do_print () const;
- virtual void do_process (Moment);
+ virtual void process (Moment);
virtual Music_iterator *try_music_in_children (Music *) const;
Music_iterator *child_iter_p_;
diff --git a/lily/include/part-combine-music-iterator.hh b/lily/include/part-combine-music-iterator.hh
index ee27bebb3a..4400e458ee 100644
--- a/lily/include/part-combine-music-iterator.hh
+++ b/lily/include/part-combine-music-iterator.hh
@@ -22,14 +22,11 @@ protected:
virtual ~Part_combine_music_iterator ();
virtual void construct_children ();
- virtual Moment next_moment () const;
- virtual void do_process (Moment);
+ virtual Moment pending_moment () const;
+ virtual void process (Moment);
+ virtual SCM get_music (Moment)const;
virtual Music_iterator *try_music_in_children (Music *) const;
-
virtual bool ok () const;
- virtual bool next ();
- virtual SCM get_music ();
- virtual void do_print () const;
private:
void change_to (Music_iterator*, String, String);
diff --git a/lily/include/property-iterator.hh b/lily/include/property-iterator.hh
index bda6483ec9..cd8aace3f0 100644
--- a/lily/include/property-iterator.hh
+++ b/lily/include/property-iterator.hh
@@ -10,7 +10,7 @@
#ifndef PROPERTY_ITERATOR_HH
#define PROPERTY_ITERATOR_HH
-#include "music-iterator.hh"
+#include "simple-music-iterator.hh"
@@ -18,31 +18,31 @@
/**
Iterate a property.
*/
-class Property_iterator : public Music_iterator
+class Property_iterator : public Simple_music_iterator
{
public:
VIRTUAL_COPY_CONS (Music_iterator);
/* construction */
protected:
- virtual void do_process (Moment);
+ virtual void process (Moment);
};
-class Push_property_iterator : public Music_iterator
+class Push_property_iterator : public Simple_music_iterator
{
public:
VIRTUAL_COPY_CONS (Music_iterator);
protected:
/* construction */
- virtual void do_process (Moment);
+ virtual void process (Moment);
};
-class Pop_property_iterator : public Music_iterator
+class Pop_property_iterator : public Simple_music_iterator
{
public:
VIRTUAL_COPY_CONS (Music_iterator);
protected:
/* construction */
- virtual void do_process (Moment);
+ virtual void process (Moment);
};
diff --git a/lily/include/request-chord-iterator.hh b/lily/include/request-chord-iterator.hh
index 0e820f7b1f..5d6602add1 100644
--- a/lily/include/request-chord-iterator.hh
+++ b/lily/include/request-chord-iterator.hh
@@ -10,33 +10,34 @@
#ifndef REQUEST_ITER_HH
#define REQUEST_ITER_HH
-#include "music-iterator.hh"
+#include "simple-music-iterator.hh"
/**
Walk through a Request_chord
*/
-class Request_chord_iterator : public Music_iterator
+class Request_chord_iterator : public Simple_music_iterator
{
Request_chord * elt_l () const;
/**
- cache elt_l ()->length_mom ().
+ Find a bottom notation context to deliver requests to.
*/
- Moment elt_length_mom_;
- bool last_b_;
+ virtual Translator_group* get_req_translator_l ();
+
+ /*
+ Since Request_chord_iterator has no list-cursor internally, we
+ must use a status variable to adminstrate where we are */
+
+ enum { NONE_DONE, START_DONE, END_DONE } status_;
public:
VIRTUAL_COPY_CONS (Music_iterator);
Request_chord_iterator ();
Request_chord_iterator (Request_chord_iterator const&);
-
- virtual bool next ();
- virtual bool ok () const;
+ virtual SCM get_music (Moment) const;
protected:
- virtual void do_process (Moment);
- virtual Moment next_moment() const;
+ virtual void process (Moment);
virtual void construct_children();
- virtual void do_print() const;
};
diff --git a/lily/include/request-iterator.hh b/lily/include/request-iterator.hh
deleted file mode 100644
index e69de29bb2..0000000000
--- a/lily/include/request-iterator.hh
+++ /dev/null
diff --git a/lily/include/sequential-music-iterator.hh b/lily/include/sequential-music-iterator.hh
index 661ce709b4..5661f260bd 100644
--- a/lily/include/sequential-music-iterator.hh
+++ b/lily/include/sequential-music-iterator.hh
@@ -24,14 +24,12 @@ public:
virtual ~Sequential_music_iterator ();
virtual void construct_children ();
- virtual Moment next_moment () const;
+ virtual Moment pending_moment () const;
virtual bool ok () const;
- virtual SCM get_music ();
- virtual bool next ();
+ virtual SCM get_music (Moment)const;
protected:
- virtual void do_print() const;
- virtual void do_process (Moment);
+ virtual void process (Moment);
virtual Music_iterator *try_music_in_children (Music *) const;
private:
diff --git a/lily/include/simple-music-iterator.hh b/lily/include/simple-music-iterator.hh
index f81a4cd629..6d86c1c35c 100644
--- a/lily/include/simple-music-iterator.hh
+++ b/lily/include/simple-music-iterator.hh
@@ -13,11 +13,17 @@
class Simple_music_iterator : public Music_iterator
{
+protected:
+ Moment length_mom_;
+ Moment last_processed_mom_;
public:
VIRTUAL_COPY_CONS (Music_iterator);
Simple_music_iterator ();
Simple_music_iterator (Simple_music_iterator const &);
- virtual void do_process (Moment);
+ virtual void process (Moment);
+ virtual bool ok()const;
+ virtual Moment pending_moment ()const;
+ virtual void construct_children ();
};
#endif /* SIMPLE_MUSIC_ITERATOR_HH */
diff --git a/lily/include/simultaneous-music-iterator.hh b/lily/include/simultaneous-music-iterator.hh
index 20efba729e..e5ecdcd14b 100644
--- a/lily/include/simultaneous-music-iterator.hh
+++ b/lily/include/simultaneous-music-iterator.hh
@@ -26,14 +26,12 @@ public:
int cursor_i_;
virtual void construct_children ();
- virtual Moment next_moment () const;
+ virtual Moment pending_moment () const;
virtual bool ok () const;
- virtual bool next ();
- virtual SCM get_music ();
+ virtual SCM get_music (Moment)const;
protected:
- virtual void do_print () const;
- virtual void do_process (Moment);
+ virtual void process (Moment);
virtual Music_iterator *try_music_in_children (Music *) const;
private:
diff --git a/lily/include/time-scaled-music-iterator.hh b/lily/include/time-scaled-music-iterator.hh
index e124bf2d42..e18716adc9 100644
--- a/lily/include/time-scaled-music-iterator.hh
+++ b/lily/include/time-scaled-music-iterator.hh
@@ -18,7 +18,7 @@ public:
VIRTUAL_COPY_CONS (Music_iterator);
/* construction */
protected:
- virtual void do_process (Moment);
+ virtual void process (Moment);
};
diff --git a/lily/include/unfolded-repeat-iterator.hh b/lily/include/unfolded-repeat-iterator.hh
index 08a51b5041..6ffdbb62aa 100644
--- a/lily/include/unfolded-repeat-iterator.hh
+++ b/lily/include/unfolded-repeat-iterator.hh
@@ -47,13 +47,12 @@ public:
protected:
virtual void construct_children ();
- virtual Moment next_moment () const;
- virtual void do_process (Moment);
+ virtual Moment pending_moment () const;
+ virtual void process (Moment);
virtual Music_iterator *try_music_in_children (Music *) const;
virtual bool ok () const;
virtual void next_element ();
- virtual void do_print () const;
};
#endif /* UNFOLDED_REPEAT_ITERATOR_HH */