[Avida-SVN] r2352 - branches/uml/source/main

hjg at myxo.css.msu.edu hjg at myxo.css.msu.edu
Thu Feb 21 07:51:44 PST 2008


Author: hjg
Date: 2008-02-21 10:51:44 -0500 (Thu, 21 Feb 2008)
New Revision: 2352

Modified:
   branches/uml/source/main/cMDEAbsenceProperty.cc
   branches/uml/source/main/cMDEAbsenceProperty.h
   branches/uml/source/main/cMDEExistenceProperty.cc
   branches/uml/source/main/cMDEExistenceProperty.h
   branches/uml/source/main/cMDEPrecedenceProperty.cc
   branches/uml/source/main/cMDEPrecedenceProperty.h
   branches/uml/source/main/cMDEProperty.cc
   branches/uml/source/main/cMDEProperty.h
   branches/uml/source/main/cMDEResponseProperty.cc
   branches/uml/source/main/cMDEResponseProperty.h
   branches/uml/source/main/cMDEUniversalProperty.cc
   branches/uml/source/main/cMDEUniversalProperty.h
   branches/uml/source/main/cUMLModel.cc
Log:


Modified: branches/uml/source/main/cMDEAbsenceProperty.cc
===================================================================
--- branches/uml/source/main/cMDEAbsenceProperty.cc	2008-02-21 14:36:30 UTC (rev 2351)
+++ branches/uml/source/main/cMDEAbsenceProperty.cc	2008-02-21 15:51:44 UTC (rev 2352)
@@ -9,13 +9,18 @@
 
 #include "cMDEAbsenceProperty.h"
 
