Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_ipc_codec.c e_ipc_codec.h 


Log Message:


some codec stuff, fi.po update

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_ipc_codec.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_ipc_codec.c       13 May 2005 15:15:52 -0000      1.2
+++ e_ipc_codec.c       22 May 2005 02:59:15 -0000      1.3
@@ -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_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_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 @@
    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 */
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_ipc_codec.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_ipc_codec.h       13 May 2005 15:15:52 -0000      1.2
+++ e_ipc_codec.h       22 May 2005 02:59:15 -0000      1.3
@@ -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 @@
    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 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




-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to