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

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 ttisLclosure(o)   checktag((o), ctb(LUA_VLCL))
 
#define ttislcf(o)   checktag((o), LUA_VLCF)
 
#define ttisCclosure(o)   checktag((o), ctb(LUA_VCCL))
 
#define ttisclosure(o)   (ttisLclosure(o) || ttisCclosure(o))
 
#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 208 of file lua-5.4.3/src/lobject.h.

◆ BIT_ISCOLLECTABLE

#define BIT_ISCOLLECTABLE   (1 << 6)

Definition at line 285 of file lua-5.4.3/src/lobject.h.

◆ BITRAS

#define BITRAS   (1 << 7)

Definition at line 718 of file lua-5.4.3/src/lobject.h.

◆ checkliveness

#define checkliveness ( L,
obj )
Value:
((void)L, lua_longassert(!iscollectable(obj) || \
(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 104 of file lua-5.4.3/src/lobject.h.

104#define checkliveness(L,obj) \
105 ((void)L, lua_longassert(!iscollectable(obj) || \
106 (righttt(obj) && (L == NULL || !isdead(G(L),gcvalue(obj))))))

◆ checktag

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

Definition at line 89 of file lua-5.4.3/src/lobject.h.

◆ checktype

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

Definition at line 90 of file lua-5.4.3/src/lobject.h.

◆ chgfltvalue

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

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

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

◆ chgivalue

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

Definition at line 334 of file lua-5.4.3/src/lobject.h.

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

◆ clCvalue

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

Definition at line 593 of file lua-5.4.3/src/lobject.h.

◆ clLvalue

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

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

◆ ClosureHeader

#define ClosureHeader    CommonHeader; lu_byte nupvalues; GCObject *gclist

Definition at line 631 of file lua-5.4.3/src/lobject.h.

631#define ClosureHeader \
632 CommonHeader; lu_byte nupvalues; GCObject *gclist

◆ clvalue

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

Definition at line 590 of file lua-5.4.3/src/lobject.h.

◆ CommonHeader

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

Definition at line 275 of file lua-5.4.3/src/lobject.h.

◆ ctb

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

Definition at line 290 of file lua-5.4.3/src/lobject.h.

◆ fltvalue

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

Definition at line 319 of file lua-5.4.3/src/lobject.h.

◆ fltvalueraw

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

Definition at line 322 of file lua-5.4.3/src/lobject.h.

Referenced by equalkey(), and mainposition().

◆ fvalue

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

Definition at line 592 of file lua-5.4.3/src/lobject.h.

◆ fvalueraw

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

Definition at line 595 of file lua-5.4.3/src/lobject.h.

Referenced by equalkey(), and mainposition().

◆ gckey

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

Definition at line 753 of file lua-5.4.3/src/lobject.h.

◆ gckeyN

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

Definition at line 754 of file lua-5.4.3/src/lobject.h.

Referenced by clearbykeys(), and traverseephemeron().

◆ gcvalue

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

Definition at line 292 of file lua-5.4.3/src/lobject.h.

◆ gcvalueraw

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

Definition at line 294 of file lua-5.4.3/src/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_); }
struct Node::NodeKey u

Definition at line 705 of file lua-5.4.3/src/lobject.h.

705#define getnodekey(L,obj,node) \
706 { TValue *io_=(obj); const Node *n_=(node); \
707 io_->value_ = n_->u.key_val; io_->tt_ = n_->u.key_tt; \
708 checkliveness(L,io_); }

Referenced by luaH_next(), and reinsert().

◆ getproto

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

Definition at line 654 of file lua-5.4.3/src/lobject.h.

◆ getstr

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

Definition at line 390 of file lua-5.4.3/src/lobject.h.

◆ getudatamem

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

Definition at line 482 of file lua-5.4.3/src/lobject.h.

◆ hvalue

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

Definition at line 669 of file lua-5.4.3/src/lobject.h.

◆ isabstkey

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

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

Referenced by findindex(), luaH_finishset(), and luaH_setint().

◆ iscollectable

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

Definition at line 287 of file lua-5.4.3/src/lobject.h.

◆ isempty

◆ isLfunction

#define isLfunction ( o)    ttisLclosure(o)

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

◆ isnonstrictnil

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

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

◆ isrealasize

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

Definition at line 719 of file lua-5.4.3/src/lobject.h.

Referenced by ispow2realasize().

◆ ivalue

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

Definition at line 320 of file lua-5.4.3/src/lobject.h.

◆ ivalueraw

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

Definition at line 323 of file lua-5.4.3/src/lobject.h.

Referenced by mainposition().

◆ keyiscollectable

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

Definition at line 751 of file lua-5.4.3/src/lobject.h.

Referenced by clearkey().

◆ keyisdead

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

Definition at line 764 of file lua-5.4.3/src/lobject.h.

Referenced by equalkey().

◆ keyisinteger

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

Definition at line 744 of file lua-5.4.3/src/lobject.h.

Referenced by luaH_getint(), and numusehash().

◆ keyisnil

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

Definition at line 743 of file lua-5.4.3/src/lobject.h.

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

◆ keyisshrstr

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

Definition at line 746 of file lua-5.4.3/src/lobject.h.

Referenced by luaH_getshortstr().

◆ keyival

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

Definition at line 745 of file lua-5.4.3/src/lobject.h.

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

◆ keystrval

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

Definition at line 747 of file lua-5.4.3/src/lobject.h.

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

◆ keytt

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

Definition at line 740 of file lua-5.4.3/src/lobject.h.

Referenced by equalkey(), and luaH_newkey().

◆ keyval

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

Definition at line 741 of file lua-5.4.3/src/lobject.h.

Referenced by equalkey(), and luaH_newkey().

◆ l_isfalse

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

Definition at line 234 of file lua-5.4.3/src/lobject.h.

◆ lmod

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

Definition at line 773 of file lua-5.4.3/src/lobject.h.

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

◆ LUA_TDEADKEY

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

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

◆ LUA_TOTALTYPES

#define LUA_TOTALTYPES   (LUA_TPROTO + 2)

Definition at line 31 of file lua-5.4.3/src/lobject.h.

◆ LUA_TPROTO

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

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

◆ LUA_TUPVAL

#define LUA_TUPVAL   LUA_NUMTYPES /* upvalues */

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

◆ LUA_VABSTKEY

#define LUA_VABSTKEY   makevariant(LUA_TNIL, 2)

Definition at line 176 of file lua-5.4.3/src/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 173 of file lua-5.4.3/src/lobject.h.

◆ LUA_VFALSE

◆ 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 416 of file lua-5.4.3/src/lobject.h.

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

◆ LUA_VLNGSTR

◆ LUA_VNIL

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

◆ LUA_VSHRSTR

◆ LUA_VTABLE

◆ LUA_VTHREAD

◆ LUA_VTRUE

◆ LUA_VUPVAL

#define LUA_VUPVAL   makevariant(LUA_TUPVAL, 0)

◆ LUA_VUSERDATA

◆ makevariant

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

Definition at line 42 of file lua-5.4.3/src/lobject.h.

◆ novariant

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

Definition at line 78 of file lua-5.4.3/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 317 of file lua-5.4.3/src/lobject.h.

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

◆ pvalue

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

Definition at line 423 of file lua-5.4.3/src/lobject.h.

◆ pvalueraw

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

Definition at line 426 of file lua-5.4.3/src/lobject.h.

Referenced by equalkey(), and mainposition().

◆ rawtt

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

Definition at line 75 of file lua-5.4.3/src/lobject.h.

Referenced by equalkey(), and mainpositionTV().

◆ righttt

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

Definition at line 96 of file lua-5.4.3/src/lobject.h.

◆ s2v

◆ setbfvalue

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

◆ setbtvalue

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

◆ setclCvalue

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

Definition at line 607 of file lua-5.4.3/src/lobject.h.

607#define setclCvalue(L,obj,x) \
608 { TValue *io = (obj); CClosure *x_ = (x); \
609 val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VCCL)); \
610 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_VLCL)); \
checkliveness(L,io); }
#define LUA_VLCL

