From 6defc333ec3aee22a49863d6f4e57367aabe0d21 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:41:07 +0000 Subject: [PATCH] lilypond-0.1.8 --- flower/include/list.tcc | 45 ++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/flower/include/list.tcc b/flower/include/list.tcc index 4c83034d82..fb64cd3ee0 100644 --- a/flower/include/list.tcc +++ b/flower/include/list.tcc @@ -1,20 +1,27 @@ +/* + list.tcc -- implement List + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys +*/ #ifndef LIST_CC #define LIST_CC // instantiate a template: explicit instantiation. -#define L_instantiate(a) template class List; template class Cursor; \ +#define L_INSTANTIATE(a) class List; template class Cursor; \ template class Link #include "list.hh" template -List::List(List const&src) +List::List (List const&src) { set_empty(); // probably el stupido - for (Cursor c(src); c.ok(); c++) - bottom().add(c); + for (Cursor c (src); c.ok(); c++) + bottom().add (c); } template @@ -24,26 +31,26 @@ List::OK() const int i = size_; Link *lp = top_; while (i--) { - assert(lp); + assert (lp); lp->OK(); lp = lp->next(); } - assert(!lp); + assert (!lp); i = size_; lp = bottom_; while (i--) { - assert(lp); + assert (lp); lp->OK(); lp = lp->previous(); } - assert(!lp); + assert (!lp); } template void List::junk_links() { - Cursor c(*this); + Cursor c (*this); while (c.ok()) c.del(); } @@ -68,17 +75,17 @@ List::~List() */ template void -List::add( T const & thing, Cursor &after_me ) +List::add (T const & thing, Cursor &after_me) { if (!size_) { // not much choice if list is empty - bottom_ = top_ = new Link( thing ); + 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); + p->add (thing); if (p == bottom_) // adjust bottom_ if necessary. bottom_ = p->next(); } @@ -88,10 +95,10 @@ List::add( T const & thing, Cursor &after_me ) template void -List::insert( T const & thing, Cursor &before_me ) +List::insert (T const & thing, Cursor &before_me) { if (!size_) { - bottom_ = top_ = new Link( thing ); + bottom_ = top_ = new Link( thing); if (!before_me.ok()) before_me = top(); @@ -101,7 +108,7 @@ List::insert( T const & thing, Cursor &before_me ) Link *p = before_me.pointer() ; - p->insert(thing); + p->insert (thing); if (p == top_) top_ = p->previous(); } @@ -112,11 +119,11 @@ List::insert( T const & thing, Cursor &before_me ) template void -List::concatenate(List const&s) +List::concatenate (List const&s) { - Cursor b(bottom()); - for (Cursor c(s); c.ok(); c++) { - b.add(c); + Cursor b (bottom()); + for (Cursor c (s); c.ok(); c++) { + b.add (c); b++; } } -- 2.39.5