aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/e_ipc_codec.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2005-05-22 02:59:15 +0000
committerCarsten Haitzler <raster@rasterman.com>2005-05-22 02:59:15 +0000
commit6fbb8a46649e96e08f6be3d1f5fde043ccf77027 (patch)
treea661c9b77142ce64ae34850d0333a64602485b70 /src/bin/e_ipc_codec.c
parentNote to self. (diff)
downloadenlightenment-6fbb8a46649e96e08f6be3d1f5fde043ccf77027.tar.gz
some codec stuff, fi.po update
SVN revision: 14890
Diffstat (limited to 'src/bin/e_ipc_codec.c')
-rw-r--r--src/bin/e_ipc_codec.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/bin/e_ipc_codec.c b/src/bin/e_ipc_codec.c
index e48f8b8b3..d6999286f 100644
--- a/src/bin/e_ipc_codec.c
+++ b/src/bin/e_ipc_codec.c
@@ -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 */