Nut/OS  5.0.5
API Reference
lobject.h File Reference
#include <stdarg.h>
#include <lua/llimits.h>
#include <lua/lua.h>
Include dependency graph for lobject.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GCheader
union  Value
struct  lua_TValue
union  TString
union  Udata
struct  Proto
struct  LocVar
struct  UpVal
struct  CClosure
struct  LClosure
union  Closure
union  TKey
struct  Node
struct  Table

Defines

#define LAST_TAG   LUA_TTHREAD
#define NUM_TAGS   (LAST_TAG+1)
#define LUA_TPROTO   (LAST_TAG+1)
#define LUA_TUPVAL   (LAST_TAG+2)
#define LUA_TDEADKEY   (LAST_TAG+3)
#define CommonHeader   GCObject *next; lu_byte tt; lu_byte marked
#define TValuefields   Value value; int tt
#define ttisnil(o)   (ttype(o) == LUA_TNIL)
#define ttisnumber(o)   (ttype(o) == LUA_TNUMBER)
#define ttisstring(o)   (ttype(o) == LUA_TSTRING)
#define ttistable(o)   (ttype(o) == LUA_TTABLE)
#define ttisfunction(o)   (ttype(o) == LUA_TFUNCTION)
#define ttisboolean(o)   (ttype(o) == LUA_TBOOLEAN)
#define ttisuserdata(o)   (ttype(o) == LUA_TUSERDATA)
#define ttisthread(o)   (ttype(o) == LUA_TTHREAD)
#define ttislightuserdata(o)   (ttype(o) == LUA_TLIGHTUSERDATA)
#define ttisrotable(o)   (ttype(o) == LUA_TROTABLE)
#define ttislightfunction(o)   (ttype(o) == LUA_TLIGHTFUNCTION)
#define ttype(o)   ((o)->tt)
#define gcvalue(o)   check_exp(iscollectable(o), (o)->value.gc)
#define pvalue(o)   check_exp(ttislightuserdata(o), (o)->value.p)
#define rvalue(o)   check_exp(ttisrotable(o), (o)->value.p)
#define fvalue(o)   check_exp(ttislightfunction(o), (o)->value.p)
#define nvalue(o)   check_exp(ttisnumber(o), (o)->value.n)
#define rawtsvalue(o)   check_exp(ttisstring(o), &(o)->value.gc->ts)
#define tsvalue(o)   (&rawtsvalue(o)->tsv)
#define rawuvalue(o)   check_exp(ttisuserdata(o), &(o)->value.gc->u)
#define uvalue(o)   (&rawuvalue(o)->uv)
#define clvalue(o)   check_exp(ttisfunction(o), &(o)->value.gc->cl)
#define hvalue(o)   check_exp(ttistable(o), &(o)->value.gc->h)
#define bvalue(o)   check_exp(ttisboolean(o), (o)->value.b)
#define thvalue(o)   check_exp(ttisthread(o), &(o)->value.gc->th)
#define l_isfalse(o)   (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0))
#define checkconsistency(obj)   lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt))
#define checkliveness(g, obj)
#define setnilvalue(obj)   ((obj)->tt=LUA_TNIL)
#define setnvalue(obj, x)   { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; }
#define setpvalue(obj, x)   { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; }
#define setrvalue(obj, x)   { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TROTABLE; }
#define setfvalue(obj, x)   { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTFUNCTION; }
#define setbvalue(obj, x)   { TValue *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; }
#define setsvalue(L, obj, x)
#define setuvalue(L, obj, x)
#define setthvalue(L, obj, x)
#define setclvalue(L, obj, x)
#define sethvalue(L, obj, x)
#define setptvalue(L, obj, x)
#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 setttype(obj, tt)   (ttype(obj) = (tt))
#define iscollectable(o)   (ttype(o) >= LUA_TSTRING)
#define getstr(ts)   cast(const char *, (ts) + 1)
#define svalue(o)   getstr(rawtsvalue(o))
#define VARARG_HASARG   1
#define VARARG_ISVARARG   2
#define VARARG_NEEDSARG   4
#define ClosureHeader
#define iscfunction(o)   ((ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC)||(ttype(o)==LUA_TLIGHTFUNCTION))
#define isLfunction(o)   (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC)
#define lmod(s, size)   (check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1)))))
#define twoto(x)   (1<<(x))
#define sizenode(t)   (twoto((t)->lsizenode))
#define luaO_nilobject   (&luaO_nilobject_)
#define ceillog2(x)   (luaO_log2((x)-1) + 1)

Typedefs

typedef union GCObject GCObject
typedef struct GCheader GCheader
typedef struct lua_TValue TValue
typedef TValueStkId
typedef union TString TString
typedef union Udata Udata
typedef struct Proto Proto
typedef struct LocVar LocVar
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_log2 (unsigned int x)
LUAI_FUNC int luaO_int2fb (unsigned int x)
LUAI_FUNC int luaO_fb2int (int x)
LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2)
LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result)
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_DATA const TValue luaO_nilobject_

Define Documentation

