Example #1
0
int
loophead(int32_t *idom, Reg *r)
{
	int32_t src;

	src = r->rpo;
	if(r->p1 != R && doms(idom, src, r->p1->rpo))
		return 1;
	for(r = r->p2; r != R; r = r->p2link)
		if(doms(idom, src, r->rpo))
			return 1;
	return 0;
}
Example #2
0
static int
loophead(int32 *idom, Flow *r)
{
	int32 src;

	src = r->rpo;
	if(r->p1 != nil && doms(idom, src, r->p1->rpo))
		return 1;
	for(r = r->p2; r != nil; r = r->p2link)
		if(doms(idom, src, r->rpo))
			return 1;
	return 0;
}
Example #3
0
void ProblemReader::readUAI(char* filename) {

  igzstream in(filename);
  assert(in);

  // Problem type indicator
  string s;
  in >> s;
  if (! (s=="MARKOV" || s=="BAYES")) {
    fprintf(stderr, "Problem type not supported.\n");
    exit(-1);
  }

  // read num_vars
  in >> num_vars;

  // read domain sizes and store locally for now
  vector<int> doms(num_vars,-1);
  for (int i=0; i<num_vars; ++i)
    in >> doms[i];

  // read num_pots
  in >> num_pots;

  // now that num_vars and num_pots is read, we can allocate the memory
  allocateVarsAndPTs(false);

  // set domain sizes
  for (int i=0; i<num_vars; ++i)
    variables[i]->setDomainSize(doms[i]);

  // read and set function scopes
  vector<vector<int> > scopes(num_pots);
  vector<int> tabSizes(num_pots,-1);
  for (int i=0; i<num_pots; ++i) {
    int var, z, num_vars_in_pot;
    in >> num_vars_in_pot;
    z = num_vars_in_pot;
    while (z--) {
      in >> var;
      scopes[i].push_back(var);
    }
    // allocate and init function table
    probTables[i]->init(scopes[i].size());
    int numEntries = 1;
    for(int j=0; j<num_vars_in_pot; ++j){
            probTables[i]->setVar(j, scopes[i][j]);
            numEntries *= doms[scopes[i][j]]; //variables[scopes[i][j]]->domSize;
    }
    tabSizes[i] = numEntries;
    probTables[i]->setNumEntries(numEntries);
  }

  // read function tables
  double d;
  for (int i=0; i<num_pots; ++i) {
    int numEntries;
    in >> numEntries;
    assert(numEntries == tabSizes[i]);

    for (int j=0; j<numEntries; ++j) {
      in >> d;
      probTables[i]->setEntry(j,d);
    }
  }

}
Example #4
0
int checkformacs(){
	short mcto=0;
	char temps[2048];

	if(kreturn==11779){
	if(wn[cwin].chan>-1)closchan(wn[cwin].chan);
	return 1;
	}
	
	if(kreturn==19200){
	if(wn[cwin].cx>0){wn[cwin].cx--;return 1;}
	else{
	if(wn[cwin].cvof==0)return 1;
	if(wn[cwin].cvof!=0){wn[cwin].cvof--;wn[cwin].cx=wn[cwin].ihc[wn[cwin].cvof];ipbredraw(cwin);return 1;}
	}
	return 1;
	}
	if(kreturn==19712){
	if(wn[cwin].cx<wn[cwin].ihc[wn[cwin].cvof]){wn[cwin].cx++;return 1;}
	else{
	if(wn[cwin].cx==wn[cwin].ihc[wn[cwin].cvof]){
	if(wn[cwin].ihc[wn[cwin].cvof+1]){wn[cwin].cvof++;wn[cwin].cx=0;ipbredraw(cwin);return 1;}
	else{
	return 1;
	}
	}
	}
	return 1;
	}
	
	if(kreturn==283){
	clearipb(cwin);
	return 1;
	}
	if(kreturn==3849){
	clearipb(cwin);
	strcpy(temps,"/msg ");
	if(lastnt){
	mcto=0;
	lastnc++;
	while(!strlen(lastn[lastnc]) && mcto!=50){
	lastnc++;
	if(lastnc==20)lastnc=0;
	mcto++;
	if(mcto==21)mcto=50;
	}
	}
	if(strlen(lastn[lastnc])){strcat(temps,lastn[lastnc]);strcat(temps," ");wtib(temps,1);}
	lastnt=20;
	return 1;
	}
	
	if(kreturn==15104){doms(0);return 1;}
	if(kreturn==15360){doms(1);return 1;}
	if(kreturn==15616){doms(2);return 1;}
	if(kreturn==15872){doms(3);return 1;}
	if(kreturn==16128){doms(4);return 1;}
	if(kreturn==16384){doms(5);return 1;}
	if(kreturn==16640){doms(6);return 1;}
	if(kreturn==16896){doms(7);return 1;}
	if(kreturn==17152){doms(8);return 1;}
	if(kreturn==17408){doms(9);return 1;}
	
	if(kreturn==30720 && wn[0].hand>-1){topwindow(0);return 1;}
	if(kreturn==30976 && wn[1].hand>-1){topwindow(1);return 1;}
	if(kreturn==31232 && wn[2].hand>-1){topwindow(2);return 1;}
	if(kreturn==31488 && wn[3].hand>-1){topwindow(3);return 1;}
	if(kreturn==31744 && wn[4].hand>-1){topwindow(4);return 1;}
	if(kreturn==32000 && wn[5].hand>-1){topwindow(5);return 1;}
	if(kreturn==3103){
	wtib("",0);
	return 1;
	}
	if(kreturn==3357){
	wtib("",0);
	return 1;
	}
	if(kreturn==10496){
	wtib("",0);
	return 1;
	}
	if(kreturn==2832){
	wtib("",0);
	return 1;
	}
	
	if(kreturn==4096){
	mcto=0;
	while(mcto<NOFWIN)
	{
	if(cn[mcto].cn>-1){
	if(form_alert(2,"[1][Still connected!|Are you sure?][No!][Yes!]")==1)return 1;
	mcto=NOFWIN;
	}
	mcto++;
	}
	mcto=0;
	while(mcto<10)
	{
	if(dcc[mcto].stat){
	if(form_alert(2,"[1][DCC transfer open!|Are you sure?][No!][Yes!]")==1)return 1;
	mcto=10;
	}
	mcto++;
	}
	qt();
	}
	if(kreturn==19252){
	cycchan(BACKWARDS);
	return 1;
	}
	if(kreturn==19766){
	cycchan(FORWARDS);
	return 1;
	}
	if(kreturn==29440){
	cycwin(BACKWARDS);
	return 1;
	}
	if(kreturn==29696){
	cycwin(FORWARDS);
	return 1;
	}
	if(kreturn==4375){
	openwin(0,0,0,0,2);
	return 1;
	}
	if(kreturn==5653){
	dodccsend();
	return 1;
	}
	if(kreturn==4113){
	disnnect(wn[cwin].cnn);
	return 1;
	}
	if(kreturn==12813 && cwin>-1){
	closewin(cwin);
	return 1;
	}
	if(kreturn==6159){
	sortconnection();
	return 1;
	}
	return 0;
	}