The Battle for Wesnoth  1.17.0-dev
Classes | Macros | Typedefs | Functions
lobject.h File Reference
#include <stdarg.h>
#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.

Classes

union  Value
 
struct  TValue
 
union  StackValue
 
struct  GCObject
 
struct  TString
 
union  UValue
 
struct  Udata
 
struct  Udata0
 
struct  Upvaldesc
 
struct  LocVar
 
struct  AbsLineInfo
 
struct  Proto
 
struct  UpVal
 
struct  CClosure
 
struct  LClosure
 
union  Closure
 
union  Node
 
struct  Node::NodeKey
 
struct  Table
 

Macros

#define LUA_TUPVAL   LUA_NUMTYPES /* upvalues */
 
#define LUA_TPROTO   (LUA_NUMTYPES+1) /* function prototypes */
 
#define LUA_TDEADKEY   (LUA_NUMTYPES+2) /* removed keys in tables */
 
#define LUA_TOTALTYPES   (LUA_TPROTO + 2)
 
#define makevariant(t, v)   ((t) | ((v) << 4))
 
#define TValuefields   Value value_; lu_byte tt_
 
#define val_(o)   ((o)->value_)
 
#define valraw(o)   (&val_(o))
 
#define rawtt(o)   ((o)->tt_)
 
#define novariant(t)   ((t) & 0x0F)
 
#define withvariant(t)   ((t) & 0x3F)
 
#define ttypetag(o)   withvariant(rawtt(o))
 
#define ttype(o)   (novariant(rawtt(o)))
 
#define checktag(o, t)   (rawtt(o) == (t))
 
#define checktype(o, t)   (ttype(o) == (t))
 
#define righttt(obj)   (ttypetag(obj) == gcvalue(obj)->tt)
 
#define checkliveness(L, obj)
 
#define settt_(o, t)   ((o)->tt_=(t))
 
#define setobj(L, obj1, obj2)
 
#define setobjs2s(L, o1, o2)   setobj(L,s2v(o1),s2v(o2))
 
#define setobj2s(L, o1, o2)   setobj(L,s2v(o1),o2)
 
#define setobjt2t   setobj
 
#define setobj2n   setobj
 
#define setobj2t   setobj
 
#define s2v(o)   (&(o)->val)
 
#define LUA_VNIL   makevariant(LUA_TNIL, 0)
 
#define LUA_VEMPTY   makevariant(LUA_TNIL, 1)
 
#define LUA_VABSTKEY   makevariant(LUA_TNIL, 2)
 
#define ttisnil(v)   checktype((v), LUA_TNIL)
 
#define ttisstrictnil(o)   checktag((o), LUA_VNIL)
 
#define setnilvalue(obj)   settt_(obj, LUA_VNIL)
 
#define isabstkey(v)   checktag((v), LUA_VABSTKEY)
 
#define isnonstrictnil(v)   (ttisnil(v) && !ttisstrictnil(v))
 
#define isempty(v)   ttisnil(v)
 
#define ABSTKEYCONSTANT   {NULL}, LUA_VABSTKEY
 
#define setempty(v)   settt_(v, LUA_VEMPTY)
 
#define LUA_VFALSE   makevariant(LUA_TBOOLEAN, 0)
 
#define LUA_VTRUE   makevariant(LUA_TBOOLEAN, 1)
 
#define ttisboolean(o)   checktype((o), LUA_TBOOLEAN)
 
#define ttisfalse(o)   checktag((o), LUA_VFALSE)
 
#define ttistrue(o)   checktag((o), LUA_VTRUE)
 
#define l_isfalse(o)   (ttisfalse(o) || ttisnil(o))
 
#define setbfvalue(obj)   settt_(obj, LUA_VFALSE)
 
#define setbtvalue(obj)   settt_(obj, LUA_VTRUE)
 
#define LUA_VTHREAD   makevariant(LUA_TTHREAD, 0)
 
#define ttisthread(o)   checktag((o), ctb(LUA_VTHREAD))
 
#define thvalue(o)   check_exp(ttisthread(o), gco2th(val_(o).gc))
 
#define setthvalue(L, obj, x)
 
#define setthvalue2s(L, o, t)   setthvalue(L,s2v(o),t)
 
#define CommonHeader   struct GCObject *next; lu_byte tt; lu_byte marked
 
#define BIT_ISCOLLECTABLE   (1 << 6)
 
#define iscollectable(o)   (rawtt(o) & BIT_ISCOLLECTABLE)
 
#define ctb(t)   ((t) | BIT_ISCOLLECTABLE)
 
#define gcvalue(o)   check_exp(iscollectable(o), val_(o).gc)
 
#define gcvalueraw(v)   ((v).gc)
 
#define setgcovalue(L, obj, x)
 
#define LUA_VNUMINT   makevariant(LUA_TNUMBER, 0) /* integer numbers */
 
#define LUA_VNUMFLT   makevariant(LUA_TNUMBER, 1) /* float numbers */
 
#define ttisnumber(o)   checktype((o), LUA_TNUMBER)
 
#define ttisfloat(o)   checktag((o), LUA_VNUMFLT)
 
#define ttisinteger(o)   checktag((o), LUA_VNUMINT)
 
#define nvalue(o)
 
#define fltvalue(o)   check_exp(ttisfloat(o), val_(o).n)
 
#define ivalue(o)   check_exp(ttisinteger(o), val_(o).i)
 
#define fltvalueraw(v)   ((v).n)
 
#define ivalueraw(v)   ((v).i)
 
#define setfltvalue(obj, x)   { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_VNUMFLT); }
 
#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_VNUMINT); }
 
