aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/e_ipc_codec.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2005-05-31 03:01:53 +0000
committerCarsten Haitzler <raster@rasterman.com>2005-05-31 03:01:53 +0000
commitd59acfc65fca88dfcfc6ceb924ed0b612f455aba (patch)
tree74f64af7dd43599c69108c8b55baeaba2e343f8c /src/bin/e_ipc_codec.c
parentFix memleak. (diff)
downloadenlightenment-d59acfc65fca88dfcfc6ceb924ed0b612f455aba.tar.gz
this is VERY evil - VERY evil. but its the sanest solution other than code
generation tools (scripts etc.) for generating wads of repetitive code easily, and keeping the codec higher level logic per ipc call in 1 place. SVN revision: 15026
Diffstat (limited to 'src/bin/e_ipc_codec.c')
-rw-r--r--src/bin/e_ipc_codec.c119
1 files changed, 115 insertions, 4 deletions
diff --git a/src/bin/e_ipc_codec.c b/src/bin/e_ipc_codec.c
index d6999286f..7ac557eb1 100644
--- a/src/bin/e_ipc_codec.c
+++ b/src/bin/e_ipc_codec.c
@@ -10,6 +10,10 @@ 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;
+static Eet_Data_Descriptor *_e_ipc_str_int_edd = NULL;
+static Eet_Data_Descriptor *_e_ipc_str_int_list_edd = NULL;
+static Eet_Data_Descriptor *_e_ipc_2str_int_edd = NULL;
+static Eet_Data_Descriptor *_e_ipc_2str_int_list_edd = NULL;
/* externally accessible functions */
int
@@ -28,8 +32,23 @@ e_ipc_codec_init(void)
_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);
+ _e_ipc_str_list_edd = E_CONFIG_DD_NEW("str_list", E_Ipc_List);
+ E_CONFIG_LIST(_e_ipc_str_list_edd, E_Ipc_List, list, _e_ipc_str_edd);
+
+ _e_ipc_str_int_edd = E_CONFIG_DD_NEW("str_int", E_Ipc_Str_Int);
+ E_CONFIG_VAL(_e_ipc_str_int_edd, E_Ipc_Str_Int, str, STR);
+ E_CONFIG_VAL(_e_ipc_str_int_edd, E_Ipc_Str_Int, val, INT);
+
+ _e_ipc_str_int_list_edd = E_CONFIG_DD_NEW("str_int_list", E_Ipc_List);
+ E_CONFIG_LIST(_e_ipc_str_int_list_edd, E_Ipc_List, list, _e_ipc_str_int_edd);
+
+ _e_ipc_2str_int_edd = E_CONFIG_DD_NEW("2str_int", E_Ipc_2Str_Int);
+ E_CONFIG_VAL(_e_ipc_2str_int_edd, E_Ipc_2Str_Int, str1, STR);
+ E_CONFIG_VAL(_e_ipc_2str_int_edd, E_Ipc_2Str_Int, str2, STR);
+ E_CONFIG_VAL(_e_ipc_2str_int_edd, E_Ipc_2Str_Int, val, INT);
+
+ _e_ipc_2str_int_list_edd = E_CONFIG_DD_NEW("2str_int_list", E_Ipc_List);
+ E_CONFIG_LIST(_e_ipc_2str_int_list_edd, E_Ipc_List, list, _e_ipc_2str_int_edd);
return 1;
}
@@ -41,6 +60,10 @@ e_ipc_codec_shutdown(void)
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);
+ E_CONFIG_DD_FREE(_e_ipc_str_int_edd);
+ E_CONFIG_DD_FREE(_e_ipc_str_int_list_edd);
+ E_CONFIG_DD_FREE(_e_ipc_2str_int_edd);
+ E_CONFIG_DD_FREE(_e_ipc_2str_int_list_edd);
}
int
@@ -136,7 +159,7 @@ e_ipc_codec_str_enc(char *str, int *size_ret)
int
e_ipc_codec_str_list_dec(char *data, int bytes, Evas_List **dest)
{
- E_Ipc_Str_List *dat;
+ E_Ipc_List *dat;
Evas_List *list = NULL, *l;
if (!data) return 0;
@@ -162,7 +185,7 @@ e_ipc_codec_str_list_dec(char *data, int bytes, Evas_List **dest)
void *
e_ipc_codec_str_list_enc(Evas_List *list, int *size_ret)
{
- E_Ipc_Str_List dat;
+ E_Ipc_List dat;
Evas_List *l;
void *data;
@@ -184,5 +207,93 @@ e_ipc_codec_str_list_enc(Evas_List *list, int *size_ret)
return data;
}
+int
+e_ipc_codec_str_int_dec(char *data, int bytes, E_Ipc_Str_Int **dest)
+{
+ E_Ipc_Str_Int *dat;
+
+ if (!data) return 0;
+ dat = eet_data_descriptor_decode(_e_ipc_str_int_edd, data, bytes);
+ if (!dat) return 0;
+ if (dest) *dest = dat;
+ return 1;
+}
+
+void *
+e_ipc_codec_str_int_enc(char *str, int val, int *size_ret)
+{
+ E_Ipc_Str_Int dat;
+
+ dat.str = str;
+ dat.val = val;
+ return eet_data_descriptor_encode(_e_ipc_str_int_edd, &dat, size_ret);
+}
+
+int
+e_ipc_codec_str_int_list_dec(char *data, int bytes, Evas_List **dest)
+{
+ E_Ipc_List *dat;
+
+ if (!data) return 0;
+ dat = eet_data_descriptor_decode(_e_ipc_str_int_list_edd, data, bytes);
+ if (!dat) return 0;
+ if (dest) *dest = dat->list;
+ free(dat);
+ return 1;
+}
+
+void *
+e_ipc_codec_str_int_list_enc(Evas_List *list, int *size_ret)
+{
+ E_Ipc_List dat;
+ dat.list = list;
+ return eet_data_descriptor_encode(_e_ipc_str_int_list_edd, &dat, size_ret);
+}
+
+int
+e_ipc_codec_2str_int_dec(char *data, int bytes, E_Ipc_2Str_Int **dest)
+{
+ E_Ipc_2Str_Int *dat;
+
+ if (!data) return 0;
+ dat = eet_data_descriptor_decode(_e_ipc_2str_int_edd, data, bytes);
+ if (!dat) return 0;
+ if (dest) *dest = dat;
+ return 1;
+}
+
+void *
+e_ipc_codec_2str_int_enc(char *str1, char *str2, int val, int *size_ret)
+{
+ E_Ipc_2Str_Int dat;
+
+ dat.str1 = str1;
+ dat.str2 = str2;
+ dat.val = val;
+ return eet_data_descriptor_encode(_e_ipc_2str_int_edd, &dat, size_ret);
+}
+
+int
+e_ipc_codec_2str_int_list_dec(char *data, int bytes, Evas_List **dest)
+{
+ E_Ipc_List *dat;
+
+ if (!data) return 0;
+ dat = eet_data_descriptor_decode(_e_ipc_2str_int_list_edd, data, bytes);
+ if (!dat) return 0;
+ if (dest) *dest = dat->list;
+ free(dat);
+ return 1;
+}
+
+void *
+e_ipc_codec_2str_int_list_enc(Evas_List *list, int *size_ret)
+{
+ E_Ipc_List dat;
+ dat.list = list;
+ return eet_data_descriptor_encode(_e_ipc_2str_int_list_edd, &dat, size_ret);
+}
+
+
/* local subsystem globals */