diff options
author | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
commit | 07274513e984f0b5544586c74508ccd16e7dcafa (patch) | |
tree | b32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c | |
parent | Added Irrlicht 1.8, but without all the Windows binaries. (diff) | |
download | SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2 SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz |
Remove EFL, since it's been released now.
Diffstat (limited to 'libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c')
-rw-r--r-- | libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c | 275 |
1 files changed, 0 insertions, 275 deletions
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c b/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c deleted file mode 100644 index 35bd783..0000000 --- a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c +++ /dev/null | |||
@@ -1,275 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | /* ############## bad */ | ||
6 | #define HAVE_EVAS2 | ||
7 | |||
8 | #include <signal.h> | ||
9 | #include <dlfcn.h> | ||
10 | #include <stdio.h> | ||
11 | #include <glob.h> | ||
12 | #include <sys/param.h> | ||
13 | #include <limits.h> | ||
14 | #include <string.h> | ||
15 | #include <stdlib.h> /* malloc(), free() */ | ||
16 | |||
17 | #include "Ecore.h" | ||
18 | #include "Ecore_Config.h" | ||
19 | #include "ecore_config_util.h" | ||
20 | #include "ecore_config_ipc.h" | ||
21 | |||
22 | #include "ecore_config_private.h" | ||
23 | |||
24 | static Ecore_Config_Server *__ecore_config_servers; | ||
25 | Ecore_Timer *ipc_timer = NULL; | ||
26 | |||
27 | Ecore_Config_Server * | ||
28 | _ecore_config_server_convert(void *srv) | ||
29 | { | ||
30 | Ecore_Config_Server *srv_tmp; | ||
31 | |||
32 | srv_tmp = __ecore_config_servers; | ||
33 | while (srv_tmp) | ||
34 | { | ||
35 | if (srv_tmp->server == srv) | ||
36 | return srv_tmp; | ||
37 | srv_tmp = srv_tmp->next; | ||
38 | } | ||
39 | |||
40 | return __ecore_config_server_global; | ||
41 | } | ||
42 | |||
43 | /*****************************************************************************/ | ||
44 | /* INTERFACE FOR IPC MODULES */ | ||
45 | /*****************************/ | ||
46 | |||
47 | char * | ||
48 | _ecore_config_ipc_prop_list(Ecore_Config_Server * srv, const long serial) | ||
49 | { | ||
50 | Ecore_Config_Bundle *theme; | ||
51 | Ecore_Config_Prop *e; | ||
52 | estring *s; | ||
53 | int f; | ||
54 | |||
55 | theme = ecore_config_bundle_by_serial_get(srv, serial); | ||
56 | e = theme ? theme->data : NULL; | ||
57 | s = estring_new(8192); | ||
58 | f = 0; | ||
59 | while (e) | ||
60 | { | ||
61 | /* ignore system properties in listings, unless they have been overridden */ | ||
62 | if (e->flags & ECORE_CONFIG_FLAG_SYSTEM && !(e->flags & ECORE_CONFIG_FLAG_MODIFIED)) | ||
63 | { | ||
64 | e = e->next; | ||
65 | continue; | ||
66 | } | ||
67 | estring_appendf(s, "%s%s: %s", f ? "\n" : "", e->key, | ||
68 | ecore_config_type_get(e)); | ||
69 | if (e->flags & ECORE_CONFIG_FLAG_BOUNDS) | ||
70 | { | ||
71 | if (e->type == ECORE_CONFIG_FLT) | ||
72 | estring_appendf(s, ", range %le..%le", | ||
73 | (float)e->lo / ECORE_CONFIG_FLOAT_PRECISION, | ||
74 | (float)e->hi / ECORE_CONFIG_FLOAT_PRECISION); | ||
75 | else | ||
76 | estring_appendf(s, ", range %d..%d", e->lo, e->hi); | ||
77 | } | ||
78 | if (e->type == ECORE_CONFIG_THM) | ||
79 | estring_appendf(s, ", group %s", e->data ? e->data : "Main"); | ||
80 | f = 1; | ||
81 | e = e->next; | ||
82 | } | ||
83 | |||
84 | return estring_disown(s); | ||
85 | } | ||
86 | |||
87 | char * | ||
88 | _ecore_config_ipc_prop_desc(Ecore_Config_Server * srv, const long serial, | ||
89 | const char *key) | ||
90 | { | ||
91 | #ifdef HAVE_EVAS2 | ||
92 | Ecore_Config_Prop *e; | ||
93 | |||
94 | e = ecore_config_get(key); | ||
95 | if (e) | ||
96 | { | ||
97 | estring *s = estring_new(512); | ||
98 | |||
99 | estring_appendf(s, "%s: %s", e->key, ecore_config_type_get(e)); | ||
100 | if (e->flags & ECORE_CONFIG_FLAG_BOUNDS) | ||
101 | estring_appendf(s, ", range %d..%d", e->lo, e->hi); | ||
102 | return estring_disown(s); | ||
103 | } | ||
104 | #endif | ||
105 | return strdup("<undefined>"); | ||
106 | } | ||
107 | |||
108 | char * | ||
109 | _ecore_config_ipc_prop_get(Ecore_Config_Server * srv, const long serial, | ||
110 | const char *key) | ||
111 | { | ||
112 | #ifdef HAVE_EVAS2 | ||
113 | char *ret; | ||
114 | |||
115 | if ((ret = ecore_config_as_string_get(key))) | ||
116 | return ret; | ||
117 | #endif | ||
118 | return strdup("<undefined>"); | ||
119 | } | ||
120 | |||
121 | int | ||
122 | _ecore_config_ipc_prop_set(Ecore_Config_Server * srv, const long serial, | ||
123 | const char *key, const char *val) | ||
124 | { | ||
125 | #ifdef HAVE_EVAS2 | ||
126 | int ret; | ||
127 | Ecore_Config_Bundle *theme; | ||
128 | |||
129 | theme = ecore_config_bundle_by_serial_get(srv, serial); | ||
130 | ret = ecore_config_set(key, (char *)val); | ||
131 | ERR("ipc.prop.set(%s->%s,\"%s\") => %d\n", theme ? theme->identifier : "", | ||
132 | key, val, ret); | ||
133 | return ret; | ||
134 | #else | ||
135 | return ECORE_CONFIG_ERR_NOTSUPP; | ||
136 | #endif | ||
137 | } | ||
138 | |||
139 | /*****************************************************************************/ | ||
140 | |||
141 | char * | ||
142 | _ecore_config_ipc_bundle_list(Ecore_Config_Server * srv) | ||
143 | { | ||
144 | Ecore_Config_Bundle *ns; | ||
145 | estring *s; | ||
146 | int f; | ||
147 | |||
148 | ns = ecore_config_bundle_1st_get(srv); | ||
149 | s = estring_new(8192); | ||
150 | f = 0; | ||
151 | if (!ns) | ||
152 | return strdup("<no_bundles_created>"); | ||
153 | |||
154 | while (ns) | ||
155 | { | ||
156 | estring_appendf(s, "%s%d: %s", f ? "\n" : "", | ||
157 | ecore_config_bundle_serial_get(ns), | ||
158 | ecore_config_bundle_label_get(ns)); | ||
159 | f = 1; | ||
160 | ns = ecore_config_bundle_next_get(ns); | ||
161 | } | ||
162 | |||
163 | return estring_disown(s); | ||
164 | } | ||
165 | |||
166 | int | ||
167 | _ecore_config_ipc_bundle_new(Ecore_Config_Server * srv, const char *label) | ||
168 | { | ||
169 | if (ecore_config_bundle_new(srv, label)) | ||
170 | return ECORE_CONFIG_ERR_SUCC; | ||
171 | return ECORE_CONFIG_ERR_FAIL; | ||
172 | } | ||
173 | |||
174 | char * | ||
175 | _ecore_config_ipc_bundle_label_get(Ecore_Config_Server * srv, const long serial) | ||
176 | { | ||
177 | Ecore_Config_Bundle *ns; | ||
178 | char *label; | ||
179 | |||
180 | ns = ecore_config_bundle_by_serial_get(srv, serial); | ||
181 | label = ecore_config_bundle_label_get(ns); | ||
182 | return strdup(label ? label : "<no such bundle>"); | ||
183 | } | ||
184 | |||
185 | int | ||
186 | _ecore_config_ipc_bundle_label_set(Ecore_Config_Server * srv, const long serial, | ||
187 | const char *label) | ||
188 | { | ||
189 | Ecore_Config_Bundle *ns; | ||
190 | |||
191 | ns = ecore_config_bundle_by_serial_get(srv, serial); | ||
192 | if (!(ns->identifier = malloc(sizeof(label)))) | ||
193 | return ECORE_CONFIG_ERR_OOM; | ||
194 | memcpy(ns->identifier, label, sizeof(label)); | ||
195 | return ECORE_CONFIG_ERR_SUCC; | ||
196 | } | ||
197 | |||
198 | long | ||
199 | _ecore_config_ipc_bundle_label_find(Ecore_Config_Server * srv, | ||
200 | const char *label) | ||
201 | { | ||
202 | Ecore_Config_Bundle *ns; | ||
203 | |||
204 | ns = ecore_config_bundle_by_label_get(srv, label); | ||
205 | return ns ? ecore_config_bundle_serial_get(ns) : -1; | ||
206 | } | ||
207 | |||
208 | static Eina_Bool | ||
209 | _ecore_config_ipc_poll(void *data __UNUSED__) | ||
210 | { | ||
211 | Ecore_Config_Server *s; | ||
212 | |||
213 | s = __ecore_config_servers; | ||
214 | while (s) | ||
215 | { | ||
216 | _ecore_config_ipc_ecore_poll(&s->server); | ||
217 | s = s->next; | ||
218 | } | ||
219 | |||
220 | return EINA_TRUE; | ||
221 | } | ||
222 | |||
223 | int | ||
224 | _ecore_config_ipc_exit(void) | ||
225 | { | ||
226 | Ecore_Config_Server *l; | ||
227 | |||
228 | if (ipc_timer) | ||
229 | ecore_timer_del(ipc_timer); | ||
230 | |||
231 | l = __ecore_config_servers; | ||
232 | while (l) | ||
233 | { | ||
234 | _ecore_config_ipc_ecore_exit(&l->server); | ||
235 | if (l->name) | ||
236 | free(l->name); | ||
237 | l = l->next; | ||
238 | } | ||
239 | |||
240 | return ECORE_CONFIG_ERR_SUCC; | ||
241 | } | ||
242 | |||
243 | Ecore_Config_Server * | ||
244 | _ecore_config_ipc_init(const char *pipe_name) | ||
245 | { | ||
246 | int ret; | ||
247 | Ecore_Config_Server *list; | ||
248 | Ecore_Config_Server *ret_srv; | ||
249 | |||
250 | list = NULL; | ||
251 | ret_srv = NULL; | ||
252 | list = NULL; | ||
253 | |||
254 | list = calloc(1, sizeof(Ecore_Config_Server)); | ||
255 | if ((ret = _ecore_config_ipc_ecore_init(pipe_name, &list->server)) != ECORE_CONFIG_ERR_SUCC) | ||
256 | { | ||
257 | ERR("_ecore_config_ipc_init: failed to register %s, code %d", | ||
258 | pipe_name, ret); | ||
259 | } | ||
260 | |||
261 | ERR("_ecore_config_ipc_init: registered \"%s\"...", pipe_name); | ||
262 | |||
263 | list->name = strdup(pipe_name); | ||
264 | list->next = __ecore_config_servers; | ||
265 | |||
266 | __ecore_config_servers = list; | ||
267 | if (!ret_srv) | ||
268 | ret_srv = list; | ||
269 | |||
270 | if (!ipc_timer) | ||
271 | ipc_timer = ecore_timer_add(100, _ecore_config_ipc_poll, NULL); | ||
272 | |||
273 | return ret_srv; | ||
274 | } | ||
275 | /*****************************************************************************/ | ||