#define chgivalue(obj, x)   { TValue *io=(obj); lua_assert(ttisinteger(io)); val_(io).i=(x); }
 
#define LUA_VSHRSTR   makevariant(LUA_TSTRING, 0) /* short strings */
 
#define LUA_VLNGSTR   makevariant(LUA_TSTRING, 1) /* long strings */
 
#define ttisstring(o)   checktype((o), LUA_TSTRING)
 
#define ttisshrstring(o)   checktag((o), ctb(LUA_VSHRSTR))
 
#define ttislngstring(o)   checktag((o), ctb(LUA_VLNGSTR))
 
#define tsvalueraw(v)   (gco2ts((v).gc))
 
#define tsvalue(o)   check_exp(ttisstring(o), gco2ts(val_(o).gc))
 
#define setsvalue(L, obj, x)
 
#define setsvalue2s(L, o, s)   setsvalue(L,s2v(o),s)
 
#define setsvalue2n   setsvalue
 
#define getstr(ts)   ((ts)->contents)
 
#define svalue(o)   getstr(tsvalue(o))
 
#define tsslen(s)   ((s)->tt == LUA_VSHRSTR ? (s)->shrlen : (s)->u.lnglen)
 
#define vslen(o)   tsslen(tsvalue(o))
 
#define LUA_VLIGHTUSERDATA   makevariant(LUA_TLIGHTUSERDATA, 0)
 
#define LUA_VUSERDATA   makevariant(LUA_TUSERDATA, 0)
 
#define ttislightuserdata(o)   checktag((o), LUA_VLIGHTUSERDATA)
 
#define ttisfulluserdata(o)   checktag((o), ctb(LUA_VUSERDATA))
 
#define pvalue(o)   check_exp(ttislightuserdata(o), val_(o).p)
 
#define uvalue(o)   check_exp(ttisfulluserdata(o), gco2u(val_(o).gc))
 
#define pvalueraw(v)   ((v).p)
 
#define setpvalue(obj, x)   { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_VLIGHTUSERDATA); }
 
#define setuvalue(L, obj, x)
 
#define udatamemoffset(nuv)
 
#define getudatamem(u)   (cast_charp(u) + udatamemoffset((u)->nuvalue))
 
#define sizeudata(nuv, nb)   (udatamemoffset(nuv) + (nb))
 
#define LUA_VPROTO   makevariant(LUA_TPROTO, 0)
 
#define LUA_VUPVAL   makevariant(LUA_TUPVAL, 0)
 
#define LUA_VLCL   makevariant(LUA_TFUNCTION, 0) /* Lua closure */
 
#define LUA_VLCF   makevariant(LUA_TFUNCTION, 1) /* light C function */
 
#define LUA_VCCL   makevariant(LUA_TFUNCTION, 2) /* C closure */
 
#define ttisfunction(o)   checktype(o, LUA_TFUNCTION)
 
#define ttisclosure(o)   ((rawtt(o) & 0x1F) == LUA_VLCL)
 
#define ttisLclosure(o)   checktag((o), ctb(LUA_VLCL))
 
#define ttislcf(o)   checktag((o), LUA_VLCF)
 
#define ttisCclosure(o)   checktag((o), ctb(LUA_VCCL))
 
#define isLfunction(o)   ttisLclosure(o)
 
#define clvalue(o)   check_exp(ttisclosure(o), gco2cl(val_(o).gc))
 
#define clLvalue(o)   check_exp(ttisLclosure(o), gco2lcl(val_(o).gc))
 
#define fvalue(o)   check_exp(ttislcf(o), val_(o).f)
 
#define clCvalue(o)   check_exp(ttisCclosure(o), gco2ccl(val_(o).gc))
 
#define fvalueraw(v)   ((v).f)
 
#define setclLvalue(L, obj, x)
 
#define setclLvalue2s(L, o, cl)   setclLvalue(L,s2v(o),cl)
 
#define setfvalue(obj, x)   { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_VLCF); }
 
#define setclCvalue(L, obj, x)
 
#define ClosureHeader   CommonHeader; lu_byte nupvalues; GCObject *gclist
 
#define getproto(o)   (clLvalue(o)->p)
 
#define LUA_VTABLE   makevariant(LUA_TTABLE, 0)
 
#define ttistable(o)   checktag((o), ctb(LUA_VTABLE))
 
#define hvalue(o)   check_exp(ttistable(o), gco2t(val_(o).gc))
 
#define sethvalue(L, obj, x)
 
#define sethvalue2s(L, o, h)   sethvalue(L,s2v(o),h)
 
#define setnodekey(L, node, obj)
 
#define getnodekey(L, obj, node)
 
#define BITRAS   (1 << 7)
 
#define isrealasize(t)   (!((t)->flags & BITRAS))
 
#define setrealasize(t)   ((t)->flags &= cast_byte(~BITRAS))
 
#define setnorealasize(t)   ((t)->flags |= BITRAS)
 
#define keytt(node)   ((node)->u.key_tt)
 
#define keyval(node)   ((node)->u.key_val)
 
#define keyisnil(node)   (keytt(node) == LUA_TNIL)
 
#define keyisinteger(node)   (keytt(node) == LUA_VNUMINT)
 
#define keyival(node)   (keyval(node).i)
 
#define keyisshrstr(node)   (keytt(node) == ctb(LUA_VSHRSTR))
 
#define keystrval(node)   (gco2ts(keyval(node).gc))
 
#define setnilkey(node)   (keytt(node) = LUA_TNIL)
 
#define keyiscollectable(n)   (keytt(n) & BIT_ISCOLLECTABLE)
 
#define gckey(n)   (keyval(n).gc)
 
#define gckeyN(n)   (keyiscollectable(n) ? gckey(n) : NULL)
 
