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  GCheader
 
union  Value
 
struct  lua_TValue
 
struct  TString
 
struct  Udata
 
struct  Upvaldesc
 
struct  LocVar
 
struct  Proto
 
struct  UpVal
 
struct  CClosure
 
struct  LClosure
 
union  Closure
 
union  TKey
 
union  Node
 
struct  Table
 

Macros

#define LUA_TPROTO   LUA_NUMTAGS
 
#define LUA_TUPVAL   (LUA_NUMTAGS+1)
 
#define LUA_TDEADKEY   (LUA_NUMTAGS+2)
 
#define LUA_TOTALTAGS   (LUA_TUPVAL+2)
 
#define VARBITS   (3 << 4)
 
#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 BIT_ISCOLLECTABLE   (1 << 6)
 
#define ctb(t)   ((t) | BIT_ISCOLLECTABLE)
 
#define CommonHeader   GCObject *next; lu_byte tt; lu_byte marked
 
#define numfield   lua_Number n; /* numbers */
 
#define TValuefields   Value value_; int tt_
 
#define NILCONSTANT   {NULL}, LUA_TNIL
 
#define val_(o)   ((o)->value_)
 
#define num_(o)   (val_(o).n)
 
#define rttype(o)   ((o)->tt_)
 
#define novariant(x)   ((x) & 0x0F)
 
#define ttype(o)   (rttype(o) & 0x3F)
 
#define ttypenv(o)   (novariant(rttype(o)))
 
#define checktag(o, t)   (rttype(o) == (t))
 
#define checktype(o, t)   (ttypenv(o) == (t))
 
#define ttisnumber(o)   checktag((o), LUA_TNUMBER)
 
#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 ttisuserdata(o)   checktag((o), ctb(LUA_TUSERDATA))
 
#define ttisthread(o)   checktag((o), ctb(LUA_TTHREAD))
 
#define ttisdeadkey(o)   checktag((o), LUA_TDEADKEY)
 
#define ttisequal(o1, o2)   (rttype(o1) == rttype(o2))
 
#define nvalue(o)   check_exp(ttisnumber(o), num_(o))
 
#define gcvalue(o)   check_exp(iscollectable(o), val_(o).gc)
 
#define pvalue(o)   check_exp(ttislightuserdata(o), val_(o).p)
 
#define rawtsvalue(o)   check_exp(ttisstring(o), &val_(o).gc->ts)
 
#define tsvalue(o)   (&rawtsvalue(o)->tsv)
 
#define rawuvalue(o)   check_exp(ttisuserdata(o), &val_(o).gc->u)
 
#define uvalue(o)   (&rawuvalue(o)->uv)
 
#define clvalue(o)   check_exp(ttisclosure(o), &val_(o).gc->cl)
 
#define clLvalue(o)   check_exp(ttisLclosure(o), &val_(o).gc->cl.l)
 
#define clCvalue(o)   check_exp(ttisCclosure(o), &val_(o).gc->cl.c)
 
#define fvalue(o)   check_exp(ttislcf(o), val_(o).f)
 
#define hvalue(o)   check_exp(ttistable(o), &val_(o).gc->h)
 
#define bvalue(o)   check_exp(ttisboolean(o), val_(o).b)
 
#define thvalue(o)   check_exp(ttisthread(o), &val_(o).gc->th)
 
#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)->gch.tt)
 
#define checkliveness(g, obj)
 
#define settt_(o, t)   ((o)->tt_=(t))
 
#define setnvalue(obj, x)    { TValue *io=(obj); num_(io)=(x); settt_(io, LUA_TNUMBER); }
 
#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 setobj2t   setobj
 
#define setobj2n   setobj
 
#define setsvalue2n   setsvalue
 
#define luai_checknum(L, o, c)   { /* empty */ }
 
#define getstr(ts)   cast(const char *, (ts) + 1)
 
#define svalue(o)   getstr(rawtsvalue(o))
 
#define ClosureHeader    CommonHeader; lu_byte nupvalues; GCObject *gclist
 
#define isLfunction(o)   ttisLclosure(o)
 
#define getproto(o)   (clLvalue(o)->p)
 