-void cMDEAbsenceProperty::print() {
+bool cMDEAbsenceProperty::print() {
 	
+	// Create the file...
+	std::string cmd = "cp " + _promela + " " + _property_file_name;
+	if(system(cmd.c_str())!=0) return false;
+	
+	// Open the file in append mode...
 	std::ofstream outfile;
-//	outfile.open (_name.c_str());
-	outfile.open ("property");
+	outfile.open (_property_file_name.c_str(), std::ios_base::app);
 	assert(outfile.is_open());
 	
+	// Add the absence property to the end of the file...
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
 	outfile << "never { /* !([](!p)) */" << std::endl;
 	outfile << "T0_init :    /* init */" << std::endl;
@@ -28,15 +33,19 @@
 	outfile << "}" << std::endl;
 	
 	outfile.close();
+	return true;
 
 }
 
-void cMDEAbsenceProperty::printWitness() {
+bool cMDEAbsenceProperty::printWitness() {
 	
+	// Create the file
+	std::string cmd = "cp " + _promela + " " + _witness_file_name;
+	if(system(cmd.c_str())!=0) return false;
+	
+	// Open the file in append mode
 	std::ofstream outfile;
-//	std::string file_name= "w" + _name;
-	std::string file_name = "witness-property";
-	outfile.open (file_name.c_str());
+	outfile.open (_witness_file_name.c_str(), std::ios_base::app);
 	assert(outfile.is_open());
 	
 	outfile << "/* Absence property " << _expr_p << "*/" << std::endl;
@@ -51,9 +60,8 @@
 	outfile << "skip " << std::endl;
 	outfile << "}" << std::endl;
 	
-
-	
 	outfile.close();
+	return true;
 	
 }
 
@@ -70,23 +78,24 @@
 
 		// if this property passed, then save it to a file
 	if (verify_reward) { 
-		cmd = "cat english-property >> " + work_prop;
-		system(cmd.c_str());
+//		cmd = "cat english-property >> " + work_prop;
+//		system(cmd.c_str());
+		printInEnglish();
 	}
 	
 	_reward = verify_reward;
 }
 
 
-void cMDEAbsenceProperty::printInEnglish() {
+bool cMDEAbsenceProperty::printInEnglish() {
 	
 	std::ofstream outfile;
-	std::string file_name = "english-property";
-	outfile.open (file_name.c_str());
+	outfile.open (_properties.c_str(), std::ios_base::app);
 	assert(outfile.is_open());
 	
 	outfile << "Globally, it is never the case that " << _expr_p  << " holds." << std::endl << std::endl;
 	
 	outfile.close();
+	return true;
 	
 }
\ No newline at end of file

Modified: branches/uml/source/main/cMDEAbsenceProperty.h
===================================================================
--- branches/uml/source/main/cMDEAbsenceProperty.h	2008-02-21 14:36:30 UTC (rev 2351)
+++ branches/uml/source/main/cMDEAbsenceProperty.h	2008-02-21 15:51:44 UTC (rev 2352)
@@ -22,11 +22,16 @@
 	
 public:
 	cMDEAbsenceProperty(std::string expr, std::string q) { _expr_p = expr; 
-		_name = ("Absence" + q); _reward = -1; }
+		_name = ("Absence" + q); _reward = -1; 
+		_property_file_name = "tmp-property.pr"; 
+		_witness_file_name = "tmp-witness.pr";
+		_properties = "properties_that_passed";
+		_promela = "tmp.pr";
+	}
 	virtual ~cMDEAbsenceProperty() {}
-	void print(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
-	void printWitness(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
-	void printInEnglish();
+	bool print(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
+	bool printWitness(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
+	bool printInEnglish();
 	void evaluate();
 	std::string getPropertyType() { return "Absence"; } 
 	std::string getPropertyParameters() { return _expr_p; }

Modified: branches/uml/source/main/cMDEExistenceProperty.cc
===================================================================
--- branches/uml/source/main/cMDEExistenceProperty.cc	2008-02-21 14:36:30 UTC (rev 2351)
+++ branches/uml/source/main/cMDEExistenceProperty.cc	2008-02-21 15:51:44 UTC (rev 2352)
@@ -9,13 +9,19 @@
 
 #include "cMDEExistenceProperty.h"
 
-void cMDEExistenceProperty::print() {
+/* This function prepares the file tmp-property.pr to be verified. */
+
+bool cMDEExistenceProperty::print() {
+	// Create the file...
+	std::string cmd = "cp " + _promela + " " + _property_file_name;
+	if(system(cmd.c_str())!=0) return false;
 	
+	// Open the file in append mode...
 	std::ofstream outfile;
-//	outfile.open (_name.c_str());
-	outfile.open ("property");
+	outfile.open (_property_file_name.c_str(), std::ios_base::app);
 	assert(outfile.is_open());
 	
+	// Add the existence property to the end of the file...
 	outfile << "/* Existence property " << _expr_p << "*/" << std::endl;
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
 	outfile << "never { /* !(<>(p)) */ " << std::endl;
@@ -24,17 +30,23 @@
 	outfile << ":: (!p) -> goto accept_init " << std::endl;
 	outfile << "fi; }" << std::endl;
 	
+	// close the file...
 	outfile.close();
-
+	return true;
 }
 
-void cMDEExistenceProperty::printWitness() {
+bool cMDEExistenceProperty::printWitness() {
 	
+	// Create the file
+	std::string cmd = "cp " + _promela + " " + _witness_file_name;
+	if(system(cmd.c_str())!=0) return false;
+	
+	// Open the file in append mode
 	std::ofstream outfile;
-	std::string file_name = "witness-property";
-	outfile.open (file_name.c_str());
+	outfile.open (_witness_file_name.c_str(), std::ios_base::app);
 	assert(outfile.is_open());
 	
+	// Add existence witness
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
 	outfile << "never { /* !([](!p)) */ " << std::endl;
 	outfile << "T0_init :    /* init */ " << std::endl;
@@ -47,18 +59,19 @@
 
 	
 	outfile.close();
+	return true;
 	
 }
 
-void cMDEExistenceProperty::printInEnglish() {
+bool cMDEExistenceProperty::printInEnglish() {
 	
 	std::ofstream outfile;
-	std::string file_name = "english-property";
-	outfile.open (file_name.c_str());
+	outfile.open (_properties.c_str(), std::ios_base::app);
 	assert(outfile.is_open());
 	
 	outfile << "Globally, " << _expr_p  << " eventually holds." << std::endl<< std::endl;
 	
 	outfile.close();
+	return true;
 	
 }
\ No newline at end of file

Modified: branches/uml/source/main/cMDEExistenceProperty.h
===================================================================
--- branches/uml/source/main/cMDEExistenceProperty.h	2008-02-21 14:36:30 UTC (rev 2351)
+++ branches/uml/source/main/cMDEExistenceProperty.h	2008-02-21 15:51:44 UTC (rev 2352)
@@ -23,13 +23,18 @@
 	
 public:
 	cMDEExistenceProperty(std::string expr, std::string q) { _expr_p = expr; 
-		_name = ("Existence" + q); _reward = -1;}
+		_name = ("Existence" + q); _reward = -1;
+		_property_file_name = "tmp-property.pr"; 
+		_witness_file_name = "tmp-witness.pr";
+		_properties = "properties_that_passed";
+		_promela = "tmp.pr";
+	}
 	
 	virtual ~cMDEExistenceProperty() {}
 
-	void print(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
-	void printWitness(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
-	void printInEnglish();
+	bool print(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
+	bool printWitness(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
+	bool printInEnglish();
 	std::string getPropertyType() { return "Existence"; } 
 	std::string getPropertyParameters() { return _expr_p; }
 

Modified: branches/uml/source/main/cMDEPrecedenceProperty.cc
===================================================================
--- branches/uml/source/main/cMDEPrecedenceProperty.cc	2008-02-21 14:36:30 UTC (rev 2351)
+++ branches/uml/source/main/cMDEPrecedenceProperty.cc	2008-02-21 15:51:44 UTC (rev 2352)
@@ -9,12 +9,19 @@
 
 #include "cMDEPrecedenceProperty.h"
 
-void cMDEPrecedenceProperty::print() {
+bool cMDEPrecedenceProperty::print() {
 	
+	// Create the file...
+	std::string cmd = "cp " + _promela + " " + _property_file_name;
+	if(system(cmd.c_str())!=0) return false;
+	
+	// Open the file in append mode...
 	std::ofstream outfile;
-	outfile.open ("property");
+	outfile.open (_property_file_name.c_str(), std::ios_base::app);
 	assert(outfile.is_open());
 	
+	
+	// Add the precedence property to the end of the file...
 	outfile << "/* Precedence property " << _expr_p  << " " << _expr_q << "*/" << std::endl;
 	outfile << "#define s (" << _expr_q << ")" << std::endl;
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
@@ -45,16 +52,22 @@
 	outfile << "skip }" << std::endl;
 	
 	outfile.close();
+	return true;
 
 }
 
-void cMDEPrecedenceProperty::printWitness() {
+bool cMDEPrecedenceProperty::printWitness() {
 	
+	// Create the file
+	std::string cmd = "cp " + _promela + " " + _witness_file_name;
+	if(system(cmd.c_str())!=0) return false;
+	
+	// Open the file in append mode
 	std::ofstream outfile;
-	std::string file_name = "witness-property";
-	outfile.open (file_name.c_str());
+	outfile.open (_witness_file_name.c_str(), std::ios_base::app);
 	assert(outfile.is_open());
 	
+	// Add precedence property witness to the end of the file....
 	outfile << "/* Precedence property " << _expr_p  << " " << _expr_q << "*/" << std::endl;
 	outfile << "#define q (" << _expr_q << ")" << std::endl;
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
@@ -74,20 +87,21 @@
     outfile << "skip }" << std::endl;
 
 	outfile.close();
+	return true;
 	
 }
 
-void cMDEPrecedenceProperty::printInEnglish() {
+bool cMDEPrecedenceProperty::printInEnglish() {
 	
 	std::ofstream outfile;
-	std::string file_name = "english-property";
-	outfile.open (file_name.c_str());
+	outfile.open (_properties.c_str(), std::ios_base::app);
 	assert(outfile.is_open());
 	
 	outfile << "Globally, it is always the case that if " << _expr_p  << " holds, ";
 	outfile << "then "<< _expr_q << " previously held." << std::endl << std::endl;
 	
 	outfile.close();
+	return true;
 	
 }
 

Modified: branches/uml/source/main/cMDEPrecedenceProperty.h
===================================================================
--- branches/uml/source/main/cMDEPrecedenceProperty.h	2008-02-21 14:36:30 UTC (rev 2351)
+++ branches/uml/source/main/cMDEPrecedenceProperty.h	2008-02-21 15:51:44 UTC (rev 2352)
@@ -26,13 +26,17 @@
 		_expr_p = p;
 		_expr_q = q;
 		_name = ("Precedence" + r); _reward = -1;
+		_property_file_name = "tmp-property.pr"; 
+		_witness_file_name = "tmp-witness.pr";
+		_properties = "properties_that_passed";
+		_promela = "tmp.pr";
 	}
 	
 	virtual ~cMDEPrecedenceProperty() {}
 
-	void print(); 
-	void printWitness(); 
-	void printInEnglish();
+	bool print(); 
+	bool printWitness(); 
+	bool printInEnglish();
 	std::string getPropertyType() { return "Precedence"; } 
 	std::string getPropertyParameters() { return (_expr_p + " " + _expr_q); }
 

Modified: branches/uml/source/main/cMDEProperty.cc
===================================================================
--- branches/uml/source/main/cMDEProperty.cc	2008-02-21 14:36:30 UTC (rev 2351)
+++ branches/uml/source/main/cMDEProperty.cc	2008-02-21 15:51:44 UTC (rev 2352)
@@ -19,18 +19,17 @@
 #include <errno.h>
 
 float cMDEProperty::numWitnesses() {
-	
-//	std::string file_name = "tmp-witness" + _name + ".pr";
+/*	
 	std::string file_name = "tmp-witness.pr";
 	std::string cmd = "cp tmp.pr "+ file_name;
-	int num_witness = 0;
+	if(system(cmd.c_str())!=0) return 0.0;*/
 	
+///	std::string file_name = "tmp-witness.pr";
+	int num_witness = 0;
+
+	std::string cmd = "./spin -a " +  _witness_file_name + " &> /dev/null";
 	if(system(cmd.c_str())!=0) return 0.0;
 	
-//	cmd = "cat w" + _name + " >> " + file_name + " && ./spin -a " +  file_name + " &> /dev/null";
-	cmd = "cat witness-property >> " + file_name + " && ./spin -a " +  file_name + " &> /dev/null";
-	if(system(cmd.c_str())!=0) return 0.0;
-	
 	if(system("/usr/bin/gcc -DMEMLIM=512 pan.c -o pan &> /dev/null")!=0) return 0.0;
 	if(system("./pan -e -n -a -w19  -m100000 -c1 &> ./pan.out")!=0) return 0.0;
 	num_witness = (system("cat pan.out | perl -e 'while(<STDIN>) { if(/errors:\\s(\\d+)/) {exit($1);}}'"));
@@ -43,14 +42,11 @@
 
 
 float cMDEProperty::verify() { 
-//	std::string file_name = "tmp-" + _name + ".pr";
-	std::string file_name = "tmp-property.pr";
-	std::string cmd = "cp tmp.pr "+ file_name;
-	if(system(cmd.c_str())!=0) return 0.0;
+
+//	std::string file_name = "tmp-property.pr";
+	std::string cmd;
 	
-	
-//	cmd = "cat " + _name + " >> " + file_name + " && ./spin -a " +  file_name + " &> /dev/null";
-	cmd = "cat property >> " + file_name + " && ./spin -a " +  file_name + " &> /dev/null";
+	cmd = "./spin -a " +  _property_file_name + " &> /dev/null";
 	if(system(cmd.c_str())!=0) return 0.0;
 	
 	if(system("/usr/bin/gcc -DMEMLIM=512 pan.c -o pan &> /dev/null")!=0) return 0.0;
@@ -70,6 +66,7 @@
 	
 	// print the witness property
 	printWitness();
+	
 	// call numWitnesses
 	wit_reward = numWitnesses();
 	
@@ -83,9 +80,8 @@
 	// if this property passed, then save it to a file
 	if (verify_reward) { 
 		printInEnglish();
-//		cmd = "cat " + _name + " >> " + work_prop;
-		cmd = "cat english-property >> " + work_prop;
-		system(cmd.c_str());
+//		cmd = "cat english-property >> " + work_prop;
+//		system(cmd.c_str());
 	}
 	
 //	_reward = wit_reward + verify_reward;

Modified: branches/uml/source/main/cMDEProperty.h
===================================================================
--- branches/uml/source/main/cMDEProperty.h	2008-02-21 14:36:30 UTC (rev 2351)
+++ branches/uml/source/main/cMDEProperty.h	2008-02-21 15:51:44 UTC (rev 2352)
@@ -11,17 +11,23 @@
 #include <string>
 #include <iostream>
 #include <cassert>
+#include<fstream>
 
 
 
 class cMDEProperty{
 	
 public:
-	virtual ~cMDEProperty() {}
+	virtual ~cMDEProperty() {
+		_property_file_name = "tmp-property.pr"; 
+		_witness_file_name = "tmp-witness.pr";
+		_properties = "properties_that_passed";
+		_promela = "tmp.pr";
+	}
 	// A function that prints the property to a file.
-	virtual void print() = 0;
-	virtual void printWitness() = 0;
-	virtual void printInEnglish() =0;
+	virtual bool print() = 0;
+	virtual bool printWitness() = 0;
+	virtual bool printInEnglish() =0;
 	virtual std::string getPropertyType() = 0;
 	virtual std::string getPropertyParameters() { return ""; } 
 	
@@ -40,6 +46,10 @@
 	std::string _name;
 	std::string _scope;
 	float _reward;
+	std::string _property_file_name; // = "tmp-property.pr"; 
+	std::string _witness_file_name; // = "tmp-witness.pr";
+	std::string _properties; // = "properties_that_passed";
+	std::string _promela; 
 	
 };
 

Modified: branches/uml/source/main/cMDEResponseProperty.cc
===================================================================
--- branches/uml/source/main/cMDEResponseProperty.cc	2008-02-21 14:36:30 UTC (rev 2351)
+++ branches/uml/source/main/cMDEResponseProperty.cc	2008-02-21 15:51:44 UTC (rev 2352)
@@ -9,13 +9,19 @@
 
 #include "cMDEResponseProperty.h"
 
-void cMDEResponseProperty::print() {
+bool cMDEResponseProperty::print() {
 	
+	// Create the file...
+	std::string cmd = "cp " + _promela + " " + _property_file_name;
+	if(system(cmd.c_str())!=0) return false;
+	
+	// Open the file in append mode...
 	std::ofstream outfile;
-//	outfile.open (_name.c_str());
-	outfile.open ("property");
+	outfile.open (_property_file_name.c_str(), std::ios_base::app);
 	assert(outfile.is_open());
 	
+	
+	// Add the response property to the end of the file...
 	outfile << "/* Response property " << _expr_p  << " " << _expr_q << "*/" << std::endl;
 	outfile << "#define s (" << _expr_q << ")" << std::endl;
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
@@ -31,16 +37,22 @@
 	outfile << "fi; }" << std::endl;
 	
 	outfile.close();
+	return true;
 
 }
 
-void cMDEResponseProperty::printWitness() {
+bool cMDEResponseProperty::printWitness() {
 	
+	// Create the file
+	std::string cmd = "cp " + _promela + " " + _witness_file_name;
+	if(system(cmd.c_str())!=0) return false;
+	
+	// Open the file in append mode
 	std::ofstream outfile;
-	std::string file_name = "witness-property";
-	outfile.open (file_name.c_str());
+	outfile.open (_witness_file_name.c_str(), std::ios_base::app);
 	assert(outfile.is_open());
 	
+	// Add response property to the end of the file...
 	outfile << "/* Response property " << _expr_p  << " " << _expr_q << "*/" << std::endl;
 	outfile << "#define s (" << _expr_q << ")" << std::endl;
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
@@ -60,20 +72,21 @@
 	outfile << "skip}" << std::endl;
 	
 	outfile.close();
+	return true;
 	
 }
 
 
-void cMDEResponseProperty::printInEnglish() {
+bool cMDEResponseProperty::printInEnglish() {
 	
 	std::ofstream outfile;
-	std::string file_name = "english-property";
-	outfile.open (file_name.c_str());
+	outfile.open (_properties.c_str(), std::ios_base::app);
 	assert(outfile.is_open());
 	
 	outfile << "Globally, it is always the case that if " << _expr_p  << " holds, ";
 	outfile << "then "<< _expr_q << " eventually holds." << std::endl << std::endl;
 	
 	outfile.close();
+	return true;
 	
 }

Modified: branches/uml/source/main/cMDEResponseProperty.h
===================================================================
--- branches/uml/source/main/cMDEResponseProperty.h	2008-02-21 14:36:30 UTC (rev 2351)
+++ branches/uml/source/main/cMDEResponseProperty.h	2008-02-21 15:51:44 UTC (rev 2352)
@@ -26,13 +26,17 @@
 		_expr_p = p;
 		_expr_q = q;
 		_name = ("Response" + r); _reward = -1;
+		_property_file_name = "tmp-property.pr"; 
+		_witness_file_name = "tmp-witness.pr";
+		_properties = "properties_that_passed";
+		_promela = "tmp.pr";
 	}
 	
 	virtual ~cMDEResponseProperty() {}
 
-	void print(); 
-	void printWitness(); 
-	void printInEnglish();
+	bool print(); 
+	bool printWitness(); 
+	bool printInEnglish();
 	std::string getPropertyType() { return "Response"; } 
 	std::string getPropertyParameters() { return (_expr_p + " " + _expr_q); }
 

Modified: branches/uml/source/main/cMDEUniversalProperty.cc
===================================================================
--- branches/uml/source/main/cMDEUniversalProperty.cc	2008-02-21 14:36:30 UTC (rev 2351)
+++ branches/uml/source/main/cMDEUniversalProperty.cc	2008-02-21 15:51:44 UTC (rev 2352)
@@ -9,13 +9,19 @@
 
 #include "cMDEUniversalProperty.h"
 
-void cMDEUniversalProperty::print() {
+bool cMDEUniversalProperty::print() {
 	
+	
+	// Create the file...
+	std::string cmd = "cp " + _promela + " " + _property_file_name;
+	if(system(cmd.c_str())!=0) return false;
+	
+	// Open the file in append mode...
 	std::ofstream outfile;
-//	outfile.open (_name.c_str());
-	outfile.open ("property");
+	outfile.open (_property_file_name.c_str(), std::ios_base::app);
 	assert(outfile.is_open());
 	
+	// Add the universal property to the end of the file...
 	outfile << "/* Universal property " << _expr_p << "*/" << std::endl;
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
 	outfile << "never { /* ![]p */" << std::endl;
@@ -29,15 +35,19 @@
 	outfile << "}" << std::endl;
 	
 	outfile.close();
+	return true;
 
 }
 
-void cMDEUniversalProperty::printWitness() {
+bool cMDEUniversalProperty::printWitness() {
 	
+	// Create the file
+	std::string cmd = "cp " + _promela + " " + _witness_file_name;
+	if(system(cmd.c_str())!=0) return false;
+	
+	// Open the file in append mode
 	std::ofstream outfile;
-//	std::string file_name = "w" + _name;
-	std::string file_name = "witness-property";
-	outfile.open (file_name.c_str());
+	outfile.open (_witness_file_name.c_str(), std::ios_base::app);
 	assert(outfile.is_open());
 	
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
@@ -52,6 +62,7 @@
 	outfile << "}" << std::endl;
 	
 	outfile.close();
+	return true;
 	
 }
 
@@ -69,8 +80,9 @@
 	// if this property passed, then save it to a file
 	if (verify_reward) { 
 //		cmd = "cat " + _name + " >> " + work_prop;
-		cmd = "cat english-property >> " + work_prop;
-		system(cmd.c_str());
+//		cmd = "cat english-property >> " + work_prop;
+		printInEnglish();
+//		system(cmd.c_str());
 	}
 	
 	_reward = verify_reward;
@@ -78,15 +90,15 @@
 
 
 
-void cMDEUniversalProperty::printInEnglish() {
+bool cMDEUniversalProperty::printInEnglish() {
 	
 	std::ofstream outfile;
-	std::string file_name = "english-property";
-	outfile.open (file_name.c_str());
-	assert(outfile.is_open());
+	outfile.open (_properties.c_str(), std::ios_base::app);
+	assert(outfile.is_open());	
 	
 	outfile << "Globally, it is always the case that " << _expr_p  << " holds." << std::endl << std::endl;
 	
 	outfile.close();
+	return true;
 	
 }
\ No newline at end of file

Modified: branches/uml/source/main/cMDEUniversalProperty.h
===================================================================
--- branches/uml/source/main/cMDEUniversalProperty.h	2008-02-21 14:36:30 UTC (rev 2351)
+++ branches/uml/source/main/cMDEUniversalProperty.h	2008-02-21 15:51:44 UTC (rev 2352)
@@ -22,11 +22,16 @@
 	
 public:
 	cMDEUniversalProperty(std::string expr, std::string q) { _expr_p = expr; 
-		_name = ("Universal" + q); _reward = -1;}
+		_name = ("Universal" + q); _reward = -1;
+		_property_file_name = "tmp-property.pr"; 
+		_witness_file_name = "tmp-witness.pr";
+		_properties = "properties_that_passed";
+		_promela = "tmp.pr";
+	}
 	virtual ~cMDEUniversalProperty() {}
-	void print(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
-	void printWitness(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
-	void printInEnglish();
+	bool print(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
+	bool printWitness(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
+	bool printInEnglish();
 	void evaluate();
 	std::string getPropertyType() { return "Universal"; } 
 	std::string getPropertyParameters() { return _expr_p; }

Modified: branches/uml/source/main/cUMLModel.cc
===================================================================
--- branches/uml/source/main/cUMLModel.cc	2008-02-21 14:36:30 UTC (rev 2351)
+++ branches/uml/source/main/cUMLModel.cc	2008-02-21 15:51:44 UTC (rev 2352)
@@ -544,6 +544,7 @@
 	cUMLClass c;
 	int temp_size;
 	std::string temp1, temp2, temp3;
+	std::string at_type;
 	
 	// For each class, create its set of expressions. 
 	for (unsigned int i=0; i<classes.size(); i++) { 
@@ -555,30 +556,44 @@
 		for (int j=0; j<temp_size; j++) {
 			a = c.getAttribute(j);
 			temp1 = class_name + "_V." + a.attribute_name;
+			at_type = a.attribute_type;
 			
-			// For each attribute value
-			for (unsigned int k=0; k<a.attribute_values.size(); k++){
-				// create both an equality and an inequality expression
-				temp2 = a.attribute_values[k];
-				temp3 = temp1 + "==" + temp2;
-				addExpression(temp3, c.getAssociatedClasses());
-				//std::cout << temp3 << std::endl;
-				temp3 = temp1 + "!=" + temp2;
-				//std::cout << temp3 << std::endl;
-				addExpression(temp3, c.getAssociatedClasses());
+			if ((at_type == "int") || (at_type == "integer")) {
+				// For each attribute value
+				for (unsigned int k=0; k<a.attribute_values.size(); k++){
+					// create both an equality and an inequality expression
+					temp2 = a.attribute_values[k];
+					temp3 = temp1 + "==" + temp2;
+					addExpression(temp3, c.getAssociatedClasses());
+					//std::cout << temp3 << std::endl;
+					temp3 = temp1 + "!=" + temp2;
+					//std::cout << temp3 << std::endl;
+					addExpression(temp3, c.getAssociatedClasses());
 				
-				temp3 = temp1 + ">" + temp2;
-				addExpression(temp3, c.getAssociatedClasses());
+					temp3 = temp1 + ">" + temp2;
+					addExpression(temp3, c.getAssociatedClasses());
 
-				temp3 = temp1 + "<" + temp2;
-				addExpression(temp3, c.getAssociatedClasses());
+					temp3 = temp1 + "<" + temp2;
+					addExpression(temp3, c.getAssociatedClasses());
 				
-				temp3 = temp1 + ">=" + temp2;
-				addExpression(temp3, c.getAssociatedClasses());
+					temp3 = temp1 + ">=" + temp2;
+					addExpression(temp3, c.getAssociatedClasses());
 				
-				temp3 = temp1 + "<=" + temp2;
-				addExpression(temp3, c.getAssociatedClasses());
+					temp3 = temp1 + "<=" + temp2;
+					addExpression(temp3, c.getAssociatedClasses());
 				
+				}
+			} else if ((at_type == "bool")||(at_type == "boolean")) {
+				for (unsigned int k=0; k<a.attribute_values.size(); k++){
+					// create both an equality and an inequality expression
+					temp2 = a.attribute_values[k];
+					temp3 = temp1 + "==" + temp2;
+					addExpression(temp3, c.getAssociatedClasses());
+					//std::cout << temp3 << std::endl;
+					temp3 = temp1 + "!=" + temp2;
+					//std::cout << temp3 << std::endl;
+					addExpression(temp3, c.getAssociatedClasses());
+				}
 			}
 		}
 		
@@ -637,7 +652,7 @@
 	if (expression_p != expression_q){
 		p = getP();
 		q = getQ();
-		totalstring = p.getExpr() + " && " + q.getExpr();
+		totalstring = "(" + p.getExpr() + " && " + q.getExpr() + ")";
 
 	//	classes = p.getRelatedClasses();
 	//	classes.insert(q.getRelatedClasses().begin(), q.getRelatedClasses().end());
@@ -662,7 +677,7 @@
 		q = getQ();
 //		classes = p.getRelatedClasses();
 //		classes.insert(q.getRelatedClasses().begin(), q.getRelatedClasses().end());
-		totalstring = p.getExpr() + " || " + q.getExpr();
+		totalstring = "(" + p.getExpr() + " || " + q.getExpr() + ")";
 		val = addExpression(totalstring, classes); 
 	}
 	return (val);




More information about the Avida-cvs mailing list