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,
153 BOOL8 ex_current_was_last;
155 BOOL8 ex_current_was_cycle_pt;
159 BOOL8 started_cycling;
171 CLIST *list_to_iterate);
174 CLIST *list_to_iterate);
176 void add_after_then_move(
179 void add_after_stay_put(
182 void add_before_then_move(
185 void add_before_stay_put(
191 void add_list_before(
201 return current->data;
211 void *move_to_first();
213 void *move_to_last();
215 void mark_cycle_pt();
222 return list->empty ();
245 const void *,
const void *));
257 CLIST *list_to_iterate) {
259 if (!list_to_iterate)
261 "list_to_iterate is NULL");
264 list = list_to_iterate;
266 current = list->First ();
267 next = current != NULL ? current->next : NULL;
269 started_cycling =
FALSE;
270 ex_current_was_last =
FALSE;
271 ex_current_was_cycle_pt =
FALSE;
304 new_element->data = new_data;
306 if (list->
empty ()) {
307 new_element->next = new_element;
308 list->last = new_element;
309 prev = next = new_element;
312 new_element->next = next;
315 current->next = new_element;
317 if (current == list->last)
318 list->last = new_element;
321 prev->next = new_element;
322 if (ex_current_was_last)
323 list->last = new_element;
324 if (ex_current_was_cycle_pt)
325 cycle_pt = new_element;
328 current = new_element;
351 new_element->data = new_data;
353 if (list->
empty ()) {
354 new_element->next = new_element;
355 list->last = new_element;
356 prev = next = new_element;
357 ex_current_was_last =
FALSE;
361 new_element->next = next;
364 current->next = new_element;
367 if (current == list->last)
368 list->last = new_element;
371 prev->next = new_element;
372 if (ex_current_was_last) {
373 list->last = new_element;
374 ex_current_was_last =
FALSE;
401 new_element->data = new_data;
403 if (list->
empty ()) {
404 new_element->next = new_element;
405 list->last = new_element;
406 prev = next = new_element;
409 prev->next = new_element;
411 new_element->next = current;
415 new_element->next = next;
416 if (ex_current_was_last)
417 list->last = new_element;
418 if (ex_current_was_cycle_pt)
419 cycle_pt = new_element;
422 current = new_element;
445 new_element->data = new_data;
447 if (list->
empty ()) {
448 new_element->next = new_element;
449 list->last = new_element;
450 prev = next = new_element;
451 ex_current_was_last =
TRUE;
455 prev->next = new_element;
457 new_element->next = current;
462 new_element->next = next;
463 if (ex_current_was_last)
464 list->last = new_element;
484 "list_to_add is NULL");
487 if (!list_to_add->
empty ()) {
488 if (list->
empty ()) {
489 list->last = list_to_add->last;
491 next = list->First ();
492 ex_current_was_last =
TRUE;
497 current->next = list_to_add->First ();
498 if (current == list->last)
499 list->last = list_to_add->last;
500 list_to_add->last->next = next;
501 next = current->next;
504 prev->next = list_to_add->First ();
505 if (ex_current_was_last) {
506 list->last = list_to_add->last;
507 ex_current_was_last =
FALSE;
509 list_to_add->last->next = next;
513 list_to_add->last = NULL;
531 "list_to_add is NULL");
534 if (!list_to_add->
empty ()) {
535 if (list->
empty ()) {
536 list->last = list_to_add->last;
538 current = list->First ();
539 next = current->next;
540 ex_current_was_last =
FALSE;
543 prev->next = list_to_add->First ();
545 list_to_add->last->next = current;
548 list_to_add->last->next = next;
549 if (ex_current_was_last)
550 list->last = list_to_add->last;
551 if (ex_current_was_cycle_pt)
552 cycle_pt = prev->next;
554 current = prev->next;
555 next = current->next;
557 list_to_add->last = NULL;
571 void *extracted_data;
584 prev = next = list->last = NULL;
588 if (current == list->last) {
590 ex_current_was_last =
TRUE;
592 ex_current_was_last =
FALSE;
596 ex_current_was_cycle_pt = (current == cycle_pt) ?
TRUE :
FALSE;
597 extracted_data = current->data;
600 return extracted_data;
616 current = list->First ();
618 next = current != NULL ? current->next : NULL;
619 return current != NULL ? current->data : NULL;
642 ex_current_was_cycle_pt =
TRUE;
643 started_cycling =
FALSE;
660 return ((list->
empty ()) || (current == list->First ()) || ((current == NULL) &&
661 (prev == list->last) &&
662 !ex_current_was_last));
679 return ((list->
empty ()) || (current == list->last) || ((current == NULL) &&
680 (prev == list->last) &&
681 ex_current_was_last));
697 return ((list->
empty ()) || ((current == cycle_pt) && started_cycling));
727 const void *,
const void *)) {
733 list->
sort (comparator);
769 new_element->data = new_data;
771 new_element->next = list->last->next;
772 list->last->next = new_element;
773 list->last = new_element;
785 #define QUOTE_IT( parm ) #parm
819 #define CLISTIZEH_A(CLASSNAME) \
821 extern DLLSYM void CLASSNAME##_c1_zapper( \
825 *CLASSNAME##_c1_copier( \
828 #define CLISTIZEH_B(CLASSNAME) \
839 class DLLSYM CLASSNAME##_CLIST : public CLIST { \
841 CLASSNAME##_CLIST() : CLIST() {} \
845 const CLASSNAME##_CLIST &) \
847 DONT_CONSTRUCT_LIST_BY_COPY.error(QUOTE_IT(CLASSNAME##_CLIST), ABORT, \
853 CLIST::internal_deep_clear(&CLASSNAME##_c1_zapper); \
857 const CLASSNAME##_CLIST &) { \
858 DONT_ASSIGN_LISTS.error(QUOTE_IT(CLASSNAME##_CLIST), ABORT, NULL); \
861 #define CLISTIZEH_C(CLASSNAME) \
876 class DLLSYM CLASSNAME##_C_IT : public CLIST_ITERATOR { \
878 CLASSNAME##_C_IT() : CLIST_ITERATOR() {} \
880 CLASSNAME##_C_IT(CLASSNAME##_CLIST *list) : CLIST_ITERATOR(list) {} \
882 CLASSNAME *data() { return (CLASSNAME *)CLIST_ITERATOR::data(); } \
884 CLASSNAME *data_relative(inT8 offset) { \
885 return (CLASSNAME *)CLIST_ITERATOR::data_relative(offset); \
888 CLASSNAME *forward() { return (CLASSNAME *)CLIST_ITERATOR::forward(); } \
890 CLASSNAME *extract() { return (CLASSNAME *)CLIST_ITERATOR::extract(); } \
892 CLASSNAME *move_to_first() { \
893 return (CLASSNAME *)CLIST_ITERATOR::move_to_first(); \
896 CLASSNAME *move_to_last() { \
897 return (CLASSNAME *)CLIST_ITERATOR::move_to_last(); \
901 #define CLISTIZEH(CLASSNAME) \
903 CLISTIZEH_A(CLASSNAME) \
905 CLISTIZEH_B(CLASSNAME) \
907 CLISTIZEH_C(CLASSNAME)
913 #define CLISTIZE(CLASSNAME) \
925 DLLSYM void CLASSNAME##_c1_zapper( \
928 delete (CLASSNAME *)link; \
void add_list_before(CLIST *list_to_add)
void add_to_end(void *new_data)
void add_list_after(CLIST *list_to_add)
void sort(int comparator(const void *, const void *))
void operator=(const CLIST_LINK &)
void add_after_stay_put(void *new_data)
void set_to_list(CLIST *list_to_iterate)
void assign_to_sublist(CLIST_ITERATOR *start_it, CLIST_ITERATOR *end_it)
BOOL8 current_extracted()
const ERRCODE NULL_CURRENT
void add_before_then_move(void *new_data)
void sort(int comparator(const void *, const void *))
void add_before_stay_put(void *new_data)
const ERRCODE BAD_PARAMETER
void shallow_copy(CLIST *from_list)
void add_after_then_move(void *new_data)
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
CLIST_LINK(const CLIST_LINK &)