50 data = next =
nullptr;
55 data = next =
nullptr;
60 data = next =
nullptr;
89 void internal_deep_clear (
90 void (*zapper) (
void *));
105 last = from_list->last;
108 void assign_to_sublist(
116 const void *,
const void *));
125 bool add_sorted(
int comparator(
const void*,
const void*),
126 bool unique,
void* new_data);
133 void set_subtract(
int comparator(
const void*,
const void*),
bool unique,
154 bool ex_current_was_last;
155 bool ex_current_was_cycle_pt;
156 bool started_cycling;
167 CLIST *list_to_iterate);
170 CLIST *list_to_iterate);
172 void add_after_then_move(
175 void add_after_stay_put(
178 void add_before_then_move(
181 void add_before_stay_put(
187 void add_list_before(
197 return current->data;
207 void *move_to_first();
209 void *move_to_last();
211 void mark_cycle_pt();
218 return list->
empty ();
241 const void *,
const void *));
253 CLIST *list_to_iterate) {
255 if (!list_to_iterate)
257 "list_to_iterate is nullptr");
260 list = list_to_iterate;
262 current = list->First ();
263 next = current !=
nullptr ? current->next :
nullptr;
265 started_cycling =
false;
266 ex_current_was_last =
false;
267 ex_current_was_cycle_pt =
false;
296 "new_data is nullptr");
300 new_element->data = new_data;
302 if (list->
empty ()) {
303 new_element->next = new_element;
304 list->last = new_element;
305 prev = next = new_element;
308 new_element->next = next;
311 current->next = new_element;
313 if (current == list->last)
314 list->last = new_element;
317 prev->next = new_element;
318 if (ex_current_was_last)
319 list->last = new_element;
320 if (ex_current_was_cycle_pt)
321 cycle_pt = new_element;
324 current = new_element;
343 "new_data is nullptr");
347 new_element->data = new_data;
349 if (list->
empty ()) {
350 new_element->next = new_element;
351 list->last = new_element;
352 prev = next = new_element;
353 ex_current_was_last =
false;
357 new_element->next = next;
360 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 ex_current_was_last =
false;
393 "new_data is nullptr");
397 new_element->data = new_data;
399 if (list->
empty ()) {
400 new_element->next = new_element;
401 list->last = new_element;
402 prev = next = new_element;
405 prev->next = new_element;
407 new_element->next = current;
411 new_element->next = next;
412 if (ex_current_was_last)
413 list->last = new_element;
414 if (ex_current_was_cycle_pt)
415 cycle_pt = new_element;
418 current = new_element;
437 "new_data is nullptr");
441 new_element->data = new_data;
443 if (list->
empty ()) {
444 new_element->next = new_element;
445 list->last = new_element;
446 prev = next = new_element;
447 ex_current_was_last =
true;
451 prev->next = new_element;
453 new_element->next = current;
458 new_element->next = next;
459 if (ex_current_was_last)
460 list->last = new_element;
480 "list_to_add is nullptr");
483 if (!list_to_add->
empty ()) {
484 if (list->
empty ()) {
485 list->last = list_to_add->last;
487 next = list->First ();
488 ex_current_was_last =
true;
493 current->next = list_to_add->First ();
494 if (current == list->last)
495 list->last = list_to_add->last;
496 list_to_add->last->next = next;
497 next = current->next;
500 prev->next = list_to_add->First ();
501 if (ex_current_was_last) {
502 list->last = list_to_add->last;
503 ex_current_was_last =
false;
505 list_to_add->last->next = next;
509 list_to_add->last =
nullptr;
527 "list_to_add is nullptr");
530 if (!list_to_add->
empty ()) {
531 if (list->
empty ()) {
532 list->last = list_to_add->last;
534 current = list->First ();
535 next = current->next;
536 ex_current_was_last =
false;
539 prev->next = list_to_add->First ();
541 list_to_add->last->next = current;
544 list_to_add->last->next = next;
545 if (ex_current_was_last)
546 list->last = list_to_add->last;
547 if (ex_current_was_cycle_pt)
548 cycle_pt = prev->next;
550 current = prev->next;
551 next = current->next;
553 list_to_add->last =
nullptr;
567 void *extracted_data;
580 prev = next = list->last =
nullptr;
584 if (current == list->last) {
586 ex_current_was_last =
true;
588 ex_current_was_last =
false;
592 ex_current_was_cycle_pt = (current == cycle_pt);
593 extracted_data = current->data;
596 return extracted_data;
612 current = list->First ();
614 next = current !=
nullptr ? current->next :
nullptr;
615 return current !=
nullptr ? current->data :
nullptr;
638 ex_current_was_cycle_pt =
true;
639 started_cycling =
false;
656 return ((list->
empty ()) || (current == list->First ()) || ((current ==
nullptr) &&
657 (prev == list->last) &&
658 !ex_current_was_last));
675 return ((list->
empty ()) || (current == list->last) || ((current ==
nullptr) &&
676 (prev == list->last) &&
677 ex_current_was_last));
693 return ((list->
empty ()) || ((current == cycle_pt) && started_cycling));
723 const void *,
const void *)) {
729 list->
sort (comparator);
752 "new_data is nullptr");
765 new_element->data = new_data;
767 new_element->next = list->last->next;
768 list->last->next = new_element;
769 list->last = new_element;
781 #define QUOTE_IT(parm) #parm
815 #define CLISTIZEH_A(CLASSNAME) \
817 extern DLLSYM void CLASSNAME##_c1_zapper( \
821 *CLASSNAME##_c1_copier( \
824 #define CLISTIZEH_B(CLASSNAME) \
835 class DLLSYM CLASSNAME##_CLIST : public CLIST { \
837 CLASSNAME##_CLIST() : CLIST() {} \
841 const CLASSNAME##_CLIST &) \
843 DONT_CONSTRUCT_LIST_BY_COPY.error(QUOTE_IT(CLASSNAME##_CLIST), ABORT, \
849 CLIST::internal_deep_clear(&CLASSNAME##_c1_zapper); \
853 const CLASSNAME##_CLIST &) { \
854 DONT_ASSIGN_LISTS.error(QUOTE_IT(CLASSNAME##_CLIST), ABORT, nullptr); \
857 #define CLISTIZEH_C(CLASSNAME) \
872 class DLLSYM CLASSNAME##_C_IT : public CLIST_ITERATOR { \
874 CLASSNAME##_C_IT() : CLIST_ITERATOR() {} \
876 CLASSNAME##_C_IT(CLASSNAME##_CLIST *list) : CLIST_ITERATOR(list) {} \
878 CLASSNAME *data() { return (CLASSNAME *)CLIST_ITERATOR::data(); } \
880 CLASSNAME *data_relative(int8_t offset) { \
881 return (CLASSNAME *)CLIST_ITERATOR::data_relative(offset); \
884 CLASSNAME *forward() { return (CLASSNAME *)CLIST_ITERATOR::forward(); } \
886 CLASSNAME *extract() { return (CLASSNAME *)CLIST_ITERATOR::extract(); } \
888 CLASSNAME *move_to_first() { \
889 return (CLASSNAME *)CLIST_ITERATOR::move_to_first(); \
892 CLASSNAME *move_to_last() { \
893 return (CLASSNAME *)CLIST_ITERATOR::move_to_last(); \
897 #define CLISTIZEH(CLASSNAME) \
899 CLISTIZEH_A(CLASSNAME) \
901 CLISTIZEH_B(CLASSNAME) \
903 CLISTIZEH_C(CLASSNAME)
909 #define CLISTIZE(CLASSNAME) \
921 DLLSYM void CLASSNAME##_c1_zapper( \
924 delete (CLASSNAME *)link; \