#define setdeadkey(node)   (keytt(node) = LUA_TDEADKEY)
 
#define keyisdead(node)   (keytt(node) == LUA_TDEADKEY)
 
#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 UTF8BUFFSZ   8
 

Typedefs

typedef union Value Value
 
typedef struct TValue TValue
 
typedef union StackValue StackValue
 
typedef StackValueStkId
 
typedef struct GCObject GCObject
 
typedef struct TString TString
 
typedef union UValue UValue
 
typedef struct Udata Udata
 
typedef struct Udata0 Udata0
 
typedef struct Upvaldesc Upvaldesc
 
typedef struct LocVar LocVar
 
typedef struct AbsLineInfo AbsLineInfo
 
typedef struct Proto Proto
 
typedef struct UpVal UpVal
 
typedef struct CClosure CClosure
 
typedef struct LClosure LClosure
 
typedef union Closure Closure
 
typedef union Node Node
 
typedef struct Table Table
 

Functions

LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x)
 
LUAI_FUNC int luaO_ceillog2 (unsigned int x)
 
LUAI_FUNC int luaO_rawarith (lua_State *L, int op, const TValue *p1, const TValue *p2, TValue *res)
 
LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2, StkId res)
 
LUAI_FUNC size_t luaO_str2num (const char *s, TValue *o)
 
LUAI_FUNC int luaO_hexavalue (int c)
 
LUAI_FUNC void luaO_tostring (lua_State *L, TValue *obj)
 
LUAI_FUNC const char * luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp)
 
LUAI_FUNC const char * luaO_pushfstring (lua_State *L, const char *fmt,...)
 
LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t srclen)
 

Macro Definition Documentation

◆ ABSTKEYCONSTANT

#define ABSTKEYCONSTANT   {NULL}, LUA_VABSTKEY

Definition at line 199 of file lobject.h.

◆ BIT_ISCOLLECTABLE

#define BIT_ISCOLLECTABLE   (1 << 6)

Definition at line 276 of file lobject.h.

◆ BITRAS

#define BITRAS   (1 << 7)

Definition at line 708 of file lobject.h.

◆ checkliveness

#define checkliveness (   L,
  obj 
)
Value:
((void)L, lua_longassert(!iscollectable(obj) || \
(righttt(obj) && (L == NULL || !isdead(G(L),gcvalue(obj))))))
#define gcvalue(o)
Definition: lobject.h:283
#define G(L)
Definition: lstate.h:298
#define righttt(obj)
Definition: lobject.h:96
#define isdead(g, v)
Definition: lgc.h:96
#define lua_longassert(c)
Definition: llimits.h:103
#define iscollectable(o)
Definition: lobject.h:278

Definition at line 104 of file lobject.h.

◆ checktag

#define checktag (   o,
  t 
)    (rawtt(o) == (t))

Definition at line 89 of file lobject.h.

◆ checktype

#define checktype (   o,
  t 
)    (ttype(o) == (t))

Definition at line 90 of file lobject.h.

◆ chgfltvalue

#define chgfltvalue (   obj,
 
)    { TValue *io=(obj); lua_assert(ttisfloat(io)); val_(io).n=(x); }

Definition at line 319 of file lobject.h.

Referenced by floatforloop().

◆ chgivalue

#define chgivalue (   obj,
 
)    { TValue *io=(obj); lua_assert(ttisinteger(io)); val_(io).i=(x); }

Definition at line 325 of file lobject.h.

Referenced by luaV_execute().

◆ clCvalue

#define clCvalue (   o)    check_exp(ttisCclosure(o), gco2ccl(val_(o).gc))

◆ clLvalue

#define clLvalue (   o)    check_exp(ttisLclosure(o), gco2lcl(val_(o).gc))

◆ ClosureHeader

#define ClosureHeader   CommonHeader; lu_byte nupvalues; GCObject *gclist

Definition at line 621 of file lobject.h.

◆ clvalue

#define clvalue (   o)    check_exp(ttisclosure(o), gco2cl(val_(o).gc))

Definition at line 580 of file lobject.h.

Referenced by lua_getinfo().

◆ CommonHeader

#define CommonHeader   struct GCObject *next; lu_byte tt; lu_byte marked

Definition at line 266 of file lobject.h.

◆ ctb

#define ctb (   t)    ((t) | BIT_ISCOLLECTABLE)

Definition at line 281 of file lobject.h.

Referenced by equalkey().

◆ fltvalue

#define fltvalue (   o)    check_exp(ttisfloat(o), val_(o).n)

◆ fltvalueraw

#define fltvalueraw (   v)    ((v).n)

Definition at line 313 of file lobject.h.

Referenced by equalkey(), and mainposition().

◆ fvalue

#define fvalue (   o)    check_exp(ttislcf(o), val_(o).f)

Definition at line 582 of file lobject.h.

Referenced by equalkey(), lua_tocfunction(), lua_topointer(), luaD_precall(), and luaV_equalobj().

◆ fvalueraw

#define fvalueraw (   v)    ((v).f)

Definition at line 585 of file lobject.h.

Referenced by equalkey(), and mainposition().

◆ gckey

#define gckey (   n)    (keyval(n).gc)

Definition at line 743 of file lobject.h.

◆ gckeyN

#define gckeyN (   n)    (keyiscollectable(n) ? gckey(n) : NULL)

Definition at line 744 of file lobject.h.

Referenced by clearbykeys(), and traverseephemeron().

◆ gcvalue

#define gcvalue (   o)    check_exp(iscollectable(o), val_(o).gc)

◆ gcvalueraw

#define gcvalueraw (   v)    ((v).gc)

Definition at line 285 of file lobject.h.

