Ejemplo n.º 1
0
/**
 * Find in/out
 */
void find_inout()
{
   struct block *b = first_block;
   struct block *tmpb = (struct block *) malloc(sizeof(struct block));
   int i;
   int change = 1;
   int oldlen;
   
   calc_pred();
   DEBUG(print_pred());

   while(b) {
      b->defin.ini = 0;
      copy_set(b, OUT_SET, b, GEN_SET);
      b = b->next;
   }

   while(change) {
      change = 0;
      b = first_block;

      while(b) {
	 for(i = 0; i < b->predi; i++)
	    union_set(b, IN_SET, b->pred[i], OUT_SET);

	 copy_set(tmpb, IN_SET, b, IN_SET);
	 sub_set(tmpb, IN_SET, b, KILL_SET);
	 union_set(tmpb, IN_SET, b, GEN_SET);
	 
	 oldlen = b->defin.outi;
	 
	 // According to algorithm I should do what is commented belove
	 /*
	   copy_set(oldb, OUT_SET, b, OUT_SET);
	   copy_set(b, OUT_SET, tmpb, IN_SET);
	 
	   if(!equal_set(oldb, OUT_SET, b, OUT_SET))
	   change = 1;
	 */
	 // but since out[b] = gen[b] we can do
	 // 1. union agains copy
	 // 2. compare set's length to see if it's changed
	 
	 union_set(b, OUT_SET, tmpb, IN_SET);
	 if(oldlen != b->defin.outi) 
	    change = 1;
	 
	 b = b -> next;
      }
   }
}
Ejemplo n.º 2
0
void printall() {
  cprintf("$ \n");
  cprintf("\\text{Principal } 1 == A \\\\ \n");
  cprintf("\\text{Principal } 2 == B \\\\ \n");
  cprintf("\\text{Principal } 3 == C \\\\ \n");
  cprintf("\\text{Principal } 4 == D \\\\ \n");
  cprintf("\\text{Principal } 5 == E \\\\ \n");
  cprintf("\\text{Principal } 6 == F \\\\ \n");
  cprintf("\\text{Principal } 7 == G \\\\ \n");
  cprintf("\\text{Predicate } 99 == OK \\\\ \n");
  cprintf("\\text{Predicate } 100 == ALRIGHT \\\\\\\\ \n");
  cprintf("\\text{PRINTING FORMULAE} \\\\\\\\ \n");
  print_pred();
  freeall();
  cprintf(" \\\\\\\\ \n");
  print_impl();
  freeall();
  cprintf(" \\\\\\\\ \n");
  print_signed();
  freeall();
  cprintf(" \\\\\\\\ \n");
  print_says();
  freeall();
  cprintf(" \\\\\\\\ \n");
  print_confirms();
  freeall();
  cprintf(" \\\\\\\\ \n");
  print_abs();
  freeall();
  cprintf(" \\\\\\\\ \n");
  cprintf("\\text{PRINTING CONTEXT} \\\\\\\\ \n");
  print_context();
  freeall();
  cprintf(" \\\\\\\\ \n");
  cprintf("\\text{PRINTING PROOFS} \\\\\\\\ \n");
  print_signed_p();
  freeall();
  cprintf(" \\\\\\\\\\\\\\\\ \n");
  print_confirms_p();
  freeall();
  cprintf(" \\\\\\\\\\\\\\\\ \n");
  print_assump_p();
  freeall();
  cprintf(" \\\\\\\\\\\\\\\\ \n");
  print_tauto_p();
  freeall();
  cprintf(" \\\\\\\\\\\\\\\\ \n");
  print_weaken_impl_p();
  freeall();
  cprintf(" \\\\\\\\\\\\\\\\ \n");
  print_impl_p();
  freeall();
  cprintf(" \\\\\\\\\\\\\\\\ \n");
  print_says_confirms();
  freeall();
  cprintf(" \\\\\\\\\\\\\\\\ \n");
  print_says_signed();
  freeall();
  cprintf(" \\\\\\\\\\\\\\\\ \n");
  print_says_says();
  freeall();
  cprintf(" \\\\\\\\\\\\\\\\ \n");
  print_says_spec();
  freeall();
  cprintf(" \\\\\\\\\\\\\\\\ \n");
  cprintf("$ \n");
  freeall();
  cprintf("\\begin{landscape} \n $");
  print_delegation();
  freeall();
  cprintf("$ \n \\end{landscape} \n ");
}