// This may look like C code, but it is really -*- C++ -*-
Copyright (C) 1988, 1992 Free Software Foundation
written by Doug Lea (dl@rocky.oswego.edu)
This file is part of the GNU C++ Library. This library is free
software; you can redistribute it and/or modify it under the terms of
the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version. This library is distributed in the hope
that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
void BaseSLList::error(const char* msg
)
(*lib_error_handler
)("SLList", msg
);
if (t
!= 0) do { ++l
; t
= t
->tl
; } while (t
!= last
);
BaseSLNode
* p
= last
->tl
;
// Note: This is an internal method. It does *not* free old contents!
void BaseSLList::copy(const BaseSLList
& a
)
BaseSLNode
* p
= a
.last
->tl
;
BaseSLNode
* h
= copy_node(p
->item());
BaseSLNode
* n
= copy_node(p
->item());
BaseSLList
& BaseSLList::operator = (const BaseSLList
& a
)
Pix
BaseSLList::prepend(void *datum
)
return prepend(copy_node(datum
));
Pix
BaseSLList::prepend(BaseSLNode
* t
)
Pix
BaseSLList::append(void *datum
)
return append(copy_node(datum
));
Pix
BaseSLList::append(BaseSLNode
* t
)
void BaseSLList::join(BaseSLList
& b
)
BaseSLNode
* f
= last
->tl
;
Pix
BaseSLList::ins_after(Pix p
, void *datum
)
BaseSLNode
* u
= (BaseSLNode
*)p
;
BaseSLNode
* t
= copy_node(datum
);
else if (u
== 0) // ins_after 0 means prepend
void BaseSLList::del_after(Pix p
)
BaseSLNode
* u
= (BaseSLNode
*)p
;
if (last
== 0 || u
== last
) error("cannot del_after last");
if (u
== 0) u
= last
; // del_after 0 means delete first
int BaseSLList::owns(Pix p
)
if (Pix(t
) == p
) return 1;
int BaseSLList::remove_front(void *dst
, int signal_error
)
BaseSLNode
* t
= last
->tl
;
copy_item(dst
, t
->item());
error("remove_front of empty list");
void BaseSLList::del_front()
if (last
== 0) error("del_front of empty list");
BaseSLNode
* t
= last
->tl
;
long count
= MAXLONG
; // Lots of chances to find last!
} while (count
> 0 && t
!= last
);
if (!v
) error("invariant failure");
#endif /*!_G_NO_TEMPLATES*/