Definition at line 597 of file lua-5.4.3/src/lobject.h.

597#define setclLvalue(L,obj,x) \
598 { TValue *io = (obj); LClosure *x_ = (x); \
599 val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VLCL)); \
600 checkliveness(L,io); }

◆ setclLvalue2s

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

Definition at line 602 of file lua-5.4.3/src/lobject.h.

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

◆ setdeadkey

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

Definition at line 763 of file lua-5.4.3/src/lobject.h.

Referenced by clearkey().

◆ setempty

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

◆ setfltvalue

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

Definition at line 325 of file lua-5.4.3/src/lobject.h.

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

◆ setfvalue

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

Definition at line 604 of file lua-5.4.3/src/lobject.h.

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

◆ 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 296 of file lua-5.4.3/src/lobject.h.

296#define setgcovalue(L,obj,x) \
297 { TValue *io = (obj); GCObject *i_g=(x); \
298 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_VTABLE)); \
checkliveness(L,io); }
#define LUA_VTABLE

Definition at line 671 of file lua-5.4.3/src/lobject.h.

671#define sethvalue(L,obj,x) \
672 { TValue *io = (obj); Table *x_ = (x); \
673 val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VTABLE)); \
674 checkliveness(L,io); }

◆ sethvalue2s

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

Definition at line 676 of file lua-5.4.3/src/lobject.h.