Referenced by equalkey(), and mainposition().

◆ getnodekey

#define getnodekey (   L,
  obj,
  node 
)
Value:
{ TValue *io_=(obj); const Node *n_=(node); \
io_->value_ = n_->u.key_val; io_->tt_ = n_->u.key_tt; \
checkliveness(L,io_); }
lu_byte key_tt
Definition: lobject.h:679
Definition: lobject.h:65
Value key_val
Definition: lobject.h:681
struct Node::NodeKey u
Definition: lobject.h:676

Definition at line 695 of file lobject.h.

Referenced by luaH_next(), and reinsert().

◆ getproto

#define getproto (   o)    (clLvalue(o)->p)

Definition at line 644 of file lobject.h.

Referenced by lua_dump().

◆ getstr

#define getstr (   ts)    ((ts)->contents)

◆ getudatamem

#define getudatamem (   u)    (cast_charp(u) + udatamemoffset((u)->nuvalue))

Definition at line 473 of file lobject.h.

Referenced by lua_newuserdatauv(), and touserdata().

◆ hvalue

#define hvalue (   o)    check_exp(ttistable(o), gco2t(val_(o).gc))

◆ isabstkey

#define isabstkey (   v)    checktag((v), LUA_VABSTKEY)

Definition at line 181 of file lobject.h.

Referenced by findindex(), luaH_set(), luaH_setint(), and luaV_finishset().

◆ iscollectable

#define iscollectable (   o)    (rawtt(o) & BIT_ISCOLLECTABLE)

Definition at line 278 of file lobject.h.

Referenced by equalkey(), and lua_topointer().

◆ isempty

#define isempty (   v)    ttisnil(v)

◆ isLfunction

#define isLfunction (   o)    ttisLclosure(o)

Definition at line 578 of file lobject.h.

Referenced by lua_dump(), and lua_getlocal().

◆ isnonstrictnil

#define isnonstrictnil (   v)    (ttisnil(v) && !ttisstrictnil(v))

Definition at line 187 of file lobject.h.

◆ isrealasize

#define isrealasize (   t)    (!((t)->flags & BITRAS))

Definition at line 709 of file lobject.h.

Referenced by ispow2realasize().

◆ ivalue

#define ivalue (   o)    check_exp(ttisinteger(o), val_(o).i)

◆ ivalueraw

#define ivalueraw (   v)    ((v).i)

Definition at line 314 of file lobject.h.

Referenced by mainposition().

◆ keyiscollectable

#define keyiscollectable (   n)    (keytt(n) & BIT_ISCOLLECTABLE)

Definition at line 741 of file lobject.h.

Referenced by clearkey().

◆ keyisdead

#define keyisdead (   node)    (keytt(node) == LUA_TDEADKEY)

Definition at line 754 of file lobject.h.

Referenced by equalkey().

◆ keyisinteger

#define keyisinteger (   node)    (keytt(node) == LUA_VNUMINT)

Definition at line 734 of file lobject.h.

Referenced by luaH_getint(), and numusehash().

◆ keyisnil

#define keyisnil (   node)    (keytt(node) == LUA_TNIL)

Definition at line 733 of file lobject.h.

Referenced by getfreepos(), traversestrongtable(), and traverseweakvalue().

◆ keyisshrstr

#define keyisshrstr (   node)    (keytt(node) == ctb(LUA_VSHRSTR))

Definition at line 736 of file lobject.h.

Referenced by luaH_getshortstr().

◆ keyival

#define keyival (   node)    (keyval(node).i)

Definition at line 735 of file lobject.h.

Referenced by equalkey(), luaH_getint(), and numusehash().

◆ keystrval

#define keystrval (   node)    (gco2ts(keyval(node).gc))

Definition at line 737 of file lobject.h.

Referenced by equalkey(), luaH_getshortstr(), and luaX_newstring().

◆ keytt

#define keytt (   node)    ((node)->u.key_tt)

Definition at line 730 of file lobject.h.

Referenced by equalkey(), and luaH_newkey().

◆ keyval

#define keyval (   node)    ((node)->u.key_val)

Definition at line 731 of file lobject.h.

Referenced by equalkey(), and luaH_newkey().

◆ l_isfalse

#define l_isfalse (   o)    (ttisfalse(o) || ttisnil(o))

◆ lmod

#define lmod (   s,
  size 
)    (check_exp((size&(size-1))==0, (cast_int((s) & ((size)-1)))))

Definition at line 763 of file lobject.h.

Referenced by internshrstr(), luaS_remove(), and tablerehash().

◆ LUA_TDEADKEY

#define LUA_TDEADKEY   (LUA_NUMTYPES+2) /* removed keys in tables */

Definition at line 24 of file lobject.h.

◆ LUA_TOTALTYPES

#define LUA_TOTALTYPES   (LUA_TPROTO + 2)

Definition at line 31 of file lobject.h.

◆ LUA_TPROTO

#define LUA_TPROTO   (LUA_NUMTYPES+1) /* function prototypes */

Definition at line 23 of file lobject.h.

◆ LUA_TUPVAL

#define LUA_TUPVAL   LUA_NUMTYPES /* upvalues */

Definition at line 22 of file lobject.h.

◆ LUA_VABSTKEY

#define LUA_VABSTKEY   makevariant(LUA_TNIL, 2)

Definition at line 167 of file lobject.h.

◆ LUA_VCCL

#define LUA_VCCL   makevariant(LUA_TFUNCTION, 2) /* C closure */

◆ LUA_VEMPTY

#define LUA_VEMPTY   makevariant(LUA_TNIL, 1)

Definition at line 164 of file lobject.h.

◆ LUA_VFALSE