#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_)
 

Typedefs

typedef union GCObject GCObject
 
typedef struct GCheader GCheader
 
typedef union Value Value
 
typedef struct lua_TValue TValue
 
typedef TValueStkId
 
typedef union TString TString
 
typedef union Udata Udata
 
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_ceillog2 (unsigned int x)
 
LUAI_FUNC lua_Number luaO_arith (int op, lua_Number v1, lua_Number v2)
 
LUAI_FUNC int luaO_str2d (const char *s, size_t len, lua_Number *result)
 
LUAI_FUNC int luaO_hexavalue (int c)
 
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 61 of file lua-5.2.4/src/lobject.h.

◆ bvalue

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

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

◆ checkliveness

#define checkliveness ( g,
obj )
Value:
(righttt(obj) && !isdead(g,gcvalue(obj))))
#define isdead(g, v)
#define lua_longassert(c)
#define gcvalue(o)
#define righttt(obj)
#define iscollectable(o)

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

179#define checkliveness(g,obj) \
180 lua_longassert(!iscollectable(obj) || \
181 (righttt(obj) && !isdead(g,gcvalue(obj))))

◆ checktag

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

Definition at line 131 of file lua-5.2.4/src/lobject.h.

◆ checktype

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

Definition at line 132 of file lua-5.2.4/src/lobject.h.

◆ clCvalue

◆ clLvalue

◆ ClosureHeader

#define ClosureHeader    CommonHeader; lu_byte nupvalues; GCObject *gclist

Definition at line 513 of file lua-5.2.4/src/lobject.h.

513#define ClosureHeader \
514 CommonHeader; lu_byte nupvalues; GCObject *gclist

◆ clvalue

#define clvalue ( o)    check_exp(ttisclosure(o), &val_(o).gc->cl)

Definition at line 160 of file lua-5.2.4/src/lobject.h.

◆ CommonHeader

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

Definition at line 77 of file lua-5.2.4/src/lobject.h.

◆ ctb

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

Definition at line 64 of file lua-5.2.4/src/lobject.h.

Referenced by equalkey().

◆ deadvalue

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

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

Referenced by findindex(), and findindex().

◆ fvalue

◆ gcvalue

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

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

◆ getproto

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

Definition at line 538 of file lua-5.2.4/src/lobject.h.

Referenced by lua_dump(), lua_dump(), and luaV_execute().

◆ getstr

#define getstr ( ts)    cast(const char *, (ts) + 1)

Definition at line 422 of file lua-5.2.4/src/lobject.h.

◆ hvalue

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

Definition at line 164 of file lua-5.2.4/src/lobject.h.

◆ iscollectable

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

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

◆ isLfunction

#define isLfunction ( o)    ttisLclosure(o)

Definition at line 536 of file lua-5.2.4/src/lobject.h.

◆ l_isfalse

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

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

◆ lmod

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

Definition at line 577 of file lua-5.2.4/src/lobject.h.

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

◆ LUA_TCCL

◆ LUA_TDEADKEY

#define LUA_TDEADKEY   (LUA_NUMTAGS+2)

Definition at line 24 of file lua-5.2.4/src/lobject.h.

◆ LUA_TLCF

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

◆ LUA_TLCL

◆ LUA_TLNGSTR

◆ LUA_TOTALTAGS

#define LUA_TOTALTAGS   (LUA_TUPVAL+2)

Definition at line 29 of file lua-5.2.4/src/lobject.h.

◆ LUA_TPROTO

#define LUA_TPROTO   LUA_NUMTAGS

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

◆ LUA_TSHRSTR

◆ LUA_TUPVAL

#define LUA_TUPVAL   (LUA_NUMTAGS+1)

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

◆ luai_checknum

#define luai_checknum ( L,
o,
c )   { /* empty */ }

Definition at line 267 of file lua-5.2.4/src/lobject.h.

Referenced by lua_pushnumber().

◆ luaO_nilobject

#define luaO_nilobject   (&luaO_nilobject_)

Definition at line 588 of file lua-5.2.4/src/lobject.h.

◆ NILCONSTANT

