Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
lobject.h File Reference
#include <stdarg.h>
#include "llimits.h"
#include "lua.h"

Go to the source code of this file.

Data Structures

struct  GCObject
 
union  Value
 
struct  lua_TValue
 
struct  TString
 
union  UTString
 
struct  Udata
 
union  UUdata
 
struct  Upvaldesc
 
struct  LocVar
 
struct  Proto
 
struct  CClosure
 
struct  LClosure
 
union  Closure
 
union  TKey
 
union  Node
 
struct  Table
 

Macros

#define LUA_TPROTO   LUA_NUMTAGS /* function prototypes */
 
#define LUA_TDEADKEY   (LUA_NUMTAGS+1) /* removed keys in tables */
 
#define LUA_TOTALTAGS   (LUA_TPROTO + 2)
 
#define LUA_TLCL   (LUA_TFUNCTION | (0 << 4)) /* Lua closure */
 
#define LUA_TLCF   (LUA_TFUNCTION | (1 << 4)) /* light C function */
 
#define LUA_TCCL   (LUA_TFUNCTION | (2 << 4)) /* C closure */
 
#define LUA_TSHRSTR   (LUA_TSTRING | (0 << 4)) /* short strings */
 
#define LUA_TLNGSTR   (LUA_TSTRING | (1 << 4)) /* long strings */
 
#define LUA_TNUMFLT   (LUA_TNUMBER | (0 << 4)) /* float numbers */
 
#define LUA_TNUMINT   (LUA_TNUMBER | (1 << 4)) /* integer numbers */
 
#define BIT_ISCOLLECTABLE   (1 << 6)
 
#define ctb(t)   ((t) | BIT_ISCOLLECTABLE)
 
#define CommonHeader   GCObject *next; lu_byte tt; lu_byte marked
 
#define TValuefields   Value value_; int tt_
 
#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) & 0x3F)
 
#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)   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 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)
 
#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 hvalue(o)   check_exp(ttistable(o), gco2t(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)
 
#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 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)
 
#define setsvalue(L, obj, x)
 
#define setuvalue(L, obj, x)
 
#define setthvalue(L, obj, x)
 
#define setclLvalue(L, obj, x)
 
#define setclCvalue(L, obj, x)
 
#define sethvalue(L, obj, x)
 
#define setdeadvalue(obj)   settt_(obj, LUA_TDEADKEY)
 
#define setobj(L, obj1, obj2)
 
#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(L, o1, o2)   ((void)L, *(o1)=*(o2), checkliveness(L,(o1)))
 
#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))
 
#define getudatamem(u)    check_exp(sizeof((u)->ttuv_), (cast(char*, (u)) + sizeof(UUdata)))
 
#define setuservalue(L, u, o)
 
#define getuservalue(L, u, o)
 
#define ClosureHeader    CommonHeader; lu_byte nupvalues; GCObject *gclist
 
#define isLfunction(o)   ttisLclosure(o)
 
#define getproto(o)   (clLvalue(o)->p)
 
#define setnodekey(L, key, obj)
 
#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 luaO_nilobject   (&luaO_nilobject_)
 
#define UTF8BUFFSZ   8
 

Typedefs

typedef struct GCObject GCObject
 
typedef union Value Value
 
typedef struct lua_TValue TValue
 
typedef TValueStkId
 
typedef struct TString TString
 
typedef union UTString UTString
 
typedef struct Udata Udata
 
typedef union UUdata UUdata
 
typedef struct Upvaldesc Upvaldesc
 
typedef struct LocVar LocVar
 
typedef struct Proto Proto
 
typedef struct UpVal UpVal
 
typedef struct CClosure CClosure
 
typedef struct LClosure LClosure
 
typedef union Closure Closure
 
typedef union TKey TKey
 
typedef struct Node Node
 
typedef struct Table Table
 

Functions

LUAI_FUNC int luaO_int2fb (unsigned int x)
 
LUAI_FUNC int luaO_fb2int (int x)
 
LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x)
 
LUAI_FUNC int luaO_ceillog2 (unsigned int x)
 
LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2, TValue *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, StkId 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 len)
 

Variables

LUAI_DDEC const TValue luaO_nilobject_
 

Macro Definition Documentation

◆ BIT_ISCOLLECTABLE

#define BIT_ISCOLLECTABLE   (1 << 6)

Definition at line 63 of file lua-5.3.6/src/lobject.h.

◆ bvalue

#define bvalue ( o)    check_exp(ttisboolean(o), val_(o).b)

