• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ sizeCclosure函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中sizeCclosure函数的典型用法代码示例。如果您正苦于以下问题:C++ sizeCclosure函数的具体用法?C++ sizeCclosure怎么用?C++ sizeCclosure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sizeCclosure函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: freeobj

static void freeobj (lua_State *L, GCObject *o) {
  switch (o->tt) {
    case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break;
    case LUA_TLCL: {
      freeLclosure(L, gco2lcl(o));
      break;
    }
    case LUA_TCCL: {
      luaM_freemem(L, o, sizeCclosure(gco2ccl(o)->nupvalues));
      break;
    }
    case LUA_TTABLE: luaH_free(L, gco2t(o)); break;
    case LUA_TTHREAD: luaE_freethread(L, gco2th(o)); break;
    case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break;
    case LUA_TSHRSTR:
      luaS_remove(L, gco2ts(o));  /* remove it from hash table */
      luaM_freemem(L, o, sizelstring(gco2ts(o)->shrlen));
      break;
    case LUA_TLNGSTR: {
      luaM_freemem(L, o, sizelstring(gco2ts(o)->u.lnglen));
      break;
    }
    default: lua_assert(0);
  }
}
开发者ID:charleeli,项目名称:srpc,代码行数:25,代码来源:lgc.c


示例2: freeobj

static void freeobj (lua_State *L, GCObject *o) {
	switch (gch(o)->tt) {
	case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break;
	case LUA_TLCL: {
		luaM_freemem(L, o, sizeLclosure(gco2lcl(o)->nupvalues));
		break;
	}
	case LUA_TCCL: {
		luaM_freemem(L, o, sizeCclosure(gco2ccl(o)->nupvalues));
		break;
	}
	case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break;
	case LUA_TTABLE: luaH_free(L, gco2t(o)); break;
	case LUA_TTHREAD: luaE_freethread(L, gco2th(o)); break;
	case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break;
	case LUA_TSHRSTR:
		G(L)->strt.nuse--;
		/* go through */
	case LUA_TLNGSTR: {
		luaM_freemem(L, o, sizestring(gco2ts(o)));
		break;
	}
	default: lua_assert(0);
	}
}
开发者ID:crazii,项目名称:mameplus,代码行数:25,代码来源:lgc.c


示例3: debug_getsize

int debug_getsize(lua_State* L)
{
  TValue* o = L->base;
  switch (o->tt) {
    /* Container types */
    case LUA_TTABLE: {
      Table *h = hvalue(o);
      lua_pushinteger(L, sizeof(Table) + sizeof(TValue) * h->sizearray +
                             sizeof(Node) * sizenode(h));
      break;
    }
    case LUA_TFUNCTION: {
      Closure *cl = clvalue(o);
      lua_pushinteger(L, (cl->c.isC) ? sizeCclosure(cl->c.nupvalues) :
                           sizeLclosure(cl->l.nupvalues));
      break;
    }
    case LUA_TTHREAD: {
      lua_State *th = thvalue(o);
      lua_pushinteger(L, sizeof(lua_State) + sizeof(TValue) * th->stacksize +
                                 sizeof(CallInfo) * th->size_ci);
      break;
    }
    case LUA_TPROTO: {
      Proto *p = pvalue(o);
      lua_pushinteger(L, sizeof(Proto) + sizeof(Instruction) * p->sizecode +
                             sizeof(Proto *) * p->sizep +
                             sizeof(TValue) * p->sizek + 
                             sizeof(int) * p->sizelineinfo +
                             sizeof(LocVar) * p->sizelocvars +
                             sizeof(TString *) * p->sizeupvalues);
     break;
    }
    /* Non-containers */
    case LUA_TUSERDATA: {
      lua_pushnumber(L, uvalue(o)->len);
      break;
    }
    case LUA_TLIGHTUSERDATA: {
      lua_pushnumber(L, sizeof(void*));
      break;
    }
    case LUA_TSTRING: {
      TString *s = rawtsvalue(o);
      lua_pushinteger(L, sizeof(TString) + s->tsv.len + 1);
      break;
    }
    case LUA_TNUMBER: {
      lua_pushinteger(L, sizeof(lua_Number));
      break;
    }
    case LUA_TBOOLEAN: {
      lua_pushinteger(L, sizeof(int));
      break;
    }
    default: return 0;
  }
  return 1;
}
开发者ID:987690183,项目名称:selfNote,代码行数:59,代码来源:getsize.c