#define LUA_VFALSE   makevariant(LUA_TBOOLEAN, 0)

◆ LUA_VLCF

#define LUA_VLCF   makevariant(LUA_TFUNCTION, 1) /* light C function */

◆ LUA_VLCL

#define LUA_VLCL   makevariant(LUA_TFUNCTION, 0) /* Lua closure */

◆ LUA_VLIGHTUSERDATA

#define LUA_VLIGHTUSERDATA   makevariant(LUA_TLIGHTUSERDATA, 0)

Definition at line 407 of file lobject.h.

Referenced by equalkey(), lua_topointer(), luaV_equalobj(), and mainposition().

◆ LUA_VLNGSTR

#define LUA_VLNGSTR   makevariant(LUA_TSTRING, 1) /* long strings */

◆ LUA_VNIL

#define LUA_VNIL   makevariant(LUA_TNIL, 0)

Definition at line 161 of file lobject.h.

Referenced by const2exp(), dumpConstants(), equalkey(), loadConstants(), luaH_get(), and luaV_equalobj().

◆ LUA_VNUMFLT

#define LUA_VNUMFLT   makevariant(LUA_TNUMBER, 1) /* float numbers */

◆ LUA_VNUMINT

#define LUA_VNUMINT   makevariant(LUA_TNUMBER, 0) /* integer numbers */

◆ LUA_VPROTO

#define LUA_VPROTO   makevariant(LUA_TPROTO, 0)

Definition at line 487 of file lobject.h.

Referenced by freeobj(), getgclist(), luaF_newproto(), propagatemark(), and reallymarkobject().

◆ LUA_VSHRSTR

#define LUA_VSHRSTR   makevariant(LUA_TSTRING, 0) /* short strings */

◆ LUA_VTABLE

#define LUA_VTABLE   makevariant(LUA_TTABLE, 0)

◆ LUA_VTHREAD

#define LUA_VTHREAD   makevariant(LUA_TTHREAD, 0)

◆ LUA_VTRUE

#define LUA_VTRUE   makevariant(LUA_TBOOLEAN, 1)

◆ LUA_VUPVAL

#define LUA_VUPVAL   makevariant(LUA_TUPVAL, 0)

Definition at line 564 of file lobject.h.

Referenced by freeobj(), luaF_initupvals(), newupval(), reallymarkobject(), and sweep2old().

◆ LUA_VUSERDATA

#define LUA_VUSERDATA   makevariant(LUA_TUSERDATA, 0)

◆ makevariant

#define makevariant (   t,
 
)    ((t) | ((v) << 4))

Definition at line 42 of file lobject.h.

◆ novariant

#define novariant (   t)    ((t) & 0x0F)

Definition at line 78 of file lobject.h.

Referenced by iscleared(), and luaC_newobj().

◆ nvalue

#define nvalue (   o)
Value:
#define cast_num(i)
Definition: llimits.h:127
#define ttisinteger(o)
Definition: lobject.h:306
#define check_exp(c, e)
Definition: llimits.h:102
#define fltvalue(o)
Definition: lobject.h:310
#define ivalue(o)
Definition: lobject.h:311
#define ttisnumber(o)
Definition: lobject.h:304

Definition at line 308 of file lobject.h.

Referenced by luaV_tonumber_(), and validop().

◆ pvalue

#define pvalue (   o)    check_exp(ttislightuserdata(o), val_(o).p)

◆ pvalueraw

#define pvalueraw (   v)    ((v).p)

Definition at line 417 of file lobject.h.

Referenced by equalkey(), and mainposition().

◆ rawtt

#define rawtt (   o)    ((o)->tt_)

Definition at line 75 of file lobject.h.

Referenced by equalkey(), and mainpositionTV().

◆ righttt

#define righttt (   obj)    (ttypetag(obj) == gcvalue(obj)->tt)

Definition at line 96 of file lobject.h.

◆ s2v

#define s2v (   o)    (&(o)->val)

◆ setbfvalue

#define setbfvalue (   obj)    settt_(obj, LUA_VFALSE)

Definition at line 228 of file lobject.h.

Referenced by boolF(), loadConstants(), lua_pushboolean(), luaK_exp2const(), and luaV_execute().

◆ setbtvalue

#define setbtvalue (   obj)    settt_(obj, LUA_VTRUE)

◆ setclCvalue

#define setclCvalue (   L,
  obj,
 
)
Value:
{ TValue *io = (obj); CClosure *x_ = (x); \
val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VCCL)); \
checkliveness(L,io); }
#define ctb(t)
Definition: lobject.h:281
#define obj2gco(v)
Definition: lstate.h:347
#define LUA_VCCL
Definition: lobject.h:570
Definition: lobject.h:65
#define settt_(o, t)
Definition: lobject.h:112

Definition at line 597 of file lobject.h.

Referenced by lua_pushcclosure().

◆ setclLvalue

#define setclLvalue (   L,
  obj,
 
)
Value:
{ TValue *io = (obj); LClosure *x_ = (x); \
val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VLCL)); \
checkliveness(L,io); }
#define ctb(t)
Definition: lobject.h:281
#define obj2gco(v)
Definition: lstate.h:347
Definition: lobject.h:65
#define LUA_VLCL
Definition: lobject.h:568
#define settt_(o, t)
Definition: lobject.h:112

Definition at line 587 of file lobject.h.

◆ setclLvalue2s

#define setclLvalue2s (   L,
  o,
  cl 
)    setclLvalue(L,s2v(o),cl)

Definition at line 592 of file lobject.h.

Referenced by luaU_undump(), luaY_parser(), and pushclosure().

◆ setdeadkey

#define setdeadkey (   node)    (keytt(node) = LUA_TDEADKEY)

