--- /dev/null
+#include "common.h"
+
+static int _verbose = 0;
+
+void
+ex_printf(int verbose, const char *fmt, ...)
+{
+ va_list ap;
+ if (!_verbose || verbose > _verbose) return;
+
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ va_end(ap);
+}
--- /dev/null
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <Elementary.h>
+#include <Exactness.h>
+#include <exactness_private.h>
+
+void ex_printf(int verbose, const char *fmt, ...);
#include <Ecore_File.h>
#include "exactness_private.h"
+#include "common.h"
#ifdef _WIN32
# include <evil_private.h> /* mkdir */
static Eina_Bool _job_consume();
-static void
-_printf(int verbose, const char *fmt, ...)
-{
- va_list ap;
- if (!_verbose || verbose > _verbose) return;
-
- va_start(ap, fmt);
- vprintf(fmt, ap);
- va_end(ap);
-}
-
static Exactness_Image *
_image_load(const char *filename)
{
}
strncpy(buf, eina_strbuf_string_get(sbuf), SCHEDULER_CMD_SIZE-1);
eina_strbuf_free(sbuf);
- _printf(1, "Command: %s\n", buf);
+ ex_printf(1, "Command: %s\n", buf);
return EINA_TRUE;
}
#include <Elementary.h>
#include <Exactness.h>
+#include "common.h"
typedef struct
{
{NULL, NULL, NULL}
);
-static void
-_printf(int verbose, const char *fmt, ...)
-{
- va_list ap;
- if (!_verbose || verbose > _verbose) return;
-
- va_start(ap, fmt);
- vprintf(fmt, ap);
- va_end(ap);
-}
-
static void
_feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
{
{
case EXACTNESS_ACTION_MOUSE_IN:
{
- _printf(1, "Mouse in\n");
- _printf(2, "%s evas_event_feed_mouse_in n_evas=<%d>\n", __func__, n_evas);
+ ex_printf(1, "Mouse in\n");
+ ex_printf(2, "%s evas_event_feed_mouse_in n_evas=<%d>\n", __func__, n_evas);
eina_debug_session_send(_session, _cid, _mouse_in_op, &n_evas, sizeof(int));
break;
}
case EXACTNESS_ACTION_MOUSE_OUT:
{
- _printf(1, "Mouse out\n");
- _printf(2, "%s evas_event_feed_mouse_out n_evas=<%d>\n", __func__, n_evas);
+ ex_printf(1, "Mouse out\n");
+ ex_printf(2, "%s evas_event_feed_mouse_out n_evas=<%d>\n", __func__, n_evas);
eina_debug_session_send(_session, _cid, _mouse_out_op, &n_evas, sizeof(int));
break;
}
Exactness_Action_Mouse_Wheel *t = data;
int len = 3*sizeof(int);
char *buf = malloc(len), *tmp = buf;
- _printf(1, "Mouse wheel\n");
- _printf(2, "%s evas_event_feed_mouse_wheel n_evas=<%d>\n", __func__, n_evas);
+ ex_printf(1, "Mouse wheel\n");
+ ex_printf(2, "%s evas_event_feed_mouse_wheel n_evas=<%d>\n", __func__, n_evas);
STORE_INT(tmp, n_evas);
STORE_INT(tmp, t->direction);
STORE_INT(tmp, t->z);
Exactness_Action_Multi_Event *t = data;
int len = 5*sizeof(int)+7*sizeof(double)+sizeof(int);
char *buf = malloc(len), *tmp = buf;
- _printf(2, "%s %s n_evas=<%d>\n", __func__,
+ ex_printf(2, "%s %s n_evas=<%d>\n", __func__,
type == EXACTNESS_ACTION_MULTI_DOWN ? "evas_event_feed_multi_down" :
"evas_event_feed_multi_up", n_evas);
STORE_INT(tmp, n_evas);
Exactness_Action_Multi_Move *t = data;
int len = 4*sizeof(int)+7*sizeof(double);
char *buf = malloc(len), *tmp = buf;
- _printf(2, "%s evas_event_feed_multi_move n_evas=<%d>\n", __func__, n_evas);
+ ex_printf(2, "%s evas_event_feed_multi_move n_evas=<%d>\n", __func__, n_evas);
STORE_INT(tmp, n_evas);
STORE_INT(tmp, t->d);
STORE_INT(tmp, t->x);
len += t->string ? strlen(t->string) : 0;
len += t->compose ? strlen(t->compose) : 0;
char *buf = malloc(len), *tmp = buf;
- _printf(2, "%s %s n_evas=<%d>\n", __func__,
+ ex_printf(2, "%s %s n_evas=<%d>\n", __func__,
type == EXACTNESS_ACTION_KEY_DOWN ? "evas_event_feed_key_down " :
"evas_event_feed_key_up", n_evas);
STORE_INT(tmp, n_evas);
}
case EXACTNESS_ACTION_TAKE_SHOT:
{
- _printf(2, "%s take shot n_evas=<%d>\n", __func__, n_evas);
+ ex_printf(2, "%s take shot n_evas=<%d>\n", __func__, n_evas);
eina_debug_session_send(_session, _cid, _take_shot_op, &n_evas, sizeof(int));
break;
}
len += t->wdg_name ? strlen(t->wdg_name) : 0;
len += t->event_name ? strlen(t->event_name) : 0;
char *buf = malloc(len), *tmp = buf;
- _printf(2, "%s %s\n", __func__, "EFL event");
+ ex_printf(2, "%s %s\n", __func__, "EFL event");
STORE_STRING(tmp, t->wdg_name);
STORE_STRING(tmp, t->event_name);
eina_debug_session_send(_session, _cid, _efl_event_op, buf, len);
int len = 0;
len += t->wdg_name ? strlen(t->wdg_name) : 0;
char *buf = malloc(len), *tmp = buf;
- _printf(2, "%s %s\n", __func__, "Click On");
+ ex_printf(2, "%s %s\n", __func__, "Click On");
STORE_STRING(tmp, t->wdg_name);
eina_debug_session_send(_session, _cid, _click_on_op, buf, len);
free(buf);
}
case EXACTNESS_ACTION_STABILIZE:
{
- _printf(2, "%s stabilize\n", __func__);
+ ex_printf(2, "%s stabilize\n", __func__);
eina_debug_session_send(_session, _cid, _stabilize_op, NULL, 0);
break;
}
{
double diff_time = 0; /* Time to wait before feeding the first event */
- _printf(2, "<%s> Source file is <%s>\n", __func__, _src_filename);
+ ex_printf(2, "<%s> Source file is <%s>\n", __func__, _src_filename);
if (!strcmp(_src_filename + strlen(_src_filename) - 4,".exu"))
{
_src_unit = exactness_unit_file_read(_src_filename);
if (act->delay_ms)
{
- _printf(2, " Waiting <%f>\n", diff_time);
+ ex_printf(2, " Waiting <%f>\n", diff_time);
ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL);
}
else
#include <Exactness.h>
#include <Efl_Ui.h>
+#include "common.h"
+
#define LDIFF(x) "<b><color=#F0F>"#x"</color></b>"
#define RDIFF(x) "<b><color=#0FF>"#x"</color></b>"
exactness_bin = executable('exactness',
- [ 'exactness.c' ],
- dependencies: [ ecore, ecore_evas, ecore_file, exactness ],
+ [ 'exactness.c', 'common.c', 'common.h' ],
+ dependencies: [ ecore, ecore_evas, ecore_file, elementary, exactness ],
+ c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
install: true,
)
exactness_inject_bin = executable('exactness_inject',
- [ 'injector.c' ],
+ [ 'injector.c', 'common.c', 'common.h' ],
dependencies: [ elementary, exactness ],
+ c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
install: true,
)
exactness_inspect_bin = executable('exactness_inspect',
- [ 'inspect.c' ],
+ [ 'inspect.c', 'common.c', 'common.h' ],
dependencies: [ elementary, exactness ],
+ c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
install: true,
)
depends : edje_depends)
exactness_play_bin = executable('exactness_play',
- [ 'player.c', edjs ],
+ [ 'player.c', 'common.c', 'common.h', edjs ],
dependencies: [ elementary, exactness ],
c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
install: true,
)
exactness_record_bin = executable('exactness_record',
- [ 'recorder.c' ],
+ [ 'recorder.c', 'common.c', 'common.h' ],
dependencies: [ elementary, exactness ],
+ c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
install: true,
)
#include <Exactness.h>
#include "exactness_private.h"
+#include "common.h"
#define PATH_ 1024
#define CMD_LINE_MAX 256
static Eina_Bool _pause_request = EINA_FALSE;
static Eina_Bool _playing_status = EINA_FALSE;
-static void
-_printf(int verbose, const char *fmt, ...)
-{
- va_list ap;
- if (!_verbose || verbose > _verbose) return;
-
- va_start(ap, fmt);
- vprintf(fmt, ap);
- va_end(ap);
-}
-
static Exactness_Image *
_snapshot_shot_get(Evas *e)
{
Eo *o = evas_object_image_add(event->object);
evas_object_image_size_set(o, ex_shot->w, ex_shot->h);
evas_object_image_data_set(o, ex_shot->pixels);
- _printf(1, "Shot taken (%s).\n", filename);
+ ex_printf(1, "Shot taken (%s).\n", filename);
if (!evas_object_image_save(o, filename, NULL, NULL))
{
printf("Cannot save widget to <%s>\n", filename);
Exactness_Image *ex_img = e_data;
memcpy(ex_img, ex_shot, sizeof(Exactness_Image));
ex_shot->pixels = NULL;
- _printf(1, "Shot taken (in %s).\n", _dest);
+ ex_printf(1, "Shot taken (in %s).\n", _dest);
}
else if (_dest_type == FTYPE_REMOTE)
{
{
case EXACTNESS_ACTION_MOUSE_IN:
{
- _printf(1, "Mouse in\n");
- _printf(2, "%s evas_event_feed_mouse_in n_evas=<%d>\n", __func__, n_evas);
+ ex_printf(1, "Mouse in\n");
+ ex_printf(2, "%s evas_event_feed_mouse_in n_evas=<%d>\n", __func__, n_evas);
if (e) evas_event_feed_mouse_in(e, time(NULL), NULL);
break;
}
case EXACTNESS_ACTION_MOUSE_OUT:
{
- _printf(1, "Mouse out\n");
- _printf(2, "%s evas_event_feed_mouse_out n_evas=<%d>\n", __func__, n_evas);
+ ex_printf(1, "Mouse out\n");
+ ex_printf(2, "%s evas_event_feed_mouse_out n_evas=<%d>\n", __func__, n_evas);
if (e) evas_event_feed_mouse_out(e, time(NULL), NULL);
break;
}
case EXACTNESS_ACTION_MOUSE_WHEEL:
{
Exactness_Action_Mouse_Wheel *t = data;
- _printf(1, "Mouse wheel\n");
- _printf(2, "%s evas_event_feed_mouse_wheel n_evas=<%d>\n", __func__, n_evas);
+ ex_printf(1, "Mouse wheel\n");
+ ex_printf(2, "%s evas_event_feed_mouse_wheel n_evas=<%d>\n", __func__, n_evas);
if (e) evas_event_feed_mouse_wheel(e, t->direction, t->z, time(NULL), NULL);
break;
case EXACTNESS_ACTION_MULTI_DOWN:
{
Exactness_Action_Multi_Event *t = data;
- _printf(2, "%s evas_event_feed_multi_down n_evas=<%d>\n", __func__, n_evas);
+ ex_printf(2, "%s evas_event_feed_multi_down n_evas=<%d>\n", __func__, n_evas);
if (!t->d)
{
if (e) evas_event_feed_mouse_down(e, t->b, t->flags, time(NULL), NULL);
case EXACTNESS_ACTION_MULTI_UP:
{
Exactness_Action_Multi_Event *t = data;
- _printf(2, "%s evas_event_feed_multi_up n_evas=<%d>\n", __func__, n_evas);
+ ex_printf(2, "%s evas_event_feed_multi_up n_evas=<%d>\n", __func__, n_evas);
if (!t->d)
{
if (e) evas_event_feed_mouse_up(e, t->b, t->flags, time(NULL), NULL);
case EXACTNESS_ACTION_MULTI_MOVE:
{
Exactness_Action_Multi_Move *t = data;
- _printf(2, "%s evas_event_feed_multi_move n_evas=<%d>\n", __func__, n_evas);
+ ex_printf(2, "%s evas_event_feed_multi_move n_evas=<%d>\n", __func__, n_evas);
if (!t->d)
{
if (e) evas_event_feed_mouse_move(e, t->x, t->y, time(NULL), NULL);
case EXACTNESS_ACTION_KEY_DOWN:
{
Exactness_Action_Key_Down_Up *t = data;
- _printf(2, "%s evas_event_feed_key_down n_evas=<%d>\n", __func__, n_evas);
+ ex_printf(2, "%s evas_event_feed_key_down n_evas=<%d>\n", __func__, n_evas);
if (e)
evas_event_feed_key_down_with_keycode(e,
t->keyname, t->key, t->string,
case EXACTNESS_ACTION_KEY_UP:
{
Exactness_Action_Key_Down_Up *t = data;
- _printf(2, "%s evas_event_feed_key_up n_evas=<%d>\n", __func__, n_evas);
+ ex_printf(2, "%s evas_event_feed_key_up n_evas=<%d>\n", __func__, n_evas);
if (e) evas_event_feed_key_up_with_keycode(e,
t->keyname, t->key, t->string,
t->compose, time(NULL), NULL, t->keycode);
}
case EXACTNESS_ACTION_TAKE_SHOT:
{
- _printf(2, "%s take shot n_evas=<%d>\n", __func__, n_evas);
+ ex_printf(2, "%s take shot n_evas=<%d>\n", __func__, n_evas);
if (rect) evas_object_color_set(rect, 0, 0, 255, 255);
_cur_shot_id++;
if (_dest_type != FTYPE_UNKNOWN && e) _shot_do(e);
Eo *o = efl_name_find(e, t->wdg_name);
if (o)
{
- _printf(2, "%s EFL event invoke %s on %s\n",
+ ex_printf(2, "%s EFL event invoke %s on %s\n",
__func__, t->event_name, t->wdg_name);
Efl_Event_Description d;
found = EINA_TRUE;
Exactness_Action_Multi_Event *d_event = calloc(1, sizeof(*d_event));
Exactness_Action *act, *prev_act = eina_list_data_get(_cur_event_list);
- _printf(2, "%s click on %s\n", __func__, t->wdg_name);
+ ex_printf(2, "%s click on %s\n", __func__, t->wdg_name);
act = calloc(1, sizeof(*act));
act->type = EXACTNESS_ACTION_MULTI_MOVE;
act->delay_ms = 100;
}
case EXACTNESS_ACTION_STABILIZE:
{
- _printf(2, "%s stabilize\n", __func__);
+ ex_printf(2, "%s stabilize\n", __func__);
if (rect) evas_object_color_set(rect, 255, 165, 0, 255);
ecore_timer_add(0.1, _stabilization_timer_cb, NULL);
break;
if (act->type != EXACTNESS_ACTION_STABILIZE)
{
act = eina_list_data_get(_cur_event_list);
- _printf(2, " %s timer_time=<%f>\n", __func__, act->delay_ms / 1000.0);
+ ex_printf(2, " %s timer_time=<%f>\n", __func__, act->delay_ms / 1000.0);
ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL);
}
}
Evas *e;
#define STAB_MAX 5
static int need_more = STAB_MAX;
- _printf(2, "Not stable yet!\n");
+ ex_printf(2, "Not stable yet!\n");
EINA_LIST_FOREACH(_evas_list, itr, e)
{
if (!e) continue;
if (_src_type != FTYPE_REMOTE && !_pause_request)
{
Exactness_Action *act = eina_list_data_get(_cur_event_list);
- _printf(2, " %s timer_time=<%f>\n", __func__, act->delay_ms / 1000.0);
+ ex_printf(2, " %s timer_time=<%f>\n", __func__, act->delay_ms / 1000.0);
ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL);
}
need_more = STAB_MAX;
if (act && act->delay_ms)
{
- _printf(2, " Waiting <%f>\n", act->delay_ms / 1000.0);
+ ex_printf(2, " Waiting <%f>\n", act->delay_ms / 1000.0);
ecore_timer_add(act->delay_ms / 1000.0, _feed_event_timer_cb, NULL);
}
else
{
Eina_List *itr, *itr2;
Exactness_Action *act;
- _printf(2, "<%s> Source file is <%s>\n", __func__, _src_filename);
+ ex_printf(2, "<%s> Source file is <%s>\n", __func__, _src_filename);
if (_src_type == FTYPE_EXU)
{
_src_unit = exactness_unit_file_read(_src_filename);
if (!strcmp(key, PAUSE_KEY_STR) && efl_input_key_pressed_get(evk))
{
_pause_request = !_pause_request;
- if (_pause_request) _printf(1, "Pausing scenario\n");
+ if (_pause_request) ex_printf(1, "Pausing scenario\n");
else
{
- _printf(1, "Playing scenario\n");
+ ex_printf(1, "Playing scenario\n");
if (!_playing_status)
_feed_event_timer_cb(NULL);
}
e = _evas_new();
if (e)
{
- _printf(1, "New Evas\n");
+ ex_printf(1, "New Evas\n");
_evas_list = eina_list_append(_evas_list, e);
efl_event_callback_array_add(e, _evas_callbacks(), NULL);
}
{
argv[i - opt_args] = argv[0] + (argv[i] - argv[opt_args]);
}
- _printf(1, "%s ", argv[i - opt_args]);
+ ex_printf(1, "%s ", argv[i - opt_args]);
}
- _printf(1, "\n");
+ ex_printf(1, "\n");
}
else
{
#include <Exactness.h>
#include <exactness_private.h>
+#include "common.h"
#define MAX_PATH 1024
#define STABILIZE_KEY_STR "F1"
static char *_shot_key = NULL;
static unsigned int _last_timestamp = 0.0;
-static void
-_printf(int verbose, const char *fmt, ...)
-{
- va_list ap;
- if (!_verbose || verbose > _verbose) return;
-
- va_start(ap, fmt);
- vprintf(fmt, ap);
- va_end(ap);
-}
-
static Exactness_Action_Type
_event_pointer_type_get(Efl_Pointer_Action t)
{
prev_v->n_evas == n_evas &&
(!len || !memcmp(prev_v->data, data, len))) return;
}
- _printf(1, "Recording %s\n", _exactness_action_type_to_string_get(type));
+ ex_printf(1, "Recording %s\n", _exactness_action_type_to_string_get(type));
Exactness_Action *act = malloc(sizeof(*act));
act->type = type;
act->n_evas = n_evas;
if (!timestamp) return;
- _printf(2, "Calling \"%s\" timestamp=<%u>\n", _exactness_action_type_to_string_get(evt), timestamp);
+ ex_printf(2, "Calling \"%s\" timestamp=<%u>\n", _exactness_action_type_to_string_get(evt), timestamp);
switch (action)
{
{
if (!strcmp(key, _shot_key))
{
- _printf(2, "Take Screenshot: %s timestamp=<%u>\n", __func__, timestamp);
+ ex_printf(2, "Take Screenshot: %s timestamp=<%u>\n", __func__, timestamp);
_add_to_list(EXACTNESS_ACTION_TAKE_SHOT, n_evas, timestamp, NULL, 0);
return;
}
if (!strcmp(key, STABILIZE_KEY_STR))
{
- _printf(2, "Stabilize: %s timestamp=<%u>\n", __func__, timestamp);
+ ex_printf(2, "Stabilize: %s timestamp=<%u>\n", __func__, timestamp);
_add_to_list(EXACTNESS_ACTION_STABILIZE, n_evas, timestamp, NULL, 0);
return;
}
if (!strcmp(key, SAVE_KEY_STR))
{
_output_write();
- _printf(2, "Save events: %s timestamp=<%u>\n", __func__, timestamp);
+ ex_printf(2, "Save events: %s timestamp=<%u>\n", __func__, timestamp);
return;
}
evt = EXACTNESS_ACTION_KEY_DOWN;
e = _evas_new();
if (e)
{
- _printf(1, "New Evas\n");
+ ex_printf(1, "New Evas\n");
_evas_list = eina_list_append(_evas_list, e);
efl_key_data_set(e, "__evas_id", (void *)(intptr_t)_last_evas_id++);
efl_event_callback_array_add(e, _event_pointer_callbacks(), e);
{
argv[i - opt_args] = argv[0] + (argv[i] - argv[opt_args]);
}
- _printf(1, "%s ", argv[i - opt_args]);
+ ex_printf(1, "%s ", argv[i - opt_args]);
}
- _printf(1, "\n");
+ ex_printf(1, "\n");
if (!_shot_key) _shot_key = getenv("SHOT_KEY");
if (!_shot_key) _shot_key = SHOT_KEY_STR;