120 } |
120 } |
121 return 0; |
121 return 0; |
122 } |
122 } |
123 |
123 |
124 int objconf_on_begin_tag(ObjectConfig *conf, ConfigTag *tag) { |
124 int objconf_on_begin_tag(ObjectConfig *conf, ConfigTag *tag) { |
125 UcxMempool *mp = conf->parser.mp; |
125 UcxAllocator *mp = conf->parser.mp; |
126 if(tag->type_num != TAG_OBJECT) { |
126 if(tag->type_num != TAG_OBJECT) { |
127 ConfigParserLevel *l = conf->levels->data; |
127 ConfigParserLevel *l = conf->levels->data; |
128 if(l->tag->type_num != TAG_OBJECT) { |
128 if(l->tag->type_num != TAG_OBJECT) { |
129 tag->parent = l->tag; |
129 tag->parent = l->tag; |
130 } |
130 } |
139 |
139 |
140 obj->name = cfg_param_get(tag->param, sstr("name")); |
140 obj->name = cfg_param_get(tag->param, sstr("name")); |
141 obj->ppath = cfg_param_get(tag->param, sstr("ppath")); |
141 obj->ppath = cfg_param_get(tag->param, sstr("ppath")); |
142 |
142 |
143 conf->obj = obj; |
143 conf->obj = obj; |
144 conf->objects = cfg_dlist_append(mp, conf->objects, obj); |
144 conf->objects = ucx_list_append_a(mp, conf->objects, obj); |
145 |
145 |
146 // create tree level object |
146 // create tree level object |
147 ConfigParserLevel *lvl = OBJ_NEW(mp, ConfigParserLevel); |
147 ConfigParserLevel *lvl = OBJ_NEW(mp, ConfigParserLevel); |
148 lvl->iftag = NULL; |
148 lvl->iftag = NULL; |
149 lvl->levelnum = 1; |
149 lvl->levelnum = 1; |
150 lvl->tag = tag; |
150 lvl->tag = tag; |
151 conf->levels = ucx_list_prepend(conf->levels, lvl); |
151 conf->levels = ucx_list_prepend_a(mp, conf->levels, lvl); |
152 |
152 |
153 break; |
153 break; |
154 } |
154 } |
155 case TAG_IF: { |
155 case TAG_IF: { |
156 // create tree level object |
156 // create tree level object |
159 ConfigParserLevel *lvl = OBJ_NEW(mp, ConfigParserLevel); |
159 ConfigParserLevel *lvl = OBJ_NEW(mp, ConfigParserLevel); |
160 |
160 |
161 lvl->iftag = NULL; |
161 lvl->iftag = NULL; |
162 lvl->levelnum = last_lvl->levelnum + 1; |
162 lvl->levelnum = last_lvl->levelnum + 1; |
163 lvl->tag = tag; |
163 lvl->tag = tag; |
164 conf->levels = ucx_list_prepend(conf->levels, lvl); |
164 conf->levels = ucx_list_prepend_a(mp, conf->levels, lvl); |
165 last_lvl->iftag = tag; |
165 last_lvl->iftag = tag; |
166 |
166 |
167 break; |
167 break; |
168 } |
168 } |
169 case TAG_ELSEIF: { |
169 case TAG_ELSEIF: { |
225 if(lvl->tag->type_num != TAG_OBJECT) { |
228 if(lvl->tag->type_num != TAG_OBJECT) { |
226 dir->condition = lvl->tag; |
229 dir->condition = lvl->tag; |
227 } |
230 } |
228 |
231 |
229 // add directive to current object |
232 // add directive to current object |
230 conf->obj->directives[dir->type_num] = cfg_dlist_append( |
233 conf->obj->directives[dir->type_num] = ucx_list_append_a( |
231 conf->parser.mp, |
234 conf->parser.mp, |
232 conf->obj->directives[dir->type_num], |
235 conf->obj->directives[dir->type_num], |
233 dir); |
236 dir); |
234 |
237 |
235 return 0; |
238 return 0; |