Definition at line 753 of file lobject.h.

Referenced by clearkey().

◆ setempty

#define setempty (   v)    settt_(v, LUA_VEMPTY)

Definition at line 203 of file lobject.h.

Referenced by clearbykeys(), clearbyvalues(), luaH_newkey(), luaH_resize(), and setnodevector().

◆ setfltvalue

#define setfltvalue (   obj,
 
)    { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_VNUMFLT); }

◆ setfvalue

#define setfvalue (   obj,
 
)    { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_VLCF); }

Definition at line 594 of file lobject.h.

Referenced by lua_pushcclosure().

◆ setgcovalue

#define setgcovalue (   L,
  obj,
 
)
Value:
{ TValue *io = (obj); GCObject *i_g=(x); \
val_(io).gc = i_g; settt_(io, ctb(i_g->tt)); }
#define ctb(t)
Definition: lobject.h:281
Definition: lobject.h:65
#define settt_(o, t)
Definition: lobject.h:112

Definition at line 287 of file lobject.h.

Referenced by GCTM().

◆ sethvalue

#define sethvalue (   L,
  obj,
 
)
Value:
{ TValue *io = (obj); Table *x_ = (x); \
val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VTABLE)); \
checkliveness(L,io); }
#define ctb(t)
Definition: lobject.h:281
Definition: lobject.h:714
#define obj2gco(v)
Definition: lstate.h:347
Definition: lobject.h:65
#define LUA_VTABLE
Definition: lobject.h:655
#define settt_(o, t)
Definition: lobject.h:112

Definition at line 661 of file lobject.h.

Referenced by init_registry(), and nilK().

◆ sethvalue2s

#define sethvalue2s (   L,
  o,
  h 
)    sethvalue(L,s2v(o),h)

◆ setivalue

#define setivalue (   obj,
 
)    { TValue *io=(obj); val_(io).i=(x); settt_(io, LUA_VNUMINT); }

◆ setnilkey

#define setnilkey (   node)    (keytt(node) = LUA_TNIL)

Definition at line 739 of file lobject.h.

Referenced by setnodevector().

◆ setnilvalue

#define setnilvalue (   obj)    settt_(obj, LUA_VNIL)

◆ setnodekey

#define setnodekey (   L,
  node,
  obj 
)
Value:
{ Node *n_=(node); const TValue *io_=(obj); \
n_->u.key_val = io_->value_; n_->u.key_tt = io_->tt_; \
checkliveness(L,io_); }
lu_byte key_tt
Definition: lobject.h:679
Definition: lobject.h:65
struct Node::NodeKey u
Definition: lobject.h:676

Definition at line 688 of file lobject.h.

Referenced by luaH_newkey().

◆ setnorealasize

#define setnorealasize (   t)    ((t)->flags |= BITRAS)

Definition at line 711 of file lobject.h.

Referenced by luaH_getn().

◆ setobj

#define setobj (   L,
  obj1,
  obj2 
)
Value:
{ TValue *io1=(obj1); const TValue *io2=(obj2); \
io1->value_ = io2->value_; settt_(io1, io2->tt_); \
checkliveness(L,io1); lua_assert(!isnonstrictnil(io1)); }
Definition: lobject.h:65
#define isnonstrictnil(v)
Definition: lobject.h:187
#define lua_assert(c)
Definition: llimits.h:101
#define settt_(o, t)
Definition: lobject.h:112

Definition at line 116 of file lobject.h.

Referenced by addk(), lua_copy(), lua_load(), lua_setiuservalue(), lua_setupvalue(), luaF_close(), luaK_exp2const(), luaV_execute(), and reverse().

◆ setobj2n

#define setobj2n   setobj

Definition at line 133 of file lobject.h.

Referenced by lua_pushcclosure().

◆ setobj2s

#define setobj2s (   L,
  o1,
  o2 
)    setobj(L,s2v(o1),o2)

◆ setobj2t

#define setobj2t   setobj

Definition at line 135 of file lobject.h.

Referenced by aux_rawset(), luaH_setint(), luaV_execute(), and luaV_finishset().

◆ setobjs2s

#define setobjs2s (   L,
  o1,
  o2 
)    setobj(L,s2v(o1),s2v(o2))

◆ setobjt2t

#define setobjt2t   setobj

Definition at line 131 of file lobject.h.

Referenced by reinsert().

◆ setpvalue

#define setpvalue (   obj,
 
)    { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_VLIGHTUSERDATA); }

Definition at line 419 of file lobject.h.

Referenced by lua_pushlightuserdata(), lua_rawgetp(), lua_rawsetp(), and luaK_intK().

◆ setrealasize

#define setrealasize (   t)    ((t)->flags &= cast_byte(~BITRAS))

Definition at line 710 of file lobject.h.

Referenced by setlimittosize().

◆ setsvalue

#define setsvalue (   L,
  obj,
 
)
Value:
{ TValue *io = (obj); TString *x_ = (x); \
val_(io).gc = obj2gco(x_); settt_(io, ctb(x_->tt)); \
checkliveness(L,io); }
#define ctb(t)
Definition: lobject.h:281
#define obj2gco(v)
Definition: lstate.h:347
Definition: lobject.h:65
#define settt_(o, t)
Definition: lobject.h:112

Definition at line 349 of file lobject.h.

Referenced by luaH_getstr(), luaK_exp2const(), luaO_tostring(), and stringK().

◆ setsvalue2n

#define setsvalue2n   setsvalue

Definition at line 358 of file lobject.h.

Referenced by loadConstants().

◆ setsvalue2s

#define setsvalue2s (   L,
  o,
  s 
)    setsvalue(L,s2v(o),s)

◆ setthvalue

