libkcal
pvl.hGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __PVL_H__
00012 #define __PVL_H__
00013
00014 typedef struct pvl_list_t* pvl_list;
00015 typedef struct pvl_elem_t* pvl_elem;
00016
00023 typedef struct pvl_elem_t
00024 {
00025 int MAGIC;
00026 void *d;
00027 struct pvl_elem_t *next;
00028 struct pvl_elem_t *prior;
00029 } pvl_elem_t;
00030
00031
00032
00038 extern int pvl_elem_count;
00039 extern int pvl_list_count;
00040
00041
00042 pvl_elem pvl_new_element(void* d, pvl_elem next,pvl_elem prior);
00043 pvl_list pvl_newlist(void);
00044 void pvl_free(pvl_list);
00045
00046
00047 void pvl_unshift(pvl_list l,void *d);
00048 void* pvl_shift(pvl_list l);
00049 pvl_elem pvl_head(pvl_list);
00050
00051
00052 void pvl_push(pvl_list l,void *d);
00053 void* pvl_pop(pvl_list l);
00054 pvl_elem pvl_tail(pvl_list);
00055
00056
00057 typedef int (*pvl_comparef)(void* a, void* b);
00058 void pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d);
00059 void pvl_insert_after(pvl_list l,pvl_elem e,void *d);
00060 void pvl_insert_before(pvl_list l,pvl_elem e,void *d);
00061
00062
00063 void* pvl_remove(pvl_list,pvl_elem);
00064 void pvl_clear(pvl_list);
00065
00066 int pvl_count(pvl_list);
00067
00068
00069 pvl_elem pvl_next(pvl_elem e);
00070 pvl_elem pvl_prior(pvl_elem e);
00071
00072
00073 #ifndef PVL_USE_MACROS
00074 void* pvl_data(pvl_elem);
00075 #else
00076 #define pvl_data(x) x==0 ? 0 : ((struct pvl_elem_t *)x)->d;
00077 #endif
00078
00079
00080
00081 typedef int (*pvl_findf)(void* a, void* b);
00082 pvl_elem pvl_find(pvl_list l,pvl_findf f,void* v);
00083 pvl_elem pvl_find_next(pvl_list l,pvl_findf f,void* v);
00084
00089 typedef void (*pvl_applyf)(void* a, void* b);
00090 void pvl_apply(pvl_list l,pvl_applyf f, void *v);
00091
00092
00093 #endif
00094
00095
00096
00097
00098
|