|
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.
|