Definition at line 176 of file lua-5.3.6/src/lobject.h.

◆ checkliveness

#define checkliveness ( L,
obj )
Value:
(righttt(obj) && (L == NULL || !isdead(G(L),gcvalue(obj)))))
#define NULL
Definition gmacros.h:924
#define isdead(g, v)
#define G(L)
#define lua_longassert(c)
#define gcvalue(o)
#define righttt(obj)
#define iscollectable(o)

Definition at line 190 of file lua-5.3.6/src/lobject.h.

190#define checkliveness(L,obj) \
191 lua_longassert(!iscollectable(obj) || \
192 (righttt(obj) && (L == NULL || !isdead(G(L),gcvalue(obj)))))

◆ checktag

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

Definition at line 140 of file lua-5.3.6/src/lobject.h.

◆ checktype

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

Definition at line 141 of file lua-5.3.6/src/lobject.h.

◆ chgfltvalue

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

Definition at line 201 of file lua-5.3.6/src/lobject.h.

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

Referenced by floatforloop(), and luaV_execute().

◆ chgivalue

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

Definition at line 207 of file lua-5.3.6/src/lobject.h.

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

Referenced by luaV_execute(), and luaV_execute().

◆ clCvalue

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

Definition at line 173 of file lua-5.3.6/src/lobject.h.

◆ clLvalue

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

Definition at line 172 of file lua-5.3.6/src/lobject.h.

◆ ClosureHeader

#define ClosureHeader    CommonHeader; lu_byte nupvalues; GCObject *gclist

Definition at line 443 of file lua-5.3.6/src/lobject.h.

443#define ClosureHeader \
444 CommonHeader; lu_byte nupvalues; GCObject *gclist

◆ clvalue

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

Definition at line 171 of file lua-5.3.6/src/lobject.h.

◆ CommonHeader

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

Definition at line 79 of file lua-5.3.6/src/lobject.h.

◆ ctb

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

Definition at line 66 of file lua-5.3.6/src/lobject.h.

◆ deadvalue

#define deadvalue ( o)    check_exp(ttisdeadkey(o), cast(void *, val_(o).gc))

Definition at line 179 of file lua-5.3.6/src/lobject.h.

◆ fltvalue

◆ fvalue

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

Definition at line 174 of file lua-5.3.6/src/lobject.h.

◆ gcvalue

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

Definition at line 167 of file lua-5.3.6/src/lobject.h.

◆ getproto

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

Definition at line 468 of file lua-5.3.6/src/lobject.h.

◆ getstr

#define getstr ( ts)     check_exp(sizeof((ts)->extra), cast(char *, (ts)) + sizeof(UTString))

Definition at line 328 of file lua-5.3.6/src/lobject.h.

328#define getstr(ts) \
329 check_exp(sizeof((ts)->extra), cast(char *, (ts)) + sizeof(UTString))

◆ getudatamem

#define getudatamem ( u)     check_exp(sizeof((u)->ttuv_), (cast(char*, (u)) + sizeof(UUdata)))

Definition at line 368 of file lua-5.3.6/src/lobject.h.

368#define getudatamem(u) \
369 check_exp(sizeof((u)->ttuv_), (cast(char*, (u)) + sizeof(UUdata)))

Referenced by lua_newuserdata(), lua_newuserdatauv(), lua_topointer(), lua_touserdata(), and touserdata().

◆ getuservalue

#define getuservalue ( L,
u,
o )
Value:
{ TValue *io=(o); const Udata *iu = (u); \
io->value_ = iu->user_; settt_(io, iu->ttuv_); \
checkliveness(L,io); }
#define settt_(o, t)
union Value user_

Definition at line 377 of file lua-5.3.6/src/lobject.h.

377#define getuservalue(L,u,o) \
378 { TValue *io=(o); const Udata *iu = (u); \
379 io->value_ = iu->user_; settt_(io, iu->ttuv_); \
380 checkliveness(L,io); }

Referenced by lua_getuservalue(), and reallymarkobject().

◆ hvalue

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

Definition at line 175 of file lua-5.3.6/src/lobject.h.

◆ iscollectable

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

Definition at line 184 of file lua-5.3.6/src/lobject.h.

◆ isLfunction

#define isLfunction ( o)    ttisLclosure(o)

Definition at line 466 of file lua-5.3.6/src/lobject.h.

◆ ivalue

◆ l_isfalse

#define l_isfalse ( o)    (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0))

Definition at line 181 of file lua-5.3.6/src/lobject.h.

