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


C++ setVar函数代码示例

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


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

示例1: _getVar

static inline Int
_getVar(Equation e, Var var, va_list args) /* Var, Int, Var, Int, ... */
{ int argc, i;
  Var vars[FWD_PCE_MAX_ARGS];
  Any vals[FWD_PCE_MAX_ARGS];
  Any savd[FWD_PCE_MAX_ARGS];
  numeric_value v;

  for(argc = 0; (vars[argc] = va_arg(args, Var)) != NULL; argc++)
  { assert(argc <= FWD_PCE_MAX_ARGS);
    assert(instanceOfObject(vars[argc], ClassVar));

    vals[argc] = va_arg(args, Expression);
    assert(vals[argc] != NULL);
  }

  for(i=0; i<argc; i++)
  { savd[i] = vars[i]->value;
    setVar(vars[i], vals[i]);
  }

  evaluateEquation(e, var, &v);

  for(i=0; i<argc; i++)
    setVar(vars[i], savd[i]);

  return ar_int_result(e, &v);
}
开发者ID:SWI-Prolog,项目名称:packages-xpce,代码行数:28,代码来源:spatial.c

示例2: put_new_attvar

static void
put_new_attvar(Word p, atom_t name, Word value ARG_LD)
{ Word gp, at;

  assert(gTop+6 <= gMax && tTop+1 <= tMax);

  gp = gTop;
  if ( p >= (Word)lBase )
  { gTop += 6;
    at = &gp[1];
    setVar(*at);
    gp[0] = consPtr(&gp[1], TAG_ATTVAR|STG_GLOBAL);
    *p = makeRefG(&gp[0]);
    LTrail(p);
  } else
  { gTop += 5;
    at = &gp[0];
    setVar(*at);
    *p = consPtr(&gp[0], TAG_ATTVAR|STG_GLOBAL);
    GTrail(p);
  }

  at[1] = FUNCTOR_att3;
  at[2] = name;
  at[3] = linkVal(value);
  at[4] = ATOM_nil;
  at[0] = consPtr(&at[1], TAG_COMPOUND|STG_GLOBAL);
}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:28,代码来源:pl-attvar.c

示例3: exitCyclicCopy

static inline void
exitCyclicCopy(int flags ARG_LD)
{ Word p;

  while(popSegStack(&LD->cycle.lstack, &p, Word))
  { if ( isRef(*p) )
    { Word p2 = unRef(*p);

      if ( *p2 == VAR_MARK )		/* sharing variables */
      { setVar(*p2);
	setVar(*p);
      } else
      { *p = *p2 | MARK_MASK;		/* cyclic terms */
      }
    } else
    { Word old;

      popSegStack(&LD->cycle.lstack, &old, Word);

      if ( !(flags&COPY_ATTRS) )
      { Word p2 = valPAttVar(*p & ~BOTH_MASK);

	assert(*p2 == VAR_MARK);
	setVar(*p2);
      }

      *p = consPtr(old, STG_GLOBAL|TAG_ATTVAR);
    }
  }
}
开发者ID:DouglasRMiles,项目名称:swipl-devel,代码行数:30,代码来源:pl-copyterm.c

示例4: snprintf

bool agi::hangup(int cause) 
{
	char cause_str[16];
	snprintf(cause_str,sizeof(cause_str),"%i",cause);
	setVar("PRI_CAUSE",cause_str);
	return (exec("HANGUP")==1);
}
开发者ID:olivecoder,项目名称:cppagi,代码行数:7,代码来源:cppagi.cpp

示例5: lookup

//------------------------------------------------------------------------------
int lookup(int *typeOfObject)
{
  int i;
  gettoken(yytext, sizeof yytext);

  if (!strnicmp(yytext,"reg",3) && strlen(yytext) == 5 && isdigit(yytext[3]) && isdigit(yytext[4]) && (i=atoi(yytext+3))>=0 && i<100)
  {
    *typeOfObject=IDENTIFIER;
    return i+EVAL_MAX_VARS;
  }

  for (i=0;i<EVAL_MAX_VARS;i++)
    if (!strnicmp(varTable[i].name, yytext,sizeof(varTable[i].name)))
    {
      *typeOfObject = IDENTIFIER;
      return i;
    }

  for (i=0;getFunctionFromTable(i);i++)
  {
    functionType *f=getFunctionFromTable(i);
    if (!strcmpi(f->name, yytext))
    {
      *typeOfObject = objectId(f->nParams);
      return i;
    }
  }
  *typeOfObject = IDENTIFIER;
  setLastVar();
  i = setVar(-1, 0);
  return i;
}
开发者ID:chezinut,项目名称:vis_avs,代码行数:33,代码来源:eval.c

示例6: newTerm

Word
newTerm(void)
{ GET_LD
  Word t = allocGlobal(1);

  setVar(*t);

  return t;
}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:9,代码来源:pl-alloc.c

示例7: getDirection