◆ setivalue

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

Definition at line 331 of file lua-5.4.3/src/lobject.h.

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

◆ setnilkey

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

Definition at line 749 of file lua-5.4.3/src/lobject.h.

Referenced by setnodevector().

◆ setnilvalue

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

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

◆ 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_); }

Definition at line 698 of file lua-5.4.3/src/lobject.h.

698#define setnodekey(L,node,obj) \
699 { Node *n_=(node); const TValue *io_=(obj); \
700 n_->u.key_val = io_->value_; n_->u.key_tt = io_->tt_; \
701 checkliveness(L,io_); }

◆ setnorealasize

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

Definition at line 721 of file lua-5.4.3/src/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)); }
#define lua_assert(c)
#define isnonstrictnil(v)

Definition at line 116 of file lua-5.4.3/src/lobject.h.

116#define setobj(L,obj1,obj2) \
117 { TValue *io1=(obj1); const TValue *io2=(obj2); \
118 io1->value_ = io2->value_; settt_(io1, io2->tt_); \
119 checkliveness(L,io1); lua_assert(!isnonstrictnil(io1)); }

◆ setobj2n

#define setobj2n   setobj

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

◆ setobj2s

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

Definition at line 129 of file lua-5.4.3/src/lobject.h.

◆ setobj2t

#define setobj2t   setobj

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

◆ setobjs2s

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

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

◆ setobjt2t

#define setobjt2t   setobj

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

◆ setpvalue

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

Definition at line 428 of file lua-5.4.3/src/lobject.h.

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

◆ setrealasize

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

Definition at line 720 of file lua-5.4.3/src/lobject.h.

Referenced by setlimittosize().

◆ 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 358 of file lua-5.4.3/src/lobject.h.

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

◆ setsvalue2n

#define setsvalue2n   setsvalue

Definition at line 367 of file lua-5.4.3/src/lobject.h.

◆ setsvalue2s

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

Definition at line 364 of file lua-5.4.3/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_VTHREAD)); \
checkliveness(L,io); }
#define LUA_VTHREAD

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

255#define setthvalue(L,obj,x) \
256 { TValue *io = (obj); lua_State *x_ = (x); \
257 val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VTHREAD)); \
258 checkliveness(L,io); }

◆ setthvalue2s

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

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

Referenced by lua_newthread().

◆ settt_

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

Definition at line 112 of file lua-5.4.3/src/lobject.h.

◆ setuvalue

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

Definition at line 431 of file lua-5.4.3/src/lobject.h.

431#define setuvalue(L,obj,x) \
432 { TValue *io = (obj); Udata *x_ = (x); \
433 val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_VUSERDATA)); \
434 checkliveness(L,io); }

◆ sizenode

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

Definition at line 778 of file lua-5.4.3/src/lobject.h.

◆ sizeudata

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

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

◆ svalue

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

Definition at line 394 of file lua-5.4.3/src/lobject.h.

◆ thvalue

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

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

◆ tsslen

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

Definition at line 397 of file lua-5.4.3/src/lobject.h.

◆ tsvalue

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

Definition at line 356 of file lua-5.4.3/src/lobject.h.

