w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

minilua.c File Reference
#include <stddef.h>
#include <stdarg.h>
#include <limits.h>
#include <math.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h>
#include <errno.h>
#include <time.h>
Include dependency graph for minilua.c:

Go to the source code of this file.

Classes

struct  lua_Debug
 
union  L_Umaxalign
 
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
 
struct  Mbuffer
 
struct  Zio
 
struct  stringtable
 
struct  CallInfo
 
struct  global_State
 
struct  lua_State
 
union  GCObject
 
struct  expdesc
 
struct  upvaldesc
 
struct  FuncState
 
struct  lua_longjmp
 
struct  SParser
 
union  SemInfo
 
struct  Token
 
struct  LexState
 
struct  LG
 
struct  BlockCnt
 
struct  ConsControl
 
struct  LHS_assign
 
struct  CallS
 
struct  luaL_Reg
 
struct  luaL_Buffer
 
struct  LoadF
 
struct  LoadS
 
struct  MatchState
 

Macros

#define LUA_QL(x)   "'"x"'"
 
#define luai_apicheck(L, o)   {(void)L;}
 
#define lua_number2str(s, n)   sprintf((s),"%.14g",(n))
 
#define lua_str2number(s, p)   strtod((s),(p))
 
#define luai_numadd(a, b)   ((a)+(b))
 
#define luai_numsub(a, b)   ((a)-(b))
 
#define luai_nummul(a, b)   ((a)*(b))
 
#define luai_numdiv(a, b)   ((a)/(b))
 
#define luai_nummod(a, b)   ((a)-floor((a)/(b))*(b))
 
#define luai_numpow(a, b)   (pow(a,b))
 
#define luai_numunm(a)   (-(a))
 
#define luai_numeq(a, b)   ((a)==(b))
 
#define luai_numlt(a, b)   ((a)<(b))
 
#define luai_numle(a, b)   ((a)<=(b))
 
#define luai_numisnan(a)   (!luai_numeq((a),(a)))
 
#define lua_number2int(i, d)   ((i)=(int)(d))
 
#define lua_number2integer(i, d)   ((i)=(lua_Integer)(d))
 
#define LUAI_THROW(L, c)   longjmp((c)->b,1)
 
#define LUAI_TRY(L, c, a)   if(setjmp((c)->b)==0){a}
 
#define lua_pclose(L, file)   ((void)((void)L,file),0)
 
#define lua_upvalueindex(i)   ((-10002)-(i))
 
#define lua_pop(L, n)   lua_settop(L,-(n)-1)
 
#define lua_newtable(L)   lua_createtable(L,0,0)
 
#define lua_pushcfunction(L, f)   lua_pushcclosure(L,(f),0)
 
#define lua_strlen(L, i)   lua_objlen(L,(i))
 
#define lua_isfunction(L, n)   (lua_type(L,(n))==6)
 
#define lua_istable(L, n)   (lua_type(L,(n))==5)
 
#define lua_isnil(L, n)   (lua_type(L,(n))==0)
 
#define lua_isboolean(L, n)   (lua_type(L,(n))==1)
 
#define lua_isnone(L, n)   (lua_type(L,(n))==(-1))
 
#define lua_isnoneornil(L, n)   (lua_type(L,(n))<=0)
 
#define lua_pushliteral(L, s)   lua_pushlstring(L,""s,(sizeof(s)/sizeof(char))-1)
 
#define lua_setglobal(L, s)   lua_setfield(L,(-10002),(s))
 
#define lua_tostring(L, i)   lua_tolstring(L,(i),NULL)
 
#define IntPoint(p)   ((unsigned int)(lu_mem)(p))
 
#define check_exp(c, e)   (e)
 
#define UNUSED(x)   ((void)(x))
 
#define cast(t, exp)   ((t)(exp))
 
#define cast_byte(i)   cast(lu_byte,(i))
 
#define cast_num(i)   cast(lua_Number,(i))
 
#define cast_int(i)   cast(int,(i))
 
#define condhardstacktests(x)   ((void)0)
 
#define ttisnil(o)   (ttype(o)==0)
 
#define ttisnumber(o)   (ttype(o)==3)
 
#define ttisstring(o)   (ttype(o)==4)
 
#define ttistable(o)   (ttype(o)==5)
 
#define ttisfunction(o)   (ttype(o)==6)
 
#define ttisboolean(o)   (ttype(o)==1)
 
#define ttisuserdata(o)   (ttype(o)==7)
 
#define ttisthread(o)   (ttype(o)==8)
 
#define ttislightuserdata(o)   (ttype(o)==2)
 
#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 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)
 
#define checkliveness(g, obj)
 
#define setnilvalue(obj)   ((obj)->tt=0)
 
#define setnvalue(obj, x)   {TValue*i_o=(obj);i_o->value.n=(x);i_o->tt=3;}
 
#define setbvalue(obj, x)   {TValue*i_o=(obj);i_o->value.b=(x);i_o->tt=1;}
 
#define setsvalue(L, obj, x)   {TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=4;checkliveness(G(L),i_o);}
 
#define setuvalue(L, obj, x)   {TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=7;checkliveness(G(L),i_o);}
 
#define setthvalue(L, obj, x)   {TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=8;checkliveness(G(L),i_o);}
 
#define setclvalue(L, obj, x)   {TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=6;checkliveness(G(L),i_o);}
 
#define sethvalue(L, obj, x)   {TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=5;checkliveness(G(L),i_o);}
 
#define setptvalue(L, obj, x)   {TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=(8+1);checkliveness(G(L),i_o);}
 
#define setobj(L, obj1, obj2)   {const TValue*o2=(obj2);TValue*o1=(obj1);o1->value=o2->value;o1->tt=o2->tt;checkliveness(G(L),o1);}
 
#define setttype(obj, tt)   (ttype(obj)=(tt))
 
#define iscollectable(o)   (ttype(o)>=4)
 
#define getstr(ts)   cast(const char*,(ts)+1)
 
#define svalue(o)   getstr(rawtsvalue(o))
 
#define iscfunction(o)   (ttype(o)==6&&clvalue(o)->c.isC)
 
#define lmod(s, size)   (check_exp((size&(size-1))==0,(cast(int,(s)&((size)-1)))))
 
#define twoto(x)   ((size_t)1<<(x))
 
#define sizenode(t)   (twoto((t)->lsizenode))
 
#define ceillog2(x)   (luaO_log2((x)-1)+1)
 
#define gfasttm(g, et, e)   ((et)==NULL?NULL:((et)->flags&(1u<<(e)))?NULL:luaT_gettm(et,e,(g)->tmname[e]))
 
#define fasttm(l, et, e)   gfasttm(G(l),et,e)
 
#define luaM_reallocv(L, b, on, n, e)   ((cast(size_t,(n)+1)<=((size_t)(~(size_t)0)-2)/(e))?luaM_realloc_(L,(b),(on)*(e),(n)*(e)):luaM_toobig(L))
 
#define luaM_freemem(L, b, s)   luaM_realloc_(L,(b),(s),0)
 
#define luaM_free(L, b)   luaM_realloc_(L,(b),sizeof(*(b)),0)
 
#define luaM_freearray(L, b, n, t)   luaM_reallocv(L,(b),n,0,sizeof(t))
 
#define luaM_malloc(L, t)   luaM_realloc_(L,NULL,0,(t))
 
#define luaM_new(L, t)   cast(t*,luaM_malloc(L,sizeof(t)))
 
#define luaM_newvector(L, n, t)   cast(t*,luaM_reallocv(L,NULL,0,n,sizeof(t)))
 
#define luaM_growvector(L, v, nelems, size, t, limit, e)   if((nelems)+1>(size))((v)=cast(t*,luaM_growaux_(L,v,&(size),sizeof(t),limit,e)))
 
#define luaM_reallocvector(L, v, oldn, n, t)   ((v)=cast(t*,luaM_reallocv(L,v,oldn,n,sizeof(t))))
 
#define char2int(c)   cast(int,cast(unsigned char,(c)))
 
#define zgetc(z)   (((z)->n--)>0?char2int(*(z)->p++):luaZ_fill(z))
 
#define luaZ_initbuffer(L, buff)   ((buff)->buffer=NULL,(buff)->buffsize=0)
 
#define luaZ_buffer(buff)   ((buff)->buffer)
 
#define luaZ_sizebuffer(buff)   ((buff)->buffsize)
 
#define luaZ_bufflen(buff)   ((buff)->n)
 
#define luaZ_resetbuffer(buff)   ((buff)->n=0)
 
#define luaZ_resizebuffer(L, buff, size)   (luaM_reallocvector(L,(buff)->buffer,(buff)->buffsize,size,char),(buff)->buffsize=size)
 
#define luaZ_freebuffer(L, buff)   luaZ_resizebuffer(L,buff,0)
 
#define gt(L)   (&L->l_gt)
 
#define registry(L)   (&G(L)->l_registry)
 
#define curr_func(L)   (clvalue(L->ci->func))
 
#define ci_func(ci)   (clvalue((ci)->func))
 
#define f_isLua(ci)   (!ci_func(ci)->c.isC)
 
#define isLua(ci)   (ttisfunction((ci)->func)&&f_isLua(ci))
 
#define G(L)   (L->l_G)
 
#define rawgco2ts(o)   check_exp((o)->gch.tt==4,&((o)->ts))
 
#define gco2ts(o)   (&rawgco2ts(o)->tsv)
 
#define rawgco2u(o)   check_exp((o)->gch.tt==7,&((o)->u))
 
#define gco2u(o)   (&rawgco2u(o)->uv)
 
#define gco2cl(o)   check_exp((o)->gch.tt==6,&((o)->cl))
 
#define gco2h(o)   check_exp((o)->gch.tt==5,&((o)->h))
 
#define gco2p(o)   check_exp((o)->gch.tt==(8+1),&((o)->p))
 
#define gco2uv(o)   check_exp((o)->gch.tt==(8+2),&((o)->uv))
 
#define ngcotouv(o)   check_exp((o)==NULL||(o)->gch.tt==(8+2),&((o)->uv))
 
#define gco2th(o)   check_exp((o)->gch.tt==8,&((o)->th))
 
#define obj2gco(v)   (cast(GCObject*,(v)))
 
#define pcRel(pc, p)   (cast(int,(pc)-(p)->code)-1)
 
#define getline_(f, pc)   (((f)->lineinfo)?(f)->lineinfo[pc]:0)
 
