Tesseract
3.02
|
Go to the source code of this file.
Defines | |
#define | add_on(l, x) l = push (l,first_node (x)) |
#define | next_one(l) l = list_rest (l) |
Functions | |
int | count (LIST var_list) |
LIST | delete_d (LIST list, void *key, int_compare is_equal) |
LIST | delete_d (LIST list, void *key, TessResultCallback2< int, void *, void * > *is_equal) |
LIST | destroy (LIST list) |
void | destroy_nodes (LIST list, void_dest destructor) |
void | insert (LIST list, void *node) |
int | is_same_node (void *item1, void *item2) |
int | is_same (void *item1, void *item2) |
LIST | join (LIST list1, LIST list2) |
LIST | last (LIST var_list) |
void * | nth_cell (LIST var_list, int item_num) |
LIST | pop (LIST list) |
LIST | push (LIST list, void *element) |
LIST | push_last (LIST list, void *item) |
LIST | reverse (LIST list) |
LIST | reverse_d (LIST list) |
LIST | s_adjoin (LIST var_list, void *variable, int_compare compare) |
LIST | search (LIST list, void *key, int_compare is_equal) |
LIST | search (LIST list, void *key, TessResultCallback2< int, void *, void * > *is_equal) |
#define add_on | ( | l, | |
x | |||
) | l = push (l,first_node (x)) |
Definition at line 97 of file oldlist.cpp.
#define next_one | ( | l | ) | l = list_rest (l) |
Definition at line 98 of file oldlist.cpp.
int count | ( | LIST | var_list | ) |
Definition at line 108 of file oldlist.cpp.
{ int temp = 0; iterate (var_list) temp += 1; return (temp); }
LIST delete_d | ( | LIST | list, |
void * | key, | ||
int_compare | is_equal | ||
) |
Definition at line 125 of file oldlist.cpp.
{ LIST result = NIL_LIST; LIST last_one = NIL_LIST; if (is_equal == NULL) is_equal = is_same; while (list != NIL_LIST) { if (!(*is_equal) (first_node (list), key)) { if (last_one == NIL_LIST) { last_one = list; list = list_rest (list); result = last_one; set_rest(last_one, NIL_LIST); } else { set_rest(last_one, list); last_one = list; list = list_rest (list); set_rest(last_one, NIL_LIST); } } else { list = pop (list); } } return (result); }
LIST delete_d | ( | LIST | list, |
void * | key, | ||
TessResultCallback2< int, void *, void * > * | is_equal | ||
) |
Definition at line 154 of file oldlist.cpp.
{ LIST result = NIL_LIST; LIST last_one = NIL_LIST; while (list != NIL_LIST) { if (!(*is_equal).Run (first_node (list), key)) { if (last_one == NIL_LIST) { last_one = list; list = list_rest (list); result = last_one; set_rest(last_one, NIL_LIST); } else { set_rest(last_one, list); last_one = list; list = list_rest (list); set_rest(last_one, NIL_LIST); } } else { list = pop (list); } } return (result); }
Definition at line 204 of file oldlist.cpp.
{ if (destructor == NULL) destructor = memfree; while (list != NIL_LIST) { (*destructor) (first_node (list)); list = pop (list); } }
void insert | ( | LIST | list, |
void * | node | ||
) |
int is_same | ( | void * | item1, |
void * | item2 | ||
) |
Definition at line 252 of file oldlist.cpp.
{ return (!strcmp ((char *) item1, (char *) item2)); }
int is_same_node | ( | void * | item1, |
void * | item2 | ||
) |
Definition at line 241 of file oldlist.cpp.
{
return (item1 == item2);
}
Definition at line 264 of file oldlist.cpp.
Definition at line 277 of file oldlist.cpp.
void* nth_cell | ( | LIST | var_list, |
int | item_num | ||
) |
Definition at line 289 of file oldlist.cpp.
{ int x = 0; iterate(var_list) { if (x++ == item_num) return (var_list); } return (var_list); }
Definition at line 357 of file oldlist.cpp.
{ LIST newlist = NIL_LIST; iterate (list) copy_first (list, newlist); return (newlist); }
Definition at line 371 of file oldlist.cpp.
LIST s_adjoin | ( | LIST | var_list, |
void * | variable, | ||
int_compare | compare | ||
) |
Definition at line 384 of file oldlist.cpp.
{ LIST l; int result; if (compare == NULL) compare = (int_compare) strcmp; l = var_list; iterate(l) { result = (*compare) (variable, first_node (l)); if (result == 0) return (var_list); else if (result < 0) { insert(l, variable); return (var_list); } } return (push_last (var_list, variable)); }
LIST search | ( | LIST | list, |
void * | key, | ||
int_compare | is_equal | ||
) |
Definition at line 413 of file oldlist.cpp.
LIST search | ( | LIST | list, |
void * | key, | ||
TessResultCallback2< int, void *, void * > * | is_equal | ||
) |
Definition at line 422 of file oldlist.cpp.
{ iterate (list) if ((*is_equal).Run(first_node (list), key)) return (list); return (NIL_LIST); }