|
From: <ma...@us...> - 2009-09-11 11:50:20
|
Revision: 315
http://scstudio.svn.sourceforge.net/scstudio/?rev=315&view=rev
Author: madzin
Date: 2009-09-11 11:50:12 +0000 (Fri, 11 Sep 2009)
Log Message:
-----------
Fix a few errors.
Modified Paths:
--------------
trunk/src/data/Z120/Context.cpp
trunk/src/data/Z120/Context.h
trunk/src/data/Z120/Z120.g
trunk/src/data/Z120/z120_load.cpp
trunk/tests/z120_test/z120_test01.mpr.result
trunk/tests/z120_test/z120_test39.mpr.result
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2009-09-11 11:05:10 UTC (rev 314)
+++ trunk/src/data/Z120/Context.cpp 2009-09-11 11:50:12 UTC (rev 315)
@@ -22,7 +22,7 @@
*/
/*
- * Maximal number of warning/error message is 19
+ * Maximal number of warning/error message is 22
*/
#ifndef __ParserStruct__
@@ -69,8 +69,9 @@
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;
- int no_message_label;
+ 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
@@ -123,6 +124,7 @@
context->current_event = NULL;
context->not_create_event = 0;
context->no_message_label = 0;
+ context->open_instance = 0;
context->start_node = NULL;
context->end_node = std::make_pair("", context->end_node.second); //replaice context->end_node.second with NULL
@@ -154,12 +156,30 @@
{
context->z->print_report(RS_WARNING, L"Warning 02: There are more unreferenced MSC\n");
}
+
if(context->nonpointed.size() < 1 && context->mscs.size() > 0)
{
context->z->print_report(RS_ERROR, L"Error 03: There is no MSC without reference\n");
}
+
+ if(context->open_instance > 0)
+ {
+ if(context->open_instance == 1)
+ {
+ context->z->print_report(RS_WARNING, stringize() << "Warning 20: Msc has not finished " << context->open_instance << " instance\n");
+ }
+ else
+ {
+ context->z->print_report(RS_WARNING, stringize() << "Warning 20: Msc has not finished " << context->open_instance << " instances\n");
+ }
+ }
- s_Msc** result;
+ if(context->open_instance < 0)
+ {
+ context->z->print_report(RS_WARNING, L"Warning 21: Some instance has been finished more times\n");
+ }
+
+ s_Msc** result = NULL;
if(context->mscs.size() > 0){
result = new s_Msc*[context->mscs.size()+1];
@@ -189,14 +209,12 @@
intrusive_ptr_add_ref(my_msc);
result[position++] = my_msc;
}
- }
+ }
result[position] = NULL;
-//printf("pocet msc %d\n", position -1);
}
return result;
}
-
/*
* Memory initialization.
*/
@@ -266,8 +284,9 @@
if(context->mscs.find(context->msc_name) != context->mscs.end()){
context->z->print_report(RS_WARNING, stringize() << "Warning 18: Two mscs have the same name (" << TOWSTRING(context->msc_name) << ")\n");
}
+
context->mscs.insert(std::make_pair(context->msc_name, get_msc_fun(context)));
-
+
std::map<std::string, std::set<ReferenceNodePtr> >::iterator future_ref_it;
future_ref_it = context->future_reference.find(context->msc_name);
@@ -290,7 +309,7 @@
/*
* Bug report from grammar
*/
-void bug_report(struct Context* context, char* report){
+void bug_report_fun(struct Context* context, char* report){
context->z->print_report(RS_ERROR, TOWSTRING(report));
}
@@ -413,6 +432,7 @@
context->instances.insert(std::make_pair(context->element_name, instance));
}
context->myBmsc->add_instance(instance);
+ context->open_instance++;
}
/*
@@ -620,17 +640,21 @@
}
}
-void set_not_create_event(struct Context* context)
+void set_not_create_event_fun(struct Context* context)
{
- context->not_create_event = 0;
+ context->not_create_event = 0;
}
-void missing_message_label(struct Context* context)
+void missing_message_label_fun(struct Context* context)
{
- context->no_message_label = 1;
- context->z->print_report(RS_WARNING, stringize() << L"Warning 19: There is message without label on the " << TOWSTRING(context->element_name) << " instance\n");
+ context->no_message_label = 1;
+ context->z->print_report(RS_WARNING, stringize() << L"Warning 19: There is message without label on the " << TOWSTRING(context->element_name) << " instance\n");
}
+void end_instance_fun(struct Context* context){
+ context->open_instance--;
+}
+
/*
* FUNCTIONS FOR HMSC
*/
@@ -659,17 +683,17 @@
*/
void new_end_node_fun(struct Context* context)
{
- if (context->connect_name.size() == 0)
- {
+// 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");
- }
+// }
+// else
+// {
+// context->z->print_report(RS_WARNING, L"Warning 14: There is node which is successor of end node\n");
+// }
}
/*
Modified: trunk/src/data/Z120/Context.h
===================================================================
--- trunk/src/data/Z120/Context.h 2009-09-11 11:05:10 UTC (rev 314)
+++ trunk/src/data/Z120/Context.h 2009-09-11 11:50:12 UTC (rev 315)
@@ -55,7 +55,7 @@
void msc_was_read_fun(struct Context* context);
-void bug_report(struct Context* context, char* report);
+void bug_report_fun(struct Context* context, char* report);
//BMsc
void new_bmsc_fun(struct Context* context);
@@ -78,10 +78,12 @@
void set_event_name_fun(struct Context* context, char* name);
-void set_not_create_event(struct Context* context);
+void set_not_create_event_fun(struct Context* context);
-void missing_message_label(struct Context* context);
+void missing_message_label_fun(struct Context* context);
+void end_instance_fun(struct Context* context);
+
//HMsc
void new_hmsc_fun(struct Context* context);
Modified: trunk/src/data/Z120/Z120.g
===================================================================
--- trunk/src/data/Z120/Z120.g 2009-09-11 11:05:10 UTC (rev 314)
+++ trunk/src/data/Z120/Z120.g 2009-09-11 11:50:12 UTC (rev 315)
@@ -112,7 +112,7 @@
;
non_par_non_escape:
-Character_String | NAME {bug_report(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");}
//('a'..'z' | 'A'..'Z' | '0'..'9'| '?' | '%' | '+' | '-' | '!' | '/' | '*' | '"' | '=' | '@' | '&' | '#' | '.' | '_' | '\'')+ { bug_report(context, "The file is breaking the Z120 standard");}
@@ -395,7 +395,7 @@
('time' time_dest_list end)?
{
- set_not_create_event(context);
+ set_not_create_event_fun(context);
}
;
@@ -422,7 +422,7 @@
| shared_msc_reference
| shared_inline_expr
| instance_head_statement { new_instance_fun(context); }
- | instance_end_statement
+ | instance_end_statement { end_instance_fun(context); }
| stop
;
@@ -492,7 +492,7 @@
(NAME (',' NAME)? |
',' NAME
{
- missing_message_label(context);
+ missing_message_label_fun(context);
}) ('(' parameter_list ')')?
;
@@ -1372,8 +1372,11 @@
{
set_node_name_fun(context, (char*) $NAME.text->chars);
}
- ':' 'final' end
+ ':' 'final' (connection_list
{
+ bug_report_fun(context, "Warinig 14: HMSC has defined a successor for end node\n");
+ })? end
+ {
new_end_node_fun(context);
}
;
@@ -1409,7 +1412,7 @@
new_condition_node_fun(context);
break;
default:
- bug_report(context, "Internal Error 16: There is no node to create\n");
+ bug_report_fun(context, "Internal Error 16: There is no node to create\n");
}
}
@@ -1434,7 +1437,7 @@
start {new_start_node_fun(context);}
(node_expression
- | (NAME ':' {bug_report(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
;
@@ -1461,7 +1464,7 @@
new_condition_node_fun(context);
break;
default:
- bug_report(context, "Internal Error 16: There is no node to create\n");
+ bug_report_fun(context, "Internal Error 16: There is no node to create\n");
}
}
| 'end'
Modified: trunk/src/data/Z120/z120_load.cpp
===================================================================
--- trunk/src/data/Z120/z120_load.cpp 2009-09-11 11:05:10 UTC (rev 314)
+++ trunk/src/data/Z120/z120_load.cpp 2009-09-11 11:50:12 UTC (rev 315)
@@ -46,9 +46,15 @@
pZ120Parser psr = Z120ParserNew(tstream);
if (psr == NULL)
return result;
-
+
Msc** my_mscs = (Msc**)(psr->textual_msc_file(psr, static_cast<s_Z120*>(this)));
+ if (my_mscs == NULL)
+ {
+ print_report(RS_ERROR, stringize() << "Error 22: Syntax error ");
+ return result;
+ }
+
for(int i = 0; my_mscs[i] != NULL; i++)
{
MscPtr msc = my_mscs[i];
Modified: trunk/tests/z120_test/z120_test01.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test01.mpr.result 2009-09-11 11:05:10 UTC (rev 314)
+++ trunk/tests/z120_test/z120_test01.mpr.result 2009-09-11 11:50:12 UTC (rev 315)
@@ -6,6 +6,8 @@
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.mpr is correct, should be correct
mscdocument z120_test01;
Modified: trunk/tests/z120_test/z120_test39.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test39.mpr.result 2009-09-11 11:05:10 UTC (rev 314)
+++ trunk/tests/z120_test/z120_test39.mpr.result 2009-09-11 11:50:12 UTC (rev 315)
@@ -1,5 +1,7 @@
-Warning 20: The end node of HMSC has defined successor
+Warinig 14: HMSC has defined a successor for end node
+OK: z120_test39.mpr is correct, should be correct
+
mscdocument z120_test39;
msc Stranka_1;
initial connect L0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|