src/server/config/objconf.h

changeset 415
d938228c382e
parent 95
74a81d9e19d0
child 419
f1d29785ad2d
--- a/src/server/config/objconf.h	Wed Nov 02 19:19:01 2022 +0100
+++ b/src/server/config/objconf.h	Sun Nov 06 15:53:32 2022 +0100
@@ -34,37 +34,42 @@
 #ifdef	__cplusplus
 extern "C" {
 #endif
-
+    
+#define CFG_LEVEL_PREPEND(list, level) \
+    cx_linked_list_prepend((void**)list, NULL, -1, offsetof(ConfigParserLevel, next), level)
+    
 typedef struct _conf_object {
     ConfigLine *begin;
     ConfigLine *end;
     
-    sstr_t     name;
-    sstr_t     ppath;
+    cxmutstr     name;
+    cxmutstr     ppath;
     // directives
-    UcxList    *directives[7];
+    ConfigDirectiveList *directives[7];
 } ConfigObject;
 
 /*
  * representing a xml like level in the obj.conf tree
  */
-typedef struct _conf_parser_level {
+typedef struct ConfigParserLevel ConfigParserLevel;
+struct ConfigParserLevel {
     ConfigTag  *iftag;   // last if tag
     ConfigTag  *tag;     // root of this level
     int        levelnum;
-} ConfigParserLevel;
+    ConfigParserLevel *next;
+};
 
 typedef struct _obj_conf {
     ConfigParser parser;
     char         *file;
     //UcxDlist     *lines;
-    UcxList      *conditions;
-    UcxList      *objects;
+    //UcxList      *conditions;
+    CxList      *objects;
 
     // private parser temp var
     ConfigObject *obj;     // add directives to this object
     // private parser temp var
-    UcxList      *levels;  // tree levels (stack)
+    ConfigParserLevel     *levels;  // tree levels (stack)
     
 } ObjectConfig;
 
@@ -72,11 +77,11 @@
 
 void free_object_config(ObjectConfig *conf);
 
-int objconf_parse(void *p, ConfigLine *begin, ConfigLine *end, sstr_t line);
+int objconf_parse(void *p, ConfigLine *begin, ConfigLine *end, cxmutstr line);
 
 int objconf_on_begin_tag(ObjectConfig *conf, ConfigTag *tag);
 
-int objconf_on_end_tag(ObjectConfig *conf, sstr_t tagname);
+int objconf_on_end_tag(ObjectConfig *conf, cxmutstr tagname);
 
 int objconf_on_directive(ObjectConfig *conf, ConfigDirective *dir);
 

mercurial