◆ lmod

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

Definition at line 514 of file lua-5.3.6/src/lobject.h.

514#define lmod(s,size) \
515 (check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1)))))

◆ LUA_TCCL

#define LUA_TCCL   (LUA_TFUNCTION | (2 << 4)) /* C closure */

Definition at line 49 of file lua-5.3.6/src/lobject.h.

◆ LUA_TDEADKEY

#define LUA_TDEADKEY   (LUA_NUMTAGS+1) /* removed keys in tables */

Definition at line 23 of file lua-5.3.6/src/lobject.h.

◆ LUA_TLCF

#define LUA_TLCF   (LUA_TFUNCTION | (1 << 4)) /* light C function */

Definition at line 48 of file lua-5.3.6/src/lobject.h.

◆ LUA_TLCL

#define LUA_TLCL   (LUA_TFUNCTION | (0 << 4)) /* Lua closure */

Definition at line 47 of file lua-5.3.6/src/lobject.h.

◆ LUA_TLNGSTR

#define LUA_TLNGSTR   (LUA_TSTRING | (1 << 4)) /* long strings */

Definition at line 54 of file lua-5.3.6/src/lobject.h.

◆ LUA_TNUMFLT

#define LUA_TNUMFLT   (LUA_TNUMBER | (0 << 4)) /* float numbers */

◆ LUA_TNUMINT

#define LUA_TNUMINT   (LUA_TNUMBER | (1 << 4)) /* integer numbers */

◆ LUA_TOTALTAGS

#define LUA_TOTALTAGS   (LUA_TPROTO + 2)

Definition at line 28 of file lua-5.3.6/src/lobject.h.

◆ LUA_TPROTO

#define LUA_TPROTO   LUA_NUMTAGS /* function prototypes */

Definition at line 22 of file lua-5.3.6/src/lobject.h.

◆ LUA_TSHRSTR

#define LUA_TSHRSTR   (LUA_TSTRING | (0 << 4)) /* short strings */

Definition at line 53 of file lua-5.3.6/src/lobject.h.

◆ luaO_nilobject

#define luaO_nilobject   (&luaO_nilobject_)

Definition at line 525 of file lua-5.3.6/src/lobject.h.

◆ NILCONSTANT

#define NILCONSTANT   {NULL}, LUA_TNIL

Definition at line 120 of file lua-5.3.6/src/lobject.h.

◆ novariant

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

Definition at line 130 of file lua-5.3.6/src/lobject.h.

◆ nvalue

#define nvalue ( o)
Value:
#define cast_num(i)
#define check_exp(c, e)
#define ttisnumber(o)
#define fltvalue(o)
#define ttisinteger(o)
#define ivalue(o)

Definition at line 165 of file lua-5.3.6/src/lobject.h.

165#define nvalue(o) check_exp(ttisnumber(o), \
166 (ttisinteger(o) ? cast_num(ivalue(o)) : fltvalue(o)))

◆ pvalue

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

Definition at line 168 of file lua-5.3.6/src/lobject.h.

◆ righttt

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

Definition at line 188 of file lua-5.3.6/src/lobject.h.

◆ rttype

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

Definition at line 127 of file lua-5.3.6/src/lobject.h.

◆ setbvalue

#define setbvalue ( obj,
x )    { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); }

Definition at line 218 of file lua-5.3.6/src/lobject.h.

218#define setbvalue(obj,x) \
219 { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); }

◆ setclCvalue

#define setclCvalue ( L,
obj,
x )
Value:
{ TValue *io = (obj); CClosure *x_ = (x); \
val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TCCL)); \
checkliveness(L,io); }
#define obj2gco(v)
#define ctb(t)
#define LUA_TCCL

Definition at line 245 of file lua-5.3.6/src/lobject.h.

245#define setclCvalue(L,obj,x) \
246 { TValue *io = (obj); CClosure *x_ = (x); \
247 val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TCCL)); \
248 checkliveness(L,io); }

◆ setclLvalue

#define setclLvalue ( L,
obj,
x )
Value:
{ TValue *io = (obj); LClosure *x_ = (x); \
val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TLCL)); \
checkliveness(L,io); }
#define LUA_TLCL

Definition at line 240 of file lua-5.3.6/src/lobject.h.

240#define setclLvalue(L,obj,x) \
241 { TValue *io = (obj); LClosure *x_ = (x); \
242 val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TLCL)); \
243 checkliveness(L,io); }

◆ setdeadvalue

#define setdeadvalue ( obj)    settt_(obj, LUA_TDEADKEY)

Definition at line 255 of file lua-5.3.6/src/lobject.h.

◆ setfltvalue

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

Definition at line 198 of file lua-5.3.6/src/lobject.h.

198#define setfltvalue(obj,x) \
199 { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMFLT); }

Referenced by floatforloop(), forprep(), LoadConstants(), loadConstants(), lua_pushnumber(), luaK_numberK(), luaK_numberK(), luaO_arith(), luaO_pushvfstring(), luaO_rawarith(), luaO_str2num(), luaT_callorderiTM(), luaV_execute(), luaV_execute(), tonumeral(), and tonumeral().

◆ setfvalue

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

Definition at line 212 of file lua-5.3.6/src/lobject.h.

212#define setfvalue(obj,x) \
213 { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_TLCF); }

◆ setgcovalue

#define setgcovalue ( L,
obj,
x )
Value:
{ TValue *io = (obj); GCObject *i_g=(x); \
val_(io).gc = i_g; settt_(io, ctb(i_g->tt)); }

Definition at line 221 of file lua-5.3.6/src/lobject.h.

221#define setgcovalue(L,obj,x) \
222 { TValue *io = (obj); GCObject *i_g=(x); \
223 val_(io).gc = i_g; settt_(io, ctb(i_g->tt)); }

◆ sethvalue

#define sethvalue ( L,
obj,
x )
Value:
{ TValue *io = (obj); Table *x_ = (x); \
val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTABLE)); \
checkliveness(L,io); }
#define LUA_TTABLE

Definition at line 250 of file lua-5.3.6/src/lobject.h.

250#define sethvalue(L,obj,x) \
251 { TValue *io = (obj); Table *x_ = (x); \
252 val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTABLE)); \
253 checkliveness(L,io); }

◆ sethvalue2s

#define sethvalue2s   sethvalue

Definition at line 273 of file lua-5.3.6/src/lobject.h.

◆ setivalue

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

◆ setnilvalue

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

Definition at line 210 of file lua-5.3.6/src/lobject.h.

◆ setnodekey

#define setnodekey ( L,
key,
obj )
Value:
{ TKey *k_=(key); const TValue *io_=(obj); \
k_->nk.value_ = io_->value_; k_->nk.tt_ = io_->tt_; \
(void)L; checkliveness(L,io_); }
#define checkliveness(L, obj)
struct TKey::@50 nk

Definition at line 485 of file lua-5.3.6/src/lobject.h.

485#define setnodekey(L,key,obj) \
486 { TKey *k_=(key); const TValue *io_=(obj); \
487 k_->nk.value_ = io_->value_; k_->nk.tt_ = io_->tt_; \
488 (void)L; checkliveness(L,io_); }

Referenced by luaH_newkey(), and luaH_newkey().

◆ setobj

#define setobj ( L,
obj1,
obj2 )
Value:
{ TValue *io1=(obj1); *io1 = *(obj2); \
(void)L; checkliveness(L,io1); }

Definition at line 259 of file lua-5.3.6/src/lobject.h.

259#define setobj(L,obj1,obj2) \
260 { TValue *io1=(obj1); *io1 = *(obj2); \
261 (void)L; checkliveness(L,io1); }

◆ setobj2n

#define setobj2n   setobj

Definition at line 278 of file lua-5.3.6/src/lobject.h.

◆ setobj2s

#define setobj2s   setobj

Definition at line 271 of file lua-5.3.6/src/lobject.h.

◆ setobj2t

#define setobj2t ( L,
o1,
o2 )   ((void)L, *(o1)=*(o2), checkliveness(L,(o1)))

Definition at line 282 of file lua-5.3.6/src/lobject.h.

◆ setobjs2s

#define setobjs2s   setobj

Definition at line 269 of file lua-5.3.6/src/lobject.h.

◆ setobjt2t

#define setobjt2t   setobj

Definition at line 276 of file lua-5.3.6/src/lobject.h.

◆ setptvalue2s

#define setptvalue2s   setptvalue

Definition at line 274 of file lua-5.3.6/src/lobject.h.

◆ setpvalue

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

Definition at line 215 of file lua-5.3.6/src/lobject.h.

215#define setpvalue(obj,x) \
216 { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_TLIGHTUSERDATA); }

◆ setsvalue

#define setsvalue ( L,
obj,
x )
Value:
{ TValue *io = (obj); TString *x_ = (x); \
val_(io).gc = obj2gco(x_); settt_(io, ctb(x_->tt)); \
checkliveness(L,io); }

