Namespaces avoid system clases - sorry

SVN revision: 16752
This commit is contained in:
handyande 2005-09-18 12:25:57 +00:00 committed by handyande
parent b515892939
commit bda13919e3
7 changed files with 125 additions and 125 deletions

View File

@ -41,22 +41,22 @@
*/ */
typedef enum Ecore_Config_Type typedef enum Ecore_Config_Type
{ {
PT_NIL = 0, /**< Property with no value. */ ECORE_CONFIG_NIL = 0, /**< Property with no value. */
PT_INT = 1, /**< Integer property type. */ ECORE_CONFIG_INT = 1, /**< Integer property type. */
PT_FLT = 2, /**< Float property type. */ ECORE_CONFIG_FLT = 2, /**< Float property type. */
PT_STR = 3, /**< String property type. */ ECORE_CONFIG_STR = 3, /**< String property type. */
PT_RGB = 4, /**< Colour property type. */ ECORE_CONFIG_RGB = 4, /**< Colour property type. */
PT_THM = 5, /**< Theme property type. */ ECORE_CONFIG_THM = 5, /**< Theme property type. */
PT_BLN = 6, /**< Boolean property type. */ ECORE_CONFIG_BLN = 6, /**< Boolean property type. */
} Ecore_Config_Type; } Ecore_Config_Type;
typedef enum Ecore_Config_Flag typedef enum Ecore_Config_Flag
{ {
PF_NONE = 0, ECORE_CONFIG_FLAG_NONE = 0,
PF_BOUNDS = 1, ECORE_CONFIG_FLAG_BOUNDS = 1,
PF_MODIFIED = 2, ECORE_CONFIG_FLAG_MODIFIED = 2,
PF_SYSTEM = 4, ECORE_CONFIG_FLAG_SYSTEM = 4,
PF_CMDLN = 8 ECORE_CONFIG_FLAG_CMDLN = 8
} Ecore_Config_Flag; } Ecore_Config_Flag;
/** /**

View File

@ -80,7 +80,7 @@ ecore_config_dst(Ecore_Config_Prop * e)
if (e->key) if (e->key)
free(e->key); free(e->key);
if (e->ptr && (e->type == PT_STR)) if (e->ptr && (e->type == ECORE_CONFIG_STR))
free(e->ptr); free(e->ptr);
memset(e, 0, sizeof(Ecore_Config_Prop)); memset(e, 0, sizeof(Ecore_Config_Prop));
@ -150,7 +150,7 @@ ecore_config_data_get(const char *key)
Ecore_Config_Prop *e; Ecore_Config_Prop *e;
e = ecore_config_get(key); e = ecore_config_get(key);
return (e ? ((e->type == PT_STR) ? ((void *)&e->ptr) : ((void *)&e->val)) return (e ? ((e->type == ECORE_CONFIG_STR) ? ((void *)&e->ptr) : ((void *)&e->val))
: NULL); : NULL);
} }
@ -167,7 +167,7 @@ ecore_config_string_get(const char *key)
Ecore_Config_Prop *e; Ecore_Config_Prop *e;
e = ecore_config_get(key); e = ecore_config_get(key);
return (e && (e->type == PT_STR)) ? strdup(e->ptr) : NULL; return (e && (e->type == ECORE_CONFIG_STR)) ? strdup(e->ptr) : NULL;
} }
/** /**
@ -183,7 +183,7 @@ ecore_config_boolean_get(const char *key)
Ecore_Config_Prop *e; Ecore_Config_Prop *e;
e = ecore_config_get(key); e = ecore_config_get(key);
return (e && ((e->type == PT_INT) || (e->type == PT_BLN))) ? (e->val != 0) : -1; return (e && ((e->type == ECORE_CONFIG_INT) || (e->type == ECORE_CONFIG_BLN))) ? (e->val != 0) : -1;
} }
/** /**
@ -199,7 +199,7 @@ ecore_config_int_get(const char *key)
Ecore_Config_Prop *e; Ecore_Config_Prop *e;
e = ecore_config_get(key); e = ecore_config_get(key);
return (e && ((e->type == PT_INT) || (e->type == PT_RGB))) ? e->val : 0L; return (e && ((e->type == ECORE_CONFIG_INT) || (e->type == ECORE_CONFIG_RGB))) ? e->val : 0L;
} }
/** /**
@ -217,7 +217,7 @@ ecore_config_float_get(const char *key)
e = ecore_config_get(key); e = ecore_config_get(key);
return (e return (e
&& (e->type == && (e->type ==
PT_FLT)) ? ((float)e->val / ECORE_CONFIG_FLOAT_PRECISION) : 0.0; ECORE_CONFIG_FLT)) ? ((float)e->val / ECORE_CONFIG_FLOAT_PRECISION) : 0.0;
} }
/** /**
@ -256,7 +256,7 @@ ecore_config_argb_get(const char *key, int *a, int *r, int *g, int *b)
e = ecore_config_get(key); e = ecore_config_get(key);
if (e && ((e->type == PT_RGB))) if (e && ((e->type == ECORE_CONFIG_RGB)))
{ {
*a = (e->val >> 24) & 0xff; *a = (e->val >> 24) & 0xff;
*r = (e->val >> 16) & 0xff; *r = (e->val >> 16) & 0xff;
@ -314,7 +314,7 @@ ecore_config_theme_get(const char *key)
Ecore_Config_Prop *e; Ecore_Config_Prop *e;
e = ecore_config_get(key); e = ecore_config_get(key);
return (e && (e->type == PT_THM)) ? strdup(e->ptr) : NULL; return (e && (e->type == ECORE_CONFIG_THM)) ? strdup(e->ptr) : NULL;
} }
/** /**
@ -339,26 +339,26 @@ ecore_config_as_string_get(const char *key)
switch (e->type) switch (e->type)
{ {
case PT_NIL: case ECORE_CONFIG_NIL:
esprintf(&r, "%s:%s=<nil>", key, type); esprintf(&r, "%s:%s=<nil>", key, type);
break; break;
case PT_INT: case ECORE_CONFIG_INT:
esprintf(&r, "%s:%s=%ld", key, type, ecore_config_int_get(key)); esprintf(&r, "%s:%s=%ld", key, type, ecore_config_int_get(key));
break; break;
case PT_BLN: case ECORE_CONFIG_BLN:
esprintf(&r, "%s:%s=%ld", key, type, ecore_config_boolean_get(key)); esprintf(&r, "%s:%s=%ld", key, type, ecore_config_boolean_get(key));
break; break;
case PT_FLT: case ECORE_CONFIG_FLT:
esprintf(&r, "%s:%s=%lf", key, type, ecore_config_float_get(key)); esprintf(&r, "%s:%s=%lf", key, type, ecore_config_float_get(key));
break; break;
case PT_STR: case ECORE_CONFIG_STR:
esprintf(&r, "%s:%s=\"%s\"", key, type, esprintf(&r, "%s:%s=\"%s\"", key, type,
ecore_config_string_get(key)); ecore_config_string_get(key));
break; break;
case PT_RGB: case ECORE_CONFIG_RGB:
esprintf(&r, "%s:%s=#%08x", key, type, ecore_config_int_get(key)); esprintf(&r, "%s:%s=#%08x", key, type, ecore_config_int_get(key));
break; break;
case PT_THM: case ECORE_CONFIG_THM:
esprintf(&r, "%s:%s=\"%s\"", key, type, esprintf(&r, "%s:%s=\"%s\"", key, type,
ecore_config_theme_get(key)); ecore_config_theme_get(key));
break; break;
@ -380,7 +380,7 @@ ecore_config_bound(Ecore_Config_Prop * e)
if (!e) if (!e)
return ECORE_CONFIG_ERR_FAIL; return ECORE_CONFIG_ERR_FAIL;
if (e->flags & PF_BOUNDS) if (e->flags & ECORE_CONFIG_FLAG_BOUNDS)
{ {
if ((e->val < e->lo)) if ((e->val < e->lo))
{ {
@ -407,7 +407,7 @@ ecore_config_bound(Ecore_Config_Prop * e)
v = ((int)(e->val / e->step)) * e->step; v = ((int)(e->val / e->step)) * e->step;
if (v != e->val) if (v != e->val)
{ {
if (e->type == PT_FLT) if (e->type == ECORE_CONFIG_FLT)
E(0, E(0,
"ecore_config_bound(\"%s\"): float value %f not a multiple of %f, adjusted to %f...\n", "ecore_config_bound(\"%s\"): float value %f not a multiple of %f, adjusted to %f...\n",
e->key, ((double)e->val) / ECORE_CONFIG_FLOAT_PRECISION, e->key, ((double)e->val) / ECORE_CONFIG_FLOAT_PRECISION,
@ -435,7 +435,7 @@ ecore_config_bound(Ecore_Config_Prop * e)
* @param key The property key. * @param key The property key.
* @param val The value in string form. * @param val The value in string form.
* @return The type of the property determined by the function. Note that if * @return The type of the property determined by the function. Note that if
* val is @c NULL, @c PT_NIL will be returned. * val is @c NULL, @c ECORE_CONFIG_NIL will be returned.
*/ */
int int
ecore_config_type_guess(const char *key, const char *val) ecore_config_type_guess(const char *key, const char *val)
@ -446,23 +446,23 @@ ecore_config_type_guess(const char *key, const char *val)
l = NULL; l = NULL;
if ((p = ecore_config_get(key)) && p->type != PT_NIL) if ((p = ecore_config_get(key)) && p->type != ECORE_CONFIG_NIL)
return p->type; return p->type;
if (!val) if (!val)
return PT_NIL; return ECORE_CONFIG_NIL;
if (val[0] == '#') if (val[0] == '#')
return PT_RGB; return ECORE_CONFIG_RGB;
v = strtol(val, &l, 10); v = strtol(val, &l, 10);
if (*l) if (*l)
{ {
float f; float f;
if (sscanf(val, "%f%*s", &f) != 1) if (sscanf(val, "%f%*s", &f) != 1)
return PT_STR; return ECORE_CONFIG_STR;
return PT_FLT; return ECORE_CONFIG_FLT;
} }
return PT_INT; return ECORE_CONFIG_INT;
} }
static int static int
@ -480,26 +480,26 @@ ecore_config_typed_val(Ecore_Config_Prop * e, const void *val, int type)
e->ptr = NULL; e->ptr = NULL;
else else
{ {
if (type == PT_INT) if (type == ECORE_CONFIG_INT)
{ {
i = (int *)val; i = (int *)val;
e->val = (long)*i; e->val = (long)*i;
e->type = PT_INT; e->type = ECORE_CONFIG_INT;
} }
else if (type == PT_BLN ) else if (type == ECORE_CONFIG_BLN )
{ {
i = (int *)val; i = (int *)val;
e->val = (long)*i; e->val = (long)*i;
e->type = PT_BLN; e->type = ECORE_CONFIG_BLN;
} }
else if (type == PT_STR || type == PT_THM) else if (type == ECORE_CONFIG_STR || type == ECORE_CONFIG_THM)
{ {
if (!(e->ptr = strdup(val))) if (!(e->ptr = strdup(val)))
return ECORE_CONFIG_ERR_OOM; return ECORE_CONFIG_ERR_OOM;
if (e->type == PT_NIL) if (e->type == ECORE_CONFIG_NIL)
e->type = type; e->type = type;
} }
else if (type == PT_RGB) else if (type == ECORE_CONFIG_RGB)
{ {
if (((char *)val)[0] == '#') if (((char *)val)[0] == '#')
{ {
@ -526,21 +526,21 @@ ecore_config_typed_val(Ecore_Config_Prop * e, const void *val, int type)
else else
{ {
e->val = v; e->val = v;
e->type = PT_RGB; e->type = ECORE_CONFIG_RGB;
} }
} }
else if (type == PT_FLT) else if (type == ECORE_CONFIG_FLT)
{ {
f = (float *)val; f = (float *)val;
e->val = (long)((*f) * ECORE_CONFIG_FLOAT_PRECISION); e->val = (long)((*f) * ECORE_CONFIG_FLOAT_PRECISION);
e->type = PT_FLT; e->type = ECORE_CONFIG_FLT;
} }
else else
e->type = PT_NIL; e->type = ECORE_CONFIG_NIL;
ecore_config_bound(e); ecore_config_bound(e);
e->flags |= PF_MODIFIED; e->flags |= ECORE_CONFIG_FLAG_MODIFIED;
e->flags = e->flags & ~PF_CMDLN; e->flags = e->flags & ~ECORE_CONFIG_FLAG_CMDLN;
return ECORE_CONFIG_ERR_SUCC; return ECORE_CONFIG_ERR_SUCC;
} }
return ECORE_CONFIG_ERR_IGNORED; return ECORE_CONFIG_ERR_IGNORED;
@ -722,12 +722,12 @@ ecore_config_set(const char *key, char *val)
float tmpf; float tmpf;
type = ecore_config_type_guess(key, val); type = ecore_config_type_guess(key, val);
if (type == PT_INT || type == PT_BLN) if (type == ECORE_CONFIG_INT || type == ECORE_CONFIG_BLN)
{ {
tmpi = atoi(val); tmpi = atoi(val);
return ecore_config_typed_set(key, (void *)&tmpi, type); return ecore_config_typed_set(key, (void *)&tmpi, type);
} }
else if (type == PT_FLT) else if (type == ECORE_CONFIG_FLT)
{ {
tmpf = atof(val); tmpf = atof(val);
return ecore_config_typed_set(key, (void *)&tmpf, type); return ecore_config_typed_set(key, (void *)&tmpf, type);
@ -760,7 +760,7 @@ int
ecore_config_boolean_set(const char *key, int val) ecore_config_boolean_set(const char *key, int val)
{ {
val = val ? 1 : 0; val = val ? 1 : 0;
return ecore_config_typed_set(key, (void *)&val, PT_BLN); return ecore_config_typed_set(key, (void *)&val, ECORE_CONFIG_BLN);
} }
/** /**
@ -773,7 +773,7 @@ ecore_config_boolean_set(const char *key, int val)
int int
ecore_config_int_set(const char *key, int val) ecore_config_int_set(const char *key, int val)
{ {
return ecore_config_typed_set(key, (void *)&val, PT_INT); return ecore_config_typed_set(key, (void *)&val, ECORE_CONFIG_INT);
} }
/** /**
@ -786,7 +786,7 @@ ecore_config_int_set(const char *key, int val)
int int
ecore_config_string_set(const char *key, char *val) ecore_config_string_set(const char *key, char *val)
{ {
return ecore_config_typed_set(key, (void *)val, PT_STR); return ecore_config_typed_set(key, (void *)val, ECORE_CONFIG_STR);
} }
/** /**
@ -799,7 +799,7 @@ ecore_config_string_set(const char *key, char *val)
int int
ecore_config_float_set(const char *key, float val) ecore_config_float_set(const char *key, float val)
{ {
return ecore_config_typed_set(key, (void *)&val, PT_FLT); return ecore_config_typed_set(key, (void *)&val, ECORE_CONFIG_FLT);
} }
char * char *
@ -843,7 +843,7 @@ ecore_config_rgb_set(const char *key, char *val)
int int
ecore_config_argb_set(const char *key, char *val) ecore_config_argb_set(const char *key, char *val)
{ {
return ecore_config_typed_set(key, (void *)val, PT_RGB); return ecore_config_typed_set(key, (void *)val, ECORE_CONFIG_RGB);
} }
/** /**
@ -856,7 +856,7 @@ ecore_config_argb_set(const char *key, char *val)
int int
ecore_config_theme_set(const char *key, char *val) ecore_config_theme_set(const char *key, char *val)
{ {
return ecore_config_typed_set(key, (void *)val, PT_THM); return ecore_config_typed_set(key, (void *)val, ECORE_CONFIG_THM);
} }
/** /**
@ -875,7 +875,7 @@ ecore_config_theme_preview_group_set(const char *key, char *group)
ret = ECORE_CONFIG_ERR_SUCC; ret = ECORE_CONFIG_ERR_SUCC;
if (!(e = ecore_config_get(key))) if (!(e = ecore_config_get(key)))
{ /* prop doesn't exist yet */ { /* prop doesn't exist yet */
if ((ret = ecore_config_typed_add(key, "", PT_THM)) != ECORE_CONFIG_ERR_SUCC) /* try to add it */ if ((ret = ecore_config_typed_add(key, "", ECORE_CONFIG_THM)) != ECORE_CONFIG_ERR_SUCC) /* try to add it */
return ret; /* ...failed */ return ret; /* ...failed */
if (!(e = ecore_config_get(key))) /* get handle */ if (!(e = ecore_config_get(key))) /* get handle */
return ECORE_CONFIG_ERR_FAIL; return ECORE_CONFIG_ERR_FAIL;
@ -901,14 +901,14 @@ ecore_config_typed_default(const char *key, void *val, int type)
return ret; /* ...failed */ return ret; /* ...failed */
if (!(e = ecore_config_get(key))) /* get handle */ if (!(e = ecore_config_get(key))) /* get handle */
return ECORE_CONFIG_ERR_FAIL; return ECORE_CONFIG_ERR_FAIL;
e->flags = e->flags & ~PF_MODIFIED; e->flags = e->flags & ~ECORE_CONFIG_FLAG_MODIFIED;
} }
else if (!(e->flags & PF_MODIFIED) && !(e->flags & PF_SYSTEM)) else if (!(e->flags & ECORE_CONFIG_FLAG_MODIFIED) && !(e->flags & ECORE_CONFIG_FLAG_SYSTEM))
{ {
ecore_config_typed_set(key, val, type); ecore_config_typed_set(key, val, type);
if (!(e = ecore_config_get(key))) /* get handle */ if (!(e = ecore_config_get(key))) /* get handle */
return ECORE_CONFIG_ERR_FAIL; return ECORE_CONFIG_ERR_FAIL;
e->flags = e->flags & ~PF_MODIFIED; e->flags = e->flags & ~ECORE_CONFIG_FLAG_MODIFIED;
} }
return ret; return ret;
} }
@ -942,18 +942,18 @@ ecore_config_default(const char *key, char *val, float lo, float hi, float step)
e = ecore_config_get(key); e = ecore_config_get(key);
if (e) if (e)
{ {
if (type == PT_INT) if (type == ECORE_CONFIG_INT)
{ {
e->step = step; e->step = step;
e->flags |= PF_BOUNDS; e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
e->lo = lo; e->lo = lo;
e->hi = hi; e->hi = hi;
ecore_config_bound(e); ecore_config_bound(e);
} }
else if (type == PT_FLT) else if (type == ECORE_CONFIG_FLT)
{ {
e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION); e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION);
e->flags |= PF_BOUNDS; e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
e->lo = (int)(lo * ECORE_CONFIG_FLOAT_PRECISION); e->lo = (int)(lo * ECORE_CONFIG_FLOAT_PRECISION);
e->hi = (int)(hi * ECORE_CONFIG_FLOAT_PRECISION); e->hi = (int)(hi * ECORE_CONFIG_FLOAT_PRECISION);
ecore_config_bound(e); ecore_config_bound(e);
@ -975,7 +975,7 @@ int
ecore_config_boolean_default(const char *key, int val) ecore_config_boolean_default(const char *key, int val)
{ {
val = val ? 1 : 0; val = val ? 1 : 0;
return ecore_config_typed_default(key, (void *)&val, PT_BLN); return ecore_config_typed_default(key, (void *)&val, ECORE_CONFIG_BLN);
} }
/** /**
@ -989,7 +989,7 @@ ecore_config_boolean_default(const char *key, int val)
int int
ecore_config_int_default(const char *key, int val) ecore_config_int_default(const char *key, int val)
{ {
return ecore_config_typed_default(key, (void *)&val, PT_INT); return ecore_config_typed_default(key, (void *)&val, ECORE_CONFIG_INT);
} }
/** /**
@ -1013,12 +1013,12 @@ ecore_config_int_default_bound(const char *key, int val, int low, int high,
Ecore_Config_Prop *e; Ecore_Config_Prop *e;
int ret; int ret;
ret = ecore_config_typed_default(key, (void *)&val, PT_INT); ret = ecore_config_typed_default(key, (void *)&val, ECORE_CONFIG_INT);
e = ecore_config_get(key); e = ecore_config_get(key);
if (e) if (e)
{ {
e->step = step; e->step = step;
e->flags |= PF_BOUNDS; e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
e->lo = low; e->lo = low;
e->hi = high; e->hi = high;
ecore_config_bound(e); ecore_config_bound(e);
@ -1038,7 +1038,7 @@ ecore_config_int_default_bound(const char *key, int val, int low, int high,
int int
ecore_config_string_default(const char *key, const char *val) ecore_config_string_default(const char *key, const char *val)
{ {
return ecore_config_typed_default(key, (void *)val, PT_STR); return ecore_config_typed_default(key, (void *)val, ECORE_CONFIG_STR);
} }
/** /**
@ -1052,7 +1052,7 @@ ecore_config_string_default(const char *key, const char *val)
int int
ecore_config_float_default(const char *key, float val) ecore_config_float_default(const char *key, float val)
{ {
return ecore_config_typed_default(key, (void *)&val, PT_FLT); return ecore_config_typed_default(key, (void *)&val, ECORE_CONFIG_FLT);
} }
/** /**
@ -1076,12 +1076,12 @@ ecore_config_float_default_bound(const char *key, float val, float low,
Ecore_Config_Prop *e; Ecore_Config_Prop *e;
int ret; int ret;
ret = ecore_config_typed_default(key, (void *)&val, PT_FLT); ret = ecore_config_typed_default(key, (void *)&val, ECORE_CONFIG_FLT);
e = ecore_config_get(key); e = ecore_config_get(key);
if (e) if (e)
{ {
e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION); e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION);
e->flags |= PF_BOUNDS; e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
e->lo = (int)(low * ECORE_CONFIG_FLOAT_PRECISION); e->lo = (int)(low * ECORE_CONFIG_FLOAT_PRECISION);
e->hi = (int)(high * ECORE_CONFIG_FLOAT_PRECISION); e->hi = (int)(high * ECORE_CONFIG_FLOAT_PRECISION);
ecore_config_bound(e); ecore_config_bound(e);
@ -1122,7 +1122,7 @@ ecore_config_rgb_default(const char *key, char *val)
int int
ecore_config_argb_default(const char *key, char *val) ecore_config_argb_default(const char *key, char *val)
{ {
return ecore_config_typed_default(key, (void *)val, PT_RGB); return ecore_config_typed_default(key, (void *)val, ECORE_CONFIG_RGB);
} }
/** /**
@ -1136,7 +1136,7 @@ ecore_config_argb_default(const char *key, char *val)
int int
ecore_config_theme_default(const char *key, char *val) ecore_config_theme_default(const char *key, char *val)
{ {
return ecore_config_typed_default(key, (void *)val, PT_THM); return ecore_config_typed_default(key, (void *)val, ECORE_CONFIG_THM);
} }
/** /**
@ -1206,7 +1206,7 @@ ecore_config_listen(const char *name, const char *key,
l->next = e->listeners; l->next = e->listeners;
e->listeners = l; e->listeners = l;
if (e->type != PT_NIL) /* call right on creation if prop exists and has val */ if (e->type != ECORE_CONFIG_NIL) /* call right on creation if prop exists and has val */
listener(key, e->type, tag, data); listener(key, e->type, tag, data);
return ECORE_CONFIG_ERR_SUCC; return ECORE_CONFIG_ERR_SUCC;
@ -1485,8 +1485,8 @@ ecore_config_init(const char *name)
list = ecore_config_get("/e/themes/search_path"); list = ecore_config_get("/e/themes/search_path");
if (list) if (list)
{ {
list->flags |= PF_SYSTEM; list->flags |= ECORE_CONFIG_FLAG_SYSTEM;
list->flags &= ~PF_MODIFIED; list->flags &= ~ECORE_CONFIG_FLAG_MODIFIED;
} }
return _ecore_config_system_load(); return _ecore_config_system_load();
@ -1585,9 +1585,9 @@ _ecore_config_system_load(void)
while (sys) while (sys)
{ {
/* unmark it modified - modification will mean it has been overridden */ /* unmark it modified - modification will mean it has been overridden */
sys->flags &= ~PF_MODIFIED; sys->flags &= ~ECORE_CONFIG_FLAG_MODIFIED;
/* mark as system so that examine can hide them */ /* mark as system so that examine can hide them */
sys->flags |= PF_SYSTEM; sys->flags |= ECORE_CONFIG_FLAG_SYSTEM;
sys = sys->next; sys = sys->next;
} }
} }

View File

@ -95,16 +95,16 @@ _ecore_config_db_key_type_get(Ecore_Config_DB_File *db, const char *key)
if (size <= 2) if (size <= 2)
{ {
free(data); free(data);
return PT_NIL; return ECORE_CONFIG_NIL;
} }
if (data[size - 1] != 0) if (data[size - 1] != 0)
{ {
free(data); free(data);
return PT_NIL; return ECORE_CONFIG_NIL;
} }
return (Ecore_Config_Type) data[0]; return (Ecore_Config_Type) data[0];
} }
return PT_NIL; return ECORE_CONFIG_NIL;
} }
int int
@ -145,8 +145,8 @@ _ecore_config_db_read(Ecore_Config_DB_File *db, const char *key)
switch (type) switch (type)
{ {
case PT_INT: case ECORE_CONFIG_INT:
case PT_BLN: case ECORE_CONFIG_BLN:
{ {
int tmp; int tmp;
prev_locale = setlocale(LC_NUMERIC, "C"); prev_locale = setlocale(LC_NUMERIC, "C");
@ -156,7 +156,7 @@ _ecore_config_db_read(Ecore_Config_DB_File *db, const char *key)
ecore_config_typed_set(key, (void *)&tmp, type); ecore_config_typed_set(key, (void *)&tmp, type);
break; break;
} }
case PT_FLT: case ECORE_CONFIG_FLT:
{ {
float tmp; float tmp;
prev_locale = setlocale(LC_NUMERIC, "C"); prev_locale = setlocale(LC_NUMERIC, "C");
@ -166,9 +166,9 @@ _ecore_config_db_read(Ecore_Config_DB_File *db, const char *key)
ecore_config_typed_set(key, (void *)&tmp, type); ecore_config_typed_set(key, (void *)&tmp, type);
break; break;
} }
case PT_STR: case ECORE_CONFIG_STR:
case PT_RGB: case ECORE_CONFIG_RGB:
case PT_THM: case ECORE_CONFIG_THM:
ecore_config_typed_set(key, (void *)value, type); ecore_config_typed_set(key, (void *)value, type);
break; break;
default: default:
@ -234,27 +234,27 @@ _ecore_config_db_write(Ecore_Config_DB_File *db, const char *key)
switch (type) switch (type)
{ {
case PT_INT: case ECORE_CONFIG_INT:
num = snprintf(buf, sizeof(buf), "%c %i ", (char) type, num = snprintf(buf, sizeof(buf), "%c %i ", (char) type,
(int) ecore_config_int_get(key)); (int) ecore_config_int_get(key));
break; break;
case PT_BLN: case ECORE_CONFIG_BLN:
num = snprintf(buf, sizeof(buf), "%c %i ", (char) type, num = snprintf(buf, sizeof(buf), "%c %i ", (char) type,
(int) ecore_config_boolean_get(key)); (int) ecore_config_boolean_get(key));
break; break;
case PT_FLT: case ECORE_CONFIG_FLT:
num = snprintf(buf, sizeof(buf), "%c %16.16f ", (char) type, num = snprintf(buf, sizeof(buf), "%c %16.16f ", (char) type,
ecore_config_float_get(key)); ecore_config_float_get(key));
break; break;
case PT_STR: case ECORE_CONFIG_STR:
num = snprintf(buf, sizeof(buf), "%c %s ", (char) type, num = snprintf(buf, sizeof(buf), "%c %s ", (char) type,
ecore_config_string_get(key)); ecore_config_string_get(key));
break; break;
case PT_THM: case ECORE_CONFIG_THM:
num = snprintf(buf, sizeof(buf), "%c %s ", (char) type, num = snprintf(buf, sizeof(buf), "%c %s ", (char) type,
ecore_config_theme_get(key)); ecore_config_theme_get(key));
break; break;
case PT_RGB: case ECORE_CONFIG_RGB:
num = snprintf(buf, sizeof(buf), "%c %s ", (char) type, num = snprintf(buf, sizeof(buf), "%c %s ", (char) type,
ecore_config_argbstr_get(key)); ecore_config_argbstr_get(key));
break; break;
@ -277,7 +277,7 @@ _ecore_config_db_key_data_set(Ecore_Config_DB_File *db, const char *key, void *d
num = 1 + 1 + data_size + 1; num = 1 + 1 + data_size + 1;
buf = malloc(num); buf = malloc(num);
if (!buf) return; if (!buf) return;
buf[0] = (char) PT_BIN; buf[0] = (char) ECORE_CONFIG_BIN;
buf[1] = 0; buf[1] = 0;
memcpy(buf + 2, data, data_size); memcpy(buf + 2, data, data_size);
buf[num - 1] = 0; buf[num - 1] = 0;

View File

@ -101,7 +101,7 @@ ecore_config_boolean_create(const char *key, int val, char short_opt,
char *long_opt, char *desc) char *long_opt, char *desc)
{ {
return return
ecore_config_typed_create(key, (void *)&val, PT_BLN, short_opt, long_opt, ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_BLN, short_opt, long_opt,
desc); desc);
} }
@ -122,7 +122,7 @@ ecore_config_int_create(const char *key, int val, char short_opt,
char *long_opt, char *desc) char *long_opt, char *desc)
{ {
return return
ecore_config_typed_create(key, (void *)&val, PT_INT, short_opt, long_opt, ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_INT, short_opt, long_opt,
desc); desc);
} }
@ -150,7 +150,7 @@ ecore_config_int_create_bound(const char *key, int val, int low, int high,
int ret; int ret;
ret = ret =
ecore_config_typed_create(key, (void *)&val, PT_INT, short_opt, long_opt, ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_INT, short_opt, long_opt,
desc); desc);
if (ret != ECORE_CONFIG_ERR_SUCC) if (ret != ECORE_CONFIG_ERR_SUCC)
return ret; return ret;
@ -158,7 +158,7 @@ ecore_config_int_create_bound(const char *key, int val, int low, int high,
if (e) if (e)
{ {
e->step = step; e->step = step;
e->flags |= PF_BOUNDS; e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
e->lo = low; e->lo = low;
e->hi = high; e->hi = high;
ecore_config_bound(e); ecore_config_bound(e);
@ -183,7 +183,7 @@ ecore_config_string_create(const char *key, char *val, char short_opt,
char *long_opt, char *desc) char *long_opt, char *desc)
{ {
return return
ecore_config_typed_create(key, (void *)val, PT_STR, short_opt, long_opt, ecore_config_typed_create(key, (void *)val, ECORE_CONFIG_STR, short_opt, long_opt,
desc); desc);
} }
@ -204,7 +204,7 @@ ecore_config_float_create(const char *key, float val, char short_opt,
char *long_opt, char *desc) char *long_opt, char *desc)
{ {
return return
ecore_config_typed_create(key, (void *)&val, PT_FLT, short_opt, long_opt, ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_FLT, short_opt, long_opt,
desc); desc);
} }
@ -232,13 +232,13 @@ ecore_config_float_create_bound(const char *key, float val, float low,
int ret; int ret;
ret = ret =
ecore_config_typed_create(key, (void *)&val, PT_FLT, short_opt, long_opt, ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_FLT, short_opt, long_opt,
desc); desc);
e = ecore_config_get(key); e = ecore_config_get(key);
if (e) if (e)
{ {
e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION); e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION);
e->flags |= PF_BOUNDS; e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
e->lo = (int)(low * ECORE_CONFIG_FLOAT_PRECISION); e->lo = (int)(low * ECORE_CONFIG_FLOAT_PRECISION);
e->hi = (int)(high * ECORE_CONFIG_FLOAT_PRECISION); e->hi = (int)(high * ECORE_CONFIG_FLOAT_PRECISION);
ecore_config_bound(e); ecore_config_bound(e);
@ -289,7 +289,7 @@ ecore_config_argb_create(const char *key, char *val, char short_opt,
char *long_opt, char *desc) char *long_opt, char *desc)
{ {
return return
ecore_config_typed_create(key, (void *)val, PT_RGB, short_opt, long_opt, ecore_config_typed_create(key, (void *)val, ECORE_CONFIG_RGB, short_opt, long_opt,
desc); desc);
} }
@ -310,7 +310,7 @@ ecore_config_theme_create(const char *key, char *val, char short_opt,
char *long_opt, char *desc) char *long_opt, char *desc)
{ {
return return
ecore_config_typed_create(key, (void *)val, PT_THM, short_opt, long_opt, ecore_config_typed_create(key, (void *)val, ECORE_CONFIG_THM, short_opt, long_opt,
desc); desc);
} }
@ -458,7 +458,7 @@ ecore_config_theme_search_path_append(char *path)
ecore_config_string_set("/e/themes/search_path", new_search_path); ecore_config_string_set("/e/themes/search_path", new_search_path);
prop = ecore_config_get("/e/themes/search_path"); prop = ecore_config_get("/e/themes/search_path");
if (prop) if (prop)
prop->flags &= ~PF_MODIFIED; prop->flags &= ~ECORE_CONFIG_FLAG_MODIFIED;
free(new_search_path); free(new_search_path);
@ -560,7 +560,7 @@ ecore_config_args_display(void)
while (props) while (props)
{ {
/* if it is a system prop, or cannot be set on command line hide it */ /* if it is a system prop, or cannot be set on command line hide it */
if (props->flags & PF_SYSTEM || (!props->short_opt && !props->long_opt)) if (props->flags & ECORE_CONFIG_FLAG_SYSTEM || (!props->short_opt && !props->long_opt))
{ {
props = props->next; props = props->next;
continue; continue;
@ -605,7 +605,7 @@ ecore_config_parse_set(Ecore_Config_Prop * prop, char *arg, char *opt,
else else
{ {
ecore_config_set(prop->key, arg); ecore_config_set(prop->key, arg);
prop->flags |= PF_CMDLN; prop->flags |= ECORE_CONFIG_FLAG_CMDLN;
} }
return ECORE_CONFIG_PARSE_CONTINUE; return ECORE_CONFIG_PARSE_CONTINUE;
} }
@ -634,14 +634,14 @@ void
ecore_config_args_callback_str_add(char short_opt, char *long_opt, char *desc, ecore_config_args_callback_str_add(char short_opt, char *long_opt, char *desc,
void (*func)(char *val, void *data), void (*func)(char *val, void *data),
void *data) { void *data) {
ecore_config_args_callback_add(short_opt, long_opt, desc, func, data, PT_STR); ecore_config_args_callback_add(short_opt, long_opt, desc, func, data, ECORE_CONFIG_STR);
} }
void void
ecore_config_args_callback_noarg_add(char short_opt, char *long_opt, char *desc, ecore_config_args_callback_noarg_add(char short_opt, char *long_opt, char *desc,
void (*func)(char *val, void *data), void (*func)(char *val, void *data),
void *data) { void *data) {
ecore_config_args_callback_add(short_opt, long_opt, desc, func, data, PT_NIL); ecore_config_args_callback_add(short_opt, long_opt, desc, func, data, ECORE_CONFIG_NIL);
} }
/** /**
@ -717,7 +717,7 @@ ecore_config_args_parse(void)
!strcmp(long_opt, callback->long_opt))) !strcmp(long_opt, callback->long_opt)))
{ {
found = 1; found = 1;
if (callback->type == PT_NIL) if (callback->type == ECORE_CONFIG_NIL)
{ {
callback->func(NULL, callback->data); callback->func(NULL, callback->data);
} }
@ -780,7 +780,7 @@ ecore_config_args_parse(void)
if (short_opt == callback->short_opt) if (short_opt == callback->short_opt)
{ {
found = 1; found = 1;
if (callback->type == PT_NIL) if (callback->type == ECORE_CONFIG_NIL)
{ {
callback->func(NULL, callback->data); callback->func(NULL, callback->data);
} }

View File

@ -81,22 +81,22 @@ _ecore_config_ipc_global_prop_list(Ecore_Config_Server * srv __UNUSED__, long se
type = _ecore_config_db_key_type_get(db, keys[x]); type = _ecore_config_db_key_type_get(db, keys[x]);
switch (type) switch (type)
{ {
case PT_INT: case ECORE_CONFIG_INT:
estring_appendf(s, "%s%s: integer", f ? "\n" : "", keys[x]); estring_appendf(s, "%s%s: integer", f ? "\n" : "", keys[x]);
break; break;
case PT_BLN: case ECORE_CONFIG_BLN:
estring_appendf(s, "%s%s: boolean", f ? "\n" : "", keys[x]); estring_appendf(s, "%s%s: boolean", f ? "\n" : "", keys[x]);
break; break;
case PT_FLT: case ECORE_CONFIG_FLT:
estring_appendf(s, "%s%s: float", f ? "\n" : "", keys[x]); estring_appendf(s, "%s%s: float", f ? "\n" : "", keys[x]);
break; break;
case PT_STR: case ECORE_CONFIG_STR:
estring_appendf(s, "%s%s: string", f ? "\n" : "", keys[x]); estring_appendf(s, "%s%s: string", f ? "\n" : "", keys[x]);
break; break;
case PT_RGB: case ECORE_CONFIG_RGB:
estring_appendf(s, "%s%s: colour", f ? "\n" : "", keys[x]); estring_appendf(s, "%s%s: colour", f ? "\n" : "", keys[x]);
break; break;
case PT_THM: case ECORE_CONFIG_THM:
estring_appendf(s, "%s%s: theme", f ? "\n" : "", keys[x]); estring_appendf(s, "%s%s: theme", f ? "\n" : "", keys[x]);
break; break;
default: default:

View File

@ -59,23 +59,23 @@ _ecore_config_ipc_prop_list(Ecore_Config_Server * srv, const long serial)
while (e) while (e)
{ {
/* ignore system properties in listings, unless they have been overridden */ /* ignore system properties in listings, unless they have been overridden */
if (e->flags & PF_SYSTEM && !(e->flags & PF_MODIFIED)) if (e->flags & ECORE_CONFIG_FLAG_SYSTEM && !(e->flags & ECORE_CONFIG_FLAG_MODIFIED))
{ {
e = e->next; e = e->next;
continue; continue;
} }
estring_appendf(s, "%s%s: %s", f ? "\n" : "", e->key, estring_appendf(s, "%s%s: %s", f ? "\n" : "", e->key,
ecore_config_type_get(e)); ecore_config_type_get(e));
if (e->flags & PF_BOUNDS) if (e->flags & ECORE_CONFIG_FLAG_BOUNDS)
{ {
if (e->type == PT_FLT) if (e->type == ECORE_CONFIG_FLT)
estring_appendf(s, ", range %le..%le", estring_appendf(s, ", range %le..%le",
(float)e->lo / ECORE_CONFIG_FLOAT_PRECISION, (float)e->lo / ECORE_CONFIG_FLOAT_PRECISION,
(float)e->hi / ECORE_CONFIG_FLOAT_PRECISION); (float)e->hi / ECORE_CONFIG_FLOAT_PRECISION);
else else
estring_appendf(s, ", range %d..%d", e->lo, e->hi); estring_appendf(s, ", range %d..%d", e->lo, e->hi);
} }
if (e->type == PT_THM) if (e->type == ECORE_CONFIG_THM)
estring_appendf(s, ", group %s", e->data ? e->data : "Main"); estring_appendf(s, ", group %s", e->data ? e->data : "Main");
f = 1; f = 1;
e = e->next; e = e->next;
@ -100,7 +100,7 @@ _ecore_config_ipc_prop_desc(Ecore_Config_Server * srv, const long serial,
estring *s = estring_new(512); estring *s = estring_new(512);
estring_appendf(s, "%s: %s", e->key, ecore_config_type_get(e)); estring_appendf(s, "%s: %s", e->key, ecore_config_type_get(e));
if (e->flags & PF_BOUNDS) if (e->flags & ECORE_CONFIG_FLAG_BOUNDS)
estring_appendf(s, ", range %d..%d", e->lo, e->hi); estring_appendf(s, ", range %d..%d", e->lo, e->hi);
return estring_disown(s); return estring_disown(s);
} }

View File

@ -156,7 +156,7 @@ ecore_config_file_save(const char *file)
* handyande: hmm, not sure that it ever does - reinstating until * handyande: hmm, not sure that it ever does - reinstating until
* further discussions satisfy me! * further discussions satisfy me!
*/ */
if (!(next->flags & PF_MODIFIED) || next->flags & PF_CMDLN) if (!(next->flags & ECORE_CONFIG_FLAG_MODIFIED) || next->flags & ECORE_CONFIG_FLAG_CMDLN)
{ {
next = next->next; next = next->next;
continue; continue;