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,
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) {
258 if (!list_to_iterate)
260 "list_to_iterate is NULL");
263 list = list_to_iterate;
265 current = list->First ();
266 next = current != NULL ? current->next : NULL;
268 started_cycling =
FALSE;
269 ex_current_was_last =
FALSE;
270 ex_current_was_cycle_pt =
FALSE;
305 new_element->data = new_data;
307 if (list->
empty ()) {
308 new_element->next = new_element;
309 list->last = new_element;
310 prev = next = new_element;
313 new_element->next = next;
316 current->next = new_element;
318 if (current == list->last)
319 list->last = new_element;
322 prev->next = new_element;
323 if (ex_current_was_last)
324 list->last = new_element;
325 if (ex_current_was_cycle_pt)
326 cycle_pt = new_element;
329 current = new_element;
353 new_element->data = new_data;
355 if (list->
empty ()) {
356 new_element->next = new_element;
357 list->last = new_element;
358 prev = next = new_element;
359 ex_current_was_last =
FALSE;
363 new_element->next = next;
366 current->next = new_element;
369 if (current == list->last)
370 list->last = new_element;
373 prev->next = new_element;
374 if (ex_current_was_last) {
375 list->last = new_element;
376 ex_current_was_last =
FALSE;
404 new_element->data = new_data;
406 if (list->
empty ()) {
407 new_element->next = new_element;
408 list->last = new_element;
409 prev = next = new_element;
412 prev->next = new_element;
414 new_element->next = current;
418 new_element->next = next;
419 if (ex_current_was_last)
420 list->last = new_element;
421 if (ex_current_was_cycle_pt)
422 cycle_pt = new_element;
425 current = new_element;
449 new_element->data = new_data;
451 if (list->
empty ()) {
452 new_element->next = new_element;
453 list->last = new_element;
454 prev = next = new_element;
455 ex_current_was_last =
TRUE;
459 prev->next = new_element;
461 new_element->next = current;
466 new_element->next = next;
467 if (ex_current_was_last)
468 list->last = new_element;
488 "list_to_add is NULL");
491 if (!list_to_add->
empty ()) {
492 if (list->
empty ()) {
493 list->last = list_to_add->last;
495 next = list->First ();
496 ex_current_was_last =
TRUE;
501 current->next = list_to_add->First ();
502 if (current == list->last)
503 list->last = list_to_add->last;
504 list_to_add->last->next = next;
505 next = current->next;
508 prev->next = list_to_add->First ();
509 if (ex_current_was_last) {
510 list->last = list_to_add->last;
511 ex_current_was_last =
FALSE;
513 list_to_add->last->next = next;
517 list_to_add->last = NULL;
536 "list_to_add is NULL");
539 if (!list_to_add->
empty ()) {
540 if (list->
empty ()) {
541 list->last = list_to_add->last;
543 current = list->First ();
544 next = current->next;
545 ex_current_was_last =
FALSE;
548 prev->next = list_to_add->First ();
550 list_to_add->last->next = current;
553 list_to_add->last->next = next;
554 if (ex_current_was_last)
555 list->last = list_to_add->last;
556 if (ex_current_was_cycle_pt)
557 cycle_pt = prev->next;
559 current = prev->next;
560 next = current->next;
562 list_to_add->last = NULL;
577 void *extracted_data;
590 prev = next = list->last = NULL;
594 if (current == list->last) {
596 ex_current_was_last =
TRUE;
598 ex_current_was_last =
FALSE;
602 ex_current_was_cycle_pt = (current == cycle_pt) ?
TRUE :
FALSE;
603 extracted_data = current->data;
606 return extracted_data;
623 current = list->First ();
625 next = current != NULL ? current->next : NULL;
626 return current != NULL ? current->data : NULL;
650 ex_current_was_cycle_pt =
TRUE;
651 started_cycling =
FALSE;
669 return ((list->
empty ()) || (current == list->First ()) || ((current == NULL) &&
670 (prev == list->last) &&
671 !ex_current_was_last));
689 return ((list->
empty ()) || (current == list->last) || ((current == NULL) &&
690 (prev == list->last) &&
691 ex_current_was_last));
708 return ((list->
empty ()) || ((current == cycle_pt) && started_cycling));
740 const void *,
const void *)) {
746 list->
sort (comparator);
783 new_element->data = new_data;
785 new_element->next = list->last->next;
786 list->last->next = new_element;
787 list->last = new_element;
799 #define QUOTE_IT( parm ) #parm
833 #define CLISTIZEH_A( CLASSNAME ) \
835 extern DLLSYM void CLASSNAME##_c1_zapper( \
838 extern DLLSYM void* CLASSNAME##_c1_copier( \
841 #define CLISTIZEH_B( CLASSNAME ) \
850 class DLLSYM CLASSNAME##_CLIST : public CLIST \
853 CLASSNAME##_CLIST():CLIST() {} \
857 const CLASSNAME##_CLIST&) \
858 { DONT_CONSTRUCT_LIST_BY_COPY.error( QUOTE_IT( CLASSNAME##_CLIST ), \
862 { CLIST::internal_deep_clear( &CLASSNAME##_c1_zapper ); } \
865 const CLASSNAME##_CLIST&) \
866 { DONT_ASSIGN_LISTS.error( QUOTE_IT( CLASSNAME##_CLIST ), \
869 #define CLISTIZEH_C( CLASSNAME ) \
886 class DLLSYM CLASSNAME##_C_IT : public CLIST_ITERATOR \
889 CLASSNAME##_C_IT():CLIST_ITERATOR(){} \
892 CLASSNAME##_CLIST* list):CLIST_ITERATOR(list){} \
895 { return (CLASSNAME*) CLIST_ITERATOR::data(); } \
897 CLASSNAME* data_relative( \
899 { return (CLASSNAME*) CLIST_ITERATOR::data_relative( offset ); } \
901 CLASSNAME* forward() \
902 { return (CLASSNAME*) CLIST_ITERATOR::forward(); } \
904 CLASSNAME* extract() \
905 { return (CLASSNAME*) CLIST_ITERATOR::extract(); } \
907 CLASSNAME* move_to_first() \
908 { return (CLASSNAME*) CLIST_ITERATOR::move_to_first(); } \
910 CLASSNAME* move_to_last() \
911 { return (CLASSNAME*) CLIST_ITERATOR::move_to_last(); } \
914 #define CLISTIZEH( CLASSNAME ) \
916 CLISTIZEH_A( CLASSNAME ) \
918 CLISTIZEH_B( CLASSNAME ) \
920 CLISTIZEH_C( CLASSNAME )
926 #define CLISTIZE( CLASSNAME ) \
937 DLLSYM void CLASSNAME##_c1_zapper( \
940 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 *))
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_CURRENT