Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

lua/lobject.h File Reference

#include "llimits.h"
#include "lua.h"

Include dependency graph for lobject.h:

This graph shows which files directly or indirectly include this file:

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 GCheader GCheader
typedef lua_TObject TObject
typedef TObjectStkId
typedef TString TString
typedef Udata Udata
typedef Proto Proto
typedef LocVar LocVar
typedef UpVal UpVal
typedef CClosure CClosure
typedef LClosure LClosure
typedef Closure Closure
typedef Node Node
typedef Table Table

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 Documentation

#define bvalue  )     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))
 

Definition at line 140 of file lobject.h.

#define chgnvalue obj,
 )     check_exp(ttype(obj)==LUA_TNUMBER, (obj)->value.n=(x))
 

Definition at line 99 of file lobject.h.

Referenced by luaV_execute().

#define ClosureHeader   CommonHeader; lu_byte isC; lu_byte nupvalues; /*@null@*/ GCObject *gclist
 

Definition at line 268 of file lobject.h.

#define clvalue  )     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 CommonHeader   /*@dependent@*/ /*@null@*/ GCObject *next; lu_byte tt; lu_byte marked
 

Definition at line 36 of file lobject.h.

#define fb2int  )     (((x) & 7) << ((x) >> 3))
 

Definition at line 342 of file lobject.h.

Referenced by luaV_execute().

#define gcvalue  )     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(), luaF_getlocalname(), luaS_newlstr(), luaV_strcmp(), luaX_errorline(), luaX_syntaxerror(), prefixexp(), and travglobals().

#define hvalue  )     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_execute(), luaV_gettable(), luaV_index(), luaV_settable(), traverseclosure(), and travglobals().

#define iscfunction  )     (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  )     (ttype(o) >= LUA_TSTRING)
 

Definition at line 170 of file lobject.h.

Referenced by luaO_rawequalObj(), removekey(), and valismarked().

#define isLfunction  )     (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  )     (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0))
 

Definition at line 93 of file lobject.h.

Referenced by call_orderTM(), lua_toboolean(), luaV_equalval(), and luaV_execute().

#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 NUM_TAGS   LUA_TTHREAD
 

Definition at line 16 of file lobject.h.

#define nvalue  )     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_execute(), luaV_lessequal(), luaV_lessthan(), and luaV_tostring().

#define pvalue  )     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,
 )     { TObject *i_o=(obj); i_o->tt=LUA_TBOOLEAN; i_o->value.b=(x); }
 

Definition at line 105 of file lobject.h.

Referenced by lua_pushboolean(), luaV_execute(), and newkey().

#define setclvalue obj,
 ) 
 

Value:

{ TObject *i_o=(obj); i_o->tt=LUA_TFUNCTION; \
    i_o->value.gc=cast(GCObject *, (x)); \
    lua_assert(i_o->value.gc->gch.tt == LUA_TFUNCTION); }

Definition at line 123 of file lobject.h.

Referenced by f_Ccall(), f_parser(), lua_pushcclosure(), and luaV_execute().

#define sethvalue obj,
 ) 
 

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(), luaV_execute(), 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(), luaV_execute(), newkey(), nil_constant(), preinit_state(), removekey(), resize(), setarrayvector(), setnodevector(), stack_init(), and traversestack().

#define setnvalue obj,
 )     { 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(), luaV_execute(), 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(), luaF_close(), and luaV_execute().

#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(), luaV_execute(), and tryfuncTM().

#define setobj2t   setobj
 

Definition at line 162 of file lobject.h.

Referenced by lua_rawset(), lua_rawseti(), luaV_execute(), 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(), luaV_execute(), seterrorobj(), and tryfuncTM().

#define setobjt2t   setobj
 

Definition at line 160 of file lobject.h.

Referenced by resize().

#define setpvalue obj,
 )     { TObject *i_o=(obj); i_o->tt=LUA_TLIGHTUSERDATA; i_o->value.p=(x); }
 

Definition at line 102 of file lobject.h.

Referenced by f_Ccall(), and lua_pushlightuserdata().

#define setsvalue obj,
 ) 
 

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
 

Definition at line 165 of file lobject.h.

Referenced by LoadConstants().

#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,
 ) 
 

Value:

