Skip to content
Snippets Groups Projects
Commit 1717a083 authored by Bastien Sultan's avatar Bastien Sultan
Browse files

Merge branch 'master' of https://gitlab.telecom-paris.fr/mbe-tools/TTool into JURASSIC

parents 97510f2b 340cb3cc
No related branches found
No related tags found
1 merge request!478Adding a compiler for JURASSIC AMULET
/*Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Daniel Knorreck,
Ludovic Apvrille, Renaud Pacalet
*
* ludovic.apvrille AT telecom-paristech.fr
*
* This software is a computer program whose purpose is to allow the
* edition of TURTLE analysis, design and deployment diagrams, to
* allow the generation of RT-LOTOS or Java code from this diagram,
* and at last to allow the analysis of formal validation traces
* obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
* from INRIA Rhone-Alpes.
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
*/
Ludovic Apvrille, Renaud Pacalet
*
* ludovic.apvrille AT telecom-paristech.fr
*
* This software is a computer program whose purpose is to allow the
* edition of TURTLE analysis, design and deployment diagrams, to
* allow the generation of RT-LOTOS or Java code from this diagram,
* and at last to allow the analysis of formal validation traces
* obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
* from INRIA Rhone-Alpes.
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
*/
#ifndef ParameterH
#define ParameterH
......@@ -47,161 +47,161 @@ Ludovic Apvrille, Renaud Pacalet
class Parameter {
public:
///Constructor
virtual void print() const=0;
virtual std::ostream& writeObject(std::ostream& s) = 0;
virtual void streamStateXML(std::ostream& s) const = 0;
virtual void getP(void* op1 ...) const = 0;
virtual void getStateHash(HashAlgo* iHash) const = 0;
virtual void readFromStream(std::istream &is)=0;
///Constructor
virtual void print() const=0;
virtual std::ostream& writeObject(std::ostream& s) = 0;
virtual void streamStateXML(std::ostream& s) const = 0;
virtual void getP(void* op1 ...) const = 0;
virtual void getStateHash(HashAlgo* iHash) const = 0;
virtual void readFromStream(std::istream &is)=0;
///Stream operator >>
friend std::istream& operator >>(std::istream &is,Parameter* obj){
obj->readFromStream(is);
//for (unsigned int i=0;i<obj.size;i++){
// is >> obj._p[i];
//}
return is;
}
///Stream operator >>
friend std::istream& operator >>(std::istream &is,Parameter* obj){
obj->readFromStream(is);
//for (unsigned int i=0;i<obj.size;i++){
// is >> obj._p[i];
//}
return is;
}
};
template <typename T, int size>
class SizedParameter: public Parameter {
public:
SizedParameter(){
}
SizedParameter(){
}
SizedParameter(const T ip1 ...){
//#if size>0
if (size!=0){
va_list args; // argument list
va_start(args, ip1); // initialize args
_p[0]=ip1;
for (unsigned int i=1;i<size;i++){
_p[i]=va_arg(args, T);
}
}
//#endif
}
SizedParameter(const T ip1 ...){
//#if size>0
if (size!=0){
va_list args; // argument list
va_start(args, ip1); // initialize args
_p[0]=ip1;
for (unsigned int i=1;i<size;i++){
_p[i]=va_arg(args, T);
}
}
//#endif
}
SizedParameter(std::istream& s){
//#if size>0
for (unsigned int i=0;i<size;i++){
READ_STREAM(s, _p[i]);
}
SizedParameter(std::istream& s){
//#if size>0
for (int i=0;i<size;i++){
READ_STREAM(s, _p[i]);
}
#ifdef DEBUG_SERIALIZE
print();
print();
#endif
//#endif
}
//#endif
}
virtual ~SizedParameter(){
}
virtual ~SizedParameter(){
}
///Print function for testing purposes
void print() const{
//std::cerr << "print " << size << " elements in mempool " << &memPool << " :\n";
//#if size>0
for (unsigned int i=0;i<size;i++){
std::cout << " p[" << (i+1) << "]:" << _p[i];
}
//#endif
//std::cerr << std::endl;
//std::cerr << "end print:\n";
}
///Print function for testing purposes
void print() const{
//std::cerr << "print " << size << " elements in mempool " << &memPool << " :\n";
//#if size>0
for (int i=0;i<size;i++){
std::cout << " p[" << (i+1) << "]:" << _p[i];
}
//#endif
//std::cerr << std::endl;
//std::cerr << "end print:\n";
}
std::ostream& writeObject(std::ostream& s){
//#if size>0
//std::cout << "writeObject:\n";
for (unsigned int i=0;i<size;i++){
WRITE_STREAM(s, _p[i]);
}
std::ostream& writeObject(std::ostream& s){
//#if size>0
//std::cout << "writeObject:\n";
for (int i=0;i<size;i++){
WRITE_STREAM(s, _p[i]);
}
#ifdef DEBUG_SERIALIZE
print();
print();
#endif
//#endif
//std::cout << "end writeObject:\n";
return s;
}
//#endif
//std::cout << "end writeObject:\n";
return s;
}
///Streams the parameter in XML format
/**
\param s Stream
*/
void streamStateXML(std::ostream& s) const{
//std::cout << "streamStateXML:\n";
s << TAG_PARAMo;
//#if size>0
for (unsigned int i=0;i<size;i++){
s << TAG_Pxo << i << ">" << _p[i] << TAG_Pxc << i << ">";
}
//#endif
s << TAG_PARAMc;
//std::cout << "end streamStateXML:\n";
}
///Streams the parameter in XML format
/**
\param s Stream
*/
void streamStateXML(std::ostream& s) const{
//std::cout << "streamStateXML:\n";
s << TAG_PARAMo;
//#if size>0
for (int i=0;i<size;i++){
s << TAG_Pxo << i << ">" << _p[i] << TAG_Pxc << i << ">";
}
//#endif
s << TAG_PARAMc;
//std::cout << "end streamStateXML:\n";
}
/* template <typename T, int size> void SizedParameter<T,size>::setP(T ip1 ...){
va_list args; // argument list
va_start(args, ip1); // initialize args
_p[0]=ip1;
for (unsigned int i=1;i<size;i++){
_p[i]=va_arg(args, T);
}
}*/
/* template <typename T, int size> void SizedParameter<T,size>::setP(T ip1 ...){
va_list args; // argument list
va_start(args, ip1); // initialize args
_p[0]=ip1;
for (unsigned int i=1;i<size;i++){
_p[i]=va_arg(args, T);
}
}*/
void getP(void* op1 ...) const {
//std::cout << "getP:\n";
if(size!=0){
//#if size>0
T* arg= (T*) op1;
va_list args; // argument list
va_start(args, op1); // initialize args
for (unsigned int i=0;i<size;i++){
//std::cerr << "set Param " << i << "\n";
*arg=_p[i];
arg=va_arg(args, T*);
}
}
//#endif
//std::cout << "end getP:\n";
}
void getP(void* op1 ...) const {
//std::cout << "getP:\n";
if(size!=0){
//#if size>0
T* arg= (T*) op1;
va_list args; // argument list
va_start(args, op1); // initialize args
for (int i=0;i<size;i++){
//std::cerr << "set Param " << i << "\n";
*arg=_p[i];
arg=va_arg(args, T*);
}
}
//#endif
//std::cout << "end getP:\n";
}
//inline T getPByIndex(unsigned int iIndex){
// return _p[iIndex];
//}
//inline T getPByIndex(unsigned int iIndex){
// return _p[iIndex];
//}
void getStateHash(HashAlgo* iHash) const{
//#if size>0
//std::cout << "add param vals:\n";
for (unsigned int i=0;i<size;i++){
iHash->addValue((HashValueType)_p[i]);
//std::cout << _p[i] << ", ";
}
//std::cout << "\nend add param vals:\n";
//#endif
}
void getStateHash(HashAlgo* iHash) const{
//#if size>0
//std::cout << "add param vals:\n";
for (int i=0;i<size;i++){
iHash->addValue((HashValueType)_p[i]);
//std::cout << _p[i] << ", ";
}
//std::cout << "\nend add param vals:\n";
//#endif
}
static void * operator new(size_t iSize){
return memPool.pmalloc(iSize);
}
static void * operator new(size_t iSize){
return memPool.pmalloc(iSize);
}
static void operator delete(void *p, size_t iSize){
memPool.pfree(p, iSize);
}
static void operator delete(void *p, size_t iSize){
memPool.pfree(p, iSize);
}
void readFromStream(std::istream &is){
//#if size>0
for (unsigned int i=0;i<size;i++){
is >> _p[i];
}
//#endif
}
protected:
static MemPool<SizedParameter<T,size> > memPool;
//#if size>0
T _p[(size==0)?1:size];
//#endif
void readFromStream(std::istream &is){
//#if size>0
for (int i=0;i<size;i++){
is >> _p[i];
}
//#endif
}
protected:
static MemPool<SizedParameter<T,size> > memPool;
//#if size>0
T _p[(size==0)?1:size];
//#endif
};
......
......@@ -86,10 +86,19 @@ public class Penalties {
} else if ((indexD > -1) && (indexU > -1)) {
mustChange = true;
} else {
String remaining = "";
if (indexD > -1) {
mustChange = mustHandlePenalties == false;
remaining = data.substring(indexD+1);
} else {
mustChange = mustHandlePenalties == true;
remaining = data.substring(indexU+1);
}
if (mustChange == false) {
if (remaining.trim().length() > 0) {
mustChange = true;
}
}
}
} catch (FileException e) {
......
......@@ -25,7 +25,7 @@ public class TMLDeepCloneTests extends AbstractTest {
// Test true cases
@Test
@Test @SuppressWarnings("unchecked")
public void testDeepCloneTMLApplication() {
for(String fileName: TML_APP_FILES) {
fileName = getBaseResourcesDir() + PATH_TO_TEST_CLONE_FILE + fileName;
......@@ -48,6 +48,7 @@ public class TMLDeepCloneTests extends AbstractTest {
assertTrue(parsed);
TMLTextSpecification tmltsw = new TMLTextSpecification("original");
@SuppressWarnings("unchecked")
String outputTML = tmltsw.toTextFormat(tmlts.getTMLModeling());
TraceManager.addDev("Original:\n" + outputTML + "\n\n");
......@@ -67,6 +68,7 @@ public class TMLDeepCloneTests extends AbstractTest {
assertTrue(false);
}
tmltsw = new TMLTextSpecification("cloned");
outputTML = tmltsw.toTextFormat(cloned);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment