summaryrefslogtreecommitdiff
path: root/src/bin/exactness
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2020-03-03 17:03:41 +0100
committerStefan Schmidt <s.schmidt@samsung.com>2020-03-12 16:41:03 +0100
commitf8299e054234d73ba27b0bf7a6a07120279c92f1 (patch)
treeac48391850caef975393e5078358ee8fc964389a /src/bin/exactness
parent5c8942bf393f239d9860cb663d1bc6bcbee368e8 (diff)
exactness: factor out _printf() handling into common part
First step to do some re-factoring of the exactness binaries. We will share common parts from the different binaries in common.{c,h} to reduce the code duplication. The start makes _printf() used in various places. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D11456
Diffstat (limited to 'src/bin/exactness')
-rw-r--r--src/bin/exactness/common.c14
-rw-r--r--src/bin/exactness/common.h9
-rw-r--r--src/bin/exactness/exactness.c14
-rw-r--r--src/bin/exactness/injector.c42
-rw-r--r--src/bin/exactness/inspect.c2
-rw-r--r--src/bin/exactness/meson.build16
-rw-r--r--src/bin/exactness/player.c66
-rw-r--r--src/bin/exactness/recorder.c28
8 files changed, 90 insertions, 101 deletions
diff --git a/src/bin/exactness/common.c b/src/bin/exactness/common.c
new file mode 100644
index 0000000000..17983cdbc6
--- /dev/null
+++ b/src/bin/exactness/common.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3static int _verbose = 0;
4
5void
6ex_printf(int verbose, const char *fmt, ...)
7{
8 va_list ap;
9 if (!_verbose || verbose > _verbose) return;
10
11 va_start(ap, fmt);
12 vprintf(fmt, ap);
13 va_end(ap);
14}
diff --git a/src/bin/exactness/common.h b/src/bin/exactness/common.h
new file mode 100644
index 0000000000..1f84d80db7
--- /dev/null
+++ b/src/bin/exactness/common.h
@@ -0,0 +1,9 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Elementary.h>
6#include <Exactness.h>
7#include <exactness_private.h>
8
9void ex_printf(int verbose, const char *fmt, ...);
diff --git a/src/bin/exactness/exactness.c b/src/bin/exactness/exactness.c
index 9214236045..ebcae7f4a1 100644
--- a/src/bin/exactness/exactness.c
+++ b/src/bin/exactness/exactness.c
@@ -8,6 +8,7 @@
8#include <Ecore_File.h> 8#include <Ecore_File.h>
9 9
10#include "exactness_private.h" 10#include "exactness_private.h"
11#include "common.h"
11 12
12#ifdef _WIN32 13#ifdef _WIN32
13# include <evil_private.h> /* mkdir */ 14# include <evil_private.h> /* mkdir */
@@ -52,17 +53,6 @@ static Eina_List *_compare_errors;
52 53
53static Eina_Bool _job_consume(); 54static Eina_Bool _job_consume();
54 55
55static void
56_printf(int verbose, const char *fmt, ...)
57{
58 va_list ap;
59 if (!_verbose || verbose > _verbose) return;
60
61 va_start(ap, fmt);
62 vprintf(fmt, ap);
63 va_end(ap);
64}
65
66static Exactness_Image * 56static Exactness_Image *
67_image_load(const char *filename) 57_image_load(const char *filename)
68{ 58{
@@ -283,7 +273,7 @@ ok:
283 } 273 }
284 strncpy(buf, eina_strbuf_string_get(sbuf), SCHEDULER_CMD_SIZE-1); 274 strncpy(buf, eina_strbuf_string_get(sbuf), SCHEDULER_CMD_SIZE-1);
285 eina_strbuf_free(sbuf); 275 eina_strbuf_free(sbuf);
286 _printf(1, "Command: %s\n", buf); 276 ex_printf(1, "Command: %s\n", buf);
287 return EINA_TRUE; 277 return EINA_TRUE;
288} 278}
289 279
diff --git a/src/bin/exactness/injector.c b/src/bin/exactness/injector.c
index d2b29d014b..882752620d 100644
--- a/src/bin/exactness/injector.c
+++ b/src/bin/exactness/injector.c
@@ -14,6 +14,7 @@
14#include <Elementary.h> 14#include <Elementary.h>
15 15
16#include <Exactness.h> 16#include <Exactness.h>
17#include "common.h"
17 18
18typedef struct 19typedef struct
19{ 20{
@@ -135,32 +136,21 @@ EINA_DEBUG_OPCODES_ARRAY_DEFINE(_debug_ops,
135 ); 136 );
136 137
137static void 138static void
138_printf(int verbose, const char *fmt, ...)
139{
140 va_list ap;
141 if (!_verbose || verbose > _verbose) return;
142
143 va_start(ap, fmt);
144 vprintf(fmt, ap);
145 va_end(ap);
146}
147
148static void
149_feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data) 139_feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
150{ 140{
151 switch (type) 141 switch (type)
152 { 142 {
153 case EXACTNESS_ACTION_MOUSE_IN: 143 case EXACTNESS_ACTION_MOUSE_IN:
154 { 144 {
155 _printf(1, "Mouse in\n"); 145 ex_printf(1, "Mouse in\n");
156 _printf(2, "%s evas_event_feed_mouse_in n_evas=<%d>\n", __func__, n_evas); 146 ex_printf(2, "%s evas_event_feed_mouse_in n_evas=<%d>\n", __func__, n_evas);
157 eina_debug_session_send(_session, _cid, _mouse_in_op, &n_evas, sizeof(int)); 147 eina_debug_session_send(_session, _cid, _mouse_in_op, &n_evas, sizeof(int));
158 break; 148 break;
159 } 149 }
160 case EXACTNESS_ACTION_MOUSE_OUT: 150 case EXACTNESS_ACTION_MOUSE_OUT:
161 { 151 {
162 _printf(1, "Mouse out\n"); 152 ex_printf(1, "Mouse out\n");
163 _printf(2, "%s evas_event_feed_mouse_out n_evas=<%d>\n", __func__, n_evas); 153 ex_printf(2, "%s evas_event_feed_mouse_out n_evas=<%d>\n", __func__, n_evas);
164 eina_debug_session_send(_session, _cid, _mouse_out_op, &n_evas, sizeof(int)); 154 eina_debug_session_send(_session, _cid, _mouse_out_op, &n_evas, sizeof(int));
165 break; 155 break;
166 } 156 }
@@ -169,8 +159,8 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
169 Exactness_Action_Mouse_Wheel *t = data; 159 Exactness_Action_Mouse_Wheel *t = data;
170 int len = 3*sizeof(int); 160 int len = 3*sizeof(int);
171 char *buf = malloc(len), *tmp = buf; 161 char *buf = malloc(len), *tmp = buf;
172 _printf(1, "Mouse wheel\n"); 162 ex_printf(1, "Mouse wheel\n");
173 _printf(2, "%s evas_event_feed_mouse_wheel n_evas=<%d>\n", __func__, n_evas); 163 ex_printf(2, "%s evas_event_feed_mouse_wheel n_evas=<%d>\n", __func__, n_evas);
174 STORE_INT(tmp, n_evas); 164 STORE_INT(tmp, n_evas);
175 STORE_INT(tmp, t->direction); 165 STORE_INT(tmp, t->direction);
176 STORE_INT(tmp, t->z); 166 STORE_INT(tmp, t->z);
@@ -184,7 +174,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
184 Exactness_Action_Multi_Event *t = data; 174 Exactness_Action_Multi_Event *t = data;
185 int len = 5*sizeof(int)+7*sizeof(double)+sizeof(int); 175 int len = 5*sizeof(int)+7*sizeof(double)+sizeof(int);
186 char *buf = malloc(len), *tmp = buf; 176 char *buf = malloc(len), *tmp = buf;
187 _printf(2, "%s %s n_evas=<%d>\n", __func__, 177 ex_printf(2, "%s %s n_evas=<%d>\n", __func__,
188 type == EXACTNESS_ACTION_MULTI_DOWN ? "evas_event_feed_multi_down" : 178 type == EXACTNESS_ACTION_MULTI_DOWN ? "evas_event_feed_multi_down" :
189 "evas_event_feed_multi_up", n_evas); 179 "evas_event_feed_multi_up", n_evas);
190 STORE_INT(tmp, n_evas); 180 STORE_INT(tmp, n_evas);
@@ -211,7 +201,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
211 Exactness_Action_Multi_Move *t = data; 201 Exactness_Action_Multi_Move *t = data;
212 int len = 4*sizeof(int)+7*sizeof(double); 202 int len = 4*sizeof(int)+7*sizeof(double);
213 char *buf = malloc(len), *tmp = buf; 203 char *buf = malloc(len), *tmp = buf;
214 _printf(2, "%s evas_event_feed_multi_move n_evas=<%d>\n", __func__, n_evas); 204 ex_printf(2, "%s evas_event_feed_multi_move n_evas=<%d>\n", __func__, n_evas);
215 STORE_INT(tmp, n_evas); 205 STORE_INT(tmp, n_evas);
216 STORE_INT(tmp, t->d); 206 STORE_INT(tmp, t->d);
217 STORE_INT(tmp, t->x); 207 STORE_INT(tmp, t->x);
@@ -237,7 +227,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
237 len += t->string ? strlen(t->string) : 0; 227 len += t->string ? strlen(t->string) : 0;
238 len += t->compose ? strlen(t->compose) : 0; 228 len += t->compose ? strlen(t->compose) : 0;
239 char *buf = malloc(len), *tmp = buf; 229 char *buf = malloc(len), *tmp = buf;
240 _printf(2, "%s %s n_evas=<%d>\n", __func__, 230 ex_printf(2, "%s %s n_evas=<%d>\n", __func__,
241 type == EXACTNESS_ACTION_KEY_DOWN ? "evas_event_feed_key_down " : 231 type == EXACTNESS_ACTION_KEY_DOWN ? "evas_event_feed_key_down " :
242 "evas_event_feed_key_up", n_evas); 232 "evas_event_feed_key_up", n_evas);
243 STORE_INT(tmp, n_evas); 233 STORE_INT(tmp, n_evas);
@@ -254,7 +244,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
254 } 244 }
255 case EXACTNESS_ACTION_TAKE_SHOT: 245 case EXACTNESS_ACTION_TAKE_SHOT:
256 { 246 {
257 _printf(2, "%s take shot n_evas=<%d>\n", __func__, n_evas); 247 ex_printf(2, "%s take shot n_evas=<%d>\n", __func__, n_evas);
258 eina_debug_session_send(_session, _cid, _take_shot_op, &n_evas, sizeof(int)); 248 eina_debug_session_send(_session, _cid, _take_shot_op, &n_evas, sizeof(int));
259 break; 249 break;
260 } 250 }
@@ -265,7 +255,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
265 len += t->wdg_name ? strlen(t->wdg_name) : 0; 255 len += t->wdg_name ? strlen(t->wdg_name) : 0;
266 len += t->event_name ? strlen(t->event_name) : 0; 256 len += t->event_name ? strlen(t->event_name) : 0;
267 char *buf = malloc(len), *tmp = buf; 257 char *buf = malloc(len), *tmp = buf;
268 _printf(2, "%s %s\n", __func__, "EFL event"); 258 ex_printf(2, "%s %s\n", __func__, "EFL event");
269 STORE_STRING(tmp, t->wdg_name); 259 STORE_STRING(tmp, t->wdg_name);
270 STORE_STRING(tmp, t->event_name); 260 STORE_STRING(tmp, t->event_name);
271 eina_debug_session_send(_session, _cid, _efl_event_op, buf, len); 261 eina_debug_session_send(_session, _cid, _efl_event_op, buf, len);
@@ -278,7 +268,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
278 int len = 0; 268 int len = 0;
279 len += t->wdg_name ? strlen(t->wdg_name) : 0; 269 len += t->wdg_name ? strlen(t->wdg_name) : 0;
280 char *buf = malloc(len), *tmp = buf; 270 char *buf = malloc(len), *tmp = buf;
281 _printf(2, "%s %s\n", __func__, "Click On"); 271 ex_printf(2, "%s %s\n", __func__, "Click On");
282 STORE_STRING(tmp, t->wdg_name); 272 STORE_STRING(tmp, t->wdg_name);
283 eina_debug_session_send(_session, _cid, _click_on_op, buf, len); 273 eina_debug_session_send(_session, _cid, _click_on_op, buf, len);
284 free(buf); 274 free(buf);
@@ -286,7 +276,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
286 } 276 }
287 case EXACTNESS_ACTION_STABILIZE: 277 case EXACTNESS_ACTION_STABILIZE:
288 { 278 {
289 _printf(2, "%s stabilize\n", __func__); 279 ex_printf(2, "%s stabilize\n", __func__);
290 eina_debug_session_send(_session, _cid, _stabilize_op, NULL, 0); 280 eina_debug_session_send(_session, _cid, _stabilize_op, NULL, 0);
291 break; 281 break;
292 } 282 }
@@ -321,7 +311,7 @@ _src_open()
321{ 311{
322 double diff_time = 0; /* Time to wait before feeding the first event */ 312 double diff_time = 0; /* Time to wait before feeding the first event */
323 313
324 _printf(2, "<%s> Source file is <%s>\n", __func__, _src_filename); 314 ex_printf(2, "<%s> Source file is <%s>\n", __func__, _src_filename);
325 if (!strcmp(_src_filename + strlen(_src_filename) - 4,".exu")) 315 if (!strcmp(_src_filename + strlen(_src_filename) - 4,".exu"))
326 { 316 {
327 _src_unit = exactness_unit_file_read(_src_filename); 317 _src_unit = exactness_unit_file_read(_src_filename);
@@ -336,7 +326,7 @@ _src_open()
336 326
337 if (act->delay_ms) 327 if (act->delay_ms)
338 { 328 {
339 _printf(2, " Waiting <%f>\n", diff_time); 329 ex_printf(2, " Waiting <%f>\n", diff_time);
340 ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL); 330 ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL);
341 } 331 }
342 else 332 else
diff --git a/src/bin/exactness/inspect.c b/src/bin/exactness/inspect.c
index a04a5217df..384cda81b6 100644
--- a/src/bin/exactness/inspect.c
+++ b/src/bin/exactness/inspect.c
@@ -9,6 +9,8 @@
9#include <Exactness.h> 9#include <Exactness.h>
10#include <Efl_Ui.h> 10#include <Efl_Ui.h>
11 11
12#include "common.h"
13
12#define LDIFF(x) "<b><color=#F0F>"#x"</color></b>" 14#define LDIFF(x) "<b><color=#F0F>"#x"</color></b>"
13#define RDIFF(x) "<b><color=#0FF>"#x"</color></b>" 15#define RDIFF(x) "<b><color=#0FF>"#x"</color></b>"
14 16
diff --git a/src/bin/exactness/meson.build b/src/bin/exactness/meson.build
index b01c77de1e..f835cd40ea 100644
--- a/src/bin/exactness/meson.build
+++ b/src/bin/exactness/meson.build
@@ -1,18 +1,21 @@
1exactness_bin = executable('exactness', 1exactness_bin = executable('exactness',
2 [ 'exactness.c' ], 2 [ 'exactness.c', 'common.c', 'common.h' ],
3 dependencies: [ ecore, ecore_evas, ecore_file, exactness ], 3 dependencies: [ ecore, ecore_evas, ecore_file, elementary, exactness ],
4 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
4 install: true, 5 install: true,
5 ) 6 )
6 7
7exactness_inject_bin = executable('exactness_inject', 8exactness_inject_bin = executable('exactness_inject',
8 [ 'injector.c' ], 9 [ 'injector.c', 'common.c', 'common.h' ],
9 dependencies: [ elementary, exactness ], 10 dependencies: [ elementary, exactness ],
11 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
10 install: true, 12 install: true,
11 ) 13 )
12 14
13exactness_inspect_bin = executable('exactness_inspect', 15exactness_inspect_bin = executable('exactness_inspect',
14 [ 'inspect.c' ], 16 [ 'inspect.c', 'common.c', 'common.h' ],
15 dependencies: [ elementary, exactness ], 17 dependencies: [ elementary, exactness ],
18 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
16 install: true, 19 install: true,
17 ) 20 )
18 21
@@ -28,15 +31,16 @@ edjs = custom_target('player_entry',
28 depends : edje_depends) 31 depends : edje_depends)
29 32
30exactness_play_bin = executable('exactness_play', 33exactness_play_bin = executable('exactness_play',
31 [ 'player.c', edjs ], 34 [ 'player.c', 'common.c', 'common.h', edjs ],
32 dependencies: [ elementary, exactness ], 35 dependencies: [ elementary, exactness ],
33 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"', 36 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
34 install: true, 37 install: true,
35 ) 38 )
36 39
37exactness_record_bin = executable('exactness_record', 40exactness_record_bin = executable('exactness_record',
38 [ 'recorder.c' ], 41 [ 'recorder.c', 'common.c', 'common.h' ],
39 dependencies: [ elementary, exactness ], 42 dependencies: [ elementary, exactness ],
43 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
40 install: true, 44 install: true,
41 ) 45 )
42 46
diff --git a/src/bin/exactness/player.c b/src/bin/exactness/player.c
index 260d433b46..9e5629aa5b 100644
--- a/src/bin/exactness/player.c
+++ b/src/bin/exactness/player.c
@@ -30,6 +30,7 @@
30#include <Exactness.h> 30#include <Exactness.h>
31 31
32#include "exactness_private.h" 32#include "exactness_private.h"
33#include "common.h"
33 34
34#define PATH_ 1024 35#define PATH_ 1024
35#define CMD_LINE_MAX 256 36#define CMD_LINE_MAX 256
@@ -152,17 +153,6 @@ static Eina_Bool _exit_required = EINA_FALSE;
152static Eina_Bool _pause_request = EINA_FALSE; 153static Eina_Bool _pause_request = EINA_FALSE;
153static Eina_Bool _playing_status = EINA_FALSE; 154static Eina_Bool _playing_status = EINA_FALSE;
154 155
155static void
156_printf(int verbose, const char *fmt, ...)
157{
158 va_list ap;
159 if (!_verbose || verbose > _verbose) return;
160
161 va_start(ap, fmt);
162 vprintf(fmt, ap);
163 va_end(ap);
164}
165
166static Exactness_Image * 156static Exactness_Image *
167_snapshot_shot_get(Evas *e) 157_snapshot_shot_get(Evas *e)
168{ 158{
@@ -226,7 +216,7 @@ _evas_render_post_cb(void *data EINA_UNUSED, const Efl_Event *event)
226 Eo *o = evas_object_image_add(event->object); 216 Eo *o = evas_object_image_add(event->object);
227 evas_object_image_size_set(o, ex_shot->w, ex_shot->h); 217 evas_object_image_size_set(o, ex_shot->w, ex_shot->h);
228 evas_object_image_data_set(o, ex_shot->pixels); 218 evas_object_image_data_set(o, ex_shot->pixels);
229 _printf(1, "Shot taken (%s).\n", filename); 219 ex_printf(1, "Shot taken (%s).\n", filename);
230 if (!evas_object_image_save(o, filename, NULL, NULL)) 220 if (!evas_object_image_save(o, filename, NULL, NULL))
231 { 221 {
232 printf("Cannot save widget to <%s>\n", filename); 222 printf("Cannot save widget to <%s>\n", filename);
@@ -238,7 +228,7 @@ _evas_render_post_cb(void *data EINA_UNUSED, const Efl_Event *event)
238 Exactness_Image *ex_img = e_data; 228 Exactness_Image *ex_img = e_data;
239 memcpy(ex_img, ex_shot, sizeof(Exactness_Image)); 229 memcpy(ex_img, ex_shot, sizeof(Exactness_Image));
240 ex_shot->pixels = NULL; 230 ex_shot->pixels = NULL;
241 _printf(1, "Shot taken (in %s).\n", _dest); 231 ex_printf(1, "Shot taken (in %s).\n", _dest);
242 } 232 }
243 else if (_dest_type == FTYPE_REMOTE) 233 else if (_dest_type == FTYPE_REMOTE)
244 { 234 {
@@ -369,23 +359,23 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
369 { 359 {
370 case EXACTNESS_ACTION_MOUSE_IN: 360 case EXACTNESS_ACTION_MOUSE_IN:
371 { 361 {
372 _printf(1, "Mouse in\n"); 362 ex_printf(1, "Mouse in\n");
373 _printf(2, "%s evas_event_feed_mouse_in n_evas=<%d>\n", __func__, n_evas); 363 ex_printf(2, "%s evas_event_feed_mouse_in n_evas=<%d>\n", __func__, n_evas);
374 if (e) evas_event_feed_mouse_in(e, time(NULL), NULL); 364 if (e) evas_event_feed_mouse_in(e, time(NULL), NULL);
375 break; 365 break;
376 } 366 }
377 case EXACTNESS_ACTION_MOUSE_OUT: 367 case EXACTNESS_ACTION_MOUSE_OUT:
378 { 368 {
379 _printf(1, "Mouse out\n"); 369 ex_printf(1, "Mouse out\n");
380 _printf(2, "%s evas_event_feed_mouse_out n_evas=<%d>\n", __func__, n_evas); 370 ex_printf(2, "%s evas_event_feed_mouse_out n_evas=<%d>\n", __func__, n_evas);
381 if (e) evas_event_feed_mouse_out(e, time(NULL), NULL); 371 if (e) evas_event_feed_mouse_out(e, time(NULL), NULL);
382 break; 372 break;
383 } 373 }
384 case EXACTNESS_ACTION_MOUSE_WHEEL: 374 case EXACTNESS_ACTION_MOUSE_WHEEL:
385 { 375 {
386 Exactness_Action_Mouse_Wheel *t = data; 376 Exactness_Action_Mouse_Wheel *t = data;
387 _printf(1, "Mouse wheel\n"); 377 ex_printf(1, "Mouse wheel\n");
388 _printf(2, "%s evas_event_feed_mouse_wheel n_evas=<%d>\n", __func__, n_evas); 378 ex_printf(2, "%s evas_event_feed_mouse_wheel n_evas=<%d>\n", __func__, n_evas);
389 if (e) evas_event_feed_mouse_wheel(e, t->direction, t->z, time(NULL), NULL); 379 if (e) evas_event_feed_mouse_wheel(e, t->direction, t->z, time(NULL), NULL);
390 380
391 break; 381 break;
@@ -393,7 +383,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
393 case EXACTNESS_ACTION_MULTI_DOWN: 383 case EXACTNESS_ACTION_MULTI_DOWN:
394 { 384 {
395 Exactness_Action_Multi_Event *t = data; 385 Exactness_Action_Multi_Event *t = data;
396 _printf(2, "%s evas_event_feed_multi_down n_evas=<%d>\n", __func__, n_evas); 386 ex_printf(2, "%s evas_event_feed_multi_down n_evas=<%d>\n", __func__, n_evas);
397 if (!t->d) 387 if (!t->d)
398 { 388 {
399 if (e) evas_event_feed_mouse_down(e, t->b, t->flags, time(NULL), NULL); 389 if (e) evas_event_feed_mouse_down(e, t->b, t->flags, time(NULL), NULL);
@@ -412,7 +402,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
412 case EXACTNESS_ACTION_MULTI_UP: 402 case EXACTNESS_ACTION_MULTI_UP:
413 { 403 {
414 Exactness_Action_Multi_Event *t = data; 404 Exactness_Action_Multi_Event *t = data;
415 _printf(2, "%s evas_event_feed_multi_up n_evas=<%d>\n", __func__, n_evas); 405 ex_printf(2, "%s evas_event_feed_multi_up n_evas=<%d>\n", __func__, n_evas);
416 if (!t->d) 406 if (!t->d)
417 { 407 {
418 if (e) evas_event_feed_mouse_up(e, t->b, t->flags, time(NULL), NULL); 408 if (e) evas_event_feed_mouse_up(e, t->b, t->flags, time(NULL), NULL);
@@ -431,7 +421,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
431 case EXACTNESS_ACTION_MULTI_MOVE: 421 case EXACTNESS_ACTION_MULTI_MOVE:
432 { 422 {
433 Exactness_Action_Multi_Move *t = data; 423 Exactness_Action_Multi_Move *t = data;
434 _printf(2, "%s evas_event_feed_multi_move n_evas=<%d>\n", __func__, n_evas); 424 ex_printf(2, "%s evas_event_feed_multi_move n_evas=<%d>\n", __func__, n_evas);
435 if (!t->d) 425 if (!t->d)
436 { 426 {
437 if (e) evas_event_feed_mouse_move(e, t->x, t->y, time(NULL), NULL); 427 if (e) evas_event_feed_mouse_move(e, t->x, t->y, time(NULL), NULL);
@@ -454,7 +444,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
454 case EXACTNESS_ACTION_KEY_DOWN: 444 case EXACTNESS_ACTION_KEY_DOWN:
455 { 445 {
456 Exactness_Action_Key_Down_Up *t = data; 446 Exactness_Action_Key_Down_Up *t = data;
457 _printf(2, "%s evas_event_feed_key_down n_evas=<%d>\n", __func__, n_evas); 447 ex_printf(2, "%s evas_event_feed_key_down n_evas=<%d>\n", __func__, n_evas);
458 if (e) 448 if (e)
459 evas_event_feed_key_down_with_keycode(e, 449 evas_event_feed_key_down_with_keycode(e,
460 t->keyname, t->key, t->string, 450 t->keyname, t->key, t->string,
@@ -464,7 +454,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
464 case EXACTNESS_ACTION_KEY_UP: 454 case EXACTNESS_ACTION_KEY_UP:
465 { 455 {
466 Exactness_Action_Key_Down_Up *t = data; 456 Exactness_Action_Key_Down_Up *t = data;
467 _printf(2, "%s evas_event_feed_key_up n_evas=<%d>\n", __func__, n_evas); 457 ex_printf(2, "%s evas_event_feed_key_up n_evas=<%d>\n", __func__, n_evas);
468 if (e) evas_event_feed_key_up_with_keycode(e, 458 if (e) evas_event_feed_key_up_with_keycode(e,
469 t->keyname, t->key, t->string, 459 t->keyname, t->key, t->string,
470 t->compose, time(NULL), NULL, t->keycode); 460 t->compose, time(NULL), NULL, t->keycode);
@@ -473,7 +463,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
473 } 463 }
474 case EXACTNESS_ACTION_TAKE_SHOT: 464 case EXACTNESS_ACTION_TAKE_SHOT:
475 { 465 {
476 _printf(2, "%s take shot n_evas=<%d>\n", __func__, n_evas); 466 ex_printf(2, "%s take shot n_evas=<%d>\n", __func__, n_evas);
477 if (rect) evas_object_color_set(rect, 0, 0, 255, 255); 467 if (rect) evas_object_color_set(rect, 0, 0, 255, 255);
478 _cur_shot_id++; 468 _cur_shot_id++;
479 if (_dest_type != FTYPE_UNKNOWN && e) _shot_do(e); 469 if (_dest_type != FTYPE_UNKNOWN && e) _shot_do(e);
@@ -489,7 +479,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
489 Eo *o = efl_name_find(e, t->wdg_name); 479 Eo *o = efl_name_find(e, t->wdg_name);
490 if (o) 480 if (o)
491 { 481 {
492 _printf(2, "%s EFL event invoke %s on %s\n", 482 ex_printf(2, "%s EFL event invoke %s on %s\n",
493 __func__, t->event_name, t->wdg_name); 483 __func__, t->event_name, t->wdg_name);
494 Efl_Event_Description d; 484 Efl_Event_Description d;
495 found = EINA_TRUE; 485 found = EINA_TRUE;
@@ -526,7 +516,7 @@ wdg_found:
526 Exactness_Action_Multi_Event *d_event = calloc(1, sizeof(*d_event)); 516 Exactness_Action_Multi_Event *d_event = calloc(1, sizeof(*d_event));
527 Exactness_Action *act, *prev_act = eina_list_data_get(_cur_event_list); 517 Exactness_Action *act, *prev_act = eina_list_data_get(_cur_event_list);
528 518
529 _printf(2, "%s click on %s\n", __func__, t->wdg_name); 519 ex_printf(2, "%s click on %s\n", __func__, t->wdg_name);
530 act = calloc(1, sizeof(*act)); 520 act = calloc(1, sizeof(*act));
531 act->type = EXACTNESS_ACTION_MULTI_MOVE; 521 act->type = EXACTNESS_ACTION_MULTI_MOVE;
532 act->delay_ms = 100; 522 act->delay_ms = 100;
@@ -563,7 +553,7 @@ wdg_found:
563 } 553 }
564 case EXACTNESS_ACTION_STABILIZE: 554 case EXACTNESS_ACTION_STABILIZE:
565 { 555 {
566 _printf(2, "%s stabilize\n", __func__); 556 ex_printf(2, "%s stabilize\n", __func__);
567 if (rect) evas_object_color_set(rect, 255, 165, 0, 255); 557 if (rect) evas_object_color_set(rect, 255, 165, 0, 255);
568 ecore_timer_add(0.1, _stabilization_timer_cb, NULL); 558 ecore_timer_add(0.1, _stabilization_timer_cb, NULL);
569 break; 559 break;
@@ -591,7 +581,7 @@ _feed_event_timer_cb(void *data EINA_UNUSED)
591 if (act->type != EXACTNESS_ACTION_STABILIZE) 581 if (act->type != EXACTNESS_ACTION_STABILIZE)
592 { 582 {
593 act = eina_list_data_get(_cur_event_list); 583 act = eina_list_data_get(_cur_event_list);
594 _printf(2, " %s timer_time=<%f>\n", __func__, act->delay_ms / 1000.0); 584 ex_printf(2, " %s timer_time=<%f>\n", __func__, act->delay_ms / 1000.0);
595 ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL); 585 ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL);
596 } 586 }
597 } 587 }
@@ -605,7 +595,7 @@ _stabilization_timer_cb(void *data EINA_UNUSED)
605 Evas *e; 595 Evas *e;
606#define STAB_MAX 5 596#define STAB_MAX 5
607 static int need_more = STAB_MAX; 597 static int need_more = STAB_MAX;
608 _printf(2, "Not stable yet!\n"); 598 ex_printf(2, "Not stable yet!\n");
609 EINA_LIST_FOREACH(_evas_list, itr, e) 599 EINA_LIST_FOREACH(_evas_list, itr, e)
610 { 600 {
611 if (!e) continue; 601 if (!e) continue;
@@ -629,7 +619,7 @@ _stabilization_timer_cb(void *data EINA_UNUSED)
629 if (_src_type != FTYPE_REMOTE && !_pause_request) 619 if (_src_type != FTYPE_REMOTE && !_pause_request)
630 { 620 {
631 Exactness_Action *act = eina_list_data_get(_cur_event_list); 621 Exactness_Action *act = eina_list_data_get(_cur_event_list);
632 _printf(2, " %s timer_time=<%f>\n", __func__, act->delay_ms / 1000.0); 622 ex_printf(2, " %s timer_time=<%f>\n", __func__, act->delay_ms / 1000.0);
633 ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL); 623 ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL);
634 } 624 }
635 need_more = STAB_MAX; 625 need_more = STAB_MAX;
@@ -836,7 +826,7 @@ _src_feed(void *data EINA_UNUSED)
836 826
837 if (act && act->delay_ms) 827 if (act && act->delay_ms)
838 { 828 {
839 _printf(2, " Waiting <%f>\n", act->delay_ms / 1000.0); 829 ex_printf(2, " Waiting <%f>\n", act->delay_ms / 1000.0);
840 ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL); 830 ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL);
841 } 831 }
842 else 832 else
@@ -853,7 +843,7 @@ _src_open()
853 { 843 {
854 Eina_List *itr, *itr2; 844 Eina_List *itr, *itr2;
855 Exactness_Action *act; 845 Exactness_Action *act;
856 _printf(2, "<%s> Source file is <%s>\n", __func__, _src_filename); 846 ex_printf(2, "<%s> Source file is <%s>\n", __func__, _src_filename);
857 if (_src_type == FTYPE_EXU) 847 if (_src_type == FTYPE_EXU)
858 { 848 {
859 _src_unit = exactness_unit_file_read(_src_filename); 849 _src_unit = exactness_unit_file_read(_src_filename);
@@ -1035,10 +1025,10 @@ _event_key_cb(void *data EINA_UNUSED, const Efl_Event *event)
1035 if (!strcmp(key, PAUSE_KEY_STR) && efl_input_key_pressed_get(evk)) 1025 if (!strcmp(key, PAUSE_KEY_STR) && efl_input_key_pressed_get(evk))
1036 { 1026 {
1037 _pause_request = !_pause_request; 1027 _pause_request = !_pause_request;
1038 if (_pause_request) _printf(1, "Pausing scenario\n"); 1028 if (_pause_request) ex_printf(1, "Pausing scenario\n");
1039 else 1029 else
1040 { 1030 {
1041 _printf(1, "Playing scenario\n"); 1031 ex_printf(1, "Playing scenario\n");
1042 if (!_playing_status) 1032 if (!_playing_status)
1043 _feed_event_timer_cb(NULL); 1033 _feed_event_timer_cb(NULL);
1044 } 1034 }
@@ -1060,7 +1050,7 @@ _my_evas_new(int w EINA_UNUSED, int h EINA_UNUSED)
1060 e = _evas_new(); 1050 e = _evas_new();
1061 if (e) 1051 if (e)
1062 { 1052 {
1063 _printf(1, "New Evas\n"); 1053 ex_printf(1, "New Evas\n");
1064 _evas_list = eina_list_append(_evas_list, e); 1054 _evas_list = eina_list_append(_evas_list, e);
1065 efl_event_callback_array_add(e, _evas_callbacks(), NULL); 1055 efl_event_callback_array_add(e, _evas_callbacks(), NULL);
1066 } 1056 }
@@ -1297,9 +1287,9 @@ int main(int argc, char **argv)
1297 { 1287 {
1298 argv[i - opt_args] = argv[0] + (argv[i] - argv[opt_args]); 1288 argv[i - opt_args] = argv[0] + (argv[i] - argv[opt_args]);
1299 } 1289 }
1300 _printf(1, "%s ", argv[i - opt_args]); 1290 ex_printf(1, "%s ", argv[i - opt_args]);
1301 } 1291 }
1302 _printf(1, "\n"); 1292 ex_printf(1, "\n");
1303 } 1293 }
1304 else 1294 else
1305 { 1295 {
diff --git a/src/bin/exactness/recorder.c b/src/bin/exactness/recorder.c
index 59a4d3106e..812ef737e7 100644
--- a/src/bin/exactness/recorder.c
+++ b/src/bin/exactness/recorder.c
@@ -23,6 +23,7 @@
23#include <Exactness.h> 23#include <Exactness.h>
24 24
25#include <exactness_private.h> 25#include <exactness_private.h>
26#include "common.h"
26 27
27#define MAX_PATH 1024 28#define MAX_PATH 1024
28#define STABILIZE_KEY_STR "F1" 29#define STABILIZE_KEY_STR "F1"
@@ -42,17 +43,6 @@ static Exactness_Unit *_unit = NULL;
42static char *_shot_key = NULL; 43static char *_shot_key = NULL;
43static unsigned int _last_timestamp = 0.0; 44static unsigned int _last_timestamp = 0.0;
44 45
45static void
46_printf(int verbose, const char *fmt, ...)
47{
48 va_list ap;
49 if (!_verbose || verbose > _verbose) return;
50
51 va_start(ap, fmt);
52 vprintf(fmt, ap);
53 va_end(ap);
54}
55
56static Exactness_Action_Type 46static Exactness_Action_Type
57_event_pointer_type_get(Efl_Pointer_Action t) 47_event_pointer_type_get(Efl_Pointer_Action t)
58{ 48{
@@ -87,7 +77,7 @@ _add_to_list(Exactness_Action_Type type, unsigned int n_evas, unsigned int times
87 prev_v->n_evas == n_evas && 77 prev_v->n_evas == n_evas &&
88 (!len || !memcmp(prev_v->data, data, len))) return; 78 (!len || !memcmp(prev_v->data, data, len))) return;
89 } 79 }
90 _printf(1, "Recording %s\n", _exactness_action_type_to_string_get(type)); 80 ex_printf(1, "Recording %s\n", _exactness_action_type_to_string_get(type));
91 Exactness_Action *act = malloc(sizeof(*act)); 81 Exactness_Action *act = malloc(sizeof(*act));
92 act->type = type; 82 act->type = type;
93 act->n_evas = n_evas; 83 act->n_evas = n_evas;
@@ -122,7 +112,7 @@ _event_pointer_cb(void *data, const Efl_Event *event)
122 112
123 if (!timestamp) return; 113 if (!timestamp) return;
124 114
125 _printf(2, "Calling \"%s\" timestamp=<%u>\n", _exactness_action_type_to_string_get(evt), timestamp); 115 ex_printf(2, "Calling \"%s\" timestamp=<%u>\n", _exactness_action_type_to_string_get(evt), timestamp);
126 116
127 switch (action) 117 switch (action)
128 { 118 {
@@ -182,20 +172,20 @@ _event_key_cb(void *data, const Efl_Event *event)
182 { 172 {
183 if (!strcmp(key, _shot_key)) 173 if (!strcmp(key, _shot_key))
184 { 174 {
185 _printf(2, "Take Screenshot: %s timestamp=<%u>\n", __func__, timestamp); 175 ex_printf(2, "Take Screenshot: %s timestamp=<%u>\n", __func__, timestamp);
186 _add_to_list(EXACTNESS_ACTION_TAKE_SHOT, n_evas, timestamp, NULL, 0); 176 _add_to_list(EXACTNESS_ACTION_TAKE_SHOT, n_evas, timestamp, NULL, 0);
187 return; 177 return;
188 } 178 }
189 if (!strcmp(key, STABILIZE_KEY_STR)) 179 if (!strcmp(key, STABILIZE_KEY_STR))
190 { 180 {
191 _printf(2, "Stabilize: %s timestamp=<%u>\n", __func__, timestamp); 181 ex_printf(2, "Stabilize: %s timestamp=<%u>\n", __func__, timestamp);
192 _add_to_list(EXACTNESS_ACTION_STABILIZE, n_evas, timestamp, NULL, 0); 182 _add_to_list(EXACTNESS_ACTION_STABILIZE, n_evas, timestamp, NULL, 0);
193 return; 183 return;
194 } 184 }
195 if (!strcmp(key, SAVE_KEY_STR)) 185 if (!strcmp(key, SAVE_KEY_STR))
196 { 186 {
197 _output_write(); 187 _output_write();
198 _printf(2, "Save events: %s timestamp=<%u>\n", __func__, timestamp); 188 ex_printf(2, "Save events: %s timestamp=<%u>\n", __func__, timestamp);
199 return; 189 return;
200 } 190 }
201 evt = EXACTNESS_ACTION_KEY_DOWN; 191 evt = EXACTNESS_ACTION_KEY_DOWN;
@@ -239,7 +229,7 @@ _my_evas_new(int w EINA_UNUSED, int h EINA_UNUSED)
239 e = _evas_new(); 229 e = _evas_new();
240 if (e) 230 if (e)
241 { 231 {
242 _printf(1, "New Evas\n"); 232 ex_printf(1, "New Evas\n");
243 _evas_list = eina_list_append(_evas_list, e); 233 _evas_list = eina_list_append(_evas_list, e);
244 efl_key_data_set(e, "__evas_id", (void *)(intptr_t)_last_evas_id++); 234 efl_key_data_set(e, "__evas_id", (void *)(intptr_t)_last_evas_id++);
245 efl_event_callback_array_add(e, _event_pointer_callbacks(), e); 235 efl_event_callback_array_add(e, _event_pointer_callbacks(), e);
@@ -502,9 +492,9 @@ int main(int argc, char **argv)
502 { 492 {
503 argv[i - opt_args] = argv[0] + (argv[i] - argv[opt_args]); 493 argv[i - opt_args] = argv[0] + (argv[i] - argv[opt_args]);
504 } 494 }
505 _printf(1, "%s ", argv[i - opt_args]); 495 ex_printf(1, "%s ", argv[i - opt_args]);
506 } 496 }
507 _printf(1, "\n"); 497 ex_printf(1, "\n");
508 498
509 if (!_shot_key) _shot_key = getenv("SHOT_KEY"); 499 if (!_shot_key) _shot_key = getenv("SHOT_KEY");
510 if (!_shot_key) _shot_key = SHOT_KEY_STR; 500 if (!_shot_key) _shot_key = SHOT_KEY_STR;