#include "llimits.h"
#include "lua.h"
Go to the source code of this file.
Data Structures | |
struct | GCheader |
union | Value |
struct | lua_TObject |
union | TString |
union | Udata |
struct | Proto |
struct | LocVar |
struct | UpVal |
struct | CClosure |
struct | LClosure |
union | Closure |
struct | Node |
struct | Table |
Defines | |
#define | NUM_TAGS LUA_TTHREAD |
#define | LUA_TPROTO (NUM_TAGS+1) |
#define | LUA_TUPVAL (NUM_TAGS+2) |
#define | CommonHeader /*@dependent@*/ /*@null@*/ GCObject *next; lu_byte tt; lu_byte marked |
#define | ttisnil(o) (ttype(o) == LUA_TNIL) |
#define | ttisnumber(o) (ttype(o) == LUA_TNUMBER) |
#define | ttisstring(o) (ttype(o) == LUA_TSTRING) |
#define | ttistable(o) (ttype(o) == LUA_TTABLE) |
#define | ttisfunction(o) (ttype(o) == LUA_TFUNCTION) |
#define | ttisboolean(o) (ttype(o) == LUA_TBOOLEAN) |
#define | ttisuserdata(o) (ttype(o) == LUA_TUSERDATA) |
#define | ttisthread(o) (ttype(o) == LUA_TTHREAD) |
#define | ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA) |
#define | ttype(o) ((o)->tt) |
#define | gcvalue(o) check_exp(iscollectable(o), (o)->value.gc) |
#define | pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p) |
#define | nvalue(o) check_exp(ttisnumber(o), (o)->value.n) |
#define | tsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts) |
#define | uvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u) |
#define | clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl) |
#define | hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h) |
#define | bvalue(o) check_exp(ttisboolean(o), (o)->value.b) |
#define | thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th) |
#define | l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) |
#define | setnvalue(obj, x) { TObject *i_o=(obj); i_o->tt=LUA_TNUMBER; i_o->value.n=(x); } |
#define | chgnvalue(obj, x) check_exp(ttype(obj)==LUA_TNUMBER, (obj)->value.n=(x)) |
#define | setpvalue(obj, x) { TObject *i_o=(obj); i_o->tt=LUA_TLIGHTUSERDATA; i_o->value.p=(x); } |
#define | setbvalue(obj, x) { TObject *i_o=(obj); i_o->tt=LUA_TBOOLEAN; i_o->value.b=(x); } |
#define | setsvalue(obj, x) |
#define | setuvalue(obj, x) |
#define | setthvalue(obj, x) |
#define | setclvalue(obj, x) |
#define | sethvalue(obj, x) |
#define | setnilvalue(obj) ((obj)->tt=LUA_TNIL) |
#define | checkconsistency(obj) lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt)) |
#define | setobj(obj1, obj2) |
#define | setobjs2s setobj |
#define | setobj2s setobj |
#define | setsvalue2s setsvalue |
#define | setobjt2t setobj |
#define | setobj2t setobj |
#define | setobj2n setobj |
#define | setsvalue2n setsvalue |
#define | setttype(obj, tt) (ttype(obj) = (tt)) |
#define | iscollectable(o) (ttype(o) >= LUA_TSTRING) |
#define | getstr(ts) cast(const char *, (ts) + 1) |
#define | svalue(o) getstr(tsvalue(o)) |
#define | ClosureHeader CommonHeader; lu_byte isC; lu_byte nupvalues; /*@null@*/ GCObject *gclist |
#define | iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC) |
#define | isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC) |
#define | lmod(s, size) check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1)))) |
#define | twoto(x) (1<<(x)) |
#define | sizenode(t) (twoto((t)->lsizenode)) |
#define | fb2int(x) (((x) & 7) << ((x) >> 3)) |
Typedefs | |
typedef GCObject | GCObject |
typedef lua_TObject | TObject |
typedef TObject * | StkId |
Functions | |
int | luaO_log2 (unsigned int x) |
int | luaO_int2fb (unsigned int x) |
int | luaO_rawequalObj (const TObject *t1, const TObject *t2) |
int | luaO_str2d (const char *s, lua_Number *result) |
const char * | luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) |
const char * | luaO_pushfstring (lua_State *L, const char *fmt,...) |
void | luaO_chunkid (char *out, const char *source, int len) |
Variables | |
const TObject | luaO_nilobject |
#define bvalue | ( | o | ) | check_exp(ttisboolean(o), (o)->value.b) |
Definition at line 90 of file lobject.h.
Referenced by luaH_mainposition(), luaO_rawequalObj(), and luaV_equalval().
#define checkconsistency | ( | obj | ) | lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt)) |
#define chgnvalue | ( | obj, | |||
x | ) | check_exp(ttype(obj)==LUA_TNUMBER, (obj)->value.n=(x)) |
#define clvalue | ( | o | ) | check_exp(ttisfunction(o), &(o)->value.gc->cl) |
Definition at line 88 of file lobject.h.
Referenced by aux_upvalue(), auxgetinfo(), funcinfo(), lua_dump(), lua_getfenv(), lua_pushupvalues(), lua_setfenv(), lua_tocfunction(), lua_topointer(), luaD_precall(), luaV_execute(), and negindex().
#define gcvalue | ( | o | ) | check_exp(iscollectable(o), (o)->value.gc) |
Definition at line 83 of file lobject.h.
Referenced by luaH_mainposition(), luaO_rawequalObj(), and luaV_equalval().
#define getstr | ( | ts | ) | cast(const char *, (ts) + 1) |
Definition at line 191 of file lobject.h.
Referenced by addinfo(), aux_upvalue(), DumpString(), funcinfo(), getvalue(), luaF_getlocalname(), luaS_newlstr(), luaV_strcmp(), luaX_errorline(), luaX_syntaxerror(), prefixexp(), and travglobals().
#define hvalue | ( | o | ) | check_exp(ttistable(o), &(o)->value.gc->h) |
Definition at line 89 of file lobject.h.
Referenced by Arith(), f_luaopen(), lua_getmetatable(), lua_next(), lua_rawget(), lua_rawgeti(), lua_rawset(), lua_rawseti(), lua_setmetatable(), lua_topointer(), luaH_new(), luaS_newudata(), luaT_gettmbyobj(), luaV_equalval(), luaV_gettable(), luaV_index(), luaV_settable(), traverseclosure(), and travglobals().
#define iscfunction | ( | o | ) | (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC) |
Definition at line 292 of file lobject.h.
Referenced by lua_iscfunction(), lua_pushupvalues(), lua_tocfunction(), and negindex().
#define iscollectable | ( | o | ) | (ttype(o) >= LUA_TSTRING) |
Definition at line 170 of file lobject.h.
Referenced by luaO_rawequalObj(), removekey(), and valismarked().
#define isLfunction | ( | o | ) | (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC) |
Definition at line 293 of file lobject.h.
Referenced by lua_dump(), lua_getfenv(), and lua_setfenv().
#define l_isfalse | ( | o | ) | (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) |
Definition at line 93 of file lobject.h.
Referenced by call_orderTM(), lua_toboolean(), and luaV_equalval().
#define lmod | ( | s, | |||
size | ) | check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1)))) |
Definition at line 326 of file lobject.h.
Referenced by luaS_newlstr(), luaS_resize(), and newlstr().
#define LUA_TPROTO (NUM_TAGS+1) |
Definition at line 22 of file lobject.h.
Referenced by freeobj(), luaF_newproto(), propagatemarks(), and reallymarkobject().
#define LUA_TUPVAL (NUM_TAGS+2) |
Definition at line 23 of file lobject.h.
Referenced by freeobj(), luaF_close(), and luaF_findupval().
#define nvalue | ( | o | ) | check_exp(ttisnumber(o), (o)->value.n) |
Definition at line 85 of file lobject.h.
Referenced by addk(), Arith(), arrayindex(), DumpConstants(), lua_tonumber(), luaH_get(), luaH_getnum(), luaH_mainposition(), luaH_set(), luaK_prefix(), luaO_rawequalObj(), luaV_equalval(), luaV_lessequal(), luaV_lessthan(), and luaV_tostring().
#define pvalue | ( | o | ) | check_exp(ttislightuserdata(o), (o)->value.p) |
Definition at line 84 of file lobject.h.
Referenced by lua_touserdata(), luaH_mainposition(), luaO_rawequalObj(), and luaV_equalval().
#define setbvalue | ( | obj, | |||
x | ) | { TObject *i_o=(obj); i_o->tt=LUA_TBOOLEAN; i_o->value.b=(x); } |
#define setclvalue | ( | obj, | |||
x | ) |
#define sethvalue | ( | obj, | |||
x | ) |
Value:
{ TObject *i_o=(obj); i_o->tt=LUA_TTABLE; \ i_o->value.gc=cast(GCObject *, (x)); \ lua_assert(i_o->value.gc->gch.tt == LUA_TTABLE); }
Definition at line 128 of file lobject.h.
Referenced by adjust_varargs(), f_luaopen(), lua_getmetatable(), lua_newtable(), and nil_constant().
#define setnilvalue | ( | obj | ) | ((obj)->tt=LUA_TNIL) |
Definition at line 133 of file lobject.h.
Referenced by adjust_varargs(), cleartablevalues(), f_luaopen(), info_tailcall(), LoadConstants(), lua_pushnil(), lua_settop(), luaD_poscall(), luaD_precall(), newkey(), nil_constant(), preinit_state(), removekey(), resize(), setarrayvector(), setnodevector(), stack_init(), and traversestack().
#define setnvalue | ( | obj, | |||
x | ) | { TObject *i_o=(obj); i_o->tt=LUA_TNUMBER; i_o->value.n=(x); } |
Definition at line 96 of file lobject.h.
Referenced by addk(), adjust_varargs(), Arith(), LoadConstants(), lua_pushnumber(), luaH_next(), luaH_setnum(), luaK_numberK(), luaO_pushvfstring(), and luaV_tonumber().
#define setobj | ( | obj1, | |||
obj2 | ) |
Value:
{ const TObject *o2=(obj2); TObject *o1=(obj1); \ checkconsistency(o2); \ o1->tt=o2->tt; o1->value = o2->value; }
Definition at line 144 of file lobject.h.
Referenced by lua_replace(), lua_setupvalue(), and luaF_close().
#define setobj2n setobj |
Definition at line 164 of file lobject.h.
Referenced by addk(), adjust_varargs(), lua_pushcclosure(), and luaE_newthread().
#define setobj2s setobj |
Definition at line 157 of file lobject.h.
Referenced by auxgetinfo(), callTM(), callTMres(), do1gcTM(), lua_getfenv(), lua_gettable(), lua_getupvalue(), lua_pushupvalues(), lua_pushvalue(), lua_rawget(), lua_rawgeti(), lua_xmove(), luaA_pushobject(), luaH_next(), and tryfuncTM().
#define setobj2t setobj |
Definition at line 162 of file lobject.h.
Referenced by lua_rawset(), lua_rawseti(), luaV_settable(), and newkey().
#define setobjs2s setobj |
Definition at line 155 of file lobject.h.
Referenced by Arith(), call_binTM(), lua_insert(), lua_remove(), lua_setlocal(), lua_yield(), luaD_poscall(), luaG_errormsg(), seterrorobj(), and tryfuncTM().
#define setpvalue | ( | obj, | |||
x | ) | { TObject *i_o=(obj); i_o->tt=LUA_TLIGHTUSERDATA; i_o->value.p=(x); } |
#define setsvalue | ( | obj, | |||
x | ) |
Value:
{ TObject *i_o=(obj); i_o->tt=LUA_TSTRING; \ i_o->value.gc=cast(GCObject *, (x)); \ lua_assert(i_o->value.gc->gch.tt == LUA_TSTRING); }
Definition at line 108 of file lobject.h.
Referenced by adjust_varargs(), and luaK_stringK().
#define setsvalue2n setsvalue |
#define setsvalue2s setsvalue |
Definition at line 158 of file lobject.h.
Referenced by lua_concat(), lua_pushlstring(), luaO_pushvfstring(), luaV_concat(), luaV_tostring(), pushstr(), resume_error(), and seterrorobj().
#define setthvalue | ( | obj, | |||
x | ) |
#define setttype | ( | obj, | |||
tt | ) | (ttype(obj) = (tt)) |
#define setuvalue | ( | obj, | |||
x | ) |
#define sizenode | ( | t | ) | (twoto((t)->lsizenode)) |
Definition at line 331 of file lobject.h.
Referenced by cleartablekeys(), cleartablevalues(), luaH_free(), traversetable(), and travglobals().
#define svalue | ( | o | ) | getstr(tsvalue(o)) |
Definition at line 192 of file lobject.h.
Referenced by getobjname(), kname(), lua_tostring(), luaO_pushvfstring(), luaV_concat(), luaV_tonumber(), and traversetable().
#define thvalue | ( | o | ) | check_exp(ttisthread(o), &(o)->value.gc->th) |
#define tsvalue | ( | o | ) | check_exp(ttisstring(o), &(o)->value.gc->ts) |
Definition at line 86 of file lobject.h.
Referenced by DumpConstants(), lua_strlen(), luaH_get(), luaH_getstr(), luaH_mainposition(), luaV_concat(), luaV_lessequal(), luaV_lessthan(), traverseproto(), travglobals(), and valismarked().
#define ttisboolean | ( | o | ) | (ttype(o) == LUA_TBOOLEAN) |
#define ttisfunction | ( | o | ) | (ttype(o) == LUA_TFUNCTION) |
Definition at line 75 of file lobject.h.
Referenced by Arith(), aux_upvalue(), call_binTM(), lua_getinfo(), luaD_precall(), luaG_errormsg(), luaV_getnotable(), luaV_index(), luaV_settable(), and tryfuncTM().
#define ttislightuserdata | ( | o | ) | (ttype(o) == LUA_TLIGHTUSERDATA) |
#define ttisnil | ( | o | ) | (ttype(o) == LUA_TNIL) |
Definition at line 71 of file lobject.h.
Referenced by call_binTM(), call_orderTM(), lua_setmetatable(), luaH_getany(), luaH_index(), luaH_next(), luaH_set(), luaT_gettm(), luaV_getnotable(), luaV_gettable(), luaV_settable(), newkey(), numuse(), resize(), setnodevector(), and traversetable().
#define ttisnumber | ( | o | ) | (ttype(o) == LUA_TNUMBER) |
Definition at line 72 of file lobject.h.
Referenced by addk(), arrayindex(), luaH_getnum(), luaH_set(), luaK_prefix(), luaV_lessequal(), luaV_lessthan(), luaV_tonumber(), and luaV_tostring().
#define ttisstring | ( | o | ) | (ttype(o) == LUA_TSTRING) |
Definition at line 73 of file lobject.h.
Referenced by getobjname(), kname(), lua_strlen(), lua_tostring(), luaG_concaterror(), luaG_symbexec(), luaH_getstr(), luaV_lessequal(), luaV_lessthan(), luaV_tonumber(), traverseproto(), traversetable(), travglobals(), and valismarked().
#define ttistable | ( | o | ) | (ttype(o) == LUA_TTABLE) |
Definition at line 74 of file lobject.h.
Referenced by lua_next(), lua_rawget(), lua_rawgeti(), lua_rawset(), lua_rawseti(), lua_setfenv(), lua_setmetatable(), luaV_gettable(), and luaV_settable().
#define ttisthread | ( | o | ) | (ttype(o) == LUA_TTHREAD) |
#define ttisuserdata | ( | o | ) | (ttype(o) == LUA_TUSERDATA) |
#define ttype | ( | o | ) | ((o)->tt) |
Definition at line 82 of file lobject.h.
Referenced by DumpConstants(), lua_getmetatable(), lua_setmetatable(), lua_topointer(), lua_touserdata(), lua_type(), luaG_ordererror(), luaG_typeerror(), luaH_get(), luaH_mainposition(), luaO_rawequalObj(), luaT_gettmbyobj(), luaV_equalval(), luaV_lessequal(), and luaV_lessthan().
#define twoto | ( | x | ) | (1<<(x)) |
Definition at line 330 of file lobject.h.
Referenced by computesizes(), numuse(), resize(), and setnodevector().
#define uvalue | ( | o | ) | check_exp(ttisuserdata(o), &(o)->value.gc->u) |
Definition at line 87 of file lobject.h.
Referenced by lua_getmetatable(), lua_setmetatable(), lua_touserdata(), luaT_gettmbyobj(), and luaV_equalval().
typedef struct lua_TObject TObject |
void luaO_chunkid | ( | char * | out, | |
const char * | source, | |||
int | len | |||
) |
Definition at line 165 of file lobject.c.
Referenced by addinfo(), funcinfo(), info_tailcall(), and luaX_errorline().
int luaO_int2fb | ( | unsigned int | x | ) |
int luaO_log2 | ( | unsigned int | x | ) |
const char* luaO_pushfstring | ( | lua_State * | L, | |
const char * | fmt, | |||
... | ||||
) |
Definition at line 155 of file lobject.c.
References luaO_pushvfstring().
Referenced by addinfo(), check_match(), error_expected(), luaX_checklimit(), luaX_errorline(), luaX_lex(), and luaX_token2str().
const char* luaO_pushvfstring | ( | lua_State * | L, | |
const char * | fmt, | |||
va_list | argp | |||
) |
Definition at line 113 of file lobject.c.
References lua_State::base, cast, incr_top, lua_assert, luaS_newlstr(), luaV_concat(), pushstr(), setnvalue, setsvalue2s, svalue, and lua_State::top.
Referenced by lua_pushfstring(), lua_pushvfstring(), luaG_runerror(), and luaO_pushfstring().
Definition at line 74 of file lobject.c.
References bvalue, gcvalue, iscollectable, lua_assert, nvalue, pvalue, and ttype.
Referenced by addk(), call_orderTM(), get_compTM(), lua_rawequal(), luaH_getany(), and travglobals().
int luaO_str2d | ( | const char * | s, | |
lua_Number * | result | |||
) |
Definition at line 92 of file lobject.c.
References lua_str2number.
Referenced by luaV_tonumber(), and read_numeral().
const TObject luaO_nilobject |
Definition at line 30 of file lobject.c.
Referenced by luaH_getany(), luaH_getnum(), luaH_getstr(), luaH_index(), luaH_set(), luaH_setnum(), luaT_gettmbyobj(), and luaV_index().