#define NILCONSTANT   {NULL}, LUA_TNIL

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

◆ novariant

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

Definition at line 121 of file lua-5.2.4/src/lobject.h.

Referenced by iscleared(), luaC_newobj(), and luaC_newobj().

◆ num_

#define num_ ( o)    (val_(o).n)

Definition at line 114 of file lua-5.2.4/src/lobject.h.

◆ numfield

#define numfield   lua_Number n; /* numbers */

Definition at line 95 of file lua-5.2.4/src/lobject.h.

◆ nvalue

#define nvalue ( o)    check_exp(ttisnumber(o), num_(o))

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

◆ pvalue

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

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

◆ rawtsvalue

#define rawtsvalue ( o)    check_exp(ttisstring(o), &val_(o).gc->ts)

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

◆ rawuvalue

#define rawuvalue ( o)    check_exp(ttisuserdata(o), &val_(o).gc->u)

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

◆ righttt

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

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

◆ rttype

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

Definition at line 118 of file lua-5.2.4/src/lobject.h.

◆ setbvalue

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

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

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

◆ setclCvalue

#define setclCvalue ( L,
obj,
x )
Value:
{ TValue *io=(obj); \
val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TCCL)); \
checkliveness(G(L),io); }
#define cast(t, exp)
#define G(L)
#define ctb(t)
#define settt_(o, t)
#define LUA_TCCL

Definition at line 226 of file lua-5.2.4/src/lobject.h.

226#define setclCvalue(L,obj,x) \
227 { TValue *io=(obj); \
228 val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TCCL)); \
229 checkliveness(G(L),io); }

Referenced by lua_pushcclosure().

◆ setclLvalue

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

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

221#define setclLvalue(L,obj,x) \
222 { TValue *io=(obj); \
223 val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TLCL)); \
224 checkliveness(G(L),io); }

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

◆ setdeadvalue

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

Definition at line 236 of file lua-5.2.4/src/lobject.h.

Referenced by removeentry(), and removeentry().

◆ setfvalue

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

Definition at line 192 of file lua-5.2.4/src/lobject.h.

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

Referenced by lua_pushcclosure().

◆ setgcovalue

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

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

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

Referenced by GCTM(), GCTM(), and GCTM().

◆ sethvalue

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

Definition at line 231 of file lua-5.2.4/src/lobject.h.

231#define sethvalue(L,obj,x) \
232 { TValue *io=(obj); \
233 val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TTABLE)); \
234 checkliveness(G(L),io); }

◆ sethvalue2s

#define sethvalue2s   sethvalue

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

◆ setnilvalue

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

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

◆ setnvalue

#define setnvalue ( obj,
x )    { TValue *io=(obj); num_(io)=(x); settt_(io, LUA_TNUMBER); }

Definition at line 187 of file lua-5.2.4/src/lobject.h.

187#define setnvalue(obj,x) \
188 { TValue *io=(obj); num_(io)=(x); settt_(io, LUA_TNUMBER); }

◆ setobj

#define setobj ( L,
obj1,
obj2 )
Value:
{ const TValue *io2=(obj2); TValue *io1=(obj1); \
io1->value_ = io2->value_; io1->tt_ = io2->tt_; \
checkliveness(G(L),io1); }

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

240#define setobj(L,obj1,obj2) \
241 { const TValue *io2=(obj2); TValue *io1=(obj1); \
242 io1->value_ = io2->value_; io1->tt_ = io2->tt_; \
243 checkliveness(G(L),io1); }

◆ setobj2n

#define setobj2n   setobj

Definition at line 262 of file lua-5.2.4/src/lobject.h.

◆ setobj2s

#define setobj2s   setobj

Definition at line 253 of file lua-5.2.4/src/lobject.h.

◆ setobj2t

#define setobj2t   setobj

Definition at line 260 of file lua-5.2.4/src/lobject.h.

◆ setobjs2s

#define setobjs2s   setobj

Definition at line 251 of file lua-5.2.4/src/lobject.h.

◆ setobjt2t

#define setobjt2t   setobj

Definition at line 258 of file lua-5.2.4/src/lobject.h.

◆ setptvalue2s