#define resethookcount(L)   (L->hookcount=L->basehookcount)
 
#define luaD_checkstack(L, n)   if((char*)L->stack_last-(char*)L->top<=(n)*(int)sizeof(TValue))luaD_growstack(L,n);else condhardstacktests(luaD_reallocstack(L,L->stacksize-5-1));
 
#define incr_top(L)   {luaD_checkstack(L,1);L->top++;}
 
#define savestack(L, p)   ((char*)(p)-(char*)L->stack)
 
#define restorestack(L, n)   ((TValue*)((char*)L->stack+(n)))
 
#define saveci(L, p)   ((char*)(p)-(char*)L->base_ci)
 
#define restoreci(L, n)   ((CallInfo*)((char*)L->base_ci+(n)))
 
#define resetbits(x, m)   ((x)&=cast(lu_byte,~(m)))
 
#define setbits(x, m)   ((x)|=(m))
 
#define testbits(x, m)   ((x)&(m))
 
#define bitmask(b)   (1<<(b))
 
#define bit2mask(b1, b2)   (bitmask(b1)|bitmask(b2))
 
#define l_setbit(x, b)   setbits(x,bitmask(b))
 
#define resetbit(x, b)   resetbits(x,bitmask(b))
 
#define testbit(x, b)   testbits(x,bitmask(b))
 
#define set2bits(x, b1, b2)   setbits(x,(bit2mask(b1,b2)))
 
#define reset2bits(x, b1, b2)   resetbits(x,(bit2mask(b1,b2)))
 
#define test2bits(x, b1, b2)   testbits(x,(bit2mask(b1,b2)))
 
#define iswhite(x)   test2bits((x)->gch.marked,0,1)
 
#define isblack(x)   testbit((x)->gch.marked,2)
 
#define isgray(x)   (!isblack(x)&&!iswhite(x))
 
#define otherwhite(g)   (g->currentwhite^bit2mask(0,1))
 
#define isdead(g, v)   ((v)->gch.marked&otherwhite(g)&bit2mask(0,1))
 
#define changewhite(x)   ((x)->gch.marked^=bit2mask(0,1))
 
#define gray2black(x)   l_setbit((x)->gch.marked,2)
 
#define valiswhite(x)   (iscollectable(x)&&iswhite(gcvalue(x)))
 
#define luaC_white(g)   cast(lu_byte,(g)->currentwhite&bit2mask(0,1))
 
#define luaC_checkGC(L)   {condhardstacktests(luaD_reallocstack(L,L->stacksize-5-1));if(G(L)->totalbytes>=G(L)->GCthreshold)luaC_step(L);}
 
#define luaC_barrier(L, p, v)   {if(valiswhite(v)&&isblack(obj2gco(p)))luaC_barrierf(L,obj2gco(p),gcvalue(v));}
 
#define luaC_barriert(L, t, v)   {if(valiswhite(v)&&isblack(obj2gco(t)))luaC_barrierback(L,t);}
 
#define luaC_objbarrier(L, p, o)   {if(iswhite(obj2gco(o))&&isblack(obj2gco(p)))luaC_barrierf(L,obj2gco(p),obj2gco(o));}
 
#define luaC_objbarriert(L, t, o)   {if(iswhite(obj2gco(o))&&isblack(obj2gco(t)))luaC_barrierback(L,t);}
 
#define sizestring(s)   (sizeof(union TString)+((s)->len+1)*sizeof(char))
 
#define sizeudata(u)   (sizeof(union Udata)+(u)->len)
 
#define luaS_new(L, s)   (luaS_newlstr(L,s,strlen(s)))
 
#define luaS_newliteral(L, s)   (luaS_newlstr(L,""s,(sizeof(s)/sizeof(char))-1))
 
#define luaS_fix(s)   l_setbit((s)->tsv.marked,5)
 
#define tostring(L, o)   ((ttype(o)==4)||(luaV_tostring(L,o)))
 
#define tonumber(o, n)   (ttype(o)==3||(((o)=luaV_tonumber(o,n))!=NULL))
 
#define equalobj(L, o1, o2)   (ttype(o1)==ttype(o2)&&luaV_equalval(L,o1,o2))
 
#define gnode(t, i)   (&(t)->node[i])
 
#define gkey(n)   (&(n)->i_key.nk)
 
#define gval(n)   (&(n)->i_val)
 
#define gnext(n)   ((n)->i_key.nk.next)
 
#define key2tval(n)   (&(n)->i_key.tvk)
 
#define sizeCclosure(n)   (cast(int,sizeof(CClosure))+cast(int,sizeof(TValue)*((n)-1)))
 
#define sizeLclosure(n)   (cast(int,sizeof(LClosure))+cast(int,sizeof(TValue*)*((n)-1)))
 
#define MASK1(n, p)   ((~((~(Instruction)0)<<n))<<p)
 
#define MASK0(n, p)   (~MASK1(n,p))
 
#define GET_OPCODE(i)   (cast(OpCode,((i)>>0)&MASK1(6,0)))
 
#define SET_OPCODE(i, o)   ((i)=(((i)&MASK0(6,0))|((cast(Instruction,o)<<0)&MASK1(6,0))))
 
#define GETARG_A(i)   (cast(int,((i)>>(0+6))&MASK1(8,0)))
 
#define SETARG_A(i, u)   ((i)=(((i)&MASK0(8,(0+6)))|((cast(Instruction,u)<<(0+6))&MASK1(8,(0+6)))))
 
#define GETARG_B(i)   (cast(int,((i)>>(((0+6)+8)+9))&MASK1(9,0)))
 
#define SETARG_B(i, b)   ((i)=(((i)&MASK0(9,(((0+6)+8)+9)))|((cast(Instruction,b)<<(((0+6)+8)+9))&MASK1(9,(((0+6)+8)+9)))))
 
#define GETARG_C(i)   (cast(int,((i)>>((0+6)+8))&MASK1(9,0)))
 
#define SETARG_C(i, b)   ((i)=(((i)&MASK0(9,((0+6)+8)))|((cast(Instruction,b)<<((0+6)+8))&MASK1(9,((0+6)+8)))))
 
#define GETARG_Bx(i)   (cast(int,((i)>>((0+6)+8))&MASK1((9+9),0)))
 
#define SETARG_Bx(i, b)   ((i)=(((i)&MASK0((9+9),((0+6)+8)))|((cast(Instruction,b)<<((0+6)+8))&MASK1((9+9),((0+6)+8)))))
 
#define GETARG_sBx(i)   (GETARG_Bx(i)-(((1<<(9+9))-1)>>1))
 
#define SETARG_sBx(i, b)   SETARG_Bx((i),cast(unsigned int,(b)+(((1<<(9+9))-1)>>1)))
 
#define CREATE_ABC(o, a, b, c)   ((cast(Instruction,o)<<0)|(cast(Instruction,a)<<(0+6))|(cast(Instruction,b)<<(((0+6)+8)+9))|(cast(Instruction,c)<<((0+6)+8)))
 
#define CREATE_ABx(o, a, bc)   ((cast(Instruction,o)<<0)|(cast(Instruction,a)<<(0+6))|(cast(Instruction,bc)<<((0+6)+8)))
 
#define ISK(x)   ((x)&(1<<(9-1)))
 
#define INDEXK(r)   ((int)(r)&~(1<<(9-1)))
 
#define RKASK(x)   ((x)|(1<<(9-1)))
 
#define getBMode(m)   (cast(enum OpArgMask,(luaP_opmodes[m]>>4)&3))
 
#define getCMode(m)   (cast(enum OpArgMask,(luaP_opmodes[m]>>2)&3))
 
#define testTMode(m)   (luaP_opmodes[m]&(1<<7))
 
#define inc_ci(L)   ((L->ci==L->end_ci)?growCI(L):(condhardstacktests(luaD_reallocCI(L,L->size_ci)),++L->ci))
 
#define hashpow2(t, n)   (gnode(t,lmod((n),sizenode(t))))
 
#define hashstr(t, str)   hashpow2(t,(str)->tsv.hash)
 
#define hashboolean(t, p)   hashpow2(t,p)
 
#define hashmod(t, n)   (gnode(t,((n)%((sizenode(t)-1)|1))))
 
#define hashpointer(t, p)   hashmod(t,IntPoint(p))
 
#define makewhite(g, x)   ((x)->gch.marked=cast_byte(((x)->gch.marked&cast_byte(~(bitmask(2)|bit2mask(0,1))))|luaC_white(g)))
 
#define white2gray(x)   reset2bits((x)->gch.marked,0,1)
 
#define black2gray(x)   resetbit((x)->gch.marked,2)
 
#define stringmark(s)   reset2bits((s)->tsv.marked,0,1)
 
#define isfinalized(u)   testbit((u)->marked,3)
 
#define markfinalized(u)   l_setbit((u)->marked,3)
 
#define markvalue(g, o)   {checkconsistency(o);if(iscollectable(o)&&iswhite(gcvalue(o)))reallymarkobject(g,gcvalue(o));}
 
#define markobject(g, t)   {if(iswhite(obj2gco(t)))reallymarkobject(g,obj2gco(t));}
 
#define setthreshold(g)   (g->GCthreshold=(g->estimate/100)*g->gcpause)
 
#define sweepwholelist(L, p)   sweeplist(L,p,((lu_mem)(~(lu_mem)0)-2))
 
#define state_size(x)   (sizeof(x)+0)
 
#define fromstate(l)   (cast(lu_byte*,(l))-0)
 
#define tostate(l)   (cast(lua_State*,cast(lu_byte*,l)+0))
 
#define getcode(fs, e)   ((fs)->f->code[(e)->u.s.info])
 
#define luaK_codeAsBx(fs, o, A, sBx)   luaK_codeABx(fs,o,A,(sBx)+(((1<<(9+9))-1)>>1))
 
#define luaK_setmultret(fs, e)   luaK_setreturns(fs,e,(-1))
 
#define opmode(t, a, b, c, m)   (((t)<<7)|((a)<<6)|((b)<<4)|((c)<<2)|(m))
 
#define next(ls)   (ls->current=zgetc(ls->z))
 
#define currIsNewline(ls)   (ls->current=='\n'||ls->current=='\r')
 
#define save_and_next(ls)   (save(ls,ls->current),next(ls))
 
#define hasjumps(e)   ((e)->t!=(e)->f)
 
