|
From: <ma...@us...> - 2009-11-22 00:22:47
|
Revision: 479
http://scstudio.svn.sourceforge.net/scstudio/?rev=479&view=rev
Author: madzin
Date: 2009-11-22 00:22:26 +0000 (Sun, 22 Nov 2009)
Log Message:
-----------
Fix problems with SIGSEGVs and memory leak.
Modified Paths:
--------------
trunk/src/data/Z120/Context.cpp
trunk/tests/z120_test/CMakeLists.txt
trunk/tests/z120_test/z120_test31.mpr.result
Added Paths:
-----------
trunk/tests/z120_test/z120_time20.mpr
trunk/tests/z120_test/z120_time20.mpr.result
trunk/tests/z120_test/z120_time21.mpr
trunk/tests/z120_test/z120_time21.mpr.result
trunk/tests/z120_test/z120_time22.mpr
trunk/tests/z120_test/z120_time22.mpr.result
trunk/tests/z120_test/z120_time23.mpr
trunk/tests/z120_test/z120_time23.mpr.result
trunk/tests/z120_test/z120_time24.mpr
trunk/tests/z120_test/z120_time24.mpr.result
trunk/tests/z120_test/z120_time25.mpr
trunk/tests/z120_test/z120_time25.mpr.result
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2009-11-21 17:16:07 UTC (rev 478)
+++ trunk/src/data/Z120/Context.cpp 2009-11-22 00:22:26 UTC (rev 479)
@@ -327,7 +327,14 @@
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((*set_it)->is_bottom_node_a())
+ {
+ ref_node->remove_time_relation_bottom(*set_it);
+ }
+ else
+ {
+ ref_node->remove_time_relation_top(*set_it);
+ }
}
}
context->future_top_time_relations.clear();
@@ -346,7 +353,14 @@
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);
+ if((*set_it)->is_bottom_node_a())
+ {
+ ref_node->remove_time_relation_bottom(*set_it);
+ }
+ else
+ {
+ ref_node->remove_time_relation_top(*set_it);
+ }
}
}
context->future_bottom_time_relations.clear();
@@ -1028,6 +1042,12 @@
*/
void new_reference_node_fun(struct Context* context)
{
+ if(TOWSTRING(context->reference_name) == get_msc_fun(context)->get_label())
+ {
+ context->z->print_report(RS_ERROR, stringize() << L"Error 31: Infinite recursion at " << TOWSTRING(context->element_name) << " node");
+ context->reference_name = "_" + context->reference_name + "_";
+ }
+
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;
@@ -1039,23 +1059,23 @@
if(msc_it == context->mscs.end())
{
- std::map<std::string, std::set<ReferenceNodePtr> >::iterator ref_it = context->future_reference.find(context->reference_name);
+ std::map<std::string, std::set<ReferenceNodePtr> >::iterator ref_it = context->future_reference.find(context->reference_name);
- if(ref_it != context->future_reference.end())
- {
- ref_it->second.insert(node);
- }
- else
- {
- std::set<ReferenceNodePtr> my_set;
- my_set.insert(node);
- context->future_reference.insert(std::make_pair(context->reference_name, my_set));
- }
+ if(ref_it != context->future_reference.end())
+ {
+ ref_it->second.insert(node);
+ }
+ else
+ {
+ std::set<ReferenceNodePtr> my_set;
+ my_set.insert(node);
+ context->future_reference.insert(std::make_pair(context->reference_name, my_set));
+ }
}
else
{
node->set_msc(msc_it->second);
-
+
std::set<std::string>::iterator erase_it = context->nonpointed.find(context->reference_name);
if(erase_it != context->nonpointed.end())
{
@@ -1312,6 +1332,10 @@
{
relation->glue_ref_nodes(false, node.get(), true, node.get());
}
+ else
+ {
+// std::cout << " warning " << std::endl;
+ }
}
/*
@@ -1363,12 +1387,47 @@
if(ref_it != context->hmsc_nodes.end())
{
ReferenceNodePtr node2 = boost::dynamic_pointer_cast<ReferenceNode>(ref_it->second);
- if(node == NULL)
+ if(node2 == NULL)
{
- context->z->print_report(RS_ERROR, L"Warning 23: Time information can be defined only to a reference node");
- return ;
+// context->z->print_report(RS_ERROR, L"Warning 23: Time information can be defined only to a reference node");
+// return ;
+//--------------------------------------------------------------------------------------------------------------------
+// added due to the same warning with 24 to print
+ relation->glue_ref_node_a(context->time_first == bottom, node.get());
+
+ 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);
+
+ 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);
+ }
+ }
+ return;
+//----------------------------------------------------------------------------------------------------------------------------
+ }
+
if(context->time_first == context->time_second && context->time_first != unknown && node2 == node)
{
context->z->print_report(RS_ERROR, L"Warning 30: Time interval was defined to one point");
Modified: trunk/tests/z120_test/CMakeLists.txt
===================================================================
--- trunk/tests/z120_test/CMakeLists.txt 2009-11-21 17:16:07 UTC (rev 478)
+++ trunk/tests/z120_test/CMakeLists.txt 2009-11-22 00:22:26 UTC (rev 479)
@@ -127,6 +127,12 @@
ADD_Z120_TEST(z120_time17.mpr 1)
ADD_Z120_TEST(z120_time18.mpr 1)
ADD_Z120_TEST(z120_time19.mpr 1)
+ADD_Z120_TEST(z120_time20.mpr 1)
+ADD_Z120_TEST(z120_time21.mpr 1)
+ADD_Z120_TEST(z120_time22.mpr 1)
+ADD_Z120_TEST(z120_time23.mpr 1)
+ADD_Z120_TEST(z120_time24.mpr 1)
+ADD_Z120_TEST(z120_time25.mpr 1)
# $Id$
Modified: trunk/tests/z120_test/z120_test31.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test31.mpr.result 2009-11-21 17:16:07 UTC (rev 478)
+++ trunk/tests/z120_test/z120_test31.mpr.result 2009-11-22 00:22:26 UTC (rev 479)
@@ -1,13 +1,15 @@
-Warning 09: Reference to nonexisting MSC: bmsc1
-Error 03: Infinite recursion among MSCs
+Error 31: Infinite recursion at L1 node
+Warning 09: Reference to nonexisting MSC: _out_iha_, bmsc1
OK: z120_test31 is correct, should be correct
mscdocument z120_test31;
msc out_iha;
initial connect L0;
L0: reference bmsc1 connect L1;
-L1: reference out_iha connect L0, L2;
+L1: reference _out_iha_ connect L0, L2;
L2: final;
endmsc;
msc bmsc1;
endmsc;
+msc _out_iha_;
+endmsc;
Added: trunk/tests/z120_test/z120_time20.mpr
===================================================================
--- trunk/tests/z120_test/z120_time20.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time20.mpr 2009-11-22 00:22:26 UTC (rev 479)
@@ -0,0 +1,21 @@
+/* Incorrect time constraint (top top) between reference node and final node (forbidden).
+ */
+mscdocument Vykres1;
+msc Stranka_1;
+initial connect L0, L1;
+L0: reference A top top L2 [0,inf);
+ connect L2;
+L1: reference B top top L2 [0,4);
+ 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_time20.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time20.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time20.mpr.result 2009-11-22 00:22:26 UTC (rev 479)
@@ -0,0 +1,20 @@
+Warning 24: Time information to nonexisting reference node: L2
+OK: z120_time20 is correct, should be correct
+
+mscdocument z120_time20;
+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;
Added: trunk/tests/z120_test/z120_time21.mpr
===================================================================
--- trunk/tests/z120_test/z120_time21.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time21.mpr 2009-11-22 00:22:26 UTC (rev 479)
@@ -0,0 +1,21 @@
+/* Incorrect time constraint (top bottom) between reference node and final node (forbidden).
+ */
+mscdocument Vykres1;
+msc Stranka_1;
+initial connect L0, L1;
+L0: reference A bottom bottom L2 [0,inf);
+ connect L2;
+L1: reference B bottom bottom L2 [0,4);
+ 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_time21.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time21.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time21.mpr.result 2009-11-22 00:22:26 UTC (rev 479)
@@ -0,0 +1,20 @@
+Warning 24: Time information to nonexisting reference node: L2
+OK: z120_time21 is correct, should be correct
+
+mscdocument z120_time21;
+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;
Added: trunk/tests/z120_test/z120_time22.mpr
===================================================================
--- trunk/tests/z120_test/z120_time22.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time22.mpr 2009-11-22 00:22:26 UTC (rev 479)
@@ -0,0 +1,25 @@
+mscdocument proper_neg22.vsd;
+msc A;
+initial connect L0;
+L0: reference A top bottom L1 [0,inf);
+ bottom top L2 [0,inf), top L3 [0,inf);
+ connect L3, L4;
+L3: reference NAME time [0,inf);
+ connect L2;
+L4: connect L1,L2, L3;
+L2: reference NAME time [0,inf);
+ top top L1 [0,inf);
+ connect L5;
+L5: final;
+L1: condition mark connect L4;
+endmsc;
+msc NAME;
+inst asd;
+inst dsrgdf;
+asd: instance;
+out NAME,0 to dsrgdf;
+endinstance;
+dsrgdf: instance;
+in NAME,0 from asd;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time22.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time22.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time22.mpr.result 2009-11-22 00:22:26 UTC (rev 479)
@@ -0,0 +1,30 @@
+Error 31: Infinite recursion at L0 node
+Warning 24: Time information to nonexisting reference node: L1
+Warning 09: Reference to nonexisting MSC: _A_
+OK: z120_time22 is correct, should be correct
+
+mscdocument z120_time22;
+msc A;
+initial connect L0;
+L0: reference _A_ bottom top L1 [0,inf), top L2 [0,inf);
+ connect L2, L3;
+L2: reference NAME time [0,inf);
+ connect L1;
+L3: connect L2, L1, L4;
+L1: reference NAME time [0,inf);
+ connect L5;
+L4: condition mark connect L3;
+L5: final;
+endmsc;
+msc NAME;
+inst asd;
+inst dsrgdf;
+asd: instance;
+out NAME,0 to dsrgdf;
+endinstance;
+dsrgdf: instance;
+in NAME,0 from asd;
+endinstance;
+endmsc;
+msc _A_;
+endmsc;
Added: trunk/tests/z120_test/z120_time23.mpr
===================================================================
--- trunk/tests/z120_test/z120_time23.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time23.mpr 2009-11-22 00:22:26 UTC (rev 479)
@@ -0,0 +1,25 @@
+mscdocument proper_neg22.vsd;
+msc A;
+initial connect L0;
+L0: reference A top bottom L1 [0,inf);
+ bottom top L2 [0,inf), top L3 [0,inf);
+ connect L3, L4;
+L3: reference NAME time [0,inf);
+ connect L2;
+L1: condition mark connect L4;
+L4: connect L1,L2, L3;
+L2: reference NAME time [0,inf);
+ top top L1 [0,inf);
+ connect L5;
+L5: final;
+endmsc;
+msc NAME;
+inst asd;
+inst dsrgdf;
+asd: instance;
+out NAME,0 to dsrgdf;
+endinstance;
+dsrgdf: instance;
+in NAME,0 from asd;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time23.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time23.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time23.mpr.result 2009-11-22 00:22:26 UTC (rev 479)
@@ -0,0 +1,30 @@
+Error 31: Infinite recursion at L0 node
+Warning 24: Time information to nonexisting reference node: L1
+Warning 09: Reference to nonexisting MSC: _A_
+OK: z120_time23 is correct, should be correct
+
+mscdocument z120_time23;
+msc A;
+initial connect L0;
+L0: reference _A_ bottom top L1 [0,inf), top L2 [0,inf);
+ connect L2, L3;
+L2: reference NAME time [0,inf);
+ connect L1;
+L3: connect L4, L2, L1;
+L1: reference NAME time [0,inf);
+ connect L5;
+L4: condition mark connect L3;
+L5: final;
+endmsc;
+msc NAME;
+inst asd;
+inst dsrgdf;
+asd: instance;
+out NAME,0 to dsrgdf;
+endinstance;
+dsrgdf: instance;
+in NAME,0 from asd;
+endinstance;
+endmsc;
+msc _A_;
+endmsc;
Added: trunk/tests/z120_test/z120_time24.mpr
===================================================================
--- trunk/tests/z120_test/z120_time24.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time24.mpr 2009-11-22 00:22:26 UTC (rev 479)
@@ -0,0 +1,25 @@
+mscdocument proper_neg22.vsd;
+msc A;
+initial connect L0;
+L0: reference A top bottom L1 [0,inf);
+ bottom top L2 [0,inf), top L3 [0,inf);
+ connect L3, L4;
+L3: reference NAME time [0,inf);
+ connect L2;
+L1: condition mark connect L4;
+L4: connect L1,L2, L3;
+L2: reference NAME time [0,inf);
+ top top L4 [0,inf);
+ connect L5;
+L5: final;
+endmsc;
+msc NAME;
+inst asd;
+inst dsrgdf;
+asd: instance;
+out NAME,0 to dsrgdf;
+endinstance;
+dsrgdf: instance;
+in NAME,0 from asd;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time24.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time24.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time24.mpr.result 2009-11-22 00:22:26 UTC (rev 479)
@@ -0,0 +1,30 @@
+Error 31: Infinite recursion at L0 node
+Warning 24: Time information to nonexisting reference node: L1, L4
+Warning 09: Reference to nonexisting MSC: _A_
+OK: z120_time24 is correct, should be correct
+
+mscdocument z120_time24;
+msc A;
+initial connect L0;
+L0: reference _A_ bottom top L1 [0,inf), top L2 [0,inf);
+ connect L2, L3;
+L2: reference NAME time [0,inf);
+ connect L1;
+L3: connect L4, L2, L1;
+L1: reference NAME time [0,inf);
+ connect L5;
+L4: condition mark connect L3;
+L5: final;
+endmsc;
+msc NAME;
+inst asd;
+inst dsrgdf;
+asd: instance;
+out NAME,0 to dsrgdf;
+endinstance;
+dsrgdf: instance;
+in NAME,0 from asd;
+endinstance;
+endmsc;
+msc _A_;
+endmsc;
Added: trunk/tests/z120_test/z120_time25.mpr
===================================================================
--- trunk/tests/z120_test/z120_time25.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time25.mpr 2009-11-22 00:22:26 UTC (rev 479)
@@ -0,0 +1,25 @@
+mscdocument proper_neg22.vsd;
+msc A;
+initial connect L0;
+L0: reference A top bottom L1 [0,inf);
+ bottom top L2 [0,inf), top L3 [0,inf);
+ connect L3, L4;
+L3: reference NAME time [0,inf);
+ connect L2;
+L1: condition mark connect L4;
+L2: reference NAME time [0,inf);
+ top top L4 [0,inf);
+ connect L5;
+L5: final;
+L4: connect L1,L2, L3;
+endmsc;
+msc NAME;
+inst asd;
+inst dsrgdf;
+asd: instance;
+out NAME,0 to dsrgdf;
+endinstance;
+dsrgdf: instance;
+in NAME,0 from asd;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time25.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time25.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time25.mpr.result 2009-11-22 00:22:26 UTC (rev 479)
@@ -0,0 +1,30 @@
+Error 31: Infinite recursion at L0 node
+Warning 24: Time information to nonexisting reference node: L1, L4
+Warning 09: Reference to nonexisting MSC: _A_
+OK: z120_time25 is correct, should be correct
+
+mscdocument z120_time25;
+msc A;
+initial connect L0;
+L0: reference _A_ bottom top L1 [0,inf), top L2 [0,inf);
+ connect L2, L3;
+L2: reference NAME time [0,inf);
+ connect L1;
+L3: connect L4, L1, L2;
+L1: reference NAME time [0,inf);
+ connect L5;
+L4: condition mark connect L3;
+L5: final;
+endmsc;
+msc NAME;
+inst asd;
+inst dsrgdf;
+asd: instance;
+out NAME,0 to dsrgdf;
+endinstance;
+dsrgdf: instance;
+in NAME,0 from asd;
+endinstance;
+endmsc;
+msc _A_;
+endmsc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|