#define setptvalue2s   setptvalue

Definition at line 256 of file lua-5.2.4/src/lobject.h.

◆ setpvalue

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

Definition at line 195 of file lua-5.2.4/src/lobject.h.

195#define setpvalue(obj,x) \
196 { 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=cast(GCObject *, x_); settt_(io, ctb(x_->tsv.tt)); \
checkliveness(G(L),io); }
struct TString::@46 tsv

Definition at line 205 of file lua-5.2.4/src/lobject.h.

205#define setsvalue(L,obj,x) \
206 { TValue *io=(obj); \
207 TString *x_ = (x); \
208 val_(io).gc=cast(GCObject *, x_); settt_(io, ctb(x_->tsv.tt)); \
209 checkliveness(G(L),io); }

◆ setsvalue2n

#define setsvalue2n   setsvalue

Definition at line 263 of file lua-5.2.4/src/lobject.h.

◆ setsvalue2s

#define setsvalue2s   setsvalue

Definition at line 254 of file lua-5.2.4/src/lobject.h.

◆ setthvalue

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

Definition at line 216 of file lua-5.2.4/src/lobject.h.

216#define setthvalue(L,obj,x) \
217 { TValue *io=(obj); \
218 val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TTHREAD)); \
219 checkliveness(G(L),io); }

◆ settt_

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

Definition at line 185 of file lua-5.2.4/src/lobject.h.

◆ setuvalue

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

Definition at line 211 of file lua-5.2.4/src/lobject.h.

211#define setuvalue(L,obj,x) \
212 { TValue *io=(obj); \
213 val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TUSERDATA)); \
214 checkliveness(G(L),io); }

◆ sizenode

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

Definition at line 582 of file lua-5.2.4/src/lobject.h.

◆ svalue

#define svalue ( o)    getstr(rawtsvalue(o))

Definition at line 425 of file lua-5.2.4/src/lobject.h.

◆ thvalue

#define thvalue ( o)    check_exp(ttisthread(o), &val_(o).gc->th)

Definition at line 166 of file lua-5.2.4/src/lobject.h.

◆ tsvalue

#define tsvalue ( o)    (&rawtsvalue(o)->tsv)

Definition at line 157 of file lua-5.2.4/src/lobject.h.

◆ ttisboolean

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

Definition at line 135 of file lua-5.2.4/src/lobject.h.

◆ ttisCclosure

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

Definition at line 143 of file lua-5.2.4/src/lobject.h.

Referenced by lua_iscfunction(), and lua_tocfunction().

◆ ttisclosure

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

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

Referenced by lua_getinfo().

◆ ttisdeadkey

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

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

Referenced by findindex(), findindex(), and mainposition().

◆ ttisequal

#define ttisequal ( o1,
o2 )   (rttype(o1) == rttype(o2))

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

Referenced by luaV_equalobj_().

◆ ttisfunction

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

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

◆ ttislcf

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

◆ ttisLclosure

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

Definition at line 144 of file lua-5.2.4/src/lobject.h.

Referenced by getupvalref(), getupvalref(), getupvalref(), and luaV_execute().

◆ ttislightuserdata

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

Definition at line 136 of file lua-5.2.4/src/lobject.h.

◆ ttislngstring

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

Definition at line 139 of file lua-5.2.4/src/lobject.h.

◆ ttisnil

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

Definition at line 134 of file lua-5.2.4/src/lobject.h.

◆ ttisnumber

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

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

◆ ttisshrstring

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

Definition at line 138 of file lua-5.2.4/src/lobject.h.

Referenced by isKstr(), lua_error(), luaH_getshortstr(), and luaH_getstr().

◆ ttisstring

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

Definition at line 137 of file lua-5.2.4/src/lobject.h.

◆ ttistable

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

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

◆ ttisthread

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

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

◆ ttisuserdata

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

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

◆ ttype

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

Definition at line 124 of file lua-5.2.4/src/lobject.h.

◆ ttypenv

◆ TValuefields

#define TValuefields   Value value_; int tt_

Definition at line 104 of file lua-5.2.4/src/lobject.h.

◆ twoto

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