◆ tsvalueraw

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

Definition at line 354 of file lua-5.4.3/src/lobject.h.

Referenced by mainposition().

◆ ttisboolean

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

Definition at line 229 of file lua-5.4.3/src/lobject.h.

◆ ttisCclosure

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

Definition at line 584 of file lua-5.4.3/src/lobject.h.

◆ ttisclosure

#define ttisclosure ( o)    (ttisLclosure(o) || ttisCclosure(o))

Definition at line 585 of file lua-5.4.3/src/lobject.h.

◆ ttisfalse

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

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

◆ ttisfloat

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

Definition at line 314 of file lua-5.4.3/src/lobject.h.

◆ ttisfulluserdata

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

Definition at line 421 of file lua-5.4.3/src/lobject.h.

◆ ttisfunction

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

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

◆ ttisinteger

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

Definition at line 315 of file lua-5.4.3/src/lobject.h.

◆ ttislcf

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

Definition at line 583 of file lua-5.4.3/src/lobject.h.

◆ ttisLclosure

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

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

◆ ttislightuserdata

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

Definition at line 420 of file lua-5.4.3/src/lobject.h.

◆ ttislngstring

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

Definition at line 352 of file lua-5.4.3/src/lobject.h.

◆ ttisnil

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

Definition at line 180 of file lua-5.4.3/src/lobject.h.

◆ ttisnumber

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

Definition at line 313 of file lua-5.4.3/src/lobject.h.

◆ ttisshrstring

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

Definition at line 351 of file lua-5.4.3/src/lobject.h.

◆ ttisstrictnil

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

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

◆ ttisstring

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

Definition at line 350 of file lua-5.4.3/src/lobject.h.

◆ ttistable

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

Definition at line 667 of file lua-5.4.3/src/lobject.h.

◆ ttisthread

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

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

◆ ttistrue

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

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

◆ ttype

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

Definition at line 85 of file lua-5.4.3/src/lobject.h.

◆ ttypetag

◆ TValuefields

#define TValuefields   Value value_; lu_byte tt_

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

◆ twoto

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

Definition at line 777 of file lua-5.4.3/src/lobject.h.

◆ udatamemoffset

#define udatamemoffset ( nuv)
Value:
((nuv) == 0 ? offsetof(Udata0, bindata) \
: offsetof(Udata, uv) + (sizeof(UValue) * (nuv)))
union UValue UValue
#define offsetof(STRUCTURE, FIELD)
Definition sqlite3.c:14256

Definition at line 477 of file lua-5.4.3/src/lobject.h.

477#define udatamemoffset(nuv) \
478 ((nuv) == 0 ? offsetof(Udata0, bindata) \
479 : offsetof(Udata, uv) + (sizeof(UValue) * (nuv)))

Referenced by luaS_newudata().

◆ UTF8BUFFSZ

#define UTF8BUFFSZ   8

Definition at line 782 of file lua-5.4.3/src/lobject.h.

◆ uvalue

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

Definition at line 424 of file lua-5.4.3/src/lobject.h.

◆ val_

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

Definition at line 70 of file lua-5.4.3/src/lobject.h.

◆ valraw

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

Definition at line 71 of file lua-5.4.3/src/lobject.h.

Referenced by mainpositionTV().

◆ vslen

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

Definition at line 400 of file lua-5.4.3/src/lobject.h.

◆ withvariant

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

Definition at line 81 of file lua-5.4.3/src/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 156 of file lua-5.4.3/src/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 lua-5.4.3/src/lobject.c.

127 {
128 if (!luaO_rawarith(L, op, p1, p2, s2v(res))) {
129 /* could not perform raw operation; try metamethod */
130 luaT_trybinTM(L, p1, p2, res, cast(TMS, (op - LUA_OPADD) + TM_ADD));
131 }
132}
#define cast(t, exp)
@ TM_ADD
#define LUA_OPADD
void luaT_trybinTM(lua_State *L, const TValue *p1, const TValue *p2, StkId res, TMS event)
int luaO_rawarith(lua_State *L, int op, const TValue *p1, const TValue *p2, TValue *res)
#define s2v(o)

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

◆ 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

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

◆ luaO_chunkid()

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

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)

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