#define hasmultret(k)   ((k)==VCALL||(k)==VVARARG)
 
#define getlocvar(fs, i)   ((fs)->f->locvars[(fs)->actvar[i]])
 
#define luaY_checklimit(fs, v, l, m)   if((v)>(l))errorlimit(fs,l,m)
 
#define check_condition(ls, c, msg)   {if(!(c))luaX_syntaxerror(ls,msg);}
 
#define new_localvarliteral(ls, v, n)   new_localvar(ls,luaX_newstring(ls,""v,(sizeof(v)/sizeof(char))-1),n)
 
#define leavelevel(ls)   ((ls)->L->nCcalls--)
 
#define runtime_check(L, c)   {if(!(c))break;}
 
#define RA(i)   (base+GETARG_A(i))
 
#define RB(i)   check_exp(getBMode(GET_OPCODE(i))==OpArgR,base+GETARG_B(i))
 
#define RKB(i)   check_exp(getBMode(GET_OPCODE(i))==OpArgK,ISK(GETARG_B(i))?k+INDEXK(GETARG_B(i)):base+GETARG_B(i))
 
#define RKC(i)   check_exp(getCMode(GET_OPCODE(i))==OpArgK,ISK(GETARG_C(i))?k+INDEXK(GETARG_C(i)):base+GETARG_C(i))
 
#define KBx(i)   check_exp(getBMode(GET_OPCODE(i))==OpArgK,k+GETARG_Bx(i))
 
#define dojump(L, pc, i)   {(pc)+=(i);}
 
#define Protect(x)   {L->savedpc=pc;{x;};base=L->base;}
 
#define arith_op(op, tm)   {TValue*rb=RKB(i);TValue*rc=RKC(i);if(ttisnumber(rb)&&ttisnumber(rc)){lua_Number nb=nvalue(rb),nc=nvalue(rc);setnvalue(ra,op(nb,nc));}else Protect(Arith(L,ra,rb,rc,tm));}
 
#define api_checknelems(L, n)   luai_apicheck(L,(n)<=(L->top-L->base))
 
#define api_checkvalidindex(L, i)   luai_apicheck(L,(i)!=(&luaO_nilobject_))
 
#define api_incr_top(L)   {luai_apicheck(L,L->top<L->ci->top);L->top++;}
 
#define adjustresults(L, nres)   {if(nres==(-1)&&L->top>=L->ci->top)L->ci->top=L->top;}
 
#define checkresults(L, na, nr)   luai_apicheck(L,(nr)==(-1)||(L->ci->top-L->top>=(nr)-(na)))
 
#define luaL_getn(L, i)   ((int)lua_objlen(L,i))
 
#define luaL_setn(L, i, j)   ((void)0)
 
#define luaL_argcheck(L, cond, numarg, extramsg)   ((void)((cond)||luaL_argerror(L,(numarg),(extramsg))))
 
#define luaL_checkstring(L, n)   (luaL_checklstring(L,(n),NULL))
 
#define luaL_optstring(L, n, d)   (luaL_optlstring(L,(n),(d),NULL))
 
#define luaL_checkint(L, n)   ((int)luaL_checkinteger(L,(n)))
 
#define luaL_optint(L, n, d)   ((int)luaL_optinteger(L,(n),(d)))
 
#define luaL_typename(L, i)   lua_typename(L,lua_type(L,(i)))
 
#define luaL_getmetatable(L, n)   (lua_getfield(L,(-10000),(n)))
 
#define luaL_opt(L, f, n, d)   (lua_isnoneornil(L,(n))?(d):f(L,(n)))
 
#define luaL_addchar(B, c)   ((void)((B)->p<((B)->buffer+BUFSIZ)||luaL_prepbuffer(B)),(*(B)->p++=(char)(c)))
 
#define luaL_addsize(B, n)   ((B)->p+=(n))
 
#define bufflen(B)   ((B)->p-(B)->buffer)
 
#define bufffree(B)   ((size_t)(BUFSIZ-bufflen(B)))
 
#define aux_getn(L, n)   (luaL_checktype(L,n,5),luaL_getn(L,n))
 
#define tofilep(L)   ((FILE**)luaL_checkudata(L,1,"FILE*"))
 
#define uchar(c)   ((unsigned char)(c))
 
#define BRET(b)   lua_pushnumber(L,(lua_Number)(int)(b));return 1;
 

Typedefs

typedef unsigned long long U64
 
typedef enum BinOpr BinOpr
 
typedef enum UnOpr UnOpr
 
typedef struct lua_State lua_State
 
typedef int(* lua_CFunction) (lua_State *L)
 
typedef const char *(* lua_Reader) (lua_State *L, void *ud, size_t *sz)
 
typedef void *(* lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize)
 
typedef double lua_Number
 
typedef ptrdiff_t lua_Integer
 
typedef struct lua_Debug lua_Debug
 
typedef void(* lua_Hook) (lua_State *L, lua_Debug *ar)
 
typedef unsigned int lu_int32
 
typedef size_t lu_mem
 
typedef ptrdiff_t l_mem
 
typedef unsigned char lu_byte
 
typedef double l_uacNumber
 
typedef lu_int32 Instruction
 
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
 
typedef struct Zio ZIO
 
typedef struct Mbuffer Mbuffer
 
typedef struct stringtable stringtable
 
typedef struct CallInfo CallInfo
 
typedef struct global_State global_State
 
typedef void(* Pfunc) (lua_State *L, void *ud)
 
typedef struct expdesc expdesc
 
typedef struct upvaldesc upvaldesc
 
typedef struct FuncState FuncState
 
typedef struct Token Token
 
typedef struct LexState LexState
 
typedef struct LG LG
 
typedef struct BlockCnt BlockCnt
 
typedef struct luaL_Reg luaL_Reg
 
typedef struct luaL_Buffer luaL_Buffer
 
typedef struct LoadF LoadF
 
typedef struct LoadS LoadS
 
typedef struct MatchState MatchState
 
typedef unsigned int UB
 

Enumerations

enum  TMS {
  TM_INDEX , TM_NEWINDEX , TM_GC , TM_MODE ,
  TM_LEN , TM_EQ , TM_ADD , TM_SUB ,
  TM_MUL , TM_MOD , TM_POW , TM_DIV ,
  TM_IDIV , TM_BAND , TM_BOR , TM_BXOR ,
  TM_SHL , TM_SHR , TM_UNM , TM_BNOT ,
  TM_LT , TM_LE , TM_CONCAT , TM_CALL ,
  TM_N , TM_INDEX , TM_NEWINDEX , TM_GC ,
  TM_MODE , TM_EQ , TM_ADD , TM_SUB ,
  TM_MUL , TM_DIV , TM_MOD , TM_POW ,
  TM_UNM , TM_LEN , TM_LT , TM_LE ,
  TM_CONCAT , TM_CALL , TM_N , TM_INDEX ,
  TM_NEWINDEX , TM_GC , TM_MODE , TM_LEN ,
  TM_EQ , TM_ADD , TM_SUB , TM_MUL ,
  TM_MOD , TM_POW , TM_DIV , TM_IDIV ,
  TM_BAND , TM_BOR , TM_BXOR , TM_SHL ,
  TM_SHR , TM_UNM , TM_BNOT , TM_LT ,
  TM_LE , TM_CONCAT , TM_CALL , TM_N ,
  TM_INDEX , TM_NEWINDEX , TM_GC , TM_MODE ,
  TM_EQ , TM_ADD , TM_SUB , TM_MUL ,
  TM_DIV , TM_MOD , TM_POW , TM_UNM ,
  TM_LEN , TM_LT , TM_LE , TM_CONCAT ,
  TM_CALL , TM_N
}
 
enum  OpMode {
  iABC , iABx , iAsBx , iAx ,
  iABC , iABx , iAsBx , iABC ,
  iABx , iAsBx , iAx , iABC ,
  iABx , iAsBx
}
 
enum  OpCode {
  OP_MOVE , OP_LOADK , OP_LOADKX , OP_LOADBOOL ,
  OP_LOADNIL , OP_GETUPVAL , OP_GETTABUP , OP_GETTABLE ,
  OP_SETTABUP , OP_SETUPVAL , OP_SETTABLE , OP_NEWTABLE ,
  OP_SELF , OP_ADD , OP_SUB , OP_MUL ,
  OP_MOD , OP_POW , OP_DIV , OP_IDIV ,
  OP_BAND , OP_BOR , OP_BXOR , OP_SHL ,
  OP_SHR , OP_UNM , OP_BNOT , OP_NOT ,
  OP_LEN , OP_CONCAT , OP_JMP , OP_EQ ,
  OP_LT , OP_LE , OP_TEST , OP_TESTSET ,
  OP_CALL , OP_TAILCALL , OP_RETURN , OP_FORLOOP ,
  OP_FORPREP , OP_TFORCALL , OP_TFORLOOP , OP_SETLIST ,
  OP_CLOSURE , OP_VARARG , OP_EXTRAARG , OP_MOVE ,
  OP_LOADK , OP_LOADBOOL , OP_LOADNIL , OP_GETUPVAL ,
  OP_GETGLOBAL , OP_GETTABLE , OP_SETGLOBAL , OP_SETUPVAL ,
  OP_SETTABLE , OP_NEWTABLE , OP_SELF , OP_ADD ,
  OP_SUB , OP_MUL , OP_DIV , OP_MOD ,
  OP_POW , OP_UNM , OP_NOT , OP_LEN ,
  OP_CONCAT , OP_JMP , OP_EQ , OP_LT ,
  OP_LE , OP_TEST , OP_TESTSET , OP_CALL ,
  OP_TAILCALL , OP_RETURN , OP_FORLOOP , OP_FORPREP ,
  OP_TFORLOOP , OP_SETLIST , OP_CLOSE , OP_CLOSURE ,
  OP_VARARG , OP_MOVE , OP_LOADK , OP_LOADKX ,
  OP_LOADBOOL , OP_LOADNIL , OP_GETUPVAL , OP_GETTABUP ,
  OP_GETTABLE , OP_SETTABUP , OP_SETUPVAL , OP_SETTABLE ,
  OP_NEWTABLE , OP_SELF , OP_ADD , OP_SUB ,
  OP_MUL , OP_MOD , OP_POW , OP_DIV ,
  OP_IDIV , OP_BAND , OP_BOR , OP_BXOR ,
  OP_SHL , OP_SHR , OP_UNM , OP_BNOT ,
  OP_NOT , OP_LEN , OP_CONCAT , OP_JMP ,
  OP_EQ , OP_LT , OP_LE , OP_TEST ,
  OP_TESTSET , OP_CALL , OP_TAILCALL , OP_RETURN ,
  OP_FORLOOP , OP_FORPREP , OP_TFORCALL , OP_TFORLOOP ,
  OP_SETLIST , OP_CLOSURE , OP_VARARG , OP_EXTRAARG ,
  OP_MOVE , OP_LOADK , OP_LOADBOOL , OP_LOADNIL ,
  OP_GETUPVAL , OP_GETGLOBAL , OP_GETTABLE , OP_SETGLOBAL ,
  OP_SETUPVAL , OP_SETTABLE , OP_NEWTABLE , OP_SELF ,
  OP_ADD , OP_SUB , OP_MUL , OP_DIV ,
  OP_MOD , OP_POW , OP_UNM , OP_NOT ,
  OP_LEN , OP_CONCAT , OP_JMP , OP_EQ ,
  OP_LT , OP_LE , OP_TEST , OP_TESTSET ,
  OP_CALL , OP_TAILCALL , OP_RETURN , OP_FORLOOP ,
  OP_FORPREP , OP_TFORLOOP , OP_SETLIST , OP_CLOSE ,
  OP_CLOSURE , OP_VARARG
}
 
enum  OpArgMask {
  OpArgN , OpArgU , OpArgR , OpArgK ,
  OpArgN , OpArgU , OpArgR , OpArgK ,
  OpArgN , OpArgU , OpArgR , OpArgK ,
  OpArgN , OpArgU , OpArgR , OpArgK
}
 
enum  expkind {
  VVOID , VNIL , VTRUE , VFALSE ,
  VK , VKFLT , VKINT , VNONRELOC ,
  VLOCAL , VUPVAL , VINDEXED , VJMP ,
  VRELOCABLE , VCALL , VVARARG , VVOID ,
  VNIL , VTRUE , VFALSE , VK ,
  VKNUM , VLOCAL , VUPVAL , VGLOBAL ,
  VINDEXED , VJMP , VRELOCABLE , VNONRELOC ,
  VCALL , VVARARG , VVOID , VNIL ,
  VTRUE , VFALSE , VK , VKFLT ,
  VKINT , VNONRELOC , VLOCAL , VUPVAL ,
  VINDEXED , VJMP , VRELOCABLE , VCALL ,
  VVARARG , VVOID , VNIL , VTRUE ,
  VFALSE , VK , VKNUM , VLOCAL ,
  VUPVAL , VGLOBAL , VINDEXED , VJMP ,
  VRELOCABLE , VNONRELOC , VCALL , VVARARG
}
 
enum  RESERVED {
  TK_AND = 257 , TK_BREAK , TK_DO , TK_ELSE ,
  TK_ELSEIF , TK_END , TK_FALSE , TK_FOR ,
  TK_FUNCTION , TK_GOTO , TK_IF , TK_IN ,
  TK_LOCAL , TK_NIL , TK_NOT , TK_OR ,
  TK_REPEAT , TK_RETURN , TK_THEN , TK_TRUE ,
  TK_UNTIL , TK_WHILE , TK_IDIV , TK_CONCAT ,
  TK_DOTS , TK_EQ , TK_GE , TK_LE ,
  TK_NE , TK_SHL , TK_SHR , TK_DBCOLON ,
  TK_EOS , TK_FLT , TK_INT , TK_NAME ,
  TK_STRING , TK_AND =257 , TK_BREAK , TK_DO ,
  TK_ELSE , TK_ELSEIF , TK_END , TK_FALSE ,
  TK_FOR , TK_FUNCTION , TK_IF , TK_IN ,
  TK_LOCAL , TK_NIL , TK_NOT , TK_OR ,
  TK_REPEAT , TK_RETURN , TK_THEN , TK_TRUE ,
  TK_UNTIL , TK_WHILE , TK_CONCAT , TK_DOTS ,
  TK_EQ , TK_GE , TK_LE , TK_NE ,
  TK_NUMBER , TK_NAME , TK_STRING , TK_EOS ,
  TK_AND = 257 , TK_BREAK , TK_DO , TK_ELSE ,
  TK_ELSEIF , TK_END , TK_FALSE , TK_FOR ,
  TK_FUNCTION , TK_GOTO , TK_IF , TK_IN ,
  TK_LOCAL , TK_NIL , TK_NOT , TK_OR ,
  TK_REPEAT , TK_RETURN , TK_THEN , TK_TRUE ,
  TK_UNTIL , TK_WHILE , TK_IDIV , TK_CONCAT ,
  TK_DOTS , TK_EQ , TK_GE , TK_LE ,
  TK_NE , TK_SHL , TK_SHR , TK_DBCOLON ,
  TK_EOS , TK_FLT , TK_INT , TK_NAME ,
  TK_STRING , TK_AND =257 , TK_BREAK , TK_DO ,
  TK_ELSE , TK_ELSEIF , TK_END , TK_FALSE ,
  TK_FOR , TK_FUNCTION , TK_IF , TK_IN ,
  TK_LOCAL , TK_NIL , TK_NOT , TK_OR ,
  TK_REPEAT , TK_RETURN , TK_THEN , TK_TRUE ,
  TK_UNTIL , TK_WHILE , TK_CONCAT , TK_DOTS ,
  TK_EQ , TK_GE , TK_LE , TK_NE ,
  TK_NUMBER , TK_NAME , TK_STRING , TK_EOS
}
 
enum  BinOpr {
  OPR_ADD , OPR_SUB , OPR_MUL , OPR_MOD ,
  OPR_POW , OPR_DIV , OPR_IDIV , OPR_BAND ,
  OPR_BOR , OPR_BXOR , OPR_SHL , OPR_SHR ,
  OPR_CONCAT , OPR_EQ , OPR_LT , OPR_LE ,
  OPR_NE , OPR_GT , OPR_GE , OPR_AND ,
  OPR_OR , OPR_NOBINOPR , OPR_ADD , OPR_SUB ,
  OPR_MUL , OPR_DIV , OPR_MOD , OPR_POW ,
  OPR_CONCAT , OPR_NE , OPR_EQ , OPR_LT ,
  OPR_LE , OPR_GT , OPR_GE , OPR_AND ,
  OPR_OR , OPR_NOBINOPR , OPR_ADD , OPR_SUB ,
  OPR_MUL , OPR_DIV , OPR_MOD , OPR_POW ,
  OPR_CONCAT , OPR_NE , OPR_EQ , OPR_LT ,
  OPR_GE , OPR_LE , OPR_GT , OPR_AND ,
  OPR_OR , OPR_NOBINOPR , OPR_ADD , OPR_SUB ,
  OPR_MUL , OPR_MOD , OPR_POW , OPR_DIV ,
  OPR_IDIV , OPR_BAND , OPR_BOR , OPR_BXOR ,
  OPR_SHL , OPR_SHR , OPR_CONCAT , OPR_EQ ,
  OPR_LT , OPR_LE , OPR_NE , OPR_GT ,
  OPR_GE , OPR_AND , OPR_OR , OPR_NOBINOPR ,
  OPR_ADD , OPR_SUB , OPR_MUL , OPR_DIV ,
  OPR_MOD , OPR_POW , OPR_CONCAT , OPR_NE ,
  OPR_EQ , OPR_LT , OPR_LE , OPR_GT ,
  OPR_GE , OPR_AND , OPR_OR , OPR_NOBINOPR ,
  OPR_ADD , OPR_SUB , OPR_MUL , OPR_DIV ,
  OPR_MOD , OPR_POW , OPR_CONCAT , OPR_NE ,
  OPR_EQ , OPR_LT , OPR_GE , OPR_LE ,
  OPR_GT , OPR_AND , OPR_OR , OPR_NOBINOPR
}
 
enum  UnOpr {
  OPR_MINUS , OPR_BNOT , OPR_NOT , OPR_LEN ,
  OPR_NOUNOPR , OPR_MINUS , OPR_NOT , OPR_LEN ,
  OPR_NOUNOPR , OPR_MINUS , OPR_BNOT , OPR_NOT ,
  OPR_LEN , OPR_NOUNOPR , OPR_MINUS , OPR_NOT ,
  OPR_LEN , OPR_NOUNOPR
}
 

Functions

static void lua_settop (lua_State *L, int idx)
 
static int lua_type (lua_State *L, int idx)
 
static const char * lua_tolstring (lua_State *L, int idx, size_t *len)
 
static size_t lua_objlen (lua_State *L, int idx)
 
static void lua_pushlstring (lua_State *L, const char *s, size_t l)
 
static void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n)
 
static void lua_createtable (lua_State *L, int narr, int nrec)
 
static void lua_setfield (lua_State *L, int idx, const char *k)
 
static int luaO_log2 (unsigned int x)
 
static const TValueluaT_gettm (Table *events, TMS event, TString *ename)
 
static voidluaM_realloc_ (lua_State *L, void *block, size_t oldsize, size_t size)
 
static voidluaM_toobig (lua_State *L)
 
static voidluaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elem, int limit, const char *errormsg)
 
static int luaZ_fill (ZIO *z)
 
static void luaE_freethread (lua_State *L, lua_State *L1)
 
static void luaG_typeerror (lua_State *L, const TValue *o, const char *opname)
 
static void luaG_runerror (lua_State *L, const char *fmt,...)
 
static int luaD_poscall (lua_State *L, StkId firstResult)
 
static void luaD_reallocCI (lua_State *L, int newsize)
 
static void luaD_reallocstack (lua_State *L, int newsize)
 
static void luaD_growstack (lua_State *L, int n)
 
static void luaD_throw (lua_State *L, int errcode)
 
static void luaC_step (lua_State *L)
 
static void luaC_link (lua_State *L, GCObject *o, lu_byte tt)
 
static void luaC_linkupval (lua_State *L, UpVal *uv)
 
static void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v)
 
static void luaC_barrierback (lua_State *L, Table *t)
 
static TStringluaS_newlstr (lua_State *L, const char *str, size_t l)
 
static int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2)
 
static const TValueluaV_tonumber (const TValue *obj, TValue *n)
 
static int luaV_tostring (lua_State *L, StkId obj)
 
static void luaV_execute (lua_State *L, int nexeccalls)
 
static void luaV_concat (lua_State *L, int total, int last)
 