Definition at line 225 of file lua-5.3.6/src/lobject.h.

225#define setsvalue(L,obj,x) \
226 { TValue *io = (obj); TString *x_ = (x); \
227 val_(io).gc = obj2gco(x_); settt_(io, ctb(x_->tt)); \
228 checkliveness(L,io); }

◆ setsvalue2n

#define setsvalue2n   setsvalue

Definition at line 279 of file lua-5.3.6/src/lobject.h.

◆ setsvalue2s

#define setsvalue2s   setsvalue

Definition at line 272 of file lua-5.3.6/src/lobject.h.

◆ setthvalue

#define setthvalue ( L,
obj,
x )
Value:
{ TValue *io = (obj); lua_State *x_ = (x); \
val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTHREAD)); \
checkliveness(L,io); }
#define LUA_TTHREAD

Definition at line 235 of file lua-5.3.6/src/lobject.h.

235#define setthvalue(L,obj,x) \
236 { TValue *io = (obj); lua_State *x_ = (x); \
237 val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTHREAD)); \
238 checkliveness(L,io); }

◆ settt_

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

Definition at line 196 of file lua-5.3.6/src/lobject.h.

◆ setuservalue

#define setuservalue ( L,
u,
o )
Value:
{ const TValue *io=(o); Udata *iu = (u); \
iu->user_ = io->value_; iu->ttuv_ = rttype(io); \
checkliveness(L,io); }
#define rttype(o)

Definition at line 371 of file lua-5.3.6/src/lobject.h.

371#define setuservalue(L,u,o) \
372 { const TValue *io=(o); Udata *iu = (u); \
373 iu->user_ = io->value_; iu->ttuv_ = rttype(io); \
374 checkliveness(L,io); }

Referenced by lua_setuservalue(), and luaS_newudata().

◆ setuvalue

#define setuvalue ( L,
obj,
x )
Value:
{ TValue *io = (obj); Udata *x_ = (x); \
val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TUSERDATA)); \
checkliveness(L,io); }
#define LUA_TUSERDATA

Definition at line 230 of file lua-5.3.6/src/lobject.h.

230#define setuvalue(L,obj,x) \
231 { TValue *io = (obj); Udata *x_ = (x); \
232 val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TUSERDATA)); \
233 checkliveness(L,io); }

◆ sizenode

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

Definition at line 519 of file lua-5.3.6/src/lobject.h.

◆ svalue

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

Definition at line 333 of file lua-5.3.6/src/lobject.h.

◆ thvalue

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

Definition at line 177 of file lua-5.3.6/src/lobject.h.

◆ tsslen

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

◆ tsvalue

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

Definition at line 169 of file lua-5.3.6/src/lobject.h.

◆ ttisboolean

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

Definition at line 146 of file lua-5.3.6/src/lobject.h.

◆ ttisCclosure

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

Definition at line 154 of file lua-5.3.6/src/lobject.h.

◆ ttisclosure

#define ttisclosure ( o)    ((rttype(o) & 0x1F) == LUA_TFUNCTION)

Definition at line 153 of file lua-5.3.6/src/lobject.h.

◆ ttisdeadkey

#define ttisdeadkey ( o)    checktag((o), LUA_TDEADKEY)

Definition at line 159 of file lua-5.3.6/src/lobject.h.

◆ ttisfloat

◆ ttisfulluserdata

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

◆ ttisfunction

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

Definition at line 152 of file lua-5.3.6/src/lobject.h.

◆ ttisinteger

◆ ttislcf

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

Definition at line 156 of file lua-5.3.6/src/lobject.h.

◆ ttisLclosure

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

Definition at line 155 of file lua-5.3.6/src/lobject.h.

◆ ttislightuserdata

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

Definition at line 147 of file lua-5.3.6/src/lobject.h.

◆ ttislngstring

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

Definition at line 150 of file lua-5.3.6/src/lobject.h.

◆ ttisnil

#define ttisnil ( o)    checktag((o), LUA_TNIL)

Definition at line 145 of file lua-5.3.6/src/lobject.h.

◆ ttisnumber

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

Definition at line 142 of file lua-5.3.6/src/lobject.h.

◆ ttisshrstring

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

Definition at line 149 of file lua-5.3.6/src/lobject.h.

◆ ttisstring

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

Definition at line 148 of file lua-5.3.6/src/lobject.h.

◆ ttistable

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

Definition at line 151 of file lua-5.3.6/src/lobject.h.