Referenced by addinfo(), addinfo(), funcinfo(), funcinfo(), funcinfo(), funcinfo(), info_tailcall(), lexerror(), luaG_addinfo(), and luaX_lexerror().

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

References lisdigit, and ltolower.

Referenced by gethexa(), gethexa(), l_str2int(), l_str2int(), readhexa(), readhexaesc(), readutf8esc(), and readutf8esc().

◆ luaO_pushfstring()

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

References addnum2buff(), addsize, addstr2buff(), lua_State::base, BuffFS::blen, cast, cast_int, cast_num, cast_uchar, clearbuff(), getbuff(), incr_top, BuffFS::L, lisprint, lua_assert, lua_pointer2str, LUA_QL, luaD_checkstack, luaD_inctop(), luaG_runerror(), luaO_pushfstring(), luaO_tostring(), luaO_utf8esc(), luaS_newlstr(), luaV_concat(), NULL, BuffFS::pushed, pushstr(), pushstr(), pushstr(), s, s2v, setfltvalue, setivalue, setnvalue, setsvalue2s, svalue, lua_State::top, and UTF8BUFFSZ.

Referenced by lua_pushfstring(), lua_pushvfstring(), luaG_runerror(), and luaO_pushfstring().

◆ luaO_rawarith()

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

Definition at line 89 of file lua-5.4.3/src/lobject.c.

90 {
91 switch (op) {
92 case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR:
93 case LUA_OPSHL: case LUA_OPSHR:
94 case LUA_OPBNOT: { /* operate only on integers */
96 if (tointegerns(p1, &i1) && tointegerns(p2, &i2)) {
97 setivalue(res, intarith(L, op, i1, i2));
98 return 1;
99 }
100 else return 0; /* fail */
101 }
102 case LUA_OPDIV: case LUA_OPPOW: { /* operate only on floats */
103 lua_Number n1; lua_Number n2;
104 if (tonumberns(p1, n1) && tonumberns(p2, n2)) {
105 setfltvalue(res, numarith(L, op, n1, n2));
106 return 1;
107 }
108 else return 0; /* fail */
109 }
110 default: { /* other operations */
111 lua_Number n1; lua_Number n2;
112 if (ttisinteger(p1) && ttisinteger(p2)) {
113 setivalue(res, intarith(L, op, ivalue(p1), ivalue(p2)));
114 return 1;
115 }
116 else if (tonumberns(p1, n1) && tonumberns(p2, n2)) {
117 setfltvalue(res, numarith(L, op, n1, n2));
118 return 1;
119 }
120 else return 0; /* fail */
121 }
122 }
123}
LUA_INTEGER lua_Integer
LUA_NUMBER lua_Number
#define LUA_OPPOW
#define LUA_OPDIV
#define ttisinteger(o)
#define setfltvalue(obj, x)
#define ivalue(o)
#define setivalue(obj, x)
#define LUA_OPBXOR
#define LUA_OPSHL
#define LUA_OPBOR
#define LUA_OPSHR
#define LUA_OPBNOT
#define LUA_OPBAND
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 tointegerns(o, i)
#define tonumberns(o, n)

References intarith(), ivalue, LUA_OPBAND, LUA_OPBNOT, LUA_OPBOR, LUA_OPBXOR, LUA_OPDIV, LUA_OPPOW, LUA_OPSHL, LUA_OPSHR, numarith(), setfltvalue, setivalue, tointegerns, tonumberns, and ttisinteger.

Referenced by constfolding(), and luaO_arith().

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

References l_str2d(), l_str2d(), l_str2int(), l_str2int(), NULL, s, setfltvalue, and setivalue.

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

◆ luaO_tostring()

LUAI_FUNC void luaO_tostring ( lua_State * L,
TValue * obj )

Definition at line 374 of file lua-5.4.3/src/lobject.c.

374 {
375 char buff[MAXNUMBER2STR];
376 int len = tostringbuff(obj, buff);
377 setsvalue(L, obj, luaS_newlstr(L, buff, len));
378}
#define setsvalue(L, obj, x)
#define MAXNUMBER2STR
static int tostringbuff(TValue *obj, char *buff)

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

◆ 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

References cast, cast_char, lua_assert, and UTF8BUFFSZ.

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