static int luaO_int2fb (unsigned int x)
 
static int luaO_fb2int (int x)
 
static int luaO_rawequalObj (const TValue *t1, const TValue *t2)
 
static int luaO_str2d (const char *s, lua_Number *result)
 
static void pushstr (lua_State *L, const char *str)
 
static const char * luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp)
 
static const char * luaO_pushfstring (lua_State *L, const char *fmt,...)
 
static void luaO_chunkid (char *out, const char *source, size_t bufflen)
 
static TValueluaH_setnum (lua_State *L, Table *t, int key)
 
static const TValueluaH_getstr (Table *t, TString *key)
 
static TValueluaH_set (lua_State *L, Table *t, const TValue *key)
 
static void luaT_init (lua_State *L)
 
static const TValueluaT_gettmbyobj (lua_State *L, const TValue *o, TMS event)
 
static ClosureluaF_newCclosure (lua_State *L, int nelems, Table *e)
 
static ClosureluaF_newLclosure (lua_State *L, int nelems, Table *e)
 
static UpValluaF_newupval (lua_State *L)
 
static UpValluaF_findupval (lua_State *L, StkId level)
 
static void unlinkupval (UpVal *uv)
 
static void luaF_freeupval (lua_State *L, UpVal *uv)
 
static void luaF_close (lua_State *L, StkId level)
 
static ProtoluaF_newproto (lua_State *L)
 
static void luaF_freeproto (lua_State *L, Proto *f)
 
static void luaF_freeclosure (lua_State *L, Closure *c)
 
static ProtoluaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name)
 
static void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop)
 
static void restore_stack_limit (lua_State *L)
 
static void resetstack (lua_State *L, int status)
 
static int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud)
 
static void correctstack (lua_State *L, TValue *oldstack)
 
static CallInfogrowCI (lua_State *L)
 
static StkId adjust_varargs (lua_State *L, Proto *p, int actual)
 
static StkId tryfuncTM (lua_State *L, StkId func)
 
static int luaD_precall (lua_State *L, StkId func, int nresults)
 
static void luaD_call (lua_State *L, StkId func, int nResults)
 
static int luaD_pcall (lua_State *L, Pfunc func, void *u, ptrdiff_t old_top, ptrdiff_t ef)
 
static void f_parser (lua_State *L, void *ud)
 
static int luaD_protectedparser (lua_State *L, ZIO *z, const char *name)
 
static void luaS_resize (lua_State *L, int newsize)
 
static TStringnewlstr (lua_State *L, const char *str, size_t l, unsigned int h)
 
static UdataluaS_newudata (lua_State *L, size_t s, Table *e)
 
static Nodehashnum (const Table *t, lua_Number n)
 
static Nodemainposition (const Table *t, const TValue *key)
 
static int arrayindex (const TValue *key)
 
static int findindex (lua_State *L, Table *t, StkId key)
 
static int luaH_next (lua_State *L, Table *t, StkId key)
 
static int computesizes (int nums[], int *narray)
 
static int countint (const TValue *key, int *nums)
 
static int numusearray (const Table *t, int *nums)
 
static int numusehash (const Table *t, int *nums, int *pnasize)
 
static void setarrayvector (lua_State *L, Table *t, int size)
 
static void setnodevector (lua_State *L, Table *t, int size)
 
static void resize (lua_State *L, Table *t, int nasize, int nhsize)
 
static void luaH_resizearray (lua_State *L, Table *t, int nasize)
 
static void rehash (lua_State *L, Table *t, const TValue *ek)
 
static TableluaH_new (lua_State *L, int narray, int nhash)
 
static void luaH_free (lua_State *L, Table *t)
 
static Nodegetfreepos (Table *t)
 
static TValuenewkey (lua_State *L, Table *t, const TValue *key)
 
static const TValueluaH_getnum (Table *t, int key)
 
static const TValueluaH_get (Table *t, const TValue *key)
 
static TValueluaH_setstr (lua_State *L, Table *t, TString *key)
 
static int unbound_search (Table *t, unsigned int j)
 
static int luaH_getn (Table *t)
 
static void removeentry (Node *n)
 
static void reallymarkobject (global_State *g, GCObject *o)
 
static void marktmu (global_State *g)
 
static size_t luaC_separateudata (lua_State *L, int all)
 
static int traversetable (global_State *g, Table *h)
 
static void traverseproto (global_State *g, Proto *f)
 
static void traverseclosure (global_State *g, Closure *cl)
 
static void checkstacksizes (lua_State *L, StkId max)
 
static void traversestack (global_State *g, lua_State *l)
 
static l_mem propagatemark (global_State *g)
 
static size_t propagateall (global_State *g)
 
static int iscleared (const TValue *o, int iskey)
 
static void cleartable (GCObject *l)
 
static void freeobj (lua_State *L, GCObject *o)
 
static GCObject ** sweeplist (lua_State *L, GCObject **p, lu_mem count)
 
static void checkSizes (lua_State *L)
 
static void GCTM (lua_State *L)
 
static void luaC_callGCTM (lua_State *L)
 
static void luaC_freeall (lua_State *L)
 
static void markmt (global_State *g)
 
static void markroot (lua_State *L)
 
static void remarkupvals (global_State *g)
 
static void atomic (lua_State *L)
 
static l_mem singlestep (lua_State *L)
 
static void luaX_init (lua_State *L)
 
static void luaX_lexerror (LexState *ls, const char *msg, int token)
 
static void stack_init (lua_State *L1, lua_State *L)
 
static void freestack (lua_State *L, lua_State *L1)
 
static void f_luaopen (lua_State *L, void *ud)
 
static void preinit_state (lua_State *L, global_State *g)
 
static void close_state (lua_State *L)
 
static lua_Statelua_newstate (lua_Alloc f, void *ud)
 
static void callallgcTM (lua_State *L, void *ud)
 
static void lua_close (lua_State *L)
 
static int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx)
 
static int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C)
 
static void luaK_setreturns (FuncState *fs, expdesc *e, int nresults)
 
static void luaK_patchtohere (FuncState *fs, int list)
 
static void luaK_concat (FuncState *fs, int *l1, int l2)
 
static int currentpc (lua_State *L, CallInfo *ci)
 
static int currentline (lua_State *L, CallInfo *ci)
 
static int lua_getstack (lua_State *L, int level, lua_Debug *ar)
 
static Protogetluaproto (CallInfo *ci)
 
static void funcinfo (lua_Debug *ar, Closure *cl)
 
static void info_tailcall (lua_Debug *ar)
 
static void collectvalidlines (lua_State *L, Closure *f)
 
static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, Closure *f, CallInfo *ci)
 
static int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar)
 
static int isinstack (CallInfo *ci, const TValue *o)
 
static void luaG_concaterror (lua_State *L, StkId p1, StkId p2)
 
static void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2)
 
static int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2)
 
static void addinfo (lua_State *L, const char *msg)
 
static void luaG_errormsg (lua_State *L)
 
static void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data)
 
static char * luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n)
 
static void save (LexState *ls, int c)
 
static const char * luaX_token2str (LexState *ls, int token)
 
static const char * txtToken (LexState *ls, int token)
 
static void luaX_syntaxerror (LexState *ls, const char *msg)
 
static TStringluaX_newstring (LexState *ls, const char *str, size_t l)
 
static void inclinenumber (LexState *ls)
 
static void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source)
 
static int check_next (LexState *ls, const char *set)
 
static void buffreplace (LexState *ls, char from, char to)
 
static void read_numeral (LexState *ls, SemInfo *seminfo)
 
static int skip_sep (LexState *ls)
 
static void read_long_string (LexState *ls, SemInfo *seminfo, int sep)
 
static void read_string (LexState *ls, int del, SemInfo *seminfo)
 
static int llex (LexState *ls, SemInfo *seminfo)
 
static void luaX_next (LexState *ls)
 
static void luaX_lookahead (LexState *ls)
 
static int isnumeral (expdesc *e)
 
static void luaK_nil (FuncState *fs, int from, int n)
 
static int luaK_jump (FuncState *fs)
 
static void luaK_ret (FuncState *fs, int first, int nret)
 
static int condjump (FuncState *fs, OpCode op, int A, int B, int C)
 
static void fixjump (FuncState *fs, int pc, int dest)
 
static int luaK_getlabel (FuncState *fs)
 
static int getjump (FuncState *fs, int pc)
 
static Instructiongetjumpcontrol (FuncState *fs, int pc)
 
static int need_value (FuncState *fs, int list)
 
static int patchtestreg (FuncState *fs, int node, int reg)
 
static void removevalues (FuncState *fs, int list)
 
static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, int dtarget)
 
static void dischargejpc (FuncState *fs)
 
static void luaK_patchlist (FuncState *fs, int list, int target)
 
static void luaK_checkstack (FuncState *fs, int n)
 
static void luaK_reserveregs (FuncState *fs, int n)
 
static void freereg (FuncState *fs, int reg)
 
static void freeexp (FuncState *fs, expdesc *e)
 
static int addk (FuncState *fs, TValue *k, TValue *v)
 
static int luaK_stringK (FuncState *fs, TString *s)
 
static int luaK_numberK (FuncState *fs, lua_Number r)
 
static int boolK (FuncState *fs, int b)
 
static int nilK (FuncState *fs)
 
static void luaK_setoneret (FuncState *fs, expdesc *e)
 
static void luaK_dischargevars (FuncState *fs, expdesc *e)
 
static int code_label (FuncState *fs, int A, int b, int jump)
 
static void discharge2reg (FuncState *fs, expdesc *e, int reg)
 
static void discharge2anyreg (FuncState *fs, expdesc *e)
 
static void exp2reg (FuncState *fs, expdesc *e, int reg)
 
static void luaK_exp2nextreg (FuncState *fs, expdesc *e)
 
static int luaK_exp2anyreg (FuncState *fs, expdesc *e)
 
static void luaK_exp2val (FuncState *fs, expdesc *e)
 
static int luaK_exp2RK (FuncState *fs, expdesc *e)
 
static void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex)
 
static void luaK_self (FuncState *fs, expdesc *e, expdesc *key)
 
static void invertjump (FuncState *fs, expdesc *e)
 
static int jumponcond (FuncState *fs, expdesc *e, int cond)
 
static void luaK_goiftrue (FuncState *fs, expdesc *e)
 
static void luaK_goiffalse (FuncState *fs, expdesc *e)
 
