parent
3cf760c38f
commit
6fbb8a4664
|
@ -8,6 +8,8 @@
|
|||
static Eet_Data_Descriptor *_e_ipc_int_edd = NULL;
|
||||
static Eet_Data_Descriptor *_e_ipc_double_edd = NULL;
|
||||
static Eet_Data_Descriptor *_e_ipc_2int_edd = NULL;
|
||||
static Eet_Data_Descriptor *_e_ipc_str_edd = NULL;
|
||||
static Eet_Data_Descriptor *_e_ipc_str_list_edd = NULL;
|
||||
|
||||
/* externally accessible functions */
|
||||
int
|
||||
|
@ -22,6 +24,12 @@ e_ipc_codec_init(void)
|
|||
_e_ipc_2int_edd = E_CONFIG_DD_NEW("2int", E_Ipc_2Int);
|
||||
E_CONFIG_VAL(_e_ipc_2int_edd, E_Ipc_2Int, val1, INT);
|
||||
E_CONFIG_VAL(_e_ipc_2int_edd, E_Ipc_2Int, val2, INT);
|
||||
|
||||
_e_ipc_str_edd = E_CONFIG_DD_NEW("str", E_Ipc_Str);
|
||||
E_CONFIG_VAL(_e_ipc_str_edd, E_Ipc_Str, str, STR);
|
||||
|
||||
_e_ipc_str_list_edd = E_CONFIG_DD_NEW("str_list", E_Ipc_Str_List);
|
||||
E_CONFIG_LIST(_e_ipc_str_list_edd, E_Ipc_Str_List, list, _e_ipc_str_list_edd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -31,6 +39,8 @@ e_ipc_codec_shutdown(void)
|
|||
E_CONFIG_DD_FREE(_e_ipc_int_edd);
|
||||
E_CONFIG_DD_FREE(_e_ipc_double_edd);
|
||||
E_CONFIG_DD_FREE(_e_ipc_2int_edd);
|
||||
E_CONFIG_DD_FREE(_e_ipc_str_edd);
|
||||
E_CONFIG_DD_FREE(_e_ipc_str_list_edd);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -101,5 +111,78 @@ e_ipc_codec_2int_enc(int val1, int val2, int *size_ret)
|
|||
return eet_data_descriptor_encode(_e_ipc_2int_edd, &dat, size_ret);
|
||||
}
|
||||
|
||||
int
|
||||
e_ipc_codec_str_dec(char *data, int bytes, char **dest)
|
||||
{
|
||||
E_Ipc_Str *dat;
|
||||
|
||||
if (!data) return 0;
|
||||
dat = eet_data_descriptor_decode(_e_ipc_str_edd, data, bytes);
|
||||
if (!dat) return 0;
|
||||
if (dest) *dest = dat->str;
|
||||
free(dat);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void *
|
||||
e_ipc_codec_str_enc(char *str, int *size_ret)
|
||||
{
|
||||
E_Ipc_Str dat;
|
||||
|
||||
dat.str = str;
|
||||
return eet_data_descriptor_encode(_e_ipc_str_edd, &dat, size_ret);
|
||||
}
|
||||
|
||||
int
|
||||
e_ipc_codec_str_list_dec(char *data, int bytes, Evas_List **dest)
|
||||
{
|
||||
E_Ipc_Str_List *dat;
|
||||
Evas_List *list = NULL, *l;
|
||||
|
||||
if (!data) return 0;
|
||||
dat = eet_data_descriptor_decode(_e_ipc_str_list_edd, data, bytes);
|
||||
if (!dat) return 0;
|
||||
for (l = dat->list; l; l = l->next)
|
||||
{
|
||||
E_Ipc_Str *str_node;
|
||||
|
||||
str_node->str = l->data;
|
||||
list = evas_list_append(list, str_node->str);
|
||||
}
|
||||
if (dest) *dest = list;
|
||||
while (dat->list)
|
||||
{
|
||||
free(dat->list->data);
|
||||
dat->list = evas_list_remove_list(dat->list, dat->list);
|
||||
}
|
||||
free(dat);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void *
|
||||
e_ipc_codec_str_list_enc(Evas_List *list, int *size_ret)
|
||||
{
|
||||
E_Ipc_Str_List dat;
|
||||
Evas_List *l;
|
||||
void *data;
|
||||
|
||||
dat.list = NULL;
|
||||
for (l = list; l; l = l->next)
|
||||
{
|
||||
E_Ipc_Str *str_node;
|
||||
|
||||
str_node = malloc(sizeof(E_Ipc_Str));
|
||||
str_node->str = l->data;
|
||||
dat.list = evas_list_append(dat.list, str_node);
|
||||
}
|
||||
data = eet_data_descriptor_encode(_e_ipc_str_list_edd, &dat, size_ret);
|
||||
while (dat.list)
|
||||
{
|
||||
free(dat.list->data);
|
||||
dat.list = evas_list_remove_list(dat.list, dat.list);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/* local subsystem globals */
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
typedef struct _E_Ipc_Int E_Ipc_Int;
|
||||
typedef struct _E_Ipc_Double E_Ipc_Double;
|
||||
typedef struct _E_Ipc_2Int E_Ipc_2Int;
|
||||
typedef struct _E_Ipc_Str E_Ipc_Str;
|
||||
typedef struct _E_Ipc_Str_List E_Ipc_Str_List;
|
||||
|
||||
#else
|
||||
#ifndef E_IPC_CODEC_H
|
||||
|
@ -26,6 +28,15 @@ struct _E_Ipc_2Int
|
|||
int val1, val2;
|
||||
};
|
||||
|
||||
struct _E_Ipc_Str
|
||||
{
|
||||
char *str;
|
||||
};
|
||||
|
||||
struct _E_Ipc_Str_List
|
||||
{
|
||||
Evas_List *list;
|
||||
};
|
||||
|
||||
EAPI int e_ipc_codec_init(void);
|
||||
EAPI void e_ipc_codec_shutdown(void);
|
||||
|
@ -36,6 +47,10 @@ EAPI int e_ipc_codec_double_dec(char *data, int bytes, double *dest);
|
|||
EAPI void *e_ipc_codec_double_enc(double val, int *size_ret);
|
||||
EAPI int e_ipc_codec_2int_dec(char *data, int bytes, int *dest, int *dest2x);
|
||||
EAPI void *e_ipc_codec_2int_enc(int val1, int val2, int *size_ret);
|
||||
EAPI int e_ipc_codec_str_dec(char *data, int bytes, char **dest);
|
||||
EAPI void *e_ipc_codec_str_enc(char *str, int *size_ret);
|
||||
EAPI int e_ipc_codec_str_list_dec(char *data, int bytes, Evas_List **dest);
|
||||
EAPI void *e_ipc_codec_str_list_enc(Evas_List *list, int *size_ret);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue