lua/lobject.h File Reference

#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 union GCObject GCObject
typedef struct lua_TObject TObject
typedef TObjectStkId

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)

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

#define hvalue (  )     check_exp(ttistable(o), &(o)->value.gc->h)

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

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

#define setnvalue ( obj,
 )     { TObject *i_o=(obj); i_o->tt=LUA_TNUMBER; i_o->value.n=(x); }

#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

#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

#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

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

#define svalue (  )     getstr(tsvalue(o))

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

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

Definition at line 76 of file lobject.h.

Referenced by newkey().

#define ttisfunction (  )     (ttype(o) == LUA_TFUNCTION)

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

Definition at line 79 of file lobject.h.

Referenced by lua_isuserdata().

#define ttisnil (  )     (ttype(o) == LUA_TNIL)

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

#define ttisstring (  )     (ttype(o) == LUA_TSTRING)

#define ttistable (  )     (ttype(o) == LUA_TTABLE)

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

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


Typedef Documentation

typedef union GCObject GCObject

Definition at line 29 of file lobject.h.

typedef TObject* StkId

Definition at line 174 of file lobject.h.

typedef struct lua_TObject TObject


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

const char* luaO_pushvfstring ( lua_State L,
const char *  fmt,
va_list  argp 
)

int luaO_rawequalObj ( const TObject t1,
const TObject t2 
)

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


Generated on Fri Dec 12 13:02:11 2008 for rpm by  doxygen 1.5.6