00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __EKG_DYNSTUFF_H
00023 #define __EKG_DYNSTUFF_H
00024
00025 struct list {
00026
00027
00028
00029
00030
00031 struct list *next;
00032
00033 void *data;
00034 };
00035
00036 typedef struct list *list_t;
00037
00038 #define LIST_ADD_COMPARE(x, type) int x(const type data1, const type data2)
00039 #define LIST_ADD_SORTED2(list, data, comp) list_add_sorted3((list_t *) (void *) list, (list_t) data, (void *) comp)
00040 #define LIST_ADD_BEGINNING2(list, data) list_add_beginning3((list_t *) (void *) list, (list_t) data)
00041 #define LIST_ADD2(list, data) list_add3((list_t *) (void *) list, (list_t) data)
00042
00043 #define LIST_COUNT2(list) list_count((list_t) list)
00044 #define LIST_REMOVE2(list, elem, func) list_remove3((list_t *) (void *) list, (list_t) elem, (void *) func)
00045 #define LIST_UNLINK2(list, elem) list_unlink3((list_t *) (void *) list, (list_t) elem)
00046 #define LIST_FREE_ITEM(x, type) void x(type data)
00047
00048 #define LIST_DESTROY2(list, func) list_destroy3((list_t) list, (void *) func)
00049
00050 void *list_add_beginning(list_t *list, void *data);
00051
00052 void *list_add3(list_t *list, list_t new);
00053 void *list_add_sorted3(list_t *list, list_t new, int (*comparision)(void *, void *));
00054 void list_add_beginning3(list_t *list, list_t new);
00055
00056 void *list_remove3(list_t *list, list_t elem, void (*func)(list_t));
00057 void *list_remove3i(list_t *list, list_t elem, void (*func)(list_t data));
00058 void *list_unlink3(list_t *list, list_t elem);
00059
00060 int list_destroy(list_t list);
00061 int list_destroy3(list_t list, void (*func)(void *));
00062
00063 void list_cleanup(list_t *list);
00064 int list_remove_safe(list_t *list, void *data);
00065
00066 struct string {
00067 char *str;
00068 int len, size;
00069 };
00070
00071 typedef struct string *string_t;
00072
00073 string_t string_init(const char *str);
00074 int string_append(string_t s, const char *str);
00075 int string_append_n(string_t s, const char *str, int count);
00076 int string_append_c(string_t s, char ch);
00077 int string_append_raw(string_t s, const char *str, int count);
00078 void string_remove(string_t s, int count);
00079 char *string_free(string_t s, int free_string);
00080
00081
00082 char **array_make(const char *string, const char *sep, int max, int trim, int quotes);
00083 char *array_join(char **array, const char *sep);
00084
00085 int array_add(char ***array, char *string);
00086 int array_add_check(char ***array, char *string, int casesensitive);
00087 int array_count(char **array);
00088 int array_item_contains(char **array, const char *string, int casesensitive);
00089 void array_free(char **array);
00090
00091
00092
00093 const char *itoa(long int i);
00094
00095
00096
00097
00098 typedef struct private_data_s {
00099 struct private_data_s *next;
00100
00101 char *name;
00102 char *value;
00103 } private_data_t;
00104
00105 void private_item_set(private_data_t **data, const char *item_name, const char *value);
00106 int private_item_get_int(private_data_t **data, const char *item_name);
00107 void private_items_destroy(private_data_t **data);
00108
00109 #endif
00110
00111
00112
00113
00114
00115
00116
00117
00118