static void codenot (FuncState *fs, expdesc *e)
 
static void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k)
 
static int constfolding (OpCode op, expdesc *e1, expdesc *e2)
 
static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2)
 
static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, expdesc *e2)
 
static void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e)
 
static void luaK_infix (FuncState *fs, BinOpr op, expdesc *v)
 
static void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2)
 
static void luaK_fixline (FuncState *fs, int line)
 
static int luaK_code (FuncState *fs, Instruction i, int line)
 
static void luaK_setlist (FuncState *fs, int base, int nelems, int tostore)
 
static void chunk (LexState *ls)
 
static void expr (LexState *ls, expdesc *v)
 
static void anchor_token (LexState *ls)
 
static void error_expected (LexState *ls, int token)
 
static void errorlimit (FuncState *fs, int limit, const char *what)
 
static int testnext (LexState *ls, int c)
 
static void check (LexState *ls, int c)
 
static void checknext (LexState *ls, int c)
 
static void check_match (LexState *ls, int what, int who, int where)
 
static TStringstr_checkname (LexState *ls)
 
static void init_exp (expdesc *e, expkind k, int i)
 
static void codestring (LexState *ls, expdesc *e, TString *s)
 
static void checkname (LexState *ls, expdesc *e)
 
static int registerlocalvar (LexState *ls, TString *varname)
 
static void new_localvar (LexState *ls, TString *name, int n)
 
static void adjustlocalvars (LexState *ls, int nvars)
 
static void removevars (LexState *ls, int tolevel)
 
static int indexupvalue (FuncState *fs, TString *name, expdesc *v)
 
static int searchvar (FuncState *fs, TString *n)
 
static void markupval (FuncState *fs, int level)
 
static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base)
 
static void singlevar (LexState *ls, expdesc *var)
 
static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e)
 
static void enterlevel (LexState *ls)
 
static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable)
 
static void leaveblock (FuncState *fs)
 
static void pushclosure (LexState *ls, FuncState *func, expdesc *v)
 
static void open_func (LexState *ls, FuncState *fs)
 
static void close_func (LexState *ls)
 
static void field (LexState *ls, expdesc *v)
 
static void yindex (LexState *ls, expdesc *v)
 
static void recfield (LexState *ls, struct ConsControl *cc)
 
static void closelistfield (FuncState *fs, struct ConsControl *cc)
 
static void lastlistfield (FuncState *fs, struct ConsControl *cc)
 
static void listfield (LexState *ls, struct ConsControl *cc)
 
static void constructor (LexState *ls, expdesc *t)
 
static void parlist (LexState *ls)
 
static void body (LexState *ls, expdesc *e, int needself, int line)
 
static int explist1 (LexState *ls, expdesc *v)
 
static void funcargs (LexState *ls, expdesc *f)
 
static void prefixexp (LexState *ls, expdesc *v)
 
static void primaryexp (LexState *ls, expdesc *v)
 
static void simpleexp (LexState *ls, expdesc *v)
 
static UnOpr getunopr (int op)
 
static BinOpr getbinopr (int op)
 
static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit)
 
static int block_follow (int token)
 
static void block (LexState *ls)
 
static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v)
 
static void assignment (LexState *ls, struct LHS_assign *lh, int nvars)
 
static int cond (LexState *ls)
 
static void breakstat (LexState *ls)
 
static void whilestat (LexState *ls, int line)
 
static void repeatstat (LexState *ls, int line)
 
static int exp1 (LexState *ls)
 
static void forbody (LexState *ls, int base, int line, int nvars, int isnum)
 
static void fornum (LexState *ls, TString *varname, int line)
 
static void forlist (LexState *ls, TString *indexname)
 
static void forstat (LexState *ls, int line)
 
static int test_then_block (LexState *ls)
 
static void ifstat (LexState *ls, int line)
 
static void localfunc (LexState *ls)
 
static void localstat (LexState *ls)
 
static int funcname (LexState *ls, expdesc *v)
 
static void funcstat (LexState *ls, int line)
 
static void exprstat (LexState *ls)
 
static void retstat (LexState *ls)
 
static int statement (LexState *ls)
 
static void callTMres (lua_State *L, StkId res, const TValue *f, const TValue *p1, const TValue *p2)
 
static void callTM (lua_State *L, const TValue *f, const TValue *p1, const TValue *p2, const TValue *p3)
 
static void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val)
 
static void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val)
 
static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2, StkId res, TMS event)
 
static const TValueget_compTM (lua_State *L, Table *mt1, Table *mt2, TMS event)
 
static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2, TMS event)
 
static int l_strcmp (const TString *ls, const TString *rs)
 
static int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r)
 
static int lessequal (lua_State *L, const TValue *l, const TValue *r)
 
static void Arith (lua_State *L, StkId ra, const TValue *rb, const TValue *rc, TMS op)
 
static TValueindex2adr (lua_State *L, int idx)
 
static Tablegetcurrenv (lua_State *L)
 
static int lua_checkstack (lua_State *L, int size)
 
static lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf)
 
static int lua_gettop (lua_State *L)
 
static void lua_remove (lua_State *L, int idx)
 
static void lua_insert (lua_State *L, int idx)
 
static void lua_replace (lua_State *L, int idx)
 
static void lua_pushvalue (lua_State *L, int idx)
 
static const char * lua_typename (lua_State *L, int t)
 
static int lua_iscfunction (lua_State *L, int idx)
 
static int lua_isnumber (lua_State *L, int idx)
 
static int lua_isstring (lua_State *L, int idx)
 
static int lua_rawequal (lua_State *L, int index1, int index2)
 
static int lua_lessthan (lua_State *L, int index1, int index2)
 
static lua_Number lua_tonumber (lua_State *L, int idx)
 
static lua_Integer lua_tointeger (lua_State *L, int idx)
 
static int lua_toboolean (lua_State *L, int idx)
 
static lua_CFunction lua_tocfunction (lua_State *L, int idx)
 
static voidlua_touserdata (lua_State *L, int idx)
 
static void lua_pushnil (lua_State *L)
 
static void lua_pushnumber (lua_State *L, lua_Number n)
 
static void lua_pushinteger (lua_State *L, lua_Integer n)
 
static void lua_pushstring (lua_State *L, const char *s)
 
static const char * lua_pushvfstring (lua_State *L, const char *fmt, va_list argp)
 
static const char * lua_pushfstring (lua_State *L, const char *fmt,...)
 
static void lua_pushboolean (lua_State *L, int b)
 
static int lua_pushthread (lua_State *L)
 
static void lua_gettable (lua_State *L, int idx)
 
static void lua_getfield (lua_State *L, int idx, const char *k)
 
static void lua_rawget (lua_State *L, int idx)
 
static void lua_rawgeti (lua_State *L, int idx, int n)
 
static int lua_getmetatable (lua_State *L, int objindex)
 
static void lua_getfenv (lua_State *L, int idx)
 
static void lua_settable (lua_State *L, int idx)
 
static void lua_rawset (lua_State *L, int idx)
 
static void lua_rawseti (lua_State *L, int idx, int n)
 
static int lua_setmetatable (lua_State *L, int objindex)
 
static int lua_setfenv (lua_State *L, int idx)
 
static void lua_call (lua_State *L, int nargs, int nresults)
 
static void f_call (lua_State *L, void *ud)
 
static int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc)
 
static int lua_load (lua_State *L, lua_Reader reader, void *data, const char *chunkname)
 
static int lua_error (lua_State *L)
 
static int lua_next (lua_State *L, int idx)
 
static void lua_concat (lua_State *L, int n)
 
static voidlua_newuserdata (lua_State *L, size_t size)
 
static void luaI_openlib (lua_State *L, const char *libname, const luaL_Reg *l, int nup)
 
static int luaL_argerror (lua_State *L, int numarg, const char *extramsg)
 
static const char * luaL_checklstring (lua_State *L, int numArg, size_t *l)
 
static const char * luaL_optlstring (lua_State *L, int numArg, const char *def, size_t *l)
 
static lua_Integer luaL_checkinteger (lua_State *L, int numArg)
 
static lua_Integer luaL_optinteger (lua_State *L, int nArg, lua_Integer def)
 
static int luaL_error (lua_State *L, const char *fmt,...)
 
static const char * luaL_findtable (lua_State *L, int idx, const char *fname, int szhint)
 
static char * luaL_prepbuffer (luaL_Buffer *B)
 
static int luaL_typerror (lua_State *L, int narg, const char *tname)
 
static void tag_error (lua_State *L, int narg, int tag)
 
static void luaL_where (lua_State *L, int level)
 
static int luaL_newmetatable (lua_State *L, const char *tname)
 
static voidluaL_checkudata (lua_State *L, int ud, const char *tname)
 
static void luaL_checkstack (lua_State *L, int space, const char *mes)
 
static void luaL_checktype (lua_State *L, int narg, int t)
 
static void luaL_checkany (lua_State *L, int narg)
 
static lua_Number luaL_checknumber (lua_State *L, int narg)
 
static int luaL_getmetafield (lua_State *L, int obj, const char *event)
 
static void luaL_register (lua_State *L, const char *libname, const luaL_Reg *l)
 
static int libsize (const luaL_Reg *l)
 
static int emptybuffer (luaL_Buffer *B)
 
static void adjuststack (luaL_Buffer *B)
 
static void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l)
 
static void luaL_pushresult (luaL_Buffer *B)
 
static void luaL_addvalue (luaL_Buffer *B)
 
static void luaL_buffinit (lua_State *L, luaL_Buffer *B)
 
static const char * getF (lua_State *L, void *ud, size_t *size)
 
static int errfile (lua_State *L, const char *what, int fnameindex)
 
static int luaL_loadfile (lua_State *L, const char *filename)
 
static const char * getS (lua_State *L, void *ud, size_t *size)
 
static int luaL_loadbuffer (lua_State *L, const char *buff, size_t size, const char *name)
 
static voidl_alloc (void *ud, void *ptr, size_t osize, size_t nsize)
 
static int panic (lua_State *L)
 
static lua_StateluaL_newstate (void)
 
static int luaB_tonumber (lua_State *L)
 
static int luaB_error (lua_State *L)
 
static int luaB_setmetatable (lua_State *L)
 
static void getfunc (lua_State *L, int opt)
 
static int luaB_setfenv (lua_State *L)
 
static int luaB_rawget (lua_State *L)
 
static int luaB_type (lua_State *L)
 
static int luaB_next (lua_State *L)
 
static int luaB_pairs (lua_State *L)
 
static int ipairsaux (lua_State *L)
 
static int luaB_ipairs (lua_State *L)
 
static int load_aux (lua_State *L, int status)
 
static int luaB_loadstring (lua_State *L)
 
static int luaB_loadfile (lua_State *L)
 
static int luaB_assert (lua_State *L)
 
static int luaB_unpack (lua_State *L)
 
static int luaB_pcall (lua_State *L)
 
static int luaB_newproxy (lua_State *L)
 
static void auxopen (lua_State *L, const char *name, lua_CFunction f, lua_CFunction u)
 
static void base_open (lua_State *L)
 
static int luaopen_base (lua_State *L)
 
static int tinsert (lua_State *L)
 
static int tremove (lua_State *L)
 
static void addfield (lua_State *L, luaL_Buffer *b, int i)
 
static int tconcat (lua_State *L)
 
static void set2 (lua_State *L, int i, int j)
 
static int sort_comp (lua_State *L, int a, int b)
 
static void auxsort (lua_State *L, int l, int u)
 
static int sort (lua_State *L)
 
static int luaopen_table (lua_State *L)
 
static int pushresult (lua_State *L, int i, const char *filename)
 
static void fileerror (lua_State *L, int arg, const char *filename)
 
static int io_type (lua_State *L)
 
static FILEtofile (lua_State *L)
 
static FILE ** newfile (lua_State *L)
 
static int io_noclose (lua_State *L)
 
static int io_pclose (lua_State *L)
 
static int io_fclose (lua_State *L)
 
static int aux_close (lua_State *L)
 
static int io_close (lua_State *L)
 
static int io_gc (lua_State *L)
 
static int io_open (lua_State *L)
 
static FILEgetiofile (lua_State *L, int findex)
 
static int g_iofile (lua_State *L, int f, const char *mode)
 
static int io_input (lua_State *L)
 
static int io_output (lua_State *L)
 
static int io_readline (lua_State *L)
 
static void aux_lines (lua_State *L, int idx, int toclose)
 
static int f_lines (lua_State *L)
 
static int io_lines (lua_State *L)
 
static int read_number (lua_State *L, FILE *f)
 
static int test_eof (lua_State *L, FILE *f)
 
static int read_line (lua_State *L, FILE *f)
 
static int read_chars (lua_State *L, FILE *f, size_t n)
 
static int g_read (lua_State *L, FILE *f, int first)
 
static int io_read (lua_State *L)
 
static int f_read (lua_State *L)
 
static int g_write (lua_State *L, FILE *f, int arg)
 
static int io_write (lua_State *L)
 
static int f_write (lua_State *L)
 
static int io_flush (lua_State *L)
 
static int f_flush (lua_State *L)
 
static void createmeta (lua_State *L)
 
static void createstdfile (lua_State *L, FILE *f, int k, const char *fname)
 
static void newfenv (lua_State *L, lua_CFunction cls)
 
static int luaopen_io (lua_State *L)
 
static int os_pushresult (lua_State *L, int i, const char *filename)
 
static int os_remove (lua_State *L)
 
static int os_exit (lua_State *L)
 
static int luaopen_os (lua_State *L)
 
static ptrdiff_t posrelat (ptrdiff_t pos, size_t len)
 
static int str_sub (lua_State *L)
 
static int str_lower (lua_State *L)
 
static int str_upper (lua_State *L)
 
static int str_rep (lua_State *L)
 
static int str_byte (lua_State *L)
 
static int str_char (lua_State *L)
 
static int check_capture (MatchState *ms, int l)
 
static int capture_to_close (MatchState *ms)
 
static const char * classend (MatchState *ms, const char *p)
 
static int match_class (int c, int cl)
 
static int matchbracketclass (int c, const char *p, const char *ec)
 
static int singlematch (int c, const char *p, const char *ep)
 
static const char * match (MatchState *ms, const char *s, const char *p)
 
static const char * matchbalance (MatchState *ms, const char *s, const char *p)
 
static const char * max_expand (MatchState *ms, const char *s, const char *p, const char *ep)
 
static const char * min_expand (MatchState *ms, const char *s, const char *p, const char *ep)
 
static const char * start_capture (MatchState *ms, const char *s, const char *p, int what)
 
static const char * end_capture (MatchState *ms, const char *s, const char *p)
 
static const char * match_capture (MatchState *ms, const char *s, int l)
 
static const char * lmemfind (const char *s1, size_t l1, const char *s2, size_t l2)
 
static void push_onecapture (MatchState *ms, int i, const char *s, const char *e)
 
static int push_captures (MatchState *ms, const char *s, const char *e)
 
static int str_find_aux (lua_State *L, int find)
 
static int str_find (lua_State *L)
 
static int str_match (lua_State *L)
 
static int gmatch_aux (lua_State *L)
 
static int gmatch (lua_State *L)
 
static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, const char *e)
 
static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, const char *e)
 
static int str_gsub (lua_State *L)
 
static void addquoted (lua_State *L, luaL_Buffer *b, int arg)
 
static const char * scanformat (lua_State *L, const char *strfrmt, char *form)
 
static void addintlen (char *form)
 
static int str_format (lua_State *L)
 
static void createmetatable (lua_State *L)
 
static int luaopen_string (lua_State *L)
 
static void luaL_openlibs (lua_State *L)
 
static UB barg (lua_State *L, int idx)
 
static int tobit (lua_State *L)
 
static int bnot (lua_State *L)
 
static int band (lua_State *L)
 
static int bor (lua_State *L)
 
static int bxor (lua_State *L)
 
static int lshift (lua_State *L)
 
static int rshift (lua_State *L)
 
static int arshift (lua_State *L)
 
static int rol (lua_State *L)
 
static int ror (lua_State *L)
 
static int bswap (lua_State *L)
 
static int tohex (lua_State *L)
 
int main (int argc, char **argv)
 

Variables

int _CRT_glob = 0
 
static const TValue luaO_nilobject_ ={{NULL},0}
 
static const char *const luaT_typenames []
 
static const lu_byte luaP_opmodes [(((int)(OP_VARARG))+1)]
 
static const Node dummynode_
 
static const char *const luaX_tokens []
 
struct {
   lu_byte   left
 
   lu_byte   right
 
priority []
 
static const luaL_Reg base_funcs []
 
static const luaL_Reg tab_funcs []
 
static const char *const fnames [] ={"input","output"}
 
static const luaL_Reg iolib []
 
static const luaL_Reg flib []
 
static const luaL_Reg syslib []
 
static const luaL_Reg strlib []
 
static const luaL_Reg lualibs []
 
static const struct luaL_Reg bitlib []
 

Macro Definition Documentation

◆ adjustresults

#define adjustresults (   L,
  nres 
)    {if(nres==(-1)&&L->top>=L->ci->top)L->ci->top=L->top;}

Definition at line 5751 of file minilua.c.

◆ api_checknelems

#define api_checknelems (   L,
  n 
)    luai_apicheck(L,(n)<=(L->top-L->base))

Definition at line 5310 of file minilua.c.

◆ api_checkvalidindex

#define api_checkvalidindex (   L,
  i 
)    luai_apicheck(L,(i)!=(&luaO_nilobject_))

Definition at line 5311 of file minilua.c.

◆ api_incr_top

#define api_incr_top (   L)    {luai_apicheck(L,L->top<L->ci->top);L->top++;}

Definition at line 5312 of file minilua.c.

◆ arith_op

#define arith_op (   op,
  tm 
)    {TValue*rb=RKB(i);TValue*rc=RKC(i);if(ttisnumber(rb)&&ttisnumber(rc)){lua_Number nb=nvalue(rb),nc=nvalue(rc);setnvalue(ra,op(nb,nc));}else Protect(Arith(L,ra,rb,rc,tm));}

Definition at line 4943 of file minilua.c.

◆ aux_getn

#define aux_getn (   L,
  n 
)    (luaL_checktype(L,n,5),luaL_getn(L,n))

Definition at line 6452 of file minilua.c.

◆ bit2mask

#define bit2mask (   b1,
  b2 
)    (bitmask(b1)|bitmask(b2))

Definition at line 564 of file minilua.c.

◆ bitmask

#define bitmask (   b)    (1<<(b))

Definition at line 563 of file minilua.c.

◆ black2gray

#define black2gray (   x)    resetbit((x)->gch.marked,2)

Definition at line 1721 of file minilua.c.

◆ BRET

#define BRET (   b)    lua_pushnumber(L,(lua_Number)(int)(b));return 1;

Definition at line 7699 of file minilua.c.

◆ bufffree

#define bufffree (   B)    ((size_t)(BUFSIZ-bufflen(B)))

Definition at line 6055 of file minilua.c.

◆ bufflen

#define bufflen (   B)    ((B)->p-(B)->buffer)

Definition at line 6054 of file minilua.c.

◆ bvalue

#define bvalue (   o)    check_exp(ttisboolean(o),(o)->value.b)

Definition at line 253 of file minilua.c.

◆ cast

#define cast (   t,
  exp 
)    ((t)(exp))

Definition at line 215 of file minilua.c.

◆ cast_byte

#define cast_byte (   i)    cast(lu_byte,(i))

Definition at line 216 of file minilua.c.

◆ cast_int

#define cast_int (   i)    cast(int,(i))

Definition at line 218 of file minilua.c.

◆ cast_num

#define cast_num (   i)    cast(lua_Number,(i))

Definition at line 217 of file minilua.c.

◆ ceillog2

#define ceillog2 (   x)    (luaO_log2((x)-1)+1)

Definition at line 371 of file minilua.c.

◆ changewhite

#define changewhite (   x)    ((x)->gch.marked^=bit2mask(0,1))

Definition at line 576 of file minilua.c.

◆ char2int

#define char2int (   c)    cast(int,cast(unsigned char,(c)))

Definition at line 392 of file minilua.c.

◆ check_condition

#define check_condition (   ls,
  c,
  msg 
)    {if(!(c))luaX_syntaxerror(ls,msg);}

Definition at line 3699 of file minilua.c.

◆ check_exp

#define check_exp (   c,
  e 
)    (e)

Definition at line 213 of file minilua.c.

◆ checkconsistency

#define checkconsistency (   obj)

Definition at line 256 of file minilua.c.

◆ checkliveness

#define checkliveness (   g,
  obj 
)

Definition at line 257 of file minilua.c.

◆ checkresults

#define checkresults (   L,
  na,
  nr 
)    luai_apicheck(L,(nr)==(-1)||(L->ci->top-L->top>=(nr)-(na)))

Definition at line 5752 of file minilua.c.

◆ ci_func

#define ci_func (   ci)    (clvalue((ci)->func))

Definition at line 431 of file minilua.c.

◆ clvalue

#define clvalue (   o)    check_exp(ttisfunction(o),&(o)->value.gc->cl)

Definition at line 251 of file minilua.c.

◆ condhardstacktests

#define condhardstacktests (   x)    ((void)0)

Definition at line 220 of file minilua.c.

◆ CREATE_ABC

#define CREATE_ABC (   o,
  a,
  b,
  c 
)    ((cast(Instruction,o)<<0)|(cast(Instruction,a)<<(0+6))|(cast(Instruction,b)<<(((0+6)+8)+9))|(cast(Instruction,c)<<((0+6)+8)))

Definition at line 941 of file minilua.c.

◆ CREATE_ABx

#define CREATE_ABx (   o,
  a,
  bc 
)    ((cast(Instruction,o)<<0)|(cast(Instruction,a)<<(0+6))|(cast(Instruction,bc)<<((0+6)+8)))

Definition at line 942 of file minilua.c.

◆ curr_func

#define curr_func (   L)    (clvalue(L->ci->func))

Definition at line 430 of file minilua.c.

◆ currIsNewline

#define currIsNewline (   ls)    (ls->current=='\n'||ls->current=='\r')

Definition at line 2661 of file minilua.c.

◆ dojump

#define dojump (   L,
  pc,
  i 
)    {(pc)+=(i);}

Definition at line 4941 of file minilua.c.

◆ equalobj

#define equalobj (   L,
  o1,
  o2 
)    (ttype(o1)==ttype(o2)&&luaV_equalval(L,o1,o2))

Definition at line 598 of file minilua.c.

◆ f_isLua

#define f_isLua (   ci)    (!ci_func(ci)->c.isC)

Definition at line 432 of file minilua.c.

◆ fasttm

#define fasttm (   l,
  et,
  e 
)    gfasttm(G(l),et,e)

Definition at line 374 of file minilua.c.

◆ fromstate

#define fromstate (   l)    (cast(lu_byte*,(l))-0)

Definition at line 2257 of file minilua.c.

◆ G

#define G (   L)    (L->l_G)

Definition at line 489 of file minilua.c.

◆ gco2cl

#define gco2cl (   o)    check_exp((o)->gch.tt==6,&((o)->cl))

Definition at line 504 of file minilua.c.

◆ gco2h

#define gco2h (   o)    check_exp((o)->gch.tt==5,&((o)->h))

Definition at line 505 of file minilua.c.

◆ gco2p

#define gco2p (   o)    check_exp((o)->gch.tt==(8+1),&((o)->p))

Definition at line 506 of file minilua.c.

◆ gco2th

#define gco2th (   o)    check_exp((o)->gch.tt==8,&((o)->th))

Definition at line 509 of file minilua.c.

◆ gco2ts

#define gco2ts (   o)    (&rawgco2ts(o)->tsv)

Definition at line 501 of file minilua.c.

◆ gco2u

#define gco2u (   o)    (&rawgco2u(o)->uv)

Definition at line 503 of file minilua.c.

◆ gco2uv

#define gco2uv (   o)    check_exp((o)->gch.tt==(8+2),&((o)->uv))

Definition at line 507 of file minilua.c.

◆ gcvalue

#define gcvalue (   o)    check_exp(iscollectable(o),(o)->value.gc)

Definition at line 244 of file minilua.c.

◆ GET_OPCODE

#define GET_OPCODE (   i)    (cast(OpCode,((i)>>0)&MASK1(6,0)))

Definition at line 929 of file minilua.c.

◆ GETARG_A

#define GETARG_A (   i)    (cast(int,((i)>>(0+6))&MASK1(8,0)))

Definition at line 931 of file minilua.c.

◆ GETARG_B

#define GETARG_B (   i)    (cast(int,((i)>>(((0+6)+8)+9))&MASK1(9,0)))

Definition at line 933 of file minilua.c.

◆ GETARG_Bx

#define GETARG_Bx (   i)    (cast(int,((i)>>((0+6)+8))&MASK1((9+9),0)))

Definition at line 937 of file minilua.c.

◆ GETARG_C

#define GETARG_C (   i)    (cast(int,((i)>>((0+6)+8))&MASK1(9,0)))

Definition at line 935 of file minilua.c.

◆ GETARG_sBx

#define GETARG_sBx (   i)    (GETARG_Bx(i)-(((1<<(9+9))-1)>>1))

Definition at line 939 of file minilua.c.

◆ getBMode

#define getBMode (   m)    (cast(enum OpArgMask,(luaP_opmodes[m]>>4)&3))

Definition at line 947 of file minilua.c.

◆ getCMode

#define getCMode (   m)    (cast(enum OpArgMask,(luaP_opmodes[m]>>2)&3))

Definition at line 948 of file minilua.c.

◆ getcode

#define getcode (   fs,
  e 
)    ((fs)->f->code[(e)->u.s.info])

Definition at line 2389 of file minilua.c.

◆ getline_

#define getline_ (   f,
  pc 
)    (((f)->lineinfo)?(f)->lineinfo[pc]:0)

Definition at line 513 of file minilua.c.

◆ getlocvar

#define getlocvar (   fs,
  i 
)    ((fs)->f->locvars[(fs)->actvar[i]])

Definition at line 3656 of file minilua.c.

◆ getstr

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

Definition at line 280 of file minilua.c.

◆ gfasttm

#define gfasttm (   g,
  et,
  e 
)    ((et)==NULL?NULL:((et)->flags&(1u<<(e)))?NULL:luaT_gettm(et,e,(g)->tmname[e]))

Definition at line 373 of file minilua.c.

◆ gkey

#define gkey (   n)    (&(n)->i_key.nk)

Definition at line 765 of file minilua.c.

◆ gnext

#define gnext (   n)    ((n)->i_key.nk.next)

Definition at line 767 of file minilua.c.

◆ gnode

#define gnode (   t,
  i 
)    (&(t)->node[i])

Definition at line 764 of file minilua.c.

◆ gray2black

#define gray2black (   x)    l_setbit((x)->gch.marked,2)

Definition at line 577 of file minilua.c.

◆ gt

#define gt (   L)    (&L->l_gt)

Definition at line 415 of file minilua.c.

◆ gval

#define gval (   n)    (&(n)->i_val)

Definition at line 766 of file minilua.c.

◆ hashboolean

#define hashboolean (   t,
  p 
)    hashpow2(t,p)

Definition at line 1340 of file minilua.c.

◆ hashmod

#define hashmod (   t,
  n 
)    (gnode(t,((n)%((sizenode(t)-1)|1))))

Definition at line 1341 of file minilua.c.

◆ hashpointer

#define hashpointer (   t,
  p 
)    hashmod(t,IntPoint(p))

Definition at line 1342 of file minilua.c.

◆ hashpow2

#define hashpow2 (   t,
  n 
)    (gnode(t,lmod((n),sizenode(t))))

Definition at line 1338 of file minilua.c.

◆ hashstr

#define hashstr (   t,
  str 
)    hashpow2(t,(str)->tsv.hash)

Definition at line 1339 of file minilua.c.

◆ hasjumps

#define hasjumps (   e)    ((e)->t!=(e)->f)

Definition at line 2996 of file minilua.c.

◆ hasmultret

#define hasmultret (   k)    ((k)==VCALL||(k)==VVARARG)

Definition at line 3655 of file minilua.c.

◆ hvalue

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

Definition at line 252 of file minilua.c.

◆ inc_ci

#define inc_ci (   L)    ((L->ci==L->end_ci)?growCI(L):(condhardstacktests(luaD_reallocCI(L,L->size_ci)),++L->ci))

Definition at line 1124 of file minilua.c.

◆ incr_top

#define incr_top (   L)    {luaD_checkstack(L,1);L->top++;}

Definition at line 519 of file minilua.c.

◆ INDEXK

#define INDEXK (   r)    ((int)(r)&~(1<<(9-1)))

Definition at line 944 of file minilua.c.

◆ IntPoint

#define IntPoint (   p)    ((unsigned int)(lu_mem)(p))

Definition at line 210 of file minilua.c.

◆ isblack

#define isblack (   x)    testbit((x)->gch.marked,2)

Definition at line 572 of file minilua.c.

◆ iscfunction

#define iscfunction (   o)    (ttype(o)==6&&clvalue(o)->c.isC)

Definition at line 344 of file minilua.c.

◆ iscollectable

#define iscollectable (   o)    (ttype(o)>=4)

Definition at line 269 of file minilua.c.

◆ isdead

#define isdead (   g,
  v 
)    ((v)->gch.marked&otherwhite(g)&bit2mask(0,1))

Definition at line 575 of file minilua.c.

◆ isfinalized

#define isfinalized (   u)    testbit((u)->marked,3)

Definition at line 1723 of file minilua.c.

◆ isgray

#define isgray (   x)    (!isblack(x)&&!iswhite(x))

Definition at line 573 of file minilua.c.

◆ ISK

#define ISK (   x)    ((x)&(1<<(9-1)))

Definition at line 943 of file minilua.c.

◆ isLua

#define isLua (   ci)    (ttisfunction((ci)->func)&&f_isLua(ci))

Definition at line 433 of file minilua.c.

◆ iswhite

#define iswhite (   x)    test2bits((x)->gch.marked,0,1)

Definition at line 571 of file minilua.c.

◆ KBx

Definition at line 4940 of file minilua.c.

◆ key2tval

#define key2tval (   n)    (&(n)->i_key.tvk)

Definition at line 768 of file minilua.c.

◆ l_isfalse

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

Definition at line 255 of file minilua.c.

◆ l_setbit

#define l_setbit (   x,
  b 
)    setbits(x,bitmask(b))

Definition at line 565 of file minilua.c.

◆ leavelevel

#define leavelevel (   ls)    ((ls)->L->nCcalls--)

Definition at line 3840 of file minilua.c.

◆ lmod

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

Definition at line 367 of file minilua.c.

◆ lua_isboolean

#define lua_isboolean (   L,
  n 
)    (lua_type(L,(n))==1)

Definition at line 185 of file minilua.c.

<