#define setthvalue (   L,
  obj,
 
)
Value:
{ TValue *io = (obj); lua_State *x_ = (x); \
val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VTHREAD)); \
checkliveness(L,io); }
#define ctb(t)
Definition: lobject.h:281
#define LUA_VTHREAD
Definition: lobject.h:240
#define obj2gco(v)
Definition: lstate.h:347
Definition: lobject.h:65
#define settt_(o, t)
Definition: lobject.h:112

Definition at line 246 of file lobject.h.

Referenced by init_registry(), and lua_pushthread().

◆ setthvalue2s

#define setthvalue2s (   L,
  o,
  t 
)    setthvalue(L,s2v(o),t)

Definition at line 251 of file lobject.h.

Referenced by lua_newthread().

◆ settt_

#define settt_ (   o,
  t 
)    ((o)->tt_=(t))

Definition at line 112 of file lobject.h.

◆ setuvalue

#define setuvalue (   L,
  obj,
 
)
Value:
{ TValue *io = (obj); Udata *x_ = (x); \
val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VUSERDATA)); \
checkliveness(L,io); }
#define ctb(t)
Definition: lobject.h:281
#define obj2gco(v)
Definition: lstate.h:347
Definition: lobject.h:65
Definition: lobject.h:439
#define settt_(o, t)
Definition: lobject.h:112
#define LUA_VUSERDATA
Definition: lobject.h:409

Definition at line 422 of file lobject.h.

Referenced by lua_newuserdatauv().

◆ sizenode

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

Definition at line 768 of file lobject.h.

Referenced by freehash(), luaH_next(), numusehash(), reinsert(), and traverseephemeron().

◆ sizeudata

#define sizeudata (   nuv,
  nb 
)    (udatamemoffset(nuv) + (nb))

Definition at line 476 of file lobject.h.

Referenced by freeobj(), and luaS_newudata().

◆ svalue

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

◆ thvalue

#define thvalue (   o)    check_exp(ttisthread(o), gco2th(val_(o).gc))

Definition at line 244 of file lobject.h.

Referenced by lua_tothread().

◆ tsslen

#define tsslen (   s)    ((s)->tt == LUA_VSHRSTR ? (s)->shrlen : (s)->u.lnglen)

Definition at line 388 of file lobject.h.

Referenced by dumpString(), funcinfo(), l_strcmp(), and luaG_addinfo().

◆ tsvalue

#define tsvalue (   o)    check_exp(ttisstring(o), gco2ts(val_(o).gc))

◆ tsvalueraw

#define tsvalueraw (   v)    (gco2ts((v).gc))

Definition at line 345 of file lobject.h.

Referenced by mainposition().

◆ ttisboolean

#define ttisboolean (   o)    checktype((o), LUA_TBOOLEAN)

Definition at line 220 of file lobject.h.

◆ ttisCclosure

#define ttisCclosure (   o)    checktag((o), ctb(LUA_VCCL))

Definition at line 576 of file lobject.h.

Referenced by lua_iscfunction(), and lua_tocfunction().

◆ ttisclosure

#define ttisclosure (   o)    ((rawtt(o) & 0x1F) == LUA_VLCL)

Definition at line 573 of file lobject.h.

Referenced by lua_getinfo().

◆ ttisfalse

#define ttisfalse (   o)    checktag((o), LUA_VFALSE)

Definition at line 221 of file lobject.h.

◆ ttisfloat

#define ttisfloat (   o)    checktag((o), LUA_VNUMFLT)

Definition at line 305 of file lobject.h.

Referenced by LEnum(), LTnum(), luaH_newkey(), luaV_execute(), luaV_tointegerns(), and read_numeral().

◆ ttisfulluserdata

#define ttisfulluserdata (   o)    checktag((o), ctb(LUA_VUSERDATA))

Definition at line 412 of file lobject.h.

Referenced by lua_getiuservalue(), lua_isuserdata(), lua_setiuservalue(), and luaT_objtypename().

◆ ttisfunction

#define ttisfunction (   o)    checktype(o, LUA_TFUNCTION)

◆ ttisinteger

#define ttisinteger (   o)    checktag((o), LUA_VNUMINT)

◆ ttislcf

#define ttislcf (   o)    checktag((o), LUA_VLCF)

Definition at line 575 of file lobject.h.

Referenced by index2value(), lua_iscfunction(), and lua_tocfunction().

◆ ttisLclosure

#define ttisLclosure (   o)    checktag((o), ctb(LUA_VLCL))

Definition at line 574 of file lobject.h.

Referenced by getupvalref(), and luaV_execute().

◆ ttislightuserdata

#define ttislightuserdata (   o)    checktag((o), LUA_VLIGHTUSERDATA)

Definition at line 411 of file lobject.h.

Referenced by lua_isuserdata().

◆ ttislngstring

#define ttislngstring (   o)    checktag((o), ctb(LUA_VLNGSTR))

Definition at line 343 of file lobject.h.

◆ ttisnil

#define ttisnil (   v)    checktype((v), LUA_TNIL)

◆ ttisnumber

#define ttisnumber (   o)    checktype((o), LUA_TNUMBER)

◆ ttisshrstring

#define ttisshrstring (   o)    checktag((o), ctb(LUA_VSHRSTR))

Definition at line 342 of file lobject.h.

Referenced by isKstr(), and lua_error().

◆ ttisstrictnil

#define ttisstrictnil (   o)    checktag((o), LUA_VNIL)

Definition at line 175 of file lobject.h.

◆ ttisstring

#define ttisstring (   o)    checktype((o), LUA_TSTRING)

◆ ttistable

#define ttistable (   o)    checktag((o), ctb(LUA_VTABLE))

