Mercurial > hg > th-libs
diff th_config.h @ 16:0cea9c0cfce7
Sync.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 02 Nov 2010 23:22:44 +0200 |
parents | 4adf7093060c |
children | 1ac2449c4df7 |
line wrap: on
line diff
--- a/th_config.h Sat Oct 30 17:48:40 2010 +0300 +++ b/th_config.h Tue Nov 02 23:22:44 2010 +0200 @@ -19,14 +19,17 @@ /* Definitions */ enum ITEM_TYPE { - ITEM_BLOCK = 1, + ITEM_SECTION = 1, ITEM_COMMENT, ITEM_STRING, ITEM_INT, ITEM_UINT, ITEM_BOOL, ITEM_FLOAT, - ITEM_HEX_TRIPLET + ITEM_HEX_TRIPLET, + + ITEM_STRING_LIST, + ITEM_HEX_TRIPLET_LIST }; @@ -34,14 +37,15 @@ int type; char *name; union { - void *data; int *val_int; unsigned int *val_uint; - char *val_str; + char **val_str; BOOL *val_bool; + + void *data; + qlist_t **list; struct _cfgitem_t *section; }; - BOOL (*validate)(struct _cfgitem_t *); struct _cfgitem_t *next, *prev; } cfgitem_t; @@ -49,19 +53,20 @@ /* Functions */ -int th_config_read(FILE *, char *, cfgitem_t *); -void th_config_free(cfgitem_t *); -int th_config_write(FILE *, char *, cfgitem_t *); +int th_cfg_read(FILE *, char *, cfgitem_t *); +void th_cfg_free(cfgitem_t *); +int th_cfg_write(FILE *, char *, cfgitem_t *); -int th_config_add_section(cfgitem_t **cfg, char *name, cfgitem_t *data); -int th_config_add_comment(cfgitem_t **cfg, char *comment); -int th_config_add_int(cfgitem_t **cfg, char *name, BOOL (*validate)(cfgitem_t *), int *data, int itemDef); -int th_config_add_uint(cfgitem_t **cfg, char *name, BOOL (*validate)(cfgitem_t *), unsigned int *data, unsigned int itemDef); -int th_config_add_string(cfgitem_t **cfg, char *name, BOOL (*validate)(cfgitem_t *), char **data, char *itemDef); -int th_config_add_bool(cfgitem_t **cfg, char *name, BOOL (*validate)(cfgitem_t *), BOOL *data, BOOL itemDef); -int th_config_add_float(cfgitem_t **cfg, char *name, BOOL (*validate)(cfgitem_t *), float *data, float itemDef); -int th_config_add_hexvalue(cfgitem_t **cfg, char *name, BOOL (*validate)(cfgitem_t *), int *data, int itemDef); +int th_cfg_add_section(cfgitem_t **cfg, char *name, cfgitem_t *data); +int th_cfg_add_comment(cfgitem_t **cfg, char *comment); +int th_cfg_add_int(cfgitem_t **cfg, char *name, int *data, int itemDef); +int th_cfg_add_uint(cfgitem_t **cfg, char *name, unsigned int *data, unsigned int itemDef); +int th_cfg_add_string(cfgitem_t **cfg, char *name, char **data, char *itemDef); +int th_cfg_add_bool(cfgitem_t **cfg, char *name, BOOL *data, BOOL itemDef); +int th_cfg_add_float(cfgitem_t **cfg, char *name, float *data, float itemDef); +int th_cfg_add_hexvalue(cfgitem_t **cfg, char *name, int *data, int itemDef); +int th_cfg_add_string_list(cfgitem_t **cfg, char *name, qlist_t **list); #ifdef __cplusplus }