Example #1
0
/* walks through a clist and numbers variables whose addresses are
   contained; if pass==-1, index is set to -1, if pass==0, index is set,
   otherwise vilist
   clcnt is used as index-counter in pass 0 */
void num_clist_refs(int pass,struct Typ *t,struct const_list *cl)
{
  /*FIXME: bei Aufrufen auch auf locale, nicht USEDASDEST|USEDASADDR */
  int i;zmax sz;
  if(ISARRAY(t->flags)){
    for(sz=l2zm(0L);!zmleq(t->size,sz)&&cl;sz=zmadd(sz,l2zm(1L)),cl=cl->next){
      if(!cl->other){ierror(0);return;}
      num_clist_refs(pass,t->next,cl->other);
    }
    return;
  }
  if(ISUNION(t->flags)){
    num_clist_refs(pass,(*t->exact->sl)[0].styp,cl);
    return;
  }
  if(ISSTRUCT(t->flags)&&!cl->tree){
    struct Typ *st;
    for(i=0;i<t->exact->count&&cl;i++){
      st=(*t->exact->sl)[i].styp;
      if(!(*t->exact->sl)[i].identifier) ierror(0);
      if((*t->exact->sl)[i].identifier[0]){
        if(!cl->other)
          ierror(0);
        num_clist_refs(pass,st,cl->other);
        cl=cl->next;
      }
    }
    return;
  }
  if(cl->tree&&(cl->tree->o.flags&VARADR)){
    struct Var *v=cl->tree->o.v;
    if(pass==-1){
      v->index=-1;
    }else if(pass==0){
      if(v->index<0) {v->index=clcnt++;v->inr=inr;}
    }else{
      if(v->index<0||v->index>=vcount-rcount)
	ierror(0);
      vilist[v->index]=v;
    }
  }
}
Example #2
0
bool bpx_is_structure(TERM t)
{
    XDEREF(t);
    return ISSTRUCT(t);
}