◆ ttisthread

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

Definition at line 158 of file lua-5.3.6/src/lobject.h.

◆ ttnov

◆ ttype

#define ttype ( o)    (rttype(o) & 0x3F)

Definition at line 133 of file lua-5.3.6/src/lobject.h.

◆ TValuefields

#define TValuefields   Value value_; int tt_

Definition at line 110 of file lua-5.3.6/src/lobject.h.

◆ twoto

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

Definition at line 518 of file lua-5.3.6/src/lobject.h.

◆ UTF8BUFFSZ

#define UTF8BUFFSZ   8

Definition at line 531 of file lua-5.3.6/src/lobject.h.

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

◆ uvalue

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

Definition at line 170 of file lua-5.3.6/src/lobject.h.

◆ val_

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

Definition at line 123 of file lua-5.3.6/src/lobject.h.

◆ vslen

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

Typedef Documentation

◆ CClosure

typedef struct CClosure CClosure

◆ Closure

typedef union Closure Closure

◆ GCObject

typedef struct GCObject GCObject

Definition at line 72 of file lua-5.3.6/src/lobject.h.

◆ LClosure

typedef struct LClosure LClosure

◆ LocVar

typedef struct LocVar LocVar

◆ Node

typedef struct Node Node

◆ Proto

typedef struct Proto Proto

◆ StkId

typedef TValue* StkId

Definition at line 294 of file lua-5.3.6/src/lobject.h.

◆ Table

typedef struct Table Table

◆ TKey

typedef union TKey TKey

◆ TString

typedef struct TString TString

◆ TValue

typedef struct lua_TValue TValue

◆ Udata

typedef struct Udata Udata

◆ UpVal

typedef struct UpVal UpVal

Definition at line 436 of file lua-5.3.6/src/lobject.h.

◆ Upvaldesc

typedef struct Upvaldesc Upvaldesc

◆ UTString

typedef union UTString UTString

◆ UUdata

typedef union UUdata UUdata

◆ 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,
TValue * res )

Definition at line 123 of file lua-5.3.6/src/lobject.c.

124 {
125 switch (op) {
126 case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR:
127 case LUA_OPSHL: case LUA_OPSHR:
128 case LUA_OPBNOT: { /* operate only on integers */
130 if (tointeger(p1, &i1) && tointeger(p2, &i2)) {
131 setivalue(res, intarith(L, op, i1, i2));
132 return;
133 }
134 else break; /* go to the end */
135 }
136 case LUA_OPDIV: case LUA_OPPOW: { /* operate only on floats */
137 lua_Number n1; lua_Number n2;
138 if (tonumber(p1, &n1) && tonumber(p2, &n2)) {
139 setfltvalue(res, numarith(L, op, n1, n2));
140 return;
141 }
142 else break; /* go to the end */
143 }
144 default: { /* other operations */
145 lua_Number n1; lua_Number n2;
146 if (ttisinteger(p1) && ttisinteger(p2)) {
147 setivalue(res, intarith(L, op, ivalue(p1), ivalue(p2)));
148 return;
149 }
150 else if (tonumber(p1, &n1) && tonumber(p2, &n2)) {
151 setfltvalue(res, numarith(L, op, n1, n2));
152 return;
153 }
154 else break; /* go to the end */
155 }
156 }
157 /* could not perform raw operation; try metamethod */
158 lua_assert(L != NULL); /* should not fail when folding (compile time) */
159 luaT_trybinTM(L, p1, p2, res, cast(TMS, (op - LUA_OPADD) + TM_ADD));
160}
#define lua_assert(c)
#define cast(t, exp)
@ TM_ADD
LUA_INTEGER lua_Integer
LUA_NUMBER lua_Number
#define tonumber(o, n)
#define LUA_OPADD
#define LUA_OPPOW
#define LUA_OPDIV
static lua_Integer intarith(lua_State *L, int op, lua_Integer v1, lua_Integer v2)
static lua_Number numarith(lua_State *L, int op, lua_Number v1, lua_Number v2)
#define setfltvalue(obj, x)
#define setivalue(obj, x)
void luaT_trybinTM(lua_State *L, const TValue *p1, const TValue *p2, StkId res, TMS event)
#define LUA_OPBXOR
#define LUA_OPSHL
#define LUA_OPBOR
#define LUA_OPSHR
#define LUA_OPBNOT
#define LUA_OPBAND
#define tointeger(o, i)

