From: <enl...@li...> - 2003-12-31 00:09:57
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/bin Modified Files: Makefile.am Added Files: examine.c Log Message: very first bit of code for examine - does not do anything but list properties... =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/bin/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- Makefile.am 16 Dec 2003 02:46:31 -0000 1.6 +++ Makefile.am 31 Dec 2003 00:09:55 -0000 1.7 @@ -59,12 +59,15 @@ -I$(top_srcdir)/src/lib/ecore_txt @iconv_cflags@ \ -I$(top_srcdir)/src/lib/ecore_config \ @evas_cflags@ \ -@x_cflags@ +@x_cflags@ \ +@ewl_cflags@ \ +@edb_cflags@ if BUILD_ECORE_CONFIG bin_PROGRAMS = \ ecore_test \ exsh \ +examine \ ecore_evas_test else bin_PROGRAMS = \ @@ -158,4 +161,21 @@ exsh_DEPENDENCIES = \ $(top_builddir)/src/lib/ecore/libecore.la \ $(ECORE_CONFIG_LIB) + +examine_SOURCES = \ +examine.c \ +ecore_config_client.c \ +ecore_config_client.h + +examine_LDADD = \ +@ewl_libs@ -ldl + +examine_LDFLAGS = + +examine_CFLAGS = \ +$(CFLAGS) \ +$(INCLUDES) \ +@ewl_cflags@ + +examine_DEPENDENCIES = |
From: <enl...@li...> - 2003-12-31 00:10:26
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore Modified Files: configure.in Log Message: very first bit of code for examine - does not do anything but list properties... =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/configure.in,v retrieving revision 1.28 retrieving revision 1.29 diff -u -3 -r1.28 -r1.29 --- configure.in 30 Dec 2003 21:51:50 -0000 1.28 +++ configure.in 31 Dec 2003 00:09:55 -0000 1.29 @@ -471,6 +471,11 @@ ecore_config_cflags=""; ecore_config_libs=""; +ewl_cflags=`ewl-config --cflags` +ewl_libs=`ewl-config --libs` +AC_SUBST(ewl_cflags) +AC_SUBST(ewl_libs) + AC_ARG_ENABLE(ecore-config, [ --enable-ecore-config enable the ecore_config module], [ if [ test "$enableval" = "yes" ]; then |
From: <enl...@li...> - 2003-12-31 16:25:27
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/bin Modified Files: examine.c Log Message: minor work on examine =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/bin/examine.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- examine.c 31 Dec 2003 00:09:55 -0000 1.1 +++ examine.c 31 Dec 2003 16:25:23 -0000 1.2 @@ -96,7 +96,7 @@ int ex_ipc_server_sent(void *data,int type,void *event) { - Ewl_Widget *text, *type_text; + Ewl_Widget *row, *cell[2], *text[2]; char *label, *type, *start, *end; Ecore_Ipc_Event_Server_Data *e; @@ -106,6 +106,25 @@ if(e->data&&(e->size>0)) { printf("%s\n",(char *)e->data); + row = ewl_grid_new(2, 1); + cell[0] = ewl_cell_new(); + cell[1] = ewl_cell_new(); + text[0] = ewl_text_new("Property"); + text[1] = ewl_text_new("type"); + + ewl_container_append_child(EWL_CONTAINER(cell[0]), text[0]); + ewl_container_append_child(EWL_CONTAINER(cell[1]), text[1]); + ewl_grid_add(EWL_GRID(row), cell[0], 1, 1, 1, 1); + ewl_grid_add(EWL_GRID(row), cell[1], 2, 2, 1, 1); + + ewl_widget_show(cell[0]); + ewl_widget_show(cell[1]); + ewl_widget_show(text[0]); + ewl_widget_show(text[1]); + + ewl_container_append_child(EWL_CONTAINER(main_box), row); + ewl_widget_show(row); + start = (char *)e->data; end = ((char *)e->data) + strlen((char *)e->data); @@ -129,15 +148,32 @@ } if (*label && *type) { - printf("button %s, %s\n", label, type); - - text = ewl_text_new(label); - type_text = ewl_text_new(type); - ewl_widget_show(text); - ewl_widget_show(type_text); + row = ewl_grid_new(2, 1); + cell[0] = ewl_cell_new(); + cell[1] = ewl_cell_new(); + text[0] = ewl_text_new(label); + + if (!strcmp(type, "string")) + text[1] = ewl_entry_new("<a string>"); + else if (!strcmp(type, "integer")) + text[1] = ewl_spinner_new(); + else + text[1] = ewl_text_new(type); + ewl_object_set_minimum_h(EWL_OBJECT(text[1]), 12); + + ewl_container_append_child(EWL_CONTAINER(cell[0]), text[0]); + ewl_container_append_child(EWL_CONTAINER(cell[1]), text[1]); + ewl_grid_add(EWL_GRID(row), cell[0], 1, 1, 1, 1); + ewl_grid_add(EWL_GRID(row), cell[1], 2, 2, 1, 1); + + ewl_widget_show(cell[0]); + ewl_widget_show(cell[1]); + ewl_widget_show(text[0]); + ewl_widget_show(text[1]); - ewl_container_append_child(EWL_CONTAINER(main_box), text); - ewl_container_append_child(EWL_CONTAINER(main_box), type_text); + ewl_container_append_child(EWL_CONTAINER(main_box), row); + ewl_widget_show(row); + ewl_object_set_minimum_h(EWL_OBJECT(row), 20); } start++; @@ -347,7 +383,7 @@ main_win = ewl_window_new(); ewl_window_set_title(EWL_WINDOW(main_win), "Examine Configuration Client"); - ewl_object_set_minimum_size(EWL_OBJECT(main_win), 100, 200); + ewl_object_set_minimum_size(EWL_OBJECT(main_win), 200, 100); ewl_callback_append(main_win, EWL_CALLBACK_DELETE_WINDOW, __destroy_main_window, NULL); main_box = ewl_vbox_new(); |
From: <enl...@li...> - 2004-01-05 22:30:01
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore Modified Files: configure.in Log Message: OK, spanking noted, examine and its referenced to ewl moved out and into apps/examine =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/configure.in,v retrieving revision 1.37 retrieving revision 1.38 diff -u -3 -r1.37 -r1.38 --- configure.in 4 Jan 2004 20:23:36 -0000 1.37 +++ configure.in 5 Jan 2004 22:29:30 -0000 1.38 @@ -498,11 +498,6 @@ ecore_config_cflags=""; ecore_config_libs=""; -ewl_cflags=`ewl-config --cflags` -ewl_libs=`ewl-config --libs` -AC_SUBST(ewl_cflags) -AC_SUBST(ewl_libs) - AC_ARG_ENABLE(ecore-config, [ --disable-ecore-config disable the ecore_config module], [ if [ test "$enableval" = "yes" ]; then |
From: <enl...@li...> - 2004-01-05 23:13:47
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/bin Modified Files: Makefile.am Removed Files: ecore_config_client.c ecore_config_client.h examine.c exsh.c Log Message: OK, spanking noted, examine and its referenced to ewl moved out and into apps/examine =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/bin/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- Makefile.am 3 Jan 2004 03:36:18 -0000 1.8 +++ Makefile.am 5 Jan 2004 22:29:30 -0000 1.9 @@ -60,25 +60,12 @@ -I$(top_srcdir)/src/lib/ecore_config \ @evas_cflags@ \ @x_cflags@ \ -@ewl_cflags@ \ @edb_cflags@ -if BUILD_ECORE_CONFIG bin_PROGRAMS = \ ecore_test \ -exsh \ ecore_evas_test -# You FOOOOOOOOLS! examine requires ewl. ewl requires ecore. see the circular -# dependancy? NO NO NO! -#examine \ - -else -bin_PROGRAMS = \ -ecore_test \ -ecore_evas_test -endif - ecore_test_SOURCES = \ ecore_test.c @@ -142,44 +129,4 @@ $(ECORE_CON_LIB) \ $(ECORE_IPC_LIB) \ $(ECORE_TXT_LIB) - -exsh_SOURCES = \ -exsh.c \ -ecore_config_client.c \ -ecore_config_client.h - -exsh_LDADD = \ -$(top_builddir)/src/lib/ecore/libecore.la \ -$(ECORE_IPC_LIB) \ -$(ECORE_CONFIG_LIB) \ -@edb_libs@ -ldl - -exsh_LDFLAGS = - -exsh_CFLAGS = \ -$(CFLAGS) \ -$(INCLUDES) \ --I$(top_builddir)/src/lib/ecore_config/ \ -@edb_cflags@ - -exsh_DEPENDENCIES = \ -$(top_builddir)/src/lib/ecore/libecore.la \ -$(ECORE_CONFIG_LIB) - -examine_SOURCES = \ -examine.c \ -ecore_config_client.c \ -ecore_config_client.h - -examine_LDADD = \ -@ewl_libs@ -ldl - -examine_LDFLAGS = - -examine_CFLAGS = \ -$(CFLAGS) \ -$(INCLUDES) \ -@ewl_cflags@ - -examine_DEPENDENCIES = |
From: <enl...@li...> - 2004-01-12 16:08:09
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: Ecore_Config.h ecore_config.c edb.c Log Message: Added types to default calls - this concludes my planned api additions for now Made edb only save modified (non-default) properties =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/Ecore_Config.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- Ecore_Config.h 31 Dec 2003 22:15:33 -0000 1.4 +++ Ecore_Config.h 12 Jan 2004 16:08:08 -0000 1.5 @@ -128,6 +128,11 @@ int ecore_config_set_as_string(Ecore_Config_Bundle *t,const char *key,char *val); int ecore_config_default(Ecore_Config_Bundle *t,const char *key,char *val,float lo,float hi,float step); +int ecore_config_default_int(Ecore_Config_Bundle *t,const char *key,int val,int lo,int hi,int step); +int ecore_config_default_string(Ecore_Config_Bundle *t,const char *key,char *val); +int ecore_config_default_float(Ecore_Config_Bundle *t,const char *key,float val,float lo,float hi,float step); +int ecore_config_default_rgb(Ecore_Config_Bundle *t,const char *key,char *val); + int ecore_config_listen(Ecore_Config_Bundle *t,const char *name,const char *key,Ecore_Config_Listener listener,int tag,void *data); int ecore_config_deaf(Ecore_Config_Bundle *t,const char *name,const char *key,Ecore_Config_Listener listener); Ecore_Config_Prop *ecore_config_dst(Ecore_Config_Bundle *t,Ecore_Config_Prop *e); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ecore_config.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- ecore_config.c 6 Dec 2003 17:24:19 -0000 1.2 +++ ecore_config.c 12 Jan 2004 16:08:08 -0000 1.3 @@ -12,7 +12,7 @@ Ecore_Config_Server *ipc_init(char *name); int ipc_quit(void); -static char *ecore_config_type[]={ "undefined", "integer", "float", "string", "pointer", "colour" }; +static char *ecore_config_type[]={ "undefined", "integer", "float", "string", "colour" }; /* tolower, weed out _ - */ char *prop_canonize_key(char *pn,int modify) { @@ -339,12 +339,12 @@ return ecore_config_set_typed(t,key,(void *)val,PT_RGB); } -int ecore_config_default(Ecore_Config_Bundle *t,const char *key,char *val,float lo,float hi,float step) { +static int ecore_config_default_typed(Ecore_Config_Bundle *t,const char *key,void *val,float lo,float hi,float step, int type) { int ret=ECORE_CONFIG_ERR_SUCC; Ecore_Config_Prop *e; if(!(e=ecore_config_get(t,key))) { /* prop doesn't exist yet */ - if((ret=ecore_config_add(t,key,val))!=ECORE_CONFIG_ERR_SUCC) /* try to add it */ + if((ret=ecore_config_add_typed(t,key,val,type))!=ECORE_CONFIG_ERR_SUCC) /* try to add it */ return ret; /* ...failed */ if(!(e=ecore_config_get(t,key))) /* get handle */ return ECORE_CONFIG_ERR_FAIL; @@ -365,7 +365,26 @@ return ret; } +int ecore_config_default(Ecore_Config_Bundle *t,const char *key,char *val,float lo,float hi,float step) { + int type=ecore_config_guess_type(val); + return ecore_config_default_typed(t, key, val, lo, hi, step, type); +} + +int ecore_config_default_int(Ecore_Config_Bundle *t,const char *key,int val,int low,int high,int step) { + return ecore_config_default_typed(t, key, (void *) &val, (float) low, (float) high, (float) step, PT_INT); +} +int ecore_config_default_string(Ecore_Config_Bundle *t,const char *key,char *val) { + return ecore_config_default_typed(t, key, (void *) val, (float) 0, (float) 0, (float) 0, PT_STR); +} + +int ecore_config_default_float(Ecore_Config_Bundle *t,const char *key,float val,float low,float high,float step) { + return ecore_config_default_typed(t, key, (void *) &val, low, high, step, PT_FLT); +} + +int ecore_config_default_rgb(Ecore_Config_Bundle *t,const char *key,char *val) { + return ecore_config_default_typed(t, key, (void *) val, (float) 0, (float) 0, (float) 0, PT_RGB); +} int ecore_config_listen(Ecore_Config_Bundle *t,const char *name,const char *key, Ecore_Config_Listener listener,int tag,void *data) { =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/edb.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- edb.c 31 Dec 2003 22:15:33 -0000 1.4 +++ edb.c 12 Jan 2004 16:08:08 -0000 1.5 @@ -87,6 +87,10 @@ } while (next) { + if (!(next->flags&PF_MODIFIED)) { + next=next->next; + continue; + } switch (next->type) { case PT_INT: e_db_int_set(db, next->key, ecore_config_get_int(b, next->key)); |
From: <enl...@li...> - 2004-01-13 21:15:24
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: ipc_main.c Ecore_Config.h ecore_config.c Log Message: more work, seperate bounded numbers in api fix float bugs =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ipc_main.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- ipc_main.c 31 Dec 2003 22:15:33 -0000 1.4 +++ ipc_main.c 13 Jan 2004 21:15:23 -0000 1.5 @@ -70,7 +70,10 @@ while(e) { estring_appendf(s,"%s%s: %s",f?"\n":"",e->key,ecore_config_get_type(e)); if(e->flags&PF_BOUNDS) - estring_appendf(s,", range %d..%d",e->lo,e->hi); + if (e->type==PT_FLT) + estring_appendf(s,", range %le..%le",(float)e->lo/ECORE_CONFIG_FLOAT_PRECISION,(float)e->hi/ECORE_CONFIG_FLOAT_PRECISION); + else + estring_appendf(s,", range %d..%d",e->lo,e->hi); f=1; e=e->next; } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/Ecore_Config.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- Ecore_Config.h 12 Jan 2004 16:08:08 -0000 1.5 +++ Ecore_Config.h 13 Jan 2004 21:15:23 -0000 1.6 @@ -128,9 +128,11 @@ int ecore_config_set_as_string(Ecore_Config_Bundle *t,const char *key,char *val); int ecore_config_default(Ecore_Config_Bundle *t,const char *key,char *val,float lo,float hi,float step); -int ecore_config_default_int(Ecore_Config_Bundle *t,const char *key,int val,int lo,int hi,int step); +int ecore_config_default_int(Ecore_Config_Bundle *t,const char *key,int val); +int ecore_config_default_int_bound(Ecore_Config_Bundle *t,const char *key,int val,int lo,int hi,int step); int ecore_config_default_string(Ecore_Config_Bundle *t,const char *key,char *val); -int ecore_config_default_float(Ecore_Config_Bundle *t,const char *key,float val,float lo,float hi,float step); +int ecore_config_default_float(Ecore_Config_Bundle *t,const char *key,float val); +int ecore_config_default_float_bound(Ecore_Config_Bundle *t,const char *key,float val,float lo,float hi,float step); int ecore_config_default_rgb(Ecore_Config_Bundle *t,const char *key,char *val); int ecore_config_listen(Ecore_Config_Bundle *t,const char *name,const char *key,Ecore_Config_Listener listener,int tag,void *data); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ecore_config.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ecore_config.c 12 Jan 2004 16:08:08 -0000 1.3 +++ ecore_config.c 13 Jan 2004 21:15:23 -0000 1.4 @@ -110,7 +110,7 @@ float ecore_config_get_float(const Ecore_Config_Bundle *t,const char *key) { Ecore_Config_Prop *e=ecore_config_get(t,key); - return (e&&(e->type==PT_FLT))?(e->val/ECORE_CONFIG_FLOAT_PRECISION):0.0; } + return (e&&(e->type==PT_FLT))?((float)e->val/ECORE_CONFIG_FLOAT_PRECISION):0.0; } int ecore_config_get_rgb(const Ecore_Config_Bundle *t,const char *key,int *r, int *g, int *b) { @@ -204,6 +204,7 @@ static int ecore_config_val_typed(Ecore_Config_Prop *e,void *val,int type) { char *l=NULL; long v=0; + float *f; e->type=PT_NIL; @@ -235,17 +236,9 @@ e->type=PT_RGB; } } else if (type==PT_FLT) { - v=strtol(val,&l,10); - if(*l) { - float f; - if(sscanf(val,"%f%*s",&f)!=1) { - if(!(e->ptr=strdup(val))) - return ECORE_CONFIG_ERR_OOM; - e->type=PT_STR; } - else { - e->val=(long)(f*ECORE_CONFIG_FLOAT_PRECISION); - e->type=PT_FLT; } - } + f = (float *)val; + e->val=(long)((*f)*ECORE_CONFIG_FLOAT_PRECISION); + e->type=PT_FLT; } ecore_config_bound(e); @@ -339,7 +332,7 @@ return ecore_config_set_typed(t,key,(void *)val,PT_RGB); } -static int ecore_config_default_typed(Ecore_Config_Bundle *t,const char *key,void *val,float lo,float hi,float step, int type) { +static int ecore_config_default_typed(Ecore_Config_Bundle *t,const char *key,void *val,int type) { int ret=ECORE_CONFIG_ERR_SUCC; Ecore_Config_Prop *e; @@ -350,40 +343,77 @@ return ECORE_CONFIG_ERR_FAIL; e->flags=e->flags&~PF_MODIFIED; } - if(e->type==PT_INT) { - e->step=(int)step; - e->flags|=PF_BOUNDS; - e->lo=(int)lo; - e->hi=(int)hi; } - else if(e->type==PT_FLT) { - e->step=(int)(step*ECORE_CONFIG_FLOAT_PRECISION); - e->flags|=PF_BOUNDS; - e->lo=(int)(lo*ECORE_CONFIG_FLOAT_PRECISION); - e->hi=(int)(hi*ECORE_CONFIG_FLOAT_PRECISION); } - - ecore_config_bound(e); - return ret; } int ecore_config_default(Ecore_Config_Bundle *t,const char *key,char *val,float lo,float hi,float step) { - int type=ecore_config_guess_type(val); - return ecore_config_default_typed(t, key, val, lo, hi, step, type); + int ret, type; + Ecore_Config_Prop *e; + + type=ecore_config_guess_type(val); + ret=ecore_config_default_typed(t, key, val, type); + if (e=ecore_config_get(t,key)) { + if (type==PT_INT) { + e->step=step; + e->flags|=PF_BOUNDS; + e->lo=lo; + e->hi=hi; + ecore_config_bound(e); + } else if (type==PT_FLT) { + e->step=(int)(step*ECORE_CONFIG_FLOAT_PRECISION); + e->flags|=PF_BOUNDS; + e->lo=(int)(lo*ECORE_CONFIG_FLOAT_PRECISION); + e->hi=(int)(hi*ECORE_CONFIG_FLOAT_PRECISION); + ecore_config_bound(e); + } + } } -int ecore_config_default_int(Ecore_Config_Bundle *t,const char *key,int val,int low,int high,int step) { - return ecore_config_default_typed(t, key, (void *) &val, (float) low, (float) high, (float) step, PT_INT); +int ecore_config_default_int(Ecore_Config_Bundle *t,const char *key,int val) { + return ecore_config_default_typed(t, key, (void *) val, PT_INT); +} + +int ecore_config_default_int_bound(Ecore_Config_Bundle *t,const char *key,int val,int low,int high,int step) { + Ecore_Config_Prop *e; + int ret; + + ret=ecore_config_default_typed(t, key, (void *) val, PT_INT); + if (e=ecore_config_get(t,key)) { + e->step=step; + e->flags|=PF_BOUNDS; + e->lo=low; + e->hi=high; + ecore_config_bound(e); + } + + return ret; } int ecore_config_default_string(Ecore_Config_Bundle *t,const char *key,char *val) { - return ecore_config_default_typed(t, key, (void *) val, (float) 0, (float) 0, (float) 0, PT_STR); + return ecore_config_default_typed(t, key, (void *) val, PT_STR); } -int ecore_config_default_float(Ecore_Config_Bundle *t,const char *key,float val,float low,float high,float step) { - return ecore_config_default_typed(t, key, (void *) &val, low, high, step, PT_FLT); +int ecore_config_default_float(Ecore_Config_Bundle *t,const char *key,float val){ + return ecore_config_default_typed(t, key, (void *) &val, PT_FLT); +} + +int ecore_config_default_float_bound(Ecore_Config_Bundle *t,const char *key,float val,float low,float high,float step) { + Ecore_Config_Prop *e; + int ret; + + ret=ecore_config_default_typed(t, key, (void *) &val, PT_FLT); + if (e=ecore_config_get(t,key)) { + e->step=(int)(step*ECORE_CONFIG_FLOAT_PRECISION); + e->flags|=PF_BOUNDS; + e->lo=(int)(low*ECORE_CONFIG_FLOAT_PRECISION); + e->hi=(int)(high*ECORE_CONFIG_FLOAT_PRECISION); + ecore_config_bound(e); + } + + return ret; } int ecore_config_default_rgb(Ecore_Config_Bundle *t,const char *key,char *val) { - return ecore_config_default_typed(t, key, (void *) val, (float) 0, (float) 0, (float) 0, PT_RGB); + return ecore_config_default_typed(t, key, (void *) val, PT_RGB); } int ecore_config_listen(Ecore_Config_Bundle *t,const char *name,const char *key, |
From: <enl...@li...> - 2004-01-20 00:45:53
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: Ecore_Config.h ecore_config.c ipc_main.c Log Message: More playing with ecore_config Azundris suggested this new layout and I agree docs should be available soon =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/Ecore_Config.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- Ecore_Config.h 13 Jan 2004 21:15:23 -0000 1.6 +++ Ecore_Config.h 20 Jan 2004 00:45:52 -0000 1.7 @@ -44,6 +44,7 @@ # define E(lvl,args...) do { } while(0) #endif +#define ECORE_CONFIG_GLOBAL_ID "_system" /* structures */ @@ -109,6 +110,8 @@ Ecore_Config_Bundle *bundles; /* data anchor */ struct Ecore_Config_Server *next; } Ecore_Config_Server; +Ecore_Config_Server *config_system; + Ecore_Config_Prop *ecore_config_get(const Ecore_Config_Bundle *t,const char *key); const char *ecore_config_get_type(const Ecore_Config_Prop *e); @@ -149,8 +152,7 @@ char *ecore_config_bundle_get_label(Ecore_Config_Bundle *ns); -Ecore_Config_Server *ecore_config_init(char *name); -Ecore_Config_Server *ecore_config_init_global(char *name); +Ecore_Config_Bundle *ecore_config_init(char *name); int ecore_config_exit(void); int ecore_config_load(Ecore_Config_Bundle *b); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ecore_config.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- ecore_config.c 18 Jan 2004 09:29:39 -0000 1.5 +++ ecore_config.c 20 Jan 2004 00:45:52 -0000 1.6 @@ -551,7 +551,7 @@ return ipc_init(name); } -Ecore_Config_Server *ecore_config_init(char *name) { +Ecore_Config_Server *ecore_config_init_local(char *name) { char *p; char *buf; @@ -585,6 +585,28 @@ return do_init(name); } +Ecore_Config_Bundle *ecore_config_init(char *name) { + Ecore_Config_Server *srv; + Ecore_Config_Bundle *bdl; + char *buf, *p; + + srv = ecore_config_init_local(name); + ecore_config_init_global(ECORE_CONFIG_GLOBAL_ID); + + bdl = ecore_config_bundle_new(srv, "config"); + + if((p=getenv("HOME"))) { /* debug-only ### FIXME */ + if ((buf=malloc(PATH_MAX*sizeof(char)))) { + snprintf(buf,PATH_MAX,"%s/.e/config.db",p); + ecore_config_load_file(bdl, buf); + } + free(buf); + } + + config_system=srv; + return bdl; +} + int ecore_config_exit(void) { return ipc_exit(); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ipc_main.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ipc_main.c 18 Jan 2004 09:29:39 -0000 1.6 +++ ipc_main.c 20 Jan 2004 00:45:52 -0000 1.7 @@ -21,7 +21,6 @@ # define TRUE (!FALSE) #endif - typedef struct _ipc { void *lib; void *data; @@ -40,7 +39,7 @@ Ecore_Config_Server *srv2ecore_config_srv(void *srv) { ipc *ipc_tmp; Ecore_Config_Server *srv_tmp; - +/* ipc_tmp = ipc_modules; while (ipc_tmp) { srv_tmp = ipc_tmp->data; @@ -51,8 +50,8 @@ } ipc_tmp = ipc_tmp->next; } - - return NULL; +*/ + return config_system; } /*****************************************************************************/ |
From: <enl...@li...> - 2004-01-20 16:19:47
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: Ecore_Config.h ecore_config.c edb.c ipc_main.c Log Message: Well, this is the api to the new simpler and cleaner ecore_config much code remains, it will be tidied out later if this is seen to be good =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/Ecore_Config.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- Ecore_Config.h 20 Jan 2004 00:45:52 -0000 1.7 +++ Ecore_Config.h 20 Jan 2004 16:19:45 -0000 1.8 @@ -110,37 +110,40 @@ Ecore_Config_Bundle *bundles; /* data anchor */ struct Ecore_Config_Server *next; } Ecore_Config_Server; -Ecore_Config_Server *config_system; +/* global ptrs to save passing them through the API */ +Ecore_Config_Server *__server_global; +Ecore_Config_Server *__server_local; +Ecore_Config_Bundle *__bundle_local; +char *__app_name; - -Ecore_Config_Prop *ecore_config_get(const Ecore_Config_Bundle *t,const char *key); +Ecore_Config_Prop *ecore_config_get(Ecore_Config_Bundle *t,const char *key); const char *ecore_config_get_type(const Ecore_Config_Prop *e); -void *ecore_config_get_data(const Ecore_Config_Bundle *t,const char *key); -char *ecore_config_get_string(const Ecore_Config_Bundle *t,const char *key); -long ecore_config_get_int(const Ecore_Config_Bundle *t,const char *key); -int ecore_config_get_rgb(const Ecore_Config_Bundle *t,const char *key,int *r, int *g, int *b); -float ecore_config_get_float(const Ecore_Config_Bundle *t,const char *key); -char *ecore_config_get_as_string(const Ecore_Config_Bundle *t,const char *key); +void *ecore_config_get_data(const char *key); +char *ecore_config_get_string(const char *key); +long ecore_config_get_int(const char *key); +int ecore_config_get_rgb(const char *key,int *r, int *g, int *b); +float ecore_config_get_float(const char *key); +char *ecore_config_get_as_string(const char *key); char *ecore_config_canonize_key(char *,int modify); int ecore_config_set(Ecore_Config_Bundle *t,const char *key,char *val); -int ecore_config_set_string(Ecore_Config_Bundle *t,const char *key,char *val); -int ecore_config_set_int(Ecore_Config_Bundle *t,const char *key,int val); -int ecore_config_set_rgb(Ecore_Config_Bundle *t,const char *key,char *val); -char *ecore_config_get_rgbstr(const Ecore_Config_Bundle *t,const char *key); -int ecore_config_set_float(Ecore_Config_Bundle *t,const char *key,float val); -int ecore_config_set_as_string(Ecore_Config_Bundle *t,const char *key,char *val); - -int ecore_config_default(Ecore_Config_Bundle *t,const char *key,char *val,float lo,float hi,float step); -int ecore_config_default_int(Ecore_Config_Bundle *t,const char *key,int val); -int ecore_config_default_int_bound(Ecore_Config_Bundle *t,const char *key,int val,int lo,int hi,int step); -int ecore_config_default_string(Ecore_Config_Bundle *t,const char *key,char *val); -int ecore_config_default_float(Ecore_Config_Bundle *t,const char *key,float val); -int ecore_config_default_float_bound(Ecore_Config_Bundle *t,const char *key,float val,float lo,float hi,float step); -int ecore_config_default_rgb(Ecore_Config_Bundle *t,const char *key,char *val); - -int ecore_config_listen(Ecore_Config_Bundle *t,const char *name,const char *key,Ecore_Config_Listener listener,int tag,void *data); -int ecore_config_deaf(Ecore_Config_Bundle *t,const char *name,const char *key,Ecore_Config_Listener listener); -Ecore_Config_Prop *ecore_config_dst(Ecore_Config_Bundle *t,Ecore_Config_Prop *e); +int ecore_config_set_string(const char *key,char *val); +int ecore_config_set_int(const char *key,int val); +int ecore_config_set_rgb(const char *key,char *val); +char *ecore_config_get_rgbstr(const char *key); +int ecore_config_set_float(const char *key,float val); +int ecore_config_set_as_string(const char *key,char *val); + +int ecore_config_default(const char *key,char *val,float lo,float hi,float step); +int ecore_config_default_int(const char *key,int val); +int ecore_config_default_int_bound(const char *key,int val,int lo,int hi,int step); +int ecore_config_default_string(const char *key,char *val); +int ecore_config_default_float(const char *key,float val); +int ecore_config_default_float_bound(const char *key,float val,float lo,float hi,float step); +int ecore_config_default_rgb(const char *key,char *val); + +int ecore_config_listen(const char *name,const char *key,Ecore_Config_Listener listener,int tag,void *data); +int ecore_config_deaf(const char *name,const char *key,Ecore_Config_Listener listener); +Ecore_Config_Prop *ecore_config_dst(Ecore_Config_Prop *e); int ecore_config_guess_type(char *val); Ecore_Config_Bundle *ecore_config_bundle_new(Ecore_Config_Server *srv, const char *id); @@ -152,13 +155,13 @@ char *ecore_config_bundle_get_label(Ecore_Config_Bundle *ns); -Ecore_Config_Bundle *ecore_config_init(char *name); +int ecore_config_init(char *name); int ecore_config_exit(void); -int ecore_config_load(Ecore_Config_Bundle *b); -int ecore_config_load_file(Ecore_Config_Bundle *b, char *file); -int ecore_config_save(Ecore_Config_Bundle *b); -int ecore_config_save_file(Ecore_Config_Bundle *b, char *file); +int ecore_config_load(void); +int ecore_config_load_file(char *file); +int ecore_config_save(void); +int ecore_config_save_file(char *file); /* error codes */ # define ECORE_CONFIG_ERR_NOTSUPP (-16) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ecore_config.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ecore_config.c 20 Jan 2004 00:45:52 -0000 1.6 +++ ecore_config.c 20 Jan 2004 16:19:45 -0000 1.7 @@ -37,10 +37,11 @@ return r; } - -Ecore_Config_Prop *ecore_config_dst(Ecore_Config_Bundle *t,Ecore_Config_Prop *e) { +Ecore_Config_Prop *ecore_config_dst(Ecore_Config_Prop *e) { + Ecore_Config_Bundle *t; Ecore_Config_Prop *p=NULL,*c=e; Ecore_Config_Listener_List *l; + t = __bundle_local; if(!e||!e->key) return NULL; @@ -70,9 +71,7 @@ return NULL; } - - -Ecore_Config_Prop *ecore_config_get(const Ecore_Config_Bundle *t,const char *key) { +Ecore_Config_Prop *ecore_config_get(Ecore_Config_Bundle *t, const char *key) { Ecore_Config_Prop *e; if(!t||!key) return NULL; @@ -91,33 +90,28 @@ return "not found"; } - -void *ecore_config_get_data(const Ecore_Config_Bundle *t,const char *key) { - Ecore_Config_Prop *e=ecore_config_get(t,key); +void *ecore_config_get_data(const char *key) { + Ecore_Config_Prop *e=ecore_config_get(__bundle_local,key); return (e?((e->type==PT_STR)?((void *)&e->ptr):((void *)&e->val)) :NULL); } - -char *ecore_config_get_string(const Ecore_Config_Bundle *t,const char *key) { - Ecore_Config_Prop *e=ecore_config_get(t,key); +char *ecore_config_get_string(const char *key) { + Ecore_Config_Prop *e=ecore_config_get(__bundle_local,key); return (e&&(e->type==PT_STR))?e->ptr:NULL; } - -long ecore_config_get_int(const Ecore_Config_Bundle *t,const char *key) { - Ecore_Config_Prop *e=ecore_config_get(t,key); +long ecore_config_get_int(const char *key) { + Ecore_Config_Prop *e=ecore_config_get(__bundle_local,key); return (e&&((e->type==PT_INT)||(e->type==PT_RGB)))?e->val:0L; } - -float ecore_config_get_float(const Ecore_Config_Bundle *t,const char *key) { - Ecore_Config_Prop *e=ecore_config_get(t,key); +float ecore_config_get_float(const char *key) { + Ecore_Config_Prop *e=ecore_config_get(__bundle_local,key); return (e&&(e->type==PT_FLT))?((float)e->val/ECORE_CONFIG_FLOAT_PRECISION):0.0; } - -int ecore_config_get_rgb(const Ecore_Config_Bundle *t,const char *key,int *r, int *g, int *b) { - Ecore_Config_Prop *e=ecore_config_get(t,key); +int ecore_config_get_rgb(const char *key,int *r, int *g, int *b) { + Ecore_Config_Prop *e=ecore_config_get(__bundle_local,key); if(e&&((e->type==PT_RGB))) { *r=(e->val>>16)&0xff; @@ -126,14 +120,16 @@ return ECORE_CONFIG_ERR_SUCC; } return ECORE_CONFIG_ERR_FAIL; } -char *ecore_config_get_rgbstr(const Ecore_Config_Bundle *t,const char *key) { +char *ecore_config_get_rgbstr(const char *key) { char *r=NULL; - esprintf(&r,"#%06x",ecore_config_get_int(t,key)); + esprintf(&r,"#%06x",ecore_config_get_int(key)); return r; } - -char *ecore_config_get_as_string(const Ecore_Config_Bundle *t,const char *key) { + +char *ecore_config_get_as_string(const char *key) { + Ecore_Config_Bundle *t; Ecore_Config_Prop *e; char *r=NULL; + t = __bundle_local; if(!(e=ecore_config_get(t,key))) E(0,"no such property, \"%s\"...\n",key); else { @@ -142,13 +138,13 @@ case PT_NIL: esprintf(&r,"%s:%s=<nil>",key,type); break; case PT_INT: - esprintf(&r,"%s:%s=%ld",key,type,ecore_config_get_int(t,key)); break; + esprintf(&r,"%s:%s=%ld",key,type,ecore_config_get_int(key)); break; case PT_FLT: - esprintf(&r,"%s:%s=%lf",key,type,ecore_config_get_float(t,key)); break; + esprintf(&r,"%s:%s=%lf",key,type,ecore_config_get_float(key)); break; case PT_STR: - esprintf(&r,"%s:%s=\"%s\"",key,type,ecore_config_get_string(t,key)); break; + esprintf(&r,"%s:%s=\"%s\"",key,type,ecore_config_get_string(key)); break; case PT_RGB: - esprintf(&r,"%s:%s=#%06x",key,type,ecore_config_get_int(t,key)); break; + esprintf(&r,"%s:%s=#%06x",key,type,ecore_config_get_int(key)); break; default: esprintf(&r,"%s:unknown_type",key); break; }} return r; } @@ -294,7 +290,6 @@ int type=ecore_config_guess_type(val); return ecore_config_add_typed(t,key,val,type); } - int ecore_config_set_typed(Ecore_Config_Bundle *t,const char *key,void *val,int type) { Ecore_Config_Prop *e; Ecore_Config_Listener_List *l; @@ -321,20 +316,20 @@ int type=ecore_config_guess_type(val); return ecore_config_set_typed(t,key,val,type); } -int ecore_config_set_as_string(Ecore_Config_Bundle *t,const char *key,char *val) { - return ecore_config_set(t,key,val); } - -int ecore_config_set_int(Ecore_Config_Bundle *t,const char *key, int val) { - return ecore_config_set_typed(t,key,(void *)val,PT_INT); } +int ecore_config_set_as_string(const char *key,char *val) { + return ecore_config_set(__bundle_local,key,val); } + +int ecore_config_set_int(const char *key, int val) { + return ecore_config_set_typed(__bundle_local,key,(void *)val,PT_INT); } -int ecore_config_set_string(Ecore_Config_Bundle *t,const char *key, char* val) { - return ecore_config_set_typed(t,key,(void *)val,PT_STR); } +int ecore_config_set_string(const char *key, char* val) { + return ecore_config_set_typed(__bundle_local,key,(void *)val,PT_STR); } -int ecore_config_set_float(Ecore_Config_Bundle *t,const char *key, float val) { - return ecore_config_set_typed(t,key,(void *)&val,PT_FLT); } +int ecore_config_set_float(const char *key, float val) { + return ecore_config_set_typed(__bundle_local,key,(void *)&val,PT_FLT); } -int ecore_config_set_rgb(Ecore_Config_Bundle *t,const char *key, char* val) { - return ecore_config_set_typed(t,key,(void *)val,PT_RGB); } +int ecore_config_set_rgb(const char *key, char* val) { + return ecore_config_set_typed(__bundle_local,key,(void *)val,PT_RGB); } static int ecore_config_default_typed(Ecore_Config_Bundle *t,const char *key,void *val,int type) { @@ -350,9 +345,11 @@ return ret; } -int ecore_config_default(Ecore_Config_Bundle *t,const char *key,char *val,float lo,float hi,float step) { +int ecore_config_default(const char *key,char *val,float lo,float hi,float step) { int ret, type; + Ecore_Config_Bundle *t; Ecore_Config_Prop *e; + t = __bundle_local; type=ecore_config_guess_type(val); ret=ecore_config_default_typed(t, key, val, type); @@ -376,13 +373,15 @@ return ret; } -int ecore_config_default_int(Ecore_Config_Bundle *t,const char *key,int val) { - return ecore_config_default_typed(t, key, (void *) val, PT_INT); +int ecore_config_default_int(const char *key,int val) { + return ecore_config_default_typed(__bundle_local, key, (void *) val, PT_INT); } -int ecore_config_default_int_bound(Ecore_Config_Bundle *t,const char *key,int val,int low,int high,int step) { +int ecore_config_default_int_bound(const char *key,int val,int low,int high,int step) { + Ecore_Config_Bundle *t; Ecore_Config_Prop *e; int ret; + t = __bundle_local; ret=ecore_config_default_typed(t, key, (void *) val, PT_INT); e=ecore_config_get(t,key); @@ -397,20 +396,20 @@ return ret; } -int ecore_config_default_string(Ecore_Config_Bundle *t,const char *key,char *val) { - return ecore_config_default_typed(t, key, (void *) val, PT_STR); +int ecore_config_default_string(const char *key,char *val) { + return ecore_config_default_typed(__bundle_local, key, (void *) val, PT_STR); } -int ecore_config_default_float(Ecore_Config_Bundle *t,const char *key,float val){ - return ecore_config_default_typed(t, key, (void *) &val, PT_FLT); +int ecore_config_default_float(const char *key,float val){ + return ecore_config_default_typed(__bundle_local, key, (void *) &val, PT_FLT); } -int ecore_config_default_float_bound(Ecore_Config_Bundle *t,const char *key,float val,float low,float high,float step) { +int ecore_config_default_float_bound(const char *key,float val,float low,float high,float step) { Ecore_Config_Prop *e; int ret; - ret=ecore_config_default_typed(t, key, (void *) &val, PT_FLT); - e=ecore_config_get(t,key); + ret=ecore_config_default_typed(__bundle_local, key, (void *) &val, PT_FLT); + e=ecore_config_get(__bundle_local,key); if (e) { e->step=(int)(step*ECORE_CONFIG_FLOAT_PRECISION); e->flags|=PF_BOUNDS; @@ -422,14 +421,16 @@ return ret; } -int ecore_config_default_rgb(Ecore_Config_Bundle *t,const char *key,char *val) { - return ecore_config_default_typed(t, key, (void *) val, PT_RGB); +int ecore_config_default_rgb(const char *key,char *val) { + return ecore_config_default_typed(__bundle_local, key, (void *) val, PT_RGB); } -int ecore_config_listen(Ecore_Config_Bundle *t,const char *name,const char *key, - Ecore_Config_Listener listener,int tag,void *data) { +int ecore_config_listen(const char *name,const char *key, + Ecore_Config_Listener listener,int tag,void *data) { + Ecore_Config_Bundle *t; Ecore_Config_Prop *e; Ecore_Config_Listener_List *l; + t = __bundle_local; if(!t||!key) return ECORE_CONFIG_ERR_NODATA; @@ -468,18 +469,16 @@ return ECORE_CONFIG_ERR_SUCC; } - - -int ecore_config_deaf(Ecore_Config_Bundle *t,const char *name,const char *key, - Ecore_Config_Listener listener) { +int ecore_config_deaf(const char *name,const char *key, + Ecore_Config_Listener listener) { Ecore_Config_Prop *e; Ecore_Config_Listener_List *l,*p; int ret=ECORE_CONFIG_ERR_NOTFOUND; - if(!t||!key) + if(!__bundle_local||!key) return ECORE_CONFIG_ERR_NODATA; - if(!(e=ecore_config_get(t,key))) + if(!(e=ecore_config_get(__bundle_local,key))) return ECORE_CONFIG_ERR_NOTFOUND; for(p=NULL,l=e->listeners;l;p=l,l=l->next) { @@ -585,26 +584,24 @@ return do_init(name); } -Ecore_Config_Bundle *ecore_config_init(char *name) { - Ecore_Config_Server *srv; - Ecore_Config_Bundle *bdl; +int ecore_config_init(char *name) { char *buf, *p; - srv = ecore_config_init_local(name); - ecore_config_init_global(ECORE_CONFIG_GLOBAL_ID); + __app_name = strdup(name); + __server_local = ecore_config_init_local(name); + __server_global = ecore_config_init_global(ECORE_CONFIG_GLOBAL_ID); - bdl = ecore_config_bundle_new(srv, "config"); + __bundle_local = ecore_config_bundle_new(__server_local, "config"); if((p=getenv("HOME"))) { /* debug-only ### FIXME */ if ((buf=malloc(PATH_MAX*sizeof(char)))) { snprintf(buf,PATH_MAX,"%s/.e/config.db",p); - ecore_config_load_file(bdl, buf); + ecore_config_load_file(buf); } free(buf); } - config_system=srv; - return bdl; + return ECORE_CONFIG_ERR_SUCC; } int ecore_config_exit(void) { =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/edb.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- edb.c 18 Jan 2004 09:29:39 -0000 1.6 +++ edb.c 20 Jan 2004 16:19:45 -0000 1.7 @@ -5,21 +5,21 @@ #include <stdio.h> #include <string.h> -int ecore_config_load(Ecore_Config_Bundle *b) { +int ecore_config_load(void) { char* file = malloc(1024); /* ### fixme */ - sprintf(file,"%s/.e/apps/%s/config.db",getenv("HOME"),b->owner); - return ecore_config_load_file(b,file); + sprintf(file,"%s/.e/apps/%s/config.db",getenv("HOME"),__app_name); + return ecore_config_load_file(file); free(file); } -int ecore_config_save(Ecore_Config_Bundle *b) { +int ecore_config_save(void) { char* file = malloc(1024); /* ### fixme */ - sprintf(file,"%s/.e/apps/%s/config.db",getenv("HOME"),b->owner); - return ecore_config_save_file(b,file); + sprintf(file,"%s/.e/apps/%s/config.db",getenv("HOME"),__app_name); + return ecore_config_save_file(file); free(file); } -int ecore_config_load_file(Ecore_Config_Bundle *b, char *file) { +int ecore_config_load_file(char *file) { E_DB_File *db = NULL; char **keys; int key_count; @@ -45,13 +45,13 @@ if (!strcmp(type, "int")) { if (e_db_int_get(db, keys[x], &itmp)) { - ecore_config_set_int(b, keys[x], itmp); + ecore_config_set_int(keys[x], itmp); } else { E(0, "Could not read key %s!\n", keys[x]); } } else if (!strcmp(type, "float")) { if (e_db_float_get(db, keys[x], &ftmp)) { - ecore_config_set_float(b, keys[x], ftmp); + ecore_config_set_float(keys[x], ftmp); } else { E(0, "Could not read key %s!\n", keys[x]); } @@ -59,9 +59,9 @@ data = e_db_str_get(db, keys[x]); if (data) { if (ecore_config_guess_type(data)==PT_RGB) - ecore_config_set_rgb(b,keys[x],data); + ecore_config_set_rgb(keys[x],data); else - ecore_config_set_string(b,keys[x],data); + ecore_config_set_string(keys[x],data); } else { E(0, "Could not read key %s!\n", keys[x]); } @@ -76,8 +76,8 @@ return 0; } -int ecore_config_save_file(Ecore_Config_Bundle *b, char *file) { - Ecore_Config_Prop *next=b->data; +int ecore_config_save_file(char *file) { + Ecore_Config_Prop *next=__bundle_local->data; E_DB_File *db = NULL; /* ### we may need to create a directory or two here! */ @@ -94,16 +94,16 @@ } switch (next->type) { case PT_INT: - e_db_int_set(db, next->key, ecore_config_get_int(b, next->key)); + e_db_int_set(db, next->key, ecore_config_get_int(next->key)); break; case PT_FLT: - e_db_float_set(db, next->key, ecore_config_get_float(b, next->key)); + e_db_float_set(db, next->key, ecore_config_get_float(next->key)); break; case PT_RGB: - e_db_str_set(db, next->key, ecore_config_get_rgbstr(b, next->key)); + e_db_str_set(db, next->key, ecore_config_get_rgbstr(next->key)); break; case PT_STR: - e_db_str_set(db, next->key, ecore_config_get_string(b, next->key)); + e_db_str_set(db, next->key, ecore_config_get_string(next->key)); break; case PT_NIL: /* currently we do nothing for undefined ojects */ =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ipc_main.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- ipc_main.c 20 Jan 2004 00:45:52 -0000 1.7 +++ ipc_main.c 20 Jan 2004 16:19:45 -0000 1.8 @@ -39,7 +39,7 @@ Ecore_Config_Server *srv2ecore_config_srv(void *srv) { ipc *ipc_tmp; Ecore_Config_Server *srv_tmp; -/* + ipc_tmp = ipc_modules; while (ipc_tmp) { srv_tmp = ipc_tmp->data; @@ -50,8 +50,8 @@ } ipc_tmp = ipc_tmp->next; } -*/ - return config_system; + + return __server_global; } /*****************************************************************************/ @@ -101,7 +101,7 @@ #ifdef HAVE_EVAS2 char *ret=NULL; Ecore_Config_Bundle *theme=ecore_config_bundle_get_by_serial(srv, serial); - if((ret=ecore_config_get_as_string(theme,key))) + if((ret=ecore_config_get_as_string(/*theme,*/key))) return ret; #endif return strdup("<undefined>"); } @@ -243,7 +243,7 @@ list->next=nm->data; nm->data=list; - if (ret_srv) ret_srv=list; + if (!ret_srv) ret_srv=list; nm = nm->next; } |
From: <enl...@li...> - 2004-01-26 01:58:11
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: ipc_ecore.c .cvsignore Log Message: Yay, fixed - Can I see who changed this code please? ;) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ipc_ecore.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- ipc_ecore.c 31 Dec 2003 22:15:33 -0000 1.1 +++ ipc_ecore.c 25 Jan 2004 11:18:32 -0000 1.2 @@ -169,7 +169,7 @@ -static int ipc_init(char *pipe_name, void **data) { +int ipc_init(char *pipe_name, void **data) { Ecore_Ipc_Server **server=(Ecore_Ipc_Server **)data; struct stat st; char *p; @@ -219,7 +219,7 @@ -static int ipc_exit(void **data) { +int ipc_exit(void **data) { int ret=ECORE_CONFIG_ERR_SUCC; Ecore_Ipc_Server **server=(Ecore_Ipc_Server **)data; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- .cvsignore 16 Jan 2004 16:59:02 -0000 1.1 +++ .cvsignore 25 Jan 2004 11:18:33 -0000 1.2 @@ -8,3 +8,4 @@ util.lo edb.lo libecore_config.la +ecore_config_ipc_ecore.la |
From: <enl...@li...> - 2004-01-27 08:31:26
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: Makefile.am Log Message: avoid worning =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- Makefile.am 24 Jan 2004 17:56:49 -0000 1.8 +++ Makefile.am 24 Jan 2004 18:45:29 -0000 1.9 @@ -8,6 +8,10 @@ libecore_config_la_LDFLAGS = -version-info 1:0:0 \ -L$(top_builddir)/src/lib/ecore/.libs +ecore_config_ipc_ecore_la_LDFLAGS = -no-undefined -module \ +-avoid-version -rdynamic -shared + + if BUILD_ECORE_CONFIG lib_LTLIBRARIES = libecore_config.la ecore_config_ipc_ecore.la @@ -35,7 +39,6 @@ ecore_config_ipc_ecore_la_LIBADD = \ $(top_builddir)/src/lib/ecore/libecore.la \ $(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la -ecore_config_ipc_ecore_la_LDFLAGS = -no-undefined -module -avoid-version -rdynamic -shared endif |
From: <enl...@li...> - 2004-01-27 13:01:46
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: Makefile.am Log Message: Hmm, this must have disappeared in the move from ./ipc =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- Makefile.am 31 Dec 2003 22:15:33 -0000 1.7 +++ Makefile.am 24 Jan 2004 17:56:49 -0000 1.8 @@ -2,21 +2,21 @@ INCLUDES = \ -I$(top_srcdir)/src/lib/ecore \ --I$(top_srcdir)/src/lib/ecore_ipc +-I$(top_srcdir)/src/lib/ecore_ipc \ +-I$(top_srcdir)/ libecore_config_la_LDFLAGS = -version-info 1:0:0 \ -L$(top_builddir)/src/lib/ecore/.libs if BUILD_ECORE_CONFIG -lib_LTLIBRARIES = libecore_config.la +lib_LTLIBRARIES = libecore_config.la ecore_config_ipc_ecore.la include_HEADERS = \ Ecore_Config.h libecore_config_la_SOURCES = \ ecore_config.c \ ipc_main.c \ -ipc_ecore.c \ util.c \ edb.c @@ -26,6 +26,18 @@ libecore_config_la_DEPENDENCIES = \ $(top_builddir)/src/lib/ecore/libecore.la + +ecore_config_ipc_ecore_la_DEPENDENCIES = \ +$(top_builddir)/config.h \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la +ecore_config_ipc_ecore_la_SOURCES = ipc_ecore.c +ecore_config_ipc_ecore_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la +ecore_config_ipc_ecore_la_LDFLAGS = -no-undefined -module -avoid-version -rdynamic -shared + + endif EXTRA_DIST = \ |
From: <enl...@li...> - 2004-01-28 18:54:36
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: Makefile.am Added Files: build_system.db.sh Log Message: Added a simple db build script to generate a simple system db which will be copied if none exists (by ecore_config) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- Makefile.am 25 Jan 2004 18:07:53 -0000 1.10 +++ Makefile.am 28 Jan 2004 18:53:25 -0000 1.11 @@ -5,19 +5,24 @@ -I$(top_srcdir)/src/lib/ecore_ipc \ -I$(top_srcdir)/ +DB = system.db +CLEANFILES = $(DB) + libecore_config_la_LDFLAGS = -version-info 1:0:0 \ -L$(top_builddir)/src/lib/ecore/.libs ecore_config_ipc_ecore_la_LDFLAGS = -no-undefined -module \ -avoid-version -rdynamic -shared - if BUILD_ECORE_CONFIG lib_LTLIBRARIES = libecore_config.la ecore_config_ipc_ecore.la include_HEADERS = \ Ecore_Config.h +config_DATA = $(DB) +configdir = $(sysconfdir) + libecore_config_la_SOURCES = \ ecore_config.c \ ipc_main.c \ @@ -43,6 +48,8 @@ $(top_builddir)/src/lib/ecore_config/libecore_config.la \ -ledb +$(DB): + sh build_$(DB).sh endif @@ -55,3 +62,6 @@ util.c \ util.h \ edb.c + +CLEANFILES = $(DB) + |
From: <enl...@li...> - 2004-01-28 22:30:06
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: ecore_config.c Log Message: Thanks Azundris =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ecore_config.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- ecore_config.c 23 Jan 2004 04:01:40 -0000 1.8 +++ ecore_config.c 26 Jan 2004 15:27:11 -0000 1.9 @@ -487,7 +487,7 @@ return ECORE_CONFIG_ERR_NOTFOUND; for(p=NULL,l=e->listeners;l;p=l,l=l->next) { - if(!strcmp(l->name,name)||(l->listener==listener)) { + if((name&&!strcmp(l->name,name))||(l->listener==listener)) { ret=ECORE_CONFIG_ERR_SUCC; if(!p) e->listeners=e->listeners->next; |
From: <enl...@li...> - 2004-01-28 18:55:27
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: .cvsignore Log Message: Added a simple db build script to generate a simple system db which will be copied if none exists (by ecore_config) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- .cvsignore 25 Jan 2004 11:18:33 -0000 1.2 +++ .cvsignore 28 Jan 2004 18:54:15 -0000 1.3 @@ -9,3 +9,4 @@ edb.lo libecore_config.la ecore_config_ipc_ecore.la +system.db |
From: <enl...@li...> - 2004-02-01 21:24:32
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: ipc_main.c ipc_ecore.c Log Message: Should fix naming conflicts - need a proper namespace fixup =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ipc_main.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- ipc_main.c 20 Jan 2004 16:19:45 -0000 1.8 +++ ipc_main.c 1 Feb 2004 21:22:38 -0000 1.9 @@ -266,7 +266,7 @@ E(1,"ipc_init: checking \"%s\"...\n",globbuf.gl_pathv[c]); ret=dlmulti("IPC-plugin",globbuf.gl_pathv[c],RTLD_NOW,&nm->lib, - "!ipc_init !ipc_exit !ipc_poll", + "!ecore_config_mod_init !ecore_config_mod_exit !ecore_config_mod_poll", &nm->ipc_init,&nm->ipc_exit,&nm->ipc_poll); if(ret==ECORE_CONFIG_ERR_NODATA) E(0,"ipc_init: could not load \"%s\": %s...\n",globbuf.gl_pathv[c],dlerror()); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ipc_ecore.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- ipc_ecore.c 25 Jan 2004 11:18:32 -0000 1.2 +++ ipc_ecore.c 1 Feb 2004 21:22:38 -0000 1.3 @@ -169,7 +169,7 @@ -int ipc_init(char *pipe_name, void **data) { +int ecore_config_mod_init(char *pipe_name, void **data) { Ecore_Ipc_Server **server=(Ecore_Ipc_Server **)data; struct stat st; char *p; @@ -219,7 +219,7 @@ -int ipc_exit(void **data) { +int ecore_config_mod_exit(void **data) { int ret=ECORE_CONFIG_ERR_SUCC; Ecore_Ipc_Server **server=(Ecore_Ipc_Server **)data; @@ -243,7 +243,7 @@ -int ipc_poll(void **data) { +int ecore_config_mod_poll(void **data) { Ecore_Ipc_Server **server=(Ecore_Ipc_Server **)data; if(!server) |
From: <enl...@li...> - 2004-02-01 21:50:59
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: Makefile.am Log Message: fix up the crazy generic install location for system.db =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/Makefile.am,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- Makefile.am 28 Jan 2004 18:53:25 -0000 1.11 +++ Makefile.am 1 Feb 2004 21:49:01 -0000 1.12 @@ -21,7 +21,7 @@ Ecore_Config.h config_DATA = $(DB) -configdir = $(sysconfdir) +configdir = $(pkgdatadir) libecore_config_la_SOURCES = \ ecore_config.c \ |
From: <enl...@li...> - 2004-02-01 23:56:06
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: ecore_config.c Log Message: use the created system file if one is not defined (modifications will cause it to get saved to ~/.e/config.db) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ecore_config.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- ecore_config.c 1 Feb 2004 07:28:09 -0000 1.10 +++ ecore_config.c 1 Feb 2004 23:54:08 -0000 1.11 @@ -607,7 +607,8 @@ if ((buf=malloc(PATH_MAX*sizeof(char)))) { snprintf(buf,PATH_MAX,"%s/.e/config.db",p); if (ecore_config_load_file(buf) != 0) - return ECORE_CONFIG_ERR_NOFILE; + if (ecore_config_load_file(PACKAGE_DATA_DIR "/system.db") != 0) + return ECORE_CONFIG_ERR_NOFILE; } free(buf); } |
From: <enl...@li...> - 2004-02-03 22:55:34
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: ecore_config.c Ecore_Config.h Log Message: Never save system properties in apps config files unless they have been overridden (modified locally) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ecore_config.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- ecore_config.c 1 Feb 2004 23:54:08 -0000 1.11 +++ ecore_config.c 3 Feb 2004 22:53:13 -0000 1.12 @@ -591,6 +591,7 @@ int ecore_config_init(char *name) { char *buf, *p; + Ecore_Config_Prop *sys; __app_name = strdup(name); __server_local = ecore_config_init_local(name); @@ -609,6 +610,14 @@ if (ecore_config_load_file(buf) != 0) if (ecore_config_load_file(PACKAGE_DATA_DIR "/system.db") != 0) return ECORE_CONFIG_ERR_NOFILE; + sys = __bundle_local->data; + while (sys) { + /* unmark it modified - modification will mean it has been overridden */ + sys->flags&=~PF_MODIFIED; + /* mark as system so that examine can hide them */ + sys->flags&=PF_SYSTEM; + sys=sys->next; + } } free(buf); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/Ecore_Config.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- Ecore_Config.h 23 Jan 2004 04:01:40 -0000 1.9 +++ Ecore_Config.h 3 Feb 2004 22:53:13 -0000 1.10 @@ -61,7 +61,8 @@ typedef enum Ecore_Config_Flag { PF_NONE=0, PF_BOUNDS=1, - PF_MODIFIED=2 + PF_MODIFIED=2, + PF_SYSTEM=4 } Ecore_Config_Flag; |
From: <enl...@li...> - 2004-02-07 01:48:15
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: build_system.db.sh Log Message: Moved theme setting to be E-global (most things have a winter theme ;) Fixed bug #0000029 =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/build_system.db.sh,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- build_system.db.sh 28 Jan 2004 18:53:25 -0000 1.1 +++ build_system.db.sh 7 Feb 2004 00:10:06 -0000 1.2 @@ -1,9 +1,18 @@ #!/bin/sh DB=system.db -edb_ed $DB add /ewl/theme/name str "default" +edb_ed $DB add /e/theme/name str "winter" if [ $BROWSER ]; then edb_ed $DB add /apps/web/browser str "$BROWSER" else -edb_ed $DB add /apps/web/browser str "`which MozillaFirebird || which phoenix || which mozilla || which opera || which konqueror || which epiphany`" +edb_ed $DB add /apps/web/browser str "`which MozillaFirebird 2>/dev/null || + which phoenix 2>/dev/null || + which mozilla 2>/dev/null || + which opera 2>/dev/null || + which konqueror 2>/dev/null || + which epiphany 2>/dev/null`" fi -edb_ed $DB add /apps/web/email str "`which MozillaThunderbird || which mozilla || which kmail || which sylpheed || which evolution`" +edb_ed $DB add /apps/web/email str "`which MozillaThunderbird 2>/dev/null || + which mozilla 2>/dev/null || + which kmail 2>/dev/null || + which sylpheed 2>/dev/null || + which evolution 2>/dev/null`" |
From: <enl...@li...> - 2004-02-15 14:50:23
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: ecore_config.c edb.c Log Message: A few mem leaks plugged - getting to grips with valgrind =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ecore_config.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- ecore_config.c 3 Feb 2004 22:53:13 -0000 1.12 +++ ecore_config.c 15 Feb 2004 14:43:08 -0000 1.13 @@ -626,6 +626,12 @@ } int ecore_config_exit(void) { - return ipc_exit(); + int ret; + ret = ipc_exit(); + free(__app_name); + free(__bundle_local); + free(__server_local); + free(__server_global); + return ret; } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/edb.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- edb.c 13 Feb 2004 17:07:45 -0000 1.9 +++ edb.c 15 Feb 2004 14:43:08 -0000 1.10 @@ -10,13 +10,13 @@ char file[PATH_MAX]; snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.db",getenv("HOME"),__app_name); return ecore_config_load_file(file); - } +} int ecore_config_save(void) { char file[PATH_MAX]; snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.db",getenv("HOME"),__app_name); return ecore_config_save_file(file); - } +} int ecore_config_load_file(char *file) { E_DB_File *db = NULL; @@ -61,6 +61,7 @@ ecore_config_set_rgb(keys[x],data); else ecore_config_set_string(keys[x],data); + free(data); } else { E(0, "Could not read key %s!\n", keys[x]); } @@ -72,6 +73,7 @@ if (type) free(type); } e_db_close(db); + free(keys); return 0; } |
From: <enl...@li...> - 2004-02-15 14:57:37
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: ipc_ecore.c Log Message: A few mem leaks plugged - getting to grips with valgrind =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ipc_ecore.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ipc_ecore.c 1 Feb 2004 21:22:38 -0000 1.3 +++ ipc_ecore.c 15 Feb 2004 14:50:23 -0000 1.4 @@ -174,7 +174,7 @@ struct stat st; char *p; int port=0; - char *str = NULL; + char socket[PATH_MAX]; if(!server) return ECORE_CONFIG_ERR_FAIL; @@ -187,16 +187,13 @@ return ECORE_CONFIG_ERR_FAIL; if((p=getenv("HOME"))) { /* debug-only ### FIXME */ - char buf[PATH_MAX]; int stale; - str=malloc(1000*sizeof(char)); stale=1; while (stale) { - sprintf(str,"%s/.ecore/%s/%d",p,pipe_name,port); - snprintf(buf,PATH_MAX,str); + snprintf(socket,PATH_MAX,"%s/.ecore/%s/%d",p,pipe_name,port); - if(!stat(buf,&st)) { - E(0,"IPC/eCore: pipe \"%s\" already exists!?\n",buf); + if(!stat(socket,&st)) { + E(0,"IPC/eCore: pipe \"%s\" already exists!?\n",socket); /* if(unlink(buf)) E(0,"IPC/eCore: could not remove pipe \"%s\": %d\n",buf,errno); }}*/ port++; @@ -210,9 +207,8 @@ ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, ipc_client_del, server); ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA,ipc_client_sent,server); - if(str) { - sprintf(str,"IPC/eCore: Server is listening on %s.\n", pipe_name); - E(1,str); + if(socket) { + E(1,"IPC/eCore: Server is listening on %s.\n", pipe_name); } return ECORE_CONFIG_ERR_SUCC; } |
From: <enl...@li...> - 2004-02-15 22:51:20
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: ipc_ecore.c Log Message: Fixy - taa kim =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ipc_ecore.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- ipc_ecore.c 15 Feb 2004 14:50:23 -0000 1.4 +++ ipc_ecore.c 15 Feb 2004 22:43:48 -0000 1.5 @@ -207,7 +207,7 @@ ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, ipc_client_del, server); ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA,ipc_client_sent,server); - if(socket) { + if(server) { E(1,"IPC/eCore: Server is listening on %s.\n", pipe_name); } |
From: <enl...@li...> - 2004-02-24 20:09:21
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: build_system.db.sh Log Message: Hmm, Moz name changes again =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/build_system.db.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- build_system.db.sh 7 Feb 2004 00:10:06 -0000 1.2 +++ build_system.db.sh 24 Feb 2004 19:54:51 -0000 1.3 @@ -4,14 +4,14 @@ if [ $BROWSER ]; then edb_ed $DB add /apps/web/browser str "$BROWSER" else -edb_ed $DB add /apps/web/browser str "`which MozillaFirebird 2>/dev/null || +edb_ed $DB add /apps/web/browser str "`which firefox 2>/dev/null || which phoenix 2>/dev/null || which mozilla 2>/dev/null || which opera 2>/dev/null || which konqueror 2>/dev/null || which epiphany 2>/dev/null`" fi -edb_ed $DB add /apps/web/email str "`which MozillaThunderbird 2>/dev/null || +edb_ed $DB add /apps/web/email str "`which thunderbird 2>/dev/null || which mozilla 2>/dev/null || which kmail 2>/dev/null || which sylpheed 2>/dev/null || |
From: <enl...@li...> - 2004-03-01 23:30:40
|
Enlightenment CVS committal Author : handyande Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: Ecore_Config.h ecore_config.c edb.c ipc.h ipc_ecore.c ipc_main.c Log Message: Start tidyup with namespaces - fingers crossed =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/Ecore_Config.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- Ecore_Config.h 3 Feb 2004 22:53:13 -0000 1.10 +++ Ecore_Config.h 1 Mar 2004 23:11:28 -0000 1.11 @@ -112,10 +112,10 @@ struct Ecore_Config_Server *next; } Ecore_Config_Server; /* global ptrs to save passing them through the API */ -extern Ecore_Config_Server *__server_global; -extern Ecore_Config_Server *__server_local; -extern Ecore_Config_Bundle *__bundle_local; -extern char *__app_name; +extern Ecore_Config_Server *__ecore_config_server_global; +extern Ecore_Config_Server *__ecore_config_server_local; +extern Ecore_Config_Bundle *__ecore_config_bundle_local; +extern char *__ecore_config_app_name; Ecore_Config_Prop *ecore_config_get(Ecore_Config_Bundle *t,const char *key); const char *ecore_config_get_type(const Ecore_Config_Prop *e); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ecore_config.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- ecore_config.c 15 Feb 2004 14:43:08 -0000 1.13 +++ ecore_config.c 1 Mar 2004 23:11:28 -0000 1.14 @@ -12,41 +12,23 @@ #include <unistd.h> #include <util.h> -Ecore_Config_Server *__server_global = NULL; -Ecore_Config_Server *__server_local = NULL; -Ecore_Config_Bundle *__bundle_local = NULL; -char *__app_name = NULL; - -Ecore_Config_Server *ipc_init(char *name); -int ipc_exit(void); - -static char *ecore_config_type[]={ "undefined", "integer", "float", "string", "colour" }; - -/* tolower, weed out _ - */ -char *prop_canonize_key(char *pn,int modify) { - char *v,*r; - - if(!modify) - r=pn; - else if(!(r=strdup(pn))) - return NULL; +Ecore_Config_Server *__ecore_config_server_global = NULL; +Ecore_Config_Server *__ecore_config_server_local = NULL; +Ecore_Config_Bundle *__ecore_config_bundle_local = NULL; +char *__ecore_config_app_name = NULL; - v=r; - while(*v) { - if(strchr("-_/",*v)) - memmove(v,&v[1],strlen(v)); - else { - if(isupper(*v)) - *v=tolower(*v); - v++; }} - return r; } +Ecore_Config_Server *_ecore_config_ipc_init(char *name); +int _ecore_config_ipc_exit(void); +static char *_ecore_config_type[]={ "undefined", "integer", "float", "string", "colour" }; Ecore_Config_Prop *ecore_config_dst(Ecore_Config_Prop *e) { Ecore_Config_Bundle *t; - Ecore_Config_Prop *p=NULL,*c=e; + Ecore_Config_Prop *p,*c; Ecore_Config_Listener_List *l; - t = __bundle_local; + p=NULL; + c=e; + t = __ecore_config_bundle_local; if(!e||!e->key) return NULL; @@ -91,32 +73,37 @@ const char *ecore_config_get_type(const Ecore_Config_Prop *e) { if(e) { - return ecore_config_type[e->type]; } + return _ecore_config_type[e->type]; } return "not found"; } void *ecore_config_get_data(const char *key) { - Ecore_Config_Prop *e=ecore_config_get(__bundle_local,key); + Ecore_Config_Prop *e; + e=ecore_config_get(__ecore_config_bundle_local,key); return (e?((e->type==PT_STR)?((void *)&e->ptr):((void *)&e->val)) :NULL); } char *ecore_config_get_string(const char *key) { - Ecore_Config_Prop *e=ecore_config_get(__bundle_local,key); + Ecore_Config_Prop *e; + e=ecore_config_get(__ecore_config_bundle_local,key); return (e&&(e->type==PT_STR))?e->ptr:NULL; } long ecore_config_get_int(const char *key) { - Ecore_Config_Prop *e=ecore_config_get(__bundle_local,key); + Ecore_Config_Prop *e; + e=ecore_config_get(__ecore_config_bundle_local,key); return (e&&((e->type==PT_INT)||(e->type==PT_RGB)))?e->val:0L; } float ecore_config_get_float(const char *key) { - Ecore_Config_Prop *e=ecore_config_get(__bundle_local,key); + Ecore_Config_Prop *e; + e=ecore_config_get(__ecore_config_bundle_local,key); return (e&&(e->type==PT_FLT))?((float)e->val/ECORE_CONFIG_FLOAT_PRECISION):0.0; } int ecore_config_get_rgb(const char *key,int *r, int *g, int *b) { - Ecore_Config_Prop *e=ecore_config_get(__bundle_local,key); + Ecore_Config_Prop *e; + e=ecore_config_get(__ecore_config_bundle_local,key); if(e&&((e->type==PT_RGB))) { *r=(e->val>>16)&0xff; @@ -126,15 +113,17 @@ return ECORE_CONFIG_ERR_FAIL; } char *ecore_config_get_rgbstr(const char *key) { - char *r=NULL; + char *r; + r=NULL; esprintf(&r,"#%06x",ecore_config_get_int(key)); return r; } char *ecore_config_get_as_string(const char *key) { Ecore_Config_Bundle *t; Ecore_Config_Prop *e; - char *r=NULL; - t = __bundle_local; + char *r; + r=NULL; + t = __ecore_config_bundle_local; if(!(e=ecore_config_get(t,key))) E(0,"no such property, \"%s\"...\n",key); else { @@ -156,8 +145,9 @@ static int ecore_config_bound(Ecore_Config_Prop *e) { - int ret=ECORE_CONFIG_ERR_SUCC; + int ret; long v; + ret=ECORE_CONFIG_ERR_SUCC; if(!e) return ECORE_CONFIG_ERR_FAIL; @@ -188,8 +178,9 @@ return ret; } int ecore_config_guess_type(char *val) { - char *l=NULL; + char *l; long v; + l=NULL; if(!val) return PT_NIL; @@ -206,10 +197,12 @@ } static int ecore_config_val_typed(Ecore_Config_Prop *e,void *val,int type) { - char *l=NULL; - long v=0; + char *l; + long v; float *f; + l=NULL; + v=0; e->type=PT_NIL; if(!val) @@ -252,14 +245,6 @@ return ECORE_CONFIG_ERR_IGNORED; } - -#if 0 /* Not used */ -static int ecore_config_val(Ecore_Config_Prop *e,char *val) { - int type = ecore_config_guess_type(val); - return ecore_config_val_typed(e,(void *)val,type); } -#endif - - static int ecore_config_add_typed(Ecore_Config_Bundle *t, const char *key, void* val, int type) { Ecore_Config_Prop *e; @@ -292,7 +277,8 @@ static int ecore_config_add(Ecore_Config_Bundle *t,const char *key,char *val) { - int type=ecore_config_guess_type(val); + int type; + type=ecore_config_guess_type(val); return ecore_config_add_typed(t,key,val,type); } int ecore_config_set_typed(Ecore_Config_Bundle *t,const char *key,void *val,int type) { @@ -318,28 +304,30 @@ } int ecore_config_set(Ecore_Config_Bundle *t,const char *key,char *val) { - int type=ecore_config_guess_type(val); + int type; + type=ecore_config_guess_type(val); return ecore_config_set_typed(t,key,val,type); } int ecore_config_set_as_string(const char *key,char *val) { - return ecore_config_set(__bundle_local,key,val); } + return ecore_config_set(__ecore_config_bundle_local,key,val); } int ecore_config_set_int(const char *key, int val) { - return ecore_config_set_typed(__bundle_local,key,(void *)val,PT_INT); } + return ecore_config_set_typed(__ecore_config_bundle_local,key,(void *)val,PT_INT); } int ecore_config_set_string(const char *key, char* val) { - return ecore_config_set_typed(__bundle_local,key,(void *)val,PT_STR); } + return ecore_config_set_typed(__ecore_config_bundle_local,key,(void *)val,PT_STR); } int ecore_config_set_float(const char *key, float val) { - return ecore_config_set_typed(__bundle_local,key,(void *)&val,PT_FLT); } + return ecore_config_set_typed(__ecore_config_bundle_local,key,(void *)&val,PT_FLT); } int ecore_config_set_rgb(const char *key, char* val) { - return ecore_config_set_typed(__bundle_local,key,(void *)val,PT_RGB); } + return ecore_config_set_typed(__ecore_config_bundle_local,key,(void *)val,PT_RGB); } static int ecore_config_default_typed(Ecore_Config_Bundle *t,const char *key,void *val,int type) { - int ret=ECORE_CONFIG_ERR_SUCC; + int ret; Ecore_Config_Prop *e; + ret=ECORE_CONFIG_ERR_SUCC; if(!(e=ecore_config_get(t,key))) { /* prop doesn't exist yet */ if((ret=ecore_config_add_typed(t,key,val,type))!=ECORE_CONFIG_ERR_SUCC) /* try to add it */ @@ -354,7 +342,7 @@ int ret, type; Ecore_Config_Bundle *t; Ecore_Config_Prop *e; - t = __bundle_local; + t = __ecore_config_bundle_local; type=ecore_config_guess_type(val); ret=ecore_config_default_typed(t, key, val, type); @@ -379,14 +367,14 @@ } int ecore_config_default_int(const char *key,int val) { - return ecore_config_default_typed(__bundle_local, key, (void *) val, PT_INT); + return ecore_config_default_typed(__ecore_config_bundle_local, key, (void *) val, PT_INT); } int ecore_config_default_int_bound(const char *key,int val,int low,int high,int step) { Ecore_Config_Bundle *t; Ecore_Config_Prop *e; int ret; - t = __bundle_local; + t = __ecore_config_bundle_local; ret=ecore_config_default_typed(t, key, (void *) val, PT_INT); e=ecore_config_get(t,key); @@ -402,19 +390,19 @@ } int ecore_config_default_string(const char *key,char *val) { - return ecore_config_default_typed(__bundle_local, key, (void *) val, PT_STR); + return ecore_config_default_typed(__ecore_config_bundle_local, key, (void *) val, PT_STR); } int ecore_config_default_float(const char *key,float val){ - return ecore_config_default_typed(__bundle_local, key, (void *) &val, PT_FLT); + return ecore_config_default_typed(__ecore_config_bundle_local, key, (void *) &val, PT_FLT); } int ecore_config_default_float_bound(const char *key,float val,float low,float high,float step) { Ecore_Config_Prop *e; int ret; - ret=ecore_config_default_typed(__bundle_local, key, (void *) &val, PT_FLT); - e=ecore_config_get(__bundle_local,key); + ret=ecore_config_default_typed(__ecore_config_bundle_local, key, (void *) &val, PT_FLT); + e=ecore_config_get(__ecore_config_bundle_local,key); if (e) { e->step=(int)(step*ECORE_CONFIG_FLOAT_PRECISION); e->flags|=PF_BOUNDS; @@ -427,7 +415,7 @@ } int ecore_config_default_rgb(const char *key,char *val) { - return ecore_config_default_typed(__bundle_local, key, (void *) val, PT_RGB); + return ecore_config_default_typed(__ecore_config_bundle_local, key, (void *) val, PT_RGB); } int ecore_config_listen(const char *name,const char *key, @@ -435,7 +423,7 @@ Ecore_Config_Bundle *t; Ecore_Config_Prop *e; Ecore_Config_Listener_List *l; - t = __bundle_local; + t = __ecore_config_bundle_local; if(!t||!key) return ECORE_CONFIG_ERR_NODATA; @@ -478,12 +466,13 @@ Ecore_Config_Listener listener) { Ecore_Config_Prop *e; Ecore_Config_Listener_List *l,*p; - int ret=ECORE_CONFIG_ERR_NOTFOUND; + int ret; + ret=ECORE_CONFIG_ERR_NOTFOUND; - if(!__bundle_local||!key) + if(!__ecore_config_bundle_local||!key) return ECORE_CONFIG_ERR_NODATA; - if(!(e=ecore_config_get(__bundle_local,key))) + if(!(e=ecore_config_get(__ecore_config_bundle_local,key))) return ECORE_CONFIG_ERR_NOTFOUND; for(p=NULL,l=e->listeners;l;p=l,l=l->next) { @@ -505,7 +494,8 @@ return ns?ns->next:NULL; } Ecore_Config_Bundle *ecore_config_bundle_get_by_serial(Ecore_Config_Server *srv, long serial) { - Ecore_Config_Bundle *eb=srv->bundles; + Ecore_Config_Bundle *eb; + eb=srv->bundles; if(serial<0) return NULL; @@ -520,7 +510,8 @@ return NULL; } Ecore_Config_Bundle *ecore_config_bundle_get_by_label(Ecore_Config_Server *srv, const char *label) { - Ecore_Config_Bundle *ns=srv->bundles; + Ecore_Config_Bundle *ns; + ns=srv->bundles; while(ns) { if(ns->identifier&&!strcmp(ns->identifier,label)) @@ -552,7 +543,7 @@ return t; } Ecore_Config_Server *do_init(char *name) { - return ipc_init(name); + return _ecore_config_ipc_init(name); } Ecore_Config_Server *ecore_config_init_local(char *name) { @@ -573,8 +564,9 @@ Ecore_Config_Server *ecore_config_init_global(char *name) { char *p; - int global=0; + int global; char *buf; + global=0; if((p=getenv("HOME"))) { /* debug-only ### FIXME */ if (!(buf=malloc(PATH_MAX*sizeof(char)))) @@ -593,16 +585,16 @@ char *buf, *p; Ecore_Config_Prop *sys; - __app_name = strdup(name); - __server_local = ecore_config_init_local(name); - if (!__server_local) + __ecore_config_app_name = strdup(name); + __ecore_config_server_local = ecore_config_init_local(name); + if (!__ecore_config_server_local) return ECORE_CONFIG_ERR_FAIL; - __server_global = ecore_config_init_global(ECORE_CONFIG_GLOBAL_ID); - if (!__server_global) + __ecore_config_server_global = ecore_config_init_global(ECORE_CONFIG_GLOBAL_ID); + if (!__ecore_config_server_global) return ECORE_CONFIG_ERR_FAIL; - __bundle_local = ecore_config_bundle_new(__server_local, "config"); + __ecore_config_bundle_local = ecore_config_bundle_new(__ecore_config_server_local, "config"); if((p=getenv("HOME"))) { /* debug-only ### FIXME */ if ((buf=malloc(PATH_MAX*sizeof(char)))) { @@ -610,7 +602,7 @@ if (ecore_config_load_file(buf) != 0) if (ecore_config_load_file(PACKAGE_DATA_DIR "/system.db") != 0) return ECORE_CONFIG_ERR_NOFILE; - sys = __bundle_local->data; + sys = __ecore_config_bundle_local->data; while (sys) { /* unmark it modified - modification will mean it has been overridden */ sys->flags&=~PF_MODIFIED; @@ -627,11 +619,11 @@ int ecore_config_exit(void) { int ret; - ret = ipc_exit(); - free(__app_name); - free(__bundle_local); - free(__server_local); - free(__server_global); + ret = _ecore_config_ipc_exit(); + free(__ecore_config_app_name); + free(__ecore_config_bundle_local); + free(__ecore_config_server_local); + free(__ecore_config_server_global); return ret; } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/edb.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- edb.c 15 Feb 2004 14:43:08 -0000 1.10 +++ edb.c 1 Mar 2004 23:11:28 -0000 1.11 @@ -8,18 +8,18 @@ int ecore_config_load(void) { char file[PATH_MAX]; - snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.db",getenv("HOME"),__app_name); + snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.db",getenv("HOME"),__ecore_config_app_name); return ecore_config_load_file(file); } int ecore_config_save(void) { char file[PATH_MAX]; - snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.db",getenv("HOME"),__app_name); + snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.db",getenv("HOME"),__ecore_config_app_name); return ecore_config_save_file(file); } int ecore_config_load_file(char *file) { - E_DB_File *db = NULL; + E_DB_File *db; char **keys; int key_count; int x; @@ -27,6 +27,7 @@ float ftmp; char *type; char *data; + db=NULL; type = NULL; data = NULL; @@ -78,8 +79,10 @@ } int ecore_config_save_file(char *file) { - Ecore_Config_Prop *next=__bundle_local->data; - E_DB_File *db = NULL; + Ecore_Config_Prop *next; + E_DB_File *db; + next=__ecore_config_bundle_local->data; + db = NULL; /* ### we may need to create a directory or two here! */ db = e_db_open(file); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ipc.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- ipc.h 5 Dec 2003 16:57:32 -0000 1.1 +++ ipc.h 1 Mar 2004 23:11:28 -0000 1.2 @@ -15,18 +15,18 @@ IPC_BUNDLE_LABEL_FIND, IPC_LAST -} ex_ipc_call; +} Ecore_Config_Ipc_Call; -Ecore_Config_Server *srv2ecore_config_srv(void *srv); +Ecore_Config_Server *_ecore_config_server_convert(void *srv); -char *ipc_prop_list(Ecore_Config_Server *srv, const long serial); -char *ipc_prop_desc(Ecore_Config_Server *srv, const long serial,const char *key); -char *ipc_prop_get(Ecore_Config_Server *srv, const long serial,const char *key); -int ipc_prop_set(Ecore_Config_Server *srv, const long serial,const char *key,const char *val); +char *_ecore_config_ipc_prop_list(Ecore_Config_Server *srv, const long serial); +char *_ecore_config_ipc_prop_desc(Ecore_Config_Server *srv, const long serial,const char *key); +char *_ecore_config_ipc_prop_get(Ecore_Config_Server *srv, const long serial,const char *key); +int _ecore_config_ipc_prop_set(Ecore_Config_Server *srv, const long serial,const char *key,const char *val); -char *ipc_bundle_list(Ecore_Config_Server *srv); -int ipc_bundle_new(Ecore_Config_Server *srv, const char *); -char *ipc_bundle_label_get(Ecore_Config_Server *srv, const long); -int ipc_bundle_label_set(Ecore_Config_Server *srv, const long,const char *); -long ipc_bundle_label_find(Ecore_Config_Server *srv, const char *); +char *_ecore_config_ipc_bundle_list(Ecore_Config_Server *srv); +int _ecore_config_ipc_bundle_new(Ecore_Config_Server *srv, const char *); +char *_ecore_config_ipc_bundle_label_get(Ecore_Config_Server *srv, const long); +int _ecore_config_ipc_bundle_label_set(Ecore_Config_Server *srv, const long,const char *); +long _ecore_config_ipc_bundle_label_find(Ecore_Config_Server *srv, const char *); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ipc_ecore.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- ipc_ecore.c 15 Feb 2004 22:43:48 -0000 1.5 +++ ipc_ecore.c 1 Mar 2004 23:11:28 -0000 1.6 @@ -22,7 +22,7 @@ -static int get_string(char **m,char **r) { +static int _ecore_config_ipc_ecore_get_string(char **m,char **r) { char *q; int l=0; @@ -51,7 +51,7 @@ -static int send(Ecore_Ipc_Event_Client_Data *e,int code,char *reply) { +static int _ecore_config_ipc_ecore_send(Ecore_Ipc_Event_Client_Data *e,int code,char *reply) { static int our_ref=0; int len=reply?strlen(reply)+1:0; our_ref++; @@ -65,53 +65,55 @@ /*****************************************************************************/ -static int handle_request(Ecore_Ipc_Server *server,Ecore_Ipc_Event_Client_Data *e) { +static int _ecore_config_ipc_ecore_handle_request(Ecore_Ipc_Server *server,Ecore_Ipc_Event_Client_Data *e) { Ecore_Config_Server *srv; - long serial=e->minor; + long serial; int ret=ECORE_CONFIG_ERR_FAIL; - char *r=NULL,*k,*v,*m=(char *)e->data; - srv=srv2ecore_config_srv(server); + char *r=NULL,*k,*v,*m; + srv=_ecore_config_server_convert(server); + serial=e->minor; + m=(char *)e->data; E(1,"IPC/eCore: client sent: [%d,%d] #%d (%d) @ %p\n",e->major,e->minor,e->ref,e->size,server); switch(e->major) { case IPC_PROP_LIST: - r=ipc_prop_list(srv, serial); + r=_ecore_config_ipc_prop_list(srv, serial); break; case IPC_PROP_DESC: - if(get_string(&m,&k)==ECORE_CONFIG_ERR_SUCC) - r=ipc_prop_desc(srv, serial,k); + if(_ecore_config_ipc_ecore_get_string(&m,&k)==ECORE_CONFIG_ERR_SUCC) + r=_ecore_config_ipc_prop_desc(srv, serial,k); break; case IPC_PROP_GET: - if(get_string(&m,&k)==ECORE_CONFIG_ERR_SUCC) - r=ipc_prop_get(srv, serial,k); + if(_ecore_config_ipc_ecore_get_string(&m,&k)==ECORE_CONFIG_ERR_SUCC) + r=_ecore_config_ipc_prop_get(srv, serial,k); break; case IPC_PROP_SET: - if(get_string(&m,&k)==ECORE_CONFIG_ERR_SUCC) { - if(get_string(&m,&v)==ECORE_CONFIG_ERR_SUCC) - return send(e,ipc_prop_set(srv, serial,k,v),NULL); } + if(_ecore_config_ipc_ecore_get_string(&m,&k)==ECORE_CONFIG_ERR_SUCC) { + if(_ecore_config_ipc_ecore_get_string(&m,&v)==ECORE_CONFIG_ERR_SUCC) + return _ecore_config_ipc_ecore_send(e,_ecore_config_ipc_prop_set(srv, serial,k,v),NULL); } break; case IPC_BUNDLE_LIST: - r=ipc_bundle_list(srv); + r=_ecore_config_ipc_bundle_list(srv); break; case IPC_BUNDLE_NEW: - if(get_string(&m,&k)==ECORE_CONFIG_ERR_SUCC) - return send(e,k?ipc_bundle_new(srv, k):ECORE_CONFIG_ERR_FAIL,NULL); + if(_ecore_config_ipc_ecore_get_string(&m,&k)==ECORE_CONFIG_ERR_SUCC) + return _ecore_config_ipc_ecore_send(e,k?_ecore_config_ipc_bundle_new(srv, k):ECORE_CONFIG_ERR_FAIL,NULL); break; case IPC_BUNDLE_LABEL_SET: - if(get_string(&m,&k)==ECORE_CONFIG_ERR_SUCC) - return send(e,k?ipc_bundle_label_set(srv, serial,k):ECORE_CONFIG_ERR_FAIL,NULL); + if(_ecore_config_ipc_ecore_get_string(&m,&k)==ECORE_CONFIG_ERR_SUCC) + return _ecore_config_ipc_ecore_send(e,k?_ecore_config_ipc_bundle_label_set(srv, serial,k):ECORE_CONFIG_ERR_FAIL,NULL); break; case IPC_BUNDLE_LABEL_FIND: - if(get_string(&m,&k)==ECORE_CONFIG_ERR_SUCC) - return send(e,ipc_bundle_label_find(srv, k),NULL); + if(_ecore_config_ipc_ecore_get_string(&m,&k)==ECORE_CONFIG_ERR_SUCC) + return _ecore_config_ipc_ecore_send(e,_ecore_config_ipc_bundle_label_find(srv, k),NULL); break; case IPC_BUNDLE_LABEL_GET: - r=ipc_bundle_label_get(srv, serial); + r=_ecore_config_ipc_bundle_label_get(srv, serial); break; } - ret=send(e,r?ECORE_CONFIG_ERR_SUCC:ECORE_CONFIG_ERR_FAIL,r); + ret=_ecore_config_ipc_ecore_send(e,r?ECORE_CONFIG_ERR_SUCC:ECORE_CONFIG_ERR_FAIL,r); if(r) { free(r); return ret; } @@ -126,9 +128,11 @@ -static int ipc_client_add(void *data,int type,void *event) { - Ecore_Ipc_Server **server=(Ecore_Ipc_Server **)data; - Ecore_Ipc_Event_Client_Data *e=(Ecore_Ipc_Event_Client_Data *)event; +static int _ecore_config_ipc_client_add(void *data,int type,void *event) { + Ecore_Ipc_Server **server; + Ecore_Ipc_Event_Client_Data *e; + server=(Ecore_Ipc_Server **)data; + e=(Ecore_Ipc_Event_Client_Data *)event; if (*server != ecore_ipc_client_server_get(e->client)) return 1; @@ -138,9 +142,11 @@ -static int ipc_client_del(void *data, int type, void *event) { - Ecore_Ipc_Server **server=(Ecore_Ipc_Server **)data; - Ecore_Ipc_Event_Client_Data *e=(Ecore_Ipc_Event_Client_Data *)event; +static int _ecore_config_ipc_client_del(void *data, int type, void *event) { + Ecore_Ipc_Server **server; + Ecore_Ipc_Event_Client_Data *e; + server=(Ecore_Ipc_Server **)data; + e=(Ecore_Ipc_Event_Client_Data *)event; if (*server != ecore_ipc_client_server_get(e->client)) return 1; @@ -150,14 +156,16 @@ -static int ipc_client_sent(void *data,int type,void *event) { - Ecore_Ipc_Server **server=(Ecore_Ipc_Server **)data; - Ecore_Ipc_Event_Client_Data *e=(Ecore_Ipc_Event_Client_Data *)event; +static int _ecore_config_ipc_client_sent(void *data,int type,void *event) { + Ecore_Ipc_Server **server; + Ecore_Ipc_Event_Client_Data *e; + server=(Ecore_Ipc_Server **)data; + e=(Ecore_Ipc_Event_Client_Data *)event; if (*server != ecore_ipc_client_server_get(e->client)) return 1; - handle_request(*server,e); + _ecore_config_ipc_ecore_handle_request(*server,e); return 1; } @@ -169,13 +177,15 @@ -int ecore_config_mod_init(char *pipe_name, void **data) { - Ecore_Ipc_Server **server=(Ecore_Ipc_Server **)data; +int _ecore_config_mod_init(char *pipe_name, void **data) { + Ecore_Ipc_Server **server; struct stat st; char *p; - int port=0; + int port; char socket[PATH_MAX]; + server=(Ecore_Ipc_Server **)data; + port=0; if(!server) return ECORE_CONFIG_ERR_FAIL; @@ -203,9 +213,9 @@ } } *server=ecore_ipc_server_add(ECORE_IPC_LOCAL_USER,pipe_name,port,NULL); - ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, ipc_client_add, server); - ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, ipc_client_del, server); - ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA,ipc_client_sent,server); + ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, _ecore_config_ipc_client_add, server); + ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, _ecore_config_ipc_client_del, server); + ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA,_ecore_config_ipc_client_sent,server); if(server) { E(1,"IPC/eCore: Server is listening on %s.\n", pipe_name); @@ -215,9 +225,11 @@ -int ecore_config_mod_exit(void **data) { - int ret=ECORE_CONFIG_ERR_SUCC; - Ecore_Ipc_Server **server=(Ecore_Ipc_Server **)data; +int _ecore_config_mod_exit(void **data) { + int ret; + Ecore_Ipc_Server **server; + ret=ECORE_CONFIG_ERR_SUCC; + server=(Ecore_Ipc_Server **)data; if(!server) return ECORE_CONFIG_ERR_FAIL; @@ -239,8 +251,9 @@ -int ecore_config_mod_poll(void **data) { - Ecore_Ipc_Server **server=(Ecore_Ipc_Server **)data; +int _ecore_config_mod_poll(void **data) { + Ecore_Ipc_Server **server; + server=(Ecore_Ipc_Server **)data; if(!server) return ECORE_CONFIG_ERR_FAIL; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ipc_main.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- ipc_main.c 1 Feb 2004 21:22:38 -0000 1.9 +++ ipc_main.c 1 Mar 2004 23:11:28 -0000 1.10 @@ -21,23 +21,23 @@ # define TRUE (!FALSE) #endif -typedef struct _ipc { +typedef struct _ecore_config_ipc { void *lib; void *data; int (*ipc_init)(char *pipe_name,void **data); int (*ipc_exit)(void **data); int (*ipc_poll)(void **data); - struct _ipc *next; -} ipc; + struct _ecore_config_ipc *next; +} Ecore_Config_Ipc; -static ipc *ipc_modules=NULL; +static Ecore_Config_Ipc *ipc_modules=NULL; static unsigned long ipc_timer=0L; -Ecore_Config_Server *srv2ecore_config_srv(void *srv) { - ipc *ipc_tmp; +Ecore_Config_Server *_ecore_config_server_convert(void *srv) { + Ecore_Config_Ipc *ipc_tmp; Ecore_Config_Server *srv_tmp; ipc_tmp = ipc_modules; @@ -51,7 +51,7 @@ ipc_tmp = ipc_tmp->next; } - return __server_global; + return __ecore_config_server_global; } /*****************************************************************************/ @@ -60,12 +60,16 @@ -char *ipc_prop_list(Ecore_Config_Server *srv, const long serial) { - Ecore_Config_Bundle *theme=ecore_config_bundle_get_by_serial(srv, serial); - Ecore_Config_Prop *e=theme?theme->data:NULL; - estring *s=estring_new(8192); - int f=0; - +char *_ecore_config_ipc_prop_list(Ecore_Config_Server *srv, const long serial) { + Ecore_Config_Bundle *theme; + Ecore_Config_Prop *e; + estring *s; + int f; + + theme=ecore_config_bundle_get_by_serial(srv, serial); + e=theme?theme->data:NULL; + s=estring_new(8192); + f=0; while(e) { estring_appendf(s,"%s%s: %s",f?"\n":"",e->key,ecore_config_get_type(e)); if(e->flags&PF_BOUNDS) { @@ -81,10 +85,12 @@ -char *ipc_prop_desc(Ecore_Config_Server *srv, const long serial,const char *key) { +char *_ecore_config_ipc_prop_desc(Ecore_Config_Server *srv, const long serial,const char *key) { #ifdef HAVE_EVAS2 - Ecore_Config_Bundle *theme=ecore_config_bundle_get_by_serial(srv, serial); - Ecore_Config_Prop *e=ecore_config_get(theme,key); + Ecore_Config_Bundle *theme; + Ecore_Config_Prop *e; + theme=ecore_config_bundle_get_by_serial(srv, serial); + e=ecore_config_get(theme,key); if(e) { estring *s=estring_new(512); @@ -97,10 +103,12 @@ -char *ipc_prop_get(Ecore_Config_Server *srv, const long serial,const char *key) { +char *_ecore_config_ipc_prop_get(Ecore_Config_Server *srv, const long serial,const char *key) { #ifdef HAVE_EVAS2 - char *ret=NULL; - Ecore_Config_Bundle *theme=ecore_config_bundle_get_by_serial(srv, serial); + char *ret; + Ecore_Config_Bundle *theme; + ret=NULL; + theme=ecore_config_bundle_get_by_serial(srv, serial); if((ret=ecore_config_get_as_string(/*theme,*/key))) return ret; #endif @@ -108,11 +116,12 @@ -int ipc_prop_set(Ecore_Config_Server *srv, const long serial,const char *key,const char *val) { +int _ecore_config_ipc_prop_set(Ecore_Config_Server *srv, const long serial,const char *key,const char *val) { #ifdef HAVE_EVAS2 int ret; - Ecore_Config_Bundle *theme=ecore_config_bundle_get_by_serial(srv, serial); + Ecore_Config_Bundle *theme; ret=ecore_config_set(theme,key,(char *)val); + theme=ecore_config_bundle_get_by_serial(srv, serial); E(1,"ipc.prop.set(%s->%s,\"%s\") => %d\n",theme->identifier,key,val,ret); return ret; #else @@ -124,11 +133,14 @@ /*****************************************************************************/ -char *ipc_bundle_list(Ecore_Config_Server *srv) { - Ecore_Config_Bundle *ns=ecore_config_bundle_get_1st(srv); - estring *s=estring_new(8192); - int f=0; - +char *_ecore_config_ipc_bundle_list(Ecore_Config_Server *srv) { + Ecore_Config_Bundle *ns; + estring *s; + int f; + + ns=ecore_config_bundle_get_1st(srv); + s=estring_new(8192); + f=0; if(!ns) return strdup("<no_bundles_created>"); @@ -141,22 +153,25 @@ -int ipc_bundle_new(Ecore_Config_Server *srv, const char *label) { +int _ecore_config_ipc_bundle_new(Ecore_Config_Server *srv, const char *label) { if (ecore_config_bundle_new(srv, label)) return ECORE_CONFIG_ERR_SUCC; return ECORE_CONFIG_ERR_FAIL; } -char *ipc_bundle_label_get(Ecore_Config_Server *srv, const long serial) { - Ecore_Config_Bundle *ns=ecore_config_bundle_get_by_serial(srv, serial); - char *label=ecore_config_bundle_get_label(ns); +char *_ecore_config_ipc_bundle_label_get(Ecore_Config_Server *srv, const long serial) { + Ecore_Config_Bundle *ns; + char *label; + ns=ecore_config_bundle_get_by_serial(srv, serial); + label=ecore_config_bundle_get_label(ns); return strdup(label?label:"<no such bundle>"); } -int ipc_bundle_label_set(Ecore_Config_Server *srv, const long serial,const char *label) { - Ecore_Config_Bundle *ns=ecore_config_bundle_get_by_serial(srv, serial); +int _ecore_config_ipc_bundle_label_set(Ecore_Config_Server *srv, const long serial,const char *label) { + Ecore_Config_Bundle *ns; + ns=ecore_config_bundle_get_by_serial(srv, serial); if (!(ns->identifier=malloc(sizeof(label)))) return ECORE_CONFIG_ERR_OOM; memcpy(ns->identifier,label,sizeof(label)); @@ -164,17 +179,19 @@ -long ipc_bundle_label_find(Ecore_Config_Server *srv, const char *label) { - Ecore_Config_Bundle *ns=ecore_config_bundle_get_by_label(srv, label); +long _ecore_config_ipc_bundle_label_find(Ecore_Config_Server *srv, const char *label) { + Ecore_Config_Bundle *ns; + ns=ecore_config_bundle_get_by_label(srv, label); return ns?ecore_config_bundle_get_serial(ns):-1; } -static int ipc_poll(void *data) { - ipc *m=(ipc *)data; +static int _ecore_config_ipc_poll(void *data) { + Ecore_Config_Ipc *m; Ecore_Config_Server *s; + m=(Ecore_Config_Ipc *)data; while(m) { s = m->data; while (s) { @@ -187,8 +204,8 @@ -int ipc_exit(void) { - ipc *m; +int _ecore_config_ipc_exit(void) { + Ecore_Config_Ipc *m; Ecore_Config_Server *l; if(ipc_timer) @@ -206,14 +223,17 @@ -Ecore_Config_Server *ipc_init(char *pipe_name) { +Ecore_Config_Server *_ecore_config_ipc_init(char *pipe_name) { char buf[PATH_MAX]; glob_t globbuf; int ret; unsigned int c; - ipc *nm=NULL; - Ecore_Config_Server *list=NULL; - Ecore_Config_Server *ret_srv=NULL; + Ecore_Config_Ipc *nm; + Ecore_Config_Server *list; + Ecore_Config_Server *ret_srv; + nm=NULL; + list=NULL; + ret_srv=NULL; if (nm) { list=(Ecore_Config_Server *)nm->data; @@ -233,11 +253,11 @@ list=malloc(sizeof(Ecore_Config_Server)); memset(list, 0, sizeof(Ecore_Config_Server)); if((ret=nm->ipc_init(pipe_name,&list->server))!=ECORE_CONFIG_ERR_SUCC) { - E(2,"ipc_init: failed to register %s, code %d\n", pipe_name, ret); + E(2,"_ecore_config_ipc_init: failed to register %s, code %d\n", pipe_name, ret); break; } - E(2,"ipc_init: registered \"%s\"...\n",pipe_name); + E(2,"_ecore_config_ipc_init: registered \"%s\"...\n",pipe_name); list->name=strdup(pipe_name); list->next=nm->data; @@ -259,30 +279,30 @@ return NULL; for(c=0;c<globbuf.gl_pathc;c++) { - if(!(nm=malloc(sizeof(ipc)))) { + if(!(nm=malloc(sizeof(Ecore_Config_Ipc)))) { ret=ECORE_CONFIG_ERR_OOM; goto done; } - memset(nm,0,sizeof(ipc)); + memset(nm,0,sizeof(Ecore_Config_Ipc)); - E(1,"ipc_init: checking \"%s\"...\n",globbuf.gl_pathv[c]); + E(1,"_ecore_config_ipc_init: checking \"%s\"...\n",globbuf.gl_pathv[c]); ret=dlmulti("IPC-plugin",globbuf.gl_pathv[c],RTLD_NOW,&nm->lib, - "!ecore_config_mod_init !ecore_config_mod_exit !ecore_config_mod_poll", + "!_ecore_config_mod_init !_ecore_config_mod_exit !_ecore_config_mod_poll", &nm->ipc_init,&nm->ipc_exit,&nm->ipc_poll); if(ret==ECORE_CONFIG_ERR_NODATA) - E(0,"ipc_init: could not load \"%s\": %s...\n",globbuf.gl_pathv[c],dlerror()); + E(0,"_ecore_config_ipc_init: could not load \"%s\": %s...\n",globbuf.gl_pathv[c],dlerror()); else if(ret==ECORE_CONFIG_ERR_SUCC) { list=malloc(sizeof(Ecore_Config_Server)); /* memcpy(list, 0, sizeof(Ecore_Config_Server));*/ if((ret=nm->ipc_init(pipe_name,&list->server))!=ECORE_CONFIG_ERR_SUCC) - E(0,"ipc_init: could not initialize \"%s\": %d\n",globbuf.gl_pathv[c],ret); + E(0,"_ecore_config_ipc_init: could not initialize \"%s\": %d\n",globbuf.gl_pathv[c],ret); else { char *p=globbuf.gl_pathv[c]; if(DEBUG!=0) { char *q=strrchr(p,DIR_DELIMITER); if(q) p=++q; } - E(0,"ipc_init: adding \"%s\"...\n",p); - E(2,"ipc_init: registered \"%s\"...\n",pipe_name); + E(0,"_ecore_config_ipc_init: adding \"%s\"...\n",p); + E(2,"_ecore_config_ipc_init: registered \"%s\"...\n",pipe_name); list->name=strdup(pipe_name); list->next=nm->data; @@ -298,11 +318,7 @@ globfree(&globbuf); if(ipc_modules) { - /* ### temporary evilness */ -/* if((debug>0)||(getenv("USER")&&!strcmp(getenv("USER"),"aje"))) { - signal(SIGINT,SIG_DFL); - signal(SIGSEGV,SIG_DFL); } */ - ipc_timer=timeout_add(100,ipc_poll,ipc_modules); } + ipc_timer=timeout_add(100,_ecore_config_ipc_poll,ipc_modules); } return ret_srv; } |