typedef unsigned long long size_t; typedef long long ptrdiff_t; typedef long long intptr_t; typedef long long int64_t; typedef unsigned long long uint64_t; typedef int int32_t; typedef unsigned int uint32_t; typedef short int16_t; typedef unsigned short uint16_t; typedef char int8_t; typedef unsigned char uint8_t; typedef size_t lu_mem; typedef ptrdiff_t l_mem; typedef unsigned char lu_byte; typedef uint16_t LuaType; #define NULL ((void *)0) typedef struct lua_State lua_State; #define LUA_TNONE (-1) #define LUA_TNIL 0 #define LUA_TBOOLEAN 1 #define LUA_TLIGHTUSERDATA 2 #define LUA_TNUMBER 3 #define LUA_TSTRING 4 #define LUA_TTABLE 5 #define LUA_TFUNCTION 6 #define LUA_TUSERDATA 7 #define LUA_TTHREAD 8 #define LUA_OK 0 typedef enum { TM_INDEX, TM_NEWINDEX, TM_GC, TM_MODE, TM_LEN, TM_EQ, TM_ADD, TM_SUB, TM_MUL, TM_MOD, TM_POW, TM_DIV, TM_IDIV, TM_BAND, TM_BOR, TM_BXOR, TM_SHL, TM_SHR, TM_UNM, TM_BNOT, TM_LT, TM_LE, TM_CONCAT, TM_CALL, TM_N } TMS; typedef double lua_Number; typedef int64_t lua_Integer; typedef uint64_t lua_Unsigned; typedef int (*lua_CFunction) (lua_State * L); typedef union { lua_Number n; double u; void *s; lua_Integer i; long l; } L_Umaxalign; #define lua_assert(c) ((void)0) #define check_exp(c,e) (e) #define lua_longassert(c) ((void)0) #define luai_apicheck(l,e) lua_assert(e) #define api_check(l,e,msg) luai_apicheck(l,(e) && msg) #define UNUSED(x) ((void)(x)) #define cast(t, exp) ((t)(exp)) #define cast_void(i) cast(void, (i)) #define cast_byte(i) cast(lu_byte, (i)) #define cast_num(i) cast(lua_Number, (i)) #define cast_int(i) cast(int, (i)) #define cast_uchar(i) cast(unsigned char, (i)) #define l_castS2U(i) ((lua_Unsigned)(i)) #define l_castU2S(i) ((lua_Integer)(i)) #define l_noret void typedef unsigned int Instruction; #define luai_numidiv(L,a,b) ((void)L, l_floor(luai_numdiv(L,a,b))) #define luai_numdiv(L,a,b) ((a)/(b)) #define luai_nummod(L,a,b,m) \ { (m) = l_mathop(fmod)(a,b); if ((m)*(b) < 0) (m) += (b); } #define LUA_TLCL (LUA_TFUNCTION | (0 << 4)) #define LUA_TLCF (LUA_TFUNCTION | (1 << 4)) #define LUA_TCCL (LUA_TFUNCTION | (2 << 4)) #define RAVI_TFCF (LUA_TFUNCTION | (4 << 4)) #define LUA_TSHRSTR (LUA_TSTRING | (0 << 4)) #define LUA_TLNGSTR (LUA_TSTRING | (1 << 4)) #define LUA_TNUMFLT (LUA_TNUMBER | (0 << 4)) #define LUA_TNUMINT (LUA_TNUMBER | (1 << 4)) #define RAVI_TIARRAY (LUA_TTABLE | (1 << 4)) #define RAVI_TFARRAY (LUA_TTABLE | (2 << 4)) #define BIT_ISCOLLECTABLE (1 << 15) #define ctb(t) ((t) | BIT_ISCOLLECTABLE) typedef struct GCObject GCObject; #define CommonHeader GCObject *next; lu_byte tt; lu_byte marked struct GCObject { CommonHeader; }; typedef union Value { GCObject *gc; void *p; int b; lua_CFunction f; lua_Integer i; lua_Number n; } Value; #define TValuefields Value value_; LuaType tt_ typedef struct lua_TValue { TValuefields; } TValue; #define NILCONSTANT {NULL}, LUA_TNIL #define val_(o) ((o)->value_) #define rttype(o) ((o)->tt_) #define novariant(x) ((x) & 0x0F) #define ttype(o) (rttype(o) & 0x7F) #define ttnov(o) (novariant(rttype(o))) #define checktag(o,t) (rttype(o) == (t)) #define checktype(o,t) (ttnov(o) == (t)) #define ttisnumber(o) checktype((o), LUA_TNUMBER) #define ttisfloat(o) checktag((o), LUA_TNUMFLT) #define ttisinteger(o) checktag((o), LUA_TNUMINT) #define ttisnil(o) checktag((o), LUA_TNIL) #define ttisboolean(o) checktag((o), LUA_TBOOLEAN) #define ttislightuserdata(o) checktag((o), LUA_TLIGHTUSERDATA) #define ttisstring(o) checktype((o), LUA_TSTRING) #define ttisshrstring(o) checktag((o), ctb(LUA_TSHRSTR)) #define ttislngstring(o) checktag((o), ctb(LUA_TLNGSTR)) #define ttistable(o) checktype((o), LUA_TTABLE) #define ttisiarray(o) checktag((o), ctb(RAVI_TIARRAY)) #define ttisfarray(o) checktag((o), ctb(RAVI_TFARRAY)) #define ttisarray(o) (ttisiarray(o) || ttisfarray(o)) #define ttisLtable(o) checktag((o), ctb(LUA_TTABLE)) #define ttisfunction(o) checktype(o, LUA_TFUNCTION) #define ttisclosure(o) ((rttype(o) & 0x1F) == LUA_TFUNCTION) #define ttisCclosure(o) checktag((o), ctb(LUA_TCCL)) #define ttisLclosure(o) checktag((o), ctb(LUA_TLCL)) #define ttislcf(o) checktag((o), LUA_TLCF) #define ttisfcf(o) (ttype(o) == RAVI_TFCF) #define ttisfulluserdata(o) checktag((o), ctb(LUA_TUSERDATA)) #define ttisthread(o) checktag((o), ctb(LUA_TTHREAD)) #define ttisdeadkey(o) checktag((o), LUA_TDEADKEY) #define ivalue(o) check_exp(ttisinteger(o), val_(o).i) #define fltvalue(o) check_exp(ttisfloat(o), val_(o).n) #define nvalue(o) check_exp(ttisnumber(o), \ (ttisinteger(o) ? cast_num(ivalue(o)) : fltvalue(o))) #define gcvalue(o) check_exp(iscollectable(o), val_(o).gc) #define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p) #define tsvalue(o) check_exp(ttisstring(o), gco2ts(val_(o).gc)) #define uvalue(o) check_exp(ttisfulluserdata(o), gco2u(val_(o).gc)) #define clvalue(o) check_exp(ttisclosure(o), gco2cl(val_(o).gc)) #define clLvalue(o) check_exp(ttisLclosure(o), gco2lcl(val_(o).gc)) #define clCvalue(o) check_exp(ttisCclosure(o), gco2ccl(val_(o).gc)) #define fvalue(o) check_exp(ttislcf(o), val_(o).f) #define fcfvalue(o) check_exp(ttisfcf(o), val_(o).p) #define hvalue(o) check_exp(ttistable(o), gco2t(val_(o).gc)) #define arrvalue(o) check_exp(ttisarray(o), gco2array(val_(o).gc)) #define arrvalue(o) check_exp(ttisarray(o), gco2array(val_(o).gc)) #define bvalue(o) check_exp(ttisboolean(o), val_(o).b) #define thvalue(o) check_exp(ttisthread(o), gco2th(val_(o).gc)) #define deadvalue(o) check_exp(ttisdeadkey(o), cast(void *, val_(o).gc)) #define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) #define iscollectable(o) (rttype(o) & BIT_ISCOLLECTABLE) #define righttt(obj) (ttype(obj) == gcvalue(obj)->tt) #define checkliveness(L,obj) \ lua_longassert(!iscollectable(obj) || \ (righttt(obj) && (L == NULL || !isdead(G(L),gcvalue(obj))))) #define settt_(o,t) ((o)->tt_=(t)) #define setfltvalue(obj,x) \ { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMFLT); } #define chgfltvalue(obj,x) \ { TValue *io=(obj); lua_assert(ttisfloat(io)); val_(io).n=(x); } #define setivalue(obj,x) \ { TValue *io=(obj); val_(io).i=(x); settt_(io, LUA_TNUMINT); } #define chgivalue(obj,x) \ { TValue *io=(obj); lua_assert(ttisinteger(io)); val_(io).i=(x); } #define setnilvalue(obj) settt_(obj, LUA_TNIL) #define setfvalue(obj,x) \ { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_TLCF); } #define setfvalue_fastcall(obj, x, tag) \ { \ TValue *io = (obj); \ lua_assert(tag >= 1 && tag < 0x80); \ val_(io).p = (x); \ settt_(io, ((tag << 8) | RAVI_TFCF)); \ } #define setpvalue(obj,x) \ { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_TLIGHTUSERDATA); } #define setbvalue(obj,x) \ { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); } #define setgcovalue(L,obj,x) \ { TValue *io = (obj); GCObject *i_g=(x); \ val_(io).gc = i_g; settt_(io, ctb(i_g->tt)); } #define setsvalue(L,obj,x) \ { TValue *io = (obj); TString *x_ = (x); \ val_(io).gc = obj2gco(x_); settt_(io, ctb(x_->tt)); \ checkliveness(L,io); } #define setuvalue(L,obj,x) \ { TValue *io = (obj); Udata *x_ = (x); \ val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TUSERDATA)); \ checkliveness(L,io); } #define setthvalue(L,obj,x) \ { TValue *io = (obj); lua_State *x_ = (x); \ val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTHREAD)); \ checkliveness(L,io); } #define setclLvalue(L,obj,x) \ { TValue *io = (obj); LClosure *x_ = (x); \ val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TLCL)); \ checkliveness(L,io); } #define setclCvalue(L,obj,x) \ { TValue *io = (obj); CClosure *x_ = (x); \ val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TCCL)); \ checkliveness(L,io); } #define sethvalue(L,obj,x) \ { TValue *io = (obj); Table *x_ = (x); \ val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTABLE)); \ checkliveness(L,io); } #define setiarrayvalue(L,obj,x) \ { TValue *io = (obj); Table *x_ = (x); \ val_(io).gc = obj2gco(x_); settt_(io, ctb(RAVI_TIARRAY)); \ checkliveness(L,io); } #define setfarrayvalue(L,obj,x) \ { TValue *io = (obj); Table *x_ = (x); \ val_(io).gc = obj2gco(x_); settt_(io, ctb(RAVI_TFARRAY)); \ checkliveness(L,io); } #define setdeadvalue(obj) settt_(obj, LUA_TDEADKEY) #define setobj(L,obj1,obj2) \ { TValue *io1=(obj1); const TValue *io2=(obj2); io1->tt_ = io2->tt_; val_(io1).n = val_(io2).n; \ (void)L; checkliveness(L,io1); } #define setobjs2s setobj #define setobj2s setobj #define setsvalue2s setsvalue #define sethvalue2s sethvalue #define setptvalue2s setptvalue #define setobjt2t setobj #define setobj2n setobj #define setsvalue2n setsvalue #define setobj2t setobj typedef TValue *StkId; typedef struct TString { CommonHeader; lu_byte extra; lu_byte shrlen; unsigned int hash; union { size_t lnglen; struct TString *hnext; } u; } TString; typedef union UTString { L_Umaxalign dummy; TString tsv; } UTString; #define getstr(ts) \ check_exp(sizeof((ts)->extra), cast(char *, (ts)) + sizeof(UTString)) #define svalue(o) getstr(tsvalue(o)) #define tsslen(s) ((s)->tt == LUA_TSHRSTR ? (s)->shrlen : (s)->u.lnglen) #define vslen(o) tsslen(tsvalue(o)) typedef struct Udata { CommonHeader; LuaType ttuv_; struct Table *metatable; size_t len; union Value user_; } Udata; typedef union UUdata { L_Umaxalign dummy; Udata uv; } UUdata; #define getudatamem(u) \ check_exp(sizeof((u)->ttuv_), (cast(char*, (u)) + sizeof(UUdata))) #define setuservalue(L,u,o) \ { const TValue *io=(o); Udata *iu = (u); \ iu->user_ = io->value_; iu->ttuv_ = rttype(io); \ checkliveness(L,io); } #define getuservalue(L,u,o) \ { TValue *io=(o); const Udata *iu = (u); \ io->value_ = iu->user_; settt_(io, iu->ttuv_); \ checkliveness(L,io); } typedef enum { RAVI_TANY = 0, RAVI_TNUMINT = 1, RAVI_TNUMFLT, RAVI_TARRAYINT, RAVI_TARRAYFLT, RAVI_TFUNCTION, RAVI_TTABLE, RAVI_TSTRING, RAVI_TNIL, RAVI_TBOOLEAN, RAVI_TUSERDATA } ravitype_t; typedef struct Upvaldesc { TString *name; TString *usertype; lu_byte ravi_type; lu_byte instack; lu_byte idx; } Upvaldesc; typedef struct LocVar { TString *varname; TString *usertype; int startpc; int endpc; lu_byte ravi_type; } LocVar; typedef enum { RAVI_JIT_NOT_COMPILED = 0, RAVI_JIT_CANT_COMPILE = 1, RAVI_JIT_COMPILED = 2 } ravi_jit_status_t; typedef enum { RAVI_JIT_FLAG_NONE = 0, RAVI_JIT_FLAG_HASFORLOOP = 1 } ravi_jit_flag_t; typedef struct RaviJITProto { lu_byte jit_status; lu_byte jit_flags; unsigned short execution_count; void *jit_data; lua_CFunction jit_function; } RaviJITProto; typedef struct Proto { CommonHeader; lu_byte numparams; lu_byte is_vararg; lu_byte maxstacksize; int sizeupvalues; int sizek; int sizecode; int sizelineinfo; int sizep; int sizelocvars; int linedefined; int lastlinedefined; TValue *k; Instruction *code; struct Proto **p; int *lineinfo; LocVar *locvars; Upvaldesc *upvalues; struct LClosure *cache; TString *source; GCObject *gclist; RaviJITProto ravi_jit; } Proto; typedef struct UpVal UpVal; #define ClosureHeader \ CommonHeader; lu_byte nupvalues; GCObject *gclist typedef struct CClosure { ClosureHeader; lua_CFunction f; TValue upvalue[1]; } CClosure; typedef struct LClosure { ClosureHeader; struct Proto *p; UpVal *upvals[1]; } LClosure; typedef union Closure { CClosure c; LClosure l; } Closure; #define isLfunction(o) ttisLclosure(o) #define getproto(o) (clLvalue(o)->p) typedef union TKey { struct { TValuefields; int next; } nk; TValue tvk; } TKey; #define setnodekey(L,key,obj) \ { TKey *k_=(key); const TValue *io_=(obj); \ k_->nk.value_ = io_->value_; k_->nk.tt_ = io_->tt_; \ (void)L; checkliveness(L,io_); } typedef struct Node { TValue i_val; TKey i_key; } Node; typedef enum RaviArrayModifer { RAVI_ARRAY_SLICE = 1, RAVI_ARRAY_FIXEDSIZE = 2, RAVI_ARRAY_ALLOCATED = 4, RAVI_ARRAY_ISFLOAT = 8 } RaviArrayModifier; enum { RAVI_ARRAY_MAX_INLINE = 3, }; typedef struct RaviArray { CommonHeader; lu_byte flags; unsigned int len; unsigned int size; union { lua_Number numarray[RAVI_ARRAY_MAX_INLINE]; lua_Integer intarray[RAVI_ARRAY_MAX_INLINE]; struct RaviArray *parent; }; char *data; struct Table *metatable; } RaviArray; typedef struct Table { CommonHeader; lu_byte flags; lu_byte lsizenode; unsigned int sizearray; TValue *array; Node *node; Node *lastfree; struct Table *metatable; GCObject *gclist; unsigned int hmask; } Table; typedef struct Mbuffer { char *buffer; size_t n; size_t buffsize; } Mbuffer; typedef struct stringtable { TString **hash; int nuse; int size; } stringtable; struct lua_Debug; typedef intptr_t lua_KContext; typedef int (*lua_KFunction) (struct lua_State * L, int status, lua_KContext ctx); typedef void *(*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); typedef void (*lua_Hook) (struct lua_State * L, struct lua_Debug * ar); typedef struct CallInfo { StkId func; StkId top; struct CallInfo *previous, *next; union { struct { StkId base; const Instruction *savedpc; } l; struct { lua_KFunction k; ptrdiff_t old_errfunc; lua_KContext ctx; } c; } u; ptrdiff_t extra; short nresults; unsigned short callstatus; unsigned short stacklevel; lu_byte jitstatus; lu_byte magic; } CallInfo; #define CIST_OAH (1<<0) #define CIST_LUA (1<<1) #define CIST_HOOKED (1<<2) #define CIST_FRESH (1<<3) #define CIST_YPCALL (1<<4) #define CIST_TAIL (1<<5) #define CIST_HOOKYIELD (1<<6) #define CIST_LEQ (1<<7) #define CIST_FIN (1<<8) #define isLua(ci) ((ci)->callstatus & CIST_LUA) #define isJITed(ci) ((ci)->jitstatus) #define setoah(st,v) ((st) = ((st) & ~CIST_OAH) | (v)) #define getoah(st) ((st) & CIST_OAH) typedef struct global_State global_State; struct lua_State { CommonHeader; lu_byte status; StkId top; global_State *l_G; CallInfo *ci; const Instruction *oldpc; StkId stack_last; StkId stack; UpVal *openupval; GCObject *gclist; struct lua_State *twups; struct lua_longjmp *errorJmp; CallInfo base_ci; volatile lua_Hook hook; ptrdiff_t errfunc; int stacksize; int basehookcount; int hookcount; unsigned short nny; unsigned short nCcalls; lu_byte hookmask; lu_byte allowhook; unsigned short nci; lu_byte magic; }; #define G(L) (L->l_G) union GCUnion { GCObject gc; struct TString ts; struct Udata u; union Closure cl; struct Table h; struct RaviArray arr; struct Proto p; struct lua_State th; }; struct UpVal { TValue *v; lu_mem refcount; union { struct { UpVal *next; int touched; } open; TValue value; } u; }; #define cast_u(o) cast(union GCUnion *, (o)) #define gco2ts(o) \ check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts)) #define gco2u(o) check_exp((o)->tt == LUA_TUSERDATA, &((cast_u(o))->u)) #define gco2lcl(o) check_exp((o)->tt == LUA_TLCL, &((cast_u(o))->cl.l)) #define gco2ccl(o) check_exp((o)->tt == LUA_TCCL, &((cast_u(o))->cl.c)) #define gco2cl(o) \ check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl)) #define gco2t(o) check_exp((o)->tt == LUA_TTABLE, &((cast_u(o))->h)) #define gco2array(o) check_exp(((o)->tt == RAVI_TIARRAY || (o)->tt == RAVI_TFARRAY), &((cast_u(o))->arr)) #define gco2p(o) check_exp((o)->tt == LUA_TPROTO, &((cast_u(o))->p)) #define gco2th(o) check_exp((o)->tt == LUA_TTHREAD, &((cast_u(o))->th)) #define obj2gco(v) \ check_exp(novariant((v)->tt) < LUA_TDEADKEY, (&(cast_u(v)->gc))) #define LUA_FLOORN2I 0 #define tonumber(o,n) \ (ttisfloat(o) ? (*(n) = fltvalue(o), 1) : luaV_tonumber_(o,n)) #define tointeger(o,i) \ (ttisinteger(o) ? (*(i) = ivalue(o), 1) : luaV_tointeger(o,i,LUA_FLOORN2I)) extern int luaV_tonumber_ (const TValue * obj, lua_Number * n); extern int luaV_tointeger (const TValue * obj, lua_Integer * p, int mode); extern void luaF_close (lua_State * L, StkId level); extern int luaD_poscall (lua_State * L, CallInfo * ci, StkId firstResult, int nres); extern void luaD_growstack (lua_State * L, int n); extern int luaV_equalobj (lua_State * L, const TValue * t1, const TValue * t2); extern int luaV_lessthan (lua_State * L, const TValue * l, const TValue * r); extern int luaV_lessequal (lua_State * L, const TValue * l, const TValue * r); extern void luaV_gettable (lua_State * L, const TValue * t, TValue * key, StkId val); extern void luaV_settable (lua_State * L, const TValue * t, TValue * key, StkId val); extern int luaV_execute (lua_State * L); extern int luaD_precall (lua_State * L, StkId func, int nresults, int op_call); extern void raviV_op_newtable (lua_State * L, CallInfo * ci, TValue * ra, int b, int c); extern void raviV_op_newarrayint (lua_State * L, CallInfo * ci, TValue * ra); extern void raviV_op_newarrayfloat (lua_State * L, CallInfo * ci, TValue * ra); extern void luaO_arith (lua_State * L, int op, const TValue * p1, const TValue * p2, TValue * res); extern void raviV_op_setlist (lua_State * L, CallInfo * ci, TValue * ra, int b, int c); extern void raviV_op_concat (lua_State * L, CallInfo * ci, int a, int b, int c); extern void raviV_op_closure (lua_State * L, CallInfo * ci, LClosure * cl, int a, int Bx); extern void raviV_op_vararg (lua_State * L, CallInfo * ci, LClosure * cl, int a, int b); extern void luaV_objlen (lua_State * L, StkId ra, const TValue * rb); extern int luaV_forlimit (const TValue * obj, lua_Integer * p, lua_Integer step, int *stopnow); extern void raviV_op_setupval (lua_State * L, LClosure * cl, TValue * ra, int b); extern void raviV_op_setupvali (lua_State * L, LClosure * cl, TValue * ra, int b); extern void raviV_op_setupvalf (lua_State * L, LClosure * cl, TValue * ra, int b); extern void raviV_op_setupvalai (lua_State * L, LClosure * cl, TValue * ra, int b); extern void raviV_op_setupvalaf (lua_State * L, LClosure * cl, TValue * ra, int b); extern void raviV_op_setupvalt (lua_State * L, LClosure * cl, TValue * ra, int b); extern void raise_error (lua_State * L, int errorcode); extern void raise_error_with_info (lua_State * L, int errorcode, const char *info); extern void luaD_call (lua_State * L, StkId func, int nResults); extern void raviH_set_int (lua_State * L, RaviArray * t, lua_Unsigned key, lua_Integer value); extern void raviH_set_float (lua_State * L, RaviArray * t, lua_Unsigned key, lua_Number value); extern int raviV_check_usertype (lua_State * L, TString * name, const TValue * o); extern void luaT_trybinTM (lua_State * L, const TValue * p1, const TValue * p2, TValue * res, TMS event); extern void raviV_gettable_sskey (lua_State * L, const TValue * t, TValue * key, TValue * val); extern void raviV_settable_sskey (lua_State * L, const TValue * t, TValue * key, TValue * val); extern void raviV_gettable_i (lua_State * L, const TValue * t, TValue * key, TValue * val); extern void raviV_settable_i (lua_State * L, const TValue * t, TValue * key, TValue * val); extern lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y); extern void ravi_dump_value (lua_State * L, const struct lua_TValue *v); extern void raviV_op_bnot (lua_State * L, TValue * ra, TValue * rb); #define R(i) (base + i) #define K(i) (k + i) #define S(i) (stackbase + i) #define stackoverflow(L, n) (((int)(L->top - L->stack) + (n) + 5) >= L->stacksize) #define savestack(L,p) ((char *)(p) - (char *)L->stack) #define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) #define tonumberns(o,n) \ (ttisfloat(o) ? ((n) = fltvalue(o), 1) : \ (ttisinteger(o) ? ((n) = cast_num(ivalue(o)), 1) : 0)) #define intop(op,v1,v2) l_castU2S(l_castS2U(v1) op l_castS2U(v2)) #define nan (0./0.) #define inf (1./0.) #define luai_numunm(L,a) (-(a)) extern int __ravifunc_1 (lua_State * L); int __ravifunc_1 (lua_State * L) { int error_code = 0; int result = 0; CallInfo *ci = L->ci; LClosure *cl = clLvalue (ci->func); TValue *k = cl->p->k; StkId base = ci->u.l.base; lua_Integer i_0 = 0, i_1 = 0, i_2 = 0, i_3 = 0, i_4 = 0, i_5 = 0, i_6 = 0, i_7 = 0, i_8 = 0, i_9 = 0, i_10 = 0, i_11 = 0, i_12 = 0, i_13 = 0, i_14 = 0, i_15 = 0, i_16 = 0, i_17 = 0, i_18 = 0, i_19 = 0, i_20 = 0, i_21 = 0, i_22 = 0, i_23 = 0; TValue ival; settt_ (&ival, LUA_TNUMINT); TValue fval; settt_ (&fval, LUA_TNUMFLT); TValue bval; settt_ (&bval, LUA_TBOOLEAN); TValue nilval; setnilvalue (&nilval); L0: { TValue *tab = cl->upvals[0]->v; TValue *name = K (0); TValue *dst = R (1); raviV_gettable_sskey (L, tab, name, dst); base = ci->u.l.base; } { TValue *tab = R (1); TValue *name = K (1); TValue *dst = R (2); raviV_gettable_sskey (L, tab, name, dst); base = ci->u.l.base; } if (stackoverflow (L, 3)) { luaD_growstack (L, 3); base = ci->u.l.base; } L->top = R (2) + 2; { TValue *dst_reg = R (3); setivalue (dst_reg, 8190); } { TValue *ra = R (2); int result = luaD_precall (L, ra, 1, 1); if (result) { if (result == 1 && 1 >= 0) L->top = ci->top; } else { /* Lua function */ result = luaV_execute (L); if (result) L->top = ci->top; } base = ci->u.l.base; } { TValue *ra = R (2); if (!ttisiarray (ra)) { error_code = 2; goto Lraise_error; } } { const TValue *src_reg = R (2); TValue *dst_reg = R (0); dst_reg->tt_ = src_reg->tt_; dst_reg->value_.n = src_reg->value_.n; } i_5 = 0; i_6 = 100000; i_7 = 1; { i_8 = 0 < i_7; } { i_5 = i_5 - i_7; } goto L2; L1: return result; Lraise_error: raise_error (L, error_code); /* does not return */ return result; L2: { i_5 = i_5 + i_7; } { if (i_8 != 0) goto L3; else goto L4; } L3: { i_9 = i_6 < i_5; } { if (i_9 != 0) goto L6; else goto L5; } L4: { i_9 = i_5 < i_6; } { if (i_9 != 0) goto L6; else goto L5; } L5: i_4 = i_5; i_3 = 0; i_11 = 0; i_12 = 8190; i_13 = 1; { i_14 = 0 < i_13; } { i_11 = i_11 - i_13; } goto L7; L6: { TValue *stackbase = ci->func; int wanted = ci->nresults; result = wanted == -1 ? 0 : 1; if (wanted == -1) wanted = 1; int j = 0; if (0 < wanted) { { TValue *dst_reg = S (0); setivalue (dst_reg, i_3); } } j++; while (j < wanted) { setnilvalue (S (j)); j++; } L->top = S (0) + wanted; L->ci = ci->previous; } goto L1; L7: { i_11 = i_11 + i_13; } { if (i_14 != 0) goto L8; else goto L9; } L8: { i_15 = i_12 < i_11; } { if (i_15 != 0) goto L11; else goto L10; } L9: { i_15 = i_11 < i_12; } { if (i_15 != 0) goto L11; else goto L10; } L10: i_10 = i_11; { RaviArray *arr = arrvalue (R (0)); lua_Unsigned ukey = (lua_Unsigned) i_10; lua_Integer *iptr = (lua_Integer *) arr->data; if (ukey < (lua_Unsigned) (arr->len)) { iptr[ukey] = 1; } else { raviH_set_int (L, arr, ukey, 1); } } goto L7; L11: i_12 = 0; i_13 = 8190; i_14 = 1; { i_15 = 0 < i_14; } { i_12 = i_12 - i_14; } goto L12; L12: { i_12 = i_12 + i_14; } { if (i_15 != 0) goto L13; else goto L14; } L13: { i_10 = i_13 < i_12; } { if (i_10 != 0) goto L16; else goto L15; } L14: { i_10 = i_12 < i_13; } { if (i_10 != 0) goto L16; else goto L15; } L15: i_11 = i_12; goto L17; L16: goto L2; L17: { RaviArray *arr = arrvalue (R (0)); lua_Unsigned ukey = (lua_Unsigned) i_11; lua_Integer *iptr = (lua_Integer *) arr->data; i_16 = iptr[ukey]; } { TValue *dst_reg = R (3); setbvalue (dst_reg, i_16 == 1); } { const TValue *src_reg = R (3); if (!l_isfalse (src_reg)) goto L18; else goto L19; } L18: { i_16 = i_11 + i_11; } { i_17 = i_16 + 3; } i_2 = i_17; { i_16 = i_11 + i_2; } i_18 = i_16; i_19 = 8190; i_20 = i_2; { i_21 = 0 < i_20; } { i_18 = i_18 - i_20; } goto L20; L19: goto L12; L20: { i_18 = i_18 + i_20; } { if (i_21 != 0) goto L21; else goto L22; } L21: { i_22 = i_19 < i_18; } { if (i_22 != 0) goto L24; else goto L23; } L22: { i_22 = i_18 < i_19; } { if (i_22 != 0) goto L24; else goto L23; } L23: i_17 = i_18; { RaviArray *arr = arrvalue (R (0)); lua_Unsigned ukey = (lua_Unsigned) i_17; lua_Integer *iptr = (lua_Integer *) arr->data; if (ukey < (lua_Unsigned) (arr->len)) { iptr[ukey] = 0; } else { raviH_set_int (L, arr, ukey, 0); } } goto L20; L24: { i_18 = i_3 + 1; } i_3 = i_18; goto L19; }