|
|
|
|
@ -900,10 +900,14 @@ dictionary *__yon_config_ignored = NULL;
|
|
|
|
|
#define for_config dictionary *temp = NULL; for_dictionaries(temp,(dictionary*)__yon__config__strings)
|
|
|
|
|
#define for_default_config dictionary *temp = NULL; for_dictionaries(temp,(dictionary*)__yon__config__default__strings)
|
|
|
|
|
#define yon_config_parameter_add_or_create_if_exists_with_data(dict,key,value) {if (dict){\
|
|
|
|
|
if (yon_dictionary_get((dictionary**)&dict,key))\
|
|
|
|
|
yon_config_parameter *dct = (yon_config_parameter *)yon_dictionary_get((dictionary**)&dict,key);\
|
|
|
|
|
if (dct) {\
|
|
|
|
|
dict=dct;\
|
|
|
|
|
dict->data=value;\
|
|
|
|
|
else\
|
|
|
|
|
}\
|
|
|
|
|
else{\
|
|
|
|
|
dict=yon_config_parameter_append_with_data(dict,key,value);\
|
|
|
|
|
}\
|
|
|
|
|
}\
|
|
|
|
|
else dict=yon_config_parameter_new_with_data(key,value);}
|
|
|
|
|
|
|
|
|
|
@ -1278,7 +1282,24 @@ int yon_config_clean(){
|
|
|
|
|
|
|
|
|
|
void yon_config_register(char *key, char *config_section, void *data){
|
|
|
|
|
if (!__yon__config__strings||!yon_dictionary_get((dictionary**)&__yon__config__strings,key)){
|
|
|
|
|
yon_config_parameter_add_or_create_if_exists_with_data(__yon__config__strings,key,yon_char_new(data));
|
|
|
|
|
{
|
|
|
|
|
if (__yon__config__strings){
|
|
|
|
|
char *data_copy = yon_char_new(data);
|
|
|
|
|
yon_config_parameter* dict=NULL;
|
|
|
|
|
for_dictionaries(dict,__yon__config__strings){
|
|
|
|
|
if (!dict->next){
|
|
|
|
|
__yon__config__strings=dict;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
__yon__config__strings=yon_config_parameter_append_with_data(__yon__config__strings,key,data_copy);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
char *data_copy = yon_char_new(data);
|
|
|
|
|
__yon__config__strings=yon_config_parameter_new_with_data(key,yon_char_new(data));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
__yon__config__strings = (yon_config_parameter*)yon_dictionary_get_last((dictionary*)__yon__config__strings);
|
|
|
|
|
__yon__config__strings->flag1=1;
|
|
|
|
|
__yon__config__strings->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
|
__yon__config__strings->section=yon_char_new(config_section);
|
|
|
|
|
|