Definition at line 657 of file lobject.h.

Referenced by gettable(), lua_setmetatable(), luaT_objtypename(), and luaV_finishget().

◆ ttisthread

#define ttisthread (   o)    checktag((o), ctb(LUA_VTHREAD))

Definition at line 242 of file lobject.h.

Referenced by lua_tothread().

◆ ttistrue

#define ttistrue (   o)    checktag((o), LUA_VTRUE)

Definition at line 222 of file lobject.h.

◆ ttype

#define ttype (   o)    (novariant(rawtt(o)))

◆ ttypetag

#define ttypetag (   o)    withvariant(rawtt(o))

◆ TValuefields

#define TValuefields   Value value_; lu_byte tt_

Definition at line 63 of file lobject.h.

◆ twoto

#define twoto (   x)    (1<<(x))

Definition at line 767 of file lobject.h.

Referenced by setnodevector().

◆ udatamemoffset

#define udatamemoffset (   nuv)
Value:
((nuv) == 0 ? offsetof(Udata0, bindata) \
: offsetof(Udata, uv) + (sizeof(UValue) * (nuv)))
union UValue UValue
Definition: lobject.h:439

Definition at line 468 of file lobject.h.

Referenced by luaS_newudata().

◆ UTF8BUFFSZ

#define UTF8BUFFSZ   8

Definition at line 772 of file lobject.h.

Referenced by luaO_pushvfstring(), luaO_utf8esc(), and utf8esc().

◆ uvalue

#define uvalue (   o)    check_exp(ttisfulluserdata(o), gco2u(val_(o).gc))

◆ val_

#define val_ (   o)    ((o)->value_)

◆ valraw

#define valraw (   o)    (&val_(o))

Definition at line 71 of file lobject.h.

Referenced by mainpositionTV().

◆ vslen

#define vslen (   o)    tsslen(tsvalue(o))

Definition at line 391 of file lobject.h.

Referenced by copy2buff(), l_strton(), lua_tolstring(), and luaV_concat().

◆ withvariant

#define withvariant (   t)    ((t) & 0x3F)

Definition at line 81 of file lobject.h.

Referenced by mainposition().

Typedef Documentation

◆ AbsLineInfo

typedef struct AbsLineInfo AbsLineInfo

◆ CClosure

typedef struct CClosure CClosure

◆ Closure

typedef union Closure Closure

◆ GCObject

typedef struct GCObject GCObject

◆ LClosure

typedef struct LClosure LClosure

◆ LocVar

typedef struct LocVar LocVar

◆ Node

typedef union Node Node

◆ Proto

typedef struct Proto Proto

◆ StackValue

typedef union StackValue StackValue

◆ StkId

typedef StackValue* StkId

Definition at line 147 of file lobject.h.

◆ Table

typedef struct Table Table

◆ TString

typedef struct TString TString

◆ TValue

typedef struct TValue TValue

◆ Udata

typedef struct Udata Udata

◆ Udata0

typedef struct Udata0 Udata0

◆ UpVal

typedef struct UpVal UpVal

◆ Upvaldesc

typedef struct Upvaldesc Upvaldesc

◆ UValue

typedef union UValue UValue

◆ Value

typedef union Value Value

Function Documentation

◆ luaO_arith()

LUAI_FUNC void luaO_arith ( lua_State L,
int  op,
const TValue p1,
const TValue p2,
StkId  res 
)

Definition at line 126 of file lobject.cpp.

References cast, LUA_OPADD, luaO_rawarith(), luaT_trybinTM(), s2v, and TM_ADD.

Referenced by lua_arith().

◆ luaO_ceillog2()

LUAI_FUNC int luaO_ceillog2 ( unsigned int  x)

Definition at line 35 of file lobject.cpp.

Referenced by countint(), luaK_settablesize(), and setnodevector().

◆ luaO_chunkid()

LUAI_FUNC void luaO_chunkid ( char *  out,
const char *  source,
size_t  srclen 
)

Definition at line 557 of file lobject.cpp.

References addstr, LL, LUA_IDSIZE, POS, PRE, and RETS.

Referenced by funcinfo(), and luaG_addinfo().

◆ luaO_hexavalue()

LUAI_FUNC int luaO_hexavalue ( int  c)

Definition at line 135 of file lobject.cpp.

References lisdigit, and ltolower.

Referenced by gethexa(), isneg(), l_str2int(), and readutf8esc().

◆ luaO_pushfstring()

LUAI_FUNC const char* luaO_pushfstring ( lua_State L,
const char *  fmt,
  ... 
)

◆ luaO_pushvfstring()

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

◆ luaO_rawarith()

LUAI_FUNC int luaO_rawarith ( lua_State L,
int  op,
const TValue p1,
const TValue p2,
TValue res 
)

◆ luaO_str2num()

LUAI_FUNC size_t luaO_str2num ( const char *  s,
TValue o 
)

Definition at line 308 of file lobject.cpp.

References e, i, l_str2d(), l_str2int(), n, setfltvalue, and setivalue.

Referenced by l_strton(), lua_stringtonumber(), and read_numeral().

◆ luaO_tostring()

LUAI_FUNC void luaO_tostring ( lua_State L,
TValue obj 
)

Definition at line 374 of file lobject.cpp.

References luaS_newlstr(), MAXNUMBER2STR, setsvalue, and tostringbuff().

Referenced by lua_tolstring().

◆ luaO_utf8esc()

LUAI_FUNC int luaO_utf8esc ( char *  buff,
unsigned long  x 
)

Definition at line 323 of file lobject.cpp.

References cast_char, lua_assert, n, and UTF8BUFFSZ.

Referenced by luaO_pushvfstring(), and utf8esc().