|
|
|
|
@ -745,8 +745,13 @@ config_str yon_char_parsed_merge(config_str array1, int size1, config_str array2
|
|
|
|
|
}
|
|
|
|
|
return parsed_final;
|
|
|
|
|
} else {
|
|
|
|
|
*final_size=size1;
|
|
|
|
|
return array1;
|
|
|
|
|
if (array1){
|
|
|
|
|
*final_size=size1;
|
|
|
|
|
return array1;
|
|
|
|
|
}
|
|
|
|
|
if (array2)
|
|
|
|
|
*final_size=size2;
|
|
|
|
|
return array2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1037,6 +1042,17 @@ char *yon_config_get_type_path(YON_CONFIG_TYPE type){
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *yon_config_get_all_info(){
|
|
|
|
|
check_config{
|
|
|
|
|
int size;
|
|
|
|
|
config_str parsed = yon_config_get_all(&size);
|
|
|
|
|
char *full = yon_char_parsed_to_string(parsed,size,"\n");
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
return full;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_config_parameter_set_load_command(char *key, char *command){
|
|
|
|
|
dictionary *found = yon_dictionary_get((dictionary**)&__yon__config__strings,key);
|
|
|
|
|
if (found){
|
|
|
|
|
@ -1225,6 +1241,11 @@ int yon_config_load_config(YON_CONFIG_TYPE config_type, ...){
|
|
|
|
|
for (int i=0;i<command_size;i++){
|
|
|
|
|
int parsed_size;
|
|
|
|
|
config_str parsed = yon_config_load(command[i],&parsed_size);
|
|
|
|
|
int command_parsed_size=0;
|
|
|
|
|
config_str command_parsed = yon_char_parse(command[i],&command_parsed_size," ");
|
|
|
|
|
yon_config_register(command_parsed[5], command[i],NULL);
|
|
|
|
|
yon_config_set_status(command_parsed[5],0);
|
|
|
|
|
yon_char_parsed_free(command_parsed,command_parsed_size);
|
|
|
|
|
if (parsed_size>0){
|
|
|
|
|
for (int j=0;j<parsed_size;j++){
|
|
|
|
|
if (!yon_char_is_empty(parsed[j])&&strcmp(parsed[j],"(null)\n")){
|
|
|
|
|
@ -1533,7 +1554,8 @@ int yon_config_clean(){
|
|
|
|
|
void yon_config_register(char *key, char *config_load, void *data){
|
|
|
|
|
key=yon_char_new(key);
|
|
|
|
|
config_load=yon_char_new(config_load);
|
|
|
|
|
if (!__yon__config__strings||!yon_dictionary_get((dictionary**)&__yon__config__strings,key)){
|
|
|
|
|
yon_config_parameter *current = NULL;
|
|
|
|
|
if (!__yon__config__strings||!(current=(yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){
|
|
|
|
|
{
|
|
|
|
|
if (__yon__config__strings){
|
|
|
|
|
char *data_copy = yon_char_new(data);
|
|
|
|
|
@ -1560,18 +1582,18 @@ void yon_config_register(char *key, char *config_load, void *data){
|
|
|
|
|
__yon__config__strings->section=yon_char_new(section[4]);
|
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
|
}
|
|
|
|
|
else if (yon_dictionary_get((dictionary**)&__yon__config__strings,key)){
|
|
|
|
|
if (data!=__yon__config__strings->data&&strcmp(__yon__config__strings->data,data)){
|
|
|
|
|
__yon__config__strings->data=yon_char_new(data);
|
|
|
|
|
__yon__config__strings->flag1=1;
|
|
|
|
|
__yon__config__strings->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
|
__yon__config__strings->load_command=config_load;
|
|
|
|
|
if (yon_dictionary_get(&__yon_config_ignored, __yon__config__strings->key)){
|
|
|
|
|
else if ((current = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){
|
|
|
|
|
if ((current->data&&data!=__yon__config__strings->data&&strcmp(__yon__config__strings->data,data))||!current->data){
|
|
|
|
|
current->data=yon_char_new(data);
|
|
|
|
|
current->flag1=1;
|
|
|
|
|
current->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
|
current->load_command=config_load;
|
|
|
|
|
if (yon_dictionary_get(&__yon_config_ignored, current->key)){
|
|
|
|
|
yon_dictionary_rip(__yon_config_ignored);
|
|
|
|
|
}
|
|
|
|
|
int size=0;
|
|
|
|
|
config_str section = yon_char_parse(config_load,&size," ");
|
|
|
|
|
__yon__config__strings->section=yon_char_new(section[4]);
|
|
|
|
|
current->section=yon_char_new(section[4]);
|
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1790,9 +1812,9 @@ config_str yon_config_get_save_parameters_by_key(int *size, char *parameter,...)
|
|
|
|
|
config_str yon_config_get_save_parameters(int *size){
|
|
|
|
|
|
|
|
|
|
(*size)=0;
|
|
|
|
|
int removed_size;
|
|
|
|
|
int removed_size=0;
|
|
|
|
|
config_str removed = NULL;
|
|
|
|
|
int updated_size;
|
|
|
|
|
int updated_size=0;
|
|
|
|
|
config_str updated = NULL;
|
|
|
|
|
config_str final = NULL;
|
|
|
|
|
for_config{
|
|
|
|
|
@ -2186,16 +2208,6 @@ void yon_launch(char *command)
|
|
|
|
|
|
|
|
|
|
// // Trash collector functions
|
|
|
|
|
|
|
|
|
|
// typedef struct yon_trash_collector_group{
|
|
|
|
|
|
|
|
|
|
// char *group_key;
|
|
|
|
|
// void *data;
|
|
|
|
|
// struct yon_trash_collector_group *next;
|
|
|
|
|
// struct yon_trash_collector_group *prev;
|
|
|
|
|
// struct yon_trash_collector_group *first;
|
|
|
|
|
|
|
|
|
|
// } yon_trash_collector_group;
|
|
|
|
|
|
|
|
|
|
// typedef struct yon_trash_collector_element{
|
|
|
|
|
// char *key;
|
|
|
|
|
// void *data;
|
|
|
|
|
@ -2205,6 +2217,16 @@ void yon_launch(char *command)
|
|
|
|
|
|
|
|
|
|
// } yon_trash_collector_element;
|
|
|
|
|
|
|
|
|
|
// typedef struct yon_trash_collector_group{
|
|
|
|
|
|
|
|
|
|
// char *group_key;
|
|
|
|
|
// yon_trash_collector_element *data;
|
|
|
|
|
// struct yon_trash_collector_group *next;
|
|
|
|
|
// struct yon_trash_collector_group *prev;
|
|
|
|
|
// struct yon_trash_collector_group *first;
|
|
|
|
|
// } yon_trash_collector_group;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// yon_trash_collector_group *__yon_trash_collector__ = NULL;
|
|
|
|
|
|
|
|
|
|
// #define check_trash if (__yon_trash_collector__)
|
|
|
|
|
@ -2212,6 +2234,43 @@ void yon_launch(char *command)
|
|
|
|
|
// #define for_trash_group for(yon_trash_collector_group *gr = __yon_trash_collector__->first;gr;gr=gr->next)
|
|
|
|
|
// #define for_trash_element(group) for (yon_trash_collector_element *gr = group->first; gr;gr=gr->next)
|
|
|
|
|
|
|
|
|
|
// #define yon_malloc_reg(size,key,group) yon_var_create_register(size,key,group)
|
|
|
|
|
|
|
|
|
|
// yon_trash_collector_group *yon_trash_collector_group_new(){
|
|
|
|
|
// yon_trash_collector_group *group = malloc(sizeof(yon_trash_collector_group));
|
|
|
|
|
// group->data=NULL;
|
|
|
|
|
// group->first=group;
|
|
|
|
|
// group->group_key=NULL;
|
|
|
|
|
// group->next=NULL;
|
|
|
|
|
// group->prev=NULL;
|
|
|
|
|
// return group;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// int yon_trash_collector_element_register(yon_trash_collector_element *element,char *group){
|
|
|
|
|
// if (!element||yon_char_is_empty(element->key)||yon_char_is_empty(group))
|
|
|
|
|
// return 0;
|
|
|
|
|
// check_trash{
|
|
|
|
|
// if (yon_dictionary_get((dictionary**)&__yon_trash_collector__,group)){
|
|
|
|
|
// if (yon_dictionary_get((dictionary**)&__yon_trash_collector__->data,element->key));
|
|
|
|
|
// } else {
|
|
|
|
|
// yon_trash_collector_group *last = (yon_trash_collector_group*)yon_dictionary_get_last((dictionary*)__yon_trash_collector__);
|
|
|
|
|
// __yon_trash_collector__->next = yon_trash_collector_group_new();
|
|
|
|
|
// __yon_trash_collector__->next->prev=__yon_trash_collector__;
|
|
|
|
|
// __yon_trash_collector__->next->first=__yon_trash_collector__->first;
|
|
|
|
|
// __yon_trash_collector__->next->data=element;
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// __yon_trash_collector__ = yon_trash_collector_group_new();
|
|
|
|
|
// __yon_trash_collector__->data=element;
|
|
|
|
|
// }
|
|
|
|
|
// return 1;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// void *yon_var_create_register(int size,char *key,char*group){
|
|
|
|
|
// void *allocated = malloc(size);
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// yon_trash_collector_element *yon_trash_collector_element_get(void *pointer,yon_trash_collector_group *group){
|
|
|
|
|
// for_trash_element(group){
|
|
|
|
|
// if (gr->data==pointer)
|
|
|
|
|
|