00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _list_h_
00018 #define _list_h_
00019
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023
00024 typedef struct st_list {
00025 struct st_list *prev,*next;
00026 void *data;
00027 } LIST;
00028
00029 typedef int (*list_walk_action)(void *,void *);
00030
00031 extern LIST *list_add(LIST *root,LIST *element);
00032 extern LIST *list_delete(LIST *root,LIST *element);
00033 extern LIST *list_cons(void *data,LIST *root);
00034 extern LIST *list_reverse(LIST *root);
00035 extern void list_free(LIST *root,unsigned int free_data);
00036 extern unsigned int list_length(LIST *);
00037 extern int list_walk(LIST *,list_walk_action action,gptr argument);
00038
00039 #define rest(a) ((a)->next)
00040 #define list_push(a,b) (a)=list_cons((b),(a))
00041 #define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((gptr) old,MYF(MY_FAE)); }
00042
00043 #ifdef __cplusplus
00044 }
00045 #endif
00046 #endif