#define LAST_TAG   LUA_TTHREAD
#define NUM_TAGS   (LAST_TAG+1)
#define LUA_TPROTO   (LAST_TAG+1)
#define LUA_TUPVAL   (LAST_TAG+2)
#define LUA_TDEADKEY   (LAST_TAG+3)
#define CommonHeader   GCObject *next; lu_byte tt; lu_byte marked
#define TValuefields   Value value; int tt
#define ttisnil (   o)    (ttype(o) == LUA_TNIL)
#define ttisnumber (   o)    (ttype(o) == LUA_TNUMBER)
#define ttisstring (   o)    (ttype(o) == LUA_TSTRING)
#define ttistable (   o)    (ttype(o) == LUA_TTABLE)
#define ttisfunction (   o)    (ttype(o) == LUA_TFUNCTION)
#define ttisboolean (   o)    (ttype(o) == LUA_TBOOLEAN)
#define ttisuserdata (   o)    (ttype(o) == LUA_TUSERDATA)
#define ttisthread (   o)    (ttype(o) == LUA_TTHREAD)
#define ttislightuserdata (   o)    (ttype(o) == LUA_TLIGHTUSERDATA)
#define ttisrotable (   o)    (ttype(o) == LUA_TROTABLE)
#define ttislightfunction (   o)    (ttype(o) == LUA_TLIGHTFUNCTION)
#define ttype (   o)    ((o)->tt)
#define gcvalue (   o)    check_exp(iscollectable(o), (o)->value.gc)
#define pvalue (   o)    check_exp(ttislightuserdata(o), (o)->value.p)
#define rvalue (   o)    check_exp(ttisrotable(o), (o)->value.p)
#define fvalue (   o)    check_exp(ttislightfunction(o), (o)->value.p)
#define nvalue (   o)    check_exp(ttisnumber(o), (o)->value.n)
#define rawtsvalue (   o)    check_exp(ttisstring(o), &(o)->value.gc->ts)
#define tsvalue (   o)    (&rawtsvalue(o)->tsv)
#define rawuvalue (   o)    check_exp(ttisuserdata(o), &(o)->value.gc->u)
#define uvalue (   o)    (&rawuvalue(o)->uv)
#define clvalue (   o)    check_exp(ttisfunction(o), &(o)->value.gc->cl)
#define hvalue (   o)    check_exp(ttistable(o), &(o)->value.gc->h)
#define bvalue (   o)    check_exp(ttisboolean(o), (o)->value.b)
#define thvalue (   o)    check_exp(ttisthread(o), &(o)->value.gc->th)
#define l_isfalse (   o)    (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0))
#define checkconsistency (   obj)    lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt))
#define checkliveness (   g,
  obj 
)
Value:
lua_assert(!iscollectable(obj) || \
  ((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc)))
#define setnilvalue (   obj)    ((obj)->tt=LUA_TNIL)
#define setnvalue (   obj,
 
)    { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; }
#define setpvalue (   obj,
 
)    { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; }
#define setrvalue (   obj,
 
)    { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TROTABLE; }
#define setfvalue (   obj,
 
)    { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTFUNCTION; }
#define setbvalue (   obj,
 
)    { TValue *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; }
#define setsvalue (   L,
  obj,
 
)
Value:
{ TValue *i_o=(obj); \
    i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \
    checkliveness(G(L),i_o); }
#define setuvalue (   L,
  obj,
 
)
Value:
{ TValue *i_o=(obj); \
    i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \
    checkliveness(G(L),i_o); }
#define setthvalue (   L,
  obj,
 
)
Value:
{ TValue *i_o=(obj); \
    i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \
    checkliveness(G(L),i_o); }
#define setclvalue (   L,
  obj,
 
)
Value:
{ TValue *i_o=(obj); \
    i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \
    checkliveness(G(L),i_o); }
#define sethvalue (   L,
  obj,
 
)
Value:
{ TValue *i_o=(obj); \
    i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \
    checkliveness(G(L),i_o); }
#define setptvalue (   L,
  obj,
 
)
Value:
{ TValue *i_o=(obj); \
    i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \
    checkliveness(G(L),i_o); }
#define setobj (   L,
  obj1,
  obj2 
)
Value:
{ const TValue *o2=(obj2); TValue *o1=(obj1); \
    o1->value = o2->value; o1->tt=o2->tt; \
    checkliveness(G(L),o1); }
#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 setttype (   obj,
  tt 
)    (ttype(obj) = (tt))
#define iscollectable (   o)    (ttype(o) >= LUA_TSTRING)
#define getstr (   ts)    cast(const char *, (ts) + 1)
#define svalue (   o)    getstr(rawtsvalue(o))
#define VARARG_HASARG   1
#define VARARG_ISVARARG   2
#define VARARG_NEEDSARG   4
#define ClosureHeader
Value:
CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist; \
    struct Table *env
#define iscfunction (   o)    ((ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC)||(ttype(o)==LUA_TLIGHTFUNCTION))
#define isLfunction (   o)    (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC)
#define lmod (   s,
  size 
)    (check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1)))))
#define twoto (   x)    (1<<(x))
#define sizenode (   t)    (twoto((t)->lsizenode))
#define luaO_nilobject   (&luaO_nilobject_)
#define ceillog2 (   x)    (luaO_log2((x)-1) + 1)

Typedef Documentation

typedef union GCObject GCObject
typedef struct GCheader GCheader
typedef struct lua_TValue TValue
typedef TValue* StkId
typedef union TString TString
typedef union Udata Udata
typedef struct Proto Proto
typedef struct LocVar LocVar
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

Function Documentation

LUAI_FUNC int luaO_log2 ( unsigned int  x)
LUAI_FUNC int luaO_int2fb ( unsigned int  x)
LUAI_FUNC int luaO_fb2int ( int  x)
LUAI_FUNC int luaO_rawequalObj ( const TValue t1,
const TValue t2 
)
LUAI_FUNC int luaO_str2d ( const char *  s,
lua_Number result 
)
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 
)

Variable Documentation

LUAI_DATA const TValue luaO_nilobject_