{ TObject *i_o=(obj); i_o->tt=LUA_TTHREAD; \
    i_o->value.gc=cast(GCObject *, (x)); \
    lua_assert(i_o->value.gc->gch.tt == LUA_TTHREAD); }

Definition at line 118 of file lobject.h.

Referenced by lua_newthread().

#define setttype obj,
tt   )     (ttype(obj) = (tt))
 

Definition at line 167 of file lobject.h.

Referenced by removekey().

#define setuvalue obj,
 ) 
 

Value:

{ TObject *i_o=(obj); i_o->tt=LUA_TUSERDATA; \
    i_o->value.gc=cast(GCObject *, (x)); \
    lua_assert(i_o->value.gc->gch.tt == LUA_TUSERDATA); }

Definition at line 113 of file lobject.h.

Referenced by do1gcTM(), lua_newuserdata(), and luaC_callGCTM().

#define sizenode  )     (twoto((t)->lsizenode))
 

Definition at line 331 of file lobject.h.

Referenced by cleartablekeys(), cleartablevalues(), luaH_free(), luaH_next(), numuse(), traversetable(), and travglobals().

#define svalue  )     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  )     check_exp(ttisthread(o), &(o)->value.gc->th)
 

Definition at line 91 of file lobject.h.

Referenced by lua_topointer(), and lua_tothread().

#define tsvalue  )     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_execute(), luaV_lessequal(), luaV_lessthan(), traverseproto(), travglobals(), and valismarked().

#define ttisboolean  )     (ttype(o) == LUA_TBOOLEAN)
 

Definition at line 76 of file lobject.h.

Referenced by newkey().

#define ttisfunction  )     (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_execute(), luaV_getnotable(), luaV_index(), luaV_settable(), and tryfuncTM().

#define ttislightuserdata  )     (ttype(o) == LUA_TLIGHTUSERDATA)
 

Definition at line 79 of file lobject.h.

Referenced by lua_isuserdata().

#define ttisnil  )     (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_execute(), luaV_getnotable(), luaV_gettable(), luaV_settable(), newkey(), numuse(), resize(), setnodevector(), and traversetable().

#define ttisnumber  )     (ttype(o) == LUA_TNUMBER)
 

Definition at line 72 of file lobject.h.

Referenced by addk(), arrayindex(), luaH_getnum(), luaH_set(), luaK_prefix(), luaV_execute(), luaV_lessequal(), luaV_lessthan(), luaV_tonumber(), and luaV_tostring().

#define ttisstring  )     (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_execute(), luaV_lessequal(), luaV_lessthan(), luaV_tonumber(), traverseproto(), traversetable(), travglobals(), and valismarked().

#define ttistable  )     (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_execute(), luaV_gettable(), and luaV_settable().

#define ttisthread  )     (ttype(o) == LUA_TTHREAD)
 

Definition at line 78 of file lobject.h.

Referenced by lua_tothread().

#define ttisuserdata  )     (ttype(o) == LUA_TUSERDATA)
 

Definition at line 77 of file lobject.h.

Referenced by lua_isuserdata().

#define ttype  )     ((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  )     (1<<(x))
 

Definition at line 330 of file lobject.h.

Referenced by computesizes(), numuse(), resize(), and setnodevector().

#define uvalue  )     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 Documentation

typedef struct CClosure CClosure
 

typedef union Closure Closure
 

typedef struct GCheader GCheader
 

typedef union GCObject GCObject
 

Definition at line 29 of file lobject.h.

typedef struct LClosure LClosure
 

typedef struct LocVar LocVar
 

typedef struct Node Node
 

typedef struct Proto Proto
 

typedef TObject* StkId
 

Definition at line 174 of file lobject.h.

typedef struct Table Table
 

typedef struct lua_TObject TObject
 

typedef union TString TString
 

typedef union Udata Udata
 

typedef struct UpVal UpVal
 


Function Documentation

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  ) 
 

Definition at line 37 of file lobject.c.

References cast.

Referenced by constructor().

int luaO_log2 unsigned int  x  ) 
 

Definition at line 47 of file lobject.c.

Referenced by constructor(), numuse(), and rehash().

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().

int luaO_rawequalObj const TObject t1,
const TObject t2
 

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().


Variable Documentation

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().


Generated on Tue Dec 27 22:20:31 2016 for rpm by  doxygen 1.4.4