forked from enlightenment/efl
nuke old obsolete lua stuff - except edje_lua.c. let it dangle with
the actual lua code in it entirely not being compiled just as reference until it's killed off. SVN revision: 51622
This commit is contained in:
parent
2aebc5b458
commit
5e36f9979b
|
@ -98,7 +98,6 @@ static void ob_collections(void);
|
|||
static void ob_collections_group(void);
|
||||
static void st_collections_group_name(void);
|
||||
static void st_collections_group_script_only(void);
|
||||
static void st_collections_group_lua_script_only(void);
|
||||
static void st_collections_group_alias(void);
|
||||
static void st_collections_group_min(void);
|
||||
static void st_collections_group_max(void);
|
||||
|
@ -246,7 +245,6 @@ static void st_collections_group_programs_program_after(void);
|
|||
static void st_collections_group_programs_program_api(void);
|
||||
|
||||
static void ob_collections_group_programs_program_script(void);
|
||||
static void ob_collections_group_programs_program_lua_script(void);
|
||||
|
||||
/*****/
|
||||
|
||||
|
@ -287,7 +285,7 @@ New_Statement_Handler statement_handlers[] =
|
|||
{"collections.color_classes.color_class.color3", st_color_class_color3}, /* dup */
|
||||
{"collections.group.name", st_collections_group_name},
|
||||
{"collections.group.script_only", st_collections_group_script_only},
|
||||
{"collections.group.lua_script_only", st_collections_group_lua_script_only},
|
||||
{"collections.group.lua_script_only", st_collections_group_script_only},
|
||||
{"collections.group.alias", st_collections_group_alias},
|
||||
{"collections.group.min", st_collections_group_min},
|
||||
{"collections.group.max", st_collections_group_max},
|
||||
|
@ -710,7 +708,6 @@ New_Object_Handler object_handlers[] =
|
|||
{"collections.group.parts.part.description.color_classes.color_class", ob_color_class}, /* dup */
|
||||
{"collections.group.parts.part.description.program", ob_collections_group_programs_program}, /* dup */
|
||||
{"collections.group.parts.part.description.program.script", ob_collections_group_programs_program_script}, /* dup */
|
||||
{"collections.group.parts.part.description.program.lua_script", ob_collections_group_programs_program_lua_script}, /* dup */
|
||||
{"collections.group.parts.part.description.programs", NULL}, /* dup */
|
||||
{"collections.group.parts.part.description.programs.set", ob_images_set}, /* dup */
|
||||
{"collections.group.parts.part.description.programs.set.image", ob_images_set_image}, /* dup */
|
||||
|
@ -720,12 +717,9 @@ New_Object_Handler object_handlers[] =
|
|||
{"collections.group.parts.part.description.programs.fonts", NULL}, /* dup */
|
||||
{"collections.group.parts.part.description.programs.program", ob_collections_group_programs_program}, /* dup */
|
||||
{"collections.group.parts.part.description.programs.program.script", ob_collections_group_programs_program_script}, /* dup */
|
||||
{"collections.group.parts.part.description.programs.program.lua_script", ob_collections_group_programs_program_lua_script}, /* dup */
|
||||
{"collections.group.parts.part.description.script", ob_collections_group_script}, /* dup */
|
||||
{"collections.group.parts.part.description.lua_script", ob_collections_group_lua_script}, /* dup */
|
||||
{"collections.group.parts.part.program", ob_collections_group_programs_program}, /* dup */
|
||||
{"collections.group.parts.part.program.script", ob_collections_group_programs_program_script}, /* dup */
|
||||
{"collections.group.parts.part.program.lua_script", ob_collections_group_programs_program_lua_script}, /* dup */
|
||||
{"collections.group.parts.part.programs", NULL}, /* dup */
|
||||
{"collections.group.parts.part.programs.set", ob_images_set}, /* dup */
|
||||
{"collections.group.parts.part.programs.set.image", ob_images_set_image}, /* dup */
|
||||
|
@ -735,12 +729,9 @@ New_Object_Handler object_handlers[] =
|
|||
{"collections.group.parts.part.programs.fonts", NULL}, /* dup */
|
||||
{"collections.group.parts.part.programs.program", ob_collections_group_programs_program}, /* dup */
|
||||
{"collections.group.parts.part.programs.program.script", ob_collections_group_programs_program_script}, /* dup */
|
||||
{"collections.group.parts.part.programs.program.lua_script", ob_collections_group_programs_program_lua_script}, /* dup */
|
||||
{"collections.group.parts.part.script", ob_collections_group_script}, /* dup */
|
||||
{"collections.group.parts.part.lua_script", ob_collections_group_lua_script}, /* dup */
|
||||
{"collections.group.parts.program", ob_collections_group_programs_program}, /* dup */
|
||||
{"collections.group.parts.program.script", ob_collections_group_programs_program_script}, /* dup */
|
||||
{"collections.group.parts.program.lua_script", ob_collections_group_programs_program_lua_script}, /* dup */
|
||||
{"collections.group.parts.programs", NULL}, /* dup */
|
||||
{"collections.group.parts.programs.set", ob_images_set}, /* dup */
|
||||
{"collections.group.parts.programs.set.image", ob_images_set_image}, /* dup */
|
||||
|
@ -750,12 +741,9 @@ New_Object_Handler object_handlers[] =
|
|||
{"collections.group.parts.programs.fonts", NULL}, /* dup */
|
||||
{"collections.group.parts.programs.program", ob_collections_group_programs_program}, /* dup */
|
||||
{"collections.group.parts.programs.program.script", ob_collections_group_programs_program_script}, /* dup */
|
||||
{"collections.group.parts.programs.program.lua_script", ob_collections_group_programs_program_lua_script}, /* dup */
|
||||
{"collections.group.parts.script", ob_collections_group_script}, /* dup */
|
||||
{"collections.group.parts.lua_script", ob_collections_group_lua_script}, /* dup */
|
||||
{"collections.group.program", ob_collections_group_programs_program}, /* dup */
|
||||
{"collections.group.program.script", ob_collections_group_programs_program_script}, /* dup */
|
||||
{"collections.group.program.lua_script", ob_collections_group_programs_program_lua_script}, /* dup */
|
||||
{"collections.group.programs", NULL},
|
||||
{"collections.group.programs.set", ob_images_set}, /* dup */
|
||||
{"collections.group.programs.set.image", ob_images_set_image}, /* dup */
|
||||
|
@ -765,9 +753,7 @@ New_Object_Handler object_handlers[] =
|
|||
{"collections.group.programs.fonts", NULL}, /* dup */
|
||||
{"collections.group.programs.program", ob_collections_group_programs_program},
|
||||
{"collections.group.programs.program.script", ob_collections_group_programs_program_script},
|
||||
{"collections.group.programs.program.lua_script", ob_collections_group_programs_program_lua_script},
|
||||
{"collections.group.programs.script", ob_collections_group_script}, /* dup */
|
||||
{"collections.group.programs.lua_script", ob_collections_group_lua_script} /* dup */
|
||||
{"collections.group.programs.script", ob_collections_group_script} /* dup */
|
||||
};
|
||||
|
||||
/*****/
|
||||
|
@ -1824,17 +1810,6 @@ st_collections_group_script_only(void)
|
|||
|
||||
check_arg_count(1);
|
||||
|
||||
pc = eina_list_data_get(eina_list_last(edje_collections));
|
||||
pc->script_only = parse_bool(0);
|
||||
}
|
||||
|
||||
static void
|
||||
st_collections_group_lua_script_only(void)
|
||||
{
|
||||
Edje_Part_Collection *pc;
|
||||
|
||||
check_arg_count(1);
|
||||
|
||||
pc = eina_list_data_get(eina_list_last(edje_collections));
|
||||
pc->lua_script_only = parse_bool(0);
|
||||
}
|
||||
|
@ -6775,7 +6750,6 @@ st_collections_group_programs_program_action(void)
|
|||
"DRAG_VAL_STEP", EDJE_ACTION_TYPE_DRAG_VAL_STEP,
|
||||
"DRAG_VAL_PAGE", EDJE_ACTION_TYPE_DRAG_VAL_PAGE,
|
||||
"SCRIPT", EDJE_ACTION_TYPE_SCRIPT,
|
||||
"LUA_SCRIPT", EDJE_ACTION_TYPE_LUA_SCRIPT,
|
||||
"FOCUS_SET", EDJE_ACTION_TYPE_FOCUS_SET,
|
||||
"FOCUS_OBJECT", EDJE_ACTION_TYPE_FOCUS_OBJECT,
|
||||
"PARAM_COPY", EDJE_ACTION_TYPE_PARAM_COPY,
|
||||
|
@ -6842,10 +6816,6 @@ st_collections_group_programs_program_action(void)
|
|||
/* this is implicitly set by script {} so this is here just for
|
||||
* completeness */
|
||||
break;
|
||||
case EDJE_ACTION_TYPE_LUA_SCRIPT:
|
||||
/* this is implicitly set by lua_script {} so this is here just for
|
||||
* completeness */
|
||||
break;
|
||||
case EDJE_ACTION_TYPE_FOCUS_OBJECT:
|
||||
case EDJE_ACTION_TYPE_FOCUS_SET:
|
||||
check_arg_count(1);
|
||||
|
@ -7057,44 +7027,6 @@ ob_collections_group_programs_program_script(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ob_collections_group_programs_program_lua_script(void)
|
||||
{
|
||||
Edje_Part_Collection *pc;
|
||||
Code *cd;
|
||||
|
||||
pc = eina_list_data_get(eina_list_last(edje_collections));
|
||||
cd = eina_list_data_get(eina_list_last(codes));
|
||||
|
||||
if (!is_verbatim()) track_verbatim(1);
|
||||
else
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = get_verbatim();
|
||||
if (s)
|
||||
{
|
||||
Code_Program *cp;
|
||||
|
||||
cp = mem_alloc(SZ(Code_Program));
|
||||
cp->l1 = get_verbatim_line1();
|
||||
cp->l2 = get_verbatim_line2();
|
||||
cp->script = s;
|
||||
if (cd->shared && !cd->is_lua)
|
||||
{
|
||||
ERR("%s: Error. parse error %s:%i. You're trying to mix Embryo and Lua scripting in the same group",
|
||||
progname, file_in, line - 1);
|
||||
exit(-1);
|
||||
}
|
||||
cd->is_lua = 1;
|
||||
cd->programs = eina_list_append(cd->programs, cp);
|
||||
data_queue_anonymous_lookup(pc, current_program, &(cp->id));
|
||||
set_verbatim(NULL, 0, 0);
|
||||
current_program->action = EDJE_ACTION_TYPE_LUA_SCRIPT;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
@page edcref
|
||||
</table>
|
||||
|
|
|
@ -869,14 +869,15 @@ data_write_scripts(Eet_File *ef)
|
|||
|
||||
typedef struct _Edje_Lua_Script_Writer_Struct Edje_Lua_Script_Writer_Struct;
|
||||
|
||||
struct _Edje_Lua_Script_Writer_Struct {
|
||||
struct _Edje_Lua_Script_Writer_Struct
|
||||
{
|
||||
char *buf;
|
||||
int size;
|
||||
};
|
||||
|
||||
#ifdef LUA_BINARY
|
||||
static int
|
||||
_edje_lua_script_writer (lua_State *L __UNUSED__, const void* chunk_buf, size_t chunk_size, void* _data)
|
||||
_edje_lua_script_writer(lua_State *L __UNUSED__, const void *chunk_buf, size_t chunk_size, void *_data)
|
||||
{
|
||||
Edje_Lua_Script_Writer_Struct *data;
|
||||
void *old;
|
||||
|
|
|
@ -64,21 +64,21 @@ enum _Edje_Message_Type
|
|||
{
|
||||
EDJE_MESSAGE_NONE = 0,
|
||||
|
||||
EDJE_MESSAGE_SIGNAL = 1, /* DONT USE THIS */
|
||||
EDJE_MESSAGE_SIGNAL = 1, /* DONT USE THIS */
|
||||
|
||||
EDJE_MESSAGE_STRING = 2,
|
||||
EDJE_MESSAGE_INT = 3,
|
||||
EDJE_MESSAGE_FLOAT = 4,
|
||||
EDJE_MESSAGE_STRING = 2,
|
||||
EDJE_MESSAGE_INT = 3,
|
||||
EDJE_MESSAGE_FLOAT = 4,
|
||||
|
||||
EDJE_MESSAGE_STRING_SET = 5,
|
||||
EDJE_MESSAGE_INT_SET = 6,
|
||||
EDJE_MESSAGE_FLOAT_SET = 7,
|
||||
EDJE_MESSAGE_STRING_SET = 5,
|
||||
EDJE_MESSAGE_INT_SET = 6,
|
||||
EDJE_MESSAGE_FLOAT_SET = 7,
|
||||
|
||||
EDJE_MESSAGE_STRING_INT = 8,
|
||||
EDJE_MESSAGE_STRING_FLOAT = 9,
|
||||
EDJE_MESSAGE_STRING_INT = 8,
|
||||
EDJE_MESSAGE_STRING_FLOAT = 9,
|
||||
|
||||
EDJE_MESSAGE_STRING_INT_SET = 10,
|
||||
EDJE_MESSAGE_STRING_FLOAT_SET = 11
|
||||
EDJE_MESSAGE_STRING_INT_SET = 10,
|
||||
EDJE_MESSAGE_STRING_FLOAT_SET = 11
|
||||
};
|
||||
typedef enum _Edje_Message_Type Edje_Message_Type;
|
||||
|
||||
|
@ -143,7 +143,7 @@ typedef enum _Edje_Action_Type
|
|||
EDJE_ACTION_TYPE_DRAG_VAL_PAGE = 6,
|
||||
EDJE_ACTION_TYPE_SCRIPT = 7,
|
||||
EDJE_ACTION_TYPE_FOCUS_SET = 8,
|
||||
EDJE_ACTION_TYPE_LUA_SCRIPT = 9,
|
||||
EDJE_ACTION_TYPE_RESERVED00 = 9,
|
||||
EDJE_ACTION_TYPE_FOCUS_OBJECT = 10,
|
||||
EDJE_ACTION_TYPE_PARAM_COPY = 11,
|
||||
EDJE_ACTION_TYPE_PARAM_SET = 12,
|
||||
|
@ -242,23 +242,23 @@ struct _Edje_Message_String_Float_Set
|
|||
enum
|
||||
{
|
||||
EDJE_DRAG_DIR_NONE = 0,
|
||||
EDJE_DRAG_DIR_X = 1,
|
||||
EDJE_DRAG_DIR_Y = 2,
|
||||
EDJE_DRAG_DIR_XY = 3
|
||||
EDJE_DRAG_DIR_X = 1,
|
||||
EDJE_DRAG_DIR_Y = 2,
|
||||
EDJE_DRAG_DIR_XY = 3
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
EDJE_LOAD_ERROR_NONE = 0,
|
||||
EDJE_LOAD_ERROR_GENERIC = 1,
|
||||
EDJE_LOAD_ERROR_DOES_NOT_EXIST = 2,
|
||||
EDJE_LOAD_ERROR_PERMISSION_DENIED = 3,
|
||||
EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 4,
|
||||
EDJE_LOAD_ERROR_CORRUPT_FILE = 5,
|
||||
EDJE_LOAD_ERROR_UNKNOWN_FORMAT = 6,
|
||||
EDJE_LOAD_ERROR_INCOMPATIBLE_FILE = 7,
|
||||
EDJE_LOAD_ERROR_UNKNOWN_COLLECTION = 8,
|
||||
EDJE_LOAD_ERROR_RECURSIVE_REFERENCE = 9
|
||||
EDJE_LOAD_ERROR_GENERIC = 1,
|
||||
EDJE_LOAD_ERROR_DOES_NOT_EXIST = 2,
|
||||
EDJE_LOAD_ERROR_PERMISSION_DENIED = 3,
|
||||
EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 4,
|
||||
EDJE_LOAD_ERROR_CORRUPT_FILE = 5,
|
||||
EDJE_LOAD_ERROR_UNKNOWN_FORMAT = 6,
|
||||
EDJE_LOAD_ERROR_INCOMPATIBLE_FILE = 7,
|
||||
EDJE_LOAD_ERROR_UNKNOWN_COLLECTION = 8,
|
||||
EDJE_LOAD_ERROR_RECURSIVE_REFERENCE = 9
|
||||
};
|
||||
|
||||
enum _Edje_External_Param_Type
|
||||
|
@ -292,34 +292,28 @@ struct _Edje_External_Param_Info
|
|||
{
|
||||
const char *name;
|
||||
Edje_External_Param_Type type;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
int def, min, max, step;
|
||||
} i;
|
||||
struct
|
||||
{
|
||||
double def, min, max, step;
|
||||
} d;
|
||||
struct
|
||||
{
|
||||
const char *def;
|
||||
const char *accept_fmt;
|
||||
const char *deny_fmt;
|
||||
} s;
|
||||
struct
|
||||
{
|
||||
int def;
|
||||
const char *false_str;
|
||||
const char *true_str;
|
||||
} b;
|
||||
struct
|
||||
{
|
||||
const char *def;
|
||||
const char **choices; /* NULL terminated array */
|
||||
} c;
|
||||
} info;
|
||||
union {
|
||||
struct {
|
||||
int def, min, max, step;
|
||||
} i;
|
||||
struct {
|
||||
double def, min, max, step;
|
||||
} d;
|
||||
struct {
|
||||
const char *def;
|
||||
const char *accept_fmt;
|
||||
const char *deny_fmt;
|
||||
} s;
|
||||
struct {
|
||||
int def;
|
||||
const char *false_str;
|
||||
const char *true_str;
|
||||
} b;
|
||||
struct {
|
||||
const char *def;
|
||||
const char **choices; /* NULL terminated array */
|
||||
} c;
|
||||
} info;
|
||||
};
|
||||
typedef struct _Edje_External_Param_Info Edje_External_Param_Info;
|
||||
|
||||
|
|
|
@ -109,24 +109,7 @@ _edje_file_coll_open(Edje_File *edf, const char *coll)
|
|||
|
||||
if (data)
|
||||
{
|
||||
#ifdef LUA2
|
||||
_edje_lua2_script_load(edc, data, size);
|
||||
#else
|
||||
int err_code;
|
||||
|
||||
//printf("lua chunk size: %d\n", size);
|
||||
_edje_lua_new_reg(_edje_lua_state_get(), -1, edc); // gets freed in 'edje_load::_edje_collectoin_free'
|
||||
|
||||
if ((err_code = luaL_loadbuffer(_edje_lua_state_get(), data, size, "edje_lua_script")))
|
||||
{
|
||||
if (err_code == LUA_ERRSYNTAX)
|
||||
ERR("lua load syntax error: %s", lua_tostring(_edje_lua_state_get(), -1));
|
||||
else if (err_code == LUA_ERRMEM)
|
||||
ERR("lua load memory allocation error: %s", lua_tostring(_edje_lua_state_get(), -1));
|
||||
}
|
||||
if (lua_pcall(_edje_lua_state_get(), 0, 0, 0))
|
||||
ERR("lua call error: %s", lua_tostring(_edje_lua_state_get(), -1));
|
||||
#endif
|
||||
free(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -983,17 +983,7 @@ _edje_file_del(Edje *ed)
|
|||
|
||||
if (rp->custom)
|
||||
{
|
||||
#ifdef LUA2
|
||||
// xxx: lua2
|
||||
#else
|
||||
if (ed->L)
|
||||
{
|
||||
_edje_lua_get_reg(ed->L, rp->custom->description);
|
||||
_edje_lua_free_reg(ed->L, lua_touserdata(ed->L, -1)); // created in edje_lua.c::_edje_lua_part_fn_custom_state
|
||||
lua_pop(ed->L, 1);
|
||||
_edje_lua_free_reg(ed->L, rp->custom->description); // created in edje_lua.c::_edje_lua_part_fn_custom_state
|
||||
}
|
||||
#endif
|
||||
_edje_collection_free_part_description_clean(rp->part->type,
|
||||
rp->custom->description,
|
||||
ed->file->free_strings);
|
||||
|
@ -1061,16 +1051,7 @@ _edje_file_del(Edje *ed)
|
|||
}
|
||||
}
|
||||
if (ed->L)
|
||||
{
|
||||
#ifdef LUA2
|
||||
_edje_lua2_script_shutdown(ed);
|
||||
#else
|
||||
_edje_lua_free_reg(ed->L, ed); // created in edje_lua.c::_edje_lua_script_fn_new/_edje_lua_group_fn_new
|
||||
_edje_lua_free_reg(ed->L, ed->L); // created in edje_program.c::_edje_program_run/edje_lua_script_only.c::_edje_lua_script_only_init
|
||||
_edje_lua_free_thread(ed, ed->L); // created in edje_program.c::_edje_program_run/edje_lua_script_only.c::_edje_lua_script_only_init
|
||||
ed->L = NULL;
|
||||
#endif
|
||||
}
|
||||
_edje_lua2_script_shutdown(ed);
|
||||
if (ed->table_parts) free(ed->table_parts);
|
||||
ed->table_parts = NULL;
|
||||
ed->table_parts_size = 0;
|
||||
|
@ -1226,9 +1207,7 @@ _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec, Edje_Part_Collec
|
|||
}
|
||||
#endif
|
||||
if (ec->script) embryo_program_free(ec->script);
|
||||
#ifdef LUA2
|
||||
_edje_lua2_script_unload(ec);
|
||||
#endif
|
||||
|
||||
/* Destroy all part and description. */
|
||||
eina_mempool_del(ce->mp.RECTANGLE);
|
||||
|
|
|
@ -23,11 +23,15 @@ void *alloca(size_t);
|
|||
|
||||
#include "edje_private.h"
|
||||
|
||||
#if 0
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// the below is deprecated and here for reference only until removed. look
|
||||
// at edje_lua2.c for the active workign code
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <lauxlib.h>
|
||||
#include <lualib.h>
|
||||
|
||||
#ifndef LUA2
|
||||
|
||||
#define EDJE_LUA_GET 1
|
||||
#define EDJE_LUA_SET 2
|
||||
#define EDJE_LUA_FN 3
|
||||
|
@ -5166,4 +5170,4 @@ _edje_lua_shutdown()
|
|||
Ledje = NULL;
|
||||
}
|
||||
|
||||
#endif // not LUA2
|
||||
#endif
|
||||
|
|
|
@ -184,7 +184,6 @@ extern "C"
|
|||
#include "edje_private.h"
|
||||
|
||||
//--------------------------------------------------------------------------//
|
||||
#ifdef LUA2
|
||||
#define MAX_LUA_MEM (4 * (1024 * 1024))
|
||||
|
||||
|
||||
|
@ -1986,7 +1985,7 @@ _edje_lua2_script_init(Edje *ed)
|
|||
|
||||
_elua_table_ptr_set(L, _elua_key, ed);
|
||||
|
||||
snprintf(buf, sizeof(buf), "lua_scripts/%i", ed->collection->id);
|
||||
snprintf(buf, sizeof(buf), "edje/scripts/lua/%i", ed->collection->id);
|
||||
data = eet_read(ed->file->ef, buf, &size);
|
||||
|
||||
if (data)
|
||||
|
@ -2051,5 +2050,3 @@ _edje_lua2_script_unload(Edje_Part_Collection *edc __UNUSED__)
|
|||
L = lstate;
|
||||
lua_gc(L, LUA_GCCOLLECT, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,287 +33,48 @@ void
|
|||
_edje_lua_script_only_init(Edje *ed)
|
||||
{
|
||||
if (ed->collection)
|
||||
{
|
||||
#ifdef LUA2
|
||||
_edje_lua2_script_init(ed);
|
||||
#else
|
||||
ed->L = _edje_lua_new_thread(ed, _edje_lua_state_get()); // freed in _edje_lua_script_only_shutdown
|
||||
_edje_lua_new_reg(ed->L, -1, ed->L); // freed in _edje_lua_script_only_shutdown
|
||||
lua_pop(ed->L, 1); /* thread */
|
||||
|
||||
lua_State *L = ed->L;
|
||||
_edje_lua_script_fn_new(ed);
|
||||
lua_pop(L, 1); /* script */
|
||||
|
||||
lua_getglobal(L, "init");
|
||||
if (!lua_isnil (L, -1))
|
||||
{
|
||||
int err_code;
|
||||
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX); /* set function environment from collection thread to edje object thread */
|
||||
lua_setfenv(L, -2);
|
||||
_edje_lua_get_reg(L, ed);
|
||||
|
||||
if ((err_code = lua_pcall(L, 1, 0, 0)))
|
||||
_edje_lua_error(L, err_code);
|
||||
}
|
||||
else
|
||||
lua_pop(L, 1);
|
||||
#endif
|
||||
}
|
||||
_edje_lua2_script_init(ed);
|
||||
}
|
||||
|
||||
void
|
||||
_edje_lua_script_only_shutdown(Edje *ed)
|
||||
{
|
||||
if (ed->collection && ed->L)
|
||||
{
|
||||
#ifdef LUA2
|
||||
_edje_lua2_script_func_shutdown(ed);
|
||||
#else
|
||||
lua_State *L = ed->L;
|
||||
lua_getglobal(L, "shutdown");
|
||||
if (!lua_isnil (L, -1))
|
||||
{
|
||||
int err_code;
|
||||
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX);
|
||||
lua_setfenv(L, -2);
|
||||
_edje_lua_get_reg(L, ed);
|
||||
|
||||
if ((err_code = lua_pcall(L, 1, 0, 0)))
|
||||
_edje_lua_error(L, err_code);
|
||||
}
|
||||
else
|
||||
lua_pop (L, 1);
|
||||
#endif
|
||||
}
|
||||
_edje_lua2_script_func_shutdown(ed);
|
||||
}
|
||||
|
||||
void
|
||||
_edje_lua_script_only_show(Edje * ed)
|
||||
{
|
||||
if (ed->collection && ed->L)
|
||||
{
|
||||
#ifdef LUA2
|
||||
_edje_lua2_script_func_show(ed);
|
||||
#else
|
||||
lua_State *L = ed->L;
|
||||
lua_getglobal(L, "show");
|
||||
if (!lua_isnil (L, -1))
|
||||
{
|
||||
int err_code;
|
||||
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX);
|
||||
lua_setfenv(L, -2);
|
||||
_edje_lua_get_reg(L, ed);
|
||||
|
||||
if ((err_code = lua_pcall(L, 1, 0, 0)))
|
||||
_edje_lua_error(L, err_code);
|
||||
}
|
||||
else
|
||||
lua_pop (L, 1);
|
||||
#endif
|
||||
}
|
||||
_edje_lua2_script_func_show(ed);
|
||||
}
|
||||
|
||||
void
|
||||
_edje_lua_script_only_hide(Edje * ed)
|
||||
{
|
||||
if (ed->collection && ed->L)
|
||||
{
|
||||
#ifdef LUA2
|
||||
_edje_lua2_script_func_hide(ed);
|
||||
#else
|
||||
lua_State *L = ed->L;
|
||||
lua_getglobal(L, "hide");
|
||||
if (!lua_isnil (L, -1))
|
||||
{
|
||||
int err_code;
|
||||
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX);
|
||||
lua_setfenv(L, -2);
|
||||
_edje_lua_get_reg(L, ed);
|
||||
|
||||
if ((err_code = lua_pcall(L, 1, 0, 0)))
|
||||
_edje_lua_error(L, err_code);
|
||||
}
|
||||
else
|
||||
lua_pop (L, 1);
|
||||
#endif
|
||||
}
|
||||
_edje_lua2_script_func_hide(ed);
|
||||
}
|
||||
|
||||
void
|
||||
_edje_lua_script_only_move(Edje * ed)
|
||||
{
|
||||
if (ed->collection && ed->L)
|
||||
{
|
||||
#ifdef LUA2
|
||||
_edje_lua2_script_func_move(ed);
|
||||
#else
|
||||
lua_State *L = ed->L;
|
||||
lua_getglobal(L, "move");
|
||||
if (!lua_isnil (L, -1))
|
||||
{
|
||||
int err_code;
|
||||
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX);
|
||||
lua_setfenv(L, -2);
|
||||
_edje_lua_get_reg(L, ed);
|
||||
lua_pushnumber(L, ed->x);
|
||||
lua_pushnumber(L, ed->y);
|
||||
|
||||
if ((err_code = lua_pcall(L, 3, 0, 0)))
|
||||
_edje_lua_error(L, err_code);
|
||||
}
|
||||
else
|
||||
lua_pop (L, 1);
|
||||
#endif
|
||||
}
|
||||
_edje_lua2_script_func_move(ed);
|
||||
}
|
||||
|
||||
void
|
||||
_edje_lua_script_only_resize(Edje * ed)
|
||||
{
|
||||
if (ed->collection && ed->L)
|
||||
{
|
||||
#ifdef LUA2
|
||||
_edje_lua2_script_func_resize(ed);
|
||||
#else
|
||||
lua_State *L = ed->L;
|
||||
lua_getglobal(L, "resize");
|
||||
if (!lua_isnil (L, -1))
|
||||
{
|
||||
int err_code;
|
||||
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX);
|
||||
lua_setfenv(L, -2);
|
||||
_edje_lua_get_reg(L, ed);
|
||||
lua_pushnumber(L, ed->w);
|
||||
lua_pushnumber(L, ed->h);
|
||||
|
||||
if ((err_code = lua_pcall(L, 3, 0, 0)))
|
||||
_edje_lua_error(L, err_code);
|
||||
}
|
||||
else
|
||||
lua_pop (L, 1);
|
||||
#endif
|
||||
}
|
||||
_edje_lua2_script_func_resize(ed);
|
||||
}
|
||||
|
||||
void
|
||||
_edje_lua_script_only_message(Edje * ed, Edje_Message * em)
|
||||
{
|
||||
if (ed->collection && ed->L)
|
||||
{
|
||||
#ifdef LUA2
|
||||
_edje_lua2_script_func_message(ed, em);
|
||||
#else
|
||||
lua_State *L = ed->L;
|
||||
lua_getglobal(L, "message");
|
||||
if (!lua_isnil (L, -1))
|
||||
{
|
||||
int nargs = 3;
|
||||
int err_code;
|
||||
int count;
|
||||
int i;
|
||||
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX);
|
||||
lua_setfenv(L, -2);
|
||||
_edje_lua_get_reg(L, ed);
|
||||
lua_pushnumber(L, em->type);
|
||||
lua_pushnumber(L, em->id);
|
||||
switch (em->type)
|
||||
{
|
||||
case EDJE_MESSAGE_NONE:
|
||||
break;
|
||||
case EDJE_MESSAGE_SIGNAL:
|
||||
break;
|
||||
case EDJE_MESSAGE_STRING:
|
||||
lua_pushstring(L, ((Edje_Message_String *) em->msg)->str);
|
||||
nargs += 1;
|
||||
break;
|
||||
case EDJE_MESSAGE_INT:
|
||||
lua_pushnumber(L, ((Edje_Message_Int *) em->msg)->val);
|
||||
nargs += 1;
|
||||
break;
|
||||
case EDJE_MESSAGE_FLOAT:
|
||||
lua_pushnumber(L, ((Edje_Message_Float *) em->msg)->val);
|
||||
nargs += 1;
|
||||
break;
|
||||
case EDJE_MESSAGE_STRING_SET:
|
||||
count = ((Edje_Message_String_Set *) em->msg)->count;
|
||||
lua_createtable(L, count, 0);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
lua_pushstring(L, ((Edje_Message_String_Set *) em->msg)->str[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
nargs += 1;
|
||||
break;
|
||||
case EDJE_MESSAGE_INT_SET:
|
||||
count = ((Edje_Message_Int_Set *) em->msg)->count;
|
||||
lua_createtable(L, count, 0);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
lua_pushnumber(L, ((Edje_Message_Int_Set *) em->msg)->val[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
nargs += 1;
|
||||
break;
|
||||
case EDJE_MESSAGE_FLOAT_SET:
|
||||
count = ((Edje_Message_Float_Set *) em->msg)->count;
|
||||
lua_createtable(L, count, 0);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
lua_pushnumber(L, ((Edje_Message_Float_Set *) em->msg)->val[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
nargs += 1;
|
||||
break;
|
||||
case EDJE_MESSAGE_STRING_INT:
|
||||
lua_pushstring(L, ((Edje_Message_String_Int *) em->msg)->str);
|
||||
lua_pushnumber(L, ((Edje_Message_String_Int *) em->msg)->val);
|
||||
nargs += 2;
|
||||
break;
|
||||
case EDJE_MESSAGE_STRING_FLOAT:
|
||||
lua_pushstring(L, ((Edje_Message_String_Float *) em->msg)->str);
|
||||
lua_pushnumber(L, ((Edje_Message_String_Float *) em->msg)->val);
|
||||
nargs += 2;
|
||||
break;
|
||||
case EDJE_MESSAGE_STRING_INT_SET:
|
||||
lua_pushstring(L, ((Edje_Message_String_Int_Set *) em->msg)->str);
|
||||
count = ((Edje_Message_String_Int_Set *) em->msg)->count;
|
||||
lua_createtable(L, count, 0);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
lua_pushnumber(L, ((Edje_Message_String_Int_Set *) em->msg)->val[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
nargs += 2;
|
||||
break;
|
||||
case EDJE_MESSAGE_STRING_FLOAT_SET:
|
||||
lua_pushstring(L, ((Edje_Message_String_Float_Set *) em->msg)->str);
|
||||
count = ((Edje_Message_String_Float_Set *) em->msg)->count;
|
||||
lua_createtable(L, count, 0);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
lua_pushnumber(L, ((Edje_Message_String_Float_Set *) em->msg)->val[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
nargs += 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((err_code = lua_pcall(L, nargs, 0, 0)))
|
||||
_edje_lua_error(L, err_code);
|
||||
}
|
||||
else
|
||||
lua_pop (L, 1);
|
||||
#endif
|
||||
}
|
||||
_edje_lua2_script_func_message(ed, em);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,9 +89,6 @@ edje_init(void)
|
|||
_edje_box_init();
|
||||
_edje_external_init();
|
||||
_edje_module_init();
|
||||
#ifndef LUA2
|
||||
_edje_lua_init();
|
||||
#endif
|
||||
_edje_message_init();
|
||||
|
||||
_edje_real_part_mp = eina_mempool_add("chained_mempool",
|
||||
|
@ -120,9 +117,6 @@ edje_init(void)
|
|||
_edje_real_part_state_mp = NULL;
|
||||
_edje_real_part_mp = NULL;
|
||||
_edje_message_shutdown();
|
||||
#ifndef LUA2
|
||||
_edje_lua_shutdown();
|
||||
#endif
|
||||
_edje_module_shutdown();
|
||||
_edje_external_shutdown();
|
||||
_edje_box_shutdown();
|
||||
|
@ -181,9 +175,6 @@ edje_shutdown(void)
|
|||
_edje_real_part_mp = NULL;
|
||||
|
||||
_edje_message_shutdown();
|
||||
#ifndef LUA2
|
||||
_edje_lua_shutdown();
|
||||
#endif
|
||||
_edje_module_shutdown();
|
||||
_edje_external_shutdown();
|
||||
_edje_box_shutdown();
|
||||
|
|
|
@ -1757,10 +1757,6 @@ edje_program_is_strrncmp(const char *str)
|
|||
EAPI void _edje_program_insert(Edje_Part_Collection *ed, Edje_Program *p);
|
||||
EAPI void _edje_program_remove(Edje_Part_Collection *ed, Edje_Program *p);
|
||||
|
||||
// new lua stuff - supercedes the old
|
||||
#define LUA2 1
|
||||
|
||||
#ifdef LUA2
|
||||
void _edje_lua2_error_full(const char *file, const char *fnc, int line, lua_State *L, int err_code);
|
||||
#define _edje_lua2_error(L, err_code) _edje_lua2_error_full(__FILE__, __FUNCTION__, __LINE__, L, err_code)
|
||||
void _edje_lua2_script_init(Edje *ed);
|
||||
|
@ -1775,7 +1771,6 @@ void _edje_lua2_script_func_move(Edje *ed);
|
|||
void _edje_lua2_script_func_resize(Edje *ed);
|
||||
void _edje_lua2_script_func_message(Edje *ed, Edje_Message *em);
|
||||
void _edje_lua2_script_func_signal(Edje *ed, const char *sig, const char *src);
|
||||
#endif
|
||||
|
||||
const char *edje_string_get(const Edje_String *es);
|
||||
const char *edje_string_id_get(const Edje_String *es);
|
||||
|
|
|
@ -834,46 +834,6 @@ _edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char *ssig,
|
|||
if (_edje_block_break(ed)) goto break_prog;
|
||||
_edje_recalc_do(ed);
|
||||
}
|
||||
else if (pr->action == EDJE_ACTION_TYPE_LUA_SCRIPT)
|
||||
{
|
||||
//printf ("running Lua program script %i\n", pr->id);
|
||||
|
||||
// _edje_emit(ed, "program,start", pr->name);
|
||||
if (_edje_block_break(ed)) goto break_prog;
|
||||
|
||||
#ifdef LUA2
|
||||
_edje_lua2_script_init(ed);
|
||||
#else
|
||||
if (!ed->L) /* private state does not yet exist, create it */
|
||||
{
|
||||
ed->L = _edje_lua_new_thread(ed, _edje_lua_state_get());
|
||||
}
|
||||
lua_State *L = ed->L;
|
||||
lua_pushnumber(L, pr->id);
|
||||
lua_gettable(L, LUA_GLOBALSINDEX);
|
||||
if (!lua_isnil(L, -1))
|
||||
{
|
||||
int err_code;
|
||||
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX); /* set function environment from collection thread to edje object thread */
|
||||
lua_setfenv(L, -2);
|
||||
_edje_lua_get_reg(L, ed);
|
||||
if (lua_isnil(L, -1)) /* group object does not yet exist, create it */
|
||||
{
|
||||
lua_pop(L, 1);
|
||||
_edje_lua_group_fn_new (ed);
|
||||
}
|
||||
lua_pushstring(L, ssig);
|
||||
lua_pushstring(L, ssrc);
|
||||
|
||||
if ((err_code = lua_pcall(L, 3, 0, 0)))
|
||||
_edje_lua_error(L, err_code);
|
||||
}
|
||||
#endif
|
||||
// _edje_emit(ed, "program,stop", pr->name);
|
||||
if (_edje_block_break(ed)) goto break_prog;
|
||||
_edje_recalc_do(ed);
|
||||
}
|
||||
else if (pr->action == EDJE_ACTION_TYPE_FOCUS_SET)
|
||||
{
|
||||
if (!pr->targets)
|
||||
|
@ -1195,10 +1155,10 @@ _edje_emit_handle(Edje *ed, const char *sig, const char *src)
|
|||
_edje_block(ed);
|
||||
_edje_ref(ed);
|
||||
_edje_freeze(ed);
|
||||
#ifdef LUA2
|
||||
|
||||
if (ed->collection && ed->L)
|
||||
_edje_lua2_script_func_signal(ed, sig, src);
|
||||
#endif
|
||||
|
||||
if (ed->collection)
|
||||
{
|
||||
#ifdef EDJE_PROGRAM_CACHE
|
||||
|
|
Loading…
Reference in New Issue