|
From: <got...@us...> - 2009-09-20 16:08:47
|
Revision: 346
http://scstudio.svn.sourceforge.net/scstudio/?rev=346&view=rev
Author: gotthardp
Date: 2009-09-20 16:08:35 +0000 (Sun, 20 Sep 2009)
Log Message:
-----------
Fixed EOL problems of z120 parser testing.
Fixed additional file properties.
Modified Paths:
--------------
trunk/tests/z120_test/z120_diff.py
Property Changed:
----------------
trunk/src/check/boundedness/
trunk/src/check/localchoice/
trunk/src/check/structure/
trunk/src/check/time/
Property changes on: trunk/src/check/boundedness
___________________________________________________________________
Added: svn:ignore
+ CMakeFiles
cmake_install.cmake
CTestTestfile.cmake
*.dir
Makefile
*.vcproj
Property changes on: trunk/src/check/localchoice
___________________________________________________________________
Added: svn:ignore
+ CMakeFiles
cmake_install.cmake
CTestTestfile.cmake
*.dir
Makefile
*.vcproj
Property changes on: trunk/src/check/structure
___________________________________________________________________
Added: svn:ignore
+ CMakeFiles
cmake_install.cmake
CTestTestfile.cmake
*.dir
Makefile
*.vcproj
Property changes on: trunk/src/check/time
___________________________________________________________________
Added: svn:ignore
+ CMakeFiles
cmake_install.cmake
CTestTestfile.cmake
*.dir
Makefile
*.vcproj
Modified: trunk/tests/z120_test/z120_diff.py
===================================================================
--- trunk/tests/z120_test/z120_diff.py 2009-09-20 15:33:38 UTC (rev 345)
+++ trunk/tests/z120_test/z120_diff.py 2009-09-20 16:08:35 UTC (rev 346)
@@ -3,14 +3,14 @@
import difflib
import sys
-p = subprocess.Popen([sys.argv[1], sys.argv[2], sys.argv[3]], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+p = subprocess.Popen([sys.argv[1], sys.argv[2], sys.argv[3]], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
if int(sys.argv[3]) == 0:
exit = p.wait()
sys.exit(exit)
else:
- f = open(sys.argv[2] + ".result", "r+")
+ f = open(sys.argv[2] + ".result", "rt")
result = difflib.unified_diff(f.readlines(), p.stderr.readlines()+ p.stdout.readlines())
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2009-09-20 21:09:48
|
Revision: 347
http://scstudio.svn.sourceforge.net/scstudio/?rev=347&view=rev
Author: gotthardp
Date: 2009-09-20 21:09:34 +0000 (Sun, 20 Sep 2009)
Log Message:
-----------
New feature: Global comments (text "xxx") are now supported by msc.h and Visio add-on.
Bug fix: Repaint and Beautify does not remove unknown shapes.
Bug fix: Added svn:ignore properties.
Modified Paths:
--------------
trunk/src/check/time/time_consistency.h
trunk/src/data/Z120/z120_save.cpp
trunk/src/data/msc.h
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/extract.cpp
trunk/src/view/visio/addon/extract.h
trunk/src/view/visio/addon/visualize.cpp
trunk/src/view/visio/addon/visualize.h
trunk/src/view/visio/stencils/Sequence Chart Studio/Basic MSC.vsx
trunk/src/view/visio/stencils/Sequence Chart Studio/HMSC.vsx
Property Changed:
----------------
trunk/doc/
trunk/src/data/Z120/
trunk/src/data/modelchecking/
Property changes on: trunk/doc
___________________________________________________________________
Modified: svn:ignore
- CMakeFiles
cmake_install.cmake
CTestTestfile.cmake
*.dir
Makefile
*.vcproj
+ CMakeFiles
cmake_install.cmake
CTestTestfile.cmake
*.dir
Makefile
*.vcproj
*.log
*.aux
*.out
Modified: trunk/src/check/time/time_consistency.h
===================================================================
--- trunk/src/check/time/time_consistency.h 2009-09-20 16:08:35 UTC (rev 346)
+++ trunk/src/check/time/time_consistency.h 2009-09-20 21:09:34 UTC (rev 347)
@@ -133,7 +133,7 @@
};
//! Abstract class to the tightener
-class MscIntervalTightener
+class SCTIME_EXPORT MscIntervalTightener
{
public:
virtual ~MscIntervalTightener() {}
@@ -144,7 +144,7 @@
};
//! Abstract class to the Consistency checker
-class MscIntervalConsistencyCheck
+class SCTIME_EXPORT MscIntervalConsistencyCheck
{
public:
virtual ~MscIntervalConsistencyCheck() {}
Property changes on: trunk/src/data/Z120
___________________________________________________________________
Modified: svn:ignore
- CMakeFiles
cmake_install.cmake
CTestTestfile.cmake
*.dir
Makefile
*.vcproj
*.swo
*.swp
+ CMakeFiles
cmake_install.cmake
CTestTestfile.cmake
*.dir
Makefile
*.vcproj
Z120.tokens
Z120Lexer.*
Z120Parser.*
Modified: trunk/src/data/Z120/z120_save.cpp
===================================================================
--- trunk/src/data/Z120/z120_save.cpp 2009-09-20 16:08:35 UTC (rev 346)
+++ trunk/src/data/Z120/z120_save.cpp 2009-09-20 21:09:34 UTC (rev 347)
@@ -83,6 +83,73 @@
std::wstring m_name;
};
+/* String modifier to print Z.120 character strings in a correct character set.
+ */
+class VALID_CHARACTER_STRING
+{
+public:
+ VALID_CHARACTER_STRING(const std::wstring &text)
+ : m_text(text)
+ { }
+
+ friend std::ostream&
+ operator<<(std::ostream& os, const VALID_CHARACTER_STRING& value)
+ {
+ static const char replacement = '_';
+ bool was_replacement = false;
+
+ for(std::wstring::const_iterator pos = value.m_text.begin();
+ pos != value.m_text.end(); pos++)
+ {
+ char stripped;
+
+ if(*pos == '\'')
+ {
+ // double the apostrophe
+ os << "''";
+ was_replacement = false;
+ }
+ else if(*pos == '\r')
+ {
+ // ignored characters
+ was_replacement = false;
+ }
+ else if(*pos == '\n' || *pos == '\t')
+ {
+ // characters transformed to a space character
+ os << " ";
+ was_replacement = false;
+ }
+ else if(iswprint(*pos))
+ {
+ // other printable characters
+ os << (char)*pos;
+ was_replacement = false;
+ }
+ else if((stripped = strip_diacritics(*pos)) != 0)
+ {
+ // use the transliteration table
+ os << stripped;
+ was_replacement = false;
+ }
+ else
+ {
+ // replace invalid characters by the 'replacement'
+ // shrink multiple replacements into a single characters
+ if(!was_replacement)
+ os << replacement;
+
+ was_replacement = true;
+ }
+ }
+
+ return os;
+ }
+
+private:
+ std::wstring m_text;
+};
+
ExportFormatter::PreconditionList Z120::get_preconditions(MscPtr msc) const
{
ExportFormatter::PreconditionList result;
@@ -181,6 +248,32 @@
}
}
+// print global comments
+// note: used when the comment is attached to BMsc or HMsc
+template<class C>
+void print_texts(std::ostream& stream, const boost::intrusive_ptr<C>& commentable)
+{
+ for(CommentPtrSet::const_iterator cpos = commentable->get_comments().begin();
+ cpos != commentable->get_comments().end(); cpos++)
+ {
+ print_element_attributes(stream, *cpos);
+ stream << "text '" << VALID_CHARACTER_STRING((*cpos)->get_text()) << "';" << std::endl;
+ }
+}
+
+// print local comments
+// note: used when the comment is attached to Event, HMscNode, etc.
+template<class C>
+void print_comments(std::ostream& stream, const boost::intrusive_ptr<C>& commentable)
+{
+ for(CommentPtrSet::const_iterator cpos = commentable->get_comments().begin();
+ cpos != commentable->get_comments().end(); cpos++)
+ {
+ print_element_attributes(stream, *cpos);
+ stream << " comment '" << VALID_CHARACTER_STRING((*cpos)->get_text()) << "'";
+ }
+}
+
void print_event(std::ostream& stream, PtrIDMap<MscMessagePtr>& message_id_map,
const EventPtr& event)
{
@@ -259,6 +352,8 @@
print_element_attributes(stream, bmsc);
stream << "msc " << VALID_NAME(bmsc->get_label()) << ";" << std::endl;
+ // print global comments
+ print_texts(stream, bmsc);
// declare instances
for(InstancePtrList::const_iterator ipos = bmsc->get_instances().begin();
@@ -293,6 +388,7 @@
stream << "label e" << event_id_map.get_id(event) << ";" << std::endl;
print_event(stream, message_id_map, event);
+ print_comments(stream, event);
stream << ";" << std::endl;
print_time_relations(stream, event_id_map, event);
}
@@ -342,6 +438,7 @@
push_back_if_unique<CoregionEventPtr>(event_stack, successor);
}
+ print_comments(stream, *epos);
stream << ";" << std::endl;
print_time_relations(stream, event_id_map, *epos);
}
@@ -436,6 +533,8 @@
print_element_attributes(stream, hmsc);
stream << "msc " << VALID_NAME(hmsc->get_label()) << ";" << std::endl;
+ // print global comments
+ print_texts(stream, hmsc);
// initialize the stack with the start node
push_back_if_unique<HMscNodePtr>(node_stack, hmsc->get_start());
@@ -507,6 +606,7 @@
}
}
+ print_comments(stream, *npos);
stream << ";" << std::endl;
if(reference_node != NULL)
Property changes on: trunk/src/data/modelchecking
___________________________________________________________________
Added: svn:ignore
+ CMakeFiles
cmake_install.cmake
CTestTestfile.cmake
*.dir
Makefile
*.vcproj
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2009-09-20 16:08:35 UTC (rev 346)
+++ trunk/src/data/msc.h 2009-09-20 21:09:34 UTC (rev 347)
@@ -36,6 +36,8 @@
#include "data/export.h"
class MscElement;
+class Comment;
+class Commentable;
class HMscNode;
class InnerNode;
class ReferenceNode;
@@ -65,6 +67,10 @@
typedef boost::intrusive_ptr<MscElement> MscElementPtr;
+typedef boost::intrusive_ptr<Comment> CommentPtr;
+typedef std::set<CommentPtr> CommentPtrSet;
+typedef boost::intrusive_ptr<Commentable> CommentablePtr;
+
typedef boost::intrusive_ptr<Msc> MscPtr;
typedef boost::intrusive_ptr<BMsc> BMscPtr;
@@ -427,15 +433,87 @@
}
};
+/**
+ * \brief Represents a text block or a text comment in MSC.
+ */
+class SCMSC_EXPORT Comment : public MscElementTmpl<Comment>
+{
+protected:
+ std::wstring m_text;
+
+ MscPoint m_position;
+ Coordinate m_width;
+
+public:
+ Comment(const std::wstring& text=L"") :
+ m_text(text), m_position(), m_width(20)
+ {
+ }
+
+ void set_text(const std::wstring& text)
+ {
+ m_text = text;
+ }
+
+ const std::wstring& get_text() const
+ {
+ return m_text;
+ }
+
+ void set_position(const MscPoint& position)
+ {
+ m_position = position;
+ }
+
+ const MscPoint& get_position() const
+ {
+ return m_position;
+ }
+
+ void set_width(Coordinate width)
+ {
+ m_width = width;
+ }
+
+ Coordinate get_width() const
+ {
+ return m_width;
+ }
+};
+
+/**
+ * \brief Represents a class that may reference text comments.
+ */
+class SCMSC_EXPORT Commentable
+{
+protected:
+ CommentPtrSet m_comments;
+
+public:
+ virtual ~Commentable()
+ {
+ }
+
+ void add_comment(CommentPtr comment)
+ {
+ m_comments.insert(comment);
+ }
+
+ const CommentPtrSet& get_comments() const
+ {
+ return m_comments;
+ }
+};
+
// An empty structure used by extern "C" pointers to Msc
struct s_Msc { };
/**
* \brief Represents virtual base class for BMsc and HMsc.
*/
-class SCMSC_EXPORT Msc:public s_Msc, public MscElementTmpl<Msc>
+class SCMSC_EXPORT Msc :
+ public s_Msc, public MscElementTmpl<Msc>, public Commentable
{
-
protected:
/**
@@ -465,7 +543,7 @@
/**
* Getter for m_label
*/
- void set_label(const std::wstring label)
+ void set_label(const std::wstring& label)
{
m_label = label;
}
@@ -527,7 +605,8 @@
/**
* \brief Base abstract class for node of HMsc
*/
-class SCMSC_EXPORT HMscNode:public MscElementTmpl<HMscNode>
+class SCMSC_EXPORT HMscNode :
+ public MscElementTmpl<HMscNode>, public Commentable
{
MscPoint m_position;
@@ -1409,9 +1488,9 @@
/**
* \brief Event which occurs in EventArea.
*/
-class SCMSC_EXPORT Event:public MscElementTmpl<Event>
+class SCMSC_EXPORT Event :
+ public MscElementTmpl<Event>, public Commentable
{
-
protected:
/**
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2009-09-20 16:08:35 UTC (rev 346)
+++ trunk/src/view/visio/addon/document.cpp 2009-09-20 21:09:34 UTC (rev 347)
@@ -928,6 +928,55 @@
return VAORC_FAILURE;
}
+void RemoveKnownSymbols(Visio::IVPagePtr page)
+{
+ Visio::IVSelectionPtr selection =
+ page->CreateSelection(Visio::visSelTypeEmpty, Visio::visSelModeSkipSuper);
+
+ // walk through all shapes
+ for(int i = 1; i <= page->Shapes->Count; i++)
+ {
+ Visio::IVShapePtr shape = page->Shapes->Item[i];
+
+ TShapeType type = get_shape_type(shape);
+ switch(type)
+ {
+ case ST_BMSC_INSTANCE:
+ case ST_BMSC_MESSAGE:
+ case ST_BMSC_MESSAGE_LOST:
+ case ST_BMSC_MESSAGE_FOUND:
+ case ST_BMSC_COREGION:
+ case ST_BMSC_ORDER_LINE:
+ case ST_BMSC_ORDER_ARROW:
+ case ST_HMSC_CONNECTION:
+ case ST_HMSC_START:
+ case ST_HMSC_END:
+ case ST_HMSC_REFERENCE:
+ case ST_HMSC_LINE:
+ case ST_HMSC_ARROW:
+ case ST_COMMENT:
+ case ST_TEXT:
+ case ST_TIME_INTERVAL:
+ case ST_TIME_DIRECTED:
+ // known symbols will be repainted
+ selection->Select(shape, Visio::visSelect);
+ break;
+
+ case ST_TIME_ABSOLUTE:
+ case ST_BMSC_ACTION:
+ case ST_BMSC_CONDITION:
+ case ST_HMSC_CONDITION:
+ case ST_MARKER_EVENT:
+ case ST_UNKNOWN:
+ // keep unknown and shapes not yet supported in msc.h
+ break;
+ }
+ }
+
+ // delete all selected shapes
+ selection->Delete();
+}
+
VAORC CDocumentMonitor::OnMenuRepaint(Visio::IVApplicationPtr vsoApp)
{
// clear the verification report
@@ -947,8 +996,8 @@
if(msc == NULL)
return VAORC_FAILURE;
- Visio::IVSelectionPtr selection = page->CreateSelection(Visio::visSelTypeAll, Visio::visSelModeSkipSuper);
- selection->Delete();
+ // delete all MSC symbols, preserve ignored shapes
+ RemoveKnownSymbols(page);
CDrawingVisualizer visualizer(vsoApp);
visualizer.visualize_msc(page, msc);
@@ -981,8 +1030,8 @@
// generate graphical layout information
beautify.process(msc);
- Visio::IVSelectionPtr selection = vsoPage->CreateSelection(Visio::visSelTypeAll, Visio::visSelModeSkipSuper);
- selection->Delete();
+ // delete all MSC symbols, preserve ignored shapes
+ RemoveKnownSymbols(vsoPage);
CDrawingVisualizer visualizer(vsoApp);
visualizer.visualize_msc(vsoPage, msc);
Modified: trunk/src/view/visio/addon/extract.cpp
===================================================================
--- trunk/src/view/visio/addon/extract.cpp 2009-09-20 16:08:35 UTC (rev 346)
+++ trunk/src/view/visio/addon/extract.cpp 2009-09-20 21:09:34 UTC (rev 347)
@@ -208,6 +208,11 @@
page_height - shape->CellsSRC[visSectionObject][visRowXFormOut][visXFormPinY]->Result[visMillimeters]);
}
+Coordinate CDrawingExtractor::GetWidth(Visio::IVShapePtr shape)
+{
+ return shape->CellsSRC[visSectionObject][visRowXFormOut][visXFormWidth]->Result[visMillimeters];
+}
+
Coordinate CDrawingExtractor::GetControlPos(Visio::IVShapePtr shape, const wchar_t* row)
{
// walk though all controls
@@ -529,10 +534,19 @@
case ST_BMSC_ORDER_LINE:
case ST_BMSC_ORDER_ARROW:
case ST_COMMENT:
- case ST_TEXT:
// ignore other basic MSC symbols
break;
+ case ST_TEXT:
+ {
+ Comment* new_comment = new Comment((const wchar_t*)shape->Text);
+ new_comment->set_position(GetPinPos(shape));
+ new_comment->set_width(GetWidth(shape));
+
+ bmsc->add_comment(new_comment);
+ break;
+ }
+
case ST_HMSC_CONNECTION:
case ST_HMSC_START:
case ST_HMSC_END:
@@ -1135,10 +1149,19 @@
break;
case ST_COMMENT:
- case ST_TEXT:
// ignore text and comments
break;
+ case ST_TEXT:
+ {
+ Comment* new_comment = new Comment((const wchar_t*)shape->Text);
+ new_comment->set_position(GetPinPos(shape));
+ new_comment->set_width(GetWidth(shape));
+
+ hmsc->add_comment(new_comment);
+ break;
+ }
+
case ST_HMSC_CONNECTION:
{
ConnectionNode *new_connection = new ConnectionNode();
Modified: trunk/src/view/visio/addon/extract.h
===================================================================
--- trunk/src/view/visio/addon/extract.h 2009-09-20 16:08:35 UTC (rev 346)
+++ trunk/src/view/visio/addon/extract.h 2009-09-20 21:09:34 UTC (rev 347)
@@ -131,6 +131,7 @@
MscPoint GetLineBegin(Visio::IVShapePtr shape);
MscPoint GetLineEnd(Visio::IVShapePtr shape);
MscPoint GetPinPos(Visio::IVShapePtr shape);
+ Coordinate GetWidth(Visio::IVShapePtr shape);
Coordinate GetControlPos(Visio::IVShapePtr shape, const wchar_t* row);
//! assert the given shape has no connections to its sub-shapes
Modified: trunk/src/view/visio/addon/visualize.cpp
===================================================================
--- trunk/src/view/visio/addon/visualize.cpp 2009-09-20 16:08:35 UTC (rev 346)
+++ trunk/src/view/visio/addon/visualize.cpp 2009-09-20 21:09:34 UTC (rev 347)
@@ -39,6 +39,8 @@
m_ordering_side_side_master = bmsc_stencil->Masters->Item["Ordering Side-Side"];
m_ordering_sides_master = bmsc_stencil->Masters->Item["Ordering Sides"];
m_ordering_arrow_master = bmsc_stencil->Masters->Item["Ordering Arrow"];
+ m_comment_master = bmsc_stencil->Masters->Item["Comment"];
+ m_text_master = bmsc_stencil->Masters->Item["Text"];
m_time_interval_master = bmsc_stencil->Masters->Item["Time Interval"];
m_directed_interval_master = bmsc_stencil->Masters->Item["Directed Interval"];
@@ -305,15 +307,33 @@
}
}
-void CDrawingVisualizer::visualize_bmsc(Visio::IVPagePtr vsoPage, const BMscPtr& bmsc)
+void CDrawingVisualizer::visualize_msc_base(Visio::IVPagePtr vsoPage, const MscPtr& msc)
{
try
{
- vsoPage->Name = bmsc->get_label().c_str();
+ vsoPage->Name = msc->get_label().c_str();
}
catch (_com_error &)
{ }
+ // visualize global comments
+ for(CommentPtrSet::const_iterator cpos = msc->get_comments().begin();
+ cpos != msc->get_comments().end(); cpos++)
+ {
+ Visio::IVShapePtr text = DropMaster(vsoPage, m_text_master, (*cpos)->get_position());
+ text->Text = (*cpos)->get_text().c_str();
+ text->CellsSRC[visSectionObject][visRowXFormOut][visXFormWidth]->Result[visMillimeters] = (*cpos)->get_width();
+
+ if((*cpos)->get_marked())
+ MarkShape(text);
+ }
+}
+
+void CDrawingVisualizer::visualize_bmsc(Visio::IVPagePtr vsoPage, const BMscPtr& bmsc)
+{
+ // drawing name and textual comments
+ visualize_msc_base(vsoPage, bmsc);
+
std::map<InstancePtr,Visio::IVShapePtr> instances;
// visualize all instances
@@ -535,12 +555,8 @@
void CDrawingVisualizer::visualize_hmsc(Visio::IVPagePtr vsoPage, const HMscPtr& hmsc)
{
- try
- {
- vsoPage->Name = hmsc->get_label().c_str();
- }
- catch (_com_error &)
- { }
+ // drawing name and textual comments
+ visualize_msc_base(vsoPage, hmsc);
NodePtrMap nodes;
Modified: trunk/src/view/visio/addon/visualize.h
===================================================================
--- trunk/src/view/visio/addon/visualize.h 2009-09-20 16:08:35 UTC (rev 346)
+++ trunk/src/view/visio/addon/visualize.h 2009-09-20 21:09:34 UTC (rev 347)
@@ -37,6 +37,8 @@
Visio::IVMasterPtr m_ordering_side_side_master;
Visio::IVMasterPtr m_ordering_sides_master;
Visio::IVMasterPtr m_ordering_arrow_master;
+ Visio::IVMasterPtr m_comment_master;
+ Visio::IVMasterPtr m_text_master;
Visio::IVMasterPtr m_time_interval_master;
Visio::IVMasterPtr m_directed_interval_master;
@@ -67,6 +69,7 @@
void show_time_relations(Visio::IVPagePtr vsoPage, TimeRelationEventPtrMap& time_relations,
Visio::IVShapePtr parent, EventPtr event);
+ void visualize_msc_base(Visio::IVPagePtr vsoPage, const MscPtr& msc);
void visualize_bmsc(Visio::IVPagePtr vsoPage, const BMscPtr& bmsc);
typedef std::map<HMscNodePtr,Visio::IVShapePtr> NodePtrMap;
Modified: trunk/src/view/visio/stencils/Sequence Chart Studio/Basic MSC.vsx
===================================================================
--- trunk/src/view/visio/stencils/Sequence Chart Studio/Basic MSC.vsx 2009-09-20 16:08:35 UTC (rev 346)
+++ trunk/src/view/visio/stencils/Sequence Chart Studio/Basic MSC.vsx 2009-09-20 21:09:34 UTC (rev 347)
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8' ?>
-<VisioDocument key='EBEFEFB9E4BDD1EDE54E236CA68CC40668BC504AE72AA05E5DAE31062A1AAC5EEB122A09E1AD319BA1611EF056B548FCBF74C66B3F58862A26D786B6D16F2C52' start='190' xmlns='http://schemas.microsoft.com/visio/2003/core' metric='0' DocLangID='1033' buildnum='8161' version='11.0' xml:space='preserve'><DocumentProperties><Title>Basic MSC</Title><Creator>Petr Gotthard</Creator><Company>Brno</Company><BuildNumberCreated>738205665</BuildNumberCreated><BuildNumberEdited>738205665</BuildNumberEdited><TimeCreated>2008-12-14T11:32:13</TimeCreated><TimeSaved>2009-09-20T15:41:50</TimeSaved><TimeEdited>2009-09-20T15:41:31</TimeEdited><TimePrinted>2008-12-14T11:32:13</TimePrinted></DocumentProperties><DocumentSettings TopPage='0' DefaultTextStyle='3' DefaultLineStyle='3' DefaultFillStyle='3' DefaultGuideStyle='4'><GlueSettings>9</GlueSettings><SnapSettings>65847</SnapSettings><SnapExtensions>34</SnapExtensions><DynamicGridEnabled>0</DynamicGridEnabled><ProtectStyles>0</ProtectStyles><ProtectShapes>0</ProtectShapes><ProtectMasters>0</ProtectMasters><ProtectBkgnds>0</ProtectBkgnds></DocumentSettings><Colors><ColorEntry IX='0' RGB='#000000'/><ColorEntry IX='1' RGB='#FFFFFF'/><ColorEntry IX='2' RGB='#FF0000'/><ColorEntry IX='3' RGB='#00FF00'/><ColorEntry IX='4' RGB='#0000FF'/><ColorEntry IX='5' RGB='#FFFF00'/><ColorEntry IX='6' RGB='#FF00FF'/><ColorEntry IX='7' RGB='#00FFFF'/><ColorEntry IX='8' RGB='#800000'/><ColorEntry IX='9' RGB='#008000'/><ColorEntry IX='10' RGB='#000080'/><ColorEntry IX='11' RGB='#808000'/><ColorEntry IX='12' RGB='#800080'/><ColorEntry IX='13' RGB='#008080'/><ColorEntry IX='14' RGB='#C0C0C0'/><ColorEntry IX='15' RGB='#E6E6E6'/><ColorEntry IX='16' RGB='#CDCDCD'/><ColorEntry IX='17' RGB='#B3B3B3'/><ColorEntry IX='18' RGB='#9A9A9A'/><ColorEntry IX='19' RGB='#808080'/><ColorEntry IX='20' RGB='#666666'/><ColorEntry IX='21' RGB='#4D4D4D'/><ColorEntry IX='22' RGB='#333333'/><ColorEntry IX='23' RGB='#1A1A1A'/></Colors><FaceNames><FaceName ID='1' Name='Arial Unicode MS' UnicodeRanges='-1 -369098753 63 0' CharSets='1614742015 -65536' Panos='2 11 6 4 2 2 2 2 2 4' Flags='357'/><FaceName ID='2' Name='Symbol' UnicodeRanges='0 0 0 0' CharSets='-2147483648 0' Panos='5 5 1 2 1 7 6 2 5 7' Flags='261'/><FaceName ID='3' Name='Wingdings' UnicodeRanges='0 0 0 0' CharSets='-2147483648 0' Panos='5 0 0 0 0 0 0 0 0 0' Flags='261'/><FaceName ID='4' Name='Arial' UnicodeRanges='31367 -2147483648 8 0' CharSets='1073742335 -65536' Panos='2 11 6 4 2 2 2 2 2 4' Flags='325'/><FaceName ID='5' Name='SimSun' UnicodeRanges='1627421663 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/><FaceName ID='6' Name='PMingLiU' UnicodeRanges='1627421663 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/><FaceName ID='7' Name='MS PGothic' UnicodeRanges='1627421663 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/><FaceName ID='8' Name='Dotum' UnicodeRanges='1627421663 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/><FaceName ID='9' Name='Sylfaen' UnicodeRanges='67110535 0 0 0' CharSets='536871071 0' Panos='1 10 5 2 5 3 6 3 3 3' Flags='325'/><FaceName ID='10' Name='Estrangelo Edessa' UnicodeRanges='-2147459008 0 128 0' CharSets='0 0' Panos='3 8 6 0 0 0 0 0 0 0' Flags='325'/><FaceName ID='11' Name='Vrinda' UnicodeRanges='65539 0 0 0' CharSets='1 0' Panos='1 1 6 0 1 1 1 1 1 1' Flags='325'/><FaceName ID='12' Name='Shruti' UnicodeRanges='262144 0 0 0' CharSets='0 0' Panos='2 0 5 0 0 0 0 0 0 0' Flags='325'/><FaceName ID='13' Name='Mangal' UnicodeRanges='32768 0 0 0' CharSets='0 0' Panos='0 0 4 0 0 0 0 0 0 0' Flags='325'/><FaceName ID='14' Name='Tunga' UnicodeRanges='4194304 0 0 0' CharSets='0 0' Panos='0 0 4 0 0 0 0 0 0 0' Flags='325'/><FaceName ID='15' Name='Sendnya' UnicodeRanges='1627421663 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/><FaceName ID='16' Name='Raavi' UnicodeRanges='131072 0 0 0' CharSets='0 0' Panos='2 0 5 0 0 0 0 0 0 0' Flags='325'/><FaceName ID='17' Name='Dhenu' UnicodeRanges='1627421663 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/><FaceName ID='18' Name='Latha' UnicodeRanges='1048576 0 0 0' CharSets='0 0' Panos='2 0 4 0 0 0 0 0 0 0' Flags='325'/><FaceName ID='19' Name='Gautami' UnicodeRanges='2097152 0 0 0' CharSets='0 0' Panos='2 0 5 0 0 0 0 0 0 0' Flags='325'/><FaceName ID='20' Name='Cordia New' UnicodeRanges='1627421663 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/><FaceName ID='21' Name='MS Farsi' UnicodeRanges='1627421663 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/><FaceName ID='22' Name='Gulim' UnicodeRanges='1627421663 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/><FaceName ID='23' Name='Times New Roman' UnicodeRanges='31367 -2147483648 8 0' CharSets='1073742335 -65536' Panos='2 2 6 3 5 4 5 2 3 4' Flags='325'/></FaceNames><StyleSheets><StyleSheet ID='0' NameU='No Style' Name='Žádný styl'><StyleProp><EnableLineProps>1</EnableLineProps><EnableFillProps>1</EnableFillProps><EnableTextProps>1</EnableTextProps><HideForApply>0</HideForApply></StyleProp><Line><LineWeight>0.01</LineWeight><LineColor>0</LineColor><LinePattern>1</LinePattern><Rounding>0</Rounding><EndArrowSize>2</EndArrowSize><BeginArrow>0</BeginArrow><EndArrow>0</EndArrow><LineCap>0</LineCap><BeginArrowSize>2</BeginArrowSize><LineColorTrans>0</LineColorTrans></Line><Fill><FillForegnd>1</FillForegnd><FillBkgnd>0</FillBkgnd><FillPattern>1</FillPattern><ShdwForegnd>0</ShdwForegnd><ShdwBkgnd>1</ShdwBkgnd><ShdwPattern>0</ShdwPattern><FillForegndTrans>0</FillForegndTrans><FillBkgndTrans>0</FillBkgndTrans><ShdwForegndTrans>0</ShdwForegndTrans><ShdwBkgndTrans>0</ShdwBkgndTrans><ShapeShdwType>0</ShapeShdwType><ShapeShdwOffsetX>0</ShapeShdwOffsetX><ShapeShdwOffsetY>0</ShapeShdwOffsetY><ShapeShdwObliqueAngle>0</ShapeShdwObliqueAngle><ShapeShdwScaleFactor>1</ShapeShdwScaleFactor></Fill><TextBlock><LeftMargin>0</LeftMargin><RightMargin>0</RightMargin><TopMargin>0</TopMargin><BottomMargin>0</BottomMargin><VerticalAlign>1</VerticalAlign><TextBkgnd>0</TextBkgnd><DefaultTabStop>0.5</DefaultTabStop><TextDirection>0</TextDirection><TextBkgndTrans>0</TextBkgndTrans></TextBlock><Protection><LockWidth>0</LockWidth><LockHeight>0</LockHeight><LockMoveX>0</LockMoveX><LockMoveY>0</LockMoveY><LockAspect>0</LockAspect><LockDelete>0</LockDelete><LockBegin>0</LockBegin><LockEnd>0</LockEnd><LockRotate>0</LockRotate><LockCrop>0</LockCrop><LockVtxEdit>0</LockVtxEdit><LockTextEdit>0</LockTextEdit><LockFormat>0</LockFormat><LockGroup>0</LockGroup><LockCalcWH>0</LockCalcWH><LockSelect>0</LockSelect><LockCustProp>0</LockCustProp></Protection><Misc><NoObjHandles>0</NoObjHandles><NonPrinting>0</NonPrinting><NoCtlHandles>0</NoCtlHandles><NoAlignBox>0</NoAlignBox><UpdateAlignBox>0</UpdateAlignBox><HideText>0</HideText><DynFeedback>0</DynFeedback><GlueType>0</GlueType><WalkPreference>0</WalkPreference><BegTrigger F='No Formula'>0</BegTrigger><EndTrigger F='No Formula'>0</EndTrigger><ObjType>0</ObjType><Comment V='null'/><IsDropSource>0</IsDropSource><NoLiveDynamics>0</NoLiveDynamics><LocalizeMerge>0</LocalizeMerge><Calendar>0</Calendar><LangID>1033</LangID><ShapeKeywords V='null'/><DropOnPageScale>1</DropOnPageScale></Misc><Event><TheData F='No Formula'>0</TheData><TheText F='No Formula'>0</TheText><EventDblClick F='No Formula'>0</EventDblClick><EventXFMod F='No Formula'>0</EventXFMod><EventDrop F='No Formula'>0</EventDrop></Event><Help><HelpTopic V='null'/><Copyright V='null'/></Help><LayerMem><LayerMember V='null'/></LayerMem><RulerGrid><XRulerDensity>32</XRulerDensity><YRulerDensity>32</YRulerDensity><XRulerOrigin>0</XRulerOrigin><YRulerOrigin>0</YRulerOrigin><XGridDensity>8</XGridDensity><YGridDensity>8</YGridDensity><XGridSpacing>0</XGridSpacing><YGridSpacing>0</YGridSpacing><XGridOrigin>0</XGridOrigin><YGridOrigin>0</YGridOrigin></RulerGrid><Image><Gamma>1</Gamma><Contrast>0.5</Contrast><Brightness>0.5</Brightness><Sharpen>0</Sharpen><Blur>0</Blur><Denoise>0</Denoise><Transparency>0</Transparency></Image><Group><SelectMode>1</SelectMode><DisplayMode>2</DisplayMode><IsDropTarget>0</IsDropTarget><IsSnapTarget>1</IsSnapTarget><IsTextEditTarget>1</IsTextEditTarget><DontMoveChildren>0</DontMoveChildren></Group><Layout><ShapePermeableX>0</ShapePermeableX><ShapePermeableY>0</ShapePermeableY><ShapePermeablePlace>0</ShapePermeablePlace><ShapeFixedCode>0</ShapeFixedCode><ShapePlowCode>0</ShapePlowCode><ShapeRouteStyle>0</ShapeRouteStyle><ConFixedCode>0</ConFixedCode><ConLineJumpCode>0</ConLineJumpCode><ConLineJumpStyle>0</ConLineJumpStyle><ConLineJumpDirX>0</ConLineJumpDirX><ConLineJumpDirY>0</ConLineJumpDirY><ShapePlaceFlip>0</ShapePlaceFlip><ConLineRouteExt>0</ConLineRouteExt><ShapeSplit>0</ShapeSplit><ShapeSplittable>0</ShapeSplittable></Layout><PageLayout><ResizePage>0</ResizePage><EnableGrid>0</EnableGrid><DynamicsOff>0</DynamicsOff><CtrlAsInput>0</CtrlAsInput><PlaceStyle>0</PlaceStyle><RouteStyle>0</RouteStyle><PlaceDepth>0</PlaceDepth><PlowCode>0</PlowCode><LineJumpCode>1</LineJumpCode><LineJumpStyle>0</LineJumpStyle><PageLineJumpDirX>0</PageLineJumpDirX><PageLineJumpDirY>0</PageLineJumpDirY><LineToNodeX>0.125</LineToNodeX><LineToNodeY>0.125</LineToNodeY><BlockSizeX>0.25</BlockSizeX><BlockSizeY>0.25</BlockSizeY><AvenueSizeX>0.375</AvenueSizeX><AvenueSizeY>0.375</AvenueSizeY><LineToLineX>0.125</LineToLineX><LineToLineY>0.125</LineToLineY><LineJumpFactorX>0.66666666666667</LineJumpFactorX><LineJumpFactorY>0.66666666666667</LineJumpFactorY><LineAdjustFrom>0</LineAdjustFrom><LineAdjustTo>0</LineAdjustTo><PlaceFlip>0</PlaceFlip><LineRouteExt>0</LineRouteExt><PageShapeSplit>0</PageShapeSplit></PageLayout><PrintProps><PageLeftMargin>0.25</PageLeftMargin><PageRightMargin>0.25</PageRightMargin><PageTopMargin>0.25</PageTopMargin><PageBottomMargin>0.25</PageBottomMargin><ScaleX>1</ScaleX><ScaleY>1</ScaleY><PagesX>1</PagesX><PagesY>1</PagesY><CenterX>0</CenterX><CenterY>0</CenterY><OnPage>0</OnPage><PrintGrid>0</PrintGrid><PrintPageOrientation>1</PrintPageOrientation><PaperKind>1</PaperKind><PaperSource>7</PaperSource></PrintProps><PageProps><PageWidth Unit='NUM' F='No Formula'>0</PageWidth><PageHeight Unit='NUM' F='No Formula'>0</PageHeight><ShdwOffsetX Unit='NUM' F='No Formula'>0</ShdwOffsetX><ShdwOffsetY Unit='NUM' F='No Formula'>0</ShdwOffsetY><PageScale F='No Formula'>0</PageScale><DrawingScale F='No Formula'>0</DrawingScale><DrawingSizeType F='No Formula'>0</DrawingSizeType><DrawingScaleType F='No Formula'>0</DrawingScaleType><InhibitSnap F='No Formula'>0</InhibitSnap><UIVisibility F='No Formula'>0</UIVisibility><ShdwType F='No Formula'>0</ShdwType><ShdwObliqueAngle Unit='NUM' F='No Formula'>0</ShdwObliqueAngle><ShdwScaleFactor F='No Formula'>0</ShdwScaleFactor></PageProps><Char IX='0'><Font>4</Font><Color>0</Color><Style>0</Style><Case>0</Case><Pos>0</Pos><FontScale>1</FontScale><Size>0.1666666666666667</Size><DblUnderline>0</DblUnderline><Overline>0</Overline><Strikethru>0</Strikethru><Highlight>0</Highlight><DoubleStrikethrough>0</DoubleStrikethrough><RTLText>0</RTLText><UseVertical>0</UseVertical><Letterspace>0</Letterspace><ColorTrans>0</ColorTrans><AsianFont>0</AsianFont><ComplexScriptFont>0</ComplexScriptFont><LocalizeFont>0</LocalizeFont><ComplexScriptSize>-1</ComplexScriptSize><LangID>1033</LangID></Char><Para IX='0'><IndFirst>0</IndFirst><IndLeft>0</IndLeft><IndRight>0</IndRight><SpLine>-1.2</SpLine><SpBefore>0</SpBefore><SpAfter>0</SpAfter><HorzAlign>1</HorzAlign><Bullet>0</Bullet><BulletStr V='null'/><BulletFont>0</BulletFont><LocalizeBulletFont>0</LocalizeBulletFont><BulletFontSize>-1</BulletFontSize><TextPosAfterBullet>0</TextPosAfterBullet><Flags>0</Flag...
[truncated message content] |
|
From: <ma...@us...> - 2009-09-21 11:28:29
|
Revision: 349
http://scstudio.svn.sourceforge.net/scstudio/?rev=349&view=rev
Author: madzin
Date: 2009-09-21 11:28:21 +0000 (Mon, 21 Sep 2009)
Log Message:
-----------
New error messages
--Thir line, and those below, will be ignored--
M trunk/tests/z120_test/z120_test42.mpr.result
M trunk/tests/z120_test/z120_test50.mpr.result
M trunk/tests/z120_test/z120_test53.mpr.result
A trunk/src/data/Z120/display_error.cpp
M trunk/src/data/Z120/Z120.g
A trunk/src/data/Z120/display_error.h
M trunk/src/data/Z120/Context.cpp
M trunk/src/data/Z120/CMakeLists.txt
Modified Paths:
--------------
trunk/src/data/Z120/CMakeLists.txt
trunk/src/data/Z120/Context.cpp
trunk/src/data/Z120/Z120.g
trunk/tests/z120_test/z120_test42.mpr.result
trunk/tests/z120_test/z120_test50.mpr.result
trunk/tests/z120_test/z120_test53.mpr.result
Added Paths:
-----------
trunk/src/data/Z120/display_error.cpp
trunk/src/data/Z120/display_error.h
Modified: trunk/src/data/Z120/CMakeLists.txt
===================================================================
--- trunk/src/data/Z120/CMakeLists.txt 2009-09-20 23:03:16 UTC (rev 348)
+++ trunk/src/data/Z120/CMakeLists.txt 2009-09-21 11:28:21 UTC (rev 349)
@@ -12,7 +12,10 @@
z120_load.cpp
Z120.g
Context.h
+ Context_Impl.h
Context.cpp
+ display_error.h
+ display_error.cpp
Z120Lexer.c
Z120Parser.c)
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2009-09-20 23:03:16 UTC (rev 348)
+++ trunk/src/data/Z120/Context.cpp 2009-09-21 11:28:21 UTC (rev 349)
@@ -28,72 +28,8 @@
#ifndef __ParserStruct__
#define __ParserStruct__
-#include "data/Z120/Context.h"
-#include <stdlib.h>
-#include <string>
-#include <iostream>
-#include <map>
-#include <list>
-#include <set>
-#include "data/msc.h"
-#include "z120.h"
+#include "Context_Impl.h"
-struct Context
-{
- std::string msc_name;
-
- /*
- * BMsc: name of instance
- * HMsc: name of node
- */
- std::string element_name;
-
- /*
- * Textual file
- */
- typedef std::multimap<std::string, MscPtr> MscPtrMap;
- MscPtrMap mscs; // map of msc in the file
- typedef std::set<std::string> MscNameSet;
- MscNameSet nonpointed; // msc which is not refered
- std::map<std::string, std::set<ReferenceNodePtr> > future_reference; //map of name of nodes on which was refered and does not exist
- Z120* z;
-
- /*
- * BMsc
- */
- BMscPtr myBmsc;
- std::set<std::string> coregion_area_finished; // set of instances which has currently finished coregion area
- std::set<std::string> coregion_area_opened; //set of instances which has currently opend coregion area
- std::map<std::string, InstancePtr> instances; // map of instances (key: name of instance, value: smart pointer to instance)
- std::multimap<std::string, CompleteMessagePtr> messages; // map of future complete messages
- std::map<std::string, EventPtr> future_events; // map of name of events on which was pointed before they were created
- std::map<std::string, CoregionEventPtr> named_events; // map of name of events
- std::set<std::string> order_events; //set of name of events which takes place after keywords 'before', 'after'
- EventPtr current_event; //event which was currently created
- std::string event_name; //name of event
- int not_create_event; //flag for event in case msc has two labeled event with the same name
- int no_message_label; //flag for message which does not have label
- int open_instance; //counter of open instances
-
- /*
- * HMsc
- */
- HMscPtr myHmsc;
- StartNodePtr start_node;
- std::pair<std::string, EndNodePtr> end_node;
- std::list<std::string> connect_name; // name of HMsc nodes which are successors of actual node
- std::string reference_name;
- std::string condition_name;
- std::map<std::string, HMscNodePtr> hmsc_nodes; // map of hmsc nodes (key: name of node, value: smart pointer to node)
- std::map<std::string, std::set<std::string> > future_connections; // map of nodes to which node will be connected
- int node_type; //flag to recognize HMsc nodes (ConnectionNode, ReferenceNode, ConditionNode). Used in Z120.g
-
- ~Context() {}
-};
-
-
-void create_future_connections_fun(struct Context* context, SuccessorNode* succ);
-
/*
* Set name of Msc
*/
Modified: trunk/src/data/Z120/Z120.g
===================================================================
--- trunk/src/data/Z120/Z120.g 2009-09-20 23:03:16 UTC (rev 348)
+++ trunk/src/data/Z120/Z120.g 2009-09-21 11:28:21 UTC (rev 349)
@@ -26,27 +26,34 @@
options
{
language = C;
-// backtrack=true;
k=3;
}
-//@rulecatch {
-// pANTLR3_EXCEPTION exe = EXCEPTION;
-// if(NULL != exe) {
-// bug_report_fun(context, "Part of the file has not been read correctly\n");
-// }
-//}
-
-
@header{
#include "data/Z120/Context.h"
+ #include "data/Z120/display_error.h"
}
@members{
struct Context* context;
+
+ void scstudio_error_reporting(pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_UINT8 *tokenNames)
+ {
+ display_error(context, recognizer, tokenNames);
+ }
+
}
+@parser::apifuncs
+{
+ void reportError (pANTLR3_BASE_RECOGNIZER recognizer);
+ RECOGNIZER->reportError = &reportError;
+ void scstudio_error_reporting(pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_UINT8 *tokenNames);
+ RECOGNIZER->displayRecognitionError = &scstudio_error_reporting;
+}
+
+
/*
* removed due to: Z120.g:40:1: syntax error: antlr: Z120.g:40:1: unexpected token: tokens
tokens
@@ -371,7 +378,7 @@
set_instance_name_fun(context, (char*) ($NAME.text->chars));
}
':' instance_event_list
- | instance_name_list ':' multi_instance_event_list
+// | instance_name_list ':' multi_instance_event_list
;
instance_event_list:
Added: trunk/src/data/Z120/display_error.cpp
===================================================================
--- trunk/src/data/Z120/display_error.cpp (rev 0)
+++ trunk/src/data/Z120/display_error.cpp 2009-09-21 11:28:21 UTC (rev 349)
@@ -0,0 +1,248 @@
+#include "data/Z120/display_error.h"
+#include "data/Z120/Context_Impl.h"
+
+void reportError (pANTLR3_BASE_RECOGNIZER recognizer)
+ {
+ if (recognizer->state->errorRecovery == ANTLR3_TRUE)
+ {
+ return;
+ }
+
+ // Signal we are in error recovery now
+ //
+ recognizer->state->errorRecovery = ANTLR3_TRUE;
+
+ // Indicate this recognizer had an error while processing.
+ //
+ recognizer->state->errorCount++;
+
+ // Call the error display routine
+ //
+ recognizer->displayRecognitionError(recognizer, recognizer->state->tokenNames);
+
+
+ }
+
+
+//void scstudio_error_reporting(pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_UINT8 *tokenNames)
+void display_error(struct Context* context, pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_UINT8 *tokenNames)
+{
+// pANTLR3_PARSER parser;
+// pANTLR3_TREE_PARSER tparser;
+// pANTLR3_INT_STREAM is;
+ pANTLR3_STRING ttext;
+ pANTLR3_STRING ftext;
+ pANTLR3_EXCEPTION ex;
+// pANTLR3_COMMON_TOKEN theToken;
+// pANTLR3_BASE_TREE theBaseTree;
+// pANTLR3_COMMON_TREE theCommonTree;
+
+ // Retrieve some info for easy reading.
+ //
+ ex = recognizer->state->exception;
+ ttext = NULL;
+
+ // See if there is a 'filename' we can use
+ //
+ if (ex->streamName == NULL)
+ {
+ if (((pANTLR3_COMMON_TOKEN)(ex->token))->type == ANTLR3_TOKEN_EOF)
+ {
+ context->z->print_report(RS_ERROR, stringize() << "-end of input-(");
+ }
+ else
+ {
+ context->z->print_report(RS_ERROR,stringize() << "-unknown source-(");
+ }
+ }
+ else
+ {
+ ftext = ex->streamName->to8(ex->streamName);
+ context->z->print_report(RS_ERROR, stringize() << (char*) ftext->chars << "(Line: "
+ << recognizer->state->exception->line << ", Line position: "
+ << recognizer->state->exception->charPositionInLine << ")");
+ }
+
+ // should be as helpful as possible for grammar developers and serve as an example
+ // of what you can do with each exception type. In general, when you make up your
+ // 'real' handler, you should debug the routine with all possible errors you expect
+ // which will then let you be as specific as possible about all circumstances.
+ //
+ // Note that in the general case, errors thrown by tree parsers indicate a problem
+ // with the output of the parser or with the tree grammar itself. The job of the parser
+ // is to produce a perfect (in traversal terms) syntactically correct tree, so errors
+ // at that stage should really be semantic errors that your own code determines and handles
+ // in whatever way is appropriate.
+ //
+ switch (ex->type)
+ {
+ case ANTLR3_UNWANTED_TOKEN_EXCEPTION:
+
+ // Indicates that the recognizer was fed a token which seesm to be
+ // spurious input. We can detect this when the token that follows
+ // this unwanted token would normally be part of the syntactically
+ // correct stream. Then we can see that the token we are looking at
+ // is just something that should not be there and throw this exception.
+ //
+ if (tokenNames == NULL)
+ {
+ context->z->print_report(RS_ERROR, stringize() << " Extraneous input...");
+ }
+ else
+ {
+ if (ex->expecting == ANTLR3_TOKEN_EOF)
+ {
+ context->z->print_report(RS_ERROR, stringize() << "Extraneous input - expected <EOF>\n");
+ }
+ else
+ {
+ context->z->print_report(RS_ERROR, stringize() << " Error " << recognizer->state->exception->type << ": " << "Extraneous input - expected " << (char*) (tokenNames[ex->expecting]) << "...\n");
+ }
+ }
+ break;
+
+ case ANTLR3_MISSING_TOKEN_EXCEPTION:
+
+ // Indicates that the recognizer detected that the token we just
+ // hit would be valid syntactically if preceeded by a particular
+ // token. Perhaps a missing ';' at line end or a missing ',' in an
+ // expression list, and such like.
+ //
+ if (tokenNames == NULL)
+ {
+ context->z->print_report(RS_ERROR, stringize() << "Missing token (" << ex->expecting << ")...");
+ }
+ else
+ {
+ if (ex->expecting == ANTLR3_TOKEN_EOF)
+ {
+ context->z->print_report(RS_ERROR, stringize() << "Missing <EOF>");
+ }
+ else
+ {
+ context->z->print_report(RS_ERROR, stringize() << " Error " << recognizer->state->exception->type << ": " << "Missing " << (char*) (tokenNames[ex->expecting]));
+ }
+ }
+ break;
+ case ANTLR3_RECOGNITION_EXCEPTION:
+
+ // Indicates that the recognizer received a token
+ // in the input that was not predicted. This is the basic exception type
+ // from which all others are derived. So we assume it was a syntax error.
+ // You may get this if there are not more tokens and more are needed
+ // to complete a parse for instance.
+ //
+ context->z->print_report(RS_ERROR, stringize() << "syntax error...\n");
+ break;
+
+ case ANTLR3_MISMATCHED_TOKEN_EXCEPTION:
+
+ // We were expecting to see one thing and got another. This is the
+ // most common error if we coudl not detect a missing or unwanted token.
+ // Here you can spend your efforts to
+ // derive more useful error messages based on the expected
+ // token set and the last token and so on. The error following
+ // bitmaps do a good job of reducing the set that we were looking
+ // for down to something small. Knowing what you are parsing may be
+ // able to allow you to be even more specific about an error.
+ //
+ if (tokenNames == NULL)
+ {
+ context->z->print_report(RS_ERROR, stringize() << "syntax error...\n");
+ }
+ else
+ {
+ if (ex->expecting == ANTLR3_TOKEN_EOF)
+ {
+ context->z->print_report(RS_ERROR, stringize() << "expected <EOF>");
+ }
+ else
+ {
+ context->z->print_report(RS_ERROR, stringize() << " Error " << recognizer->state->exception->type << ": " << "expected " << tokenNames[ex->expecting] << "...");
+ }
+ }
+ break;
+ case ANTLR3_NO_VIABLE_ALT_EXCEPTION:
+
+ // We could not pick any alt decision from the input given
+ // so god knows what happened - however when you examine your grammar,
+ // you should. It means that at the point where the current token occurred
+ // that the DFA indicates nowhere to go from here.
+ //
+ context->z->print_report(RS_ERROR, stringize() << " Error " << recognizer->state->exception->type << ": " << " : cannot match to any predicted input...\n");
+
+ break;
+
+ case ANTLR3_MISMATCHED_SET_EXCEPTION:
+
+ {
+ ANTLR3_UINT32 count;
+ ANTLR3_UINT32 bit;
+ ANTLR3_UINT32 size;
+ ANTLR3_UINT32 numbits;
+ pANTLR3_BITSET errBits;
+
+ // This means we were able to deal with one of a set of
+ // possible tokens at this point, but we did not see any
+ // member of that set.
+ //
+ context->z->print_report(RS_ERROR, stringize() << " : unexpected input...\n expected one of : ");
+
+ // What tokens could we have accepted at this point in the
+ // parse?
+ //
+ count = 0;
+ errBits = antlr3BitsetLoad (ex->expectingSet);
+ numbits = errBits->numBits (errBits);
+ size = errBits->size (errBits);
+
+ if (size > 0)
+ {
+ // However many tokens we could have dealt with here, it is usually
+ // not useful to print ALL of the set here. I arbitrarily chose 8
+ // here, but you should do whatever makes sense for you of course.
+ // No token number 0, so look for bit 1 and on.
+ //
+ for (bit = 1; bit < numbits && count < 8 && count < size; bit++)
+ {
+ // TODO: This doesn;t look right - should be asking if the bit is set!!
+ //
+
+ if (tokenNames[bit])
+ {
+ context->z->print_report(RS_ERROR, stringize() << (count > 0 ? ", " : "") << tokenNames[bit]);
+ count++;
+ }
+ }
+ context->z->print_report(RS_ERROR, stringize() << "");
+ }
+ else
+ {
+ context->z->print_report(RS_ERROR, stringize() << "Actually dude, we didn't seem to be expecting anything here, or at least");
+ context->z->print_report(RS_ERROR, stringize() << "I could not work out what I was expecting, like so many of us these days!");
+ }
+ }
+ break;
+
+ case ANTLR3_EARLY_EXIT_EXCEPTION:
+
+ // We entered a loop requiring a number of token sequences
+ // but found a token that ended that sequence earlier than
+ // we should have done.
+ //
+ context->z->print_report(RS_ERROR, stringize() << " : missing elements...");
+ break;
+
+ default:
+
+ // We don't handle any other exceptions here, but you can
+ // if you wish. If we get an exception that hits this point
+ // then we are just going to report what we know about the
+ // token.
+ //
+ context->z->print_report(RS_ERROR, stringize() << " : syntax not recognized...");
+ break;
+ }
+
+
+}
Added: trunk/src/data/Z120/display_error.h
===================================================================
--- trunk/src/data/Z120/display_error.h (rev 0)
+++ trunk/src/data/Z120/display_error.h 2009-09-21 11:28:21 UTC (rev 349)
@@ -0,0 +1,18 @@
+#ifndef _Z120Display_H
+#define _Z120Display_H
+
+#include<antlr3.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void reportError (pANTLR3_BASE_RECOGNIZER recognizer);
+
+void display_error(struct Context* context, pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_UINT8 *tokenNames);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Modified: trunk/tests/z120_test/z120_test42.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test42.mpr.result 2009-09-20 23:03:16 UTC (rev 348)
+++ trunk/tests/z120_test/z120_test42.mpr.result 2009-09-21 11:28:21 UTC (rev 349)
@@ -1,9 +1,9 @@
-z120_test42.mpr(11) : error 3 : , at offset 0
- near [Index: 22 (Start: 152711996-Stop: 152711997) ='in', type<58> Line: 11 LinePos:0]
- : cannot match to any predicted input...
-z120_test42.mpr(30) : error 3 : , at offset 0
- near [Index: 144 (Start: 152712273-Stop: 152712275) ='out', type<57> Line: 30 LinePos:0]
- : cannot match to any predicted input...
+z120_test42.mpr(Line: 11, Line position: 0)
+ Error 3: : cannot match to any predicted input...
+
+z120_test42.mpr(Line: 30, Line position: 0)
+ Error 3: : cannot match to any predicted input...
+
Warning 09: There is reference to nonexisted MSC
OK: z120_test42 is correct, should be correct
Modified: trunk/tests/z120_test/z120_test50.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test50.mpr.result 2009-09-20 23:03:16 UTC (rev 348)
+++ trunk/tests/z120_test/z120_test50.mpr.result 2009-09-21 11:28:21 UTC (rev 349)
@@ -1,6 +1,6 @@
-z120_test50.mpr(8) : error 3 : 1377:1: node_definition : ( initial_node | final_node | intermediate_node );, at offset 4
- near [Index: 28 (Start: 145601215-Stop: 145601218) ='NAME', type<11> Line: 8 LinePos:4]
- : cannot match to any predicted input...
+z120_test50.mpr(Line: 8, Line position: 4)
+ Error 3: : cannot match to any predicted input...
+
Warning 08: There is reference to nonexisted node
Warning 09: There is reference to nonexisted MSC
Modified: trunk/tests/z120_test/z120_test53.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test53.mpr.result 2009-09-20 23:03:16 UTC (rev 348)
+++ trunk/tests/z120_test/z120_test53.mpr.result 2009-09-21 11:28:21 UTC (rev 349)
@@ -1,6 +1,6 @@
-z120_test53.mpr(7) : error 3 : , at offset 0
- near [Index: 11 (Start: 163857081-Stop: 163857084) ='inst', type<39> Line: 7 LinePos:0]
- : cannot match to any predicted input...
+z120_test53.mpr(Line: 7, Line position: 0)
+ Error 3: : cannot match to any predicted input...
+
OK: z120_test53 is correct, should be correct
mscdocument z120_test53;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2009-09-21 15:06:02
|
Revision: 351
http://scstudio.svn.sourceforge.net/scstudio/?rev=351&view=rev
Author: gotthardp
Date: 2009-09-21 15:05:55 +0000 (Mon, 21 Sep 2009)
Log Message:
-----------
Enhanced z120 error reporting function.
Modified Paths:
--------------
trunk/src/data/Z120/Context_Impl.h
trunk/src/data/Z120/display_error.cpp
trunk/src/data/Z120/display_error.h
trunk/tests/z120_test/z120_test42.mpr.result
trunk/tests/z120_test/z120_test50.mpr.result
trunk/tests/z120_test/z120_test53.mpr.result
trunk/tests/z120_test/z120_test56.mpr.result
trunk/tests/z120_test/z120_test58.mpr.result
trunk/tests/z120_test/z120_test59.mpr.result
Property Changed:
----------------
trunk/src/data/Z120/Context_Impl.h
trunk/src/data/Z120/display_error.cpp
trunk/src/data/Z120/display_error.h
Modified: trunk/src/data/Z120/Context_Impl.h
===================================================================
--- trunk/src/data/Z120/Context_Impl.h 2009-09-21 11:52:58 UTC (rev 350)
+++ trunk/src/data/Z120/Context_Impl.h 2009-09-21 15:05:55 UTC (rev 351)
@@ -13,7 +13,7 @@
*
* Copyright (c) 2008 Matus Madzin <go...@ma...>
*
- * $Id: Context_Impl.h 332 2009-09-15 14:13:20Z madzin $
+ * $Id$
*/
/*
@@ -90,6 +90,6 @@
void create_future_connections_fun(struct Context* context, SuccessorNode* succ);
+#endif // _Context_Impl_
-#endif
-
+// $Id$
Property changes on: trunk/src/data/Z120/Context_Impl.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/data/Z120/display_error.cpp
===================================================================
--- trunk/src/data/Z120/display_error.cpp 2009-09-21 11:52:58 UTC (rev 350)
+++ trunk/src/data/Z120/display_error.cpp 2009-09-21 15:05:55 UTC (rev 351)
@@ -1,248 +1,220 @@
#include "data/Z120/display_error.h"
#include "data/Z120/Context_Impl.h"
+// Implementation based on src/runtime/C/antlr3baserecognizer.c, display()
+
void reportError (pANTLR3_BASE_RECOGNIZER recognizer)
+{
+ if (recognizer->state->errorRecovery == ANTLR3_TRUE)
{
- if (recognizer->state->errorRecovery == ANTLR3_TRUE)
- {
- return;
- }
+ return;
+ }
- // Signal we are in error recovery now
- //
- recognizer->state->errorRecovery = ANTLR3_TRUE;
+ // Signal we are in error recovery now
+ recognizer->state->errorRecovery = ANTLR3_TRUE;
- // Indicate this recognizer had an error while processing.
- //
- recognizer->state->errorCount++;
+ // Indicate this recognizer had an error while processing.
+ recognizer->state->errorCount++;
- // Call the error display routine
- //
- recognizer->displayRecognitionError(recognizer, recognizer->state->tokenNames);
+ // Call the error display routine
+ recognizer->displayRecognitionError(recognizer, recognizer->state->tokenNames);
+}
+void display_error(struct Context* context, pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_UINT8 *tokenNames)
+{
+ stringize report;
+ // Retrieve some info for easy reading.
+ pANTLR3_EXCEPTION ex = recognizer->state->exception;
+
+ // See if there is a 'filename' we can use
+ if (ex->streamName == NULL)
+ {
+ if (((pANTLR3_COMMON_TOKEN)(ex->token))->type == ANTLR3_TOKEN_EOF)
+ {
+ report << "<EOF>";
+ }
+ else
+ {
+ report << "<unknown>";
+ }
}
+ else
+ {
+ pANTLR3_STRING ftext = ex->streamName->to8(ex->streamName);
+ char* last_slash = (char *)ftext->chars;
+ // strip file path
+ for(char *ch = (char *)ftext->chars; *ch != 0; ch++)
+ {
+ if(*ch == '\\' || *ch == '/')
+ last_slash = ch;
+ }
-//void scstudio_error_reporting(pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_UINT8 *tokenNames)
-void display_error(struct Context* context, pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_UINT8 *tokenNames)
-{
-// pANTLR3_PARSER parser;
-// pANTLR3_TREE_PARSER tparser;
-// pANTLR3_INT_STREAM is;
- pANTLR3_STRING ttext;
- pANTLR3_STRING ftext;
- pANTLR3_EXCEPTION ex;
-// pANTLR3_COMMON_TOKEN theToken;
-// pANTLR3_BASE_TREE theBaseTree;
-// pANTLR3_COMMON_TREE theCommonTree;
+ report << last_slash+1
+ << "[" << recognizer->state->exception->line
+ << "," << recognizer->state->exception->charPositionInLine << "]";
+ }
- // Retrieve some info for easy reading.
- //
- ex = recognizer->state->exception;
- ttext = NULL;
+ report << " ";
- // See if there is a 'filename' we can use
- //
- if (ex->streamName == NULL)
+ // Note that in the general case, errors thrown by tree parsers indicate a problem
+ // with the output of the parser or with the tree grammar itself. The job of the parser
+ // is to produce a perfect (in traversal terms) syntactically correct tree, so errors
+ // at that stage should really be semantic errors that your own code determines and handles
+ // in whatever way is appropriate.
+ switch (ex->type)
+ {
+ case ANTLR3_UNWANTED_TOKEN_EXCEPTION:
+
+ // Indicates that the recognizer was fed a token which seesm to be
+ // spurious input. We can detect this when the token that follows
+ // this unwanted token would normally be part of the syntactically
+ // correct stream. Then we can see that the token we are looking at
+ // is just something that should not be there and throw this exception.
+ if (tokenNames == NULL)
+ {
+ report << "Unwanted input";
+ }
+ else
+ {
+ if (ex->expecting == ANTLR3_TOKEN_EOF)
{
- if (((pANTLR3_COMMON_TOKEN)(ex->token))->type == ANTLR3_TOKEN_EOF)
- {
- context->z->print_report(RS_ERROR, stringize() << "-end of input-(");
- }
- else
- {
- context->z->print_report(RS_ERROR,stringize() << "-unknown source-(");
- }
+ report << "Unwanted input: expected <EOF>";
}
else
{
- ftext = ex->streamName->to8(ex->streamName);
- context->z->print_report(RS_ERROR, stringize() << (char*) ftext->chars << "(Line: "
- << recognizer->state->exception->line << ", Line position: "
- << recognizer->state->exception->charPositionInLine << ")");
+ report << "Unwanted input: expected " << (char*)(tokenNames[ex->expecting]);
}
+ }
+ break;
- // should be as helpful as possible for grammar developers and serve as an example
- // of what you can do with each exception type. In general, when you make up your
- // 'real' handler, you should debug the routine with all possible errors you expect
- // which will then let you be as specific as possible about all circumstances.
- //
- // Note that in the general case, errors thrown by tree parsers indicate a problem
- // with the output of the parser or with the tree grammar itself. The job of the parser
- // is to produce a perfect (in traversal terms) syntactically correct tree, so errors
- // at that stage should really be semantic errors that your own code determines and handles
- // in whatever way is appropriate.
- //
- switch (ex->type)
+ case ANTLR3_MISSING_TOKEN_EXCEPTION:
+
+ // Indicates that the recognizer detected that the token we just
+ // hit would be valid syntactically if preceeded by a particular
+ // token. Perhaps a missing ';' at line end or a missing ',' in an
+ // expression list, and such like.
+ if (tokenNames == NULL)
+ {
+ report << "Missing token (" << ex->expecting << ")";
+ }
+ else
+ {
+ if (ex->expecting == ANTLR3_TOKEN_EOF)
{
- case ANTLR3_UNWANTED_TOKEN_EXCEPTION:
+ report << "Missing <EOF>";
+ }
+ else
+ {
+ report << "Missing " << (char*)(tokenNames[ex->expecting]);
+ }
+ }
+ break;
- // Indicates that the recognizer was fed a token which seesm to be
- // spurious input. We can detect this when the token that follows
- // this unwanted token would normally be part of the syntactically
- // correct stream. Then we can see that the token we are looking at
- // is just something that should not be there and throw this exception.
- //
- if (tokenNames == NULL)
- {
- context->z->print_report(RS_ERROR, stringize() << " Extraneous input...");
- }
- else
- {
- if (ex->expecting == ANTLR3_TOKEN_EOF)
- {
- context->z->print_report(RS_ERROR, stringize() << "Extraneous input - expected <EOF>\n");
- }
- else
- {
- context->z->print_report(RS_ERROR, stringize() << " Error " << recognizer->state->exception->type << ": " << "Extraneous input - expected " << (char*) (tokenNames[ex->expecting]) << "...\n");
- }
- }
- break;
+ case ANTLR3_RECOGNITION_EXCEPTION:
- case ANTLR3_MISSING_TOKEN_EXCEPTION:
+ // Indicates that the recognizer received a token
+ // in the input that was not predicted. This is the basic exception type
+ // from which all others are derived. So we assume it was a syntax error.
+ // You may get this if there are not more tokens and more are needed
+ // to complete a parse for instance.
+ report << "Syntax error";
+ break;
- // Indicates that the recognizer detected that the token we just
- // hit would be valid syntactically if preceeded by a particular
- // token. Perhaps a missing ';' at line end or a missing ',' in an
- // expression list, and such like.
- //
- if (tokenNames == NULL)
- {
- context->z->print_report(RS_ERROR, stringize() << "Missing token (" << ex->expecting << ")...");
- }
- else
- {
- if (ex->expecting == ANTLR3_TOKEN_EOF)
- {
- context->z->print_report(RS_ERROR, stringize() << "Missing <EOF>");
- }
- else
- {
- context->z->print_report(RS_ERROR, stringize() << " Error " << recognizer->state->exception->type << ": " << "Missing " << (char*) (tokenNames[ex->expecting]));
- }
- }
- break;
- case ANTLR3_RECOGNITION_EXCEPTION:
+ case ANTLR3_MISMATCHED_TOKEN_EXCEPTION:
- // Indicates that the recognizer received a token
- // in the input that was not predicted. This is the basic exception type
- // from which all others are derived. So we assume it was a syntax error.
- // You may get this if there are not more tokens and more are needed
- // to complete a parse for instance.
- //
- context->z->print_report(RS_ERROR, stringize() << "syntax error...\n");
- break;
+ // We were expecting to see one thing and got another. This is the
+ // most common error if we coudl not detect a missing or unwanted token.
+ // Here you can spend your efforts to
+ // derive more useful error messages based on the expected
+ // token set and the last token and so on. The error following
+ // bitmaps do a good job of reducing the set that we were looking
+ // for down to something small. Knowing what you are parsing may be
+ // able to allow you to be even more specific about an error.
+ if (tokenNames == NULL)
+ {
+ report << "Syntax error";
+ }
+ else
+ {
+ if (ex->expecting == ANTLR3_TOKEN_EOF)
+ {
+ report << "Expected <EOF>";
+ }
+ else
+ {
+ report << "Expected " << tokenNames[ex->expecting];
+ }
+ }
+ break;
- case ANTLR3_MISMATCHED_TOKEN_EXCEPTION:
+ case ANTLR3_NO_VIABLE_ALT_EXCEPTION:
- // We were expecting to see one thing and got another. This is the
- // most common error if we coudl not detect a missing or unwanted token.
- // Here you can spend your efforts to
- // derive more useful error messages based on the expected
- // token set and the last token and so on. The error following
- // bitmaps do a good job of reducing the set that we were looking
- // for down to something small. Knowing what you are parsing may be
- // able to allow you to be even more specific about an error.
- //
- if (tokenNames == NULL)
- {
- context->z->print_report(RS_ERROR, stringize() << "syntax error...\n");
- }
- else
- {
- if (ex->expecting == ANTLR3_TOKEN_EOF)
- {
- context->z->print_report(RS_ERROR, stringize() << "expected <EOF>");
- }
- else
- {
- context->z->print_report(RS_ERROR, stringize() << " Error " << recognizer->state->exception->type << ": " << "expected " << tokenNames[ex->expecting] << "...");
- }
- }
- break;
- case ANTLR3_NO_VIABLE_ALT_EXCEPTION:
+ // We could not pick any alt decision from the input given
+ // so god knows what happened - however when you examine your grammar,
+ // you should. It means that at the point where the current token occurred
+ // that the DFA indicates nowhere to go from here.
+ report << "Cannot match to any predicted input";
+ break;
- // We could not pick any alt decision from the input given
- // so god knows what happened - however when you examine your grammar,
- // you should. It means that at the point where the current token occurred
- // that the DFA indicates nowhere to go from here.
- //
- context->z->print_report(RS_ERROR, stringize() << " Error " << recognizer->state->exception->type << ": " << " : cannot match to any predicted input...\n");
+ case ANTLR3_MISMATCHED_SET_EXCEPTION:
+ {
- break;
+ // This means we were able to deal with one of a set of
+ // possible tokens at this point, but we did not see any
+ // member of that set.
+ report << "Unexpected input";
- case ANTLR3_MISMATCHED_SET_EXCEPTION:
+ // What tokens could we have accepted at this point in the parse?
+ pANTLR3_BITSET errBits = antlr3BitsetLoad(ex->expectingSet);
+ ANTLR3_UINT32 numbits = errBits->numBits(errBits);
+ ANTLR3_UINT32 size = errBits->size(errBits);
- {
- ANTLR3_UINT32 count;
- ANTLR3_UINT32 bit;
- ANTLR3_UINT32 size;
- ANTLR3_UINT32 numbits;
- pANTLR3_BITSET errBits;
+ if (size > 0)
+ {
+ ANTLR3_UINT32 count = 0;
+ report << ": expected one of";
- // This means we were able to deal with one of a set of
- // possible tokens at this point, but we did not see any
- // member of that set.
- //
- context->z->print_report(RS_ERROR, stringize() << " : unexpected input...\n expected one of : ");
+ // However many tokens we could have dealt with here, it is usually
+ // not useful to print ALL of the set here. I arbitrarily chose 8
+ // here, but you should do whatever makes sense for you of course.
+ // No token number 0, so look for bit 1 and on.
+ for(ANTLR3_UINT32 bit = 1; bit < numbits && count < 8 && count < size; bit++)
+ {
+ // TODO: This doesn;t look right - should be asking if the bit is set!!
+ if (tokenNames[bit])
+ {
+ report << (count > 0 ? ", " : " ") << "<" << tokenNames[bit] << ">";
+ count++;
+ }
+ }
+ }
- // What tokens could we have accepted at this point in the
- // parse?
- //
- count = 0;
- errBits = antlr3BitsetLoad (ex->expectingSet);
- numbits = errBits->numBits (errBits);
- size = errBits->size (errBits);
+ break;
+ }
- if (size > 0)
- {
- // However many tokens we could have dealt with here, it is usually
- // not useful to print ALL of the set here. I arbitrarily chose 8
- // here, but you should do whatever makes sense for you of course.
- // No token number 0, so look for bit 1 and on.
- //
- for (bit = 1; bit < numbits && count < 8 && count < size; bit++)
- {
- // TODO: This doesn;t look right - should be asking if the bit is set!!
- //
+ case ANTLR3_EARLY_EXIT_EXCEPTION:
- if (tokenNames[bit])
- {
- context->z->print_report(RS_ERROR, stringize() << (count > 0 ? ", " : "") << tokenNames[bit]);
- count++;
- }
- }
- context->z->print_report(RS_ERROR, stringize() << "");
- }
- else
- {
- context->z->print_report(RS_ERROR, stringize() << "Actually dude, we didn't seem to be expecting anything here, or at least");
- context->z->print_report(RS_ERROR, stringize() << "I could not work out what I was expecting, like so many of us these days!");
- }
- }
- break;
+ // We entered a loop requiring a number of token sequences
+ // but found a token that ended that sequence earlier than
+ // we should have done.
+ report << "Missing elements";
+ break;
- case ANTLR3_EARLY_EXIT_EXCEPTION:
+ default:
- // We entered a loop requiring a number of token sequences
- // but found a token that ended that sequence earlier than
- // we should have done.
- //
- context->z->print_report(RS_ERROR, stringize() << " : missing elements...");
- break;
+ // We don't handle any other exceptions here, but you can
+ // if you wish. If we get an exception that hits this point
+ // then we are just going to report what we know about the
+ // token.
+ report << "Syntax not recognized";
+ break;
+ }
- default:
+ report << ".";
- // We don't handle any other exceptions here, but you can
- // if you wish. If we get an exception that hits this point
- // then we are just going to report what we know about the
- // token.
- //
- context->z->print_report(RS_ERROR, stringize() << " : syntax not recognized...");
- break;
- }
-
-
+ context->z->print_report(RS_ERROR, report);
}
+
+// $Id$
Property changes on: trunk/src/data/Z120/display_error.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/data/Z120/display_error.h
===================================================================
--- trunk/src/data/Z120/display_error.h 2009-09-21 11:52:58 UTC (rev 350)
+++ trunk/src/data/Z120/display_error.h 2009-09-21 15:05:55 UTC (rev 351)
@@ -15,4 +15,6 @@
}
#endif
-#endif
+#endif // _Z120Display_H
+
+// $Id$
Property changes on: trunk/src/data/Z120/display_error.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/tests/z120_test/z120_test42.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test42.mpr.result 2009-09-21 11:52:58 UTC (rev 350)
+++ trunk/tests/z120_test/z120_test42.mpr.result 2009-09-21 15:05:55 UTC (rev 351)
@@ -1,9 +1,5 @@
-z120_test42.mpr(Line: 11, Line position: 0)
- Error 3: : cannot match to any predicted input...
-
-z120_test42.mpr(Line: 30, Line position: 0)
- Error 3: : cannot match to any predicted input...
-
+z120_test42.mpr[11,0] Cannot match to any predicted input.
+z120_test42.mpr[30,0] Cannot match to any predicted input.
Warning 09: There is reference to nonexisted MSC
OK: z120_test42 is correct, should be correct
Modified: trunk/tests/z120_test/z120_test50.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test50.mpr.result 2009-09-21 11:52:58 UTC (rev 350)
+++ trunk/tests/z120_test/z120_test50.mpr.result 2009-09-21 15:05:55 UTC (rev 351)
@@ -1,6 +1,4 @@
-z120_test50.mpr(Line: 8, Line position: 4)
- Error 3: : cannot match to any predicted input...
-
+z120_test50.mpr[8,4] Cannot match to any predicted input.
Warning 08: There is reference to nonexisted node
Warning 09: There is reference to nonexisted MSC
Modified: trunk/tests/z120_test/z120_test53.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test53.mpr.result 2009-09-21 11:52:58 UTC (rev 350)
+++ trunk/tests/z120_test/z120_test53.mpr.result 2009-09-21 15:05:55 UTC (rev 351)
@@ -1,6 +1,4 @@
-z120_test53.mpr(Line: 7, Line position: 0)
- Error 3: : cannot match to any predicted input...
-
+z120_test53.mpr[7,0] Cannot match to any predicted input.
OK: z120_test53 is correct, should be correct
mscdocument z120_test53;
Modified: trunk/tests/z120_test/z120_test56.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test56.mpr.result 2009-09-21 11:52:58 UTC (rev 350)
+++ trunk/tests/z120_test/z120_test56.mpr.result 2009-09-21 15:05:55 UTC (rev 351)
@@ -1,13 +1,6 @@
-z120_test56.mpr(11) : error 3 : ()+ loopback of 217:4: ( 'inst' instance_item )+, at offset 0
- near [Index: 53 (Start: 159855249-Stop: 159855250) ='in', type<59> Line: 11 LinePos:0]
- : cannot match to any predicted input...
-z120_test56.mpr(11) : error 3 : ()+ loopback of 217:4: ( 'inst' instance_item )+, at offset 0
- near [Index: 53 (Start: 159855249-Stop: 159855250) ='in', type<59> Line: 11 LinePos:0]
- : cannot match to any predicted input...
-z120_test56.mpr(11) : error 3 : 368:1: event_definition : ( NAME ':' instance_event_list | instance_name_list ':' multi_instance_event_list );, at offset 14
- near [Index: 62 (Start: 159855263-Stop: 159855263) =';', type<26> Line: 11 LinePos:14]
- : cannot match to any predicted input...
+z120_test56.mpr[11,0] Cannot match to any predicted input.
Warning 05: There is complete message with only one event
+Warning 09: There is reference to nonexisted MSC
OK: z120_test56 is correct, should be correct
Modified: trunk/tests/z120_test/z120_test58.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test58.mpr.result 2009-09-21 11:52:58 UTC (rev 350)
+++ trunk/tests/z120_test/z120_test58.mpr.result 2009-09-21 15:05:55 UTC (rev 351)
@@ -1,9 +1,5 @@
-z120_test58.mpr(16) : error 10 : Missing token, at offset 9
- near [Index: 0 (Start: 0-Stop: 0) ='<missing ';'>', type<26> Line: 16 LinePos:9]
- : Missing ';'
-z120_test58.mpr(16) : error 9 : Extraneous token, at offset 9
- near [Index: 0 (Start: 0-Stop: 0) ='<missing ';'>', type<26> Line: 16 LinePos:9]
- : Extraneous input - expected ';' ...
+z120_test58.mpr[16,9] Missing ';'.
+z120_test58.mpr[16,9] Unwanted input: expected ';'.
Warning 11: Instance server does not have open any coregion
OK: z120_test58 is correct, should be correct
Modified: trunk/tests/z120_test/z120_test59.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test59.mpr.result 2009-09-21 11:52:58 UTC (rev 350)
+++ trunk/tests/z120_test/z120_test59.mpr.result 2009-09-21 15:05:55 UTC (rev 351)
@@ -1,6 +1,4 @@
-z120_test59.mpr(28) : error 9 : Extraneous token, at offset 0
- near [Index: 151 (Start: 140641322-Stop: 140641331) ='concurrent', type<102> Line: 28 LinePos:0]
- : Extraneous input - expected ';' ...
+z120_test59.mpr[28,0] Unwanted input: expected ';'.
Warning 11: Instance server does not have open any coregion
OK: z120_test59 is correct, should be correct
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2009-09-23 16:45:27
|
Revision: 356
http://scstudio.svn.sourceforge.net/scstudio/?rev=356&view=rev
Author: madzin
Date: 2009-09-23 16:45:20 +0000 (Wed, 23 Sep 2009)
Log Message:
-----------
Error handling fix
--Thir line, and those below, will be ignored--
A trunk/tests/z120_test/z120_test62.mpr.result
A trunk/tests/z120_test/z120_test65.mpr.result
A trunk/tests/z120_test/z120_test60.mpr
A trunk/tests/z120_test/z120_test62.mpr
A trunk/tests/z120_test/z120_test64.mpr
A trunk/tests/z120_test/z120_test60.mpr.result
A trunk/tests/z120_test/z120_test61.mpr.result
A trunk/tests/z120_test/z120_test61.mpr
A trunk/tests/z120_test/z120_test63.mpr
A trunk/tests/z120_test/z120_test65.mpr
M trunk/tests/z120_test/CMakeLists.txt
A trunk/tests/z120_test/z120_test64.mpr.result
M trunk/src/data/Z120/display_error.cpp
M trunk/src/data/Z120/Z120.g
M trunk/src/data/Z120/Context.cpp
Modified Paths:
--------------
trunk/src/data/Z120/Context.cpp
trunk/src/data/Z120/Z120.g
trunk/src/data/Z120/display_error.cpp
trunk/tests/z120_test/CMakeLists.txt
Added Paths:
-----------
trunk/tests/z120_test/z120_test60.mpr
trunk/tests/z120_test/z120_test60.mpr.result
trunk/tests/z120_test/z120_test61.mpr
trunk/tests/z120_test/z120_test61.mpr.result
trunk/tests/z120_test/z120_test62.mpr
trunk/tests/z120_test/z120_test62.mpr.result
trunk/tests/z120_test/z120_test63.mpr
trunk/tests/z120_test/z120_test64.mpr
trunk/tests/z120_test/z120_test64.mpr.result
trunk/tests/z120_test/z120_test65.mpr
trunk/tests/z120_test/z120_test65.mpr.result
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2009-09-23 07:47:29 UTC (rev 355)
+++ trunk/src/data/Z120/Context.cpp 2009-09-23 16:45:20 UTC (rev 356)
@@ -186,7 +186,7 @@
void check_collections_fun(struct Context* context)
{
if(!context->coregion_area_opened.empty())
- context->z->print_report(RS_WARNING, stringize() << "Warning 04: Instance " << TOWSTRING(context->element_name) << "does not have finished some coregion\n");
+ context->z->print_report(RS_WARNING, stringize() << "Warning 04: Instance " << TOWSTRING(context->element_name) << " does not have finished some coregion\n");
if(!context->messages.empty()){
context->z->print_report(RS_WARNING, L"Warning 05: There is complete message with only one event\n");
Modified: trunk/src/data/Z120/Z120.g
===================================================================
--- trunk/src/data/Z120/Z120.g 2009-09-23 07:47:29 UTC (rev 355)
+++ trunk/src/data/Z120/Z120.g 2009-09-23 16:45:20 UTC (rev 356)
@@ -110,7 +110,7 @@
;
pure_data_string:
- non_parenthesis (parenthesis)? (pure_data_string)?
+ non_parenthesis //(parenthesis)? (pure_data_string)?
;
parenthesis:
@@ -124,7 +124,7 @@
;
non_parenthesis:
- non_par_non_escape | (escapechar (escapechar | Character_String))
+ non_par_non_escape | escapechar (escapechar | Character_String)
;
@@ -258,7 +258,7 @@
{
init(context);
}
- (virtuality)? 'msc' msc_head (msc | hmsc) 'endmsc' end
+ (virtuality)? 'msc' msc_head ( ('expr' | (hmsc_statement_without_initial)* initial_node)=> hmsc | msc ) 'endmsc' end
{
msc_was_read_fun(context);
check_collections_fun(context);
@@ -286,7 +286,7 @@
;
msc_parm_decl_list:
- msc_parm_decl_block (end msc_parm_decl_list)?
+ msc_parm_decl_block_first (end msc_parm_decl_block)*
;
msc_parm_decl_block:
@@ -296,6 +296,13 @@
| timer_parameter_decl
;
+msc_parm_decl_block_first:
+ data_parameter_decl_first
+ | instance_parameter_decl
+ | message_parameter_decl
+ | timer_parameter_decl
+;
+
instance_parameter_decl:
'inst' instance_parm_decl_list
;
@@ -379,7 +386,7 @@
set_instance_name_fun(context, (char*) ($NAME.text->chars));
}
':' instance_event_list
-// | instance_name_list ':' multi_instance_event_list
+ | instance_name_list ':' multi_instance_event_list
;
instance_event_list:
@@ -396,7 +403,7 @@
set_event_name_fun(context, (char*) ($NAME.text->chars));
})?
(message_event |
-// method_call_event | incomplete_method_call_event | create |
+ method_call_event | create |
timer_statement | action)
('before' order_dest_list
{
@@ -418,7 +425,8 @@
;
time_dest_list:
- (time_dest ('origin')?)? time_interval (',' time_dest_list)?
+// (time_dest ('origin')?)?
+ time_interval (',' time_dest_list)?
;
time_dest:
@@ -441,7 +449,7 @@
;
instance_name_list:
- NAME (',' NAME)* | 'all'
+ NAME (',' NAME)+ | 'all'
;
multi_instance_event_list:
@@ -543,42 +551,21 @@
;
call_out:
- 'call' msg_identification 'to' input_address
+ 'call' msg_identification 'to' (input_address | 'lost' (input_address)?) //merged call_out and incomplete_call_out
;
call_in:
- 'receive' msg_identification 'from' output_address
+ 'receive' msg_identification 'from' (output_address | 'found' (output_address)?) //merged call_in and incomplete_call_in
;
reply_out:
- 'replyout' msg_identification 'to' input_address
+ 'replyout' msg_identification 'to' (input_address | 'lost' (input_address)?) //merged reply_out and incomplete_reply_out
;
reply_in:
- 'replyin' msg_identification 'from' output_address
+ 'replyin' msg_identification 'from' (output_address | 'found' (output_address)?) //merged reply_in and incomplete_reply_in
;
-incomplete_method_call_event:
- incomplete_call_out | incomplete_call_in |
- incomplete_reply_out | incomplete_reply_in
-;
-
-incomplete_call_out:
- 'call' msg_identification 'to' 'lost' (input_address)?
-;
-
-incomplete_call_in:
- 'receive' msg_identification 'from' 'found' (output_address)?
-;
-
-incomplete_reply_out:
- 'replyout' msg_identification 'to' 'lost' (input_address)?
-;
-
-incomplete_reply_in:
- 'replyin' msg_identification 'from' 'found' (output_address)?
-;
-
start_method:
'method' end
;
@@ -608,11 +595,11 @@
;
input_dest:
- 'lost' (input_address)? | input_address
+ 'lost' //(input_address)? | input_address
;
output_dest:
- 'found' (output_address)? | output_address
+ 'found' //(output_address)? | output_address
;
def_in_gate:
@@ -834,7 +821,14 @@
'action' action_statement
;
+/* if needed
action_statement:
+ ( ('def' | 'undef' | expression RIGHT_BIND_SYMBOL | pattern LEFT_BIND_SYMBOL
+ ) => data_statement_list )
+ | informal_action
+;*/
+
+action_statement:
informal_action | data_statement_list
;
@@ -905,7 +899,7 @@
;
unmatched_string:
- non_parenthesis (nestable_par)? (unmatched_string)?
+ non_parenthesis (nestable_par)? //(unmatched_string)?
;
escapechar:
@@ -919,7 +913,7 @@
// ----- Declaring data
message_decl_list:
- message_decl // (end message_decl_list)?
+ message_decl ( (end ~('inst' | 'msg' | 'timer' | 'variables'))=> end message_decl_list | )
;
message_decl:
@@ -931,7 +925,7 @@
;
timer_decl_list:
- timer_decl (end timer_decl_list)?
+ timer_decl ( (end ~('inst' | 'msg' | 'timer' | 'variables'))=> end timer_decl_list | )
;
timer_decl:
@@ -952,7 +946,7 @@
;
variable_decl_list:
- variable_decl_item (end variable_decl_list)?
+ variable_decl_item ((end string (',' | ':' string))=>end variable_decl_list |)
;
variable_decl_item:
@@ -975,9 +969,12 @@
// ----- Static Data
+data_parameter_decl_first:
+ ('variables')? variable_decl_list
+;
data_parameter_decl:
- ('variables')? variable_decl_list
+ 'variables' variable_decl_list
;
actual_data_parameters:
@@ -992,7 +989,7 @@
// ----- Bindings
binding:
- left_binding | right_binding
+ (pattern LEFT_BIND_SYMBOL)=> left_binding | right_binding
;
left_binding:
@@ -1016,8 +1013,7 @@
;
pattern:
- //string | wildcard
- NAME
+ string //| wildcard
;
//wildcard:
@@ -1032,7 +1028,8 @@
;
parameter_defn:
- binding | expression // | pattern
+ //binding |
+ expression // | pattern
;
@@ -1088,10 +1085,16 @@
// ----- Time Interval
time_interval:
+ (interval_label)? ( (('@')? ('(' | '[') (time_point)? ',')=> bounded_time (measurement)? | singular_time )
+;
+
+/*
+time_interval:
(interval_label)? singular_time
| (interval_label)? bounded_time
(measurement)?
;
+*/
interval_label:
('int_boundary')? NAME
@@ -1346,11 +1349,11 @@
;
ref_gate:
- actual_out_gate | actual_in_gate |
+// actual_out_gate | actual_in_gate |
actual_order_out_gate | actual_order_in_gate |
- actual_create_out_gate | actual_create_in_gate |
- actual_out_call_gate | actual_in_call_gate |
- actual_out_reply_gate | actual_in_reply_gate
+// actual_create_out_gate | actual_create_in_gate |
+// actual_out_call_gate | actual_in_call_gate |
+// actual_out_reply_gate | actual_in_reply_gate
;
@@ -1374,8 +1377,12 @@
(hmsc_body | 'expr' msc_expression)
;
+hmsc_statement_without_initial:
+ text_definition | final_node | intermediate_node
+;
+
hmsc_body:
- (hmsc_statement)*
+ (hmsc_statement_without_initial)* initial_node (hmsc_statement)*
;
hmsc_statement:
@@ -1416,7 +1423,7 @@
{
add_connect_name_fun(context, (char*) ($NAME.text->chars));
}
- (',' label_list)*
+ (',' label_list)? //change * to ?
;
intermediate_node:
Modified: trunk/src/data/Z120/display_error.cpp
===================================================================
--- trunk/src/data/Z120/display_error.cpp 2009-09-23 07:47:29 UTC (rev 355)
+++ trunk/src/data/Z120/display_error.cpp 2009-09-23 16:45:20 UTC (rev 356)
@@ -26,6 +26,7 @@
// Retrieve some info for easy reading.
pANTLR3_EXCEPTION ex = recognizer->state->exception;
+ pANTLR3_COMMON_TOKEN theToken= (pANTLR3_COMMON_TOKEN)(recognizer->state->exception->token);
// See if there is a 'filename' we can use
if (ex->streamName == NULL)
@@ -44,16 +45,29 @@
pANTLR3_STRING ftext = ex->streamName->to8(ex->streamName);
char* last_slash = (char *)ftext->chars;
+ bool slash_present = false;
// strip file path
for(char *ch = (char *)ftext->chars; *ch != 0; ch++)
{
if(*ch == '\\' || *ch == '/')
+ {
last_slash = ch;
+ slash_present = true;
+ }
}
- report << last_slash+1
- << "[" << recognizer->state->exception->line
- << "," << recognizer->state->exception->charPositionInLine << "]";
+ if(slash_present)
+ {
+ report << last_slash+1
+ << "[" << theToken->getLine(theToken)
+ << "," << theToken->getCharPositionInLine(theToken) << "]";
+ }
+ else
+ {
+ report << last_slash
+ << "[" << theToken->getLine(theToken)
+ << "," << theToken->getCharPositionInLine(theToken) << "]";
+ }
}
report << " ";
Modified: trunk/tests/z120_test/CMakeLists.txt
===================================================================
--- trunk/tests/z120_test/CMakeLists.txt 2009-09-23 07:47:29 UTC (rev 355)
+++ trunk/tests/z120_test/CMakeLists.txt 2009-09-23 16:45:20 UTC (rev 356)
@@ -80,6 +80,12 @@
ADD_Z120_TEST(z120_test57.mpr 0)
ADD_Z120_TEST(z120_test58.mpr 1)
ADD_Z120_TEST(z120_test59.mpr 1)
+ADD_Z120_TEST(z120_test60.mpr 1)
+ADD_Z120_TEST(z120_test61.mpr 1)
+ADD_Z120_TEST(z120_test62.mpr 1)
+ADD_Z120_TEST(z120_test63.mpr 1)
+ADD_Z120_TEST(z120_test64.mpr 1)
+ADD_Z120_TEST(z120_test65.mpr 1)
ADD_Z120_TEST(z120_time01.mpr 1)
Added: trunk/tests/z120_test/z120_test60.mpr
===================================================================
--- trunk/tests/z120_test/z120_test60.mpr (rev 0)
+++ trunk/tests/z120_test/z120_test60.mpr 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,25 @@
+mscdocument Vkres2;
+msc Strnka1;
+inst client;
+inst server;
+client: instance;
+concurrent;
+label e0; out no,0 to server;
+label e1; in know,1 from server;
+endconcurrent
+out yes,2 to lost;
+concurrent
+label e2; in tric,3 from server;
+endconcurrent;
+in tric,4 from found;
+endinstance;
+server: instance;
+in no,0 from client;
+concurrent;
+label e3; out know,1 to client;
+endconcurrent;
+concurrent;
+label e4; out tric,3 to client;
+endconcurrent;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test60.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test60.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_test60.mpr.result 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,29 @@
+z120_test60.mpr[10,0] Missing ';'.
+z120_test60.mpr[12,0] Missing ';'.
+OK: z120_test60 is correct, should be correct
+
+mscdocument z120_test60;
+msc Strnka1;
+inst client;
+inst server;
+client: instance;
+concurrent;
+out no,0 to server;
+in know,1 from server;
+endconcurrent;
+out yes,2 to lost;
+concurrent;
+in tric,3 from server;
+endconcurrent;
+in tric,4 from found;
+endinstance;
+server: instance;
+in no,0 from client;
+concurrent;
+out know,1 to client;
+endconcurrent;
+concurrent;
+out tric,3 to client;
+endconcurrent;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test61.mpr
===================================================================
--- trunk/tests/z120_test/z120_test61.mpr (rev 0)
+++ trunk/tests/z120_test/z120_test61.mpr 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,25 @@
+mscdocument Vkres2;
+msc Strnka1;
+inst client;
+inst server;
+client: instance;
+concurrent;
+label e0; out no,0 to server;
+label e1; in know,1 from server;
+endconcurrent
+out yes,2 to lost;
+concurrent
+label e2; in tric,3 from server;
+endconcurrent;
+in tric,4 from found;
+endinstance;
+server: instance;
+in no,0 from client;
+concurrent;
+label e3; out know,1 to client;
+endconcurrent;
+concurrent;
+label e4; out tric3 to client;
+endconcurrent;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test61.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test61.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_test61.mpr.result 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,31 @@
+z120_test61.mpr[10,0] Missing ';'.
+z120_test61.mpr[12,0] Missing ';'.
+Warning 05: There is complete message with only one event
+
+OK: z120_test61 is correct, should be correct
+
+mscdocument z120_test61;
+msc Strnka1;
+inst client;
+inst server;
+client: instance;
+concurrent;
+out no,0 to server;
+in know,1 from server;
+endconcurrent;
+out yes,2 to lost;
+concurrent;
+in tric,3 from found;
+endconcurrent;
+in tric,4 from found;
+endinstance;
+server: instance;
+in no,0 from client;
+concurrent;
+out know,1 to client;
+endconcurrent;
+concurrent;
+out tric3,5 to lost;
+endconcurrent;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test62.mpr
===================================================================
--- trunk/tests/z120_test/z120_test62.mpr (rev 0)
+++ trunk/tests/z120_test/z120_test62.mpr 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,11 @@
+/**************************************************
+Example of bMSC with commnet and definition of parameter after message identification
+**************************************************/
+
+mscdocument z120;
+msc test01;
+/*commnet example */
+ONE: instance; //comment example
+ONE: in LEFT,2('/*commnet example*/parameter') from found;
+ONE: edinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test62.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test62.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_test62.mpr.result 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,12 @@
+z120_test62.mpr[10,5] Missing elements.
+Warning 20: Msc has not finished 1 instance
+
+OK: z120_test62 is correct, should be correct
+
+mscdocument z120_test62;
+msc test01;
+inst ONE;
+ONE: instance;
+in LEFT,0 from found;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test63.mpr
===================================================================
--- trunk/tests/z120_test/z120_test63.mpr (rev 0)
+++ trunk/tests/z120_test/z120_test63.mpr 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,20 @@
+/*****************************************************
+Example of MSC where two instances have the same name (NAME)
+*****************************************************/
+
+msc Trick;
+inst NAME;
+inst NAME;
+NAME instance;
+out NAME,0 to NAME;
+endinstance
+NAME: instance;
+in NAME,0 from NAME;
+endinstance;
+endmsc;
+msc Stranka_1;
+initial connect L0;
+L0: reference Trick connect L1;
+L1: final;
+endmsc;
+
Added: trunk/tests/z120_test/z120_test64.mpr
===================================================================
--- trunk/tests/z120_test/z120_test64.mpr (rev 0)
+++ trunk/tests/z120_test/z120_test64.mpr 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,28 @@
+/*************************************************
+Example of bMSC with coregion (used '_' sign)
+*************************************************/
+
+mscdocument Vkres1;
+msc Strnka1;
+inst PC;
+inst Server;
+PC: instance;
+out SYN,0 to Server;
+in SYNACK,1 from Server;
+out ACK,2 to Server;
+out request_a,3 to Server;
+out request_b,4 to Server;
+in result,5 from Server;
+endinstance;
+Server: instance;
+in SYN,0 fom PC;
+out SYNACK,1 to PC;
+in ACK,2 from PC;
+concurrent;
+in request_a,3 from PC befre e0;
+in request_b,4 from PC;
+label e0;
+out result,5 to PC;
+endconcurrent;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test64.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test64.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_test64.mpr.result 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,34 @@
+z120_test64.mpr[18,9] Missing 'from'.
+z120_test64.mpr[18,9] Unwanted input: expected ';'.
+z120_test64.mpr[22,23] Missing ';'.
+z120_test64.mpr[22,29] Cannot match to any predicted input.
+z120_test64.mpr[24,6] Cannot match to any predicted input.
+Warning 04: Instance Server does not have finished some coregion
+
+Warning 05: There is complete message with only one event
+
+Warning 20: Msc has not finished 1 instance
+
+OK: z120_test64 is correct, should be correct
+
+mscdocument z120_test64;
+msc Strnka1;
+inst PC;
+inst Server;
+PC: instance;
+out SYN,0 to Server;
+in SYNACK,1 from Server;
+out ACK,2 to Server;
+out request_a,3 to Server;
+out request_b,4 to lost;
+in result,5 from found;
+endinstance;
+Server: instance;
+in SYN,0 from PC;
+out SYNACK,1 to PC;
+in ACK,2 from PC;
+concurrent;
+in request_a,3 from PC;
+endconcurrent;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test65.mpr
===================================================================
--- trunk/tests/z120_test/z120_test65.mpr (rev 0)
+++ trunk/tests/z120_test/z120_test65.mpr 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,37 @@
+mscdocument Vykres2;
+msc Two;
+inst Second;
+inst First;
+Second: instance;
+out true,0 to First;
+endinstance;
+First: instance;
+in true,0 from Second;
+endinstance;
+endmsc;
+msc Stranka_1;
+iitial connect L0;
+L0: reference One connect L1;
+L1: reference Two connect L2;
+L2: final;
+endmsc;
+msc One;
+initial connect L0;
+L0: condition access connect L1;
+L1: final;
+endmsc;
+msc Trick;
+inst NAME;
+inst NAME;
+NAME: instance;
+out NAME,0 to NAME;
+endinstance;
+NAME: instance;
+in NAME,0 from NAME;
+endinstance;
+endmsc;
+msc Stranka_1;
+initial connect L0;
+L0: reference Trick connect L1;
+L1: final;
+endmsc;
Added: trunk/tests/z120_test/z120_test65.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test65.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_test65.mpr.result 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,38 @@
+z120_test65.mpr[13,7] Cannot match to any predicted input.
+Warning 16: Instance with the same name (NAME) has been created
+
+Warning 02: There are more unreferenced MSC
+
+OK: z120_test65 is correct, should be correct
+
+mscdocument z120_test65;
+msc One;
+initial connect L0;
+L0: condition access connect L1;
+L1: final;
+endmsc;
+msc Stranka_1;
+initial connect L0;
+L0: reference Trick connect L1;
+L1: final;
+endmsc;
+msc Two;
+inst Second;
+inst First;
+Second: instance;
+out true,0 to First;
+endinstance;
+First: instance;
+in true,0 from Second;
+endinstance;
+endmsc;
+msc Trick;
+inst NAME;
+inst NAME;
+NAME: instance;
+out NAME,0 to NAME;
+in NAME,0 from NAME;
+endinstance;
+NAME: instance;
+endinstance;
+endmsc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2009-09-25 08:34:13
|
Revision: 367
http://scstudio.svn.sourceforge.net/scstudio/?rev=367&view=rev
Author: madzin
Date: 2009-09-25 08:33:59 +0000 (Fri, 25 Sep 2009)
Log Message:
-----------
Fix some tests
Modified Paths:
--------------
trunk/src/data/Z120/Z120.g
trunk/tests/z120_test/z120_test52.mpr.result
trunk/tests/z120_test/z120_test54.mpr.result
trunk/tests/z120_test/z120_test63.mpr
Added Paths:
-----------
trunk/tests/z120_test/z120_test63.mpr.result
Modified: trunk/src/data/Z120/Z120.g
===================================================================
--- trunk/src/data/Z120/Z120.g 2009-09-25 08:09:05 UTC (rev 366)
+++ trunk/src/data/Z120/Z120.g 2009-09-25 08:33:59 UTC (rev 367)
@@ -595,11 +595,11 @@
;
input_dest:
- 'lost' //(input_address)? | input_address
+ 'lost' (input_address)? | input_address
;
output_dest:
- 'found' //(output_address)? | output_address
+ 'found' (output_address)? | output_address
;
def_in_gate:
Modified: trunk/tests/z120_test/z120_test52.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test52.mpr.result 2009-09-25 08:09:05 UTC (rev 366)
+++ trunk/tests/z120_test/z120_test52.mpr.result 2009-09-25 08:33:59 UTC (rev 367)
@@ -3,6 +3,6 @@
mscdocument z120_test52;
msc One;
initial connect L0;
-L0: condition access,a connect L1;
+L0: condition access_a connect L1;
L1: final;
endmsc;
Modified: trunk/tests/z120_test/z120_test54.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test54.mpr.result 2009-09-25 08:09:05 UTC (rev 366)
+++ trunk/tests/z120_test/z120_test54.mpr.result 2009-09-25 08:33:59 UTC (rev 367)
@@ -14,8 +14,8 @@
in A,2 from found;
out jedna,0 to B;
concurrent;
+out B1,1 to B;
out B,3 to lost;
-out B1,1 to B;
endconcurrent;
endinstance;
endmsc;
Modified: trunk/tests/z120_test/z120_test63.mpr
===================================================================
--- trunk/tests/z120_test/z120_test63.mpr 2009-09-25 08:09:05 UTC (rev 366)
+++ trunk/tests/z120_test/z120_test63.mpr 2009-09-25 08:33:59 UTC (rev 367)
@@ -1,7 +1,3 @@
-/*****************************************************
-Example of MSC where two instances have the same name (NAME)
-*****************************************************/
-
msc Trick;
inst NAME;
inst NAME;
Added: trunk/tests/z120_test/z120_test63.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test63.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_test63.mpr.result 2009-09-25 08:33:59 UTC (rev 367)
@@ -0,0 +1,13 @@
+z120_test63.mpr[4,5] Cannot match to any predicted input.
+Warning 09: There is reference to nonexisted MSC
+
+OK: z120_test63 is correct, should be correct
+
+mscdocument z120_test63;
+msc Stranka_1;
+initial connect L0;
+L0: reference Trick connect L1;
+L1: final;
+endmsc;
+msc Trick;
+endmsc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2009-09-25 20:24:13
|
Revision: 377
http://scstudio.svn.sourceforge.net/scstudio/?rev=377&view=rev
Author: gotthardp
Date: 2009-09-25 20:24:01 +0000 (Fri, 25 Sep 2009)
Log Message:
-----------
Fixed Z.120 compliance of time constraints generated by z120 export formatter.
Modified Paths:
--------------
trunk/src/data/Z120/z120_save.cpp
trunk/tests/z120_test/z120_time01.mpr
trunk/tests/z120_test/z120_time01.mpr.result
Modified: trunk/src/data/Z120/z120_save.cpp
===================================================================
--- trunk/src/data/Z120/z120_save.cpp 2009-09-25 11:27:52 UTC (rev 376)
+++ trunk/src/data/Z120/z120_save.cpp 2009-09-25 20:24:01 UTC (rev 377)
@@ -581,6 +581,18 @@
<< ": final";
}
+ if(reference_node != NULL)
+ {
+ const TimeRelationRefNodePtrSet& tops = reference_node->get_time_relations_top();
+ const TimeRelationRefNodePtrSet& bottoms = reference_node->get_time_relations_bottom();
+
+ // phase 1: print "time" constraints
+ print_time_relations1(stream, reference_node, tops);
+ // phase 2: print "top" and "bottom" constraints
+ print_time_relations2(stream, node_id_map, "top", reference_node, tops);
+ print_time_relations2(stream, node_id_map, "bottom", reference_node, bottoms);
+ }
+
PredecessorNode *predecessor_node = dynamic_cast<PredecessorNode*>(npos->get());
if(predecessor_node != NULL)
{
@@ -608,18 +620,6 @@
print_comments(stream, *npos);
stream << ";" << std::endl;
-
- if(reference_node != NULL)
- {
- const TimeRelationRefNodePtrSet& tops = reference_node->get_time_relations_top();
- const TimeRelationRefNodePtrSet& bottoms = reference_node->get_time_relations_bottom();
-
- // phase 1: print "time" constraints
- print_time_relations1(stream, reference_node, tops);
- // phase 2: print "top" and "bottom" constraints
- print_time_relations2(stream, node_id_map, "top", reference_node, tops);
- print_time_relations2(stream, node_id_map, "bottom", reference_node, bottoms);
- }
}
stream << "endmsc;" << std::endl;
Modified: trunk/tests/z120_test/z120_time01.mpr
===================================================================
--- trunk/tests/z120_test/z120_time01.mpr 2009-09-25 11:27:52 UTC (rev 376)
+++ trunk/tests/z120_test/z120_time01.mpr 2009-09-25 20:24:01 UTC (rev 377)
@@ -5,9 +5,9 @@
initial connect L0;
L0: connect L1, L2;
L1: reference Subprocess connect L3;
-L2: reference Subprocess connect L1;
-time (1,2);
+L2: reference Subprocess time [1,2);
top bottom L1 (1,10);
+connect L1;
L3: final;
endmsc;
msc Subprocess;
@@ -17,7 +17,7 @@
out NAME,0 to P2;
label e0;
out NAME,1 to P2;
-time e1 7;
+time e1 [7];
label e1;
in NAME,2 from P2;
endinstance;
Modified: trunk/tests/z120_test/z120_time01.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time01.mpr.result 2009-09-25 11:27:52 UTC (rev 376)
+++ trunk/tests/z120_test/z120_time01.mpr.result 2009-09-25 20:24:01 UTC (rev 377)
@@ -5,9 +5,9 @@
initial connect L0;
L0: connect L1, L2;
L1: reference Subprocess connect L3;
-L2: reference Subprocess connect L1;
-time (1,2);
+L2: reference Subprocess time [1,2);
top bottom L1 (1,10);
+connect L1;
L3: final;
endmsc;
msc Subprocess;
@@ -17,7 +17,7 @@
out NAME,0 to P2;
label e0;
out NAME,1 to P2;
-time e1 7;
+time e1 [7];
label e1;
in NAME,2 from P2;
endinstance;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <koc...@us...> - 2009-09-25 20:45:40
|
Revision: 378
http://scstudio.svn.sourceforge.net/scstudio/?rev=378&view=rev
Author: kocianon
Date: 2009-09-25 20:45:29 +0000 (Fri, 25 Sep 2009)
Log Message:
-----------
fix of string constructors
Modified Paths:
--------------
trunk/src/data/time.cpp
trunk/src/data/time.h
trunk/tests/interval_string.cpp
Modified: trunk/src/data/time.cpp
===================================================================
--- trunk/src/data/time.cpp 2009-09-25 20:24:01 UTC (rev 377)
+++ trunk/src/data/time.cpp 2009-09-25 20:45:29 UTC (rev 378)
@@ -57,8 +57,20 @@
m_closed(closed)
,m_value(0)
{
- if(number[0]=='i')
+ int position=0;
+ int neg = 1;
+ if(number[0]=='-')
+ {
+ neg = -1;
+ position=1;
+ }
+
+ if(number[position]=='i')
+ {
m_value = std::numeric_limits<double>::infinity();
+ if(neg<0)
+ m_value = -m_value;
+ }
else
{
const char* pos = number.c_str();
Modified: trunk/src/data/time.h
===================================================================
--- trunk/src/data/time.h 2009-09-25 20:24:01 UTC (rev 377)
+++ trunk/src/data/time.h 2009-09-25 20:45:29 UTC (rev 378)
@@ -133,13 +133,17 @@
inline bool check_number(const std::string& word)
{
const std::string inf="inf";
+ const std::string ninf="-inf";
// its number
- if(isdigit(word[0]))
+ int position=0;
+ if(word[0]=='-')
+ position=1;
+ if(isdigit(word[position]))
{
- // only one separator is allowed, false - separator has been found
+ // only one separator is allowed, false - separator has been used
bool separator=true;
- for(unsigned i=1;i<word.length();i++)
+ for(unsigned i=position+1;i<word.length();i++)
{
if(isdigit(word[i]))
continue;
@@ -153,9 +157,9 @@
}
return true;
}
- else if(isalpha(word[0]))
+ else if(isalpha(word[position]))
{
- if(word!=inf)
+ if(word!=inf&&word!=ninf)
return false;
return true;
}
@@ -564,7 +568,7 @@
if(!char_in_string(tmp[tmp.length()-1],")]"))
{
if(!check_number(tmp))
- throw MscIntervalStringConversionError(tmp + std::string(" is not valid number."));
+ throw MscIntervalStringConversionError(tmp + std::string(" is not a valid number."));
MscIntervalCouple<T> begin(tmp,b_closed);
MscIntervalCouple<T> end(tmp,e_closed);
@@ -608,9 +612,9 @@
}
// checking numbers
if(!check_number(b))
- throw MscIntervalStringConversionError(b + std::string(" is not valid number."));
+ throw MscIntervalStringConversionError(b + std::string(" is not a valid number."));
if(!check_number(e))
- throw MscIntervalStringConversionError(e + std::string(" is not valid number."));
+ throw MscIntervalStringConversionError(e + std::string(" is not a valid number."));
// Create MscIntervalCouples
MscIntervalCouple<T> begin(b,b_closed);
@@ -749,6 +753,28 @@
return !((m_begin==right.m_begin)&&(m_end==right.m_end));
}
+ /**
+ * \brief tests if the interval is valid
+ * Tests beginning and ending value
+ *
+ * * beginning value > ending value:
+ * invalid interval
+ *
+ * * beginning value < ending value:
+ * valid interval
+ *
+ * * MscIntervalException (begin == end, brackets difference)
+ * cases:
+ * (4,4], [4,4)
+ * interval is not valid in both cases.
+ *
+ * * beginning value == ending value, brackets are same
+ * cases:
+ * (4,4) - not valid
+ * [4,4] - valid interval
+ * \return true if the interval is valid
+ */
+
bool is_valid()
{
try
Modified: trunk/tests/interval_string.cpp
===================================================================
--- trunk/tests/interval_string.cpp 2009-09-25 20:24:01 UTC (rev 377)
+++ trunk/tests/interval_string.cpp 2009-09-25 20:45:29 UTC (rev 378)
@@ -8,9 +8,41 @@
<< ": Assertion " #x " failed on line " \
<< __LINE__ << std::endl; return 1; \
}
+/**
+ * \brief Trying to construct interval from string
+ * \param error says if the interval string is expected to be valid
+ * \return 0 to test successfully else 1
+ */
+int test_interval_set(std::string int_string,bool valid)
+{
+ std::cerr << "Interval set string: " << int_string << " expected to be ";
+ if(valid)
+ std::cerr << "valid";
+ else
+ std::cerr << "INvalid";
+ std::cerr << std::endl;
+ try
+ {
+ MscTimeIntervalSet<double> set(int_string);
+ std::cerr << "Interval set: " << set << std::endl;
+ }
+ catch(MscIntervalStringConversionError ex){
+ std::cerr << "Exception: " << ex.what() << std::endl;
+ if(valid)
+ std::cerr << "!!! ERROR" << std::endl;
+ std::cerr << std::endl;
+ return valid;
+ }
+ if(!valid)
+ std::cerr << "!!! ERROR" << std::endl;
+ std::cerr << std::endl;
+ return !valid;
+}
+
int main()
{
+/*
MscTimeInterval<double> dou(false,10,18,true);
MscTimeInterval<DecScaled> dec(false,10,18,true);
@@ -26,7 +58,6 @@
// TEST_ASSERT(dec==inter_dec);
-/*
try {
MscTimeInterval<double> a(std::string(" 9 9 "));
TEST_ASSERT(false);
@@ -45,18 +76,23 @@
}
catch(MscIntervalStringConversionError){}
*/
- MscTimeInterval<DecScaled> d("[ 10]");
- std::cerr << d << std::endl;
+ int ret;
+ ret = 0;
- MscTimeInterval<DecScaled> a("10");
- std::cerr << a << std::endl;
- MscTimeInterval<DecScaled> b("(10,12]");
- std::cerr << b << std::endl;
+ ret+=test_interval_set("10+[10]+50+[30,40)",true);
+ ret+=test_interval_set("(1,2) + (1.2,13]",true);
+ ret+=test_interval_set(" ( inf, 3.23) + [4,6543]",false);
+ ret+=test_interval_set("(5.431,4.876)+(1,2)",false);
+ ret+=test_interval_set("(0.123,inf]",false);
+ ret+=test_interval_set("( inf, 3.23,1) + [4,6543]",false);
+ ret+=test_interval_set("[(4)]",false);
+ ret+=test_interval_set("[-inf,1)",false);
+ ret+=test_interval_set("(-inf,1)",true);
- MscTimeIntervalSet<double> c("10+[10]+50+[30,40)");
- std::cerr << c << std::endl;
+ std::cerr << std::endl << "Number of errors: " << ret << std::endl;
+
// MscTimeInterval<DecScaled> c(std::string("405"));
- return 0;
+ return ret;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2009-09-26 12:40:27
|
Revision: 379
http://scstudio.svn.sourceforge.net/scstudio/?rev=379&view=rev
Author: gotthardp
Date: 2009-09-26 12:40:09 +0000 (Sat, 26 Sep 2009)
Log Message:
-----------
New feature: Help system is now integrated into the Visio add-on.
Modified Paths:
--------------
trunk/doc/CMakeLists.txt
trunk/doc/help/acyclic/acyclic.html
trunk/doc/help/fifo/fifo.html
trunk/doc/help/localchoice/localchoice.html
trunk/doc/help/membership/membership_documentation.html
trunk/src/check/boundedness/universal_boundedness_checker.h
trunk/src/check/liveness/deadlock_checker.h
trunk/src/check/liveness/livelock_checker.h
trunk/src/check/localchoice/local_choice_checker.h
trunk/src/check/order/acyclic_checker.h
trunk/src/check/order/fifo_checker.h
trunk/src/check/race/race_checker.h
trunk/src/check/realizability/realizability_checker.h
trunk/src/check/structure/name_checker.h
trunk/src/check/time/constrain_check.h
trunk/src/data/checker.h
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/dllmodule.cpp
trunk/src/view/visio/addon/dllmodule.h
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
trunk/src/view/visio/addon/reportview.cpp
trunk/src/view/visio/addon/reportview.h
trunk/src/view/visio/scstudio.nsi
Added Paths:
-----------
trunk/doc/help/
trunk/doc/help/CMakeLists.txt
trunk/doc/help/acyclic/
trunk/doc/help/algorithms.html
trunk/doc/help/fifo/
trunk/doc/help/help.css
trunk/doc/help/hhc.cmake
trunk/doc/help/localchoice/
trunk/doc/help/membership/
trunk/doc/help/scstudio.hhc
trunk/doc/help/scstudio.hhp
Removed Paths:
-------------
trunk/doc/acyclic/
trunk/doc/fifo/
trunk/doc/localChoice/
trunk/doc/membership/
Modified: trunk/doc/CMakeLists.txt
===================================================================
--- trunk/doc/CMakeLists.txt 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/doc/CMakeLists.txt 2009-09-26 12:40:09 UTC (rev 379)
@@ -25,3 +25,8 @@
ADD_PDFLATEX_DOCUMENT(beautify)
ADD_PDFLATEX_DOCUMENT(memb_alg)
ENDIF(PDFLATEX_COMPILER)
+
+
+ADD_SUBDIRECTORY(help)
+
+# $Id$
Property changes on: trunk/doc/help
___________________________________________________________________
Added: svn:ignore
+ CMakeFiles
cmake_install.cmake
CTestTestfile.cmake
*.dir
Makefile
*.vcproj
Added: trunk/doc/help/CMakeLists.txt
===================================================================
--- trunk/doc/help/CMakeLists.txt (rev 0)
+++ trunk/doc/help/CMakeLists.txt 2009-09-26 12:40:09 UTC (rev 379)
@@ -0,0 +1,20 @@
+FIND_PACKAGE(HTMLHelp)
+
+IF(HTML_HELP_COMPILER)
+ ADD_CUSTOM_TARGET(help ALL
+ DEPENDS scstudio.chm
+ )
+ ADD_CUSTOM_COMMAND(
+ OUTPUT scstudio.chm
+ COMMAND ${CMAKE_COMMAND} -DHTML_HELP_COMPILER=${HTML_HELP_COMPILER} -P ${CMAKE_CURRENT_SOURCE_DIR}/hhc.cmake
+ DEPENDS
+ help.css
+ algorithms.html
+ localChoice/localchoice.html
+ membership/membership_documentation.html
+ fifo/fifo.html
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+ENDIF(HTML_HELP_COMPILER)
+
+# $Id$
Property changes on: trunk/doc/help/CMakeLists.txt
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/doc/help/acyclic/acyclic.html
===================================================================
--- trunk/doc/acyclic/acyclic.html 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/doc/help/acyclic/acyclic.html 2009-09-26 12:40:09 UTC (rev 379)
@@ -4,9 +4,7 @@
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE>Acyclic property</TITLE>
<meta name="author" content="Martin Chmelik">
- <META NAME="CREATED" CONTENT="20090924;16150000">
- <STYLE TYPE="text/css">
- </STYLE>
+ <LINK href="../help.css" rel="stylesheet" type="text/css"/>
</HEAD>
<BODY>
<H1>Acyclic property</H1>
Added: trunk/doc/help/algorithms.html
===================================================================
--- trunk/doc/help/algorithms.html (rev 0)
+++ trunk/doc/help/algorithms.html 2009-09-26 12:40:09 UTC (rev 379)
@@ -0,0 +1,15 @@
+<html>
+<head>
+<link href="help.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<h1>Algorithms</h1>
+The following verification algorithms are supported:
+<ul>
+<li><a href="acyclic/acyclic.html">Acyclic property</a></li>
+<li><a href="fifo/fifo.html">FIFO property</a></li>
+<li><a href="localChoice/localchoice.html">Nonlocal Choice</a></li>
+<li><a href="membership/membership_documentation.html">Membership</a></li>
+</ul>
+</body>
+</html>
Property changes on: trunk/doc/help/algorithms.html
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/doc/help/fifo/fifo.html
===================================================================
--- trunk/doc/fifo/fifo.html 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/doc/help/fifo/fifo.html 2009-09-26 12:40:09 UTC (rev 379)
@@ -4,9 +4,7 @@
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE>FIFO</TITLE>
<meta name="author" content="Martin Chmelik">
- <META NAME="CREATED" CONTENT="20090924;16150000">
- <STYLE TYPE="text/css">
- </STYLE>
+ <LINK href="../help.css" rel="stylesheet" type="text/css"/>
</HEAD>
<BODY>
<H1>FIFO property</H1>
Added: trunk/doc/help/help.css
===================================================================
--- trunk/doc/help/help.css (rev 0)
+++ trunk/doc/help/help.css 2009-09-26 12:40:09 UTC (rev 379)
@@ -0,0 +1,14 @@
+body {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 0.7em;
+ color: #000000;
+}
+h1 {
+ font-size: 1.2em;
+}
+h2 {
+ font-size: 1.0em;
+}
+h3 {
+ font-size: 1.0em;
+}
Property changes on: trunk/doc/help/help.css
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/doc/help/hhc.cmake
===================================================================
--- trunk/doc/help/hhc.cmake (rev 0)
+++ trunk/doc/help/hhc.cmake 2009-09-26 12:40:09 UTC (rev 379)
@@ -0,0 +1,6 @@
+# hhc.exe always returns nonzero exit codes
+# indicect hhc.exe execution is to avoid build error in visual studio
+EXECUTE_PROCESS(
+ COMMAND ${HTML_HELP_COMPILER} scstudio.hhp
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+)
Property changes on: trunk/doc/help/hhc.cmake
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/doc/help/localchoice/localchoice.html
===================================================================
--- trunk/doc/localChoice/localchoice.html 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/doc/help/localchoice/localchoice.html 2009-09-26 12:40:09 UTC (rev 379)
@@ -4,16 +4,7 @@
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE>Non-local choice</TITLE>
<meta name="author" content="Martin Chmelik">
- <META NAME="CREATED" CONTENT="20090924;16150000">
- <STYLE TYPE="text/css">
- .gallery table { float: left; margin: 0 5px 20px 0; }
- .gallery table { border-collapse: collapse; }
- .gallery table td { padding: 0; }
- .gallery table caption { font-size: 80%; }
- .vary .caption { height: 4em; vertical-align: top; }
- .vary table { width: 200px; }
- </STYLE>
-
+ <LINK href="../help.css" rel="stylesheet" type="text/css"/>
</HEAD>
<BODY>
<H1>Non-local choice</H1>
Modified: trunk/doc/help/membership/membership_documentation.html
===================================================================
--- trunk/doc/membership/membership_documentation.html 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/doc/help/membership/membership_documentation.html 2009-09-26 12:40:09 UTC (rev 379)
@@ -3,14 +3,7 @@
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE>membership documentation</TITLE>
- <STYLE TYPE="text/css">
- .gallery table { float: left; margin: 0 5px 20px 0; }
- .gallery table { border-collapse: collapse; }
- .gallery table td { padding: 0; }
- .gallery table caption { font-size: 80%; }
- .vary .caption { height: 4em; vertical-align: top; }
- .vary table { width: 200px; }
- </STYLE>
+ <LINK href="../help.css" rel="stylesheet" type="text/css"/>
</HEAD>
<BODY LANG="en-US" DIR="LTR" STYLE="border: none; padding: 0in">
<h1>Membership</FONT></h1>
@@ -23,19 +16,19 @@
<DIV class="gallery vary">
<table><caption align="bottom"><i>Input bMSC</i></caption><tr><td>
-<img src="memebership_documentation2.png" width="265" height="265" border="0" alt="" title="Input bMSC">
+<img src="memebership_documentation2.png" border="0" alt="" title="Input bMSC">
</tr></td></table>
<table><caption align="bottom"><i>Input HMSC</i></caption><tr><td>
-<img src="memebership_documentation1.png" width="265" height="265" border="0" alt="" title="Input HMSC">
+<img src="memebership_documentation1.png" border="0" alt="" title="Input HMSC">
</tr></td></table>
<table><caption align="bottom"><i>bMSC01</i></caption><tr><td>
-<img src="memebership_documentation3.png" width="265" height="265" border="0" alt="" title="bMSC01">
+<img src="memebership_documentation3.png" border="0" alt="" title="bMSC01">
</tr></td></table>
<table><caption align="bottom"><i>bMSC02</i></caption><tr><td>
-<img src="memebership_documentation4.png" width="265" height="265" border="0" alt="" title="bMSC02">
+<img src="memebership_documentation4.png" border="0" alt="" title="bMSC02">
</tr></td></table>
</div>
<br clear="all">
@@ -71,35 +64,35 @@
<DIV class="gallery vary">
<table><caption align="bottom"><i>Input bMSC</i></caption><tr><td>
-<img src="memebership_documentation11.png" width="265" height="265" border="0" alt="" title="bMSC1">
+<img src="memebership_documentation11.png" border="0" alt="" title="bMSC1">
</tr></td></table>
<table><caption align="bottom"><i>Input HMSC</i></caption><tr><td>
-<img src="memebership_documentation5.png" width="265" height="265" border="0" alt="" title="Input HMSC" >
+<img src="memebership_documentation5.png" border="0" alt="" title="Input HMSC" >
</tr></td></table>
<table><caption align="bottom"><i>bMSC1</i></caption><tr><td>
-<img src="memebership_documentation6.png" width="265" height="265" border="0" alt="" title="bMSC2">
+<img src="memebership_documentation6.png" border="0" alt="" title="bMSC2">
</tr></td></table>
<table><caption align="bottom"><i>bMSC2</i></caption><tr><td>
-<img src="memebership_documentation7.png" width="265" height="265" border="0" alt="" title="bMSC2">
+<img src="memebership_documentation7.png" border="0" alt="" title="bMSC2">
</tr></td></table>
<table><caption align="bottom"><i>bMSC3</i></caption><tr><td>
-<img src="memebership_documentation8.png" width="265" height="265" border="0" alt="" title="bMSC3">
+<img src="memebership_documentation8.png" border="0" alt="" title="bMSC3">
</tr></td></table>
<table><caption align="bottom"><i>bMSC4</i></caption><tr><td>
-<img src="memebership_documentation9.png" width="265" height="265" border="0" alt="" title="bMSC4">
+<img src="memebership_documentation9.png" border="0" alt="" title="bMSC4">
</tr></td></table>
<table><caption align="bottom"><i>bMSC5</i></caption><tr><td>
-<img src="memebership_documentation10.png" width="265" height="265" border="0" alt="" title="bMSC5">
+<img src="memebership_documentation10.png" border="0" alt="" title="bMSC5">
</tr></td></table>
<table><caption align="bottom"><i>Result</i></caption><tr><td>
-<img src="memebership_documentation12.png" width="265" height="265" border="0" alt="" title="result">
+<img src="memebership_documentation12.png" border="0" alt="" title="result">
</tr></td></table>
</div>
<br clear="all">
Added: trunk/doc/help/scstudio.hhc
===================================================================
--- trunk/doc/help/scstudio.hhc (rev 0)
+++ trunk/doc/help/scstudio.hhc 2009-09-26 12:40:09 UTC (rev 379)
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<HTML>
+<HEAD>
+<meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1">
+<!-- Sitemap 1.0 -->
+</HEAD><BODY>
+<OBJECT type="text/site properties">
+ <param name="ImageType" value="Folder">
+</OBJECT>
+<UL>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Algorithms">
+ <param name="Local" value="algorithms.html">
+ </OBJECT>
+ <UL>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Acyclic property">
+ <param name="Local" value="acyclic\acyclic.html">
+ </OBJECT>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="FIFO property">
+ <param name="Local" value="fifo\fifo.html">
+ </OBJECT>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Nonlocal Choice">
+ <param name="Local" value="localchoice\localchoice.html">
+ </OBJECT>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Membership">
+ <param name="Local" value="membership\membership_documentation.html">
+ </OBJECT>
+ </UL>
+</UL>
+</BODY></HTML>
Property changes on: trunk/doc/help/scstudio.hhc
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/doc/help/scstudio.hhp
===================================================================
--- trunk/doc/help/scstudio.hhp (rev 0)
+++ trunk/doc/help/scstudio.hhp 2009-09-26 12:40:09 UTC (rev 379)
@@ -0,0 +1,11 @@
+[OPTIONS]
+Compatibility=1.1 or later
+Compiled file=scstudio.chm
+Contents file=scstudio.hhc
+Display compile progress=No
+Language=0x409 Angli\xE8tina (Spojen\xE9 st\xE1ty)
+Title=Sequence Chart Studio
+
+
+[INFOTYPES]
+
Property changes on: trunk/doc/help/scstudio.hhp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/check/boundedness/universal_boundedness_checker.h
===================================================================
--- trunk/src/check/boundedness/universal_boundedness_checker.h 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/check/boundedness/universal_boundedness_checker.h 2009-09-26 12:40:09 UTC (rev 379)
@@ -144,6 +144,12 @@
virtual std::wstring get_property_name() const
{ return L"Universal Boundedness"; }
+ /**
+ * Ralative path to a HTML file displayed as help.
+ */
+ virtual std::wstring get_help_filename() const
+ { return L""; }
+
virtual PreconditionList get_preconditions(MscPtr msc) const;
/**
Modified: trunk/src/check/liveness/deadlock_checker.h
===================================================================
--- trunk/src/check/liveness/deadlock_checker.h 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/check/liveness/deadlock_checker.h 2009-09-26 12:40:09 UTC (rev 379)
@@ -131,6 +131,12 @@
virtual std::wstring get_property_name() const
{ return L"Deadlock Free"; }
+ /**
+ * Ralative path to a HTML file displayed as help.
+ */
+ virtual std::wstring get_help_filename() const
+ { return L""; }
+
virtual PreconditionList get_preconditions(MscPtr msc) const;
/**
Modified: trunk/src/check/liveness/livelock_checker.h
===================================================================
--- trunk/src/check/liveness/livelock_checker.h 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/check/liveness/livelock_checker.h 2009-09-26 12:40:09 UTC (rev 379)
@@ -105,6 +105,12 @@
virtual std::wstring get_property_name() const
{ return L"Livelock Free"; }
+ /**
+ * Ralative path to a HTML file displayed as help.
+ */
+ virtual std::wstring get_help_filename() const
+ { return L""; }
+
virtual PreconditionList get_preconditions(MscPtr msc) const;
static LivelockCheckerPtr instance();
Modified: trunk/src/check/localchoice/local_choice_checker.h
===================================================================
--- trunk/src/check/localchoice/local_choice_checker.h 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/check/localchoice/local_choice_checker.h 2009-09-26 12:40:09 UTC (rev 379)
@@ -133,6 +133,12 @@
virtual std::wstring get_property_name() const
{ return L"Local Choice"; }
+ /**
+ * Ralative path to a HTML file displayed as help.
+ */
+ virtual std::wstring get_help_filename() const
+ { return L"localchoice/localchoice.html"; }
+
virtual PreconditionList get_preconditions(MscPtr msc) const;
/**
Modified: trunk/src/check/order/acyclic_checker.h
===================================================================
--- trunk/src/check/order/acyclic_checker.h 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/check/order/acyclic_checker.h 2009-09-26 12:40:09 UTC (rev 379)
@@ -69,6 +69,12 @@
virtual std::wstring get_property_name() const
{ return L"Acyclic"; }
+ /**
+ * Ralative path to a HTML file displayed as help.
+ */
+ virtual std::wstring get_help_filename() const
+ { return L"acyclic/acyclic.html"; }
+
virtual PreconditionList get_preconditions(MscPtr msc) const;
/**
Modified: trunk/src/check/order/fifo_checker.h
===================================================================
--- trunk/src/check/order/fifo_checker.h 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/check/order/fifo_checker.h 2009-09-26 12:40:09 UTC (rev 379)
@@ -82,6 +82,12 @@
virtual std::wstring get_property_name() const
{ return L"FIFO"; }
+ /**
+ * Ralative path to a HTML file displayed as help.
+ */
+ virtual std::wstring get_help_filename() const
+ { return L"fifo/fifo.html"; }
+
virtual PreconditionList get_preconditions(MscPtr msc) const;
/**
Modified: trunk/src/check/race/race_checker.h
===================================================================
--- trunk/src/check/race/race_checker.h 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/check/race/race_checker.h 2009-09-26 12:40:09 UTC (rev 379)
@@ -228,6 +228,12 @@
virtual std::wstring get_property_name() const
{ return L"Race Free"; }
+ /**
+ * Ralative path to a HTML file displayed as help.
+ */
+ virtual std::wstring get_help_filename() const
+ { return L""; }
+
virtual PreconditionList get_preconditions(MscPtr msc) const;
BMscPtr check_bmsc(BMscPtr bmsc, ChannelMapperPtr mapper);
Modified: trunk/src/check/realizability/realizability_checker.h
===================================================================
--- trunk/src/check/realizability/realizability_checker.h 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/check/realizability/realizability_checker.h 2009-09-26 12:40:09 UTC (rev 379)
@@ -48,6 +48,12 @@
virtual std::wstring get_property_name() const
{ return L"Strong realizability"; }
+ /**
+ * Ralative path to a HTML file displayed as help.
+ */
+ virtual std::wstring get_help_filename() const
+ { return L""; }
+
virtual PreconditionList get_preconditions(MscPtr msc) const;
/**
Modified: trunk/src/check/structure/name_checker.h
===================================================================
--- trunk/src/check/structure/name_checker.h 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/check/structure/name_checker.h 2009-09-26 12:40:09 UTC (rev 379)
@@ -135,6 +135,12 @@
virtual std::wstring get_property_name() const
{ return L"Unique instance names"; }
+ /**
+ * Ralative path to a HTML file displayed as help.
+ */
+ virtual std::wstring get_help_filename() const
+ { return L""; }
+
virtual PreconditionList get_preconditions(MscPtr msc) const;
/**
Modified: trunk/src/check/time/constrain_check.h
===================================================================
--- trunk/src/check/time/constrain_check.h 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/check/time/constrain_check.h 2009-09-26 12:40:09 UTC (rev 379)
@@ -130,6 +130,12 @@
return L"Time Constraints";
}
+ /**
+ * Ralative path to a HTML file displayed as help.
+ */
+ virtual std::wstring get_help_filename() const
+ { return L""; }
+
virtual Checker::PreconditionList get_preconditions(MscPtr msc) const;
/**
Modified: trunk/src/data/checker.h
===================================================================
--- trunk/src/data/checker.h 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/data/checker.h 2009-09-26 12:40:09 UTC (rev 379)
@@ -50,6 +50,11 @@
*/
virtual std::wstring get_property_name() const = 0;
+ /**
+ * Ralative path to a HTML file displayed as help.
+ */
+ virtual std::wstring get_help_filename() const = 0;
+
//! List of properties that must be satisfied before executing the check.
typedef std::vector<PrerequisiteCheck> PreconditionList;
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/view/visio/addon/addon.cpp 2009-09-26 12:40:09 UTC (rev 379)
@@ -72,55 +72,6 @@
return VAORC_SUCCESS;
}
-const int _FILE_PATH_SIZE = _MAX_PATH * 4;
-
-_bstr_t GetVisioModulePath()
-{
- TCHAR szPath[_FILE_PATH_SIZE];
- TCHAR szDrive[_MAX_PATH];
- TCHAR szDir[_FILE_PATH_SIZE];
- TCHAR szFileName[_MAX_PATH];
- TCHAR szExt[_MAX_PATH];
- std::basic_string<TCHAR> strDir;
- std::basic_string<TCHAR>::size_type uiPosition;
-
- // Get the full path including the Addon name.
- GetModuleFileName(GetModuleHandle(LoadStringResource(IDS_VSL_NAME).c_str()),
- szPath, sizeof(szPath) / sizeof(TCHAR));
-
- // Extract the path name of the Addon.
- if (szPath)
- {
- _tsplitpath(szPath, szDrive, szDir, szFileName, szExt);
- strDir = szDrive;
- strDir += szDir;
-
- // Extract the source path from the path name, since the path name
- // that was extracted will be for the Debug or Release version,
- // based on the project settings.
- uiPosition = strDir.rfind('\\');
-
- // If this is the last character in the string,
- // then find the next ('\\').
- if ((uiPosition != -1) && (uiPosition == strDir.size() - 1))
- {
- uiPosition = strDir.rfind('\\', uiPosition - 1);
- }
-
- // If it was the last character, then the position will be
- // next found ('\\'). If it was not the last character,
- // then this is the end of the actual Add-on path.
- if (uiPosition != -1)
- {
- // Include the last ('\\') in the path.
- strDir.resize(uiPosition + 1);
- }
-
- } // end szPath
-
- return _bstr_t(strDir.c_str());
-}
-
VAORC CStudioAddon::Run(LPVAOV2LSTRUCT pV2L)
{
TRACE("CStudioAddon::Run() called");
Modified: trunk/src/view/visio/addon/dllmodule.cpp
===================================================================
--- trunk/src/view/visio/addon/dllmodule.cpp 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/view/visio/addon/dllmodule.cpp 2009-09-26 12:40:09 UTC (rev 379)
@@ -77,6 +77,33 @@
return csRet;
}
+static const int _FILE_PATH_SIZE = _MAX_PATH * 4;
+
+std::basic_string<TCHAR> GetVisioModulePath()
+{
+ TCHAR szPath[_FILE_PATH_SIZE];
+ TCHAR szDrive[_MAX_PATH];
+ TCHAR szDir[_FILE_PATH_SIZE];
+ TCHAR szFileName[_MAX_PATH];
+ TCHAR szExt[_MAX_PATH];
+ std::basic_string<TCHAR> strDir;
+ std::basic_string<TCHAR>::size_type uiPosition;
+
+ // get the full path including the Addon name
+ GetModuleFileName(GetModuleHandle(LoadStringResource(IDS_VSL_NAME).c_str()),
+ szPath, sizeof(szPath) / sizeof(TCHAR));
+
+ // extract the path name of the Addon
+ if (szPath)
+ {
+ _tsplitpath(szPath, szDrive, szDir, szFileName, szExt);
+ strDir = szDrive;
+ strDir += szDir;
+ }
+
+ return strDir;
+}
+
class RegistryValueNotFound
{ };
Modified: trunk/src/view/visio/addon/dllmodule.h
===================================================================
--- trunk/src/view/visio/addon/dllmodule.h 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/view/visio/addon/dllmodule.h 2009-09-26 12:40:09 UTC (rev 379)
@@ -23,6 +23,7 @@
std::wstring LoadStringResource(UINT uiID);
std::wstring GetVersionInfo(const LPWSTR block);
+std::basic_string<TCHAR> GetVisioModulePath();
DWORD GetRegistryDWORD(const TCHAR* subkey, const TCHAR* parameter, DWORD default_value);
int SetRegistryDWORD(HKEY key, const TCHAR* subkey, const TCHAR* parameter, DWORD value);
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/view/visio/addon/dllmodule.rc 2009-09-26 12:40:09 UTC (rev 379)
@@ -171,7 +171,7 @@
BEGIN
IDS_ADDON_NAME "Sequence Chart Studio"
IDS_ERROR_VISIO_VERSION "This application requires Microsoft Office Visio 2003 or later."
- IDS_VSL_NAME "msc.vsl"
+ IDS_VSL_NAME "scstudio.vsl"
IDS_REPORT_VIEW "Verification Report"
END
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/view/visio/addon/document.cpp 2009-09-26 12:40:09 UTC (rev 379)
@@ -38,6 +38,8 @@
#include <boost/graph/breadth_first_search.hpp>
#include <boost/graph/topological_sort.hpp>
+#include <htmlhelp.h>
+
Visio::IVPagePtr GetOrCreatePage(Visio::IVPagesPtr pages, const TCHAR* name)
{
Visio::IVPagePtr page;
@@ -654,7 +656,8 @@
if(!all_preconditions)
{
m_reportView->Print(RS_WARNING, stringize() << vsoPage->Name << ": "
- << msc_checker->get_property_name() << " skipped. Required prerequisites not satisfied.");
+ << msc_checker->get_property_name()
+ << " skipped. Required prerequisites not satisfied.", msc_checker->get_help_filename());
if(boost::get(max_priority_map, *cpos) == PrerequisiteCheck::PP_REQUIRED)
error_count++;
@@ -674,7 +677,8 @@
if(!all_preconditions)
{
m_reportView->Print(RS_WARNING, stringize() << vsoPage->Name << ": "
- << msc_checker->get_property_name() << " skipped. Required prerequisites not satisfied.");
+ << msc_checker->get_property_name()
+ << " skipped. Required prerequisites not satisfied.", msc_checker->get_help_filename());
if(boost::get(max_priority_map, *cpos) == PrerequisiteCheck::PP_REQUIRED)
error_count++;
@@ -704,7 +708,8 @@
if(boost::get(max_priority_map, *cpos) == PrerequisiteCheck::PP_REQUIRED)
{
m_reportView->Print(RS_ERROR, stringize() << vsoPage->Name << ": "
- << msc_checker->get_property_name() << " violated.", result);
+ << msc_checker->get_property_name()
+ << " violated.", result, msc_checker->get_help_filename());
error_count++;
}
@@ -713,7 +718,8 @@
&& output_level >= OL_WARNING)
{
m_reportView->Print(RS_WARNING, stringize() << vsoPage->Name << ": "
- << msc_checker->get_property_name() << " violated.", result);
+ << msc_checker->get_property_name()
+ << " violated.", result, msc_checker->get_help_filename());
}
}
else
@@ -728,7 +734,8 @@
&& output_level >= OL_NOTIFY)
{
m_reportView->Print(RS_NOTICE, stringize() << vsoPage->Name << ": "
- << msc_checker->get_property_name() << " satisfied.");
+ << msc_checker->get_property_name()
+ << " satisfied.", msc_checker->get_help_filename());
}
}
@@ -1225,6 +1232,16 @@
return 0;
}
+int CDocumentMonitor::InvokeHelp(const std::wstring& filename)
+{
+ std::basic_string<TCHAR> path = GetVisioModulePath();
+ path += _T("scstudio.chm::/");
+ path += filename;
+
+ m_vsoApp->InvokeHelp(path.c_str(), HH_DISPLAY_TOPIC, 1);
+ return 0;
+}
+
Visio::IVShapePtr CDocumentMonitor::FindShape(const _bstr_t& id)
{
for(int i = 1; i <= m_vsoDocument->Pages->Count; i++)
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/view/visio/addon/document.h 2009-09-26 12:40:09 UTC (rev 379)
@@ -57,6 +57,7 @@
void ExportActiveDocument(const ExportFormatterPtr& formatter, std::ostream& stream);
int DisplayDocument(const MscPtr& msc);
+ int InvokeHelp(const std::wstring& filename);
Visio::IVShapePtr FindShape(const _bstr_t& id);
int SelectShapes(const std::vector<_bstr_t>& ids);
Modified: trunk/src/view/visio/addon/reportview.cpp
===================================================================
--- trunk/src/view/visio/addon/reportview.cpp 2009-09-25 20:45:29 UTC (rev 378)
+++ trunk/src/view/visio/addon/reportview.cpp 2009-09-26 12:40:09 UTC (rev 379)
@@ -47,9 +47,20 @@
int line = LineFromChar(ch);
TRACE("CRichList::OnLButtonDblClk() called at line " << line);
- return m_reporter->OnLineDblClk(line);
+ return m_reporter->OnLineShow(line);
}
+LRESULT CRichList::OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+ LONG ch1, ch2;
+ // get caret position
+ GetSel(ch1, ch2);
+ int line = LineFromChar((ch1+ch2)/2);
+
+ TRACE("CRichList::OnHelp() called at line " << line);
+ return m_reporter->OnLineHelp(line);
+}
+
CReportView::CReportView(CDocumentMonitor *monitor)
: m_edit(this)
{
@@ -116,8 +127,19 @@
std::wstring m_text;
};
-int CReportView::__Print(TReportSeverity severity, const std::wstring& message, int hasLink)
+void SetSelection(CRichList& edit, const std::pair<int,int>& pos)
{
+ edit.SetSel(pos.first, pos.second);
+ CHARFORMAT2 cf;
+ cf.cbSize = sizeof(cf);
+ cf.dwMask = CFM_LINK;
+ cf.dwEffects = CFE_LINK;
+ edit.SetSelectionCharFormat(cf);
+}
+
+int CReportView::__Print(Reference& reference,
+ TReportSeverity severity, const std::wstring& message)
+{
// display the report view
m_documentMonitor->ShowReportView();
@@ -154,8 +176,14 @@
break;
}
- if(hasLink)
+ // determine what hyperlinks to display
+ bool hasShow = !reference.shapes.empty() || reference.drawing...
[truncated message content] |
|
From: <got...@us...> - 2009-09-26 14:45:50
|
Revision: 380
http://scstudio.svn.sourceforge.net/scstudio/?rev=380&view=rev
Author: gotthardp
Date: 2009-09-26 14:27:43 +0000 (Sat, 26 Sep 2009)
Log Message:
-----------
Bugfix: CRT locale was not synchronized with Windows locale. This caused error when exporting MSC to a directory with locale characters.
Modified Paths:
--------------
trunk/doc/help/algorithms.html
trunk/src/view/visio/addon/dllmodule.cpp
Modified: trunk/doc/help/algorithms.html
===================================================================
--- trunk/doc/help/algorithms.html 2009-09-26 12:40:09 UTC (rev 379)
+++ trunk/doc/help/algorithms.html 2009-09-26 14:27:43 UTC (rev 380)
@@ -8,7 +8,7 @@
<ul>
<li><a href="acyclic/acyclic.html">Acyclic property</a></li>
<li><a href="fifo/fifo.html">FIFO property</a></li>
-<li><a href="localChoice/localchoice.html">Nonlocal Choice</a></li>
+<li><a href="localchoice/localchoice.html">Nonlocal Choice</a></li>
<li><a href="membership/membership_documentation.html">Membership</a></li>
</ul>
</body>
Modified: trunk/src/view/visio/addon/dllmodule.cpp
===================================================================
--- trunk/src/view/visio/addon/dllmodule.cpp 2009-09-26 12:40:09 UTC (rev 379)
+++ trunk/src/view/visio/addon/dllmodule.cpp 2009-09-26 14:27:43 UTC (rev 380)
@@ -87,7 +87,6 @@
TCHAR szFileName[_MAX_PATH];
TCHAR szExt[_MAX_PATH];
std::basic_string<TCHAR> strDir;
- std::basic_string<TCHAR>::size_type uiPosition;
// get the full path including the Addon name
GetModuleFileName(GetModuleHandle(LoadStringResource(IDS_VSL_NAME).c_str()),
@@ -104,6 +103,40 @@
return strDir;
}
+// Creates a locale string acceptable for setlocale
+// see http://www.codeproject.com/KB/locale/CRTSynch.aspx
+// public domain, written by Chris Grimes
+LPCTSTR loadLocaleId(LCID lcid, _bstr_t& bstrRetBuf)
+{
+ TCHAR arcBuf[128];
+ memset(arcBuf, 0, sizeof(arcBuf));
+
+ // loading the English name fo the locale
+ GetLocaleInfo( lcid, LOCALE_SENGLANGUAGE, arcBuf, 127);
+ bstrRetBuf = arcBuf;
+ memset(arcBuf, 0, sizeof(arcBuf));
+
+ // loading the English name for the country/region
+ GetLocaleInfo( lcid, LOCALE_SENGCOUNTRY, arcBuf, 127);
+ if( *arcBuf )
+ {
+ bstrRetBuf += TEXT("_");
+ bstrRetBuf += arcBuf;
+ }
+
+ // loading the code page
+ memset(arcBuf, 0, sizeof(arcBuf));
+ if( (GetLocaleInfo( lcid, LOCALE_IDEFAULTANSICODEPAGE, arcBuf, 127)
+ || GetLocaleInfo( lcid, LOCALE_IDEFAULTCODEPAGE, arcBuf, 127))
+ && *arcBuf )
+ {
+ bstrRetBuf += TEXT(".");
+ bstrRetBuf += arcBuf;
+ }
+
+ return bstrRetBuf;
+}
+
class RegistryValueNotFound
{ };
@@ -185,6 +218,15 @@
//! DLL Entry Point
extern "C" BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID lpReserved)
{
+ // early initialization of our subsystems
+ if (dwReason == DLL_PROCESS_ATTACH)
+ {
+ _bstr_t localeName;
+ loadLocaleId(GetThreadLocale(), localeName);
+ // keep the C-runtime (CRT) in synch with the Windows API locale locale
+ setlocale(LC_ALL, localeName);
+ }
+
return _AtlModule.DllMain(dwReason, lpReserved);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2009-09-27 20:58:20
|
Revision: 381
http://scstudio.svn.sourceforge.net/scstudio/?rev=381&view=rev
Author: gotthardp
Date: 2009-09-27 20:58:04 +0000 (Sun, 27 Sep 2009)
Log Message:
-----------
Preparation for new beautifier: Added new dfs_events_traverser listeners to listen for MSC graph edges. Added FindLpSolve.cmake to search for lp_solve library.
Modified Paths:
--------------
trunk/src/data/dfs_events_traverser.cpp
trunk/src/data/dfs_events_traverser.h
Added Paths:
-----------
trunk/FindLpSolve.cmake
Added: trunk/FindLpSolve.cmake
===================================================================
--- trunk/FindLpSolve.cmake (rev 0)
+++ trunk/FindLpSolve.cmake 2009-09-27 20:58:04 UTC (rev 381)
@@ -0,0 +1,20 @@
+# set the default LPSOLVE_ROOT value
+IF(NOT LPSOLVE_ROOT)
+ SET(LPSOLVE_ROOT $ENV{LPSOLVE_ROOT} CACHE PATH "The LPSOLVE directory root.")
+ENDIF(NOT LPSOLVE_ROOT)
+
+FIND_LIBRARY(LPSOLVE_LIBRARY
+ NAMES lpsolve55
+ PATHS
+ ${LPSOLVE_ROOT}
+ DOC "The lp_solve library")
+
+FIND_PATH(LPSOLVE_INCLUDE_DIR
+ NAMES lpsolve/lp_lib.h
+ PATHS
+ ${LPSOLVE_ROOT}
+ DOC "The lp_solve include files")
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(lp_solve DEFAULT_MSG
+ LPSOLVE_LIBRARY LPSOLVE_INCLUDE_DIR)
Property changes on: trunk/FindLpSolve.cmake
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/data/dfs_events_traverser.cpp
===================================================================
--- trunk/src/data/dfs_events_traverser.cpp 2009-09-26 14:27:43 UTC (rev 380)
+++ trunk/src/data/dfs_events_traverser.cpp 2009-09-27 20:58:04 UTC (rev 381)
@@ -74,9 +74,13 @@
{
traverse_matching_event(event);
if(event->get_successor().get())
+ {
+ event_successor(event, event->get_successor().get());
traverse_strict_event(event->get_successor().get());
+ }
else
traverse_area(event->get_area()->get_next().get());
+
event_finished(event);
}
}
@@ -94,12 +98,14 @@
for(successor=successors.begin(); successor!=successors.end(); successor++)
{
m_reached_elements.push_back((*successor).get());
+ event_successor(event, (*successor)->get_successor());
traverse_coregion_event((*successor)->get_successor());
m_reached_elements.pop_back();
}
}
else
traverse_area(event->get_area()->get_next().get());
+
event_finished(event);
}
}
@@ -109,6 +115,8 @@
if(event->is_send() && event->get_matching_event())
{
m_reached_elements.push_back(event->get_message().get());
+ send_receive_pair(event, event->get_matching_event());
+
StrictEvent* strict = dynamic_cast<StrictEvent*>(event->get_matching_event());
if(strict)
{
@@ -119,6 +127,7 @@
CoregionEvent* e = dynamic_cast<CoregionEvent*>(event->get_matching_event());
traverse_coregion_event(e);
}
+
m_reached_elements.pop_back();
}
}
@@ -182,6 +191,20 @@
m_reached_elements.pop_back();
}
+void DFSEventsTraverser::event_successor(Event* event, Event* successor)
+{
+ EventSuccessorListenerPList::iterator l;
+ for(l=event_successor_listeners.begin();l!=event_successor_listeners.end();l++)
+ (*l)->on_event_successor(event, successor);
+}
+
+void DFSEventsTraverser::send_receive_pair(Event* send, Event* receive)
+{
+ SendReceivePairListenerPList::iterator l;
+ for(l=send_receive_pair_listeners.begin();l!=send_receive_pair_listeners.end();l++)
+ (*l)->on_send_receive_pair(send, receive);
+}
+
EventPListPtr DFSEventsTraverser::topology_order(BMscPtr b)
{
EventPListPtr topology(new EventPList);
@@ -217,12 +240,24 @@
event_finished_listeners.clear();
}
+void DFSEventsTraverser::remove_event_successor_listeners()
+{
+ event_successor_listeners.clear();
+}
+
+void DFSEventsTraverser::remove_send_receive_pair_listeners()
+{
+ send_receive_pair_listeners.clear();
+}
+
void DFSEventsTraverser::remove_all_listeners()
{
remove_white_event_found_listeners();
remove_gray_event_found_listeners();
remove_black_event_found_listeners();
remove_event_finished_listeners();
+ remove_event_successor_listeners();
+ remove_send_receive_pair_listeners();
}
// $Id$
Modified: trunk/src/data/dfs_events_traverser.h
===================================================================
--- trunk/src/data/dfs_events_traverser.h 2009-09-26 14:27:43 UTC (rev 380)
+++ trunk/src/data/dfs_events_traverser.h 2009-09-27 20:58:04 UTC (rev 381)
@@ -27,7 +27,7 @@
typedef std::list<MscElement*> MscElementPList;
/**
- * Listener of founded white Event
+ * Listener of detected white Event
*/
class SCMSC_EXPORT WhiteEventFoundListener
{
@@ -42,7 +42,7 @@
};
/**
- * Listener of founded white Event
+ * Listener of detected white Event
*/
class SCMSC_EXPORT GrayEventFoundListener
{
@@ -57,7 +57,7 @@
};
/**
- * Listener of founded black Event
+ * Listener of detected black Event
*/
class SCMSC_EXPORT BlackEventFoundListener
{
@@ -86,10 +86,42 @@
virtual void on_event_finished(Event* event)=0;
};
+/**
+ * Listener for event successor relations.
+ */
+class SCMSC_EXPORT EventSuccessorListener
+{
+public:
+
+ virtual ~EventSuccessorListener()
+ {
+
+ }
+
+ virtual void on_event_successor(Event* event, Event* successor)=0;
+};
+
+/**
+ * Listener for sender-receiver relations.
+ */
+class SCMSC_EXPORT SendReceivePairListener
+{
+public:
+
+ virtual ~SendReceivePairListener()
+ {
+
+ }
+
+ virtual void on_send_receive_pair(Event* send, Event* receive)=0;
+};
+
typedef std::list<EventFinishedListener*> EventFinishedListenerPList;
typedef std::list<WhiteEventFoundListener*> WhiteEventFoundListenerPList;
typedef std::list<GrayEventFoundListener*> GrayEventFoundListenerPList;
typedef std::list<BlackEventFoundListener*> BlackEventFoundListenerPList;
+typedef std::list<EventSuccessorListener*> EventSuccessorListenerPList;
+typedef std::list<SendReceivePairListener*> SendReceivePairListenerPList;
/**
* Processes Events during traversing BMsc's Events in depth first search manner.
@@ -144,7 +176,7 @@
}
/**
- * Adds EventFoundListener
+ * Adds BlackEventFoundListener
*/
void add_black_event_found_listener(BlackEventFoundListener* l)
{
@@ -152,6 +184,22 @@
}
/**
+ * Adds EventSuccessorListener
+ */
+ void add_event_successor_listener(EventSuccessorListener* l)
+ {
+ event_successor_listeners.push_back(l);
+ }
+
+ /**
+ * Adds SendReceivePairListenerPList
+ */
+ void add_send_receive_pair_listener(SendReceivePairListener* l)
+ {
+ send_receive_pair_listeners.push_back(l);
+ }
+
+ /**
* Cleans up set attributes.
*/
virtual void cleanup_traversing_attributes();
@@ -167,6 +215,8 @@
void remove_gray_event_found_listeners();
void remove_black_event_found_listeners();
void remove_event_finished_listeners();
+ void remove_event_successor_listeners();
+ void remove_send_receive_pair_listeners();
void remove_all_listeners();
protected:
@@ -187,26 +237,12 @@
* Holds listeners
*/
EventFinishedListenerPList event_finished_listeners;
-
- /**
- * Holds listeners
- */
WhiteEventFoundListenerPList white_event_found_listeners;
-
- /**
- * Holds listeners
- */
GrayEventFoundListenerPList gray_event_found_listeners;
-
- /**
- * Holds listeners
- */
BlackEventFoundListenerPList black_event_found_listeners;
-
- /**
- * Holds listeners
- */
GrayEventFoundListenerPList grey_event_found_listeners;
+ EventSuccessorListenerPList event_successor_listeners;
+ SendReceivePairListenerPList send_receive_pair_listeners;
virtual void traverse_area(EventArea* area);
@@ -239,6 +275,16 @@
void event_finished(Event* e);
/**
+ * Called when a relation event-->successor is found.
+ */
+ void event_successor(Event* event, Event* successor);
+
+ /**
+ * Called when a message send-->receive is found.
+ */
+ void send_receive_pair(Event* send, Event* receive);
+
+ /**
* Sets color attribute of e to c value .
*/
void set_color(Event* e, NodeColor c)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2009-09-28 13:18:53
|
Revision: 384
http://scstudio.svn.sourceforge.net/scstudio/?rev=384&view=rev
Author: gotthardp
Date: 2009-09-28 13:18:35 +0000 (Mon, 28 Sep 2009)
Log Message:
-----------
New feature: implemented experimental LayoutOptimizer based on linear programming (lp_solve library).
Modified Paths:
--------------
trunk/FindLpSolve.cmake
trunk/src/data/CMakeLists.txt
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/scstudio.nsi
Added Paths:
-----------
trunk/src/data/layout_optimizer.cpp
trunk/src/data/layout_optimizer.h
Modified: trunk/FindLpSolve.cmake
===================================================================
--- trunk/FindLpSolve.cmake 2009-09-28 12:22:49 UTC (rev 383)
+++ trunk/FindLpSolve.cmake 2009-09-28 13:18:35 UTC (rev 384)
@@ -10,9 +10,10 @@
DOC "The lp_solve library")
FIND_PATH(LPSOLVE_INCLUDE_DIR
- NAMES lpsolve/lp_lib.h
+ NAMES lp_lib.h
PATHS
${LPSOLVE_ROOT}
+ ${LPSOLVE_ROOT}/lpsolve
DOC "The lp_solve include files")
INCLUDE(FindPackageHandleStandardArgs)
Modified: trunk/src/data/CMakeLists.txt
===================================================================
--- trunk/src/data/CMakeLists.txt 2009-09-28 12:22:49 UTC (rev 383)
+++ trunk/src/data/CMakeLists.txt 2009-09-28 13:18:35 UTC (rev 384)
@@ -1,3 +1,17 @@
+OPTION(BUILD_OPTIMIZER "Enable to build the layout optimizer" OFF)
+IF(BUILD_OPTIMIZER)
+ FIND_PACKAGE(LpSolve REQUIRED)
+ INCLUDE_DIRECTORIES(${LPSOLVE_INCLUDE_DIR})
+
+ SET(OPTIMIZER_SOURCES
+ layout_optimizer.cpp
+ layout_optimizer.h
+ )
+ SET(OPTIMIZER_LIBRARIES
+ ${LPSOLVE_LIBRARY}
+ )
+ENDIF(BUILD_OPTIMIZER)
+
ADD_LIBRARY(scmsc SHARED
export.h
msc_types.cpp
@@ -32,11 +46,12 @@
hmsc_reference_checker.h
beautify.h
beautify.cpp
+ ${OPTIMIZER_SOURCES}
)
-#TARGET_LINK_LIBRARIES(scmsc
-# sctime
-#)
+TARGET_LINK_LIBRARIES(scmsc
+ ${OPTIMIZER_LIBRARIES}
+)
# build import-export formatters
ADD_SUBDIRECTORY(engmann)
Added: trunk/src/data/layout_optimizer.cpp
===================================================================
--- trunk/src/data/layout_optimizer.cpp (rev 0)
+++ trunk/src/data/layout_optimizer.cpp 2009-09-28 13:18:35 UTC (rev 384)
@@ -0,0 +1,272 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2009 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#include <lp_lib.h>
+
+#include "data/dfs_events_traverser.h"
+#include "data/layout_optimizer.h"
+#include "check/pseudocode/utils.h"
+
+static lprec* initialize_solver(int events_size)
+{
+ lprec *lp = make_lp(0, events_size);
+ if(lp == NULL)
+ throw std::bad_alloc();
+
+ // turn off verbose mode
+ set_verbose(lp, NEUTRAL);
+
+ // set the objective to minimize
+ set_minim(lp);
+
+ REAL* row = new REAL[events_size+1];
+ // formulate the problem
+ // note: element 0 of the array is not considered (i.e. ignored)
+ for (int i = 1; i <= events_size; i++)
+ row[i] = 0;
+ // set the objective function: sum of e[i]
+ set_obj_fn(lp, row);
+ delete[] row;
+
+ return lp;
+}
+
+// add constraint ex < ey, i.e. ex-->ey >= d
+static int add_relative_distance_constraint(lprec *lp, int ex, int ey, REAL d)
+{
+ int columns = get_Ncolumns(lp);
+ // we add new row: turn row entry mode on
+ set_add_rowmode(lp, TRUE);
+
+ REAL* row = new REAL[columns+1];
+ // initialize the vector
+ // note: element 0 of the array is not considered (i.e. ignored)
+ for (int i = 1; i <= columns; i++)
+ row[i] = 0;
+ // add the constraint: -e[x] + e[y] >= d
+ row[ex] = -1;
+ row[ey] = 1;
+ add_constraint(lp, row, GE, d);
+
+ delete[] row;
+ return 0;
+}
+
+// append new variable, i.e. new column to the matrix
+static int add_binary_variable(lprec *lp)
+{
+ int rows = get_Nrows(lp);
+ // we add new column: turn row entry mode off
+ set_add_rowmode(lp, FALSE);
+
+ REAL* column = new REAL[rows+1];
+ // initialize the vector
+ // note: element 0 of the array represents the objective value
+ for (int i = 0; i <= rows; i++)
+ column[i] = 0;
+
+ add_column(lp, column);
+ delete[] column;
+
+ // the new column is added to the model at the end
+ // current number of columns thus represents index of the new variable
+ int idx = get_Ncolumns(lp);
+
+ set_binary(lp, idx, TRUE);
+ return idx;
+}
+
+// constraint ex < ey or ex > ey, i.e. |ex<-->ey| >= d
+// see http://www.nabble.com/Absolute-value-constraint-td14841621.html
+static int add_absolute_distance_constraint(lprec *lp, int ex, int ey, REAL d)
+{
+ static const REAL max_distance = 1000; // [millimeters]
+ int z = add_binary_variable(lp);
+
+ int columns = get_Ncolumns(lp);
+ // we add new rows: turn row entry mode on
+ set_add_rowmode(lp, TRUE);
+
+ REAL* row = new REAL[columns+1];
+ // initialize the vector
+ // note: element 0 of the array is not considered (i.e. ignored)
+ for (int i = 1; i <= columns; i++)
+ row[i] = 0;
+ // set the constraint: e[x] - e[y] + z*(M+d)
+ row[ex] = 1;
+ row[ey] = -1;
+ row[z] = max_distance+d;
+ // add constraint: e[x] - e[y] + z*(M+d) <= M
+ add_constraint(lp, row, LE, max_distance);
+ // add constraint: e[x] - e[y] + z*(M+d) >= d
+ add_constraint(lp, row, GE, d);
+
+ delete[] row;
+ return 0;
+}
+
+typedef std::map<EventPtr, int> EventPtrMap;
+
+class EventIndexer: public WhiteEventFoundListener
+{
+public:
+ virtual void on_white_event_found(Event* e)
+ {
+ int index = m_events.size()+1;
+ m_events.insert(std::make_pair(e, index));
+ }
+
+ size_t get_event_count() const
+ {
+ return m_events.size();
+ }
+
+ int get_event_index(EventPtr e) const
+ {
+ EventPtrMap::const_iterator pos = m_events.find(e);
+ if(pos == m_events.end())
+ throw std::range_error("Unknown event");
+
+ return pos->second;
+ }
+
+ const EventPtrMap& get_events() const
+ {
+ return m_events;
+ }
+
+private:
+ EventPtrMap m_events;
+};
+
+class EventConstraintCreator: public EventSuccessorListener, public SendReceivePairListener
+{
+public:
+ EventConstraintCreator(lprec *lp, const EventIndexer& indexer) :
+ m_lp(lp), m_indexer(indexer) {}
+
+ float m_successor_distance;
+ float m_send_receive_distance;
+
+ virtual void on_event_successor(Event* event, Event* successor)
+ {
+ int e1, e2;
+ if(successor->get_attribute<NodeColor>("cc_color",WHITE) == GRAY)
+ {
+ // cycle detected: reverse direction
+ e1 = m_indexer.get_event_index(successor);
+ e2 = m_indexer.get_event_index(event);
+ }
+ else
+ {
+ e1 = m_indexer.get_event_index(event);
+ e2 = m_indexer.get_event_index(successor);
+ }
+
+ add_relative_distance_constraint(m_lp, e1, e2, m_successor_distance);
+ }
+
+ virtual void on_send_receive_pair(Event* send, Event* receive)
+ {
+ int e1, e2;
+ if(receive->get_attribute<NodeColor>("cc_color",WHITE) == GRAY)
+ {
+ // cycle detected: reverse direction
+ e1 = m_indexer.get_event_index(receive);
+ e2 = m_indexer.get_event_index(send);
+ }
+ else
+ {
+ e1 = m_indexer.get_event_index(send);
+ e2 = m_indexer.get_event_index(receive);
+ }
+
+ add_relative_distance_constraint(m_lp, e1, e2, m_send_receive_distance);
+ // update the objective function for matched events:
+ // minimize length and y-coordinate, i.e. 2*y(receive) - y(send)
+ set_obj(m_lp, e1, -1.0);
+ set_obj(m_lp, e2, 2.0);
+ }
+
+private:
+ lprec *m_lp;
+ const EventIndexer& m_indexer;
+};
+
+LayoutOptimizer::LayoutOptimizer()
+{
+ m_instance_head_distance = 5.0f;
+ m_successor_distance = 5.0f;
+ m_send_receive_distance = 0.0f;
+}
+
+int LayoutOptimizer::process(MscPtr msc)
+{
+ BMscPtr bmsc = boost::dynamic_pointer_cast<BMsc>(msc);
+ if(bmsc)
+ return beautify(bmsc);
+
+ return 0; // not processed
+}
+
+int LayoutOptimizer::beautify(BMscPtr bmsc)
+{
+ EventIndexer indexer;
+ DFSEventsTraverser indexing_traverser;
+ indexing_traverser.add_white_event_found_listener(&indexer);
+ indexing_traverser.traverse(bmsc.get());
+
+ lprec *lp = initialize_solver(indexer.get_event_count());
+
+ InstancePtrList::const_iterator it;
+ EventConstraintCreator constraint_creator(lp, indexer);
+ constraint_creator.m_successor_distance = m_successor_distance;
+ constraint_creator.m_send_receive_distance = m_send_receive_distance;
+
+ DFSEventsTraverser traverser("cc_color");
+ traverser.add_event_successor_listener(&constraint_creator);
+ traverser.add_send_receive_pair_listener(&constraint_creator);
+ // create the constraints
+ traverser.traverse(bmsc.get());
+
+ // (2) solve the problem
+ // before solving the problem we have to turn the row entry mode off
+ // note: don't call other API functions while in row entry mode
+ set_add_rowmode(lp, FALSE);
+
+ if(solve(lp) != 0)
+ return 0; // no solution found
+
+ int columns = get_Ncolumns(lp);
+ // process the results
+ REAL* var = new REAL[columns];
+ get_variables(lp, var);
+
+ for(EventPtrMap::const_iterator epos = indexer.get_events().begin();
+ epos != indexer.get_events().end(); epos++)
+ {
+ // note: var element 0 contains the first variable, etc.
+ epos->first->set_position(MscPoint(0, m_instance_head_distance+var[epos->second-1]));
+ }
+ delete[] var;
+
+ delete_lp(lp);
+ return 1; // success
+}
+
+// $Id$
Property changes on: trunk/src/data/layout_optimizer.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/data/layout_optimizer.h
===================================================================
--- trunk/src/data/layout_optimizer.h (rev 0)
+++ trunk/src/data/layout_optimizer.h 2009-09-28 13:18:35 UTC (rev 384)
@@ -0,0 +1,36 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2009 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#include "data/msc.h"
+#include "data/export.h"
+
+class SCMSC_EXPORT LayoutOptimizer
+{
+public:
+ LayoutOptimizer();
+ int process(MscPtr msc);
+
+ float m_instance_head_distance;
+ float m_successor_distance;
+ float m_send_receive_distance;
+
+protected:
+ int beautify(BMscPtr bmsc);
+};
+
+// $Id$
Property changes on: trunk/src/data/layout_optimizer.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2009-09-28 12:22:49 UTC (rev 383)
+++ trunk/src/view/visio/addon/dllmodule.rc 2009-09-28 13:18:35 UTC (rev 384)
@@ -89,8 +89,8 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,3,11,0
- PRODUCTVERSION 0,3,11,0
+ FILEVERSION 0,3,13,0
+ PRODUCTVERSION 0,3,13,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x9L
@@ -107,13 +107,13 @@
BEGIN
VALUE "CompanyName", "Masaryk University Brno"
VALUE "FileDescription", "Microsoft Visio add-on for design and verification of Message Sequence Charts (MSC)."
- VALUE "FileVersion", "0.3.11"
+ VALUE "FileVersion", "0.3.13"
VALUE "InternalName", "scstudio.vsl"
VALUE "LegalCopyright", "(c) Petr Gotthard. All rights reserved."
VALUE "OriginalFilename", "scstudio.vsl"
VALUE "PrivateBuild", "$Revision$"
VALUE "ProductName", "Sequence Chart Studio"
- VALUE "ProductVersion", "0.3.11"
+ VALUE "ProductVersion", "0.3.13"
END
END
BLOCK "VarFileInfo"
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2009-09-28 12:22:49 UTC (rev 383)
+++ trunk/src/view/visio/addon/document.cpp 2009-09-28 13:18:35 UTC (rev 384)
@@ -27,7 +27,7 @@
#include <fstream>
#include "data/msc.h"
-#include "data/beautify.h"
+#include "data/layout_optimizer.h"
// Include libraries from the Windows Template Library (WTL).
// http://wtl.sourceforge.net
@@ -1033,9 +1033,20 @@
if(msc == NULL)
return VAORC_FAILURE;
- Beautify beautify;
+ LayoutOptimizer beautify;
+ beautify.m_instance_head_distance =
+ (float)GetRegistryDWORD(SCSTUDIO_REGISTRY_ROOT, _T("InstanceHeadDistance"), 5);
+ beautify.m_successor_distance =
+ (float)GetRegistryDWORD(SCSTUDIO_REGISTRY_ROOT, _T("SuccessorDistance"), 5);
+ beautify.m_send_receive_distance =
+ (float)GetRegistryDWORD(SCSTUDIO_REGISTRY_ROOT, _T("SendReceiveDistance"), 0);
+
// generate graphical layout information
- beautify.process(msc);
+ if(!beautify.process(msc))
+ {
+ m_reportView->Print(RS_WARNING,
+ stringize() << "Optimized layout not found.");
+ }
// delete all MSC symbols, preserve ignored shapes
RemoveKnownSymbols(vsoPage);
@@ -1134,7 +1145,7 @@
}
}
- Beautify beautify;
+ LayoutOptimizer beautify;
// generate graphical layout information
beautify.process(*dpos);
Modified: trunk/src/view/visio/scstudio.nsi
===================================================================
--- trunk/src/view/visio/scstudio.nsi 2009-09-28 12:22:49 UTC (rev 383)
+++ trunk/src/view/visio/scstudio.nsi 2009-09-28 13:18:35 UTC (rev 384)
@@ -21,7 +21,7 @@
; -- General ---------------------------
-!define VERSION "0.3.12"
+!define VERSION "0.3.13"
Name "Sequence Chart Studio"
OutFile "scstudio-setup-${VERSION}.exe"
@@ -99,6 +99,7 @@
File "redistribute\atl71.dll"
File "redistribute\msvcp71.dll"
File "redistribute\msvcr71.dll"
+ File "redistribute\lpsolve55.dll"
File "redistribute\capicom.dll"
ExecWait 'regsvr32.exe /s "$INSTDIR\capicom.dll"'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2009-09-28 17:38:08
|
Revision: 387
http://scstudio.svn.sourceforge.net/scstudio/?rev=387&view=rev
Author: gotthardp
Date: 2009-09-28 17:38:00 +0000 (Mon, 28 Sep 2009)
Log Message:
-----------
Fix output of "inf" time intervals.
Modified Paths:
--------------
trunk/src/data/time.h
Property Changed:
----------------
trunk/src/check/realizability/
trunk/tests/universal_boundedness/
Property changes on: trunk/src/check/realizability
___________________________________________________________________
Added: svn:ignore
+ CMakeFiles
cmake_install.cmake
CTestTestfile.cmake
*.dir
Makefile
*.vcproj
Modified: trunk/src/data/time.h
===================================================================
--- trunk/src/data/time.h 2009-09-28 13:52:36 UTC (rev 386)
+++ trunk/src/data/time.h 2009-09-28 17:38:00 UTC (rev 387)
@@ -31,6 +31,7 @@
#include<cctype>
#include<cstring>
#include<string>
+#include <limits>
#if defined(_MSC_VER)
// Visual C++ does not support functions declared using exception specification.
@@ -513,10 +514,23 @@
return (right>left)?right:left;
}
-
};
// end of MscIntervalCouple class
+template<class P>
+std::ostream&
+operator<<(std::ostream& os, const MscIntervalCouple<P>& value)
+{
+ if(value.get_value() == std::numeric_limits<P>::infinity())
+ os << "inf";
+ else if(value.get_value() == -std::numeric_limits<P>::infinity())
+ os << "-inf";
+ else
+ os << value.get_value();
+
+ return os;
+}
+
/**
* @brief class representing Interval
*/
@@ -629,7 +643,7 @@
throw MscIntervalStringConversionError(this->to_string()+std::string(" is not valid interval."));
}
- MscIntervalCouple<T> get_begin() const
+ const MscIntervalCouple<T>& get_begin() const
{
return m_begin;
}
@@ -928,9 +942,9 @@
os << "(";
os
- << interval.get_begin_value()
+ << interval.get_begin()
<< ","
- << interval.get_end_value();
+ << interval.get_end();
if (interval.get_end_closed())
os << "]";
@@ -941,7 +955,7 @@
{
os
<< "["
- << interval.get_begin_value()
+ << interval.get_begin()
<< "]";
}
Property changes on: trunk/tests/universal_boundedness
___________________________________________________________________
Added: svn:ignore
+ CMakeFiles
cmake_install.cmake
CTestTestfile.cmake
*.dir
Makefile
*.vcproj
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2009-10-02 16:03:30
|
Revision: 392
http://scstudio.svn.sourceforge.net/scstudio/?rev=392&view=rev
Author: madzin
Date: 2009-10-02 16:03:11 +0000 (Fri, 02 Oct 2009)
Log Message:
-----------
Parser is able to work with time intervals.
Modified Paths:
--------------
trunk/src/data/Z120/Context.cpp
trunk/src/data/Z120/Context.h
trunk/src/data/Z120/Context_Impl.h
trunk/src/data/Z120/Z120.g
trunk/tests/z120_test/CMakeLists.txt
trunk/tests/z120_test/z120_test01.mpr.result
trunk/tests/z120_test/z120_test02.mpr.result
trunk/tests/z120_test/z120_time01.mpr
trunk/tests/z120_test/z120_time01.mpr.result
Added Paths:
-----------
trunk/tests/z120_test/z120_time02.mpr
trunk/tests/z120_test/z120_time02.mpr.result
trunk/tests/z120_test/z120_time03.mpr
trunk/tests/z120_test/z120_time03.mpr.result
trunk/tests/z120_test/z120_time04.mpr
trunk/tests/z120_test/z120_time04.mpr.result
trunk/tests/z120_test/z120_time05.mpr
trunk/tests/z120_test/z120_time05.mpr.result
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2009-10-01 20:28:42 UTC (rev 391)
+++ trunk/src/data/Z120/Context.cpp 2009-10-02 16:03:11 UTC (rev 392)
@@ -22,7 +22,7 @@
*/
/*
- * Maximal number of warning/error message is 22
+ * Maximal number of warning/error message is 24
*/
#ifndef __ParserStruct__
@@ -47,6 +47,9 @@
*/
void init(struct Context* context)
{
+ context->interval_label = "";
+ context->time = "";
+
context->myBmsc = new BMsc();
context->myHmsc = new HMsc();
context->myBmsc = NULL;
@@ -54,12 +57,13 @@
context->element_name = "";
context->reference_name = "";
context->condition_name = "";
- context->node_type = 0;
+ context->node_type = connection;
context->event_name = "";
context->coregion_area_finished.clear();
context->instances.clear();
context->messages.clear();
context->future_events.clear();
+ context->future_time_events.clear();
context->named_events.clear();
context->current_event = NULL;
context->not_create_event = 0;
@@ -71,6 +75,9 @@
context->connect_name.clear();
context->hmsc_nodes.clear();
context->future_connections.clear();
+ context->future_bottom_time_relations.clear();
+ context->future_top_time_relations.clear();
+ context->not_connect = 0;
}
/*
@@ -118,6 +125,11 @@
{
context->z->print_report(RS_WARNING, L"Warning 21: Some instance has been finished more times\n");
}
+
+ if(context->future_top_time_relations.size() > 0 || context->future_bottom_time_relations.size() > 0)
+ {
+ context->z->print_report(RS_WARNING, L"Warning 24: Some time information points to non-existed reference node\n");
+ }
s_Msc** result = NULL;
@@ -272,6 +284,12 @@
context->z->print_report(RS_ERROR, TOWSTRING(report));
}
+void add_time_fun(struct Context* context, char* time)
+{
+ context->time = time;
+}
+
+
/*
* Create new BMsc structure
*/
@@ -372,12 +390,10 @@
//if event is named, it adds event to named_events
if(context->event_name != "")
{
- CoregionEventPtr event1 = boost::dynamic_pointer_cast<CoregionEvent>(event);
- if(event1 != NULL){
- context->named_events.insert(std::make_pair(context->event_name, event1));
- }
+ context->named_events.insert(std::make_pair(context->event_name, event));
}
-
+
+ create_future_time_relations(context);
context->event_name = "";
}
@@ -558,12 +574,10 @@
//if event is named, it adds event to named_events
if(context->event_name != "")
{
- CoregionEventPtr event1 = boost::dynamic_pointer_cast<CoregionEvent>(event);
- if(event1 != NULL){
- context->named_events.insert(std::make_pair(context->event_name, event1));
- }
+ context->named_events.insert(std::make_pair(context->event_name, event));
}
-
+
+ create_future_time_relations(context);
context->event_name = "";
}
@@ -580,7 +594,7 @@
}
std::set<std::string>::iterator it;
- std::map<std::string, CoregionEventPtr>::iterator named_event_it;
+ std::map<std::string, EventPtr>::iterator named_event_it;
CoregionEventPtr event = boost::dynamic_pointer_cast<CoregionEvent>(context->current_event);
if(event == NULL){
context->z->print_report(RS_ERROR, L"Internal Error 13: Typecast failed\n");
@@ -588,12 +602,20 @@
}
for(it = context->order_events.begin(); it != context->order_events.end(); ++it){
if((named_event_it = context->named_events.find(*it)) != context->named_events.end()){
- if(kind == before){
- event->add_successor(named_event_it->second.get());
+
+ CoregionEventPtr event1 = boost::dynamic_pointer_cast<CoregionEvent>(named_event_it->second);
+
+ if(event1 != NULL)
+ {
+ if(kind == before)
+ {
+ event->add_successor(event1.get());
+ }
+ else
+ {
+ event1->add_successor(event.get());
+ }
}
- else{
- named_event_it->second->add_successor(event.get());
- }
}
else{
InstancePtr instance = context->instances.find(context->element_name)->second;
@@ -601,6 +623,7 @@
EventPtr event1 = instance->get_last()->add_event();
CoregionEventPtr event2 = boost::dynamic_pointer_cast<CoregionEvent>(event1);
context->future_events.insert(std::make_pair(*it, event2));
+
if(kind == before){
event->add_successor(event2.get());
}
@@ -646,7 +669,59 @@
context->open_instance--;
}
+void add_time_relation_event_fun(struct Context* context)
+{
+ MscTimeIntervalSet<double> interval (context->time);
+ TimeRelationEventPtr relation = new TimeRelationEvent(interval);
+
+ std::map<std::string, EventPtr>::iterator named_events_it = context->named_events.find(context->time_event_name);
+
+ if(named_events_it != context->named_events.end())
+ {
+ relation->glue_events(context->current_event.get(), named_events_it->second.get());
+ }
+ else
+ {
+ relation->glue_event_a(context->current_event.get());
+
+ std::map<std::string, std::set<TimeRelationEventPtr> >::iterator it = context->future_time_events.find(context->time_event_name);
+
+ if(it != context->future_time_events.end())
+ {
+ it->second.insert(relation);
+ }
+ else
+ {
+ std::set<TimeRelationEventPtr> my_set;
+ my_set.insert(relation);
+ context->future_time_events.insert(std::make_pair(context->time_event_name, my_set));
+ }
+ }
+}
+
/*
+ * Set name of event which is in time relation with the event
+ */
+void set_time_reference_event_fun(struct Context* context, char* name)
+{
+ context->time_event_name = name;
+}
+
+void create_future_time_relations(struct Context* context)
+{
+ std::map<std::string, std::set<TimeRelationEventPtr> >::iterator it = context->future_time_events.find(context->event_name);
+ std::set<TimeRelationEventPtr>::iterator set_it;
+
+ if(it != context->future_time_events.end())
+ {
+ for(set_it = it->second.begin(); set_it != it->second.end(); ++set_it)
+ {
+ (*set_it)->glue_event_b(context->current_event.get());
+ }
+ }
+}
+
+/*
* FUNCTIONS FOR HMSC
*/
@@ -674,17 +749,10 @@
*/
void new_end_node_fun(struct Context* context)
{
-// if (context->connect_name.size() == 0)
-// {
EndNodePtr node = new EndNode();
context->myHmsc->add_node(node);
context->end_node = std::make_pair(context->element_name, node);
create_future_connections_fun(context, node.get());
-// }
-// else
-// {
-// context->z->print_report(RS_WARNING, L"Warning 14: There is node which is successor of end node\n");
-// }
}
/*
@@ -726,10 +794,11 @@
{
std::map<std::string, HMscNodePtr>::iterator it = context->hmsc_nodes.find(context->element_name);
std::multimap<std::string, MscPtr>::iterator msc_it = context->mscs.find(context->reference_name);
+ ReferenceNodePtr node = NULL;
if (it == context->hmsc_nodes.end())
{
- ReferenceNodePtr node = new ReferenceNode();
+ node = new ReferenceNode();
std::multimap<std::string, MscPtr>::iterator msc_it = context->mscs.find(context->reference_name);
if(msc_it == context->mscs.end())
@@ -760,13 +829,43 @@
context->hmsc_nodes.insert(make_pair(context->element_name, node));
context->myHmsc->add_node(node);
- future_connection_fill_in_fun(context);
- create_future_connections_fun(context, node.get());
+ context->current_node = node;
+ context->node_type = reference;
+
+ std::map<std::string, std::set<TimeRelationRefNodePtr> >::iterator top_it;
+ std::map<std::string, std::set<TimeRelationRefNodePtr> >::iterator bottom_it;
+
+ top_it = context->future_top_time_relations.find(context->element_name);
+ bottom_it = context->future_bottom_time_relations.find(context->element_name);
+
+ if(top_it != context->future_top_time_relations.end())
+ {
+ std::set<TimeRelationRefNodePtr>::iterator set_it;
+
+ for(set_it = top_it->second.begin(); set_it != top_it->second.end(); ++set_it)
+ {
+ (*set_it)->glue_ref_node_b(false, node.get());
+ }
+
+ context->future_top_time_relations.erase(top_it);
+ }
+
+ if(bottom_it != context->future_bottom_time_relations.end())
+ {
+ std::set<TimeRelationRefNodePtr>::iterator set_it;
+
+ for(set_it = bottom_it->second.begin(); set_it != bottom_it->second.end(); ++set_it)
+ {
+ (*set_it)->glue_ref_node_b(true, node.get());
+ }
+
+ context->future_bottom_time_relations.erase(top_it);
+ }
}
else
{
context->z->print_report(RS_WARNING, stringize() << "Warning 15: The node " << TOWSTRING(context->element_name) << " has been created\n");
- context->connect_name.clear();
+ context->not_connect = 1;
}
}
@@ -782,15 +881,14 @@
ConnectionNodePtr node = new ConnectionNode();
context->hmsc_nodes.insert(std::make_pair(context->element_name, node));
context->myHmsc->add_node(node);
- future_connection_fill_in_fun(context);
- create_future_connections_fun(context, node.get());
+ context->current_node = node;
+ context->node_type = connection;
}
else
{
context->z->print_report(RS_WARNING, stringize() << "Warning 15: The node " << TOWSTRING(context->element_name) << " has been created\n");
- context->connect_name.clear();
+ context->not_connect = 1;
}
- context->node_type = 0;
}
/*
@@ -805,17 +903,47 @@
ConditionNodePtr node = new ConditionNode(TOWSTRING(context->condition_name));
context->hmsc_nodes.insert(std::make_pair(context->element_name, node));
context->myHmsc->add_node(node);
- future_connection_fill_in_fun(context);
- create_future_connections_fun(context, node.get());
+ context->current_node = node;
+ context->node_type = condition;
}
else
{
context->z->print_report(RS_WARNING, stringize() << "Warning 15: The node " << TOWSTRING(context->element_name) << " has been created\n");
- context->connect_name.clear();
+ context->not_connect = 1;
}
- context->node_type = 0;
}
+void create_connections_fun(struct Context* context)
+{
+ if(context->not_connect == 1)
+ {
+ context->connect_name.clear();
+ return ;
+ }
+
+ future_connection_fill_in_fun(context);
+
+ if(context->node_type == reference)
+ {
+ ReferenceNodePtr node = boost::dynamic_pointer_cast<ReferenceNode>(context->current_node);
+ create_future_connections_fun(context, node.get());
+ }
+
+ if(context->node_type == connection)
+ {
+ ConnectionNodePtr node = boost::dynamic_pointer_cast<ConnectionNode>(context->current_node);
+ create_future_connections_fun(context, node.get());
+ }
+
+ if(context->node_type == condition)
+ {
+ ConditionNodePtr node = boost::dynamic_pointer_cast<ConditionNode>(context->current_node);
+ create_future_connections_fun(context, node.get());
+ }
+
+ context->connect_name.clear();
+}
+
/*
* Create connections among curently created node and existed nodes or create record in future_connections
*/
@@ -864,7 +992,7 @@
if (context->connect_name.front() == context->end_node.first)
{
node->add_successor(context->end_node.second.get());
- context->connect_name.pop_front();
+ context->connect_name.pop_front();
}
}
}
@@ -902,29 +1030,106 @@
}
/*
- * Set flag node_type to 1;
+ * Set time_relation_type to define where the time interval should be connected
*/
-void set_connection_node_fun(struct Context* context)
+void set_time_ref_relation_type_fun(struct Context* context, enum time_relation_kind time_relation_type)
{
- context->node_type = 1;
+ context->time_relation_type = time_relation_type;
}
/*
- * Set flag node_type to 2;
+ * Set time_ to define where the time interval should be connected
*/
-void set_condition_node_fun(struct Context* context)
+void set_time_reference_node_fun(struct Context* context, char* name)
{
- context->node_type = 2;
+ context->time_node_name = name;
}
/*
- * Return flag node_type
+ * Set time interval from top to bottom on the same node
*/
-int get_node_type_fun(struct Context* context)
+void add_time_relation_ref_time_fun(struct Context* context)
{
- return context->node_type;
+ MscTimeIntervalSet<double> interval (context->time);
+ TimeRelationRefNodePtr relation = new TimeRelationRefNode(interval);
+
+ ReferenceNodePtr node = boost::dynamic_pointer_cast<ReferenceNode>(context->current_node);
+
+ if(node != NULL)
+ {
+ relation->glue_ref_nodes(false, node.get(), true, node.get());
+ }
}
+/*
+ * Set time interval between current node and another node.
+ *
+ * Kind defines where the time interval is defined on the current node
+ * context->time_relation_type defines where the time interval is defined on the other node.
+ */
+void add_time_relation_ref_fun(struct Context* context, enum time_relation_kind kind)
+{
+ MscTimeIntervalSet<double> interval (context->time);
+ TimeRelationRefNodePtr relation = new TimeRelationRefNode(interval);
+
+ std::map<std::string, HMscNodePtr>::iterator ref_it;
+ ReferenceNodePtr node;
+ std::set<TimeRelationRefNodePtr> my_set;
+
+ ref_it = context->hmsc_nodes.find(context->time_node_name);
+ node = boost::dynamic_pointer_cast<ReferenceNode>(context->current_node);
+
+ if(node == NULL)
+ {
+ context->z->print_report(RS_ERROR, L"Warning 23: Time information can be defined only to a reference node\n");
+ return ;
+ }
+
+ if(ref_it != context->hmsc_nodes.end())
+ {
+ ReferenceNodePtr node2 = boost::dynamic_pointer_cast<ReferenceNode>(ref_it->second);
+ if(node == NULL)
+ {
+ context->z->print_report(RS_ERROR, L"Warning 23: Time information can be defined only to a reference node\n");
+ return ;
+ }
+
+ relation->glue_ref_nodes(kind, node.get(), context->time_relation_type, node2.get());
+ }
+ else
+ {
+ if(context->time_relation_type == top)
+ {
+ std::map<std::string, std::set<TimeRelationRefNodePtr> >::iterator top_it;
+ top_it = context->future_top_time_relations.find(context->time_node_name);
+
+ if(top_it == context->future_top_time_relations.end())
+ {
+ my_set.insert(relation);
+ context->future_top_time_relations.insert(std::make_pair(context->time_node_name, my_set));
+ }
+ else
+ {
+ top_it->second.insert(relation);
+ }
+ }
+ else{
+ std::map<std::string, std::set<TimeRelationRefNodePtr> >::iterator bottom_it;
+ bottom_it = context->future_bottom_time_relations.find(context->time_node_name);
+
+ if(bottom_it == context->future_bottom_time_relations.end())
+ {
+ my_set.insert(relation);
+ context->future_bottom_time_relations.insert(std::make_pair(context->time_node_name, my_set));
+ }
+ else
+ {
+ bottom_it->second.insert(relation);
+ }
+ }
+ }
+}
+
#endif
// $Id$
Modified: trunk/src/data/Z120/Context.h
===================================================================
--- trunk/src/data/Z120/Context.h 2009-10-01 20:28:42 UTC (rev 391)
+++ trunk/src/data/Z120/Context.h 2009-10-02 16:03:11 UTC (rev 392)
@@ -34,6 +34,7 @@
enum msg_kind {output, input};
enum relation_kind {before, after};
+enum time_relation_kind {top, bottom};
void my_print(char* a);
@@ -57,6 +58,8 @@
void bug_report_fun(struct Context* context, char* report);
+void add_time_fun(struct Context* context, char* time);
+
//BMsc
void new_bmsc_fun(struct Context* context);
@@ -84,6 +87,12 @@
void end_instance_fun(struct Context* context);
+void add_time_relation_event_fun(struct Context* context);
+
+void set_time_reference_event_fun(struct Context* context, char* name);
+
+void create_future_time_relations(struct Context* context);
+
//HMsc
void new_hmsc_fun(struct Context* context);
@@ -105,14 +114,18 @@
void new_condition_node_fun(struct Context* context);
+void create_connections_fun(struct Context* context);
+
void future_connection_fill_in_fun(struct Context* context);
-void set_connection_node_fun(struct Context* context);
+void set_time_ref_relation_type_fun(struct Context* context, enum time_relation_kind time_relation_type);
-void set_condition_node_fun(struct Context* context);
+void set_time_reference_node_fun(struct Context* context, char* name);
-int get_node_type_fun(struct Context* context);
+void add_time_relation_ref_time_fun(struct Context* context);
+void add_time_relation_ref_fun(struct Context* context, enum time_relation_kind kind);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/src/data/Z120/Context_Impl.h
===================================================================
--- trunk/src/data/Z120/Context_Impl.h 2009-10-01 20:28:42 UTC (rev 391)
+++ trunk/src/data/Z120/Context_Impl.h 2009-10-02 16:03:11 UTC (rev 392)
@@ -34,6 +34,8 @@
#include "data/msc.h"
#include "z120.h"
+enum hmsc_node_type {reference, connection, condition};
+
struct Context
{
std::string msc_name;
@@ -55,6 +57,12 @@
Z120* z;
/*
+ * Time interval
+ */
+ std::string interval_label;
+ std::string time;
+
+ /*
* BMsc
*/
BMscPtr myBmsc;
@@ -63,13 +71,15 @@
std::map<std::string, InstancePtr> instances; // map of instances (key: name of instance, value: smart pointer to instance)
std::multimap<std::string, CompleteMessagePtr> messages; // map of future complete messages
std::map<std::string, EventPtr> future_events; // map of name of events on which was pointed before they were created
- std::map<std::string, CoregionEventPtr> named_events; // map of name of events
+ std::map<std::string, std::set<TimeRelationEventPtr> > future_time_events; // map of name of events on which was created time relation before they were created
+ std::map<std::string, EventPtr> named_events; // map of name of events
std::set<std::string> order_events; //set of name of events which takes place after keywords 'before', 'after'
EventPtr current_event; //event which was currently created
std::string event_name; //name of event
+ std::string time_event_name; //name of event on which points a reference in the time relation
int not_create_event; //flag for event in case msc has two labeled event with the same name
int no_message_label; //flag for message which does not have label
- int open_instance; //counter of open instances
+ int open_instance; //counter of open instances
/*
* HMsc
@@ -79,11 +89,20 @@
std::pair<std::string, EndNodePtr> end_node;
std::list<std::string> connect_name; // name of HMsc nodes which are successors of actual node
std::string reference_name;
+
std::string condition_name;
+ HMscNodePtr current_node;
+
std::map<std::string, HMscNodePtr> hmsc_nodes; // map of hmsc nodes (key: name of node, value: smart pointer to node)
std::map<std::string, std::set<std::string> > future_connections; // map of nodes to which node will be connected
- int node_type; //flag to recognize HMsc nodes (ConnectionNode, ReferenceNode, ConditionNode). Used in Z120.g
+ std::map<std::string, std::set<TimeRelationRefNodePtr> > future_top_time_relations;
+ std::map<std::string, std::set<TimeRelationRefNodePtr> > future_bottom_time_relations;
+ enum hmsc_node_type node_type; //flag to recognize HMsc nodes (ConnectionNode, ReferenceNode, ConditionNode).
+ enum time_relation_kind time_relation_type;
+ std::string time_node_name;
+ int not_connect;
+
~Context() {}
};
Modified: trunk/src/data/Z120/Z120.g
===================================================================
--- trunk/src/data/Z120/Z120.g 2009-10-01 20:28:42 UTC (rev 391)
+++ trunk/src/data/Z120/Z120.g 2009-10-02 16:03:11 UTC (rev 392)
@@ -129,7 +129,7 @@
;
non_par_non_escape:
-Character_String | NAME {bug_report_fun(context, "Warning: The file is breaking the ITU-T Z120 standard");}
+Character_String | NAME //{bug_report_fun(context, "Warning: The file is breaking the ITU-T Z120 standard");}
;
non_nestable_par:
@@ -413,7 +413,10 @@
{
add_relation_fun(context, after);
})? end
- ('time' time_dest_list end)?
+ ('time' time_dest_list end
+ {
+ add_time_relation_event_fun(context);
+ })?
{
set_not_create_event_fun(context);
@@ -425,12 +428,16 @@
;
time_dest_list:
-// (time_dest ('origin')?)?
+ (time_dest ('origin')?)?
time_interval (',' time_dest_list)?
;
time_dest:
- NAME | ('top' | 'bottom') (reference_identification | NAME)
+ NAME {set_time_reference_event_fun(context, (char*) $NAME.text->chars);}
+ |
+ ('top' { set_time_ref_relation_type_fun(context, top); }
+ | 'bottom' { set_time_ref_relation_type_fun(context, bottom); })
+ (reference_identification | NAME { set_time_reference_node_fun(context, (char*) $NAME.text->chars);} )
;
non_orderable_event:
@@ -1085,7 +1092,15 @@
// ----- Time Interval
time_interval:
- (interval_label)? ( (('@')? ('(' | '[') (time_point)? ',')=> bounded_time (measurement)? | singular_time )
+ (interval_label)?
+ ( (('@')? ('(' | '[') (time_point)? ',')=> bounded_time
+ {
+ add_time_fun(context, (char*) $bounded_time.text->chars);
+ } (measurement)?
+ | singular_time
+ {
+ add_time_fun(context, (char*) $singular_time.text->chars);
+ })
;
/*
@@ -1433,21 +1448,7 @@
}
':' intermediate_node_type connection_list end
{
- switch (get_node_type_fun(context))
- {
- case 0:
- new_reference_node_fun(context);
- break;
- case 1:
- new_connection_node_fun(context);
- break;
- case 2:
- new_condition_node_fun(context);
- break;
- default:
- bug_report_fun(context, "Internal Error 16: There is no node to create\n");
- }
-
+ create_connections_fun(context);
}
;
@@ -1458,11 +1459,11 @@
untimeable_node:
hmsc_connection_node
{
- set_connection_node_fun(context);
+ new_connection_node_fun(context);
}
| hmsc_condition_node
{
- set_condition_node_fun(context);
+ new_condition_node_fun(context);
}
;
@@ -1470,7 +1471,7 @@
start {new_start_node_fun(context);}
(node_expression
- | (NAME ':' {bug_report_fun(context, "Warning: The file is breaking the ITU-T Z120 standard");})?
+ | (NAME ':'/* {bug_report_fun(context, "Warning: The file is breaking the ITU-T Z120 standard");}*/)?
text_definition)* // add NAME ':' out of standart Z120_1999
;
@@ -1481,25 +1482,12 @@
node_expression:
NAME
{
- set_node_name_fun(context, (char*) ($NAME.text->chars));
+ set_node_name_fun(context, (char*) ($NAME.text->chars));
}
- ':' (node 'seq' '('label_name_list')'
+ ':' (node 'seq' '('label_name_list')'
{
- switch (get_node_type_fun(context))
- {
- case 0:
- new_reference_node_fun(context);
- break;
- case 1:
- new_connection_node_fun(context);
- break;
- case 2:
- new_condition_node_fun(context);
- break;
- default:
- bug_report_fun(context, "Internal Error 16: There is no node to create\n");
- }
- }
+ create_connections_fun(context);
+ }
| 'end'
{
new_end_node_fun(context);
@@ -1516,10 +1504,10 @@
;
node:
- '(' msc_ref_expr ')' (time_interval)? //reference node
+ '(' msc_ref_expr ')' (time_interval)? { new_reference_node_fun(context); }//reference node
| par_expression (time_interval)?
- | condition_identification {set_condition_node_fun(context);}
- | 'connect' {set_connection_node_fun(context);}
+ | condition_identification {new_condition_node_fun(context);}
+ | 'connect' {new_connection_node_fun(context);}
;
par_expression:
@@ -1535,10 +1523,10 @@
;
timeable_node:
- (hmsc_ref_expr_node | hmsc_expression)
- ('time' time_interval end)?
- ('top' time_dest_list end)?
- ('bottom' time_dest_list end)?
+ (hmsc_ref_expr_node { new_reference_node_fun(context); } | hmsc_expression)
+ ('time' time_interval end { add_time_relation_ref_time_fun(context); })?
+ ('top' time_dest_list end { add_time_relation_ref_fun(context, top); })?
+ ('bottom' time_dest_list end { add_time_relation_ref_fun(context, bottom); })?
;
hmsc_ref_expr_node:
Modified: trunk/tests/z120_test/CMakeLists.txt
===================================================================
--- trunk/tests/z120_test/CMakeLists.txt 2009-10-01 20:28:42 UTC (rev 391)
+++ trunk/tests/z120_test/CMakeLists.txt 2009-10-02 16:03:11 UTC (rev 392)
@@ -88,6 +88,10 @@
ADD_Z120_TEST(z120_test65.mpr 1)
ADD_Z120_TEST(z120_time01.mpr 1)
+ADD_Z120_TEST(z120_time02.mpr 1)
+ADD_Z120_TEST(z120_time03.mpr 1)
+ADD_Z120_TEST(z120_time04.mpr 1)
+ADD_Z120_TEST(z120_time05.mpr 1)
# $Id$
Modified: trunk/tests/z120_test/z120_test01.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test01.mpr.result 2009-10-01 20:28:42 UTC (rev 391)
+++ trunk/tests/z120_test/z120_test01.mpr.result 2009-10-02 16:03:11 UTC (rev 392)
@@ -1,11 +1,3 @@
-Warning: The file is breaking the ITU-T Z120 standard
-Warning: The file is breaking the ITU-T Z120 standard
-Warning: The file is breaking the ITU-T Z120 standard
-Warning: The file is breaking the ITU-T Z120 standard
-Warning: The file is breaking the ITU-T Z120 standard
-Warning: The file is breaking the ITU-T Z120 standard
-Warning: The file is breaking the ITU-T Z120 standard
-Warning: The file is breaking the ITU-T Z120 standard
Warning 20: Msc has not finished 1 instance
OK: z120_test01 is correct, should be correct
Modified: trunk/tests/z120_test/z120_test02.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test02.mpr.result 2009-10-01 20:28:42 UTC (rev 391)
+++ trunk/tests/z120_test/z120_test02.mpr.result 2009-10-02 16:03:11 UTC (rev 392)
@@ -1,4 +1,3 @@
-Warning: The file is breaking the ITU-T Z120 standard
Warning 09: There is reference to nonexisted MSC
OK: z120_test02 is correct, should be correct
Modified: trunk/tests/z120_test/z120_time01.mpr
===================================================================
--- trunk/tests/z120_test/z120_time01.mpr 2009-10-01 20:28:42 UTC (rev 391)
+++ trunk/tests/z120_test/z120_time01.mpr 2009-10-02 16:03:11 UTC (rev 392)
@@ -25,7 +25,7 @@
concurrent;
label e2;
in NAME,0 from P1 before e3;
-time e4 12;
+time e4 [12];
label e3;
in NAME,1 from P1;
endconcurrent;
Modified: trunk/tests/z120_test/z120_time01.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time01.mpr.result 2009-10-01 20:28:42 UTC (rev 391)
+++ trunk/tests/z120_test/z120_time01.mpr.result 2009-10-02 16:03:11 UTC (rev 392)
@@ -6,8 +6,8 @@
L0: connect L1, L2;
L1: reference Subprocess connect L3;
L2: reference Subprocess time [1,2);
-top bottom L1 (1,10);
-connect L1;
+ top bottom L1 (1,10);
+ connect L1;
L3: final;
endmsc;
msc Subprocess;
@@ -25,7 +25,7 @@
concurrent;
label e2;
in NAME,0 from P1 before e3;
-time e4 12;
+time e4 [12];
label e3;
in NAME,1 from P1;
endconcurrent;
Added: trunk/tests/z120_test/z120_time02.mpr
===================================================================
--- trunk/tests/z120_test/z120_time02.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time02.mpr 2009-10-02 16:03:11 UTC (rev 392)
@@ -0,0 +1,34 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time (1,2);
+top L1 (1,10);connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time02.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time02.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time02.mpr.result 2009-10-02 16:03:11 UTC (rev 392)
@@ -0,0 +1,28 @@
+OK: z120_time02 is correct, should be correct
+
+mscdocument z120_time02;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocesstime (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+out NAME,1 to P2;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+in NAME,0 from P1 before e0;
+label e0;
+in NAME,1 from P1;
+endconcurrent;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time03.mpr
===================================================================
--- trunk/tests/z120_test/z120_time03.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time03.mpr 2009-10-02 16:03:11 UTC (rev 392)
@@ -0,0 +1,35 @@
+/* Basic time constraints in both MSC and HMS...
[truncated message content] |
|
From: <got...@us...> - 2009-10-02 19:25:21
|
Revision: 393
http://scstudio.svn.sourceforge.net/scstudio/?rev=393&view=rev
Author: gotthardp
Date: 2009-10-02 19:25:03 +0000 (Fri, 02 Oct 2009)
Log Message:
-----------
Fixed Visual Studio warning.
Test for directed and non-directed time constraint added.
Modified Paths:
--------------
trunk/src/data/Z120/Context.cpp
trunk/tests/z120_test/CMakeLists.txt
Added Paths:
-----------
trunk/tests/z120_test/z120_time06.mpr
trunk/tests/z120_test/z120_time06.mpr.result
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2009-10-02 16:03:11 UTC (rev 392)
+++ trunk/src/data/Z120/Context.cpp 2009-10-02 19:25:03 UTC (rev 393)
@@ -1094,7 +1094,7 @@
return ;
}
- relation->glue_ref_nodes(kind, node.get(), context->time_relation_type, node2.get());
+ relation->glue_ref_nodes(kind == bottom, node.get(), context->time_relation_type == bottom, node2.get());
}
else
{
Modified: trunk/tests/z120_test/CMakeLists.txt
===================================================================
--- trunk/tests/z120_test/CMakeLists.txt 2009-10-02 16:03:11 UTC (rev 392)
+++ trunk/tests/z120_test/CMakeLists.txt 2009-10-02 19:25:03 UTC (rev 393)
@@ -92,6 +92,7 @@
ADD_Z120_TEST(z120_time03.mpr 1)
ADD_Z120_TEST(z120_time04.mpr 1)
ADD_Z120_TEST(z120_time05.mpr 1)
+ADD_Z120_TEST(z120_time06.mpr 1)
# $Id$
Added: trunk/tests/z120_test/z120_time06.mpr
===================================================================
--- trunk/tests/z120_test/z120_time06.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time06.mpr 2009-10-02 19:25:03 UTC (rev 393)
@@ -0,0 +1,31 @@
+/* Mixed directed and non-directed constraints (keyword "origin")
+ */
+mscdocument z120_time06;
+msc Process;
+initial connect L0;
+L0: reference Event top top L1 [3];
+ bottom bottom L1 origin [4];
+ connect L1;
+L1: reference Event connect L2;
+L2: final;
+endmsc;
+msc Event;
+inst Client;
+inst Server;
+Client: instance;
+label e0;
+out INVITE,0 to Server;
+time e1 [1];
+label e1;
+in 200_OK,1 from Server;
+out ACK,2 to Server;
+endinstance;
+Server: instance;
+label e2;
+in INVITE,0 from Client;
+time e3 origin [2];
+out 200_OK,1 to Client;
+label e3;
+in ACK,2 from Client;
+endinstance;
+endmsc;
Property changes on: trunk/tests/z120_test/z120_time06.mpr
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/tests/z120_test/z120_time06.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time06.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time06.mpr.result 2009-10-02 19:25:03 UTC (rev 393)
@@ -0,0 +1,31 @@
+OK: z120_time05 is correct, should be correct
+
+mscdocument z120_time06;
+msc Process;
+initial connect L0;
+L0: reference Event top top L1 [3];
+ bottom bottom L1 origin [4];
+ connect L1;
+L1: reference Event connect L2;
+L2: final;
+endmsc;
+msc Event;
+inst Client;
+inst Server;
+Client: instance;
+label e0;
+out INVITE,0 to Server;
+time e1 [1];
+label e1;
+in 200_OK,1 from Server;
+out ACK,2 to Server;
+endinstance;
+Server: instance;
+label e2;
+in INVITE,0 from Client;
+time e3 origin [2];
+out 200_OK,1 to Client;
+label e3;
+in ACK,2 from Client;
+endinstance;
+endmsc;
Property changes on: trunk/tests/z120_test/z120_time06.mpr.result
___________________________________________________________________
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <koc...@us...> - 2009-10-04 10:13:13
|
Revision: 400
http://scstudio.svn.sourceforge.net/scstudio/?rev=400&view=rev
Author: kocianon
Date: 2009-10-04 10:13:06 +0000 (Sun, 04 Oct 2009)
Log Message:
-----------
compilation fix
Modified Paths:
--------------
trunk/src/check/time/bmsc_tightening.h
trunk/src/check/time/time_consistency.cpp
trunk/src/data/time.h
trunk/tests/CMakeLists.txt
trunk/tests/bmsc_tightening_test.cpp
trunk/tests/incon_test.cpp
trunk/tests/tighten_msc_test.cpp
Modified: trunk/src/check/time/bmsc_tightening.h
===================================================================
--- trunk/src/check/time/bmsc_tightening.h 2009-10-04 07:31:34 UTC (rev 399)
+++ trunk/src/check/time/bmsc_tightening.h 2009-10-04 10:13:06 UTC (rev 400)
@@ -1,6 +1,7 @@
#ifndef _TIME_TIGHTENING_H_
#define _TIME_TIGHTENING_H_
#include "time_consistency.h"
+#include "check/pseudocode/utils.h"
typedef std::pair<Event*,Event*> EventPair;
typedef std::list<EventPair> EventPairsList;
@@ -113,7 +114,7 @@
MscTimeIntervalSetD max_intrset;
MscTimeIntervalSetD evts_intrset;
- z.insert(MscTimeIntervalD(0,0));
+ max_intrset.insert(MscTimeIntervalD(0,0));
EventPairsList pairs;
@@ -142,8 +143,17 @@
// assign tightened interval
interval = MscTimeIntervalSetD::set_intersection(interval,max_intrset);
// TODO:
+ EventPVector all_events = get_events();
+ EventPVector::iterator it_v;
+
// for all a \in events
// for all b \in a.get_next do
+ for(it_v = all_events.begin();it_v!=all_events.end();it_v++)
+ {
+ EventPSet succs = EventFirstSuccessors::get(*it_v);
+ EventPSet::iterator it_succ;
+ for(it_succ=succs.begin();it_succ!=succs.end();it_succ++)
+ {
EventPList::iterator it_min_events;
EventPList::iterator it_max_events;
MscTimeIntervalSetD path_union;
@@ -153,7 +163,7 @@
for(it_max_events=m_maxs.begin();it_max_events!=m_maxs.end();it_max_events++)
{
- if(is_leq(*it_min_events,a)&&is_leq(b,*it_max_events))
+ if(is_leq(*it_min_events,*it_v)&&is_leq(*it_succ,*it_max_events))
continue;
path_union=MscTimeIntervalSetD::set_union(path_union,
t_matrix(get_number(*it_min_events),get_number(*it_max_events))
@@ -162,14 +172,15 @@
}
MscTimeIntervalSetD tight_interval;
- tight_interval = MscTimeIntervalSetD::set_union(interval,get_max_value(path_union,interval));
+ tight_interval = MscTimeIntervalSetD::set_union(interval,
+ MscTimeIntervalSetD::zero_max_interval(path_union,interval));
MscTimeIntervalSetD prefix_interval;
prefix_interval.insert(MscTimeIntervalD(0,0));
for(it_min_events=m_mins.begin();it_min_events!=m_mins.end();it_min_events++)
{
prefix_interval=MscTimeIntervalSetD::components_max(
- t_matrix(get_number(*it_min_events),get_number(a)),prefix_interval);
+ t_matrix(get_number(*it_min_events),get_number(*it_v)),prefix_interval);
}
MscTimeIntervalSetD suffix_interval;
@@ -177,13 +188,15 @@
for(it_max_events=m_maxs.begin();it_max_events!=m_maxs.end();it_max_events++)
{
suffix_interval=MscTimeIntervalSetD::components_max(
- t_matrix(get_number(b),get_number(*it_max_events)),suffix_interval);
+ t_matrix(get_number(*it_succ),get_number(*it_max_events)),suffix_interval);
}
//final tightening
- t_matrix(get_number(a),get_number(b))=MscTimeIntervalSetD::set_intersection(t_matrix(get_number(a),get_number(b)),tight_interval-prefix_interval-suffix_interval);
- //endfor
+ t_matrix(get_number(*it_v),get_number(*it_succ))=MscTimeIntervalSetD::set_intersection(t_matrix(get_number(*it_v),get_number(*it_succ)),tight_interval-prefix_interval-suffix_interval);
+ } // end for succs
+ } // end for all events
+
/*
bool is_on_common_path;
EventPSet nodes_on_common_path;
Modified: trunk/src/check/time/time_consistency.cpp
===================================================================
--- trunk/src/check/time/time_consistency.cpp 2009-10-04 07:31:34 UTC (rev 399)
+++ trunk/src/check/time/time_consistency.cpp 2009-10-04 10:13:06 UTC (rev 400)
@@ -152,8 +152,8 @@
{
for(unsigned j=0;j<size;j++)
{
- m_result_matrix(i,j)=MscTimeIntervalDSet();
- m_to_go_matrix(i,j)=MscTimeIntervalDSet();
+ m_result_matrix(i,j)=MscTimeIntervalSetD();
+ m_to_go_matrix(i,j)=MscTimeIntervalSetD();
}
}
}
@@ -182,7 +182,7 @@
//////////////////////////////////////////////////////////////////
-void BmscMatrixConverter::get_first_area_events(EventArea* area,Event* e)
+void BMscMatrixConverter::get_first_area_events(EventArea* area,Event* e)
{
if(!area)
return;
@@ -210,7 +210,7 @@
}
}
-void BmscMatrixConverter::get_strict_successors(StrictEvent *e)
+void BMscMatrixConverter::get_strict_successors(StrictEvent *e)
{
if(e->get_successor().get())
m_succs[e].insert(e->get_successor().get());
@@ -219,7 +219,7 @@
}
-void BmscMatrixConverter::get_coregion_successors(CoregionEvent *e)
+void BMscMatrixConverter::get_coregion_successors(CoregionEvent *e)
{
if(e->get_successors().size()!=0)
{
@@ -234,7 +234,7 @@
get_first_area_events(e->get_area()->get_next().get(),e);
}
-void BmscMatrixConverter::get_successors(Event *e)
+void BMscMatrixConverter::get_successors(Event *e)
{
StrictEvent* strict = dynamic_cast<StrictEvent*>(e);
if(strict)
@@ -254,7 +254,7 @@
}
-void BmscMatrixConverter::build_up_matrix()
+void BMscMatrixConverter::build_up_matrix()
{
init_visual();
m_matrix.resize(m_events.size(),m_events.size());
@@ -294,8 +294,8 @@
for(it=relations.begin();it!=relations.end();it++)
{
- if(closure_initiator.get_visual_closure((*it)->get_event_a())[
- closure_initiator.get_topology_index((*it)->get_event_b())])
+ if(m_closure_initiator.get_visual_closure((*it)->get_event_a())[
+ m_closure_initiator.get_topology_index((*it)->get_event_b())])
{
MatrixFunc::fill_matrix(m_matrix,(*it)->get_interval_set(), \
get_number((*it)->get_event_a()),get_number((*it)->get_event_b()));
@@ -310,5 +310,3 @@
}
///////////////////////////////////////////////////////////////////////
-
-
Modified: trunk/src/data/time.h
===================================================================
--- trunk/src/data/time.h 2009-10-04 07:31:34 UTC (rev 399)
+++ trunk/src/data/time.h 2009-10-04 10:13:06 UTC (rev 400)
@@ -1247,8 +1247,8 @@
tmp = MscTimeInterval<T>::interval_intersection(*it,*it2);
if(tmp.is_valid())
new_set.insert(tmp);
- else
- std::cerr<< "not valid " << tmp << std::endl;
+ //else
+ // std::cerr<< "not valid " << tmp << std::endl;
}
}
return new_set;
@@ -1285,6 +1285,28 @@
return new_set;
}
+ /**
+ *\brief makes intersection of arguments
+ * if intersection is empty set returns empty set
+ * else returns interval [0,maxValue(intersection) with
+ * appropriate right boundary ("]" or ")")
+ *
+ */
+ static MscTimeIntervalSet<T> zero_max_interval(MscTimeIntervalSet left,
+ MscTimeIntervalSet right)
+ {
+ MscTimeIntervalSet<T> inter = set_intersection(left,right);
+ if(inter.is_empty())
+ return inter;
+
+ MscTimeIntervalSet<T> ret;
+ MscTimeInterval<T> back = inter.m_set.back();
+ MscTimeInterval<T> new_int(true,0,back.get_end_value(),back.get_end_closed());
+
+ ret.insert(new_int);
+ return ret;
+ }
+
/**
* @brief prints interval set to the string
* @return interval set string
Modified: trunk/tests/CMakeLists.txt
===================================================================
--- trunk/tests/CMakeLists.txt 2009-10-04 07:31:34 UTC (rev 399)
+++ trunk/tests/CMakeLists.txt 2009-10-04 10:13:06 UTC (rev 400)
@@ -149,14 +149,14 @@
ADD_TEST(interval_set_test ${EXECUTABLE_OUTPUT_PATH}/interval_set_test)
ADD_TEST(interval_string ${EXECUTABLE_OUTPUT_PATH}/interval_string)
-ADD_EXECUTABLE(bmsc_matrix_converter_test
- bmsc_matrix_converter_test.cpp
-)
-TARGET_LINK_LIBRARIES(bmsc_matrix_converter_test
- scmsc
- sctime
- scpseudocode
-)
+#ADD_EXECUTABLE(bmsc_matrix_converter_test
+# bmsc_matrix_converter_test.cpp
+#)
+#TARGET_LINK_LIBRARIES(bmsc_matrix_converter_test
+# scmsc
+# sctime
+# scpseudocode
+#)
ADD_EXECUTABLE(incon_test
incon_test.cpp
Modified: trunk/tests/bmsc_tightening_test.cpp
===================================================================
--- trunk/tests/bmsc_tightening_test.cpp 2009-10-04 07:31:34 UTC (rev 399)
+++ trunk/tests/bmsc_tightening_test.cpp 2009-10-04 10:13:06 UTC (rev 400)
@@ -37,75 +37,87 @@
instance1->add_area(strict1);
instance2->add_area(strict2);
instance3->add_area(strict3);
+
EventPtr e0 = strict1->add_event();
- EventPtr e1 = strict3->add_event();
- EventPtr e2 = strict2->add_event();
- EventPtr e3 = strict2->add_event();
- EventPtr e4 = strict1->add_event();
- EventPtr e5 = strict3->add_event();
-
+ EventPtr e40 = strict1->add_event();
+
+ EventPtr e30 = strict2->add_event();
+ EventPtr e20 = strict2->add_event();
+
+ EventPtr e11 = strict3->add_event();
+ EventPtr e10 = strict3->add_event();
+
CompleteMessagePtr m1 = new CompleteMessage(L"hi1");
- m1->glue_events(e0, e1);
+ m1->glue_events(e0, e11);
CompleteMessagePtr m2 = new CompleteMessage(L"hi2");
- m2->glue_events(e5, e2);
+ m2->glue_events(e10, e20);
CompleteMessagePtr m3 = new CompleteMessage(L"hi3");
- m3->glue_events(e3, e4);
+ m3->glue_events(e30, e40);
- MscTimeIntervalD in6(10,20);
- MscTimeIntervalD in7(0,0);
- MscTimeIntervalD in8(30,40);
- MscTimeIntervalD in9(60,D::infinity());//TODO: infi
- MscTimeIntervalD in10(20,30);
- MscTimeIntervalD in11(40,50);
- MscTimeIntervalD in12(60,120);
+ MscTimeIntervalD in1(10,20);
+ MscTimeIntervalD in2(0,0);
+ MscTimeIntervalD in3(30,40);
+ MscTimeIntervalD in4(60,D::infinity());//TODO: infi
+ MscTimeIntervalD in5(20,30);
+ MscTimeIntervalD in6(40,50);
+
+ MscTimeIntervalD in12(60,70);
MscTimeIntervalD in13(20,70);
- MscTimeIntervalDSet ins1;
- MscTimeIntervalDSet ins2;
- MscTimeIntervalDSet ins3;
- MscTimeIntervalDSet ins4;
- MscTimeIntervalDSet ins5;
- MscTimeIntervalDSet ins6;
- MscTimeIntervalDSet ins7;
- MscTimeIntervalDSet ins8;
+ MscTimeIntervalSetD ins1;
+ MscTimeIntervalSetD ins2;
+ MscTimeIntervalSetD ins3;
+ MscTimeIntervalSetD ins4;
+ MscTimeIntervalSetD ins5;
+ MscTimeIntervalSetD ins6;
+ MscTimeIntervalSetD ins7;
+ MscTimeIntervalSetD ins8;
- ins1.insert(in6);
+ ins1.insert(in1);
- ins2.insert(in8);
- ins2.insert(in9);
+ ins2.insert(in2);
+
+// ins2.insert(in9);
- ins3.insert(in6);
+ ins3.insert(in3);
+ ins3.insert(in4);
+
- ins4.insert(in10);
- ins4.insert(in11);
+ ins4.insert(in5);
+ ins4.insert(in6);
ins5.insert(in12);
- ins6.insert(in7);
+// ins6.insert(in7);
TimeRelationEventPtr rel1a = new TimeRelationEvent(ins1);
- rel1a->glue_events(e0.get(),e1.get());
- TimeRelationEventPtr rel6 = new TimeRelationEvent(ins6);
- rel6->glue_events(e1.get(),e5.get());
- TimeRelationEventPtr rel2 = new TimeRelationEvent(ins2);
- rel2->glue_events(e5.get(),e2.get());
- TimeRelationEventPtr rel1b = new TimeRelationEvent(ins1);
- rel1b->glue_events(e3.get(),e2.get());
- TimeRelationEventPtr rel4 = new TimeRelationEvent(ins4);
- rel4->glue_events(e3.get(),e4.get());
+ rel1a->glue_events(e0.get(),e11.get());
+
+ TimeRelationEventPtr rel6 = new TimeRelationEvent(ins2);
+ rel6->glue_events(e11.get(),e10.get());
+
+ TimeRelationEventPtr rel2 = new TimeRelationEvent(ins3);
+ rel2->glue_events(e10.get(),e20.get());
+
+ TimeRelationEventPtr rel7 = new TimeRelationEvent(ins1);
+ rel7->glue_events(e30.get(),e20.get());
+
+ TimeRelationEventPtr rel1b = new TimeRelationEvent(ins4);
+ rel1b->glue_events(e30.get(),e40.get());
+
TimeRelationEventPtr rel5 = new TimeRelationEvent(ins5);
- rel5->glue_events(e0.get(),e4.get());
+ rel5->glue_events(e0.get(),e40.get());
- MscTimeIntervalDSet i;
+ MscTimeIntervalSetD i;
i.insert(MscTimeIntervalD(0,80));
BMscDuplicator duplicator;
BMscPtr bmsc_duplicated = duplicator.duplicate_bmsc(bmsc);
- BmscMatrixConverter conv2;
+ BMscMatrixConverter conv2;
conv2.compute_matrix(bmsc_duplicated);
std::cerr << conv2.get_matrix() << std::endl;
MscSolveTCSP sol2;
@@ -115,23 +127,23 @@
std::cerr << "##################################################" << std::endl;
- BmscMatrixConverter conv;
+ BMscMatrixConverter conv;
conv.compute_matrix(bmsc);
std::cerr << conv.get_matrix() << std::endl;
- if(conv.is_leq(e3.get(),e4.get()))
- std::cerr << "ANO" << std::endl;
- else
- std::cerr << "NE" << std::endl;
+// if(conv.is_leq(e3.get(),e4.get()))
+// std::cerr << "ANO" << std::endl;
+// else
+// std::cerr << "NE" << std::endl;
MscSolveTCSP sol;
std::cerr << sol.solve(conv.get_matrix()) << std::endl;
// sol.solve(conv.get_matrix());
// MaxTightener tight;
- EventPList min;
- EventPList max;
- min.push_back(e0.get());
+// EventPList min;
+// EventPList max;
+// min.push_back(e0.get());
// min.push_back(e3.get());
// max.push_back(e2.get());
- max.push_back(e4.get());
+// max.push_back(e4.get());
std::pair<MscTimeIntervalSetD,IntervalSetMatrix> pair;
TightenBMsc tighten(bmsc);
Modified: trunk/tests/incon_test.cpp
===================================================================
--- trunk/tests/incon_test.cpp 2009-10-04 07:31:34 UTC (rev 399)
+++ trunk/tests/incon_test.cpp 2009-10-04 10:13:06 UTC (rev 400)
@@ -63,14 +63,14 @@
- MscTimeIntervalDSet ints1;
- MscTimeIntervalDSet ints2;
- MscTimeIntervalDSet ints3;
- MscTimeIntervalDSet ints4;
- MscTimeIntervalDSet ints5;
- MscTimeIntervalDSet ints6;
- MscTimeIntervalDSet ints7;
- MscTimeIntervalDSet ints8;
+ MscTimeIntervalSetD ints1;
+ MscTimeIntervalSetD ints2;
+ MscTimeIntervalSetD ints3;
+ MscTimeIntervalSetD ints4;
+ MscTimeIntervalSetD ints5;
+ MscTimeIntervalSetD ints6;
+ MscTimeIntervalSetD ints7;
+ MscTimeIntervalSetD ints8;
ints1.insert(int6);
ints2.insert(int7);
@@ -89,11 +89,11 @@
for(unsigned i=0;i<ms.size1();i++){
if(i==j)
{
- ms(j,i) = MscTimeIntervalDSet();
+ ms(j,i) = MscTimeIntervalSetD();
ms(j,i).insert(MscTimeIntervalD(0,0));
}
else
- ms(j,i) = MscTimeIntervalDSet();
+ ms(j,i) = MscTimeIntervalSetD();
ms(j,i).insert(MscTimeIntervalD(false,-D::infinity(),D::infinity(),false));
}
}
@@ -120,10 +120,10 @@
- MscTimeIntervalDSet ints11;
- MscTimeIntervalDSet ints12;
- MscTimeIntervalDSet ints13;
- MscTimeIntervalDSet ints14;
+ MscTimeIntervalSetD ints11;
+ MscTimeIntervalSetD ints12;
+ MscTimeIntervalSetD ints13;
+ MscTimeIntervalSetD ints14;
ints11.insert(int17);
ints11.insert(int16);
@@ -140,12 +140,12 @@
for(unsigned i=0;i<omg.size1();i++){
if(i==j)
{
- omg(j,i) = MscTimeIntervalDSet();
+ omg(j,i) = MscTimeIntervalSetD();
omg(j,i).insert(MscTimeIntervalD(0,0));
}
else
{
- omg(j,i) = MscTimeIntervalDSet();
+ omg(j,i) = MscTimeIntervalSetD();
omg(j,i).insert(MscTimeIntervalD(false,-D::infinity(),D::infinity(),false));
}
}
@@ -156,10 +156,10 @@
omg(2,3) = ints13;
omg(1,3) = ints14;
- omg(1,0) = MscTimeIntervalDSet::interval_inverse(ints11);
- omg(2,1) = MscTimeIntervalDSet::interval_inverse(ints12);
- omg(3,2) = MscTimeIntervalDSet::interval_inverse(ints13);
- omg(3,1) = MscTimeIntervalDSet::interval_inverse(ints14);
+ omg(1,0) = MscTimeIntervalSetD::interval_inverse(ints11);
+ omg(2,1) = MscTimeIntervalSetD::interval_inverse(ints12);
+ omg(3,2) = MscTimeIntervalSetD::interval_inverse(ints13);
+ omg(3,1) = MscTimeIntervalSetD::interval_inverse(ints14);
std::cout << omg << std::endl;
std::cout << sol.solve(omg) << std::endl;
std::cout << "//////////////////////////////////////" << std::endl;
@@ -178,14 +178,14 @@
- MscTimeIntervalDSet ins1;
- MscTimeIntervalDSet ins2;
- MscTimeIntervalDSet ins3;
- MscTimeIntervalDSet ins4;
- MscTimeIntervalDSet ins5;
- MscTimeIntervalDSet ins6;
- MscTimeIntervalDSet ins7;
- MscTimeIntervalDSet ins8;
+ MscTimeIntervalSetD ins1;
+ MscTimeIntervalSetD ins2;
+ MscTimeIntervalSetD ins3;
+ MscTimeIntervalSetD ins4;
+ MscTimeIntervalSetD ins5;
+ MscTimeIntervalSetD ins6;
+ MscTimeIntervalSetD ins7;
+ MscTimeIntervalSetD ins8;
ins1.insert(int6);
@@ -204,31 +204,31 @@
for(unsigned i=0;i<karel.size1();i++){
if(i==j)
{
- karel(j,i) = MscTimeIntervalDSet();
+ karel(j,i) = MscTimeIntervalSetD();
karel(j,i).insert(MscTimeIntervalD(0,0));
}
else
{
- karel(j,i) = MscTimeIntervalDSet();
+ karel(j,i) = MscTimeIntervalSetD();
karel(j,i).insert(MscTimeIntervalD(false,-D::infinity(),D::infinity(),false));
}
}
}
karel(0,1) = ins1;
- karel(1,0) = MscTimeIntervalDSet::interval_inverse(ins1);
+ karel(1,0) = MscTimeIntervalSetD::interval_inverse(ins1);
karel(1,2) = ins2;
- karel(2,1) = MscTimeIntervalDSet::interval_inverse(ins2);
+ karel(2,1) = MscTimeIntervalSetD::interval_inverse(ins2);
karel(3,2) = ins3;
- karel(2,3) = MscTimeIntervalDSet::interval_inverse(ins3);
+ karel(2,3) = MscTimeIntervalSetD::interval_inverse(ins3);
karel(3,4) = ins4;
- karel(4,3) = MscTimeIntervalDSet::interval_inverse(ins4);
+ karel(4,3) = MscTimeIntervalSetD::interval_inverse(ins4);
karel(0,4) = ins5;
- karel(4,0) = MscTimeIntervalDSet::interval_inverse(ins5);
+ karel(4,0) = MscTimeIntervalSetD::interval_inverse(ins5);
std::cerr << karel << std::endl;
MatrixFunc::print_out(karel);
Modified: trunk/tests/tighten_msc_test.cpp
===================================================================
--- trunk/tests/tighten_msc_test.cpp 2009-10-04 07:31:34 UTC (rev 399)
+++ trunk/tests/tighten_msc_test.cpp 2009-10-04 10:13:06 UTC (rev 400)
@@ -61,14 +61,14 @@
- MscTimeIntervalDSet ins1;
- MscTimeIntervalDSet ins2;
- MscTimeIntervalDSet ins3;
- MscTimeIntervalDSet ins4;
- MscTimeIntervalDSet ins5;
- MscTimeIntervalDSet ins6;
- MscTimeIntervalDSet ins7;
- MscTimeIntervalDSet ins8;
+ MscTimeIntervalSetD ins1;
+ MscTimeIntervalSetD ins2;
+ MscTimeIntervalSetD ins3;
+ MscTimeIntervalSetD ins4;
+ MscTimeIntervalSetD ins5;
+ MscTimeIntervalSetD ins6;
+ MscTimeIntervalSetD ins7;
+ MscTimeIntervalSetD ins8;
ins1.insert(in6);
@@ -97,10 +97,10 @@
TimeRelationEventPtr rel5 = new TimeRelationEvent(ins5);
rel5->glue_events(e0.get(),e4.get());
- MscTimeIntervalDSet i;
+ MscTimeIntervalSetD i;
i.insert(MscTimeIntervalD(0,80));
- BmscMatrixConverter conv;
+ BMscMatrixConverter conv;
conv.compute_matrix(bmsc);
std::cerr << conv.get_matrix() << std::endl;
if(conv.is_leq(e3.get(),e4.get()))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <koc...@us...> - 2009-10-04 13:35:13
|
Revision: 402
http://scstudio.svn.sourceforge.net/scstudio/?rev=402&view=rev
Author: kocianon
Date: 2009-10-04 13:35:05 +0000 (Sun, 04 Oct 2009)
Log Message:
-----------
contrain checker bugfix
Modified Paths:
--------------
trunk/src/check/time/constrain_check.cpp
trunk/src/check/time/constrain_check.h
trunk/tests/constrain_check_test.cpp
Modified: trunk/src/check/time/constrain_check.cpp
===================================================================
--- trunk/src/check/time/constrain_check.cpp 2009-10-04 12:24:21 UTC (rev 401)
+++ trunk/src/check/time/constrain_check.cpp 2009-10-04 13:35:05 UTC (rev 402)
@@ -56,7 +56,7 @@
//BOTTOM
constrain_set = n->get_time_relations_bottom();
- add_active_constrains_bottom(n);
+// add_active_constrains_bottom(n);
check_active_set(n,constrain_set);
@@ -84,7 +84,19 @@
}
+void HMscTimeConstrainChecker::on_node_finished(ReferenceNode* n)
+{
+ TimeRelationRefNodePtrSet constrains_set;
+ m_active_constrains = get_active_constrains_top(n);
+ /*
+ TimeRelationRefNodePtrSet::iterator it;
+
+ for(it=constrains_set.begin();it=constrains_set.end();it++)
+ m_active_constrains.insert(*it);
+ */
+}
+
HMscPtr HMscTimeConstrainChecker::check(HMscPtr hmsc, ChannelMapperPtr chm)
{
HMscPtr p;
@@ -92,6 +104,7 @@
traverser.add_white_node_found_listener(this);
traverser.add_gray_node_found_listener(this);
traverser.add_black_node_found_listener(this);
+ traverser.add_node_finished_listener(this);
try
{
traverser.traverse(hmsc);
Modified: trunk/src/check/time/constrain_check.h
===================================================================
--- trunk/src/check/time/constrain_check.h 2009-10-04 12:24:21 UTC (rev 401)
+++ trunk/src/check/time/constrain_check.h 2009-10-04 13:35:05 UTC (rev 402)
@@ -47,6 +47,7 @@
, public WhiteRefNodeFoundListener
, public GrayRefNodeFoundListener
, public BlackRefNodeFoundListener
+ , public RefNodeFinishedListener
{
private:
std::string m_top_constrains;
@@ -149,6 +150,8 @@
void on_black_node_found(ReferenceNode*);
+ void on_node_finished(ReferenceNode*);
+
HMscPtr process_path(const MscElementPListList& path)
{
HMscPtr p;
Modified: trunk/tests/constrain_check_test.cpp
===================================================================
--- trunk/tests/constrain_check_test.cpp 2009-10-04 12:24:21 UTC (rev 401)
+++ trunk/tests/constrain_check_test.cpp 2009-10-04 13:35:05 UTC (rev 402)
@@ -28,35 +28,27 @@
ReferenceNodePtr r1_1(new ReferenceNode());
ReferenceNodePtr r1_2(new ReferenceNode());
- ReferenceNodePtr r1_3(new ReferenceNode());
EndNodePtr end1(new EndNode());
hmsc1->add_node(r1_1);
hmsc1->add_node(r1_2);
- hmsc1->add_node(r1_3);
hmsc1->add_node(end1);
start1->add_successor(r1_1.get());
r1_1->add_successor(r1_2.get());
-// r1_1->add_successor(r1_2.get());
+ r1_1->add_successor(r1_1.get());
// r1_2->add_successor(r1_2.get());
// r1_2->add_successor(end1.get());
- r1_2->add_successor(r1_3.get());
// r1_3->add_successor(r1_2.get());
- r1_3->add_successor(end1.get());
+ r1_2->add_successor(end1.get());
r1_1->set_msc(bmsc);
r1_2->set_msc(bmsc);
- r1_3->set_msc(bmsc);
MscTimeIntervalSetD inter;
TimeRelationRefNodePtr node_relation_1 = new TimeRelationRefNode(inter);
node_relation_1->glue_ref_nodes(true,r1_1.get(),false,r1_2.get());
- TimeRelationRefNodePtr node_relation_2 = new TimeRelationRefNode(inter);
- node_relation_2->glue_ref_nodes(true,r1_2.get(),false,r1_3.get());
- TimeRelationRefNodePtr node_relation_3 = new TimeRelationRefNode(inter);
- node_relation_3->glue_ref_nodes(true,r1_1.get(),false,r1_3.get());
HMscTimeConstrainChecker constrain_checker;
ChannelMapperPtr chm;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <koc...@us...> - 2009-10-04 14:27:56
|
Revision: 403
http://scstudio.svn.sourceforge.net/scstudio/?rev=403&view=rev
Author: kocianon
Date: 2009-10-04 14:27:45 +0000 (Sun, 04 Oct 2009)
Log Message:
-----------
constrain checker bugfix
Modified Paths:
--------------
trunk/src/check/time/constrain_check.cpp
trunk/tests/constrain_check_test.cpp
Modified: trunk/src/check/time/constrain_check.cpp
===================================================================
--- trunk/src/check/time/constrain_check.cpp 2009-10-04 13:35:05 UTC (rev 402)
+++ trunk/src/check/time/constrain_check.cpp 2009-10-04 14:27:45 UTC (rev 403)
@@ -28,8 +28,10 @@
if(found_constrain==m_active_constrains.end())
{
- if(constrain->get_ref_node_b()==n)
+ if(constrain->get_ref_node_b()==n && constrain->get_ref_node_a()!=n)
+ {
throw constrain.get();
+ }
m_active_constrains.insert(constrain);
}
@@ -102,9 +104,9 @@
HMscPtr p;
DFSBMscGraphTraverser traverser;
traverser.add_white_node_found_listener(this);
- traverser.add_gray_node_found_listener(this);
- traverser.add_black_node_found_listener(this);
- traverser.add_node_finished_listener(this);
+// traverser.add_gray_node_found_listener(this);
+// traverser.add_black_node_found_listener(this);
+// traverser.add_node_finished_listener(this);
try
{
traverser.traverse(hmsc);
Modified: trunk/tests/constrain_check_test.cpp
===================================================================
--- trunk/tests/constrain_check_test.cpp 2009-10-04 13:35:05 UTC (rev 402)
+++ trunk/tests/constrain_check_test.cpp 2009-10-04 14:27:45 UTC (rev 403)
@@ -64,6 +64,39 @@
std::cerr << "OK sdfs" << std::endl;
ret = 0;
}
+ std::cerr << "################333" << std::endl;
+
+ HMscPtr hmsc2(new HMsc(L"HMsc2"));
+
+ StartNodePtr start2 = new StartNode();
+ hmsc2->set_start(start2);
+
+ ReferenceNodePtr r1(new ReferenceNode());
+
+ EndNodePtr end2(new EndNode());
+
+ hmsc2->add_node(r1);
+ hmsc2->add_node(end2);
+
+ start2->add_successor(r1.get());
+ r1->add_successor(end2.get());
+
+ TimeRelationRefNodePtr node_relation_2 = new TimeRelationRefNode(inter);
+ node_relation_2->glue_ref_nodes(false,r1.get(),true,r1.get());
+
+ HMscTimeConstrainChecker constrain_checker2;
+ HMscPtr resul = constrain_checker2.check(hmsc2,chm);
+ if(resul.get())
+ {
+ std::cerr << "3 Chyba v omezenich" << std::endl;
+ ret=1;
+ }
+ else
+ {
+ std::cerr << "3 OK sdfs" << std::endl;
+ ret = 0;
+ }
+
return ret;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <koc...@us...> - 2009-10-05 10:04:55
|
Revision: 405
http://scstudio.svn.sourceforge.net/scstudio/?rev=405&view=rev
Author: kocianon
Date: 2009-10-05 10:04:45 +0000 (Mon, 05 Oct 2009)
Log Message:
-----------
organization of time algorithms
Modified Paths:
--------------
trunk/src/check/time/CMakeLists.txt
trunk/src/check/time/time_consistency.cpp
trunk/src/check/time/time_consistency.h
trunk/src/check/time/time_pseudocode.h
trunk/src/data/msc.h
trunk/tests/bmsc_tightening_test.cpp
trunk/tests/incon_test.cpp
trunk/tests/tighten_msc_test.cpp
Added Paths:
-----------
trunk/src/check/time/tightening.cpp
trunk/src/check/time/tightening.h
trunk/src/check/time/time_pseudocode.cpp
Removed Paths:
-------------
trunk/src/check/time/bmsc_tightening.h
trunk/src/check/time/hmsc_all_paths.cpp
trunk/src/check/time/hmsc_all_paths.h
trunk/src/check/time/hmsc_tighten.cpp
trunk/src/check/time/hmsc_tighten.h
Modified: trunk/src/check/time/CMakeLists.txt
===================================================================
--- trunk/src/check/time/CMakeLists.txt 2009-10-04 14:47:38 UTC (rev 404)
+++ trunk/src/check/time/CMakeLists.txt 2009-10-05 10:04:45 UTC (rev 405)
@@ -1,16 +1,14 @@
ADD_LIBRARY(sctime SHARED
export.h
module.cpp
+ time_pseudocode.cpp
+ time_pseudocode.h
time_consistency.cpp
time_consistency.h
- bmsc_tightening.h
- hmsc_all_paths.cpp
- hmsc_all_paths.h
- hmsc_tighten.h
- hmsc_tighten.cpp
- time_pseudocode.h
- constrain_check.h
- constrain_check.cpp
+ tightening.cpp
+ tightening.h
+ constrain_check.cpp
+ constrain_check.h
)
TARGET_LINK_LIBRARIES(sctime
Deleted: trunk/src/check/time/bmsc_tightening.h
===================================================================
--- trunk/src/check/time/bmsc_tightening.h 2009-10-04 14:47:38 UTC (rev 404)
+++ trunk/src/check/time/bmsc_tightening.h 2009-10-05 10:04:45 UTC (rev 405)
@@ -1,349 +0,0 @@
-#ifndef _TIME_TIGHTENING_H_
-#define _TIME_TIGHTENING_H_
-#include "time_consistency.h"
-#include "check/pseudocode/utils.h"
-
-typedef std::pair<Event*,Event*> EventPair;
-typedef std::list<EventPair> EventPairsList;
-typedef std::pair<MscTimeIntervalSetD,IntervalSetMatrix> ConstMatrixPair;
-typedef boost::intrusive_ptr<BMscMatrixConverter*> BMscMatrixConverterPtr;
-
-/**
- * \brief tightens bMSC
- */
-class TightenBMsc
-{
-private:
- BMscMatrixConverter m_converter;
- BMscPtr m_bmsc;
- IntervalSetMatrix m_matrix;
-
- EventPList m_mins;
- EventPList m_maxs;
-
- int get_number(Event* e)
- {
- return m_converter.get_number(e);
- }
-
- bool is_leq(Event* e,Event* f)
- {
- return m_converter.is_leq(e,f);
- }
-
- EventPVector get_events()
- {
- return m_converter.get_events();
- }
-
-public:
-
- TightenBMsc(BMscPtr bmsc):m_bmsc(bmsc)
- {
- m_matrix = m_converter.compute_matrix(bmsc);
- m_mins = find_minimal_events();
- m_maxs = find_maximal_events();
- }
- /**
- * \brief
- */
- EventPList find_minimal_events()
- {
- EventPList minimals;
- EventPVector events = get_events();
- EventPVector::iterator it;
- EventPVector::iterator it_b;
-
- for(it=events.begin();it!=events.end();it++)
- {
- bool is_minimal = true;
- for(it_b=events.begin();it_b!=events.end();it_b++)
- {
- if(it_b != it && is_leq(*it_b,*it))
- {
- is_minimal =false;
- break;
- }
-
- }
- if(is_minimal)
- {
- minimals.push_back(*it);
- }
- }
- return minimals;
- }
- /**
- * \brief
- */
- EventPList find_maximal_events()
- {
- EventPList maximals;
- EventPVector events = get_events();
- EventPVector::iterator it;
- EventPVector::iterator it_b;
-
- for(it=events.begin();it!=events.end();it++)
- {
- bool is_maximal = true;
- for(it_b=events.begin();it_b!=events.end();it_b++)
- {
- if(it_b != it && is_leq(*it,*it_b)){
- is_maximal =false;
- break;
- }
-
- }
- if(is_maximal)
- {
- maximals.push_back(*it);
- }
- }
- return maximals;
- }
-
- /**
- * \brief tightens interval and matrix according to each other
- * \return pair - changed interval and matrix
- */
- ConstMatrixPair max_tightener(
- IntervalSetMatrix t_matrix,
- MscTimeIntervalSetD interval
- )
- {
-
- MscTimeIntervalSetD max_intrset;
- MscTimeIntervalSetD evts_intrset;
- max_intrset.insert(MscTimeIntervalD(0,0));
-
- EventPairsList pairs;
-
- EventPList::iterator it_min;
- EventPList::iterator it_max;
-
- // for every pair (minimal,maximal) events
- for(it_min=m_mins.begin();it_min!=m_mins.end();it_min++)
- {
- for(it_max=m_maxs.begin();it_max!=m_maxs.end();it_max++)
- {
- evts_intrset=t_matrix(get_number(*it_min),get_number(*it_max));
- max_intrset = MscTimeIntervalSetD::components_max(
- max_intrset,
- evts_intrset
- );
-
- /*
- if(!MscTimeIntervalSetD::set_intersection(interval,
- t_matrix(get_number(*it_min),get_number(*it_max))).is_empty())
- pairs.push_back(std::make_pair(*it_min,*it_max));
- */
- }
- }
-
- // assign tightened interval
- interval = MscTimeIntervalSetD::set_intersection(interval,max_intrset);
- // TODO:
- EventPVector all_events = get_events();
- EventPVector::iterator it_v;
-
- // for all a \in events
- // for all b \in a.get_next do
- for(it_v = all_events.begin();it_v!=all_events.end();it_v++)
- {
- EventPSet succs = EventFirstSuccessors::get(*it_v);
- EventPSet::iterator it_succ;
- for(it_succ=succs.begin();it_succ!=succs.end();it_succ++)
- {
- EventPList::iterator it_min_events;
- EventPList::iterator it_max_events;
- MscTimeIntervalSetD path_union;
-
- for(it_min_events=m_mins.begin();it_min_events!=m_mins.end();it_min_events++)
- {
-
- for(it_max_events=m_maxs.begin();it_max_events!=m_maxs.end();it_max_events++)
- {
- if(is_leq(*it_min_events,*it_v)&&is_leq(*it_succ,*it_max_events))
- continue;
- path_union=MscTimeIntervalSetD::set_union(path_union,
- t_matrix(get_number(*it_min_events),get_number(*it_max_events))
- );
- }
- }
-
- MscTimeIntervalSetD tight_interval;
- tight_interval = MscTimeIntervalSetD::set_union(interval,
- MscTimeIntervalSetD::zero_max_interval(path_union,interval));
-
- MscTimeIntervalSetD prefix_interval;
- prefix_interval.insert(MscTimeIntervalD(0,0));
- for(it_min_events=m_mins.begin();it_min_events!=m_mins.end();it_min_events++)
- {
- prefix_interval=MscTimeIntervalSetD::components_max(
- t_matrix(get_number(*it_min_events),get_number(*it_v)),prefix_interval);
- }
-
- MscTimeIntervalSetD suffix_interval;
- suffix_interval.insert(MscTimeIntervalD(0,0));
- for(it_max_events=m_maxs.begin();it_max_events!=m_maxs.end();it_max_events++)
- {
- suffix_interval=MscTimeIntervalSetD::components_max(
- t_matrix(get_number(*it_succ),get_number(*it_max_events)),suffix_interval);
- }
-
- //final tightening
- t_matrix(get_number(*it_v),get_number(*it_succ))=MscTimeIntervalSetD::set_intersection(t_matrix(get_number(*it_v),get_number(*it_succ)),tight_interval-prefix_interval-suffix_interval);
-
- } // end for succs
- } // end for all events
-
-/*
- bool is_on_common_path;
- EventPSet nodes_on_common_path;
- EventPVector::iterator it_v;
- EventPVector events = get_events();
-
- for(it_v = events.begin();it_v!=events.end();it_v++)
- {
- is_on_common_path=true;
- EventPairsList::iterator it_a;
- for(it_a=pairs.begin();it_a!=pairs.end();it_a++)
- {
- if(!is_leq(it_a->first,(*it_v)) || !is_leq(*it_v,it_a->second))
- {
- is_on_common_path = false;
- break;
- }
- }
-
- if(is_on_common_path)
- {
- nodes_on_common_path.insert(*it_v);
- }
- }
-
- if(nodes_on_common_path.empty())
- return std::make_pair(z,t_matrix);
-
- Event* min_random;
- Event* max_random;
-
- EventPSet::iterator it_set;
- EventPSet::iterator it_set_b;
-
- for(it_set=nodes_on_common_path.begin();it_set!=nodes_on_common_path.end();it_set++)
- {
- bool is_minimal = true;
- for(it_set_b=nodes_on_common_path.begin();it_set_b!=nodes_on_common_path.end();it_set_b++)
- {
- if(it_set_b != it_set && is_leq(*it_set_b,*it_set))
- {
- is_minimal =false;
- break;
- }
-
- }
- if(is_minimal)
- {
- min_random = *it_set;
- break;
- }
- }
-
- for(it_set=nodes_on_common_path.begin();it_set!=nodes_on_common_path.end();it_set++)
- {
- if(*it_set == min_random || is_leq(*it_set,min_random))
- continue;
- bool is_maximal = true;
- for(it_set_b=nodes_on_common_path.begin();it_set_b!=nodes_on_common_path.end();it_set_b++)
- {
- if(it_set_b != it_set && is_leq(*it_set,*it_set_b))
- {
- is_maximal =false;
- break;
- }
-
- }
- if(is_maximal)
- {
- max_random = *it_set;
- break;
- }
- }
- MscTimeIntervalSetD from_min;
- MscTimeIntervalSetD from_max;
- from_min.insert(MscTimeIntervalD(0,0));
- from_max.insert(MscTimeIntervalD(0,0));
-
- for(it_min=m_mins.begin();it_min!=m_mins.end();it_min++)
- {
- from_min = MscTimeIntervalSetD::components_max(from_min,
- t_matrix(get_number(*it_min),get_number(min_random)));
- }
-
- for(it_max=m_maxs.begin();it_max!=m_maxs.end();it_max++)
- {
- from_max = MscTimeIntervalSetD::components_max(from_max,
- t_matrix(get_number(*it_max),get_number(max_random)));
- }
-
- t_matrix(get_number(min_random),get_number(max_random))= \
- MscTimeIntervalSetD::set_intersection(
- t_matrix(get_number(min_random),get_number(max_random)),
- ((i - from_min) - from_max));
-*/
- return std::make_pair(interval,t_matrix);
- }
-
-/**
- * \brief
- */
- static MscTimeIntervalSetD tight(
- BMscPtr bmsc,
- MscTimeIntervalSetD interval)
- {
- TightenBMsc tightening(bmsc);
- ConstMatrixPair pair = tightening.tighten_msc(interval);
- tightening.modificate(pair.second);
- return pair.first;
- }
-
- void modificate(IntervalSetMatrix matrix)
- {
- m_converter.modificate(matrix);
- }
-
-
-/**
- * \brief tightens bMSC
- * \parms interval of duration of bmsc
- */
- ConstMatrixPair tighten_msc(MscTimeIntervalSetD interval)
- {
-
- MscSolveTCSP solve;
- IntervalSetMatrix old_matrix;
- IntervalSetMatrix current_matrix;
-
- // pair (MscTimeIntervalSetD,IntervalSetMatrix)
- ConstMatrixPair pair;
-
- current_matrix = m_matrix;
-
- do {
- old_matrix = current_matrix;
- // tight matrix
- current_matrix = solve.solve(current_matrix);
- // tight both matrix and interval with respect to each other
- pair = max_tightener(current_matrix,interval);
- // assign tightened interval
- interval = pair.first;
- } while (!MatrixFunc::is_equal(old_matrix,current_matrix));
-
- return pair; // tighten interval, bmsc matrix
- }
-
-}; // class TightenBMsc
-
-
-#endif // _TIME_TIGHTENING_H_
Deleted: trunk/src/check/time/hmsc_all_paths.cpp
===================================================================
--- trunk/src/check/time/hmsc_all_paths.cpp 2009-10-04 14:47:38 UTC (rev 404)
+++ trunk/src/check/time/hmsc_all_paths.cpp 2009-10-05 10:04:45 UTC (rev 405)
@@ -1,66 +0,0 @@
-#include "check/time/hmsc_all_paths.h"
-
-HMscAllPaths AllPaths::get_set_of_paths()
-{
- m_paths.clear();
- m_contains_cycle_globally=false;
- bool contains_cycle_locally = false;
- std::list<HMscNodePtr> path_prefix;
- m_nodes_set = m_hmsc->get_nodes();
-
- HMscNodePtrSet::iterator it;
- for(it=m_nodes_set.begin();it!=m_nodes_set.end();it++)
- set_number(*it,0);
-
- // TODO check origin of relation
- all_paths(m_relation->get_ref_node_a(),path_prefix,contains_cycle_locally);
-
- return std::make_pair(m_paths,m_contains_cycle_globally);
-}
-
-void AllPaths::all_paths(
-HMscNodePtr node,
-std::list<HMscNodePtr> path_prefix,
-bool contains_cycle_locally
-)
-{
- path_prefix.push_back(node);
- if(node == m_relation->get_ref_node_b())
- {
- m_paths.push_back(std::make_pair(path_prefix,contains_cycle_locally));
- }
-
- set_number(node,get_number(node)+1);
- PredecessorNode * pre;
- pre = dynamic_cast<PredecessorNode*>(node.get());
-
- if(pre == NULL)
- {
- path_prefix.pop_back();
- set_number(node, 0);
- return;
- }
-
- NodeRelationPtrSet set_succ = pre->get_successors();
- NodeRelationPtrSet::const_iterator rel;
- for(rel=set_succ.begin(); rel!=set_succ.end();rel++)
- {
- const NodeRelationPtr& node_relation = *rel;
- HMscNodePtr new_node(dynamic_cast<HMscNode*>(node_relation.get()->get_successor()));
- if(get_number(new_node)<=1)
- {
- bool contains_cycle_locally_new = contains_cycle_locally;
- if(get_number(new_node)==1)
- {
- contains_cycle_locally_new = true;
- m_contains_cycle_globally = true;
- }
- all_paths(new_node,path_prefix, contains_cycle_locally_new);
-
- }
-
- }
- path_prefix.pop_back();
- set_number(node, get_number(node)-1);
- return;
-}
Deleted: trunk/src/check/time/hmsc_all_paths.h
===================================================================
--- trunk/src/check/time/hmsc_all_paths.h 2009-10-04 14:47:38 UTC (rev 404)
+++ trunk/src/check/time/hmsc_all_paths.h 2009-10-05 10:04:45 UTC (rev 405)
@@ -1,63 +0,0 @@
-#ifndef _AllPaths_
-#define _AllPaths_
-
-#include "check/time/time_consistency.h"
-
-
-typedef std::pair<std::list<HMscNodePtr>,bool> HMscPath;
-typedef std::pair<std::list<HMscPath>,bool> HMscAllPaths;
-class AllPaths
-{
-private:
- HMscNodePtrSet m_nodes_set;
- std::string m_number;
- bool m_contains_cycle_globally;
- TimeRelationRefNodePtr m_relation;
- HMscPtr m_hmsc;
- std::list<HMscPath> m_paths;
-public:
- AllPaths(HMscPtr hmsc, TimeRelationRefNodePtr relation,
- const std::string& number="AllPathAlg")
- :m_hmsc(hmsc),m_relation(relation),m_number(number)
- {
-
- }
-
- ~AllPaths()
- {
- cleanup_attributes();
- }
-
- void set_number(HMscNodePtr e,int number)
- {
- return e->set_attribute<int>(m_number,number);
- }
-
- int get_number(HMscNodePtr e)
- {
- return e->get_attribute<int>(m_number,0);
- }
-
- void cleanup_attributes()
- {
- HMscNodePtrSet::iterator node;
- for(node=m_nodes_set.begin();node!=m_nodes_set.end();node++)
- (*node)->remove_attribute<int>(m_number);
- }
-
-
- static HMscAllPaths get_all_paths(
- HMscPtr hmsc,
- TimeRelationRefNodePtr relation
- )
- {
- AllPaths allpaths(hmsc,relation);
- return allpaths.get_set_of_paths();
- }
-
- HMscAllPaths get_set_of_paths();
-
- void all_paths(HMscNodePtr, std::list<HMscNodePtr>, bool);
-
-};
-#endif
Deleted: trunk/src/check/time/hmsc_tighten.cpp
===================================================================
--- trunk/src/check/time/hmsc_tighten.cpp 2009-10-04 14:47:38 UTC (rev 404)
+++ trunk/src/check/time/hmsc_tighten.cpp 2009-10-05 10:04:45 UTC (rev 405)
@@ -1 +0,0 @@
-#include "check/time/hmsc_tighten.h"
Deleted: trunk/src/check/time/hmsc_tighten.h
===================================================================
--- trunk/src/check/time/hmsc_tighten.h 2009-10-04 14:47:38 UTC (rev 404)
+++ trunk/src/check/time/hmsc_tighten.h 2009-10-05 10:04:45 UTC (rev 405)
@@ -1,296 +0,0 @@
-#include "check/time/time_consistency.h"
-#include "check/pseudocode/msc_duplicators.h"
-#include "check/time/hmsc_all_paths.h"
-#include "check/time/bmsc_tightening.h"
-
-//typedef std::pair<std::list<HMscNodePtr>,bool> HMscPath;
-//typedef std::pair<std::list<HMscPath>,bool> HMscAllPaths;
-typedef std::list<HMscNodePtr> HMscNodePtrList;
-
-class TightenSetOfPaths
-{
-private:
-// std::set<BMscPtr> m_bmsc_on_path_set;
-// std::set<BMscPtr> m_bmsc_all_set;
- std::set<BMscPtr> m_bmsc_copy1;
- std::set<BMscPtr> m_bmsc_copy2;
-
- std::list<BMscPtr> m_msc_list;
- std::list<TimeRelationRefNodePtr> m_constr;
- IntervalSetMatrix m_t;
- BMscPtr m_msc;
- MscTimeIntervalSetD i_prime_prime;
-public:
-// HMscAllPaths
-/*
- BMscPtr return_inner_bmsc(HmscNodePtr node)
- {
-
- }
-*/
- MscTimeIntervalSetD tighten(
- HMscAllPaths paths,
- MscTimeIntervalSetD i,
- HMscPtr hmsc
- )
- {
-
-
- //initialization of both copies
- BMscDuplicator bmsc_duplicator_1;
- std::list<HMscPath>::iterator it;
- for(it=paths.first.begin();it!=paths.first.end();it++)
- {
- std::list<HMscNodePtr>::iterator node;
- for(node=(*it).first.begin();node!=(*it).first.end();node++)
- {
- ReferenceNode* ref_node = dynamic_cast<ReferenceNode*>((*node).get());
- BMscPtr bmsc_ptr = ref_node->get_bmsc();
- m_bmsc_copy1.insert(bmsc_duplicator_1.duplicate_bmsc(bmsc_ptr)); //in case that on paths are reference nodes only
- }
- }
-
- BMscDuplicator bmsc_duplicator_2;
- HMscNodePtrSet all_nodes = hmsc->get_nodes();
- HMscNodePtrSet::iterator hmsc_node;
- for(hmsc_node=all_nodes.begin();hmsc_node!=all_nodes.end();hmsc_node++)
- {
- ReferenceNode* ref_node = dynamic_cast<ReferenceNode*>((*hmsc_node).get());
- if(!ref_node)
- continue;
- BMscPtr bmsc = ref_node->get_bmsc();
- if(!bmsc)
- continue;
- m_bmsc_copy2.insert(bmsc_duplicator_2.duplicate_bmsc(bmsc));
- }
-
-
-
- // std::list<HMscPath>::iterator it;
- for(it=paths.first.begin();it!=paths.first.end();it++)
- {
-
- if(!(*it).second)
- {
- m_msc_list.clear();
- m_constr.clear();
- HMscNodePtrList::iterator n_path;
- HMscNodePtrList::iterator n_path_previous;
- n_path = it->first.begin();
- ReferenceNode* ref_node = dynamic_cast<ReferenceNode*>((*n_path).get());
- BMscPtr from_node = ref_node->get_bmsc();
- if(from_node)
- m_msc = from_node;
- n_path_previous = n_path;
- n_path++;
- for(;n_path!=it->first.end();n_path++)
- {
- n_path_previous++;
- ReferenceNode* ref_node = dynamic_cast<ReferenceNode*>((*n_path).get());
- if(!ref_node)
- continue;
-
- TimeRelationRefNodePtrSet constr_set = ref_node->get_time_relations_top();
- TimeRelationRefNodePtrSet::iterator it_c;
- bool has_constraint = false;
- for(it_c=constr_set.begin();it_c!=constr_set.end();it_c++)
- {
- if((*it_c)->get_ref_node_b() == (*n_path_previous).get() ) //Warning: we assume that nodes in time relation ref node are ordered
- {
- has_constraint = true;
- break;
- }
-
- }
- if(has_constraint)
- {
- m_constr.push_back(*it_c);
- m_msc_list.push_back(m_msc);
-
- ReferenceNode* ref_node = dynamic_cast<ReferenceNode*>((*n_path).get());
- BMscPtr from_node = ref_node->get_bmsc();
- if(from_node)
- m_msc = from_node;
-
- }
- else
- {
- BMscPtr msc_tmp;
- ReferenceNode* ref_node = dynamic_cast<ReferenceNode*>((*n_path).get());
- BMscPtr from_node = ref_node->get_bmsc();
- if(from_node)
- msc_tmp = from_node;
-
-// m_msc = concatenate(m_msc, msc_tmp); //TODO:concatenation
- }
-
- }
-
-
-
- ConstMatrixPair pair;
- if(m_msc_list.empty())
- {
- TightenBMsc tighten_msc(m_msc);
- pair = tighten_msc.tighten_msc(i);
- m_t = pair.second;
- i_prime_prime = MscTimeIntervalSetD::set_intersection(i_prime_prime,pair.first);
- }
- else
- {
- m_msc_list.push_back(m_msc);
- MscTimeIntervalSetD i_prime_prime_prime;
-// TightenMsgPath tighten_msg_path(m_msc_list); //TODO: MSG PATH
- i_prime_prime_prime = tighten_msg_path(m_msc_list,m_constr,i);
-
- i_prime_prime = MscTimeIntervalSetD::set_intersection(i_prime_prime,pair.first);
- }
- }
-
-
- HMscNodePtrList::iterator path_it;
-
- for(path_it = it->first.begin(); path_it!= it->first.end(); path_it++)
- {
- //TODO:write get_all_constraints
- std::set<TimeRelationEventPtr> constraints;
-// constraints = get_all_constraints(*path_it);
- std::set<TimeRelationEventPtr>::iterator tr_it;
- for(tr_it = constraints.begin(); tr_it != constraints.end(); tr_it++)
- {
- TimeRelationEvent* relation_copy = dynamic_cast<TimeRelationEvent*>(bmsc_duplicator_1.get_copy((*tr_it).get()));
- MscTimeIntervalSetD interval_set = MscTimeIntervalSetD::set_union(relation_copy->get_interval_set(), (*tr_it)->get_interval_set());
- relation_copy->set_interval_set(interval_set);
-
- }
- }
-
- //TODO:upravit nakopirovat povodne obmedzenia naspat
-// m_bmsc_all_set = m_bmsc_copy2;
- for(path_it = it->first.begin(); path_it!= it->first.end(); path_it++)
- {
- //TODO:write get_all_constraints
- std::set<TimeRelationEventPtr> constraints;
-// constraints = get_all_constraints(*path_it);
- std::set<TimeRelationEventPtr>::iterator tr_it;
- for(tr_it = constraints.begin(); tr_it != constraints.end(); tr_it++)
- {
-
- //TODO:upravit
- TimeRelationEvent* relation_copy = dynamic_cast<TimeRelationEvent*>(bmsc_duplicator_2.get_copy((*tr_it).get()));
- (*tr_it)->set_interval_set(relation_copy->get_interval_set());
-
- }
- }
- }
-
-
- std::set<BMscPtr>::iterator b_it2;
- for(b_it2 = m_bmsc_copy2.begin(); b_it2!= m_bmsc_copy2.end(); b_it2++)
- {
- //TODO:write get_all_constraints
- std::set<TimeRelationEventPtr> constraints;
-// constraints = get_all_constraints(*b_it);
- std::set<TimeRelationEventPtr>::iterator tr_it2;
-
- for(tr_it2 = constraints.begin(); tr_it2 != constraints.end(); tr_it2++)
- {
- TimeRelationEvent* relation_copy = dynamic_cast<TimeRelationEvent*>((*tr_it2)->get_original());
-
- //TODO:upravit
- relation_copy->set_interval_set((*tr_it2)->get_interval_set());
-
- }
-
- }
-
- return i_prime_prime;
-
- }
-
- MscTimeIntervalSetD tighten_msg_path(
- std::list<BMscPtr> list_bmsc,
- std::list<TimeRelationRefNodePtr> constr,
- MscTimeIntervalSetD interval
- )
- {
- MscTimeIntervalSetD tmp_interval(interval);
- std::vector<MscTimeIntervalSetD> durations;
- for(size_t i=0;i<list_bmsc.size();i++)
- {
- MscTimeIntervalSetD tmp;
-
- tmp.insert(MscTimeIntervalD(0,D::infinity()));
- durations.push_back(tmp);
- }
-
- MscTimeIntervalSetD s_interval;
- do {
- s_interval = tmp_interval;
- std::list<BMscPtr>::iterator bmsc;
-
- int i=0;
- for(bmsc=list_bmsc.begin();bmsc!=list_bmsc.end();bmsc++,i++)
- {
- MscTimeIntervalSetD tmp_i=tmp_interval;
- for(size_t j=0;j<list_bmsc.size();j++)
- {
- if(i==j)
- continue;
- tmp_i = tmp_i - durations[j];
- }
- std::list<TimeRelationRefNodePtr>::iterator c_it;
- for(c_it=constr.begin();c_it!=constr.end();c_it++)
- tmp_i = tmp_i - (*c_it)->get_interval_set();
-
- durations[i]=TightenBMsc::tight(*bmsc,MscTimeIntervalSetD::set_intersection(tmp_i,durations[i]));
- }
- MscTimeIntervalSetD interval_set;
-
- std::list<TimeRelationRefNodePtr>::iterator c_it2;
- for(c_it2=constr.begin();c_it2!=constr.end();c_it2++)
- {
- interval_set = (*c_it2)->get_interval_set();
- MscTimeIntervalSetD tmp_i=tmp_interval;
- for(size_t j=0;j<list_bmsc.size();j++)
- {
- tmp_i = tmp_i - durations[j];
- }
- interval_set = (*c_it2)->get_interval_set();
- std::list<TimeRelationRefNodePtr>::iterator c_it;
- for(c_it=constr.begin();c_it!=constr.end();c_it++)
- {
- interval_set = (*c_it2)->get_interval_set();
- if(*c_it==*c_it2)
- continue;
- tmp_i = tmp_i - (*c_it)->get_interval_set();
- }
- interval_set = (*c_it2)->get_interval_set();
- (*c_it2)->set_interval_set(MscTimeIntervalSetD::set_intersection((*c_it2)->get_interval_set(),tmp_i));
- interval_set = (*c_it2)->get_interval_set();
- }
-
- MscTimeIntervalSetD tmp;
- tmp.insert(MscTimeIntervalD(0,0));
-
- for(size_t j=0;j<list_bmsc.size();j++)
- {
- tmp = tmp + durations[j];
- }
-
- std::list<TimeRelationRefNodePtr>::iterator c_it;
- for(c_it=constr.begin();c_it!=constr.end();c_it++)
- {
- MscTimeIntervalSetD uu = (*c_it)->get_interval_set();
- tmp = uu + tmp;
- }
-
- tmp_interval = MscTimeIntervalSetD::set_intersection(tmp_interval,tmp);
-
- } while(s_interval!=tmp_interval);
-
- return tmp_interval;
- }
-
-};
-
Added: trunk/src/check/time/tightening.cpp
===================================================================
--- trunk/src/check/time/tightening.cpp (rev 0)
+++ trunk/src/check/time/tightening.cpp 2009-10-05 10:04:45 UTC (rev 405)
@@ -0,0 +1,136 @@
+#include "tightening.h"
+
+void MscSolveTCSP::forward(IntervalMatrix matrix,int i, int j)
+{
+ int new_j;
+ int new_i;
+ DEBUG_(i,j);
+ if((matrix.size1()==(unsigned)(i+1)) && (matrix.size1()==(unsigned)(j+1)))
+ {
+ IntervalMatrix tmp = tightener->tight(matrix);
+ for(unsigned g=0;g<matrix.size1();g++)
+ for(unsigned h=0;h<matrix.size2();h++)
+ m_result_matrix(g,h).insert(tmp(g,h));
+ go_back(matrix,i,j);
+ }
+ else
+ {
+ std::list<MscTimeIntervalD> interval_list;
+ if((unsigned)(j+1)==matrix.size1())
+ {
+ new_i = i+1;
+ new_j = new_i;
+ }
+ else
+ {
+ new_j = j+1;
+ new_i =i;
+ }
+ IntervalList list = m_solve_matrix(new_i,new_j).get_set();
+ IntervalList::iterator it;
+ for(it=list.begin();it!=list.end();it++)
+ {
+ IntervalMatrixFunc::fill_matrix(matrix,*it,(unsigned)new_i,(unsigned)new_j);
+ if(con_checker->check_consistency(matrix))
+ m_to_go_matrix(new_i,new_j).insert(*it);
+
+ }
+ DEBUG(m_to_go_matrix);
+ IntervalList& to_go = m_to_go_matrix(new_i,new_j).get_set();
+ if(!to_go.empty())
+ {
+ DEBUG(m_to_go_matrix(new_i,new_j).get_set().size());
+ MscTimeIntervalD tmp = to_go.front();
+ to_go.pop_front();
+ DEBUG(m_to_go_matrix(new_i,new_j).get_set().size());
+ DEBUG(to_go.size());
+
+
+ matrix(new_i,new_j) = tmp;
+ matrix(new_j,new_i) = MscTimeIntervalD::interval_inverse(tmp);
+
+ forward(matrix,new_i,new_j);
+ }
+ else
+ {
+ matrix(new_i,new_j) = MscTimeIntervalD(-D::infinity(),D::infinity());
+ matrix(new_j,new_i) = MscTimeIntervalD(-D::infinity(),D::infinity());
+ go_back(matrix,i,j);
+ }
+ }
+}
+
+void MscSolveTCSP::go_back(IntervalMatrix matrix,int i,int j)
+{
+ DEBUG_(i,j);
+ if(i==-1){
+ DEBUG(m_result_matrix);
+ return;
+ }
+ IntervalList& to_go = m_to_go_matrix(i,j).get_set();
+ if(!to_go.empty())
+ {
+ DEBUG(m_to_go_matrix(i,j).get_set().size());
+ MscTimeIntervalD tmp = to_go.front();
+ to_go.pop_front();
+ DEBUG(m_to_go_matrix(i,j).get_set().size());
+ DEBUG(to_go.size());
+
+ matrix(i,j) = tmp;
+ matrix(j,i) = MscTimeIntervalD::interval_inverse(tmp);
+ forward(matrix,i,j);
+ }
+ else
+ {
+ matrix(i,j) = MscTimeIntervalD(-D::infinity(),D::infinity());
+ matrix(j,i) = MscTimeIntervalD(-D::infinity(),D::infinity());
+ if(i==j)
+ {
+ i--;
+ j = matrix.size1()-1;
+ }
+ else
+ {
+ j--;
+ }
+ go_back(matrix,i,j);
+ }
+}
+
+void MscSolveTCSP::init(unsigned size)
+{
+ m_result_matrix.resize(size,size);
+ m_to_go_matrix.resize(size,size);
+
+ for(unsigned i=0;i<size;i++)
+ {
+ for(unsigned j=0;j<size;j++)
+ {
+ m_result_matrix(i,j)=MscTimeIntervalSetD();
+ m_to_go_matrix(i,j)=MscTimeIntervalSetD();
+ }
+ }
+}
+
+IntervalSetMatrix MscSolveTCSP::solve(const IntervalSetMatrix& m)
+{
+ init(m.size1());
+ m_solve_matrix=m;
+ IntervalMatrix matrix(m_solve_matrix.size1(),m_solve_matrix.size2());
+ for(unsigned i=0;i<m_solve_matrix.size1();i++)
+ {
+ for(unsigned j=0;j<m_solve_matrix.size2();j++){
+ if(i==j)
+ matrix(i,j) = MscTimeIntervalD(0,0);
+ else
+ matrix(i,j)=MscTimeIntervalD(-D::infinity(),D::infinity());
+
+ }
+ }
+ DEBUG(m_solve_matrix);
+ forward(matrix,0,-1);
+
+ return m_result_matrix;
+}
+
+//////////////////////////////////////////////////////////////////
Added: trunk/src/check/time/tightening.h
===================================================================
--- trunk/src/check/time/tightening.h (rev 0)
+++ trunk/src/check/time/tightening.h 2009-10-05 10:04:45 UTC (rev 405)
@@ -0,0 +1,712 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2009
+ *
+ * $Id:
+ */
+
+#ifndef _TIGHTENING_H_
+#define _TIGHTENING_H_
+
+#include "time_consistency.h"
+#include "time_pseudocode.h"
+#include "check/pseudocode/msc_duplicators.h"
+#include "data/transformer.h"
+/*
+class SCTIME_EXPORT GreatTighter:public Transformer, public BMscTransformer
+{
+ virtual ~Transformer() {}
+
+ //! Human readable name of the transformation.
+ virtual std::string get_name()
+ {
+ return std::string("Great Tigher");
+ }
+
+ //! List of properties that must be satisfied before executing the transformation.
+ typedef std::vector<PrerequisiteCheck> PreconditionList;
+
+ //! Returns a list of preconditions for this transformation.
+ virtual PreconditionList get_preconditions(MscPtr msc) const = 0;
+
+ virtual BMscPtr transform(BMscPtr bmsc)
+{
+
+
+}
+
+
+};
+*/
+
+class SCTIME_EXPORT MscSolveTCSP
+{
+private:
+ MscIntervalTightener* tightener;
+ MscIntervalConsistencyCheck* con_checker;
+ IntervalSetMatrix m_solve_matrix;
+ IntervalSetMatrix m_result_matrix;
+ IntervalSetMatrix m_t...
[truncated message content] |
|
From: <ma...@us...> - 2009-10-05 22:55:18
|
Revision: 406
http://scstudio.svn.sourceforge.net/scstudio/?rev=406&view=rev
Author: madzin
Date: 2009-10-05 22:55:10 +0000 (Mon, 05 Oct 2009)
Log Message:
-----------
Fix bug with time intervals to nonexisted node.
Add recognition of origin keyword
New time tests for parser
Modified Paths:
--------------
trunk/src/data/Z120/Context.cpp
trunk/src/data/Z120/Context.h
trunk/src/data/Z120/Context_Impl.h
trunk/src/data/Z120/Z120.g
trunk/tests/z120_test/CMakeLists.txt
trunk/tests/z120_test/z120_time02.mpr
trunk/tests/z120_test/z120_time02.mpr.result
trunk/tests/z120_test/z120_time06.mpr.result
Added Paths:
-----------
trunk/tests/z120_test/z120_time07.mpr
trunk/tests/z120_test/z120_time08.mpr
trunk/tests/z120_test/z120_time09.mpr
trunk/tests/z120_test/z120_time09.mpr.result
trunk/tests/z120_test/z120_time10.mpr
trunk/tests/z120_test/z120_time11.mpr
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2009-10-05 10:04:45 UTC (rev 405)
+++ trunk/src/data/Z120/Context.cpp 2009-10-05 22:55:10 UTC (rev 406)
@@ -78,6 +78,7 @@
context->future_bottom_time_relations.clear();
context->future_top_time_relations.clear();
context->not_connect = 0;
+ context->origin = false;
}
/*
@@ -289,7 +290,12 @@
context->time = time;
}
+void set_origin_fun(struct Context* context)
+{
+ context->origin = true;
+}
+
/*
* Create new BMsc structure
*/
@@ -675,6 +681,8 @@
try
{
relation = new TimeRelationEvent(MscTimeIntervalSet<double>(context->time));
+ relation->set_directed(context->origin);
+ context->origin = false;
}
catch(std::exception &exc)
{
@@ -713,6 +721,7 @@
void set_time_reference_event_fun(struct Context* context, char* name)
{
context->time_event_name = name;
+ context->time_relation_type = unknown;
}
void create_future_time_relations(struct Context* context)
@@ -849,7 +858,7 @@
if(top_it != context->future_top_time_relations.end())
{
std::set<TimeRelationRefNodePtr>::iterator set_it;
-
+
for(set_it = top_it->second.begin(); set_it != top_it->second.end(); ++set_it)
{
(*set_it)->glue_ref_node_b(false, node.get());
@@ -867,7 +876,7 @@
(*set_it)->glue_ref_node_b(true, node.get());
}
- context->future_bottom_time_relations.erase(top_it);
+ context->future_bottom_time_relations.erase(bottom_it);
}
}
else
@@ -1085,10 +1094,19 @@
*/
void add_time_relation_ref_fun(struct Context* context, enum time_relation_kind kind)
{
+ if(context->time_relation_type == unknown)
+ {
+ context->z->print_report(RS_WARNING, stringize() << "Warning 25: Time definition in " << TOWSTRING(context->element_name) << " has only one connection point");
+ context->time_relation_type = kind;
+ context->time_node_name = context->time_event_name;
+ }
+
TimeRelationRefNodePtr relation;
try
{
relation = new TimeRelationRefNode(MscTimeIntervalSet<double>(context->time));
+ relation->set_directed(context->origin);
+ context->origin = false;
}
catch(std::exception &exc)
{
@@ -1122,6 +1140,8 @@
}
else
{
+ relation->glue_ref_node_a(kind == bottom, node.get());
+
if(context->time_relation_type == top)
{
std::map<std::string, std::set<TimeRelationRefNodePtr> >::iterator top_it;
@@ -1151,7 +1171,9 @@
bottom_it->second.insert(relation);
}
}
- }
+ }
+
+ context->time_relation_type = unknown;
}
#endif
Modified: trunk/src/data/Z120/Context.h
===================================================================
--- trunk/src/data/Z120/Context.h 2009-10-05 10:04:45 UTC (rev 405)
+++ trunk/src/data/Z120/Context.h 2009-10-05 22:55:10 UTC (rev 406)
@@ -34,7 +34,7 @@
enum msg_kind {output, input};
enum relation_kind {before, after};
-enum time_relation_kind {top, bottom};
+enum time_relation_kind {top, bottom, unknown};
void my_print(char* a);
@@ -60,6 +60,8 @@
void add_time_fun(struct Context* context, char* time);
+void set_origin_fun(struct Context* context);
+
//BMsc
void new_bmsc_fun(struct Context* context);
Modified: trunk/src/data/Z120/Context_Impl.h
===================================================================
--- trunk/src/data/Z120/Context_Impl.h 2009-10-05 10:04:45 UTC (rev 405)
+++ trunk/src/data/Z120/Context_Impl.h 2009-10-05 22:55:10 UTC (rev 406)
@@ -61,6 +61,7 @@
*/
std::string interval_label;
std::string time;
+ bool origin;
/*
* BMsc
Modified: trunk/src/data/Z120/Z120.g
===================================================================
--- trunk/src/data/Z120/Z120.g 2009-10-05 10:04:45 UTC (rev 405)
+++ trunk/src/data/Z120/Z120.g 2009-10-05 22:55:10 UTC (rev 406)
@@ -428,7 +428,7 @@
;
time_dest_list:
- (time_dest ('origin')?)?
+ (time_dest ('origin' { set_origin_fun(context); } )?)?
time_interval (',' time_dest_list)?
;
Modified: trunk/tests/z120_test/CMakeLists.txt
===================================================================
--- trunk/tests/z120_test/CMakeLists.txt 2009-10-05 10:04:45 UTC (rev 405)
+++ trunk/tests/z120_test/CMakeLists.txt 2009-10-05 22:55:10 UTC (rev 406)
@@ -93,6 +93,11 @@
ADD_Z120_TEST(z120_time04.mpr 1)
ADD_Z120_TEST(z120_time05.mpr 1)
ADD_Z120_TEST(z120_time06.mpr 1)
+ADD_Z120_TEST(z120_time07.mpr 1)
+ADD_Z120_TEST(z120_time08.mpr 1)
+ADD_Z120_TEST(z120_time09.mpr 1)
+ADD_Z120_TEST(z120_time10.mpr 1)
+ADD_Z120_TEST(z120_time11.mpr 1)
# $Id$
Modified: trunk/tests/z120_test/z120_time02.mpr
===================================================================
--- trunk/tests/z120_test/z120_time02.mpr 2009-10-05 10:04:45 UTC (rev 405)
+++ trunk/tests/z120_test/z120_time02.mpr 2009-10-05 22:55:10 UTC (rev 406)
@@ -1,4 +1,4 @@
-/* Basic time constraints in both MSC and HMSC
+/* L2 has time interval with only one connection point definition.
*/
mscdocument z120_time01;
msc Main;
Modified: trunk/tests/z120_test/z120_time02.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time02.mpr.result 2009-10-05 10:04:45 UTC (rev 405)
+++ trunk/tests/z120_test/z120_time02.mpr.result 2009-10-05 22:55:10 UTC (rev 406)
@@ -1,3 +1,4 @@
+Warning 25: Time definition in L2 has only one connection point
OK: z120_time02 is correct, should be correct
mscdocument z120_time02;
@@ -5,7 +6,8 @@
initial connect L0;
L0: connect L1, L2;
L1: reference Subprocess connect L3;
-L2: reference Subprocesstime (1,10);
+L2: reference Subprocess time (1,2);
+ top top L1 (1,10);
connect L1;
L3: final;
endmsc;
@@ -14,15 +16,21 @@
inst P2;
P1: instance;
out NAME,0 to P2;
+label e0;
out NAME,1 to P2;
+time e1 [7];
+label e1;
in NAME,2 from P2;
endinstance;
P2: instance;
concurrent;
-in NAME,0 from P1 before e0;
-label e0;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
in NAME,1 from P1;
endconcurrent;
+label e4;
out NAME,2 to P1;
endinstance;
endmsc;
Modified: trunk/tests/z120_test/z120_time06.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time06.mpr.result 2009-10-05 10:04:45 UTC (rev 405)
+++ trunk/tests/z120_test/z120_time06.mpr.result 2009-10-05 22:55:10 UTC (rev 406)
@@ -1,4 +1,4 @@
-OK: z120_time05 is correct, should be correct
+OK: z120_time06 is correct, should be correct
mscdocument z120_time06;
msc Process;
Added: trunk/tests/z120_test/z120_time07.mpr
===================================================================
--- trunk/tests/z120_test/z120_time07.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time07.mpr 2009-10-05 22:55:10 UTC (rev 406)
@@ -0,0 +1,36 @@
+/* Two times definition of time interval for L2 with connection point to top.
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+top top L2 [3];
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time08.mpr
===================================================================
--- trunk/tests/z120_test/z120_time08.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time08.mpr 2009-10-05 22:55:10 UTC (rev 406)
@@ -0,0 +1,36 @@
+/* Definition of time interval to the same node. L2: ... bottom top L2;
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+bottom top L2 [3];
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time09.mpr
===================================================================
--- trunk/tests/z120_test/z120_time09.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time09.mpr 2009-10-05 22:55:10 UTC (rev 406)
@@ -0,0 +1,36 @@
+/* Two time intervals to L1
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+bottom top L1 [3];
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time09.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time09.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time09.mpr.result 2009-10-05 22:55:10 UTC (rev 406)
@@ -0,0 +1,36 @@
+OK: z120_time09 is correct, should be correct
+
+mscdocument z120_time09;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ bottom top L1 [3];
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time10.mpr
===================================================================
--- trunk/tests/z120_test/z120_time10.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time10.mpr 2009-10-05 22:55:10 UTC (rev 406)
@@ -0,0 +1,36 @@
+/* First definition of bottom interval and then top interval (L2)
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+bottom top L1 [3];
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time11.mpr
===================================================================
--- trunk/tests/z120_test/z120_time11.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time11.mpr 2009-10-05 22:55:10 UTC (rev 406)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3, L4;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10), top L4 [2,4];
+connect L1;
+L4: reference Fish connect L3;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2009-10-10 15:00:40
|
Revision: 414
http://scstudio.svn.sourceforge.net/scstudio/?rev=414&view=rev
Author: gotthardp
Date: 2009-10-10 15:00:30 +0000 (Sat, 10 Oct 2009)
Log Message:
-----------
Fixed documentation CSS.
Modified Paths:
--------------
trunk/doc/help/CMakeLists.txt
trunk/doc/help/algorithms.html
trunk/doc/help/help.css
trunk/doc/help/scstudio.hhc
trunk/doc/help/scstudio.hhp
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/scstudio.nsi
Modified: trunk/doc/help/CMakeLists.txt
===================================================================
--- trunk/doc/help/CMakeLists.txt 2009-10-08 21:09:37 UTC (rev 413)
+++ trunk/doc/help/CMakeLists.txt 2009-10-10 15:00:30 UTC (rev 414)
@@ -11,7 +11,7 @@
help.css
algorithms.html
localChoice/localchoice.html
- membership/membership_documentation.html
+ membership/membership.html
fifo/fifo.html
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
Modified: trunk/doc/help/algorithms.html
===================================================================
--- trunk/doc/help/algorithms.html 2009-10-08 21:09:37 UTC (rev 413)
+++ trunk/doc/help/algorithms.html 2009-10-10 15:00:30 UTC (rev 414)
@@ -9,7 +9,7 @@
<li><a href="acyclic/acyclic.html">Acyclic property</a></li>
<li><a href="fifo/fifo.html">FIFO property</a></li>
<li><a href="localchoice/localchoice.html">Nonlocal Choice</a></li>
-<li><a href="membership/membership_documentation.html">Membership</a></li>
+<li><a href="membership/membership.html">Membership</a></li>
</ul>
</body>
</html>
Modified: trunk/doc/help/help.css
===================================================================
--- trunk/doc/help/help.css 2009-10-08 21:09:37 UTC (rev 413)
+++ trunk/doc/help/help.css 2009-10-10 15:00:30 UTC (rev 414)
@@ -3,6 +3,10 @@
font-size: 0.7em;
color: #000000;
}
+p {
+ margin-top: 0em;
+ margin-bottom: 0.7em;
+}
h1 {
font-size: 1.2em;
}
@@ -12,3 +16,6 @@
h3 {
font-size: 1.0em;
}
+caption {
+ font-size: 0.7em;
+}
\ No newline at end of file
Modified: trunk/doc/help/scstudio.hhc
===================================================================
--- trunk/doc/help/scstudio.hhc 2009-10-08 21:09:37 UTC (rev 413)
+++ trunk/doc/help/scstudio.hhc 2009-10-10 15:00:30 UTC (rev 414)
@@ -27,7 +27,7 @@
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Membership">
- <param name="Local" value="membership\membership_documentation.html">
+ <param name="Local" value="membership\membership.html">
</OBJECT>
</UL>
</UL>
Modified: trunk/doc/help/scstudio.hhp
===================================================================
--- trunk/doc/help/scstudio.hhp 2009-10-08 21:09:37 UTC (rev 413)
+++ trunk/doc/help/scstudio.hhp 2009-10-10 15:00:30 UTC (rev 414)
@@ -2,6 +2,7 @@
Compatibility=1.1 or later
Compiled file=scstudio.chm
Contents file=scstudio.hhc
+Default topic=algorithms.html
Display compile progress=No
Language=0x409 Angli\xE8tina (Spojen\xE9 st\xE1ty)
Title=Sequence Chart Studio
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2009-10-08 21:09:37 UTC (rev 413)
+++ trunk/src/view/visio/addon/dllmodule.rc 2009-10-10 15:00:30 UTC (rev 414)
@@ -89,8 +89,8 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,3,14,0
- PRODUCTVERSION 0,3,14,0
+ FILEVERSION 0,3,15,0
+ PRODUCTVERSION 0,3,15,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x9L
@@ -107,13 +107,13 @@
BEGIN
VALUE "CompanyName", "Masaryk University Brno"
VALUE "FileDescription", "Microsoft Visio add-on for design and verification of Message Sequence Charts (MSC)."
- VALUE "FileVersion", "0.3.14"
+ VALUE "FileVersion", "0.3.15"
VALUE "InternalName", "scstudio.vsl"
VALUE "LegalCopyright", "(c) Petr Gotthard. All rights reserved."
VALUE "OriginalFilename", "scstudio.vsl"
VALUE "PrivateBuild", "$Revision$"
VALUE "ProductName", "Sequence Chart Studio"
- VALUE "ProductVersion", "0.3.14"
+ VALUE "ProductVersion", "0.3.15"
END
END
BLOCK "VarFileInfo"
Modified: trunk/src/view/visio/scstudio.nsi
===================================================================
--- trunk/src/view/visio/scstudio.nsi 2009-10-08 21:09:37 UTC (rev 413)
+++ trunk/src/view/visio/scstudio.nsi 2009-10-10 15:00:30 UTC (rev 414)
@@ -10,7 +10,7 @@
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
; Lesser General Public License for more details.
;
-; Copyright (c) 2008 Petr Gotthard <pet...@ce...>
+; Copyright (c) 2008-2009 Petr Gotthard <pet...@ce...>
;
; $Id$
@@ -21,7 +21,7 @@
; -- General ---------------------------
-!define VERSION "0.3.14"
+!define VERSION "0.3.15"
Name "Sequence Chart Studio"
OutFile "scstudio-setup-${VERSION}.exe"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2009-10-10 20:22:48
|
Revision: 415
http://scstudio.svn.sourceforge.net/scstudio/?rev=415&view=rev
Author: madzin
Date: 2009-10-10 20:22:38 +0000 (Sat, 10 Oct 2009)
Log Message:
-----------
Add multiple time intervals for one connection point
Modified Paths:
--------------
trunk/src/data/Z120/Context.cpp
trunk/src/data/Z120/Context.h
trunk/src/data/Z120/Context_Impl.h
trunk/src/data/Z120/Z120.g
trunk/tests/z120_test/CMakeLists.txt
Added Paths:
-----------
trunk/tests/z120_test/z120_time12.mpr
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2009-10-10 15:00:30 UTC (rev 414)
+++ trunk/src/data/Z120/Context.cpp 2009-10-10 20:22:38 UTC (rev 415)
@@ -79,6 +79,10 @@
context->future_top_time_relations.clear();
context->not_connect = 0;
context->origin = false;
+
+ context->time_first = unknown;
+ context->time_second = unknown;
+ context->time_event = false;
}
/*
@@ -675,6 +679,11 @@
context->open_instance--;
}
+void set_time_event_fun(struct Context* context)
+{
+ context->time_event = true;
+}
+
void add_time_relation_event_fun(struct Context* context)
{
TimeRelationEventPtr relation;
@@ -721,7 +730,7 @@
void set_time_reference_event_fun(struct Context* context, char* name)
{
context->time_event_name = name;
- context->time_relation_type = unknown;
+ context->time_second = unknown;
}
void create_future_time_relations(struct Context* context)
@@ -1046,13 +1055,6 @@
}
}
-/*
- * Set time_relation_type to define where the time interval should be connected
- */
-void set_time_ref_relation_type_fun(struct Context* context, enum time_relation_kind time_relation_type)
-{
- context->time_relation_type = time_relation_type;
-}
/*
* Set time_ to define where the time interval should be connected
@@ -1088,19 +1090,23 @@
/*
* Set time interval between current node and another node.
- *
- * Kind defines where the time interval is defined on the current node
- * context->time_relation_type defines where the time interval is defined on the other node.
*/
-void add_time_relation_ref_fun(struct Context* context, enum time_relation_kind kind)
+void add_time_relation_ref_fun(struct Context* context)
{
- if(context->time_relation_type == unknown)
+ if(context->time_event)
{
+ add_time_relation_event_fun(context);
+ context->time_event = false;
+ return ;
+ }
+
+ if(context->time_second == unknown)
+ {
context->z->print_report(RS_WARNING, stringize() << "Warning 25: Time definition in " << TOWSTRING(context->element_name) << " has only one connection point");
- context->time_relation_type = kind;
+ context->time_second = context->time_first;
context->time_node_name = context->time_event_name;
}
-
+
TimeRelationRefNodePtr relation;
try
{
@@ -1135,14 +1141,16 @@
context->z->print_report(RS_ERROR, L"Warning 23: Time information can be defined only to a reference node\n");
return ;
}
-
- relation->glue_ref_nodes(kind == bottom, node.get(), context->time_relation_type == bottom, node2.get());
+/* check for z120_time08.mpr */
+//if(node2 == node) { std::cout << "connection points " << (context->time_first==bottom) << " " << (context->time_second==bottom) << std::endl;}
+/* */
+ relation->glue_ref_nodes(context->time_first == bottom, node.get(), context->time_second == bottom, node2.get());
}
else
{
- relation->glue_ref_node_a(kind == bottom, node.get());
+ relation->glue_ref_node_a(context->time_first == bottom, node.get());
- if(context->time_relation_type == top)
+ if(context->time_second == top)
{
std::map<std::string, std::set<TimeRelationRefNodePtr> >::iterator top_it;
top_it = context->future_top_time_relations.find(context->time_node_name);
@@ -1173,9 +1181,25 @@
}
}
- context->time_relation_type = unknown;
+ context->time_second = unknown;
}
+/*
+ * Set time_first to define where the time interval should be connected
+ */
+void set_first_time_rel_kind_fun(struct Context* context, enum time_relation_kind kind)
+{
+ context->time_first = kind;
+}
+
+/*
+ * Set time_second to define where the time interval should be connected
+ */
+void set_second_time_rel_kind_fun(struct Context* context, enum time_relation_kind time_relation_type)
+{
+ context->time_second = time_relation_type;
+}
+
#endif
// $Id$
Modified: trunk/src/data/Z120/Context.h
===================================================================
--- trunk/src/data/Z120/Context.h 2009-10-10 15:00:30 UTC (rev 414)
+++ trunk/src/data/Z120/Context.h 2009-10-10 20:22:38 UTC (rev 415)
@@ -89,6 +89,8 @@
void end_instance_fun(struct Context* context);
+void set_time_event_fun(struct Context* context);
+
void add_time_relation_event_fun(struct Context* context);
void set_time_reference_event_fun(struct Context* context, char* name);
@@ -120,14 +122,16 @@
void future_connection_fill_in_fun(struct Context* context);
-void set_time_ref_relation_type_fun(struct Context* context, enum time_relation_kind time_relation_type);
-
void set_time_reference_node_fun(struct Context* context, char* name);
void add_time_relation_ref_time_fun(struct Context* context);
-void add_time_relation_ref_fun(struct Context* context, enum time_relation_kind kind);
+void add_time_relation_ref_fun(struct Context* context);
+void set_first_time_rel_kind_fun(struct Context* context, enum time_relation_kind kind);
+
+void set_second_time_rel_kind_fun(struct Context* context, enum time_relation_kind kind);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/src/data/Z120/Context_Impl.h
===================================================================
--- trunk/src/data/Z120/Context_Impl.h 2009-10-10 15:00:30 UTC (rev 414)
+++ trunk/src/data/Z120/Context_Impl.h 2009-10-10 20:22:38 UTC (rev 415)
@@ -78,6 +78,7 @@
EventPtr current_event; //event which was currently created
std::string event_name; //name of event
std::string time_event_name; //name of event on which points a reference in the time relation
+ bool time_event;
int not_create_event; //flag for event in case msc has two labeled event with the same name
int no_message_label; //flag for message which does not have label
int open_instance; //counter of open instances
@@ -100,10 +101,12 @@
std::map<std::string, std::set<TimeRelationRefNodePtr> > future_bottom_time_relations;
enum hmsc_node_type node_type; //flag to recognize HMsc nodes (ConnectionNode, ReferenceNode, ConditionNode).
- enum time_relation_kind time_relation_type;
std::string time_node_name;
int not_connect;
+ enum time_relation_kind time_first;
+ enum time_relation_kind time_second;
+
~Context() {}
};
Modified: trunk/src/data/Z120/Z120.g
===================================================================
--- trunk/src/data/Z120/Z120.g 2009-10-10 15:00:30 UTC (rev 414)
+++ trunk/src/data/Z120/Z120.g 2009-10-10 20:22:38 UTC (rev 415)
@@ -413,10 +413,7 @@
{
add_relation_fun(context, after);
})? end
- ('time' time_dest_list end
- {
- add_time_relation_event_fun(context);
- })?
+ ( {set_time_event_fun(context);} 'time' time_dest_list end )?
{
set_not_create_event_fun(context);
@@ -429,14 +426,14 @@
time_dest_list:
(time_dest ('origin' { set_origin_fun(context); } )?)?
- time_interval (',' time_dest_list)?
+ time_interval { add_time_relation_ref_fun(context); } (',' time_dest_list)?
;
time_dest:
NAME {set_time_reference_event_fun(context, (char*) $NAME.text->chars);}
|
- ('top' { set_time_ref_relation_type_fun(context, top); }
- | 'bottom' { set_time_ref_relation_type_fun(context, bottom); })
+ ('top' { set_second_time_rel_kind_fun(context, top); }
+ | 'bottom' { set_second_time_rel_kind_fun(context, bottom); })
(reference_identification | NAME { set_time_reference_node_fun(context, (char*) $NAME.text->chars);} )
;
@@ -1111,8 +1108,16 @@
;
*/
+/* Where an interval label is used, the keyword int_boundary must appear in the programming
+representation, and must be absent in the graphical representation.
+*/
+
+//interval_label:
+// ('int_boundary')? NAME
+//;
+
interval_label:
- ('int_boundary')? NAME
+ ('int_boundary') NAME
;
singular_time:
@@ -1522,11 +1527,12 @@
condition_identification (shared)?
;
+//Peter's reguirements to allow multiple definition of top or bottom time information
timeable_node:
(hmsc_ref_expr_node { new_reference_node_fun(context); } | hmsc_expression)
('time' time_interval end { add_time_relation_ref_time_fun(context); })?
- ('top' time_dest_list end { add_time_relation_ref_fun(context, top); })?
- ('bottom' time_dest_list end { add_time_relation_ref_fun(context, bottom); })?
+ ( ('top'{ set_first_time_rel_kind_fun(context, top);} time_dest_list end) |
+ ('bottom' { set_first_time_rel_kind_fun(context, bottom);} time_dest_list end) )*
;
hmsc_ref_expr_node:
Modified: trunk/tests/z120_test/CMakeLists.txt
===================================================================
--- trunk/tests/z120_test/CMakeLists.txt 2009-10-10 15:00:30 UTC (rev 414)
+++ trunk/tests/z120_test/CMakeLists.txt 2009-10-10 20:22:38 UTC (rev 415)
@@ -98,6 +98,7 @@
ADD_Z120_TEST(z120_time09.mpr 1)
ADD_Z120_TEST(z120_time10.mpr 1)
ADD_Z120_TEST(z120_time11.mpr 1)
+ADD_Z120_TEST(z120_time12.mpr 1)
# $Id$
Added: trunk/tests/z120_test/z120_time12.mpr
===================================================================
--- trunk/tests/z120_test/z120_time12.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time12.mpr 2009-10-10 20:22:38 UTC (rev 415)
@@ -0,0 +1,37 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3, L4;
+L4: reference Fish connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10), top L4 [2,4];
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2009-10-12 11:38:25
|
Revision: 418
http://scstudio.svn.sourceforge.net/scstudio/?rev=418&view=rev
Author: madzin
Date: 2009-10-12 11:38:14 +0000 (Mon, 12 Oct 2009)
Log Message:
-----------
Add inf to grammar regognition
Modified Paths:
--------------
trunk/src/data/Z120/Context.cpp
trunk/src/data/Z120/Context.h
trunk/src/data/Z120/Context_Impl.h
trunk/src/data/Z120/Z120.g
trunk/tests/z120_test/CMakeLists.txt
Added Paths:
-----------
trunk/tests/z120_test/z120_time13.mpr
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2009-10-12 11:26:25 UTC (rev 417)
+++ trunk/src/data/Z120/Context.cpp 2009-10-12 11:38:14 UTC (rev 418)
@@ -22,7 +22,7 @@
*/
/*
- * Maximal number of warning/error message is 24
+ * Maximal number of warning/error message is 29
*/
#ifndef __ParserStruct__
@@ -69,6 +69,10 @@
context->not_create_event = 0;
context->no_message_label = 0;
context->open_instance = 0;
+ context->data_parameter_decl = false;
+ context->instance_parameter_decl = false;
+ context->message_parameter_decl = false;
+ context->timer_parameter_decl = false;
context->start_node = NULL;
context->end_node = std::make_pair("", context->end_node.second); //replaice context->end_node.second with NULL
@@ -747,6 +751,31 @@
}
}
+void set_data_parameter_decl(struct Context* context)
+{
+ if(!context->data_parameter_decl) context->data_parameter_decl = true;
+ else context->z->print_report(RS_WARNING, L"Warning 26: data parameters were declared multiple times");
+}
+
+void set_instance_parameter_decl(struct Context* context)
+{
+ if(!context->instance_parameter_decl) context->instance_parameter_decl = true;
+ else context->z->print_report(RS_WARNING, L"Warning 27: instance parameters were declared multiple times");
+}
+
+void set_message_parameter_decl(struct Context* context)
+{
+ if(!context->message_parameter_decl) context->message_parameter_decl = true;
+ else context->z->print_report(RS_WARNING, L"Warning 28: message parameters were declared multiple times");
+}
+
+void set_timer_parameter_decl(struct Context* context)
+{
+ if(!context->timer_parameter_decl) context->timer_parameter_decl = true;
+ else context->z->print_report(RS_WARNING, L"Warning 29: timer parameters were declared multiple times");
+}
+
+
/*
* FUNCTIONS FOR HMSC
*/
@@ -1093,6 +1122,7 @@
*/
void add_time_relation_ref_fun(struct Context* context)
{
+//std::cout << "time definition " << context->time << std::endl;
if(context->time_event)
{
add_time_relation_event_fun(context);
Modified: trunk/src/data/Z120/Context.h
===================================================================
--- trunk/src/data/Z120/Context.h 2009-10-12 11:26:25 UTC (rev 417)
+++ trunk/src/data/Z120/Context.h 2009-10-12 11:38:14 UTC (rev 418)
@@ -97,6 +97,15 @@
void create_future_time_relations(struct Context* context);
+void set_data_parameter_decl(struct Context* context);
+
+void set_instance_parameter_decl(struct Context* context);
+
+void set_message_parameter_decl(struct Context* context);
+
+void set_timer_parameter_decl(struct Context* context);
+
+
//HMsc
void new_hmsc_fun(struct Context* context);
Modified: trunk/src/data/Z120/Context_Impl.h
===================================================================
--- trunk/src/data/Z120/Context_Impl.h 2009-10-12 11:26:25 UTC (rev 417)
+++ trunk/src/data/Z120/Context_Impl.h 2009-10-12 11:38:14 UTC (rev 418)
@@ -83,6 +83,13 @@
int no_message_label; //flag for message which does not have label
int open_instance; //counter of open instances
+ //variables for syntactic grammar solutions
+ bool data_parameter_decl;
+ bool instance_parameter_decl;
+ bool message_parameter_decl;
+ bool timer_parameter_decl;
+
+
/*
* HMsc
*/
Modified: trunk/src/data/Z120/Z120.g
===================================================================
--- trunk/src/data/Z120/Z120.g 2009-10-12 11:26:25 UTC (rev 417)
+++ trunk/src/data/Z120/Z120.g 2009-10-12 11:38:14 UTC (rev 418)
@@ -289,11 +289,15 @@
msc_parm_decl_block_first (end msc_parm_decl_block)*
;
+/*
+ * add call methods for syntax regulation
+ * each rewrite rule can be occured only once
+ */
msc_parm_decl_block:
- data_parameter_decl
- | instance_parameter_decl
- | message_parameter_decl
- | timer_parameter_decl
+ data_parameter_decl {set_data_parameter_decl(context);}
+ | instance_parameter_decl {set_instance_parameter_decl(context);}
+ | message_parameter_decl {set_message_parameter_decl(context);}
+ | timer_parameter_decl {set_timer_parameter_decl(context);}
;
msc_parm_decl_block_first:
@@ -1059,14 +1063,14 @@
// ----- Time Offset
time_offset:
- 'offset' expression
+ 'offset' expression | 'inf' //inf has been added for accept inf in time definition but it should be in expression to
;
// ----- Time Points
time_point:
- ('@')? expression
+ ('@')? expression | 'inf' //inf has been added for accept inf in time definition but it should be in expression to
;
Modified: trunk/tests/z120_test/CMakeLists.txt
===================================================================
--- trunk/tests/z120_test/CMakeLists.txt 2009-10-12 11:26:25 UTC (rev 417)
+++ trunk/tests/z120_test/CMakeLists.txt 2009-10-12 11:38:14 UTC (rev 418)
@@ -99,6 +99,7 @@
ADD_Z120_TEST(z120_time10.mpr 1)
ADD_Z120_TEST(z120_time11.mpr 1)
ADD_Z120_TEST(z120_time12.mpr 1)
+ADD_Z120_TEST(z120_time13.mpr 1)
# $Id$
Added: trunk/tests/z120_test/z120_time13.mpr
===================================================================
--- trunk/tests/z120_test/z120_time13.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time13.mpr 2009-10-12 11:38:14 UTC (rev 418)
@@ -0,0 +1,20 @@
+/* Incorrect time constraint between alternative references A and B.
+ */
+mscdocument Vykres1;
+msc Stranka_1;
+initial connect L0, L1;
+L0: reference A top bottom L2 [0,inf);
+ connect L2;
+L1: reference B connect L2;
+L2: final;
+endmsc;
+msc A;
+inst NAME;
+NAME: instance;
+endinstance;
+endmsc;
+msc B;
+inst NAME;
+NAME: instance;
+endinstance;
+endmsc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2009-10-12 12:16:50
|
Revision: 419
http://scstudio.svn.sourceforge.net/scstudio/?rev=419&view=rev
Author: gotthardp
Date: 2009-10-12 12:16:37 +0000 (Mon, 12 Oct 2009)
Log Message:
-----------
Fixed SIGSEGV when printing a disconnected time constraint.
Modified Paths:
--------------
trunk/src/data/Z120/z120_save.cpp
trunk/tests/checker_test.cpp
trunk/tests/z120_test/z120_test.cpp
Modified: trunk/src/data/Z120/z120_save.cpp
===================================================================
--- trunk/src/data/Z120/z120_save.cpp 2009-10-12 11:38:14 UTC (rev 418)
+++ trunk/src/data/Z120/z120_save.cpp 2009-10-12 12:16:37 UTC (rev 419)
@@ -508,6 +508,9 @@
else
stream << ",";
+ if((*rpos)->get_ref_node_b() == NULL)
+ throw std::invalid_argument("Disconnected time constraint.");
+
if((*rpos)->is_bottom_node_b())
stream << " bottom";
else
Modified: trunk/tests/checker_test.cpp
===================================================================
--- trunk/tests/checker_test.cpp 2009-10-12 11:38:14 UTC (rev 418)
+++ trunk/tests/checker_test.cpp 2009-10-12 12:16:37 UTC (rev 419)
@@ -159,7 +159,15 @@
else
std::cout << "OK: " << argv[3] << " violated " << argv[2] << ", should be violated" << std::endl;
- z120.save_msc(std::cout, L"counter_example", result);
+ try
+ {
+ z120.save_msc(std::cout, L"counter_example", result);
+ }
+ catch(std::exception& exc)
+ {
+ std::cerr << "EXCEPTION: Cannot save the document: " << exc.what() << std::endl;
+ errors = 1;
+ }
}
}
catch(std::exception &exc)
Modified: trunk/tests/z120_test/z120_test.cpp
===================================================================
--- trunk/tests/z120_test/z120_test.cpp 2009-10-12 11:38:14 UTC (rev 418)
+++ trunk/tests/z120_test/z120_test.cpp 2009-10-12 12:16:37 UTC (rev 419)
@@ -80,7 +80,15 @@
std::cout << std::endl;
- z120.save_msc(std::cout, TOWSTRING(filename), msc[0], msc);
+ try
+ {
+ z120.save_msc(std::cout, TOWSTRING(filename), msc[0], msc);
+ }
+ catch(std::exception& exc)
+ {
+ std::cerr << "EXCEPTION: Cannot save the document: " << exc.what() << std::endl;
+ errors = 1;
+ }
}
else
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2009-10-12 15:55:32
|
Revision: 420
http://scstudio.svn.sourceforge.net/scstudio/?rev=420&view=rev
Author: madzin
Date: 2009-10-12 15:55:23 +0000 (Mon, 12 Oct 2009)
Log Message:
-----------
Fix bug in time recognition
Modified Paths:
--------------
trunk/src/data/Z120/Context.cpp
trunk/src/data/Z120/Z120.g
trunk/tests/z120_test/CMakeLists.txt
trunk/tests/z120_test/z120_test01.mpr.result
trunk/tests/z120_test/z120_test62.mpr.result
trunk/tests/z120_test/z120_test64.mpr.result
trunk/tests/z120_test/z120_time13.mpr
Added Paths:
-----------
trunk/tests/z120_test/z120_time14.mpr
trunk/tests/z120_test/z120_time14.mpr.result
trunk/tests/z120_test/z120_time15.mpr
trunk/tests/z120_test/z120_time15.mpr.result
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2009-10-12 12:16:37 UTC (rev 419)
+++ trunk/src/data/Z120/Context.cpp 2009-10-12 15:55:23 UTC (rev 420)
@@ -240,6 +240,62 @@
if(!context->future_connections.empty()){
context->z->print_report(RS_WARNING, L"Warning 08: There is reference to nonexisted node\n");
}
+
+ if(context->open_instance > 0)
+ {
+ if(context->open_instance == 1)
+ {
+ context->z->print_report(RS_WARNING, stringize() << "Warning 20: Msc (" << TOWSTRING(context->msc_name) << ") has not finished " << context->open_instance << " instance\n");
+ }
+ else
+ {
+ context->z->print_report(RS_WARNING, stringize() << "Warning 20: Msc " << TOWSTRING(context->msc_name) << " has not finished " << context->open_instance << " instances\n");
+ }
+ }
+
+ if(context->open_instance < 0)
+ {
+ context->z->print_report(RS_WARNING, L"Warning 21:TOWSTRING(context->msc_name) Some instance has been finished more times\n");
+ }
+
+ if(context->future_top_time_relations.size() > 0)
+ {
+ context->z->print_report(RS_WARNING, L"Warning 24: Some time information points to non-existed reference node\n");
+
+ std::map<std::string, std::set<TimeRelationRefNodePtr> >::iterator it;
+ std::set<TimeRelationRefNodePtr>::iterator set_it;
+ ReferenceNode* ref_node;
+
+ for(it = context->future_top_time_relations.begin(); it != context->future_top_time_relations.end(); it++)
+ {
+ for(set_it = it->second.begin(); set_it != it->second.end(); set_it++)
+ {
+ ref_node = (*set_it)->get_ref_node_a();
+ ref_node->remove_time_relation_bottom(*set_it);
+ }
+ }
+ }
+
+ if(context->future_bottom_time_relations.size() > 0)
+ {
+ context->z->print_report(RS_WARNING, L"Warning 24: Some time information points to non-existed reference node\n");
+
+ std::map<std::string, std::set<TimeRelationRefNodePtr> >::iterator it;
+ std::set<TimeRelationRefNodePtr>::iterator set_it;
+ ReferenceNode* ref_node;
+
+ for(it = context->future_bottom_time_relations.begin(); it != context->future_bottom_time_relations.end(); ++it)
+ {
+ for(set_it = it->second.begin(); set_it != it->second.end(); set_it++)
+ {
+ ref_node = (*set_it)->get_ref_node_a();
+ ref_node->remove_time_relation_top(*set_it);
+ }
+
+ context->future_bottom_time_relations.erase(it);
+ }
+ }
+
}
void check_references_fun(struct Context* context)
Modified: trunk/src/data/Z120/Z120.g
===================================================================
--- trunk/src/data/Z120/Z120.g 2009-10-12 12:16:37 UTC (rev 419)
+++ trunk/src/data/Z120/Z120.g 2009-10-12 15:55:23 UTC (rev 420)
@@ -260,8 +260,8 @@
}
(virtuality)? 'msc' msc_head ( ('expr' | (hmsc_statement_without_initial)* initial_node)=> hmsc | msc ) 'endmsc' end
{
+ check_collections_fun(context);
msc_was_read_fun(context);
- check_collections_fun(context);
}
;
Modified: trunk/tests/z120_test/CMakeLists.txt
===================================================================
--- trunk/tests/z120_test/CMakeLists.txt 2009-10-12 12:16:37 UTC (rev 419)
+++ trunk/tests/z120_test/CMakeLists.txt 2009-10-12 15:55:23 UTC (rev 420)
@@ -100,6 +100,8 @@
ADD_Z120_TEST(z120_time11.mpr 1)
ADD_Z120_TEST(z120_time12.mpr 1)
ADD_Z120_TEST(z120_time13.mpr 1)
+ADD_Z120_TEST(z120_time14.mpr 1)
+ADD_Z120_TEST(z120_time15.mpr 1)
# $Id$
Modified: trunk/tests/z120_test/z120_test01.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test01.mpr.result 2009-10-12 12:16:37 UTC (rev 419)
+++ trunk/tests/z120_test/z120_test01.mpr.result 2009-10-12 15:55:23 UTC (rev 420)
@@ -1,3 +1,5 @@
+Warning 20: Msc (z120_test01) has not finished 1 instance
+
Warning 20: Msc has not finished 1 instance
OK: z120_test01 is correct, should be correct
Modified: trunk/tests/z120_test/z120_test62.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test62.mpr.result 2009-10-12 12:16:37 UTC (rev 419)
+++ trunk/tests/z120_test/z120_test62.mpr.result 2009-10-12 15:55:23 UTC (rev 420)
@@ -1,4 +1,6 @@
z120_test62.mpr[10,5] Missing elements.
+Warning 20: Msc (test01) has not finished 1 instance
+
Warning 20: Msc has not finished 1 instance
OK: z120_test62 is correct, should be correct
Modified: trunk/tests/z120_test/z120_test64.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test64.mpr.result 2009-10-12 12:16:37 UTC (rev 419)
+++ trunk/tests/z120_test/z120_test64.mpr.result 2009-10-12 15:55:23 UTC (rev 420)
@@ -7,6 +7,8 @@
Warning 05: There is complete message with only one event
+Warning 20: Msc (Strnka1) has not finished 1 instance
+
Warning 20: Msc has not finished 1 instance
OK: z120_test64 is correct, should be correct
Modified: trunk/tests/z120_test/z120_time13.mpr
===================================================================
--- trunk/tests/z120_test/z120_time13.mpr 2009-10-12 12:16:37 UTC (rev 419)
+++ trunk/tests/z120_test/z120_time13.mpr 2009-10-12 15:55:23 UTC (rev 420)
@@ -1,4 +1,4 @@
-/* Incorrect time constraint between alternative references A and B.
+/* Incorrect time constraint (top bottom) between reference node and final node (forbidden).
*/
mscdocument Vykres1;
msc Stranka_1;
Added: trunk/tests/z120_test/z120_time14.mpr
===================================================================
--- trunk/tests/z120_test/z120_time14.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time14.mpr 2009-10-12 15:55:23 UTC (rev 420)
@@ -0,0 +1,20 @@
+/* Incorrect time constraint between alternative references A and B.
+ */
+mscdocument Vykres1;
+msc Stranka_1;
+initial connect L0, L1;
+L0: reference A top bottom L1 [0,inf);
+ connect L2,L1;
+L1: reference B connect L2;
+L2: final;
+endmsc;
+msc A;
+inst NAME;
+NAME: instance;
+endinstance;
+endmsc;
+msc B;
+inst NAME;
+NAME: instance;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time14.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time14.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time14.mpr.result 2009-10-12 15:55:23 UTC (rev 420)
@@ -0,0 +1,20 @@
+OK: z120_time14 is correct, should be correct
+
+mscdocument z120_time14;
+msc Stranka_1;
+initial connect L0, L1;
+L0: reference A top bottom L1 [0,inf);
+ connect L1, L2;
+L1: reference B connect L2;
+L2: final;
+endmsc;
+msc A;
+inst NAME;
+NAME: instance;
+endinstance;
+endmsc;
+msc B;
+inst NAME;
+NAME: instance;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time15.mpr
===================================================================
--- trunk/tests/z120_test/z120_time15.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time15.mpr 2009-10-12 15:55:23 UTC (rev 420)
@@ -0,0 +1,20 @@
+/* Incorrect time constraint (bottom top) between reference node and final node (forbidden)
+ */
+mscdocument Vykres1;
+msc Stranka_1;
+initial connect L0, L1;
+L0: reference A bottom top L2 [0,inf);
+ connect L2;
+L1: reference B connect L2;
+L2: final;
+endmsc;
+msc A;
+inst NAME;
+NAME: instance;
+endinstance;
+endmsc;
+msc B;
+inst NAME;
+NAME: instance;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time15.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time15.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time15.mpr.result 2009-10-12 15:55:23 UTC (rev 420)
@@ -0,0 +1,21 @@
+Warning 24: Some time information points to non-existed reference node
+
+OK: z120_time15 is correct, should be correct
+
+mscdocument z120_time15;
+msc Stranka_1;
+initial connect L0, L1;
+L0: reference A connect L2;
+L1: reference B connect L2;
+L2: final;
+endmsc;
+msc A;
+inst NAME;
+NAME: instance;
+endinstance;
+endmsc;
+msc B;
+inst NAME;
+NAME: instance;
+endinstance;
+endmsc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|