129 void internal_clear (
143 last = from_list->last;
150 void assign_to_sublist(
158 const void *,
const void *));
170 ELIST_LINK *add_sorted_and_find(
int comparator(
const void*,
const void*),
175 bool add_sorted(
int comparator(
const void*,
const void*),
177 return (add_sorted_and_find(comparator, unique, new_link) == new_link);
196 bool ex_current_was_last;
198 bool ex_current_was_cycle_pt;
202 bool started_cycling;
214 ELIST *list_to_iterate);
217 ELIST *list_to_iterate);
219 void add_after_then_move(
222 void add_after_stay_put(
225 void add_before_then_move(
228 void add_before_stay_put(
234 void add_list_before(
258 void mark_cycle_pt();
265 return list->empty ();
288 const void *,
const void *));
300 ELIST *list_to_iterate) {
304 if (!list_to_iterate)
306 "list_to_iterate is NULL");
309 list = list_to_iterate;
311 current = list->First ();
312 next = current ? current->next :
NULL;
314 started_cycling =
FALSE;
315 ex_current_was_last =
FALSE;
316 ex_current_was_cycle_pt =
FALSE;
347 "new_element is NULL");
348 if (new_element->next)
352 if (list->
empty ()) {
353 new_element->next = new_element;
354 list->last = new_element;
355 prev = next = new_element;
358 new_element->next = next;
361 current->next = new_element;
363 if (current == list->last)
364 list->last = new_element;
367 prev->next = new_element;
368 if (ex_current_was_last)
369 list->last = new_element;
370 if (ex_current_was_cycle_pt)
371 cycle_pt = new_element;
374 current = new_element;
394 "new_element is NULL");
395 if (new_element->next)
399 if (list->
empty ()) {
400 new_element->next = new_element;
401 list->last = new_element;
402 prev = next = new_element;
403 ex_current_was_last =
FALSE;
407 new_element->next = next;
410 current->next = new_element;
413 if (current == list->last)
414 list->last = new_element;
417 prev->next = new_element;
418 if (ex_current_was_last) {
419 list->last = new_element;
420 ex_current_was_last =
FALSE;
444 "new_element is NULL");
445 if (new_element->next)
449 if (list->
empty ()) {
450 new_element->next = new_element;
451 list->last = new_element;
452 prev = next = new_element;
455 prev->next = new_element;
457 new_element->next = current;
461 new_element->next = next;
462 if (ex_current_was_last)
463 list->last = new_element;
464 if (ex_current_was_cycle_pt)
465 cycle_pt = new_element;
468 current = new_element;
488 "new_element is NULL");
489 if (new_element->next)
493 if (list->
empty ()) {
494 new_element->next = new_element;
495 list->last = new_element;
496 prev = next = new_element;
497 ex_current_was_last =
TRUE;
501 prev->next = new_element;
503 new_element->next = current;
508 new_element->next = next;
509 if (ex_current_was_last)
510 list->last = new_element;
532 "list_to_add is NULL");
535 if (!list_to_add->
empty ()) {
536 if (list->
empty ()) {
537 list->last = list_to_add->last;
539 next = list->First ();
540 ex_current_was_last =
TRUE;
545 current->next = list_to_add->First ();
546 if (current == list->last)
547 list->last = list_to_add->last;
548 list_to_add->last->next = next;
549 next = current->next;
552 prev->next = list_to_add->First ();
553 if (ex_current_was_last) {
554 list->last = list_to_add->last;
555 ex_current_was_last =
FALSE;
557 list_to_add->last->next = next;
561 list_to_add->last =
NULL;
582 "list_to_add is NULL");
585 if (!list_to_add->
empty ()) {
586 if (list->
empty ()) {
587 list->last = list_to_add->last;
589 current = list->First ();
590 next = current->next;
591 ex_current_was_last =
FALSE;
594 prev->next = list_to_add->First ();
596 list_to_add->last->next = current;
599 list_to_add->last->next = next;
600 if (ex_current_was_last)
601 list->last = list_to_add->last;
602 if (ex_current_was_cycle_pt)
603 cycle_pt = prev->next;
605 current = prev->next;
606 next = current->next;
608 list_to_add->last =
NULL;
638 prev = next = list->last =
NULL;
642 if (current == list->last) {
644 ex_current_was_last =
TRUE;
646 ex_current_was_last =
FALSE;
650 ex_current_was_cycle_pt = (current == cycle_pt) ?
TRUE :
FALSE;
651 extracted_link = current;
652 extracted_link->next =
NULL;
654 return extracted_link;
673 current = list->First ();
675 next = current ? current->next :
NULL;
702 ex_current_was_cycle_pt =
TRUE;
703 started_cycling =
FALSE;
723 return ((list->
empty ()) || (current == list->First ()) || ((current ==
NULL) &&
724 (prev == list->last) &&
725 !ex_current_was_last));
745 return ((list->
empty ()) || (current == list->last) || ((current ==
NULL) &&
746 (prev == list->last) &&
747 ex_current_was_last));
766 return ((list->
empty ()) || ((current == cycle_pt) && started_cycling));
800 const void *,
const void *)) {
808 list->
sort (comparator);
832 "new_element is NULL");
833 if (new_element->next)
843 list->last = new_element;
846 new_element->next = list->last->next;
847 list->last->next = new_element;
848 list->last = new_element;
864 #define QUOTE_IT( parm ) #parm
896 #define ELISTIZEH_A(CLASSNAME) \
898 extern DLLSYM void CLASSNAME##_zapper(ELIST_LINK* link);
900 #define ELISTIZEH_B(CLASSNAME) \
909 class DLLSYM CLASSNAME##_LIST : public ELIST \
912 CLASSNAME##_LIST():ELIST() {}\
916 const CLASSNAME##_LIST&) \
917 { DONT_CONSTRUCT_LIST_BY_COPY.error( QUOTE_IT( CLASSNAME##_LIST ), \
921 { ELIST::internal_clear( &CLASSNAME##_zapper ); } \
923 ~CLASSNAME##_LIST() \
927 void deep_copy(const CLASSNAME##_LIST* src_list, \
928 CLASSNAME* (*copier)(const CLASSNAME*)); \
931 const CLASSNAME##_LIST&) \
932 { DONT_ASSIGN_LISTS.error( QUOTE_IT( CLASSNAME##_LIST ), \
935 #define ELISTIZEH_C( CLASSNAME ) \
951 class DLLSYM CLASSNAME##_IT : public ELIST_ITERATOR \
954 CLASSNAME##_IT():ELIST_ITERATOR(){} \
957 CLASSNAME##_LIST* list):ELIST_ITERATOR(list){} \
960 { return (CLASSNAME*) ELIST_ITERATOR::data(); } \
962 CLASSNAME* data_relative( \
964 { return (CLASSNAME*) ELIST_ITERATOR::data_relative( offset ); } \
966 CLASSNAME* forward() \
967 { return (CLASSNAME*) ELIST_ITERATOR::forward(); } \
969 CLASSNAME* extract() \
970 { return (CLASSNAME*) ELIST_ITERATOR::extract(); } \
972 CLASSNAME* move_to_first() \
973 { return (CLASSNAME*) ELIST_ITERATOR::move_to_first(); } \
975 CLASSNAME* move_to_last() \
976 { return (CLASSNAME*) ELIST_ITERATOR::move_to_last(); } \
979 #define ELISTIZEH( CLASSNAME ) \
981 ELISTIZEH_A( CLASSNAME ) \
983 ELISTIZEH_B( CLASSNAME ) \
985 ELISTIZEH_C( CLASSNAME )
992 #define ELISTIZE(CLASSNAME) \
1003 DLLSYM void CLASSNAME##_zapper(ELIST_LINK* link) { \
1004 delete reinterpret_cast<CLASSNAME*>(link); \
1008 void CLASSNAME##_LIST::deep_copy(const CLASSNAME##_LIST* src_list, \
1009 CLASSNAME* (*copier)(const CLASSNAME*)) { \
1011 CLASSNAME##_IT from_it(const_cast<CLASSNAME##_LIST*>(src_list)); \
1012 CLASSNAME##_IT to_it(this); \
1014 for (from_it.mark_cycle_pt(); !from_it.cycled_list(); from_it.forward()) \
1015 to_it.add_after_then_move((*copier)(from_it.data())); \