Definition at line 581 of file lua-5.2.4/src/lobject.h.

◆ uvalue

#define uvalue ( o)    (&rawuvalue(o)->uv)

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

◆ val_

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

Definition at line 113 of file lua-5.2.4/src/lobject.h.

◆ VARBITS

#define VARBITS   (3 << 4)

Definition at line 39 of file lua-5.2.4/src/lobject.h.

Typedef Documentation

◆ CClosure

typedef struct CClosure CClosure

◆ Closure

typedef union Closure Closure

◆ GCheader

typedef struct GCheader GCheader

◆ GCObject

typedef union GCObject GCObject

Definition at line 70 of file lua-5.2.4/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 402 of file lua-5.2.4/src/lobject.h.

◆ Table

typedef struct Table Table

◆ TKey

typedef union TKey TKey

◆ TString

typedef union TString TString

◆ TValue

typedef struct lua_TValue TValue

Definition at line 106 of file lua-5.2.4/src/lobject.h.

◆ Udata

typedef union Udata Udata

◆ UpVal

typedef struct UpVal UpVal

◆ Upvaldesc

typedef struct Upvaldesc Upvaldesc

◆ Value

typedef union Value Value

Definition at line 92 of file lua-5.2.4/src/lobject.h.

Function Documentation

◆ luaO_arith()

LUAI_FUNC lua_Number luaO_arith ( int op,
lua_Number v1,
lua_Number v2 )

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

73 {
74 switch (op) {
75 case LUA_OPADD: return luai_numadd(NULL, v1, v2);
76 case LUA_OPSUB: return luai_numsub(NULL, v1, v2);
77 case LUA_OPMUL: return luai_nummul(NULL, v1, v2);
78 case LUA_OPDIV: return luai_numdiv(NULL, v1, v2);
79 case LUA_OPMOD: return luai_nummod(NULL, v1, v2);
80 case LUA_OPPOW: return luai_numpow(NULL, v1, v2);
81 case LUA_OPUNM: return luai_numunm(NULL, v1);
82 default: lua_assert(0); return 0;
83 }
84}
#define NULL
Definition gmacros.h:924
#define lua_assert(c)
#define LUA_OPSUB
#define LUA_OPMUL
#define LUA_OPMOD
#define LUA_OPADD
#define LUA_OPPOW
#define LUA_OPUNM
#define LUA_OPDIV
#define luai_nummul(L, a, b)
#define luai_numdiv(L, a, b)
#define luai_numpow(L, a, b)
#define luai_numunm(L, a)
#define luai_numsub(L, a, b)
#define luai_nummod(L, a, b, m)
#define luai_numadd(L, a, b)

References lua_assert, LUA_OPADD, LUA_OPDIV, LUA_OPMOD, LUA_OPMUL, LUA_OPPOW, LUA_OPSUB, LUA_OPUNM, luai_numadd, luai_numdiv, luai_nummod, luai_nummul, luai_numpow, luai_numsub, luai_numunm, and NULL.

Referenced by constfolding(), constfolding(), lua_arith(), and luaV_arith().

◆ 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}

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

◆ 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
#define cast_num(i)
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_str2d()

LUAI_FUNC int luaO_str2d ( const char * s,
size_t len,
lua_Number * result )

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

158 {
159 char *endptr;
160 if (strpbrk(s, "nN")) /* reject 'inf' and 'nan' */
161 return 0;
162 else if (strpbrk(s, "xX")) /* hexa? */
163 *result = lua_strx2number(s, &endptr);
164 else
165 *result = lua_str2number(s, &endptr);
166 if (endptr == s) return 0; /* nothing recognized */
167 while (lisspace(cast_uchar(*endptr))) endptr++;
168 return (endptr == s + len); /* OK if no trailing characters */
169}
#define lua_str2number(s, p)
#define lisspace(c)
#define cast_uchar(i)
#define lua_strx2number(s, p)

References cast_uchar, lisspace, lua_str2number, lua_strx2number, and s.

Variable Documentation

◆ luaO_nilobject_

LUAI_DDEC const TValue luaO_nilobject_

Definition at line 591 of file lua-5.2.4/src/lobject.h.