示例4: propagatemark

/*
** traverse one gray object, turning it to black.
** Returns `quantity' traversed.
*/
static l_mem propagatemark (global_State *g) {
  GCObject *o = g->gray;
  lua_assert(isgray(o));
  gray2black(o);
  switch (o->gch.tt) {
    case LUA_TTABLE: {
      Table *h = gco2h(o);
      g->gray = h->gclist;
      if (traversetable(g, h))  /* table is weak? */
        black2gray(o);  /* keep it gray */
      return sizeof(Table) + sizeof(TValue) * h->sizearray +
                             sizeof(Node) * sizenode(h);
    }
    case LUA_TFUNCTION: {
      Closure *cl = gco2cl(o);
      g->gray = cl->c.gclist;
      traverseclosure(g, cl);
      return (cl->c.isC) ? sizeCclosure(cl->c.nupvalues) :
                           sizeLclosure(cl->l.nupvalues);
    }
    case LUA_TTHREAD: {
      lua_State *th = gco2th(o);
      g->gray = th->gclist;
      th->gclist = g->grayagain;
      g->grayagain = o;
      black2gray(o);
      traversestack(g, th);
      return sizeof(lua_State) + sizeof(TValue) * th->stacksize +
                                 sizeof(CallInfo) * th->size_ci;
    }
    case LUA_TPROTO: {
      Proto *p = gco2p(o);
      g->gray = p->gclist;
      traverseproto(g, p);
      return sizeof(Proto) + sizeof(Instruction) * p->sizecode +
                             sizeof(Proto *) * p->sizep +
                             sizeof(TValue) * p->sizek + 
                             sizeof(int) * p->sizelineinfo +
                             sizeof(LocVar) * p->sizelocvars +
                             sizeof(TString *) * p->sizeupvalues;
    }
    default: lua_assert(0); return 0;
  }
}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:48,代码来源:lgc.c


示例5: sizeCclosure

Closure *luaF_newCclosure (lua_State *L, int n) {
  Closure *c = &luaC_newobj(L, LUA_TCCL, sizeCclosure(n), NULL, 0)->cl;
  c->c.nupvalues = cast_byte(n);
  return c;
}
开发者ID:iVideo,项目名称:weishao,代码行数:5,代码来源:lfunc.c


示例6: luaF_freeclosure

void luaF_freeclosure (lua_State *L, Closure *c) {
  int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) :
                          sizeLclosure(c->l.nupvalues);
  luaM_freemem(L, c, size);
}
开发者ID:minlexx,项目名称:l2-unlegits,代码行数:5,代码来源:lfunc.c


示例7: traverseCclosure

static lu_mem traverseCclosure (global_State *g, CClosure *cl) {
  int i;
  for (i = 0; i < cl->nupvalues; i++)  /* mark its upvalues */
    markvalue(g, &cl->upvalue[i]);
  return sizeCclosure(cl->nupvalues);
}
开发者ID:charleeli,项目名称:srpc,代码行数:6,代码来源:lgc.c


示例8: luaC_newobj

CClosure *luaF_newCclosure (lua_State *L, int n) {
  GCObject *o = luaC_newobj(L, LUA_TCCL, sizeCclosure(n));
  CClosure *c = gco2ccl(o);
  c->nupvalues = cast_byte(n);
  return c;
}
开发者ID:141141,项目名称:nodemcu-firmware-lua5.3.0,代码行数:6,代码来源:lfunc.c



注:本文中的sizeCclosure函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sizeDynArr函数代码示例发布时间:2022-05-30
下一篇:
C++ size函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap