当前位置: 首页>>代码示例>>C++>>正文


C++ singlevaraux函数代码示例

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


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

示例1: singlevar

static void singlevar (LexState *ls, expdesc *var) {
  TString *varname = str_checkname(ls);
  FuncState *fs = ls->fs;
  if (singlevaraux(fs, varname, var) == VVOID) {  /* global name? */
    expdesc key;
    singlevaraux(fs, ls->envn, var);  /* get environment variable */
    lua_assert(var->k == VLOCAL || var->k == VUPVAL);
    codestring(ls, &key, varname);  /* key is variable name */
    luaK_indexed(fs, var, &key);  /* env[varname] */
  }
}
开发者ID:hongzhidao,项目名称:yet-another-lua,代码行数:11,代码来源:lparser.c

示例2: singlevar

static void singlevar(ktap_lexstate *ls, ktap_expdesc *var)
{
	ktap_string *varname = str_checkname(ls);
	ktap_funcstate *fs = ls->fs;

	if (singlevaraux(fs, varname, var, 1) == VVOID) {  /* global name? */
		ktap_expdesc key;
		singlevaraux(fs, ls->envn, var, 1);  /* get environment variable */
		ktap_assert(var->k == VLOCAL || var->k == VUPVAL);
		codestring(ls, &key, varname);  /* key is variable name */
		codegen_indexed(fs, var, &key);  /* env[varname] */
	}
}
开发者ID:chubbymaggie,项目名称:ktap,代码行数:13,代码来源:parser.c

示例3: singlevaraux

/*
  Find variable with given name 'n'. If it is an upvalue, add this
  upvalue into all intermediate functions.
*/
static int singlevaraux (FuncState *fs, TString *n, expdesc *var) {
  if (fs == NULL)  /* no more levels? */
    return VVOID;  /* default is global */
  else {
  	LexState *ls = fs->ls;
    int v = searchvar(fs, n);  /* look up locals at current level */
    if (v >= 0) {  /* found? */
      init_exp(var, VLOCAL, v);  /* variable is local */
      return VLOCAL;
    }
    else {  /* not found as local at current level; try upvalues */
	  if (ls->t.token != '(') {
    	new_localvar(ls, n);
        init_exp(var, VLOCAL, fs->nlocvars - 1);  /* variable is local */
        return VLOCAL;
	  }
      int idx = searchupvalue(fs, n);  /* try existing upvalues */
      if (idx < 0) {  /* not found? */
        if (singlevaraux(fs->prev, n, var) == VVOID) /* try upper levels */
          return VVOID;  /* not found; is a global */
        /* else was LOCAL or UPVAL */
        idx  = newupvalue(fs, n, var);  /* will be a new upvalue */
      }
      init_exp(var, VUPVAL, idx);
      return VUPVAL;
    }
  }
}
开发者ID:hongzhidao,项目名称:yet-another-lua,代码行数:32,代码来源:lparser.c

示例4: singlevar

static void singlevar(LexState* ls, expdesc* var)
{
	TString* varname = str_checkname(ls);
	FuncState* fs = ls->fs;
	if (singlevaraux(fs, varname, var, 1) == VGLOBAL)
		var->u.s.info = luaK_stringK(fs, varname);	/* info points to global name */
}
开发者ID:Ape,项目名称:DCPUToolchain,代码行数:7,代码来源:lparser.c

示例5: singlevaraux

static int singlevaraux(FuncState* fs, TString* n, expdesc* var, int base)
{
	if (fs == NULL)	   /* no more levels? */
	{
		init_exp(var, VGLOBAL, NO_REG);	 /* default is global variable */
		return VGLOBAL;
	}
	else
	{
		int v = searchvar(fs, n);  /* look up at current level */
		if (v >= 0)
		{
			init_exp(var, VLOCAL, v);
			if (!base)
				markupval(fs, v);  /* local will be used as an upval */
			return VLOCAL;
		}
		else	/* not found at current level; try upper one */
		{
			if (singlevaraux(fs->prev, n, var, 0) == VGLOBAL)
				return VGLOBAL;
			var->u.s.info = indexupvalue(fs, n, var);	 /* else was LOCAL or UPVAL */
			var->k = VUPVAL;	/* upvalue in this level */
			return VUPVAL;
		}
	}
}
开发者ID:Ape,项目名称:DCPUToolchain,代码行数:27,代码来源:lparser.c

示例6: singlevaraux

/*
   Find variable with given name 'n'. If it is an upvalue, add this
   upvalue into all intermediate functions.
 */
static int singlevaraux(FuncState *fs, TString *n, expdesc *var, int base)
{
    if (fs == NULL) /* no more levels? */
        return VVOID; /* default is global */
    else
    {
        int v = searchvar(fs, n); /* look up locals at current level */
        if (v >= 0) /* found? */
        {
            init_exp(var, VLOCAL, v); /* variable is local */
            if (!base)
                markupval(fs, v); /* local will be used as an upval */

            return VLOCAL;
        }
        else /* not found as local at current level; try upvalues */
        {
            int idx = searchupvalue(fs, n); /* try existing upvalues */
            if (idx < 0) /* not found? */
            {
                if (singlevaraux(fs->prev, n, var, 0) == VVOID) /* try upper levels */
                    return VVOID; /* not found; is a global */

                /* else was LOCAL or UPVAL */
                idx = newupvalue(fs, n, var); /* will be a new upvalue */
            }

            init_exp(var, VUPVAL, idx);
            return VUPVAL;
        }
    }
}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:36,代码来源:lparser.c

示例7: singlevar

static void singlevar (LexState *ls, expdesc *var) {
  TString *varname = str_checkname(ls);
  FuncState *fs = ls->fs;
  if (singlevaraux(fs, varname, var, 1) == VGLOBAL)
  {
    var->u.s.info = luaK_stringK(fs, varname);  /* info points to global name */
#ifdef LUA_UTILITIES_NET
    GetGlobal(varname, ls);
#endif
  }
}
开发者ID:arsaccol,项目名称:SLED,代码行数:11,代码来源:lparser.c

示例8: singlevaraux

static void singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) {
  if (fs == NULL)  /* no more levels? */
    init_exp(var, VGLOBAL, NO_REG);  /* default is global variable */
  else {
    int v = searchvar(fs, n);  /* look up at current level */
    if (v >= 0) {
      init_exp(var, VLOCAL, v);
      if (!base)
        markupval(fs, v);  /* local will be used as an upval */
    }
    else {  /* not found at current level; try upper one */
      singlevaraux(fs->prev, n, var, 0);
      if (var->k == VGLOBAL) {
        if (base)
          var->info = luaK_stringK(fs, n);  /* info points to global name */
      }
      else {  /* LOCAL or UPVAL */
        var->info = indexupvalue(fs, n, var);
        var->k = VUPVAL;  /* upvalue in this level */
      }
    }
  }
}
开发者ID:BitMax,项目名称:openitg,代码行数:23,代码来源:lparser.c

示例9: str_checkname

static TString *singlevar (LexState *ls, expdesc *var, int base) {
  TString *varname = str_checkname(ls);
  singlevaraux(ls->fs, varname, var, base);
  return varname;
}
开发者ID:BitMax,项目名称:openitg,代码行数:5,代码来源:lparser.c


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