35 #ifndef _GLIBCXX_CSTDIO
44 #define RELATION_GREATER 1
45 #define RELATION_LESS 2
149 bool duplicates=
true);
235 first = last = last_asked_list_elem = remembered_elem =
NULp;
252 remembered_elem = last_asked_list_elem;
253 last_asked_list_elem = t;
259 mark = last_asked_list_elem;
260 last_asked_list_elem = remembered_elem;
261 remembered_elem = mark;
268 while (loc_elem && loc_elem->
elem!=
object) {
269 loc_elem = loc_elem->
next;
278 if (pos < 1 || pos > no_of_members)
281 if (! last_asked_list_elem) {
282 if (pos > no_of_members/2) {
284 while (elem && elem->
get_pos() != pos)
289 while (elem && elem->
get_pos() != pos)
294 elem = last_asked_list_elem;
296 if (pos >= last_asked_list_elem->get_pos()) {
297 while (elem && elem->
get_pos() != pos)
301 while (elem && elem->
get_pos() != pos)
313 if (pos < 1 || pos > no_of_members)
316 if (pos > no_of_members/2) {
318 counter = no_of_members;
319 while (elem && counter != pos) {
326 while (elem && counter != pos) {
337 last_asked_list_elem = first;
345 if (last && ! sotl) {
346 last_asked_list_elem = last;
349 else if (last && sotl) {
350 last_asked_list_elem = last->get_prev();
351 insert_as_first(last->elem);
363 if (last_asked_list_elem) {
366 last_asked_list_elem = last_asked_list_elem->
get_prev();
368 if (last_asked_list_elem)
369 result = last_asked_list_elem->elem;
372 if (last_asked_list_elem) {
373 result = last_asked_list_elem->elem;
374 mark_prev = last_asked_list_elem->
get_prev();
376 remove_member_from_list(result);
377 insert_as_first(result);
378 last_asked_list_elem = mark_prev;
389 if (last_asked_list_elem) {
392 last_asked_list_elem = last_asked_list_elem->
next;
394 if (last_asked_list_elem)
395 result = last_asked_list_elem->elem;
398 if (last_asked_list_elem) {
399 result = last_asked_list_elem->elem;
400 mark_next = last_asked_list_elem->
next;
402 remove_member_from_list(result);
403 insert_as_first(result);
404 last_asked_list_elem = mark_next;
425 first->set_prev(help);
443 help->
set_pos(no_of_members+1);
445 last->set_next(help);
450 return no_of_members;
457 if (last_asked_list_elem) {
459 if (!last_asked_list_elem->get_next()) {
460 result = insert_as_last(
object);
464 help->
set_pos(last_asked_list_elem->get_pos() + 1);
465 help->
set_prev(last_asked_list_elem);
466 help->
set_next(last_asked_list_elem->get_next());
468 last_asked_list_elem->set_next(help);
469 last_asked_list_elem =
help;
472 result = no_of_members;
481 if (last_asked_list_elem) {
483 if (!last_asked_list_elem->get_prev()) {
484 result = insert_as_first(
object);
488 help->
set_pos(last_asked_list_elem->get_pos() - 1);
489 help->
set_next(last_asked_list_elem);
490 help->
set_prev(last_asked_list_elem->get_prev());
492 last_asked_list_elem->set_prev(help);
493 last_asked_list_elem =
help;
496 result = no_of_members;
503 return insert_as_first(
object);
512 insert_as_first(
object);
515 else if (temp_pos>no_of_members) {
516 insert_as_last(
object);
517 return no_of_members;
520 elem = get_list_elem_at_pos_simple(temp_pos);
523 new_elem->
elem = object;
526 new_elem->
next = elem;
527 elem->
prev->next = new_elem;
528 elem->
prev = new_elem;
538 if (last_asked_list_elem && last_asked_list_elem->elem==
object) {
539 if (! last_asked_list_elem->next)
540 last = last_asked_list_elem->
get_prev();
542 if (! last_asked_list_elem->get_prev())
543 first = last_asked_list_elem->next;
545 delete last_asked_list_elem;
547 if (no_of_members == 1)
550 last_asked_list_elem =
NULp;
553 if (last_asked_list_elem &&
554 last_asked_list_elem->next &&
555 last_asked_list_elem->next->elem ==
object)
557 loc_elem = last_asked_list_elem->
next;
559 else if (last_asked_list_elem &&
560 last_asked_list_elem->get_prev() &&
561 last_asked_list_elem->get_prev()->elem == object)
563 loc_elem = last_asked_list_elem->
get_prev();
566 loc_elem = get_list_elem_with_member(
object);
572 if (! loc_elem->
next)
576 first = loc_elem->
next;
587 if (no_of_members <= 1) {
589 first = last = last_asked_list_elem =
NULp;
593 new_first = first->
next;
603 if (no_of_members <= 1) {
605 first = last = last_asked_list_elem =
NULp;
631 while (l_help && object < l_help->elem)
632 l_help = l_help->next;
636 while (l_help && object < l_help->elem)
637 l_help = l_help->get_prev();
640 if (l_help &&
object == l_help->elem && ! duplicates)
641 return no_of_members;
652 first->set_prev(help);
674 help->
next->set_prev(help);
684 return no_of_members;
697 while (this_list && join_list) {
698 if (this_list->
elem == join_list->elem) {
699 this_list = this_list->
next;
700 join_list = join_list->next;
706 this_list = this_list->
next;
712 new_elem->set_next(this_list);
715 if (new_elem->get_prev())
716 new_elem->get_prev()->set_next(new_elem);
720 join_list = join_list->next;
727 if (! join_list || (!this_list && !join_list))
736 last->set_next(new_elem);
743 join_list = join_list->next;
753 while (this_list && join_list) {
757 this_list = this_list->
next;
762 join_list = join_list->next;
764 else if (this_list->
elem == join_list->elem) {
765 if (this_list == first)
766 first = this_list->
next;
768 if (this_list == last)
771 mark = this_list->
next;
775 join_list = join_list->
next;
778 if (! no_of_members) {
779 last_asked_list_elem =
NULp;
790 if (last_asked_list_elem->elem ==
object)
791 help_l = last_asked_list_elem;
793 help_l = get_list_elem_with_member(
object);
801 help_l = help_l->
next;
822 update_pos_no(first, 1);
832 if (last_asked_list_elem && last_asked_list_elem->elem == ex)
833 one = last_asked_list_elem;
835 one = get_list_elem_with_member(ex);
840 if (last_asked_list_elem && last_asked_list_elem->elem == change)
841 two = last_asked_list_elem;
843 two = get_list_elem_with_member(change);
862 if (ex < 1 || ex > no_of_members ||
863 change < 1 || change > no_of_members)
866 one = get_list_elem_at_pos(ex);
870 two = get_list_elem_at_pos(change);
889 if (last_asked_list_elem && last_asked_list_elem->elem ==
object) {
890 return last_asked_list_elem->
get_pos();
894 while (elem && elem->
elem !=
object)
911 elem = get_list_elem_at_pos(pos);
914 insert_as_last(
object);
915 result = last->get_pos();
923 elem->
get_prev()->set_next(new_elem);
930 update_pos_no (new_elem, pos);
940 elem = get_list_elem_at_pos(pos);
943 last_asked_list_elem = elem;
953 elem = get_list_elem_at_pos_simple(pos);
956 last_asked_list_elem = elem;
967 if (pos < 1 || pos > no_of_members)
970 loc_elem = last_asked_list_elem;
972 if (loc_elem && loc_elem->
get_pos() == pos)
973 last_asked_list_elem =
NULp;
975 if (! (loc_elem = get_list_elem_at_pos(pos)))
979 if (last == loc_elem)
980 last = last->get_prev();
982 if (first == loc_elem)
997 #error SoTl.hxx included twice
void set_pos(positiontype p)
void set_prev(list_elem< Type > *p)
positiontype insert_as_last(Type *object)
positiontype insert_before_current(Type *object)
void set_current_ARC(list_elem< Type > *t)
positiontype get_no_of_members()
positiontype get_pos_of_member(Type *object)
list_elem< Type > * get_current_list_elem()
positiontype insert_at_pos_simple(Type *object, positiontype pos)
bool exchange_members(Type *ex, Type *change)
void sort_list_subtract(List< Type > *l, int relation=RELATION_LESS)
list_elem< Type > * get_next()
list_elem< Type > * get_first_list_elem()
List< Type > * duplicate_list(Type *object)
list_elem< Type > * get_prev()
positiontype insert_sorted_by_address_of_object(Type *object, int relation=RELATION_LESS, bool duplicates=true)
Type * get_member_at_pos(positiontype pos)
list_elem< Type > * get_last_list_elem()
void sort_list_join(List< Type > *l, int relation=RELATION_LESS)
positiontype insert_after_current(Type *object)
unsigned long positiontype
GB_write_int const char GB_write_autoconv_string WRITE_SKELETON(write_pointer, GBDATA *,"%p", GB_write_pointer) char *AW_awa if)(!gb_var) return strdup("")
bool remove_pos_from_list(positiontype pos)
void remove_member_from_list(Type *object)
positiontype insert_at_pos(Type *object, positiontype pos)
bool exchange_positions(positiontype ex, positiontype change)
Type * get_member_at_pos_simple(positiontype pos)
void set_remembered_as_current_ARC()
void set_next(list_elem< Type > *n)
positiontype insert(Type *object)
positiontype insert_as_first(Type *object)