References cast, intarith(), ivalue, lua_assert, LUA_OPADD, LUA_OPBAND, LUA_OPBNOT, LUA_OPBOR, LUA_OPBXOR, LUA_OPDIV, LUA_OPPOW, LUA_OPSHL, LUA_OPSHR, luaT_trybinTM(), NULL, numarith(), setfltvalue, setivalue, TM_ADD, tointeger, tonumber, and ttisinteger.

◆ luaO_ceillog2()

LUAI_FUNC int luaO_ceillog2 ( unsigned int x)

Definition at line 55 of file lua-5.2.4/src/lobject.c.

55 {
56 static const lu_byte log_2[256] = {
57 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
58 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
59 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
60 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
61 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
62 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
63 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
64 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
65 };
66 int l = 0;
67 x--;
68 while (x >= 256) { l += 8; x >>= 8; }
69 return l + log_2[x];
70}
unsigned char lu_byte

◆ luaO_chunkid()

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

Definition at line 182 of file lua-5.1.5/src/lobject.c.

182 {
183 if (*source == '=') {
184 strncpy(out, source+1, bufflen); /* remove first char */
185 out[bufflen-1] = '\0'; /* ensures null termination */
186 }
187 else { /* out = "source", or "...source" */
188 if (*source == '@') {
189 size_t l;
190 source++; /* skip the `@' */
191 bufflen -= sizeof(" '...' ");
192 l = strlen(source);
193 strcpy(out, "");
194 if (l > bufflen) {
195 source += (l-bufflen); /* get last part of file name */
196 strcat(out, "...");
197 }
198 strcat(out, source);
199 }
200 else { /* out = [string "string"] */
201 size_t len = strcspn(source, "\n\r"); /* stop at first newline */
202 bufflen -= sizeof(" [string \"...\"] ");
203 if (len > bufflen) len = bufflen;
204 strcpy(out, "[string \"");
205 if (source[len] != '\0') { /* must truncate? */
206 strncat(out, source, len);
207 strcat(out, "...");
208 }
209 else
210 strcat(out, source);
211 strcat(out, "\"]");
212 }
213 }
214}
#define bufflen(B)

◆ luaO_fb2int()

LUAI_FUNC int luaO_fb2int ( int x)

Definition at line 47 of file lua-5.1.5/src/lobject.c.

47 {
48 int e = (x >> 3) & 31;
49 if (e == 0) return x;
50 else return ((x & 7)+8) << (e - 1);
51}

Referenced by luaV_execute(), and luaV_execute().

◆ luaO_hexavalue()

LUAI_FUNC int luaO_hexavalue ( int c)

Definition at line 87 of file lua-5.2.4/src/lobject.c.

87 {
88 if (lisdigit(c)) return c - '0';
89 else return ltolower(c) - 'a' + 10;
90}
#define ltolower(c)
#define lisdigit(c)

◆ luaO_int2fb()

LUAI_FUNC int luaO_int2fb ( unsigned int x)

Definition at line 35 of file lua-5.1.5/src/lobject.c.

35 {
36 int e = 0; /* expoent */
37 while (x >= 16) {
38 x = (x+1) >> 1;
39 e++;
40 }
41 if (x < 8) return x;
42 else return ((e+1) << 3) | (cast_int(x) - 8);
43}
#define cast_int(i)

References cast_int.

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

◆ luaO_pushfstring()

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

Definition at line 172 of file lua-5.1.5/src/lobject.c.

172 {
173 const char *msg;
174 va_list argp;
175 va_start(argp, fmt);
176 msg = luaO_pushvfstring(L, fmt, argp);
177 va_end(argp);
178 return msg;
179}
const char * luaO_pushvfstring(lua_State *L, const char *fmt, va_list argp)

◆ luaO_pushvfstring()

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

Definition at line 111 of file lua-5.1.5/src/lobject.c.

