Edje_Part_Description *pd;
};
+jmp_buf _edje_lua_panic_jmp;
+
+static int
+_edje_lua_custom_panic(lua_State *L)
+{
+ printf("PANIC\n");
+ longjmp(_edje_lua_panic_jmp, 1);
+ return 1; /* longjmp() never returns, but this keep gcc happy */
+}
+
void
__edje_lua_error(const char *file, const char *fnc, int line, lua_State *L, int err_code)
{
_edje_lua_get_reg(L, obj);
if ((err_code = lua_pcall(L, 1, 1, 0)))
- _edje_lua_error(L, err_code);
+ {
+ _edje_lua_error(L, err_code);
+ return 0;
+ }
res = luaL_checkint(L, -1);
lua_pop(L, 1); // -- res
+
+/*
+ if (_edje_lua_panic_here())
+ printf("blahc\n");
+ else
+ lua_pop(L, 1); // -- res
+ */
if (res == ECORE_CALLBACK_CANCEL)
{
// delete object
lua_pushstring(L, "del");
lua_gettable(L, -2);
lua_insert(L, -2);
- if ((err_code = lua_pcall(L, 1, 0, 0)))
- _edje_lua_error(L, err_code);
+ if ((err_code = lua_pcall(L, 1, 0, 0)))
+ _edje_lua_error(L, err_code);
}
return res;
}
_edje_lua_get_reg(L, obj);
if ((err = lua_pcall(L, 1, 1, 0)))
- _edje_lua_error(L, err);
+ {
+ _edje_lua_error(L, err);
+ return 0;
+ }
res = luaL_checkint(L, -1);
lua_pop(L, 1); // Pop res off the stack
lua_pushstring(L, "del");
lua_gettable(L, -2);
lua_insert(L, -2);
- if ((err = lua_pcall(L, 1, 0, 0)))
- _edje_lua_error(L, err);
+ if ((err = lua_pcall(L, 1, 0, 0)))
+ _edje_lua_error(L, err);
}
return res;
_edje_lua_get_reg(L, obj);
if ((err = lua_pcall(L, 1, 1, 0)))
- _edje_lua_error(L, err);
+ {
+ _edje_lua_error(L, err);
+ return 0;
+ }
res = luaL_checkint(L, -1);
lua_pop(L, 1); // Pop res off the stack
lua_pushstring(L, "del");
lua_gettable(L, -2);
lua_insert(L, -2);
- if ((err = lua_pcall(L, 1, 0, 0)))
- _edje_lua_error(L, err);
+ if ((err = lua_pcall(L, 1, 0, 0)))
+ _edje_lua_error(L, err);
}
return res;
lua_pushnumber(L, ev->canvas.y);
if ((err_code = lua_pcall(L, 5, 0, 0)))
- _edje_lua_error(L, err_code);
+ _edje_lua_error(L, err_code);
}
static void
lua_pushnumber(L, ev->canvas.y);
if ((err_code = lua_pcall(L, 5, 0, 0)))
- _edje_lua_error(L, err_code);
+ _edje_lua_error(L, err_code);
}
static void
lua_pushnumber(L, ev->canvas.y);
if ((err_code = lua_pcall(L, 6, 0, 0)))
- _edje_lua_error(L, err_code);
+ _edje_lua_error(L, err_code);
}
static void
lua_pushnumber(L, ev->canvas.y);
if ((err_code = lua_pcall(L, 6, 0, 0)))
- _edje_lua_error(L, err_code);
+ _edje_lua_error(L, err_code);
}
static void
lua_pushnumber(L, ev->cur.canvas.y);
if ((err_code = lua_pcall(L, 6, 0, 0)))
- _edje_lua_error(L, err_code);
+ _edje_lua_error(L, err_code);
}
static void
lua_pushnumber(L, ev->canvas.y);
if ((err_code = lua_pcall(L, 6, 0, 0)))
- _edje_lua_error(L, err_code);
+ _edje_lua_error(L, err_code);
}
static int
lua_pushstring(L, signal); // signal
lua_pushstring(L, source); // source
- if ((err_code = lua_pcall(L, 3, 0, 0)))
- _edje_lua_error(L, err_code);
+ if ((err_code = lua_pcall(L, 3, 0, 0)))
+ _edje_lua_error(L, err_code);
}
}
lua_getfield (L, -1, "set"); \
lua_pushvalue (L, -2); \
lua_pushvalue (L, 2); \
- if ((err_code = lua_pcall (L, 2, 0, 0))) \
- _edje_lua_error (L, err_code); \
+ if ((err_code = lua_pcall (L, 2, 0, 0))) \
+ _edje_lua_error (L, err_code); \
} \
return 1; \
}
exit(-1);
}
+ lua_atpanic(Ledje, _edje_lua_custom_panic);
+
/*
* configure Lua garbage collector
* TODO optimize garbage collector for typical edje use or make it configurable
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);
+ if ((err_code = lua_pcall(L, 1, 0, 0)))
+ _edje_lua_error(L, err_code);
}
else
lua_pop(L, 1);
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);
+ if ((err_code = lua_pcall(L, 1, 0, 0)))
+ _edje_lua_error(L, err_code);
}
else
lua_pop (L, 1);
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);
+ if ((err_code = lua_pcall(L, 1, 0, 0)))
+ _edje_lua_error(L, err_code);
}
else
lua_pop (L, 1);
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);
+ if ((err_code = lua_pcall(L, 1, 0, 0)))
+ _edje_lua_error(L, err_code);
}
else
lua_pop (L, 1);
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);
+ if ((err_code = lua_pcall(L, 3, 0, 0)))
+ _edje_lua_error(L, err_code);
}
else
lua_pop (L, 1);
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);
+ if ((err_code = lua_pcall(L, 3, 0, 0)))
+ _edje_lua_error(L, err_code);
}
else
lua_pop (L, 1);
break;
}
- if ((err_code = lua_pcall(L, nargs, 0, 0)))
- _edje_lua_error(L, err_code);
+ if ((err_code = lua_pcall(L, nargs, 0, 0)))
+ _edje_lua_error(L, err_code);
}
else
lua_pop (L, 1);