Exemplo n.º 1
0
//'var_name': name of the variable, it is optional.
VAR * VAR_MGR::register_var(CHAR const* var_name, UINT tyid,
							UINT align, UINT flag)
{
	IS_TRUE0(var_name != NULL && tyid != 0);
	SYM * sym = m_ru_mgr->add_to_symtab(var_name);
	return register_var(sym, tyid, align, flag);
}
Exemplo n.º 2
0
//'var_name': name of the variable, it is optional.
VAR * VAR_MGR::register_var(SYM * var_name, UINT tyid, UINT align, UINT flag)
{
	IS_TRUE0(var_name != NULL && tyid != 0);
	DTD const* d = m_dm->get_dtd(tyid);
	IS_TRUE0(d);
	return register_var(var_name, DTD_rty(d), DTD_vec_ety(d),
						DTD_ptr_base_sz(d), m_dm->get_dtd_bytesize(d),
						align, flag);
}
Exemplo n.º 3
0
/*
Add VAR into VAR_TAB.
Call this function cafefully, and making sure the VAR is unique.
'var_name': name of the variable, it is optional.
*/
VAR * VAR_MGR::register_var(CHAR const* var_name, DATA_TYPE dt,
							DATA_TYPE elem_type, UINT pointer_base_size,
							UINT mem_size, UINT align, UINT flag)
{
	IS_TRUE0(var_name != NULL);
	SYM * sym = m_ru_mgr->add_to_symtab(var_name);
	return register_var(sym, dt, elem_type, pointer_base_size,
						mem_size, align, flag);
}
Exemplo n.º 4
0
Arquivo: var.cpp Projeto: aquemy/dae
void create_bound_variable(BoundVariable *v, TimeVal inf, TimeVal sup, void *hook, PropagationProc propagate, EmptyProc empty)
{
  v->inf = inf;
  v->sup = sup;
  v->hook = hook;
  v->event = NoEvent;
  v->propagate = propagate;
  v->empty = empty;
  register_var(v, bound);
}
Exemplo n.º 5
0
Arquivo: var.cpp Projeto: aquemy/dae
void create_enum_variable(EnumVariable *v, size_t n, size_t sup, void *hook, PropagationProc propagate, EmptyProc empty)
{
  size_t i;
  
  if (n + sup > MAXVAL) 
    error(bucket, "Too many values in bucket");
  v->min = 0;
  v->max = n - 1;
  v->card = n;
  v->value = (n == 1 ? 0 : VAL_UNKNOWN);
  v->hook = hook;
  v->event = NoEvent;
  v->propagate = propagate;
  v->empty = empty;
  cpt_malloc(v->bucket, (v->bucket_nb = n + sup + 1));
  for (i = 0; i < n; i++) v->bucket[i] = i;
  for (i = n; i < v->bucket_nb; i++) v->bucket[i] = VAL_UNKNOWN;
  register_var(v, removal);
  register_var(v, instantiate);
}
Exemplo n.º 6
0
//------------------------------------------------------------------------------
EEL_F *NSEEL_VM_regvar(NSEEL_VMCTX _ctx, const char *var)
{
  compileContext *ctx = (compileContext *)_ctx;
  EEL_F *r;
  if (!ctx) return 0;

  if (!strnicmp(var,"reg",3) && strlen(var) == 5 && isdigit(var[3]) && isdigit(var[4]))
  {
    int x=atoi(var+3);
    if (x < 0 || x > 99) x=0;
    return nseel_globalregs + x;
  }

  register_var(ctx,var,&r);

  return r;
}
Exemplo n.º 7
0
//------------------------------------------------------------------------------
INT_PTR nseel_setVar(compileContext *ctx, INT_PTR varNum)
{
  if (varNum < 0) // adding new var
  {
    char *var=ctx->lastVar;
    if (!strnicmp(var,"reg",3) && strlen(var) == 5 && isdigit(var[3]) && isdigit(var[4]))
    {
      int i,x=atoi(var+3);
      if (x < 0 || x > 99) x=0;
      i=NSEEL_GLOBALVAR_BASE+x;
      return i;
    }

    return register_var(ctx,ctx->lastVar,NULL);

  }

  // setting/getting oldvar

  if (varNum >= NSEEL_GLOBALVAR_BASE && varNum < NSEEL_GLOBALVAR_BASE+100)
  {
    return varNum;
  }

  {
    int wb,ti;
    char *nameptr;
    if (varNum < 0 || varNum >= ctx->varTable_numBlocks*NSEEL_VARS_PER_BLOCK) return -1;

    wb=varNum/NSEEL_VARS_PER_BLOCK;
    ti=(varNum%NSEEL_VARS_PER_BLOCK);
    nameptr=ctx->varTable_Names[wb]+ti*NSEEL_MAX_VARIABLE_NAMELEN;
    if (!nameptr[0]) 
    {
      strncpy(nameptr,ctx->lastVar,NSEEL_MAX_VARIABLE_NAMELEN);
    }  
    return varNum;  
  }

}