}
static int
-_elua_scan_params(lua_State *L, int i, Eina_Bool tr, char *params, ...) // Stack usage -
+_elua_scan_params(lua_State *L, int i, char *params, ...) // Stack usage -
// if i is a table
// [-n, +n, e]
// else
// [-0, +0, -]
- // if tr
- // if i is a table
- // stack reset to i
- // else
- // [-0, +1, m]
{
va_list vl;
char *f = strdup(params);
{
if (table)
{
- // If this is a table, then we pushed a value on the stack, pop it off. But only if not tr, coz otherwise the stack gets reset anyway.
- if (!tr)
- lua_pop(L, 1); // Stack usage [-n, +0, -]
+ // If this is a table, then we pushed a value on the stack, pop it off.
+ lua_pop(L, 1); // Stack usage [-n, +0, -]
}
else
j++;
p = q;
}
- if (tr)
- {
- if (table)
- // FIXME: Check this, it might screw up the stack if there are more arguments to check.
- lua_settop(L, i); // Stack usage [-?, +?, -]
- else
- lua_newtable(L); // Stack usage [-0, +1, m]
- }
-
free(f);
va_end(vl);
if (count > n)
}
static int
-_elua_ret(lua_State *L, char *params, ...) // Stack usage [-2*n, +2*n, em]
+_elua_ret(lua_State *L, char *params, ...) // Stack usage [-(2*n), +(2*n+1), em]
{
va_list vl;
char *f = strdup(params);
int n = 0;
if (!f) return -1;
+
+ lua_newtable(L); // Stack usage [-0, +1, m]
va_start(vl, params);
while (*p)
struct tm *tm;
time_t tt;
- lua_newtable(L); // Stack usage [-0, +1, m]
gettimeofday(&timev, NULL);
tt = (time_t)(timev.tv_sec);
if ((tt > (last_tzset + 1)) || (tt < (last_tzset - 1)))
}
tm = localtime(&tt);
if (tm)
- { // Stack usage [-16, +16, em]
+ { // Stack usage [-16, +17, em]
_elua_ret(L, "%year %month %day %yearday %weekday %hour %min #sec",
(int)(tm->tm_year + 1900),
(int)(tm->tm_mon + 1),
_elua_objgeom(lua_State *L) // Stack usage [-10, +11, em]
{
Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e]
-// FIXME: This function has no arguments, so why the table check?
- if (!lua_istable(L, 1)) lua_newtable(L); // Stack usage [-0, +0, -] [-0, +1, m]
- _elua_ret(L, "%x %y %w %h", ed->x, ed->y, ed->w, ed->h); // Stack usage [-8, +8, em]
+ _elua_ret(L, "%x %y %w %h", ed->x, ed->y, ed->w, ed->h); // Stack usage [-8, +9, em]
return 1;
}
_elua_objpos(lua_State *L) // Stack usage [-6, +7, em]
{
Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e]
-// FIXME: This function has no arguments, so why the table check?
- if (!lua_istable(L, 1)) lua_newtable(L); // Stack usage [-0, +0, -] [-0, +1, m]
- _elua_ret(L, "%x %y", ed->x, ed->y); // Stack usage [-4, +4, em]
+ _elua_ret(L, "%x %y", ed->x, ed->y); // Stack usage [-4, +5, em]
return 1;
}
_elua_objsize(lua_State *L) // Stack usage [-6, +7, em]
{
Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e]
-// FIXME: This function has no arguments, so why the table check?
- if (!lua_istable(L, 1)) lua_newtable(L); // Stack usage [-0, +0, -] [-0, +1, m]
- _elua_ret(L, "%w %h", ed->w, ed->h); // Stack usage [-4, +4, em]
+ _elua_ret(L, "%w %h", ed->w, ed->h); // Stack usage [-4, +5, em]
return 1;
}
@since 1.1.0
*/
static int
-_elua_color_class(lua_State *L) // Stack usage [-?, +?, ?]
+_elua_color_class(lua_State *L) // Stack usage [-(10|14), +(11|15), ?]
{
Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e]
Edje_Color_Class *c_class;
if (!class) return 0;
- if (_elua_scan_params(L, 2, EINA_TRUE, "%r %g %b %a", &r, &g, &b, &a) > 0)
- { // Stack usage [-0, +1, m] unless it's in a table [+4, -4, e] reset stack to 2
+ if (_elua_scan_params(L, 2, "%r %g %b %a", &r, &g, &b, &a) > 0)
+ { // Stack usage [-0, +0, m] unless it's in a table [+4, -4, e]
_elua_color_fix(&r, &g, &b, &a);
// This is the way that embryo does it -
//edje_object_color_class_set(ed->obj, class, r, g, b, a, r, g, b, a, r, g, b, a);
if (!c_class) return 0;
_elua_ret(L, "%r %g %b %a", c_class->r, c_class->g, c_class->b, c_class->a);
- // Stack usage [-8, +8, em]
+ // Stack usage [-8, +9, em]
return 1;
}
// Just like color_class above, this does things differently from embryo,
// for the same reason.
- if (_elua_scan_params(L, 2, EINA_TRUE, "$font %size", &font, &size) > 0)
- // Stack usage [-0, +1, m] unless it's in a table [+2, -2, e] reset stack to 2
+ if (_elua_scan_params(L, 2, "$font %size", &font, &size) > 0)
+ // Stack usage [-0, +1, m] unless it's in a table [+2, -2, e]
edje_text_class_set(class, font, size);
t_class = _edje_text_class_find(ed, class);
if (!t_class) return 0;
_elua_ret(L, "$font %size", t_class->font, t_class->size);
- // Stack usage [-4, +4, em]
+ // Stack usage [-4, +5, em]
return 1;
}
if (!_elua_isa(obj, _elua_evas_meta)) return 0;
evas_object_geometry_get(elo->evas_obj, &ox, &oy, &ow, &oh);
- if (_elua_scan_params(L, 2, EINA_TRUE, "%x %y %w %h", &x, &y, &w, &h) > 0)
+ if (_elua_scan_params(L, 2, "%x %y %w %h", &x, &y, &w, &h) > 0)
{
if ((x != (ox - obj->ed->x)) || (y != (oy - obj->ed->y)))
{
elo->y = oy - obj->ed->y;
}
_elua_ret(L, "%x %y %w %h", elo->x, elo->y, ow, oh);
- // Stack usage [-8, +8, em]
+ // Stack usage [-8, +9, em]
return 1;
}
if (!_elua_isa(obj, _elua_evas_meta)) return 0;
evas_object_geometry_get(elo->evas_obj, &ox, &oy, NULL, NULL);
- if (_elua_scan_params(L, 2, EINA_TRUE, "%x %y", &x, &y) > 0)
+ if (_elua_scan_params(L, 2, "%x %y", &x, &y) > 0)
{
if ((x != (ox - obj->ed->x)) || (y != (oy - obj->ed->y)))
{
elo->y = oy - obj->ed->y;
}
_elua_ret(L, "%x %y", elo->x, elo->y);
- // Stack usage [-4, +4, em]
+ // Stack usage [-4, +6, em]
return 1;
}
if (!_elua_isa(obj, _elua_evas_meta)) return 0;
evas_object_geometry_get(elo->evas_obj, NULL, NULL, &ow, &oh);
- if (_elua_scan_params(L, 2, EINA_TRUE, "%w %h", &w, &h) > 0)
+ if (_elua_scan_params(L, 2, "%w %h", &w, &h) > 0)
{
if ((w != ow) || (h != oh))
{
}
}
_elua_ret(L, "%w %h", ow, oh);
- // Stack usage [-4, +4, em]
+ // Stack usage [-4, +5, em]
return 1;
}
int r, g, b, a;
if (!_elua_isa(obj, _elua_evas_meta)) return 0;
- if (_elua_scan_params(L, 2, EINA_TRUE, "%r %g %b %a", &r, &g, &b, &a) > 0)
+ if (_elua_scan_params(L, 2, "%r %g %b %a", &r, &g, &b, &a) > 0)
{
_elua_color_fix(&r, &g, &b, &a);
evas_object_color_set(elo->evas_obj, r, g, b, a);
}
evas_object_color_get(elo->evas_obj, &r, &g, &b, &a);
_elua_ret(L, "%r %g %b %a", r, g, b, a);
- // Stack usage [-8, +8, em]
+ // Stack usage [-8, +9, em]
return 1;
}
if (!_elua_isa(obj, _elua_evas_edje_meta)) return 0;
- n = _elua_scan_params(L, 2, EINA_TRUE, "$file $group", &file, &group);
+ n = _elua_scan_params(L, 2, "$file $group", &file, &group);
if (0 >= n)
{
file = (char *) obj->ed->file->path;
}
edje_object_file_get(elo->evas_obj, &file, &group);
_elua_ret(L, "$file $group", file, group);
- // Stack usage [-4, +4, em]
+ // Stack usage [-4, +5, em]
return 1;
}
if (!_elua_isa(obj, _elua_evas_image_meta)) return 0;
- if (_elua_scan_params(L, 2, EINA_TRUE, "%x %y %w %h", &x, &y, &w, &h) > 0)
+ if (_elua_scan_params(L, 2, "%x %y %w %h", &x, &y, &w, &h) > 0)
{
evas_object_image_fill_set(elo->evas_obj, x, y, w, h);
}
evas_object_image_fill_get(elo->evas_obj, &x, &y, &w, &h);
_elua_ret(L, "%x %y %w %h", x, y, w, h);
- // Stack usage [-8, +8, em]
+ // Stack usage [-8, +9, em]
return 1;
}
if (!_elua_isa(obj, _elua_evas_image_meta)) return 0;
- n = _elua_scan_params(L, 2, EINA_TRUE, "$file $key", &file, &key);
+ n = _elua_scan_params(L, 2, "$file $key", &file, &key);
if (0 >= n)
{
file = (char *) obj->ed->file->path;
}
evas_object_image_file_get(elo->evas_obj, &file, &key);
_elua_ret(L, "$file $key", file, key);
- // Stack usage [-4, +4, em]
+ // Stack usage [-4, +5, em]
return 1;
}
if (!_elua_isa(obj, _elua_evas_line_meta)) return 0;
- if (_elua_scan_params(L, 2, EINA_TRUE, "%x1 %y1 %x2 %y2", &x1, &y1, &x2, &y2) > 0)
+ if (_elua_scan_params(L, 2, "%x1 %y1 %x2 %y2", &x1, &y1, &x2, &y2) > 0)
{
evas_object_line_xy_set(elo->evas_obj, x1, y1, x2, y2);
}
evas_object_line_xy_get(elo->evas_obj, &x1, &y1, &x2, &y2);
_elua_ret(L, "%x1 %y1 %x2 %y2", x1, y1, x2, y2);
- // Stack usage [-8, +8, em]
+ // Stack usage [-8, +9, em]
return 1;
}
{
case 5 :
{
- if (_elua_scan_params(L, 2, EINA_FALSE, "%r %g %b %a", &r, &g, &b, &a) > 0)
+ if (_elua_scan_params(L, 2, "%r %g %b %a", &r, &g, &b, &a) > 0)
{
evas_map_util_points_color_set(elm->map, r, g, b, a);
}
case 1 :
case 6 :
{
- if (_elua_scan_params(L, 3, EINA_TRUE, "%r %g %b %a", &r, &g, &b, &a) > 0)
+ if (_elua_scan_params(L, 3, "%r %g %b %a", &r, &g, &b, &a) > 0)
{
evas_map_point_color_set(elm->map, lua_tointeger(L, 2), r, g, b, a);
}
evas_map_point_color_get(elm->map, lua_tointeger(L, 2), &r, &g, &b, &a);
_elua_ret(L, "%r %g %b %a", r, g, b, a);
- // Stack usage [-8, +8, em]
+ // Stack usage [-8, +9, em]
return 1;
}
}
n = lua_gettop(L); // Stack usage [-0, +0, -]
if (2 > n) return 0;
- if (_elua_scan_params(L, 2, EINA_TRUE, "%x %y %z", &x, &y, &z) > 0)
+ if (_elua_scan_params(L, 2, "%x %y %z", &x, &y, &z) > 0)
{
evas_map_point_coord_set(elm->map, lua_tointeger(L, 2), x, y, z);
}
evas_map_point_coord_get(elm->map, lua_tointeger(L, 2), &x, &y, &z);
_elua_ret(L, "%x %y %z", x, y, z);
- // Stack usage [-6, +6, em]
+ // Stack usage [-6, +7, em]
return 1;
}
if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
- if ((n = _elua_scan_params(L, 2, EINA_FALSE, "%x %y %z", &x, &y, &z)) > 0)
- if (n += _elua_scan_params(L, 2 + n, EINA_FALSE, "%r %g %b", &r, &g, &b) > 0)
- if (_elua_scan_params(L, 2 + n, EINA_FALSE, "%r %g %b", &r1, &g1, &b1) > 0)
+ if ((n = _elua_scan_params(L, 2, "%x %y %z", &x, &y, &z)) > 0)
+ if (n += _elua_scan_params(L, 2 + n, "%r %g %b", &r, &g, &b) > 0)
+ if (_elua_scan_params(L, 2 + n, "%r %g %b", &r1, &g1, &b1) > 0)
{
evas_map_util_3d_lighting(elm->map, x, y, z, r, g, b, r1, g1, b1);
}
if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
- if (_elua_scan_params(L, 2, EINA_FALSE, "%x %y %z %f", &x, &y, &z, &f) > 0)
+ if (_elua_scan_params(L, 2, "%x %y %z %f", &x, &y, &z, &f) > 0)
{
evas_map_util_3d_perspective(elm->map, x, y, z, f);
}
{
Evas_Coord x, y, w, h;
- if ((n = _elua_scan_params(L, 2, EINA_FALSE, "%x %y %w %h", &x, &y, &w, &h)) > 0)
+ if ((n = _elua_scan_params(L, 2, "%x %y %w %h", &x, &y, &w, &h)) > 0)
{
evas_map_util_points_populate_from_geometry(elm->map, x, y, w, h, lua_tointeger(L, 2 + n));
}
if (4 != n) return 0;
degrees = lua_tonumber(L, 2);
- if (_elua_scan_params(L, 3, EINA_TRUE, "%x %y", &x, &y) > 0)
+ if (_elua_scan_params(L, 3, "%x %y", &x, &y) > 0)
{
evas_map_util_rotate(elm->map, degrees, x, y);
}
if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
- if ((n = _elua_scan_params(L, 2, EINA_FALSE, "#x #y #z", &zx, &zy, &zz)) > 0)
- if (_elua_scan_params(L, 2 + n, EINA_FALSE, "%x %y %z", &x, &y, &z) > 0)
+ if ((n = _elua_scan_params(L, 2, "#x #y #z", &zx, &zy, &zz)) > 0)
+ if (_elua_scan_params(L, 2 + n, "%x %y %z", &x, &y, &z) > 0)
{
evas_map_util_3d_rotate(elm->map, zx, zy, zz, x, y, z);
}
n = lua_gettop(L); // Stack usage [-0, +0, -]
if (2 > n) return 0;
- if (_elua_scan_params(L, 3, EINA_TRUE, "#u #v", &u, &v) > 0)
+ if (_elua_scan_params(L, 3, "#u #v", &u, &v) > 0)
{
evas_map_point_image_uv_set(elm->map, lua_tonumber(L, 2), u, v);
}
evas_map_point_image_uv_get(elm->map, lua_tonumber(L, 2), &u, &v);
_elua_ret(L, "#u #v", u, v);
- // Stack usage [-4, +4, em]
+ // Stack usage [-4, +5, em]
return 1;
}
if (!_elua_isa(obj, _elua_evas_map_meta)) return 0;
- if ((n = _elua_scan_params(L, 2, EINA_FALSE, "#x #y", &zx, &zy)) > 0)
- if (_elua_scan_params(L, 2 + n, EINA_FALSE, "%x %y", &x, &y) > 0)
+ if ((n = _elua_scan_params(L, 2, "#x #y", &zx, &zy)) > 0)
+ if (_elua_scan_params(L, 2 + n, "%x %y", &x, &y) > 0)
{
evas_map_util_zoom(elm->map, zx, zy, x, y);
}
if (!_elua_isa(obj, _elua_evas_polygon_meta)) return 0;
- if (_elua_scan_params(L, 2, EINA_FALSE, "%x %y", &x, &y) > 0)
+ if (_elua_scan_params(L, 2, "%x %y", &x, &y) > 0)
{
evas_object_polygon_point_add(elo->evas_obj, x, y);
}
if (!_elua_isa(obj, _elua_evas_text_meta)) return 0;
- if (_elua_scan_params(L, 2, EINA_TRUE, "$font %size", &font, &size) > 0)
+ if (_elua_scan_params(L, 2, "$font %size", &font, &size) > 0)
{
/* Check if the font is embedded in the .edj
* This is a simple check.
// When one external API says it's gotta be const, and another one says not, then one of them's gotta be cast. :-P
evas_object_text_font_get(elo->evas_obj, (const char **) &font, &size);
_elua_ret(L, "$font %size", font, size);
- // Stack usage [-4, +4, em]
+ // Stack usage [-4, +5, em]
return 1;
}