77 return last !=
NULL ? last->next :
NULL;
89 void internal_deep_clear (
90 void (*zapper) (
void *));
100 return last !=
NULL ? (last == last->next) :
false;
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,
152 BOOL8 ex_current_was_last;
154 BOOL8 ex_current_was_cycle_pt;
158 BOOL8 started_cycling;
170 CLIST *list_to_iterate);
173 CLIST *list_to_iterate);
175 void add_after_then_move(
178 void add_after_stay_put(
181 void add_before_then_move(
184 void add_before_stay_put(
190 void add_list_before(
200 return current->data;
210 void *move_to_first();
212 void *move_to_last();
214 void mark_cycle_pt();
221 return list->
empty ();
244 const void *,
const void *));
256 CLIST *list_to_iterate) {
260 if (!list_to_iterate)
262 "list_to_iterate is NULL");
265 list = list_to_iterate;
267 current = list->First ();
268 next = current !=
NULL ? current->next :
NULL;
270 started_cycling =
FALSE;
271 ex_current_was_last =
FALSE;
272 ex_current_was_cycle_pt =
FALSE;
309 new_element->data = new_data;
311 if (list->
empty ()) {
312 new_element->next = new_element;
313 list->last = new_element;
314 prev = next = new_element;
317 new_element->next = next;
320 current->next = new_element;
322 if (current == list->last)
323 list->last = new_element;
326 prev->next = new_element;
327 if (ex_current_was_last)
328 list->last = new_element;
329 if (ex_current_was_cycle_pt)
330 cycle_pt = new_element;
333 current = new_element;
359 new_element->data = new_data;
361 if (list->
empty ()) {
362 new_element->next = new_element;
363 list->last = new_element;
364 prev = next = new_element;
365 ex_current_was_last =
FALSE;
369 new_element->next = next;
372 current->next = new_element;
375 if (current == list->last)
376 list->last = new_element;
379 prev->next = new_element;
380 if (ex_current_was_last) {
381 list->last = new_element;
382 ex_current_was_last =
FALSE;
412 new_element->data = new_data;
414 if (list->
empty ()) {
415 new_element->next = new_element;
416 list->last = new_element;
417 prev = next = new_element;
420 prev->next = new_element;
422 new_element->next = current;
426 new_element->next = next;
427 if (ex_current_was_last)
428 list->last = new_element;
429 if (ex_current_was_cycle_pt)
430 cycle_pt = new_element;
433 current = new_element;
459 new_element->data = new_data;
461 if (list->
empty ()) {
462 new_element->next = new_element;
463 list->last = new_element;
464 prev = next = new_element;
465 ex_current_was_last =
TRUE;
469 prev->next = new_element;
471 new_element->next = current;
476 new_element->next = next;
477 if (ex_current_was_last)
478 list->last = new_element;
500 "list_to_add is NULL");
503 if (!list_to_add->
empty ()) {
504 if (list->
empty ()) {
505 list->last = list_to_add->last;
507 next = list->First ();
508 ex_current_was_last =
TRUE;
513 current->next = list_to_add->First ();
514 if (current == list->last)
515 list->last = list_to_add->last;
516 list_to_add->last->next = next;
517 next = current->next;
520 prev->next = list_to_add->First ();
521 if (ex_current_was_last) {
522 list->last = list_to_add->last;
523 ex_current_was_last =
FALSE;
525 list_to_add->last->next = next;
529 list_to_add->last =
NULL;
550 "list_to_add is NULL");
553 if (!list_to_add->
empty ()) {
554 if (list->
empty ()) {
555 list->last = list_to_add->last;
557 current = list->First ();
558 next = current->next;
559 ex_current_was_last =
FALSE;
562 prev->next = list_to_add->First ();
564 list_to_add->last->next = current;
567 list_to_add->last->next = next;
568 if (ex_current_was_last)
569 list->last = list_to_add->last;
570 if (ex_current_was_cycle_pt)
571 cycle_pt = prev->next;
573 current = prev->next;
574 next = current->next;
576 list_to_add->last =
NULL;
591 void *extracted_data;
606 prev = next = list->last =
NULL;
610 if (current == list->last) {
612 ex_current_was_last =
TRUE;
614 ex_current_was_last =
FALSE;
618 ex_current_was_cycle_pt = (current == cycle_pt) ?
TRUE :
FALSE;
619 extracted_data = current->data;
622 return extracted_data;
641 current = list->First ();
643 next = current !=
NULL ? current->next :
NULL;
644 return current !=
NULL ? current->data :
NULL;
670 ex_current_was_cycle_pt =
TRUE;
671 started_cycling =
FALSE;
691 return ((list->
empty ()) || (current == list->First ()) || ((current ==
NULL) &&
692 (prev == list->last) &&
693 !ex_current_was_last));
713 return ((list->
empty ()) || (current == list->last) || ((current ==
NULL) &&
714 (prev == list->last) &&
715 ex_current_was_last));
734 return ((list->
empty ()) || ((current == cycle_pt) && started_cycling));
768 const void *,
const void *)) {
776 list->
sort (comparator);
815 new_element->data = new_data;
817 new_element->next = list->last->next;
818 list->last->next = new_element;
819 list->last = new_element;
831 #define QUOTE_IT( parm ) #parm
865 #define CLISTIZEH_A( CLASSNAME ) \
867 extern DLLSYM void CLASSNAME##_c1_zapper( \
870 extern DLLSYM void* CLASSNAME##_c1_copier( \
873 #define CLISTIZEH_B( CLASSNAME ) \
882 class DLLSYM CLASSNAME##_CLIST : public CLIST \
885 CLASSNAME##_CLIST():CLIST() {} \
889 const CLASSNAME##_CLIST&) \
890 { DONT_CONSTRUCT_LIST_BY_COPY.error( QUOTE_IT( CLASSNAME##_CLIST ), \
894 { CLIST::internal_deep_clear( &CLASSNAME##_c1_zapper ); } \
897 const CLASSNAME##_CLIST&) \
898 { DONT_ASSIGN_LISTS.error( QUOTE_IT( CLASSNAME##_CLIST ), \
901 #define CLISTIZEH_C( CLASSNAME ) \
918 class DLLSYM CLASSNAME##_C_IT : public CLIST_ITERATOR \
921 CLASSNAME##_C_IT():CLIST_ITERATOR(){} \
924 CLASSNAME##_CLIST* list):CLIST_ITERATOR(list){} \
927 { return (CLASSNAME*) CLIST_ITERATOR::data(); } \
929 CLASSNAME* data_relative( \
931 { return (CLASSNAME*) CLIST_ITERATOR::data_relative( offset ); } \
933 CLASSNAME* forward() \
934 { return (CLASSNAME*) CLIST_ITERATOR::forward(); } \
936 CLASSNAME* extract() \
937 { return (CLASSNAME*) CLIST_ITERATOR::extract(); } \
939 CLASSNAME* move_to_first() \
940 { return (CLASSNAME*) CLIST_ITERATOR::move_to_first(); } \
942 CLASSNAME* move_to_last() \
943 { return (CLASSNAME*) CLIST_ITERATOR::move_to_last(); } \
946 #define CLISTIZEH( CLASSNAME ) \
948 CLISTIZEH_A( CLASSNAME ) \
950 CLISTIZEH_B( CLASSNAME ) \
952 CLISTIZEH_C( CLASSNAME )
958 #define CLISTIZE( CLASSNAME ) \
969 DLLSYM void CLASSNAME##_c1_zapper( \
972 delete (CLASSNAME *) link; \
void set_to_list(CLIST *list_to_iterate)
void assign_to_sublist(CLIST_ITERATOR *start_it, CLIST_ITERATOR *end_it)
void add_before_stay_put(void *new_data)
void add_list_after(CLIST *list_to_add)
void add_after_stay_put(void *new_data)
const ERRCODE BAD_PARAMETER
void add_after_then_move(void *new_data)
void sort(int comparator(const void *, const void *))
const ERRCODE NULL_CURRENT
void shallow_copy(CLIST *from_list)
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
CLIST_LINK(const CLIST_LINK &)
void add_list_before(CLIST *list_to_add)
BOOL8 current_extracted()
void sort(int comparator(const void *, const void *))
void add_before_then_move(void *new_data)
void add_to_end(void *new_data)
const ERRCODE NULL_OBJECT