forked from enlightenment/efl
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
This commit is contained in:
parent
5c8942bf39
commit
f8299e0542
|
@ -0,0 +1,14 @@
|
|||
#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);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#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, ...);
|
|
@ -8,6 +8,7 @@
|
|||
#include <Ecore_File.h>
|
||||
|
||||
#include "exactness_private.h"
|
||||
#include "common.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <evil_private.h> /* mkdir */
|
||||
|
@ -52,17 +53,6 @@ static Eina_List *_compare_errors;
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -283,7 +273,7 @@ ok:
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <Elementary.h>
|
||||
|
||||
#include <Exactness.h>
|
||||
#include "common.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -134,17 +135,6 @@ EINA_DEBUG_OPCODES_ARRAY_DEFINE(_debug_ops,
|
|||
{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)
|
||||
{
|
||||
|
@ -152,15 +142,15 @@ _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;
|
||||
}
|
||||
|
@ -169,8 +159,8 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
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);
|
||||
|
@ -184,7 +174,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
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);
|
||||
|
@ -211,7 +201,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
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);
|
||||
|
@ -237,7 +227,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
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);
|
||||
|
@ -254,7 +244,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
@ -265,7 +255,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
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);
|
||||
|
@ -278,7 +268,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
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);
|
||||
|
@ -286,7 +276,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
@ -321,7 +311,7 @@ _src_open()
|
|||
{
|
||||
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);
|
||||
|
@ -336,7 +326,7 @@ _src_open()
|
|||
|
||||
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
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#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>"
|
||||
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
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,
|
||||
)
|
||||
|
||||
|
@ -28,15 +31,16 @@ edjs = custom_target('player_entry',
|
|||
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,
|
||||
)
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <Exactness.h>
|
||||
|
||||
#include "exactness_private.h"
|
||||
#include "common.h"
|
||||
|
||||
#define PATH_ 1024
|
||||
#define CMD_LINE_MAX 256
|
||||
|
@ -152,17 +153,6 @@ static Eina_Bool _exit_required = EINA_FALSE;
|
|||
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)
|
||||
{
|
||||
|
@ -226,7 +216,7 @@ _evas_render_post_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
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);
|
||||
|
@ -238,7 +228,7 @@ _evas_render_post_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
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)
|
||||
{
|
||||
|
@ -369,23 +359,23 @@ _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);
|
||||
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;
|
||||
|
@ -393,7 +383,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
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);
|
||||
|
@ -412,7 +402,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
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);
|
||||
|
@ -431,7 +421,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
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);
|
||||
|
@ -454,7 +444,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
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,
|
||||
|
@ -464,7 +454,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
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);
|
||||
|
@ -473,7 +463,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
}
|
||||
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);
|
||||
|
@ -489,7 +479,7 @@ _feed_event(Exactness_Action_Type type, unsigned int n_evas, void *data)
|
|||
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;
|
||||
|
@ -526,7 +516,7 @@ wdg_found:
|
|||
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;
|
||||
|
@ -563,7 +553,7 @@ wdg_found:
|
|||
}
|
||||
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;
|
||||
|
@ -591,7 +581,7 @@ _feed_event_timer_cb(void *data EINA_UNUSED)
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
@ -605,7 +595,7 @@ _stabilization_timer_cb(void *data EINA_UNUSED)
|
|||
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;
|
||||
|
@ -629,7 +619,7 @@ _stabilization_timer_cb(void *data EINA_UNUSED)
|
|||
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;
|
||||
|
@ -836,7 +826,7 @@ _src_feed(void *data EINA_UNUSED)
|
|||
|
||||
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
|
||||
|
@ -853,7 +843,7 @@ _src_open()
|
|||
{
|
||||
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);
|
||||
|
@ -1035,10 +1025,10 @@ _event_key_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
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);
|
||||
}
|
||||
|
@ -1060,7 +1050,7 @@ _my_evas_new(int w EINA_UNUSED, int h EINA_UNUSED)
|
|||
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);
|
||||
}
|
||||
|
@ -1297,9 +1287,9 @@ int main(int argc, char **argv)
|
|||
{
|
||||
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
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <Exactness.h>
|
||||
|
||||
#include <exactness_private.h>
|
||||
#include "common.h"
|
||||
|
||||
#define MAX_PATH 1024
|
||||
#define STABILIZE_KEY_STR "F1"
|
||||
|
@ -42,17 +43,6 @@ static Exactness_Unit *_unit = NULL;
|
|||
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)
|
||||
{
|
||||
|
@ -87,7 +77,7 @@ _add_to_list(Exactness_Action_Type type, unsigned int n_evas, unsigned int times
|
|||
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;
|
||||
|
@ -122,7 +112,7 @@ _event_pointer_cb(void *data, const Efl_Event *event)
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -182,20 +172,20 @@ _event_key_cb(void *data, const Efl_Event *event)
|
|||
{
|
||||
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;
|
||||
|
@ -239,7 +229,7 @@ _my_evas_new(int w EINA_UNUSED, int h EINA_UNUSED)
|
|||
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);
|
||||
|
@ -502,9 +492,9 @@ int main(int argc, char **argv)
|
|||
{
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue