mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 02:27:26 -07:00
make style
This commit is contained in:
parent
0d9223a547
commit
0373696662
483 changed files with 56514 additions and 52451 deletions
78
liblua/ltm.c
78
liblua/ltm.c
|
@ -22,26 +22,27 @@
|
|||
static const char udatatypename[] = "userdata";
|
||||
|
||||
LUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTAGS] = {
|
||||
"no value",
|
||||
"nil", "boolean", udatatypename, "number",
|
||||
"string", "table", "function", udatatypename, "thread",
|
||||
"proto", "upval" /* these last two cases are used for tests only */
|
||||
"no value",
|
||||
"nil", "boolean", udatatypename, "number",
|
||||
"string", "table", "function", udatatypename, "thread",
|
||||
"proto", "upval" /* these last two cases are used for tests only */
|
||||
};
|
||||
|
||||
|
||||
void luaT_init (lua_State *L) {
|
||||
static const char *const luaT_eventname[] = { /* ORDER TM */
|
||||
"__index", "__newindex",
|
||||
"__gc", "__mode", "__len", "__eq",
|
||||
"__add", "__sub", "__mul", "__div", "__mod",
|
||||
"__pow", "__unm", "__lt", "__le",
|
||||
"__concat", "__call"
|
||||
};
|
||||
int i;
|
||||
for (i=0; i<TM_N; i++) {
|
||||
G(L)->tmname[i] = luaS_new(L, luaT_eventname[i]);
|
||||
luaS_fix(G(L)->tmname[i]); /* never collect these names */
|
||||
}
|
||||
void luaT_init(lua_State *L)
|
||||
{
|
||||
static const char *const luaT_eventname[] = { /* ORDER TM */
|
||||
"__index", "__newindex",
|
||||
"__gc", "__mode", "__len", "__eq",
|
||||
"__add", "__sub", "__mul", "__div", "__mod",
|
||||
"__pow", "__unm", "__lt", "__le",
|
||||
"__concat", "__call"
|
||||
};
|
||||
int i;
|
||||
for (i = 0; i < TM_N; i++) {
|
||||
G(L)->tmname[i] = luaS_new(L, luaT_eventname[i]);
|
||||
luaS_fix(G(L)->tmname[i]); /* never collect these names */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,29 +50,30 @@ void luaT_init (lua_State *L) {
|
|||
** function to be used with macro "fasttm": optimized for absence of
|
||||
** tag methods
|
||||
*/
|
||||
const TValue *luaT_gettm (Table *events, TMS event, TString *ename) {
|
||||
const TValue *tm = luaH_getstr(events, ename);
|
||||
lua_assert(event <= TM_EQ);
|
||||
if (ttisnil(tm)) { /* no tag method? */
|
||||
events->flags |= cast_byte(1u<<event); /* cache this fact */
|
||||
return NULL;
|
||||
}
|
||||
else return tm;
|
||||
const TValue *luaT_gettm(Table *events, TMS event, TString *ename)
|
||||
{
|
||||
const TValue *tm = luaH_getstr(events, ename);
|
||||
lua_assert(event <= TM_EQ);
|
||||
if (ttisnil(tm)) { /* no tag method? */
|
||||
events->flags |= cast_byte(1u << event); /* cache this fact */
|
||||
return NULL;
|
||||
} else return tm;
|
||||
}
|
||||
|
||||
|
||||
const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {
|
||||
Table *mt;
|
||||
switch (ttypenv(o)) {
|
||||
case LUA_TTABLE:
|
||||
mt = hvalue(o)->metatable;
|
||||
break;
|
||||
case LUA_TUSERDATA:
|
||||
mt = uvalue(o)->metatable;
|
||||
break;
|
||||
default:
|
||||
mt = G(L)->mt[ttypenv(o)];
|
||||
}
|
||||
return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject);
|
||||
const TValue *luaT_gettmbyobj(lua_State *L, const TValue *o, TMS event)
|
||||
{
|
||||
Table *mt;
|
||||
switch (ttypenv(o)) {
|
||||
case LUA_TTABLE:
|
||||
mt = hvalue(o)->metatable;
|
||||
break;
|
||||
case LUA_TUSERDATA:
|
||||
mt = uvalue(o)->metatable;
|
||||
break;
|
||||
default:
|
||||
mt = G(L)->mt[ttypenv(o)];
|
||||
}
|
||||
return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue