本文整理汇总了C++中removevars函数的典型用法代码示例。如果您正苦于以下问题:C++ removevars函数的具体用法?C++ removevars怎么用?C++ removevars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了removevars函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: close_func
static void close_func (LexState *ls) {
lua_State *L = ls->L;
FuncState *fs = ls->fs;
Proto *f = fs->f;
removevars(ls, 0);
luaK_codeABC(fs, OP_RETURN, 0, 1, 0); /* final return */
luaM_setname(L, "Lua_parser_code");
luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction);
f->sizecode = fs->pc;
luaM_setname(L, "Lua_parser_lineinfo");
luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int);
f->sizelineinfo = fs->pc;
luaM_setname(L, "Lua_parser_constants");
luaM_reallocvector(L, f->k, f->sizek, fs->nk, TObject);
f->sizek = fs->nk;
luaM_setname(L, "Lua_parser_proto");
luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *);
f->sizep = fs->np;
luaM_setname(L, "Lua_parser_locals");
luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar);
f->sizelocvars = fs->nlocvars;
luaM_setname(L, "Lua_parser_upvalues");
luaM_reallocvector(L, f->upvalues, f->sizeupvalues, f->nups, TString *);
f->sizeupvalues = f->nups;
lua_assert(luaG_checkcode(f));
lua_assert(fs->bl == NULL);
ls->fs = fs->prev;
#if LUA_REFCOUNT
__ReleaseDirect(L, (GCObject*)fs->h);
#endif LUA_REFCOUNT
}
示例2: close_func
static void close_func (LexState *ls) {
lua_State *L = ls->L;
FuncState *fs = ls->fs;
Proto *f = fs->f;
removevars(ls, 0);
luaK_ret(fs, 0, 0); /* final return */
luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction);
f->sizecode = fs->pc;
luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int);
f->sizelineinfo = fs->pc;
luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue);
f->sizek = fs->nk;
luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *);
f->sizep = fs->np;
luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar);
f->sizelocvars = fs->nlocvars;
luaM_reallocvector(L, f->upvalues, f->sizeupvalues, f->nups, TString *);
f->sizeupvalues = f->nups;
lua_assert(luaG_checkcode(f));
lua_assert(fs->bl == NULL);
ls->fs = fs->prev;
L->top -= 2; /* remove table and prototype from the stack */
/* last token read was anchored in defunct function; must reanchor it */
if (fs) anchor_token(ls);
}
示例3: leaveblock
static void leaveblock(ktap_funcstate *fs)
{
ktap_blockcnt *bl = fs->bl;
ktap_lexstate *ls = fs->ls;
if (bl->previous && bl->upval) {
/* create a 'jump to here' to close upvalues */
int j = codegen_jump(fs);
codegen_patchclose(fs, j, bl->nactvar);
codegen_patchtohere(fs, j);
}
if (bl->isloop)
breaklabel(ls); /* close pending breaks */
fs->bl = bl->previous;
removevars(fs, bl->nactvar);
ktap_assert(bl->nactvar == fs->nactvar);
fs->freereg = fs->nactvar; /* free registers */
ls->dyd->label.n = bl->firstlabel; /* remove local labels */
if (bl->previous) /* inner block? */
movegotosout(fs, bl); /* update pending gotos to outer block */
else if (bl->firstgoto < ls->dyd->gt.n) /* pending gotos in outer block? */
undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]); /* error */
}
示例4: leaveblock
static void leaveblock (FuncState *fs) {
BlockCnt *bl = fs->bl;
fs->bl = bl->previous;
removevars(fs->ls, bl->nactvar);
if (bl->upval)
luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0);
lua_assert(bl->nactvar == fs->nactvar);
fs->freereg = fs->nactvar; /* free registers */
luaK_patchtohere(fs, bl->breaklist);
}
示例5: leaveblock
static void leaveblock (FuncState *fs) {
BlockCnt *bl = fs->bl;
fs->bl = bl->previous;
removevars(fs->ls, bl->nactvar);
if (bl->upval)
luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0);
/* a block either controls scope or breaks (never both) */
lua_assert(!bl->isbreakable || !bl->upval);
lua_assert(bl->nactvar == fs->nactvar);
fs->freereg = fs->nactvar; /* free registers */
luaK_patchtohere(fs, bl->breaklist);
}
示例6: close_func
static void close_func (LexState *ls) {
lua_State *L = ls->L;
FuncState *fs = ls->fs;
Proto *f = fs->f;
removevars(ls, 0);
luaK_ret(fs, 0, 0); /* final return */
#if LUA_MEMORY_STATS
luaM_setname(L, "lua.parser.code");
#endif /* LUA_MEMORY_STATS */
luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction);
f->sizecode = fs->pc;
#if LUA_MEMORY_STATS
luaM_setname(L, "lua.parser.lineinfo");
#endif /* LUA_MEMORY_STATS */
luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int);
f->sizelineinfo = fs->pc;
#if LUA_MEMORY_STATS
luaM_setname(L, "lua.parser.constants");
#endif /* LUA_MEMORY_STATS */
luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue);
f->sizek = fs->nk;
#if LUA_MEMORY_STATS
luaM_setname(L, "lua.parser.proto");
#endif /* LUA_MEMORY_STATS */
luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *);
f->sizep = fs->np;
#if LUA_MEMORY_STATS
luaM_setname(L, "lua.parser.locals");
#endif /* LUA_MEMORY_STATS */
luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar);
f->sizelocvars = fs->nlocvars;
#if LUA_MEMORY_STATS
luaM_setname(L, "lua.parser.upvalues");
#endif /* LUA_MEMORY_STATS */
luaM_reallocvector(L, f->upvalues, f->sizeupvalues, f->nups, TString *);
#if LUA_MEMORY_STATS
luaM_setname(L, 0);
#endif /* LUA_MEMORY_STATS */
f->sizeupvalues = f->nups;
lua_assert(luaG_checkcode(f));
lua_assert(fs->bl == NULL);
ls->fs = fs->prev;
L->top -= 2; /* remove table and prototype from the stack */
/* last token read was anchored in defunct function; must reanchor it */
if (fs) anchor_token(ls);
#if LUA_REFCOUNT
setnilvalue(L->top + 1);
setnilvalue(L->top);
luarc_releasetable(L, fs->h);
#endif /* LUA_REFCOUNT */
}
示例7: close_func
static void close_func (LexState *ls) {
lua_State *L = ls->L;
global_State *g = G(L);
FuncState *fs = ls->fs;
Proto *f = fs->f;
removevars(ls, 0);
luaK_ret(fs, 0, 0); /* final return */
luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction);
f->sizecode = fs->pc;
if ( g->storedebug ) /* save memory when debugger will not be used */
{
luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int);
f->sizelineinfo = fs->pc;
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:14,代码来源:lparser.c
示例8: luaK_jump
/*static*/ void FuncState::leaveblock (/*FuncState *fs*/) {
//BlockCnt *bl = fs->bl;
//LexState *ls = fs->ls;
if (bl->previous && bl->upval) {
/* create a 'jump to here' to close upvalues */
int j = luaK_jump();
luaK_patchclose(j, bl->nactvar);
luaK_patchtohere(j);
}
if (bl->isloop)
ls->breaklabel(); /* close pending breaks */
bl = bl->previous;
removevars(bl->nactvar);
lua_assert(bl->nactvar == nactvar);
free_reg = nactvar; /* free registers */
ls->dyd->label.n = bl->firstlabel; /* remove local labels */
if (bl->previous) /* inner block? */
movegotosout(bl); /* update pending gotos to outer block */
else if (bl->firstgoto < ls->dyd->gt.n) /* pending gotos in outer block? */
ls->undefgoto(&ls->dyd->gt.arr[bl->firstgoto]); /* error */
}
示例9: close_func
static void close_func (LexState *ls) {
lua_State *L = ls->L;
FuncState *fs = ls->fs;
Proto *f = fs->f;
removevars(ls, 0);
luaK_codeABC(fs, OP_RETURN, 0, 1, 0); /* final return */
luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction);
f->sizecode = fs->pc;
luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int);
f->sizelineinfo = fs->pc;
luaM_reallocvector(L, f->k, f->sizek, fs->nk, TObject);
f->sizek = fs->nk;
luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *);
f->sizep = fs->np;
luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar);
f->sizelocvars = fs->nlocvars;
luaM_reallocvector(L, f->upvalues, f->sizeupvalues, f->nups, TString *);
f->sizeupvalues = f->nups;
lua_assert(luaG_checkcode(f));
lua_assert(fs->bl == NULL);
ls->fs = fs->prev;
}
示例10: leaveblock
static void leaveblock (FuncState *fs)
{
BlockCnt *bl = (BlockCnt*)fs->blockList.GetFirst();
// Remove the current block from visibility.
fs->blockList.RemoveFirst();
removevars(fs->ls, bl->nactvar);
if ( bl->upval )
{
luaK_codeABC( fs, OP_CLOSE, bl->nactvar, 0, 0 );
}
/* a block either controls scope or breaks (never both) */
lua_assert(!bl->isbreakable || !bl->upval);
lua_assert(bl->nactvar == fs->nactvar);
fs->freereg = fs->nactvar; /* free registers */
luaK_patchtohere(fs, bl->breaklist);
}
示例11: close_func
static void close_func (LexState *ls)
{
lua_State *L = ls->L;
FuncState *fs = (FuncState*)ls->fsList.GetFirst();
Proto *f = fs->f;
removevars(ls, 0);
luaK_ret(fs, 0, 0); /* final return */
luaM_reallocvector(L, f->code, f->sizecode, fs->pc);
f->sizecode = fs->pc;
luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc);
f->sizelineinfo = fs->pc;
luaM_reallocvector(L, f->k, f->sizek, fs->nk);
f->sizek = fs->nk;
luaM_reallocvector(L, f->p, f->sizep, fs->np);
f->sizep = fs->np;
luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars);
f->sizelocvars = fs->nlocvars;
luaM_reallocvector(L, f->upvalues, f->sizeupvalues, f->nups);
f->sizeupvalues = f->nups;
lua_assert(luaG_checkcode(f) == true);
lua_assert(fs->blockList.IsEmpty() == true);
// Remove this function state from existence.
ls->fsList.RemoveFirst();
// Dereference the table again.
// We keep the reference on the proto, because it is the result object.
fs->h->DereferenceGC( L );
/* last token read was anchored in defunct function; must reanchor it */
if ( fs )
{
anchor_token(ls);
}
}