From: fred Date: Tue, 26 Mar 2002 22:12:56 +0000 (+0000) Subject: lilypond-1.1.43 X-Git-Tag: release/1.5.59~2323 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2c840bd56b9df28546c8cb5449e279d37a585b7a;p=lilypond.git lilypond-1.1.43 --- diff --git a/flower/include/cursor.hh b/flower/include/cursor.hh deleted file mode 100644 index a7e5a1836d..0000000000 --- a/flower/include/cursor.hh +++ /dev/null @@ -1,117 +0,0 @@ -// cursor.hh - -#ifndef __CURSOR_HH -#define __CURSOR_HH - -#include "link.hh" -template class List; - -/** iterator to List. - add and insert extend the list - items are always stored as copies in List, but: - List : copies of String stored - List : copies of String* stored! - - the operations add and insert actually delegate the work to List class. - */ -template -class Cursor -{ -public: - /** create cursor, set at top. The const part isn't true, actually, #list# - surely isn't const, but I get tired of the warning messages. */ - Cursor (const List& list, Link* pointer = 0); - Cursor (const Cursor& cursor); - - T& thing(); - - /// return current T - T& operator *() { return thing(); } - operator T() { return thing(); } - Cursor operator =(const Cursor& c); - - /// make cursor with #no# items back - Cursor operator -(int no) const; - - /// make cursor with #no# items further - Cursor operator +(int no) const; - int operator -(Cursor op) const; - Cursor operator -=(int); - Cursor operator +=(int); - /// move one down - void next(); - /// move one up. - void previous(); - /// return current and move one down - Cursor operator ++(int); - - /// return current and move one up - Cursor operator --(int); - - /// point to link? - bool ok() const; - - /// ++ items left? - bool forward() const; - - /// -- items left? - bool backward() const; - - /** put (copy) after me in List. - analogously to editor. ok() interpreted as at end - of line. - - PRE: !ok, POST: added to bottom() - - PRE: ok, POST: added after me - - cursor points to same object, cursor.next() is newly added - object. - */ - void add (T const & thing); - - /** put (copy) before me in List. - analogously to editor. ok() interpreted as at begin of - line. - - PRE: !ok, POST: add to top() - - PRE: ok, POST: add before me - - cursor points to same object, cursor.previous() - is newly inserted object. - */ - - void insert (T const & thing); - /// - void backspace(); - - /// - void del(); - - /// access the list this came from - List* list_l() const ; - Link* pointer(); - static int compare (Cursor a,Cursorb) { return a-b; } - -private: - - Link* pointer_; - List* list_l_; -}; - - -/* - comparisons. - */ -#include "compare.hh" - - -TEMPLATE_INSTANTIATE_COMPARE(Cursor, Cursor::compare, template); - -#include "pcursor.hh" -#include "list.hh" -#include "cursor.icc" -#include "iterate.hh" - -#endif // CURSOR_HH diff --git a/flower/include/cursor.icc b/flower/include/cursor.icc deleted file mode 100644 index 90e64a608f..0000000000 --- a/flower/include/cursor.icc +++ /dev/null @@ -1,142 +0,0 @@ -/* - cursor.icc -- implement Cursor - - source file of the Flower Library - - (c) 1997--1999 Han-Wen Nienhuys - Jan Nieuwenhuizen -*/ - - -#ifndef CURSOR_ICC -#define CURSOR_ICC - - - -#include - -/** - Initialisation of Cursor.. Set pointer and list fields. - */ -template -inline -Cursor::Cursor (const List & list, Link* p ) -{ - list_l_ = (List *) &list; // damn const - if (list.size()) - pointer_ = p ? p : list.top_; - else - pointer_ = p; -} - - - -template -inline -Cursor::Cursor (const Cursor& cursor) -{ - list_l_= cursor.list_l_; - pointer_ = cursor.pointer_; -} - -template -inline T& -Cursor::thing() -{ - assert (pointer_); - return pointer_->thing(); -} - -template -Cursor -Cursor::operator =(const Cursor& c) -{ - assert (list_l_ == c.list_l_); - pointer_ = c.pointer_; - return *this; -} - -template -inline void -Cursor::add (const T& th) -{ - list_l_->add (th, *this); -} - -template -inline void -Cursor::insert (const T& th) -{ - list_l_->insert (th, *this); -} - -template -inline List * -Cursor::list_l() const -{ - return list_l_; // ugh! -} - -template -inline Link* -Cursor::pointer() -{ - return pointer_; -} - -template -inline bool -Cursor::backward() const -{ - return (pointer_ != 0); -} - -template -inline bool -Cursor::forward() const -{ - return (pointer_ != 0); -} - -template -inline bool -Cursor::ok() const -{ - return (pointer_ != 0); -} -template -inline void -Cursor::next() -{ - assert (pointer_); - pointer_ = pointer_->next(); -} - -template -inline Cursor -Cursor::operator ++(int) -{ - Cursor r (*this); - next(); - return r; -} - -template -inline void -Cursor::previous() -{ - assert (pointer_); - pointer_ = pointer_->previous(); -} - -template -inline Cursor -Cursor::operator --(int) -{ - Cursor r (*this); - previous(); - return r; -} - - -#endif // CURSOR_ICC diff --git a/flower/include/cursor.tcc b/flower/include/cursor.tcc deleted file mode 100644 index 42b0c52f3c..0000000000 --- a/flower/include/cursor.tcc +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef CURSOR_CC -#define CURSOR_CC - -#include "cursor.hh" -#include - -template -void -Cursor::backspace() -{ - Cursor c (*this); - if (c.ok()) - c--; - list_l_->remove (*this); -} - -template -void -Cursor::del() -{ - Cursor c (*this); - if (c.ok()) - c++; - list_l_->remove (*this); - *this = c; -} - - -template -Cursor -Cursor::operator -=(int j) -{ - while (j--) - (*this)--; - return *this; -} -template -Cursor -Cursor::operator +=(int j) -{ - while (j++) - (*this)++; - return *this; -} - -template -Cursor -Cursor::operator +(int i) const -{ - Cursor r = *this; - - if (i<0) - return r -(-i); - - while (i--) - r++; - - return r; -} - -template -Cursor -Cursor::operator -(int i) const -{ - Cursor r = *this; - if (i<0) - return r +(-i); - - while (i--) - r--; - - return r; -} -/* - warning: can't use Cursor::operator == (Cursor), - since it uses Cursor::operator-(Cursor) - */ -template -int -Cursor::operator-(Cursor rhs) const -{ - assert (rhs.list_l_ == list_l_); - int dif = 0; - - // search from *this on further up (positive difference) - Cursor c (*this); - while (c.ok() && c.pointer_ != rhs.pointer_) - { - c--; - dif++; - } - - if (c.ok()) - goto gotcha; // so, sue me. - - // search in direction of bottom. (negative diff) - dif =0; - c=*this; - while (c.ok() && c.pointer_ !=rhs.pointer_) - { - dif --; - c++; - } - assert (c.ok()); - - gotcha: - assert ((*this - dif).pointer_ == c.pointer_); - return dif; -} - -#endif diff --git a/flower/include/link.hh b/flower/include/link.hh deleted file mode 100644 index 5fce0ac915..0000000000 --- a/flower/include/link.hh +++ /dev/null @@ -1,38 +0,0 @@ -// link.hh - -#ifndef __LINK_HH -#define __LINK_HH -template -class List; - - -/// class for List -template -class Link -{ -// friend class Cursor; -public: - Link (T const & thing); - - Link* previous(); - Link* next(); - - /// put new Link item after me in list - void add (T const & thing); - /// put new Link item before me in list - void insert (T const & thing); - void remove (List &l); - - T& thing(); - void OK() const; -private: - Link (Link* previous, Link* next, T const & thing); - - T thing_; - Link* previous_; - Link* next_; -}; - -#include "link.icc" - -#endif // __LINK_HH // diff --git a/flower/include/link.icc b/flower/include/link.icc deleted file mode 100644 index 4b3c886aad..0000000000 --- a/flower/include/link.icc +++ /dev/null @@ -1,104 +0,0 @@ -// link.inl -*-c++-*- -#ifndef LINK_INL -#define LINK_INL -#include -template -inline -void -Link::OK() const -{ -#ifndef NDEBUG - if (previous_) - { - assert (previous_->next_ == this); - } - if (next_) - { - assert (next_->previous_ == this); - } -#endif -} - -template -inline -Link::Link (const T& thing) : - thing_(thing) -{ - previous_ = next_ = 0; -} - -template -inline -Link::Link (Link* previous, Link* next, const T& thing) : - thing_(thing) -{ - previous_ = previous; - next_ = next; -} - -template -inline -Link* -Link::next() -{ - return next_; -} - -template -inline -Link* -Link::previous() -{ - return previous_; -} - -template -inline -void -Link::add (const T& thing) -{ - - Link* l = new Link(this, next_, thing); - if (next_) - next_->previous_ = l; - next_ = l; -} - -template -inline void -Link::insert (const T& thing) -{ - // Link* l = new Link(next_, this, thing); - // bugfix hwn 16/9/96 - Link* l = new Link(previous_, this, thing); - if (previous_) - previous_->next_ = l; - previous_ = l; -} - -/* - don't forget to adjust #l#'s top_ and bottom_. - */ -template -inline void -Link::remove (List &l) -{ - if (previous_) - previous_->next_ = next_; - else - l.top_ = next_; - - if (next_) - next_->previous_ = previous_; - else - l.bottom_ = previous_; -} - -template -inline -T& -Link::thing() -{ - return thing_; -} -#endif diff --git a/flower/include/list.hh b/flower/include/list.hh deleted file mode 100644 index 9be31601a6..0000000000 --- a/flower/include/list.hh +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef __LIST_HH -#define __LIST_HH - -class ostream; -template class Cursor; -template class Link; - -/** all-purpose doubly linked list. - - List can be seen as all items written down on paper, - from top to bottom - - class Cursor is used to extend List - - items are always stored as copies in List, but: - #List# : copies of #String# stored - #List# : copies of #String*# stored! - (do not use, use \Ref{Link_list} ## instead.) - - {\bf note:} - retrieving "invalid" cursors, i.e. - #top()/bottom ()# from empty list, #find ()# without success, - results in a nonvalid Cursor (#!ok()#) - - - INVARIANTEN! -*/ - -template -class List -{ -public: - List (List const&src); - - /// construct empty list - List(); - virtual ~List(); - - int size() const; - - Cursor bottom() const; // const sucks. - Cursor top() const; - - void OK() const; // check list - void junk_links(); - -protected: - friend class Cursor; - friend class Link; - - void concatenate (List const &s); - - /** make *this empty. - - POST: - size == 0 - - WARNING: - contents lost, and not deleted. - */ - void set_empty(); - - void add (T const & thing, Cursor &after_me); - - /// put thing before #before_me# - void insert (T const & thing, Cursor &before_me); - - /** Remove link pointed to by me. Destructor of contents called - (nop for pointers) - - POST - none; - - - WARNING: do not use #me# after calling - */ - void remove (Cursor me); - - - /* ************** */ - - int size_; - Link* top_; - Link* bottom_; -}; - -#include "list.icc" -#include "cursor.hh" - -#endif // __LIST_HH // - - - - diff --git a/flower/include/list.icc b/flower/include/list.icc deleted file mode 100644 index 3faf315628..0000000000 --- a/flower/include/list.icc +++ /dev/null @@ -1,67 +0,0 @@ -/* - list.icc -- implement List inline functions - - source file of the Flower Library - - (c) 1996, 1997--1999 - Jan Nieuwenhuizen - Han-Wen Nienhuys -*/ - - -#ifndef LIST_ICC -#define LIST_ICC - -template -inline -List::List() -{ - set_empty(); -} - -template -inline void -List::set_empty() -{ - top_ = bottom_ = 0; - size_ = 0; -} - -template -inline void -List::remove (Cursor me) -{ - if (me.ok()) - { - Link *lp = me.pointer(); - lp->remove (*this); - delete lp; - size_--; - } -} - -template -inline int -List::size() const -{ - return size_; -} - -template -inline Cursor -List::top() const -{ - return Cursor(*this, top_); -} - - -template -inline Cursor -List::bottom() const -{ - return Cursor(*this, bottom_); -} - - -#endif - diff --git a/flower/include/list.tcc b/flower/include/list.tcc deleted file mode 100644 index 3c66774faf..0000000000 --- a/flower/include/list.tcc +++ /dev/null @@ -1,151 +0,0 @@ -/* - list.tcc -- implement List - - source file of the Flower Library - - (c) 1997--1999 Han-Wen Nienhuys -*/ -#ifndef LIST_CC -#define LIST_CC - - -#include "list.hh" - -template -List::List (List const&src) -{ - set_empty(); - // probably el stupido - for (Cursor c (src); c.ok(); c++) - bottom().add (c); -} - -template -void -List::OK() const -{ - int i = size_; - Link *lp = top_; - while (i--) - { - assert (lp); - lp->OK(); - lp = lp->next(); - } - assert (!lp); - i = size_; - lp = bottom_; - while (i--) - { - assert (lp); - lp->OK(); - lp = lp->previous(); - } - assert (!lp); -} - -template -void -List::junk_links() -{ - Cursor c (*this); - while (c.ok()) - c.del(); -} - -template -List::~List() -{ - junk_links(); -} - -/** - - add after after_me. - - Procedure: - \begin{itemize} - \item if #after_me# is #ok()#, add after #after_me#, else - \item if list !empty simply add to bottom, else - \item list is empty: create first \Ref{Link} and initialize - #bottom_# and #top_#. - \end{itemize} -*/ -template -void -List::add (T const & thing, Cursor &after_me) -{ - if (!size_) { // not much choice if list is empty - bottom_ = top_ = new Link(thing); - if (!after_me.ok()) - after_me = bottom(); - } - else { // add at aprioprate place - if (!after_me.ok()) - after_me = bottom(); - Link *p =after_me.pointer(); - p->add (thing); - if (p == bottom_) // adjust bottom_ if necessary. - bottom_ = p->next(); - } - - size_++; -} - -template -void -List::insert (T const & thing, Cursor &before_me) -{ - if (!size_) - { - bottom_ = top_ = new Link(thing); - if (!before_me.ok()) - before_me = top(); - - } - else - { - if (!before_me.ok()) - before_me = top(); - - Link *p = before_me.pointer() ; - - p->insert (thing); - if (p == top_) - top_ = p->previous(); - } - - size_++; -} - - -template -void -List::concatenate (List const&s) -{ - Cursor b (bottom()); - for (Cursor c (s); c.ok(); c++) - { - b.add (c); - b++; - } -} - -#ifndef __CYGWIN32__ // ugh should check for some gcc/egcs version - -// instantiate a template: explicit instantiation. -#define LIST_INSTANTIATE(a) template class List; \ - template class Cursor; template class Link - -#else - -#define LIST_INSTANTIATE(T)\ - static void force_list_members ()\ - {\ - List bla;\ - bla.top().add ((void*)0);\ - } -#endif - -#endif - diff --git a/flower/include/pcursor.hh b/flower/include/pcursor.hh deleted file mode 100644 index 9e7959f8a1..0000000000 --- a/flower/include/pcursor.hh +++ /dev/null @@ -1,71 +0,0 @@ -/* - pcursor.hh -- part of flowerlib - - (c) 1996 Han-Wen Nienhuys&Jan Nieuwenhuizen -*/ - -#ifndef PCURSOR_HH -#define PCURSOR_HH - -#include "plist.hh" -#include "cursor.hh" - -/** cursor to go with Link_list. - don't create Link_list's. - This cursor is just an interface class for Cursor. It takes care of the - appropriate type casts - */ -template -class PCursor : private Cursor { - friend class Pointer_list; - - /// delete contents - void junk(); -public: - Cursor::ok; - Cursor::del; - Cursor::backspace; - Cursor::next; - Cursor::previous; - - T remove_p() { - T p = ptr(); - Cursor::del(); - return p; - } - T remove_prev_p() { - assert (ok()); - (*this)--; - return remove_p(); - } - - Link_list *list_l() { return (Link_list *)Cursor::list_l (); } - PCursor operator++(int) { return Cursor::operator++(0);} - PCursor operator--(int) { return Cursor::operator--(0); } - PCursor operator+=(int i) { return Cursor::operator+=(i);} - PCursor operator-=(int i) { return Cursor::operator-=(i); } - PCursor operator -(int no) const { return Cursor::operator-(no);} - int operator -(PCursor op) const { return Cursor::operator-(op);} - PCursor operator +(int no) const {return Cursor::operator+(no);} - PCursor (const Link_list & l) : Cursor (l) {} - PCursor (const Cursor& cursor) : Cursor(cursor) { } - void* vptr() const { return *((Cursor &) *this); } - - // should return T& ? - T ptr() const { return (T) vptr (); } - T operator ->() const { return ptr(); } - operator T() { return ptr(); } - T operator *() { return ptr(); } - void add (T const & p) { Cursor::add ((void*) p); } - void insert (T const & p) { Cursor::insert ((void*) p);} - static int compare (PCursor a,PCursorb) { - return Cursor::compare (a,b); - } -}; - - - -#include "compare.hh" -TEMPLATE_INSTANTIATE_COMPARE(PCursor, PCursor::compare, template); - -#endif diff --git a/flower/include/pcursor.tcc b/flower/include/pcursor.tcc deleted file mode 100644 index a1f706b8a2..0000000000 --- a/flower/include/pcursor.tcc +++ /dev/null @@ -1,16 +0,0 @@ -#include "pcursor.hh" - -template -void -PCursor::junk() -{ -#if !defined (NDEBUG) && defined (PARANOID) - list_l()->OK(); -#endif - - delete ptr(); -#if !defined (NDEBUG)&&defined (PARANOID) - thing() = 0; - list_l()->OK(); -#endif -} diff --git a/flower/include/plist.hh b/flower/include/plist.hh deleted file mode 100644 index 03432c927e..0000000000 --- a/flower/include/plist.hh +++ /dev/null @@ -1,76 +0,0 @@ -/* - list.hh -- part of flowerlib - - (c) 1996 Han-Wen Nienhuys & Jan Nieuwenhuizen -*/ - -#ifndef PLIST_HH -#define PLIST_HH - -#include "list.hh" - -/** - A list of pointers. - - Use for list of pointers, e.g. Link_list. - This class does no deletion of the pointers, but it knows how to - copy itself (shallow copy). We could have derived it from List, - but this design saves a lot of code dup; for all Link_lists in the - program only one parent List is instantiated. - */ -template -class Link_list : public List -{ -public: - PCursor top() const{ - return PCursor (List::top()); - } - PCursor bottom() const { - return PCursor (List::bottom()); - } - PCursor find (T) const; - void concatenate (Link_list const &s) { List::concatenate (s); } - - Link_list() {} -}; - -/** - - Link_list which deletes pointers given to it. - - NOTE: - - The copy constructor doesn't do what you'd want: - Since T might have a virtual ctor, we don't try to do a - - new T(**cursor) - - You have to copy this yourself, or use the macro Link_list__copy - - TODO - operator =() - */ -template -class Pointer_list : public Link_list { - -public: - void junk(); - Pointer_list (Pointer_list const& l) : Link_list (l) { set_empty(); } - Pointer_list() { } - ~Pointer_list() { junk (); } -}; - -#define Pointer_list__copy(T, to, from, op) \ -for (PCursor _pc_(from); _pc_.ok(); _pc_++)\ -to.bottom().add (_pc_->op)\ -\ - - -template -void PL_copy (Pointer_list &dst,Pointer_list const&src); - - - -#include "plist.icc" - -#endif diff --git a/flower/include/plist.icc b/flower/include/plist.icc deleted file mode 100644 index b8d3a48091..0000000000 --- a/flower/include/plist.icc +++ /dev/null @@ -1,33 +0,0 @@ -/* -*-c++-*- - plist.icc -- part of flowerlib - - (c) 1996, 1997--1999 Han-Wen Nienhuys& Jan Nieuwenhuizen -*/ - -#ifndef PLIST_INL -#define PLIST_INL - -template -inline void -PL_copy (Pointer_list &to, Pointer_list const&src) -{ - for (PCursor pc (src); pc.ok(); pc++) - { - T *q = pc; - T *p=new T(*q) ; - to.bottom().add (p); - } -} - - -template -inline PCursor -Link_list::find (T what) const -{ - PCursor i (*this); - for (; i.ok(); i++) - if (i.ptr() == what) - break; - return i; -} -#endif diff --git a/flower/include/plist.tcc b/flower/include/plist.tcc deleted file mode 100644 index 24db16f85d..0000000000 --- a/flower/include/plist.tcc +++ /dev/null @@ -1,42 +0,0 @@ -/* - plist.tcc -- implement Pointer_list - - source file of the Flower Library - - (c) 1997--1999 Han-Wen Nienhuys -*/ - - -#ifndef PLIST_TCC -#define PLIST_TCC - -#include "plist.hh" - -template -void -Pointer_list::junk() -{ - PCursor c (*this); - while (c.ok()) - { - delete c.remove_p(); - } -} - -#ifndef __CYGWIN32__ // ugh should check for some gcc/egcs version - -#define POINTERLIST_INSTANTIATE(a) template class Pointer_list;\ - template class PCursor; - -#else - -#define POINTERLIST_INSTANTIATE(T)\ - static void force_junk##T ()\ - {\ - Pointer_list bla;\ - bla.junk ();\ - } - -#endif - -#endif // PLIST_TCC diff --git a/input/test/staff-size.fly b/input/test/staff-size.fly deleted file mode 100644 index 08c1bb8c41..0000000000 --- a/input/test/staff-size.fly +++ /dev/null @@ -1,12 +0,0 @@ -< \context Staff = VA { - \property Staff.staffLineLeading = "4" \property Staff.fontsize = "-2" - \property Voice . dynamicDir = \up \stemdown -\key gis; - c8 d [e f g a] b c \ff - } - -\context Staff = VB { \property Voice . dynamicDir = \down c,,4 \ff} - -> - -\version "1.0.16"; diff --git a/lily/include/repeated-music-iterator.hh b/lily/include/repeated-music-iterator.hh deleted file mode 100644 index 7bbb8d0a47..0000000000 --- a/lily/include/repeated-music-iterator.hh +++ /dev/null @@ -1,39 +0,0 @@ -/* - repeated-music-iterator.hh -- declare Repeated_music_iterator - - source file of the GNU LilyPond music typesetter - - (c) 1998--1999 Jan Nieuwenhuizen - - */ - -#ifndef REPEATED_MUSIC_ITERATOR_HH -#define REPEATED_MUSIC_ITERATOR_HH - -#include "music-list-iterator.hh" - -class Repeated_music_iterator : public Music_list_iterator -{ -public: - Repeated_music_iterator (); - virtual ~Repeated_music_iterator (); - - virtual void construct_children (); - virtual Moment next_moment () const; - virtual bool ok () const; - -protected: - virtual void do_print () const; - virtual void do_process_and_next (Moment); - -private: - void start_next_element (); - - int unfold_i_; - Moment here_mom_; - Music_iterator* repeat_iter_p_; - Music_list_iterator* alternative_iter_p_; -}; - -#endif /* REPEATED_MUSIC_ITERATOR_HH */ - diff --git a/lily/include/repeated-music.hh b/lily/include/repeated-music.hh deleted file mode 100644 index 1b85706da8..0000000000 --- a/lily/include/repeated-music.hh +++ /dev/null @@ -1,43 +0,0 @@ -/* - repeated-music.hh -- declare Repeated_music - - source file of the GNU LilyPond music typesetter - - (c) 1998--1999 Jan Nieuwenhuizen - - */ - -#ifndef REPEATED_MUSIC_HH -#define REPEATED_MUSIC_HH - -#include "music-list.hh" - -/** - Repeats and voltas - */ -class Repeated_music : public Music -{ -public: - int repeats_i_; - bool unfold_b_; - Music* repeat_p_; - /* - UGH FIXME: this should be: - - Music_list * alternative_p_; - */ - Music_sequence* alternative_p_; - - Repeated_music (Music*, int n, Music_sequence*); - Repeated_music (Repeated_music const& s); - virtual ~Repeated_music (); - - virtual void do_print () const; - virtual void transpose (Musical_pitch p); - virtual Moment length_mom () const; - virtual Musical_pitch to_relative_octave (Musical_pitch p); - VIRTUAL_COPY_CONS(Music); -}; - -#endif /* REPEATED_MUSIC_HH */ - diff --git a/lily/repeated-music-iterator.cc b/lily/repeated-music-iterator.cc deleted file mode 100644 index 80007e5b13..0000000000 --- a/lily/repeated-music-iterator.cc +++ /dev/null @@ -1,136 +0,0 @@ -/* - repeated-music-iterator.cc -- implement Repeated_music_iterator - - source file of the GNU LilyPond music typesetter - - (c) 1998--1999 Jan Nieuwenhuizen - - */ - -#include "repeated-music-iterator.hh" -#include "repeated-music.hh" -#include "musical-request.hh" -#include "translator-group.hh" -#include "command-request.hh" - -Repeated_music_iterator::Repeated_music_iterator () -{ - repeat_iter_p_ = 0; - alternative_iter_p_ = 0; - here_mom_ = 0; - unfold_i_ = -1; -} - -Repeated_music_iterator::~Repeated_music_iterator () -{ - delete repeat_iter_p_; - delete alternative_iter_p_; -} - -void -Repeated_music_iterator::do_print () const -{ - if (repeat_iter_p_) repeat_iter_p_->print (); - if (alternative_iter_p_) alternative_iter_p_->print (); -} - -void -Repeated_music_iterator::construct_children () -{ - repeat_iter_p_ = get_iterator_p (dynamic_cast (music_l_)->repeat_p_); -} - -void -Repeated_music_iterator::do_process_and_next (Moment m) -{ - if (first_b_) - { - bool success = report_to_l ()->try_music (dynamic_cast (music_l_)); - if (!success) - music_l_->warning ( _("No one to print a volta bracket")); - } - if (repeat_iter_p_ && repeat_iter_p_->ok ()) - repeat_iter_p_->process_and_next (m - here_mom_); - else - alternative_iter_p_->process_and_next (m - here_mom_); - Music_iterator::do_process_and_next (m); -} - -Moment -Repeated_music_iterator::next_moment () const -{ - - if (repeat_iter_p_) - return repeat_iter_p_->next_moment () + here_mom_; - else if (alternative_iter_p_) - return alternative_iter_p_->next_moment () + here_mom_; - - Repeated_music const*r = dynamic_cast(music_l_); - return r->alternative_p_->length_mom () + here_mom_; -} - -/* - FIXME - */ -bool -Repeated_music_iterator::ok () const -{ - if (!repeat_iter_p_ && !alternative_iter_p_) - return false; - - if ((repeat_iter_p_ && repeat_iter_p_->ok ()) - || (alternative_iter_p_ && alternative_iter_p_->ok ())) - return true; - - Repeated_music_iterator *urg = (Repeated_music_iterator*)this; - // urg, we're const - urg->start_next_element (); - - return ok (); -} - - -void -Repeated_music_iterator::start_next_element () -{ - Repeated_music const*rep =dynamic_cast (music_l_); - - - if (repeat_iter_p_) - { - assert (!repeat_iter_p_->ok ()); - assert (!alternative_iter_p_); - delete repeat_iter_p_; - repeat_iter_p_ = 0; - alternative_iter_p_ = dynamic_cast - (get_iterator_p ((Music*)rep->alternative_p_)); - here_mom_ += rep->repeat_p_->length_mom (); - } - else if (alternative_iter_p_) - { - assert (!alternative_iter_p_->ok ()); - assert (!repeat_iter_p_); - delete alternative_iter_p_; - alternative_iter_p_ = 0; - if (unfold_i_ < 0) - unfold_i_ = rep->unfold_b_ ? - rep->repeats_i_ - 1 : 0; - if (unfold_i_) - { - unfold_i_--; - repeat_iter_p_ = get_iterator_p (rep->repeat_p_); - // urg, assume same length alternatives for now... -// here_mom_ += rep->alternative_p_->music_p_list_p_->top ()->length_mom (); - /* - URG - this is *wrong* but at least it doesn't dump core - when unfolding, the alternative (sequential) music - shouldn't automatically move to the next alternative - - how to intercept this... - */ - here_mom_ += rep->alternative_p_->length_mom (); - } - } -} - diff --git a/lily/repeated-music.cc b/lily/repeated-music.cc deleted file mode 100644 index 48848dd9fe..0000000000 --- a/lily/repeated-music.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* - repeated-music.cc -- implement Repeated_music - - source file of the GNU LilyPond music typesetter - - (c) 1998--1999 Jan Nieuwenhuizen - - */ - -#include "repeated-music.hh" -#include "musical-pitch.hh" - -Repeated_music::Repeated_music (Music* r, int n, Music_sequence* a) -{ - repeats_i_ = n; - unfold_b_ = false; - repeat_p_ = r; - alternative_p_ = a; -} - -Repeated_music::~Repeated_music () -{ - delete repeat_p_; - delete alternative_p_; -} - -Repeated_music::Repeated_music (Repeated_music const& s) - : Music (s) -{ - repeats_i_ = s.repeats_i_; - repeat_p_ = (s.repeat_p_) ? s.repeat_p_->clone () : 0; - // urg? - alternative_p_ = (s.alternative_p_) ? dynamic_cast (s.alternative_p_->clone ()) : 0; -} - -void -Repeated_music::do_print () const -{ - if (repeat_p_) - repeat_p_->print (); - if (alternative_p_) - alternative_p_->print (); -} - -void -Repeated_music::transpose (Musical_pitch p) -{ - if (repeat_p_) - repeat_p_->transpose (p); - if (alternative_p_) - alternative_p_->transpose (p); -} - -Moment -Repeated_music::length_mom () const -{ - Moment m; - if (repeat_p_) - m += repeat_p_->length_mom (); - if (alternative_p_) - m += alternative_p_->length_mom (); - return m; -} - - -Musical_pitch -Repeated_music::to_relative_octave (Musical_pitch p) -{ - p = repeat_p_->to_relative_octave (p); - - p = alternative_p_->do_relative_octave (p, false); - return p; - - /* ugh. Should - \relative c'' \repeat 2 { c4 } { < ... > } - - and - - \relative c'' \repeat 2 { c4 } - { { ...} } - - behave differently? - */ -}