30 #define CFG_CONF_H |
30 #define CFG_CONF_H |
31 |
31 |
32 #include <stdio.h> |
32 #include <stdio.h> |
33 #include <stdlib.h> |
33 #include <stdlib.h> |
34 |
34 |
35 #include "../ucx/list.h" |
35 #include <ucx/list.h> |
36 #include "../ucx/dlist.h" |
36 #include <ucx/map.h> |
37 #include "../ucx/map.h" |
37 #include <ucx/mempool.h> |
38 #include "../ucx/mempool.h" |
38 #include <ucx/string.h> |
39 #include "../ucx/string.h" |
|
40 |
39 |
41 #ifdef __cplusplus |
40 #ifdef __cplusplus |
42 extern "C" { |
41 extern "C" { |
43 #endif |
42 #endif |
44 |
43 |
45 // mempool malloc macro |
44 // mempool malloc macro |
46 #define OBJ_NEW(pool, type) (type*)ucx_mempool_malloc(pool, sizeof(type)) |
45 #define OBJ_NEW(p, type) (type*)(p)->malloc((p)->pool, sizeof(type)) |
47 #define OBJ_NEW_N(pool, type) (type*)ucx_mempool_calloc(pool, 1, sizeof(type)) |
46 #define OBJ_NEW_N(p, type) (type*)(p)->calloc((p)->pool, 1, sizeof(type)) |
48 |
47 |
49 // line types |
48 // line types |
50 #define LINE_OTHER 0 |
49 #define LINE_OTHER 0 |
51 #define LINE_DIRECTIVE 1 |
50 #define LINE_DIRECTIVE 1 |
52 #define LINE_BEGIN_TAG 2 |
51 #define LINE_BEGIN_TAG 2 |
115 |
114 |
116 sstr_t cfg_param(sstr_t params, sstr_t *name, sstr_t *value); |
115 sstr_t cfg_param(sstr_t params, sstr_t *name, sstr_t *value); |
117 |
116 |
118 sstr_t cfg_param_get(UcxList *list, sstr_t name); |
117 sstr_t cfg_param_get(UcxList *list, sstr_t name); |
119 |
118 |
120 ConfigDirective* cfg_parse_directive(sstr_t line, UcxMempool *mp); |
119 ConfigDirective* cfg_parse_directive(sstr_t line, UcxAllocator *mp); |
121 |
120 |
122 UcxList* cfg_param_list(sstr_t param_str, UcxMempool *mp); |
121 UcxList* cfg_param_list(sstr_t param_str, UcxAllocator *mp); |
123 |
122 |
124 int cfg_get_directive_type_num(sstr_t type); |
123 int cfg_get_directive_type_num(sstr_t type); |
125 |
124 |
126 int cfg_get_basic_type(sstr_t line); |
125 int cfg_get_basic_type(sstr_t line); |
127 |
126 |
129 |
128 |
130 int cfg_get_tag_type(sstr_t tag); |
129 int cfg_get_tag_type(sstr_t tag); |
131 |
130 |
132 sstr_t cfg_get_end_tag_name(sstr_t line); |
131 sstr_t cfg_get_end_tag_name(sstr_t line); |
133 |
132 |
134 ConfigTag* cfg_parse_begin_tag(sstr_t line, UcxMempool *mp); |
133 ConfigTag* cfg_parse_begin_tag(sstr_t line, UcxAllocator *mp); |
135 |
134 |
136 ConfigDirective* cfg_directivelist_get(UcxDlist *dirs, sstr_t name); |
135 ConfigDirective* cfg_directivelist_get(UcxList *dirs, sstr_t name); |
137 |
136 |
138 sstr_t cfg_directivelist_get_str(UcxDlist *dirs, sstr_t name); |
137 sstr_t cfg_directivelist_get_str(UcxList *dirs, sstr_t name); |
139 |
138 |
140 sstr_t cfg_directive_pstr1(ConfigDirective *dir); |
139 sstr_t cfg_directive_pstr1(ConfigDirective *dir); |
141 |
140 |
142 void cfg_list_destr(UcxMempool *mp, UcxList *list); |
|
143 void cfg_dlist_destr(UcxMempool *mp, UcxDlist *list); |
|
144 void cfg_map_destr(UcxMempool *mp, UcxMap *map); |
141 void cfg_map_destr(UcxMempool *mp, UcxMap *map); |
145 UcxList* cfg_list_append(UcxMempool *mp, UcxList *list, void *data); |
|
146 UcxDlist* cfg_dlist_append(UcxMempool *mp, UcxDlist *list, void *data); |
|
147 |
142 |
148 #ifdef __cplusplus |
143 #ifdef __cplusplus |
149 } |
144 } |
150 #endif |
145 #endif |
151 |
146 |