111 {
112 int n = 1;
113 pushstr(L, "");
114 for (;;) {
115 const char *e = strchr(fmt, '%');
116 if (e == NULL) break;
117 setsvalue2s(L, L->top, luaS_newlstr(L, fmt, e-fmt));
118 incr_top(L);
119 switch (*(e+1)) {
120 case 's': {
121 const char *s = va_arg(argp, char *);
122 if (s == NULL) s = "(null)";
123 pushstr(L, s);
124 break;
125 }
126 case 'c': {
127 char buff[2];
128 buff[0] = cast(char, va_arg(argp, int));
129 buff[1] = '\0';
130 pushstr(L, buff);
131 break;
132 }
133 case 'd': {
134 setnvalue(L->top, cast_num(va_arg(argp, int)));
135 incr_top(L);
136 break;
137 }
138 case 'f': {
139 setnvalue(L->top, cast_num(va_arg(argp, l_uacNumber)));
140 incr_top(L);
141 break;
142 }
143 case 'p': {
144 char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */
145 sprintf(buff, "%p", va_arg(argp, void *));
146 pushstr(L, buff);
147 break;
148 }
149 case '%': {
150 pushstr(L, "%");
151 break;
152 }
153 default: {
154 char buff[3];
155 buff[0] = '%';
156 buff[1] = *(e+1);
157 buff[2] = '\0';
158 pushstr(L, buff);
159 break;
160 }
161 }
162 n += 2;
163 fmt = e+2;
164 }
165 pushstr(L, fmt);
166 luaV_concat(L, n+1, cast_int(L->top - L->base) - 1);
167 L->top -= n;
168 return svalue(L->top - 1);
169}
#define incr_top(L)
LUAI_UACNUMBER l_uacNumber
static void pushstr(lua_State *L, const char *str)
#define setsvalue2s
#define setnvalue(obj, x)
#define svalue(o)
TString * luaS_newlstr(lua_State *L, const char *str, size_t l)
void luaV_concat(lua_State *L, int total, int last)
CURL_EXTERN CURLMcode curl_socket_t s
Definition multi.h:318

◆ luaO_str2num()

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

Definition at line 331 of file lua-5.3.6/src/lobject.c.

331 {
333 const char *e;
334 if ((e = l_str2int(s, &i)) != NULL) { /* try as an integer */
335 setivalue(o, i);
336 }
337 else if ((e = l_str2d(s, &n)) != NULL) { /* else try as a float */
338 setfltvalue(o, n);
339 }
340 else
341 return 0; /* conversion failed */
342 return (e - s) + 1; /* success; return string size */
343}
static const char * l_str2int(const char *s, lua_Integer *result)
static const char * l_str2d(const char *s, lua_Number *result)

◆ luaO_tostring()

LUAI_FUNC void luaO_tostring ( lua_State * L,
StkId obj )

Definition at line 371 of file lua-5.3.6/src/lobject.c.

371 {
372 char buff[MAXNUMBER2STR];
373 size_t len;
375 if (ttisinteger(obj))
376 len = lua_integer2str(buff, sizeof(buff), ivalue(obj));
377 else {
378 len = lua_number2str(buff, sizeof(buff), fltvalue(obj));
379#if !defined(LUA_COMPAT_FLOATSTRING)
380 if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */
381 buff[len++] = lua_getlocaledecpoint();
382 buff[len++] = '0'; /* adds '.0' to result */
383 }
384#endif
385 }
386 setsvalue2s(L, obj, luaS_newlstr(L, buff, len));
387}
#define ttisnumber(o)
#define lua_number2str(s, n)
#define MAXNUMBER2STR
#define lua_getlocaledecpoint()
#define lua_integer2str(s, sz, n)

References fltvalue, ivalue, lua_assert, lua_getlocaledecpoint, lua_integer2str, lua_number2str, luaS_newlstr(), MAXNUMBER2STR, setsvalue2s, ttisinteger, and ttisnumber.

Referenced by lua_tolstring(), and luaO_pushvfstring().

◆ luaO_utf8esc()

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

Definition at line 346 of file lua-5.3.6/src/lobject.c.

346 {
347 int n = 1; /* number of bytes put in buffer (backwards) */
348 lua_assert(x <= 0x10FFFF);
349 if (x < 0x80) /* ascii? */
350 buff[UTF8BUFFSZ - 1] = cast(char, x);
351 else { /* need continuation bytes */
352 unsigned int mfb = 0x3f; /* maximum that fits in first byte */
353 do { /* add continuation bytes */
354 buff[UTF8BUFFSZ - (n++)] = cast(char, 0x80 | (x & 0x3f));
355 x >>= 6; /* remove added bits */
356 mfb >>= 1; /* now there is one less bit available in first byte */
357 } while (x > mfb); /* still needs continuation byte? */
358 buff[UTF8BUFFSZ - n] = cast(char, (~mfb << 1) | x); /* add first byte */
359 }
360 return n;
361}
#define UTF8BUFFSZ

Variable Documentation

◆ luaO_nilobject_

LUAI_DDEC const TValue luaO_nilobject_

Definition at line 528 of file lua-5.3.6/src/lobject.h.