void AgiEngine::motionMoveObj(ScreenObjEntry *screenObj) {
	screenObj->direction = getDirection(screenObj->xPos, screenObj->yPos, screenObj->move_x, screenObj->move_y, screenObj->stepSize);

	// Update V6 if ego
	if (isEgoView(screenObj))
		setVar(VM_VAR_EGO_DIRECTION, screenObj->direction);

	if (screenObj->direction == 0)
		motionMoveObjStop(screenObj);
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:10,代码来源:motion.cpp

示例8: setVar

ParzenMachine::ParzenMachine(int n_inputs_,int n_outputs_,real var_)
{
  data = NULL;
  setVar(var_);
  n_outputs = n_outputs_;
  n_inputs = n_inputs_;
  outputs = new(allocator) Sequence(1,n_outputs);
  n_real_examples = 0;
  real_examples = NULL;
}
开发者ID:Dandelion0124,项目名称:smartalbum,代码行数:10,代码来源:ParzenMachine.cpp

示例9: setVarFunc

int setVarFunc(HSQUIRRELVM v) {
  StackHandler sa(v);
  if (sa.GetType(1) == OT_TABLE) {
    VarRefPtr vr;
    int res = getVarInfo(sa,vr);
    if (res != SQ_OK) return res;
    return setVar(sa,vr,vr->offsetOrAddrOrConst);
  } // if
  return SQ_ERROR;
} // setVarFunc
开发者ID:Hiroyuki-Nagata,项目名称:mona,代码行数:10,代码来源:SqPlus.cpp

示例10: setVarFunc

int setVarFunc(HSQUIRRELVM v) {
  SquirrelVM::Init(v);  // For handling multi-VM setting right
  StackHandler sa(v);
  if (sa.GetType(1) == OT_TABLE) {
    VarRefPtr vr;
    int res = getVarInfo(sa,vr);
    if (res != SQ_OK) return res;
    return setVar(sa,vr,vr->offsetOrAddrOrConst);
  } // if
  return SQ_ERROR;
} // setVarFunc
开发者ID:hamstah,项目名称:geogen,代码行数:11,代码来源:SqPlus.cpp

示例11: setInstanceVarFunc

int setInstanceVarFunc(HSQUIRRELVM v) {
  StackHandler sa(v);
  if (sa.GetType(1) == OT_INSTANCE) {
    VarRefPtr vr;
    void * data;
    int res = getInstanceVarInfo(sa,vr,data);
    if (res != SQ_OK) return res;
    return setVar(sa,vr,data);
  } // if
  return SQ_ERROR;
} // setInstanceVarFunc
开发者ID:Hiroyuki-Nagata,项目名称:mona,代码行数:11,代码来源:SqPlus.cpp

示例12: setInstanceVarFunc

int setInstanceVarFunc(HSQUIRRELVM v) {
  SquirrelVM::Init(v);  // For handling multi-VM setting right
  StackHandler sa(v);
  if (sa.GetType(1) == OT_INSTANCE) {
    VarRefPtr vr;
    void * data;
    int res = getInstanceVarInfo(sa,vr,data);
    if (res != SQ_OK) return res;
    return setVar(sa,vr,data);
  } // if
  return SQ_ERROR;
} // setInstanceVarFunc
开发者ID:hamstah,项目名称:geogen,代码行数:12,代码来源:SqPlus.cpp

示例13: setVar_i

void
setVar_i (varPrec * time,
	  char *type, int *s2, char *cont, int *s1, varPrec * val, int *err)
{
  char *t = (char *) malloc (sizeof (char) * (*s2 + 1));
  char *c = (char *) malloc (sizeof (char) * (*s1 + 1));
  memcpy (t, type, *s2);
  t[*s2] = '\0';
  memcpy (c, cont, *s1);
  c[*s1] = '\0';
  *err = setVar (*time, t, c, *val);
}
开发者ID:sisarolo,项目名称:Generic-Trace-Generator,代码行数:12,代码来源:interfaceCFortranBasic1.c

示例14: int

/* 如果显示调用
typedef int (*lpFetchData)();
typedef int (*lpSaveVar)();
typedef LPCSTR (*lpGetVar)(const LPCSTR group, const LPCSTR key);
typedef int(*lpShowVar)();
typedef int(*lpTest_save)();
......
HINSTANCE hDll = LoadLibrary("fKeyValue.dll");//导入.dll动态连接库
lpFetchData fetchData=(lpFetchData)GetProcAddress(hDll,"fetchData");
lpShowVar showVar=(lpShowVar)GetProcAddress(hDll,"showVar");
lpGetVar getVar=(lpGetVar)GetProcAddress(hDll,"getVar");
......
dosomething....
FreeLibrary(hDll);
*/
int main(void)
{
    setFile("D:\\users\\goosy\\codes\\GoosyFBase\\data.ini");
    //test_save();
    fetchData();
    showVar();
    setVar("Date","safeDays","7845");
    saveVar();
    printf("安全天数为%s", getVar("Date","safeDays"));
    //MessageBoxA(0, getVar("Date","safeDays"), "安全天数为", MB_OK | MB_ICONINFORMATION);
    getch();
    return 0;
}
开发者ID:goosy,项目名称:GoosyFBase,代码行数:28,代码来源:testClient.c

示例15: _mode

Func::Func(const Func& rhs): _mode(rhs._mode)
{
    _varbuf.reserve(VARMAX);
    _parser.SetVarFactory(_addVar, this);
    // Adding pi and e, the defaults are `_pi` and `_e`
    _parser.DefineConst(_T("pi"), (mu::value_type)M_PI);
    _parser.DefineConst(_T("e"), (mu::value_type)M_E);
    setExpr(rhs.getExpr());
    vector <string> vars = rhs.getVars();
    for (unsigned int ii = 0; ii < vars.size(); ++ii){
        setVar(vars[ii], rhs.getVar(vars[ii]));
    }
}
开发者ID:iampritishpatil,项目名称:moose,代码行数:13,代码来源:Func.cpp


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