|
From: <got...@us...> - 2009-05-03 19:05:27
|
Revision: 243
http://scstudio.svn.sourceforge.net/scstudio/?rev=243&view=rev
Author: gotthardp
Date: 2009-05-03 19:05:14 +0000 (Sun, 03 May 2009)
Log Message:
-----------
Implemented UNICODE support.
Modified Paths:
--------------
trunk/src/check/boundedness/universal_boundedness_checker.cpp
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/order/acyclic_checker.h
trunk/src/check/order/fifo_checker.cpp
trunk/src/check/order/fifo_checker.h
trunk/src/check/pseudocode/communication_graph.cpp
trunk/src/check/pseudocode/communication_graph.h
trunk/src/check/pseudocode/msc_duplicators.cpp
trunk/src/check/pseudocode/utils.h
trunk/src/check/race/race_checker.cpp
trunk/src/check/race/race_checker.h
trunk/src/check/structure/name_checker.cpp
trunk/src/check/structure/name_checker.h
trunk/src/data/CMakeLists.txt
trunk/src/data/Z120/Context.cpp
trunk/src/data/Z120/main.cpp
trunk/src/data/Z120/z120.h
trunk/src/data/Z120/z120_load.cpp
trunk/src/data/Z120/z120_save.cpp
trunk/src/data/checker.h
trunk/src/data/engmann/engmann.cpp
trunk/src/data/formatter.h
trunk/src/data/msc.cpp
trunk/src/data/msc.h
trunk/src/data/reporter.h
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
trunk/src/view/visio/addon/extract.cpp
trunk/src/view/visio/addon/extract.h
trunk/src/view/visio/addon/optionsdlg.cpp
trunk/src/view/visio/addon/optionsdlg.h
trunk/src/view/visio/addon/reportview.cpp
trunk/src/view/visio/addon/reportview.h
trunk/src/view/visio/addon/visualize.cpp
trunk/src/view/visio/addon/visualize.h
trunk/tests/CMakeLists.txt
trunk/tests/acyclic_checker_test.cpp
trunk/tests/checker_test.cpp
trunk/tests/deadlock_checker_test.cpp
trunk/tests/engmann_test.cpp
trunk/tests/fifo_checker_test.cpp
trunk/tests/livelock_checker_test.cpp
trunk/tests/race_checker_test.cpp
trunk/tests/universal_boundedness_checker_test.cpp
trunk/tests/z120_test.cpp
Added Paths:
-----------
trunk/src/data/diacritics_build.py
trunk/src/data/msc_types.cpp
trunk/src/data/msc_types.h
trunk/src/data/strip_diacritics.cpp
Removed Paths:
-------------
trunk/src/data/msc_visual.h
Modified: trunk/src/check/boundedness/universal_boundedness_checker.cpp
===================================================================
--- trunk/src/check/boundedness/universal_boundedness_checker.cpp 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/boundedness/universal_boundedness_checker.cpp 2009-05-03 19:05:14 UTC (rev 243)
@@ -108,7 +108,7 @@
Checker::PreconditionList UniversalBoundednessChecker::get_preconditions(MscPtr msc) const
{
Checker::PreconditionList result;
- result.push_back(CheckerPrecondition("Unique Instance Names", PP_RECOMMENDED));
+ result.push_back(CheckerPrecondition(L"Unique Instance Names", PP_RECOMMENDED));
return result;
}
Modified: trunk/src/check/boundedness/universal_boundedness_checker.h
===================================================================
--- trunk/src/check/boundedness/universal_boundedness_checker.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/boundedness/universal_boundedness_checker.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -62,7 +62,7 @@
{
public:
void on_white_node_found(HMscNode *n);
- AssignListener(const std::map<std::string, unsigned> &map)
+ AssignListener(const std::map<std::wstring, unsigned> &map)
:m_node_number(0), m_label_map(map)
{}
unsigned get_vertex_count(void)
@@ -71,7 +71,7 @@
}
private:
unsigned m_node_number;
- const std::map<std::string, unsigned>& m_label_map;
+ const std::map<std::wstring, unsigned>& m_label_map;
};
class CycleListener: public WhiteNodeFoundListener
@@ -100,7 +100,7 @@
class NameCollector: public WhiteNodeFoundListener
{
private:
- std::map<std::string, unsigned> m_instance_map;
+ std::map<std::wstring, unsigned> m_instance_map;
public:
@@ -109,7 +109,7 @@
{
return m_instance_map.size();
}
- const std::map<std::string, unsigned> & get_instance_map(void)
+ const std::map<std::wstring, unsigned> & get_instance_map(void)
{
return m_instance_map;
}
@@ -141,8 +141,8 @@
* Human readable name of the property being checked.
*/
// note: DLL in Windows cannot return pointers to static data
- virtual std::string get_property_name() const
- { return "Universally Bounded"; }
+ virtual std::wstring get_property_name() const
+ { return L"Universally Bounded"; }
virtual PreconditionList get_preconditions(MscPtr msc) const;
Modified: trunk/src/check/liveness/deadlock_checker.h
===================================================================
--- trunk/src/check/liveness/deadlock_checker.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/liveness/deadlock_checker.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -129,8 +129,8 @@
* Human readable name of the property being checked.
*/
// note: DLL in Windows cannot return pointers to static data
- virtual std::string get_property_name() const
- { return "Deadlock Free"; }
+ virtual std::wstring get_property_name() const
+ { return L"Deadlock Free"; }
virtual PreconditionList get_preconditions(MscPtr msc) const;
Modified: trunk/src/check/liveness/livelock_checker.h
===================================================================
--- trunk/src/check/liveness/livelock_checker.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/liveness/livelock_checker.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -103,8 +103,8 @@
* Human readable name of the property being checked.
*/
// note: DLL in Windows cannot return pointers to static data
- virtual std::string get_property_name() const
- { return "Livelock Free"; }
+ virtual std::wstring get_property_name() const
+ { return L"Livelock Free"; }
virtual PreconditionList get_preconditions(MscPtr msc) const;
Modified: trunk/src/check/order/acyclic_checker.h
===================================================================
--- trunk/src/check/order/acyclic_checker.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/order/acyclic_checker.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -64,8 +64,8 @@
* Human readable name of the property being checked.
*/
// note: DLL in Windows cannot return pointers to static data
- virtual std::string get_property_name() const
- { return "Acyclic"; }
+ virtual std::wstring get_property_name() const
+ { return L"Acyclic"; }
virtual PreconditionList get_preconditions(MscPtr msc) const;
Modified: trunk/src/check/order/fifo_checker.cpp
===================================================================
--- trunk/src/check/order/fifo_checker.cpp 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/order/fifo_checker.cpp 2009-05-03 19:05:14 UTC (rev 243)
@@ -26,7 +26,7 @@
Checker::PreconditionList FifoChecker::get_preconditions(MscPtr msc) const
{
Checker::PreconditionList result;
- result.push_back(CheckerPrecondition("Acyclic", PP_REQUIRED));
+ result.push_back(CheckerPrecondition(L"Acyclic", PP_REQUIRED));
return result;
}
Modified: trunk/src/check/order/fifo_checker.h
===================================================================
--- trunk/src/check/order/fifo_checker.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/order/fifo_checker.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -68,8 +68,8 @@
* Human readable name of the property being checked.
*/
// note: DLL in Windows cannot return pointers to static data
- virtual std::string get_property_name() const
- { return "FIFO"; }
+ virtual std::wstring get_property_name() const
+ { return L"FIFO"; }
virtual PreconditionList get_preconditions(MscPtr msc) const;
Modified: trunk/src/check/pseudocode/communication_graph.cpp
===================================================================
--- trunk/src/check/pseudocode/communication_graph.cpp 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/pseudocode/communication_graph.cpp 2009-05-03 19:05:14 UTC (rev 243)
@@ -33,7 +33,7 @@
m_graph.at(from).at(to) = 1;
}
}
-void CommunicationGraph::create_from_bmsc_with_map(BMscPtr bmsc, const std::map<std::string, unsigned> & instance_map)
+void CommunicationGraph::create_from_bmsc_with_map(BMscPtr bmsc, const std::map<std::wstring, unsigned> & instance_map)
{
m_graph.clear();
m_graph.resize(instance_map.size());
@@ -66,8 +66,8 @@
void CommunicationGraph::create_from_bmsc(BMscPtr bmsc)
{
m_graph.clear();
- std::map<std::string, InstancePtr> instance_map;
- std::map<std::string, InstancePtr>::iterator instance_map_iterator;
+ std::map<std::wstring, InstancePtr> instance_map;
+ std::map<std::wstring, InstancePtr>::iterator instance_map_iterator;
const InstancePtrList& instance_list = bmsc->get_instances();
InstancePtrList::const_iterator instance_list_iterator;
Modified: trunk/src/check/pseudocode/communication_graph.h
===================================================================
--- trunk/src/check/pseudocode/communication_graph.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/pseudocode/communication_graph.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -49,7 +49,7 @@
this->create_from_bmsc(bmsc);
}
void create_from_bmsc(BMscPtr bmsc);
- void create_from_bmsc_with_map(BMscPtr bmsc, const std::map<std::string, unsigned> & instance_map);
+ void create_from_bmsc_with_map(BMscPtr bmsc, const std::map<std::wstring, unsigned> & instance_map);
void clear(void)
{
m_graph.clear();
Modified: trunk/src/check/pseudocode/msc_duplicators.cpp
===================================================================
--- trunk/src/check/pseudocode/msc_duplicators.cpp 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/pseudocode/msc_duplicators.cpp 2009-05-03 19:05:14 UTC (rev 243)
@@ -740,7 +740,7 @@
if(n && new_elem)
{
dynamic_cast<HMscNode*>(get_copy(*e))->set_position(
- Point(
+ MscPoint(
FLAT_PATH_INITIAL_X+current_depth*FLAT_PATH_HORIZONTAL_STEP,
FLAT_PATH_INITIAL_Y+current_index*FLAT_PATH_VERTICAL_STEP
)
@@ -754,7 +754,7 @@
{
current_depth--;
dynamic_cast<HMscNode*>(get_copy(*e))->set_position(
- Point(
+ MscPoint(
FLAT_PATH_INITIAL_X+current_depth*FLAT_PATH_HORIZONTAL_STEP,
FLAT_PATH_INITIAL_Y+current_index*FLAT_PATH_VERTICAL_STEP
)
Modified: trunk/src/check/pseudocode/utils.h
===================================================================
--- trunk/src/check/pseudocode/utils.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/pseudocode/utils.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -8,7 +8,7 @@
#include "data/dfsb_hmsc_traverser.h"
#include "check/pseudocode/export.h"
-typedef std::map<std::string,size_t> StringSizeTMap;
+typedef std::map<std::wstring,size_t> StringSizeTMap;
/**
* Marks Instances with apropriate identifiers
Modified: trunk/src/check/race/race_checker.cpp
===================================================================
--- trunk/src/check/race/race_checker.cpp 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/race/race_checker.cpp 2009-05-03 19:05:14 UTC (rev 243)
@@ -247,16 +247,16 @@
HMscPtr hmsc = boost::dynamic_pointer_cast<HMsc>(msc);
if(hmsc != NULL)
{
- result.push_back(CheckerPrecondition("Deadlock Free", PP_REQUIRED));
- result.push_back(CheckerPrecondition("Livelock Free", PP_REQUIRED));
+ result.push_back(CheckerPrecondition(L"Deadlock Free", PP_REQUIRED));
+ result.push_back(CheckerPrecondition(L"Livelock Free", PP_REQUIRED));
}
// FIXME: Acylic and FIFO cannot check HMSC (bug #2557089)
BMscPtr bmsc = boost::dynamic_pointer_cast<BMsc>(msc);
if(bmsc != NULL)
{
- result.push_back(CheckerPrecondition("Acyclic", PP_REQUIRED));
- result.push_back(CheckerPrecondition("FIFO", PP_REQUIRED));
+ result.push_back(CheckerPrecondition(L"Acyclic", PP_REQUIRED));
+ result.push_back(CheckerPrecondition(L"FIFO", PP_REQUIRED));
}
return result;
Modified: trunk/src/check/race/race_checker.h
===================================================================
--- trunk/src/check/race/race_checker.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/race/race_checker.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -225,8 +225,8 @@
* Human readable name of the property being checked.
*/
// note: DLL in Windows cannot return pointers to static data
- virtual std::string get_property_name() const
- { return "Race Free"; }
+ virtual std::wstring get_property_name() const
+ { return L"Race Free"; }
virtual PreconditionList get_preconditions(MscPtr msc) const;
Modified: trunk/src/check/structure/name_checker.cpp
===================================================================
--- trunk/src/check/structure/name_checker.cpp 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/structure/name_checker.cpp 2009-05-03 19:05:14 UTC (rev 243)
@@ -36,7 +36,7 @@
void NameListener::on_white_node_found(HMscNode *n)
{
size_t num_of_instances;
- std::vector<std::string> current_labels;
+ std::vector<std::wstring> current_labels;
InstancePtrList::const_iterator instance_iterator;
ReferenceNode* refnode = dynamic_cast<ReferenceNode*>(n);
@@ -147,7 +147,7 @@
BMscPtr NameChecker::check(BMscPtr bmsc, ChannelMapperPtr chm)
{
- HMscPtr hmsc1(new HMsc("HMsc1"));
+ HMscPtr hmsc1(new HMsc(L"HMsc1"));
StartNodePtr start1 = new StartNode();
hmsc1->set_start(start1);
ReferenceNodePtr r1_1(new ReferenceNode());
Modified: trunk/src/check/structure/name_checker.h
===================================================================
--- trunk/src/check/structure/name_checker.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/check/structure/name_checker.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -45,14 +45,14 @@
class DuplicateNamesException: public std::exception
{
public:
- DuplicateNamesException(const std::string& name)
+ DuplicateNamesException(const std::wstring& name)
: m_name(name)
{ }
virtual ~DuplicateNamesException() throw()
{ }
- const std::string& get_name() const
+ const std::wstring& get_name() const
{
return m_name;
}
@@ -63,7 +63,7 @@
}
private:
- std::string m_name;
+ std::wstring m_name;
};
class FindFirstNodeListener:public WhiteNodeFoundListener
@@ -86,7 +86,7 @@
{
private:
bool m_first_node;
- std::vector<std::string> m_instance_names;
+ std::vector<std::wstring> m_instance_names;
public:
void on_white_node_found(HMscNode *n);
@@ -132,8 +132,8 @@
* Human readable name of the property being checked.
*/
// note: DLL in Windows cannot return pointers to static data
- virtual std::string get_property_name() const
- { return "Unique instance names"; }
+ virtual std::wstring get_property_name() const
+ { return L"Unique instance names"; }
virtual PreconditionList get_preconditions(MscPtr msc) const;
Modified: trunk/src/data/CMakeLists.txt
===================================================================
--- trunk/src/data/CMakeLists.txt 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/data/CMakeLists.txt 2009-05-03 19:05:14 UTC (rev 243)
@@ -1,8 +1,10 @@
ADD_LIBRARY(scmsc SHARED
export.h
+ msc_types.cpp
+ msc_types.h
+ strip_diacritics.cpp
msc.cpp
msc.h
- msc_visual.h
reporter.h
formatter.h
checker.h
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/data/Z120/Context.cpp 2009-05-03 19:05:14 UTC (rev 243)
@@ -95,8 +95,8 @@
*/
void init(struct Context* context)
{
- context->myBmsc = new BMsc("");
- context->myHmsc = new HMsc("");
+ context->myBmsc = new BMsc();
+ context->myHmsc = new HMsc();
context->myBmsc = NULL;
context->myHmsc = NULL;
context->element_name = "";
@@ -141,7 +141,7 @@
if(context->nonpointed.size() == 1){
if(context->mscs.find(*(context->nonpointed.begin())) == context->mscs.end())
{
- context->z->print_report(RS_ERROR, "Internal Error 01: MSC was not found \n");
+ context->z->print_report(RS_ERROR, L"Internal Error 01: MSC was not found \n");
}
else{
my_msc = context->mscs.find(*(context->nonpointed.begin()))->second.get();
@@ -151,11 +151,11 @@
{
if(context->nonpointed.size() > 1)
{
- context->z->print_report(RS_ERROR, "Error 02: There are more unreferenced MSC\n");
+ context->z->print_report(RS_ERROR, L"Error 02: There are more unreferenced MSC\n");
}
else
{
- context->z->print_report(RS_ERROR, "Error 03: There is no MSC without reference \n");
+ context->z->print_report(RS_ERROR, L"Error 03: There is no MSC without reference \n");
}
}
@@ -194,25 +194,25 @@
void check_collections_fun(struct Context* context)
{
if(!context->coregion_area_opened.empty())
- context->z->print_report(RS_ERROR, stringize() << "Warning 04: Instance " << context->element_name << "does not have finished some coregion\n");
+ context->z->print_report(RS_ERROR, stringize() << "Warning 04: Instance " << TOWSTRING(context->element_name) << "does not have finished some coregion\n");
if(!context->messages.empty())
- context->z->print_report(RS_ERROR, "Error 05: There is complete message without receiver\n");
+ context->z->print_report(RS_ERROR, L"Error 05: There is complete message without receiver\n");
if(!context->future_events.empty())
- context->z->print_report(RS_ERROR, "Error 06: There is dependency on nonexisted event\n");
+ context->z->print_report(RS_ERROR, L"Error 06: There is dependency on nonexisted event\n");
if(!context->order_events.empty())
- context->z->print_report(RS_ERROR, "Error 07: There is reference to nonexisted event\n");
+ context->z->print_report(RS_ERROR, L"Error 07: There is reference to nonexisted event\n");
if(!context->future_connections.empty())
- context->z->print_report(RS_ERROR, "Error 08: There is reference to nonexisted node\n");
+ context->z->print_report(RS_ERROR, L"Error 08: There is reference to nonexisted node\n");
}
void check_references_fun(struct Context* context)
{
if(!context->future_reference.empty())
- context->z->print_report(RS_ERROR, "Error 09: There is references to nonexisted MSC\n");
+ context->z->print_report(RS_ERROR, L"Error 09: There is references to nonexisted MSC\n");
}
void msc_was_read_fun(struct Context* context)
@@ -242,7 +242,7 @@
* Bug report from grammar
*/
void bug_report(struct Context* context, char* report){
- context->z->print_report(RS_ERROR, report);
+ context->z->print_report(RS_ERROR, TOWSTRING(report));
}
/*
@@ -250,7 +250,7 @@
*/
void new_bmsc_fun(struct Context* context)
{
- context->myBmsc = new BMsc(context->msc_name);
+ context->myBmsc = new BMsc(TOWSTRING(context->msc_name));
}
/*
@@ -297,7 +297,7 @@
context->current_event = event;
- IncompleteMessagePtr message = new IncompleteMessage(LOST, msg_name);
+ IncompleteMessagePtr message = new IncompleteMessage(LOST, TOWSTRING(msg_name));
message->glue_event(event);
//if event is named, it adds event to named_events
@@ -356,7 +356,7 @@
context->current_event = event;
- IncompleteMessagePtr message = new IncompleteMessage(FOUND, msg_name);
+ IncompleteMessagePtr message = new IncompleteMessage(FOUND, TOWSTRING(msg_name));
message->glue_event(event);
//if event is named, it adds event to named_events
@@ -383,7 +383,7 @@
*/
void new_instance_fun(struct Context* context)
{
- InstancePtr instance(new Instance(context->element_name));
+ InstancePtr instance(new Instance(TOWSTRING(context->element_name)));
context->instances.insert(std::make_pair(context->element_name, instance));
context->myBmsc->add_instance(instance);
}
@@ -408,7 +408,7 @@
}
else
{
- context->z->print_report(RS_ERROR, stringize() << "Error 10: Instance " << context->element_name << " has already had opened some coregion\n");
+ context->z->print_report(RS_ERROR, stringize() << "Error 10: Instance " << TOWSTRING(context->element_name) << " has already had opened some coregion\n");
}
}
@@ -425,7 +425,7 @@
}
else
{
- context->z->print_report(RS_ERROR, stringize() << "Error 11: Instance " << context->element_name << " does not have opened any coregion\n"); //check
+ context->z->print_report(RS_ERROR, stringize() << "Error 11: Instance " << TOWSTRING(context->element_name) << " does not have opened any coregion\n"); //check
}
}
@@ -488,10 +488,10 @@
{
if(message_it != context->messages.end())
{
- context->z->print_report(RS_ERROR, "Error 12: Message has already had specified the sender\n"); //warning
+ context->z->print_report(RS_ERROR, L"Error 12: Message has already had specified the sender\n"); //warning
}
- CompleteMessagePtr message = new CompleteMessage(msg_name);
+ CompleteMessagePtr message = new CompleteMessage(TOWSTRING(msg_name));
message->glue_send_event(event);
context->messages.insert(std::make_pair(msg_identification, message));
}
@@ -567,7 +567,7 @@
{
std::cout << "get receive event nieje null " <<std::endl;
}
- CompleteMessagePtr message = new CompleteMessage(msg_name);
+ CompleteMessagePtr message = new CompleteMessage(TOWSTRING(msg_name));
message->glue_receive_event(event);
context->messages.insert(std::make_pair(msg_identification, message));
}
@@ -592,7 +592,7 @@
std::map<std::string, CoregionEventPtr>::iterator named_event_it;
CoregionEventPtr event = boost::dynamic_pointer_cast<CoregionEvent>(context->current_event);
if(event == NULL){
- context->z->print_report(RS_ERROR, "Internal Error 13: Typecast failed\n");
+ context->z->print_report(RS_ERROR, L"Internal Error 13: Typecast failed\n");
return;
}
for(it = context->order_events.begin(); it != context->order_events.end(); ++it){
@@ -619,7 +619,7 @@
std::map<std::string, CoregionEventPtr>::iterator named_event_it;
CoregionEventPtr event = boost::dynamic_pointer_cast<CoregionEvent> (context->current_event);
if(event == NULL){
- context->z->print_report(RS_ERROR, "Internal Error 13: Typecast failed\n");
+ context->z->print_report(RS_ERROR, L"Internal Error 13: Typecast failed\n");
return;
}
for(it = context->order_events.begin(); it != context->order_events.end(); ++it){
@@ -659,7 +659,7 @@
*/
void new_hmsc_fun(struct Context* context)
{
- context->myHmsc = new HMsc(context->msc_name);
+ context->myHmsc = new HMsc(TOWSTRING(context->msc_name));
}
/*
@@ -687,7 +687,7 @@
}
else
{
- context->z->print_report(RS_ERROR, "Error 14: There is node which is successor of end node\n");
+ context->z->print_report(RS_ERROR, L"Error 14: There is node which is successor of end node\n");
}
}
@@ -769,7 +769,7 @@
}
else
{
- context->z->print_report(RS_ERROR, stringize() << "Error 15: The node " << context->element_name << " has already been existing\n");
+ context->z->print_report(RS_ERROR, stringize() << "Error 15: The node " << TOWSTRING(context->element_name) << " has already been existing\n");
}
}
@@ -790,7 +790,7 @@
}
else
{
- context->z->print_report(RS_ERROR, stringize() << "Error 15: The node " << context->element_name << " has already been existing\n");
+ context->z->print_report(RS_ERROR, stringize() << "Error 15: The node " << TOWSTRING(context->element_name) << " has already been existing\n");
}
context->node_type = 0;
}
@@ -804,7 +804,7 @@
if (it == context->hmsc_nodes.end())
{
- ConditionNodePtr node = new ConditionNode(context->condition_name);
+ 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);
@@ -812,7 +812,7 @@
}
else
{
- context->z->print_report(RS_ERROR, stringize() << "Error 15: The node " << context->element_name << " has already been existing\n");
+ context->z->print_report(RS_ERROR, stringize() << "Error 15: The node " << TOWSTRING(context->element_name) << " has already been existing\n");
}
context->node_type = 0;
}
Modified: trunk/src/data/Z120/main.cpp
===================================================================
--- trunk/src/data/Z120/main.cpp 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/data/Z120/main.cpp 2009-05-03 19:05:14 UTC (rev 243)
@@ -13,7 +13,7 @@
std::string filename = argv[1];
Z120 z;
- StreamReportPrinter printer(std::cerr);
+ StreamReportPrinter printer(std::wcerr);
z.set_printer(&printer);
MscPtr msc = z.load_msc(filename);
// BMscPtr bmsc = boost::dynamic_pointer_cast<BMsc>(msc);
Modified: trunk/src/data/Z120/z120.h
===================================================================
--- trunk/src/data/Z120/z120.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/data/Z120/z120.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -45,7 +45,7 @@
virtual MscPtr load_msc(const std::string &filename);
#endif
//! export MSC document
- virtual int save_msc(std::ostream& stream, const std::string &name, const std::vector<MscPtr>& msc);
+ virtual int save_msc(std::ostream& stream, const std::wstring &name, const std::vector<MscPtr>& msc);
protected:
int save_msc(std::ostream& stream, const MscPtr& msc);
Modified: trunk/src/data/Z120/z120_load.cpp
===================================================================
--- trunk/src/data/Z120/z120_load.cpp 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/data/Z120/z120_load.cpp 2009-05-03 19:05:14 UTC (rev 243)
@@ -28,7 +28,7 @@
if (input == NULL || (int)input < 0)
{
print_report(RS_ERROR,
- stringize() << "Cannot open file '" << filename << "'.");
+ stringize() << "Cannot open file '" << TOWSTRING(filename) << "'.");
return NULL;
}
Modified: trunk/src/data/Z120/z120_save.cpp
===================================================================
--- trunk/src/data/Z120/z120_save.cpp 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/data/Z120/z120_save.cpp 2009-05-03 19:05:14 UTC (rev 243)
@@ -24,12 +24,71 @@
#include "data/Z120/z120.h"
-int Z120::save_msc(std::ostream& stream, const std::string &name, const std::vector<MscPtr>& msc)
+/* String modifier to print Z.120 names in a correct character set.
+ *
+ * This is a last resort correction. Invalid characters are replaced by underscore.
+ * More sophisticated transliteration should be done in the front-ends using platform
+ * specific functions.
+ *
+ * Note: Naming conventions violated for 'code prettiness' reasons.
+ */
+class VALID_NAME
{
+public:
+ VALID_NAME(const std::wstring &name)
+ : m_name(name)
+ { }
+
+ friend std::ostream&
+ operator<<(std::ostream& os, const VALID_NAME& value)
+ {
+ static const char replacement = '_';
+ bool was_replacement = false;
+
+ for(std::wstring::const_iterator pos = value.m_name.begin();
+ pos != value.m_name.end(); pos++)
+ {
+ char stripped;
+
+ if(*pos >= 'A' && *pos <= 'Z' || *pos >= 'a' && *pos <= 'z'
+ || *pos >= '0' && *pos <= '9'
+ || *pos == '_' || *pos == '.')
+ {
+ // print valid 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_name;
+};
+
+int Z120::save_msc(std::ostream& stream, const std::wstring &name, const std::vector<MscPtr>& msc)
+{
int result = 0; // error count
- stream << "mscdocument " << name << ";" << std::endl;
+ stream << "mscdocument " << VALID_NAME(name) << ";" << std::endl;
- std::set<std::string> printed;
+ std::set<std::wstring> printed;
// list of MSC to be printed
// new references may be added to m_printing by save_hmsc()
@@ -95,54 +154,55 @@
list.push_back(item);
}
-// for debugging purposes
void print_element_attributes(std::ostream& stream, const MscElementPtr& element)
{
- stream << "/* ";
+ if(element->get_marked())
+ stream << "/* MARKED */" << std::endl;
std::set<std::string> attributes = element->get_attribute_names();
- stream << "[";
- for(std::set<std::string>::const_iterator pos = attributes.begin();
- pos != attributes.end(); pos++)
+ if(!attributes.empty())
{
- stream << *pos;
+ stream << "/* ATTRIBUTES: [";
+ for(std::set<std::string>::const_iterator pos = attributes.begin();
+ pos != attributes.end(); pos++)
+ {
+ stream << *pos;
+ }
+ stream << "] */" << std::endl;
}
- stream << "]";
-
- stream << " */" << std::endl;
}
void print_event(std::ostream& stream, PtrIDMap<MscMessagePtr>& message_id_map,
const EventPtr& event)
{
- // print_element_attributes(stream, event);
+ print_element_attributes(stream, event);
CompleteMessagePtr complete_message = event->get_complete_message();
if(complete_message != NULL)
{
- // print_element_attributes(stream, complete_message);
+ print_element_attributes(stream, complete_message);
if(complete_message->get_send_event() == event)
- stream << "out " << complete_message->get_label()
+ stream << "out " << VALID_NAME(complete_message->get_label())
<< "," << message_id_map.get_id(complete_message)
- << " to " << complete_message->get_receiver()->get_label();
+ << " to " << VALID_NAME(complete_message->get_receiver()->get_label());
if(complete_message->get_receive_event() == event)
- stream << "in " << complete_message->get_label()
+ stream << "in " << VALID_NAME(complete_message->get_label())
<< "," << message_id_map.get_id(complete_message)
- << " from " << complete_message->get_sender()->get_label();
+ << " from " << VALID_NAME(complete_message->get_sender()->get_label());
}
IncompleteMessagePtr incomplete_message = event->get_incomplete_message();
if(incomplete_message != NULL)
{
- // print_element_attributes(stream, incomplete_message);
+ print_element_attributes(stream, incomplete_message);
if(incomplete_message->is_lost())
- stream << "out " << incomplete_message->get_label()
+ stream << "out " << VALID_NAME(incomplete_message->get_label())
<< "," << message_id_map.get_id(incomplete_message)
<< " to lost";
if(incomplete_message->is_found())
- stream << "in " << incomplete_message->get_label()
+ stream << "in " << VALID_NAME(incomplete_message->get_label())
<< "," << message_id_map.get_id(incomplete_message)
<< " from found";
}
@@ -153,28 +213,28 @@
PtrIDMap<MscMessagePtr> message_id_map; // message instance identifiers
PtrIDMap<EventPtr> event_id_map; // event identifiers
- // print_element_attributes(stream, bmsc);
- stream << "msc " << bmsc->get_label() << ";" << std::endl;
+ print_element_attributes(stream, bmsc);
+ stream << "msc " << VALID_NAME(bmsc->get_label()) << ";" << std::endl;
// declare instances
for(InstancePtrList::const_iterator ipos = bmsc->get_instances().begin();
ipos != bmsc->get_instances().end(); ipos++)
{
- stream << "inst " << (*ipos)->get_label() << ";" << std::endl;
+ stream << "inst " << VALID_NAME((*ipos)->get_label()) << ";" << std::endl;
}
// define instances
for(InstancePtrList::const_iterator ipos = bmsc->get_instances().begin();
ipos != bmsc->get_instances().end(); ipos++)
{
- // print_element_attributes(stream, *ipos);
- stream << (*ipos)->get_label() << ": instance;" << std::endl;
+ print_element_attributes(stream, *ipos);
+ stream << VALID_NAME((*ipos)->get_label()) << ": instance;" << std::endl;
// walk through event areas
for(EventAreaPtr area = (*ipos)->get_first();
area != NULL; area = area->get_next())
{
- // print_element_attributes(stream, area);
+ print_element_attributes(stream, area);
StrictOrderAreaPtr strict_area = boost::dynamic_pointer_cast<StrictOrderArea>(area);
if(strict_area != NULL)
@@ -247,8 +307,8 @@
// nodes to be processed; this is to avoid recursion
std::list<HMscNodePtr> node_stack;
- // print_element_attributes(stream, hmsc);
- stream << "msc " << hmsc->get_label() << ";" << std::endl;
+ print_element_attributes(stream, hmsc);
+ stream << "msc " << VALID_NAME(hmsc->get_label()) << ";" << std::endl;
// initialize the stack with the start node
push_back_if_unique<HMscNodePtr>(node_stack, hmsc->get_start());
@@ -257,7 +317,7 @@
for(std::list<HMscNodePtr>::const_iterator npos = node_stack.begin();
npos != node_stack.end(); npos++)
{
- // print_element_attributes(stream, *npos);
+ print_element_attributes(stream, *npos);
StartNodePtr start_node = boost::dynamic_pointer_cast<StartNode>(*npos);
if(start_node != NULL)
@@ -269,7 +329,8 @@
if(condition_node != NULL)
{
stream << "L" << node_id_map.get_id(*npos)
- << ": condition " << condition_node->get_label();
+ << ": condition " << VALID_NAME(condition_node->get_label());
+ // TODO: expressions may also appear as conditions
}
ConnectionNodePtr connection_node = boost::dynamic_pointer_cast<ConnectionNode>(*npos);
@@ -283,7 +344,7 @@
if(reference_node != NULL)
{
stream << "L" << node_id_map.get_id(*npos)
- << ": reference " << reference_node->get_msc()->get_label();
+ << ": reference " << VALID_NAME(reference_node->get_msc()->get_label());
m_printing.push_back(reference_node->get_msc());
}
@@ -300,7 +361,7 @@
for(NodeRelationPtrSet::const_iterator spos = predecessor_node->get_successors().begin();
spos != predecessor_node->get_successors().end(); spos++)
{
- // print_element_attributes(stream, *spos);
+ print_element_attributes(stream, *spos);
SuccessorNode *successor = (*spos)->get_successor();
Modified: trunk/src/data/checker.h
===================================================================
--- trunk/src/data/checker.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/data/checker.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -47,7 +47,7 @@
/**
* Human readable name of the property being checked.
*/
- virtual std::string get_property_name() const = 0;
+ virtual std::wstring get_property_name() const = 0;
enum PreconditionPriority
{
@@ -58,11 +58,11 @@
struct CheckerPrecondition
{
- CheckerPrecondition(const std::string& name, PreconditionPriority prio)
+ CheckerPrecondition(const std::wstring& name, PreconditionPriority prio)
: property_name(name), priority(prio)
{ }
- std::string property_name;
+ std::wstring property_name;
PreconditionPriority priority;
};
//! List of properties that must be satisfied before executing the check.
@@ -293,9 +293,9 @@
class SRMessagePart
{
- std::string m_sender;
+ std::wstring m_sender;
- std::string m_receiver;
+ std::wstring m_receiver;
public:
@@ -341,11 +341,11 @@
*/
class SRMMessagePart {
- std::string m_sender;
+ std::wstring m_sender;
- std::string m_receiver;
+ std::wstring m_receiver;
- std::string m_label;
+ std::wstring m_label;
public:
Added: trunk/src/data/diacritics_build.py
===================================================================
--- trunk/src/data/diacritics_build.py (rev 0)
+++ trunk/src/data/diacritics_build.py 2009-05-03 19:05:14 UTC (rev 243)
@@ -0,0 +1,81 @@
+#
+# 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$
+
+import csv
+
+array = {}
+
+# download from http://unicode.org/Public/UNIDATA/UnicodeData.txt
+# see http://unicode.org/Public/UNIDATA/UCD.html
+unicodeData = csv.reader(open('UnicodeData.txt'), delimiter=';')
+for row in unicodeData:
+ uchar = int(row[0],16)
+
+ # inspect unicode character decomposition
+ # decomposed [a-zA-Z] characters are considered equivalent to the wchar
+ codes = row[5].split(' ')
+ for c in codes:
+ try:
+ ch = int(c,16)
+ except:
+ ch = None
+
+ # check if this wchar is decomposed to [a-zA-Z]
+ # the table is built only for unicode character 0..1024
+ if uchar < 1024 and (ch >= ord('a') and ch <= ord('z') or ch >= ord('A') and ch <= ord('Z')):
+ array[uchar] = chr(ch)
+
+minimum = min(array.keys())
+maximum = max(array.keys())
+
+file = open("strip_diacritics.cpp", 'wt')
+
+file.write('''
+// Generated by diacritics_build.py. Do not edit!
+#include "data/msc_types.h"
+
+static char transliteration_table[''' + str(maximum-minimum+1) + '''] = {
+''')
+
+for x in range(minimum,maximum+1):
+ try:
+ file.write("'" + array[x] + "'")
+ except:
+ file.write("0")
+
+ if x < maximum:
+ file.write(",")
+
+ if (x-minimum+1) % 16 == 0:
+ file.write("\n")
+
+file.write("};\n")
+
+file.write('''
+char strip_diacritics(wchar_t ch)
+{
+ if(ch < ''' + str(minimum) + ' || ch > ' + str(maximum) + ''')
+ return 0;
+
+ // lookup equivalent character
+ return transliteration_table[ch-''' + str(minimum) + '''];
+}
+''')
+
+file.close()
+
+# $Id$
Property changes on: trunk/src/data/diacritics_build.py
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/data/engmann/engmann.cpp
===================================================================
--- trunk/src/data/engmann/engmann.cpp 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/data/engmann/engmann.cpp 2009-05-03 19:05:14 UTC (rev 243)
@@ -34,11 +34,11 @@
}
type;
- std::string text;
+ std::wstring text;
TToken(TType t)
: type(t) { }
- TToken(TType t, const std::string& s)
+ TToken(TType t, const std::wstring& s)
: type(t), text(s) { }
};
@@ -55,23 +55,23 @@
}
}
-static void trim(std::string& str)
+static void trim(std::wstring& str)
{
- std::string::size_type pos = str.find_last_not_of(' ');
- if(pos != std::string::npos)
+ std::wstring::size_type pos = str.find_last_not_of(' ');
+ if(pos != std::wstring::npos)
{
str.erase(pos + 1);
pos = str.find_first_not_of(' ');
- if(pos != std::string::npos)
+ if(pos != std::wstring::npos)
str.erase(0, pos);
}
else
str.erase(str.begin(), str.end());
}
-static std::string read_line(std::istream& stream)
+static std::wstring read_line(std::istream& stream)
{
- std::string result;
+ std::wstring result;
// skip leading whitespace
skip_whitespace(stream);
// read the text
@@ -105,7 +105,7 @@
char ch = stream.get();
if(is_word_char(ch))
{
- std::string word;
+ std::wstring word;
do
{
word.push_back(ch);
@@ -128,8 +128,8 @@
return TToken(TToken::T_EOF);
}
-typedef std::map<std::string,EventAreaPtr> InstanceAreaMap;
-static EventAreaPtr get_instance_area(const InstanceAreaMap& instances, const std::string name)
+typedef std::map<std::wstring,EventAreaPtr> InstanceAreaMap;
+static EventAreaPtr get_instance_area(const InstanceAreaMap& instances, const std::wstring name)
{
InstanceAreaMap::const_iterator pos = instances.find(name);
if(pos == instances.end())
@@ -155,7 +155,7 @@
if(!stream.good())
{
print_report(RS_ERROR,
- stringize() << "Cannot open file '" << filename << "'.");
+ stringize() << "Cannot open file '" << TOWSTRING(filename) << "'.");
return NULL;
}
@@ -168,11 +168,11 @@
// title | node
if(next_token.type == TToken::T_COLON)
{
- if(strcmp(token.text.c_str(), "title") == 0)
+ if(wcscmp(token.text.c_str(), L"title") == 0)
{
result->set_label(read_line(stream));
}
- else if(strcmp(token.text.c_str(), "node") == 0)
+ else if(wcscmp(token.text.c_str(), L"node") == 0)
{
TToken ip_address = get_token(stream);
TToken node_name = get_token(stream);
@@ -180,7 +180,7 @@
// create new instance
InstancePtr inst = new Instance(node_name.text);
inst->set_width(10);
- inst->set_line_begin(Point(current_x,5));
+ inst->set_line_begin(MscPoint(current_x,5));
result->add_instance(inst);
EventAreaPtr area = new StrictOrderArea();
@@ -198,7 +198,7 @@
// message
else if(next_token.type == TToken::T_WORD)
{
- std::string message_label = read_line(stream);
+ std::wstring message_label = read_line(stream);
EventAreaPtr from_area = get_instance_area(instances, token.text);
EventAreaPtr to_area = get_instance_area(instances, next_token.text);
@@ -207,10 +207,10 @@
CompleteMessagePtr message = new CompleteMessage(message_label);
EventPtr from_event = from_area->add_event();
- from_event->set_position(Point(0,current_y));
+ from_event->set_position(MscPoint(0,current_y));
EventPtr to_event = to_area->add_event();
- to_event->set_position(Point(0,current_y));
+ to_event->set_position(MscPoint(0,current_y));
message->glue_events(from_event, to_event);
}
@@ -239,7 +239,7 @@
Coordinate my_x = inst->get_line_begin().get_x();
Coordinate my_y = inst->get_line_begin().get_y();
- inst->set_line_end(Point(my_x,my_y+current_y));
+ inst->set_line_end(MscPoint(my_x,my_y+current_y));
}
return result;
Modified: trunk/src/data/formatter.h
===================================================================
--- trunk/src/data/formatter.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/data/formatter.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -55,7 +55,7 @@
{
public:
//! export MSC document
- virtual int save_msc(std::ostream& stream, const std::string &name, const std::vector<MscPtr>& msc) = 0;
+ virtual int save_msc(std::ostream& stream, const std::wstring &name, const std::vector<MscPtr>& msc) = 0;
};
typedef boost::shared_ptr<ExportFormatter> ExportFormatterPtr;
Modified: trunk/src/data/msc.cpp
===================================================================
--- trunk/src/data/msc.cpp 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/data/msc.cpp 2009-05-03 19:05:14 UTC (rev 243)
@@ -245,7 +245,7 @@
area->set_instance(this);
}
-Instance::Instance(const std::string& label, const std::string& kind):
+Instance::Instance(const std::wstring& label, const std::wstring& kind):
MscElementTmpl<Instance>(NULL),m_label(label),m_kind(kind)
{
m_width = 0;
@@ -273,7 +273,7 @@
/////////////////////////////////////////////////////////////////////////////
-MscMessage::MscMessage(const std::string& label):
+MscMessage::MscMessage(const std::wstring& label):
MscElementTmpl<MscMessage>(NULL),m_label(label)
{
}
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/data/msc.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -31,7 +31,7 @@
// see http://www.boost.org/doc/libs/1_37_0/libs/smart_ptr/smart_ptr.htm
#include <boost/intrusive_ptr.hpp>
-#include "data/msc_visual.h"
+#include "data/msc_types.h"
#include "data/export.h"
class MscElement;
@@ -112,21 +112,6 @@
typedef std::set<HMscNodePtr> HMscNodePtrSet;
-struct nocase_comparator: public std::binary_function<std::string, std::string, bool>
-{
- struct nocase_compare: public std::binary_function<unsigned char, unsigned char, bool>
- {
- bool operator() (const unsigned char& c1, const unsigned char& c2) const
- { return tolower(c1) < tolower(c2); };
- };
-
- bool operator() (const std::string& s1, const std::string& s2) const
- {
- return std::lexicographical_compare(
- s1.begin(), s1.end(), s2.begin(), s2.end(), nocase_compare());
- }
-};
-
/**
* \brief Common basic abstract class for all elements of MSC
*/
@@ -437,9 +422,9 @@
/**
* \brief Label of MSC.
*/
- std::string m_label;
+ std::wstring m_label;
- Msc(const std::string& label=""):m_label(label)
+ Msc(const std::wstring& label=L""):m_label(label)
{
}
@@ -461,7 +446,7 @@
/**
* Getter for m_label
*/
- void set_label(const std::string label)
+ void set_label(const std::wstring label)
{
m_label = label;
}
@@ -469,7 +454,7 @@
/**
* Setter for m_label
*/
- const std::string& get_label() const
+ const std::wstring& get_label() const
{
return m_label;
}
@@ -492,7 +477,7 @@
/**
* Initializes m_label
*/
- BMsc(const std::string& label=""):Msc(label)
+ BMsc(const std::wstring& label=L""):Msc(label)
{
}
@@ -525,7 +510,7 @@
*/
class SCMSC_EXPORT HMscNode:public MscElementTmpl<HMscNode>
{
- Point m_position;
+ MscPoint m_position;
protected:
@@ -545,12 +530,12 @@
m_owner = owner;
}
- const Point& get_position() const
+ const MscPoint& get_position() const
{
return m_position;
}
- void set_position(const Point& position)
+ void set_position(const MscPoint& position)
{
m_position = position;
}
@@ -785,7 +770,7 @@
public:
- HMsc(const std::string& label=""):Msc(label)
+ HMsc(const std::wstring& label=L""):Msc(label)
{
}
@@ -908,14 +893,14 @@
*/
class SCMSC_EXPORT ConditionNode:public PredecessorNode, public SuccessorNode, public HMscNode
{
- std::string m_label;
+ std::wstring m_label;
public:
/**
* Initializes m_label
*/
- ConditionNode(const std::string& label=""):HMscNode(),PredecessorNode(),SuccessorNode(),
+ ConditionNode(const std::wstring& label=L""):HMscNode(),PredecessorNode(),SuccessorNode(),
m_label(label)
{
}
@@ -939,7 +924,7 @@
/**
* Setter of m_label
*/
- void set_label(const std::string label)
+ void set_label(const std::wstring label)
{
m_label = label;
}
@@ -947,7 +932,7 @@
/**
* Getter of m_label
*/
- const std::string& get_label() const
+ const std::wstring& get_label() const
{
return m_label;
}
@@ -990,12 +975,12 @@
/**
* Label of instance -- name of concrete instance
*/
- std::string m_label;
+ std::wstring m_label;
/**
* Kind of instance -- name of particular type of instance
*/
- std::string m_kind;
+ std::wstring m_kind;
/**
* Form of instance axis (line/column)
@@ -1019,8 +1004,8 @@
*/
BMsc* m_bmsc;
- Point m_line_begin;
- Point m_line_end;
+ MscPoint m_line_begin;
+ MscPoint m_line_end;
Size m_width;
@@ -1031,7 +1016,7 @@
/**
* @param label - label of instance
*/
- Instance(const std::string& label, const std::string& kind="");
+ Instance(const std::wstring& label, const std::wstring& kind=L"");
Instance(Instance* original);
@@ -1063,7 +1048,7 @@
/**
* Getter for m_label.
*/
- const std::string& get_label() const
+ const std::wstring& get_label() const
{
return m_label;
}
@@ -1091,22 +1076,22 @@
m_bmsc = bmsc;
}
- const Point& get_line_begin() const
+ const MscPoint& get_line_begin() const
{
return m_line_begin;
}
- void set_line_begin(const Point& line_begin)
+ void set_line_begin(const MscPoint& line_begin)
{
m_line_begin = line_begin;
}
- const Point& get_line_end() const
+ const MscPoint& get_line_end() const
{
return m_line_end;
}
- void set_line_end(const Point& line_end)
+ void set_line_end(const MscPoint& line_end)
{
m_line_end = line_end;
}
@@ -1154,7 +1139,7 @@
/**
* Label of message.
*/
- std::string m_label;
+ std::wstring m_label;
public:
@@ -1163,18 +1148,18 @@
* @param receiver - receiving instance
* @param label - label of message
*/
- MscMessage(const std::string& label="");
+ MscMessage(const std::wstring& label=L"");
MscMessage(MscMessage* original);
virtual ~MscMessage();
- const std::string& get_label() const
+ const std::wstring& get_label() const
{
return m_label;
}
- void set_label(const std::string& label)
+ void set_label(const std::wstring& label)
{
m_label = label;
}
@@ -1207,7 +1192,7 @@
/**
* @param label - label of message
*/
- CompleteMessage(const std::string& label="")
+ CompleteMessage(const std::wstring& label=L"")
: MscMessage(label)
{
m_send_event = NULL;
@@ -1283,9 +1268,9 @@
protected:
- Point m_dot_position;
+ MscPoint m_dot_position;
- std::string m_instance_label;
+ std::wstring m_instance_label;
IncompleteMsgType m_type;
@@ -1298,8 +1283,8 @@
public:
- IncompleteMessage(const IncompleteMsgType& type=LOST, const std::string& label="",
- const std::string& instance_label="", const Point& dot_position=Point()):
+ IncompleteMessage(const IncompleteMsgType& type=LOST, const std::wstring& label=L"",
+ const std::wstring& instance_label=L"", const MscPoint& dot_position=MscPoint()):
MscMessage(label),m_instance_label(instance_label),m_type(type),
m_dot_position(dot_position)
{
@@ -1308,17 +1293,17 @@
IncompleteMessage(IncompleteMessage* original);
- const Point& get_dot_position() const
+ const MscPoint& get_dot_position() const
{
return m_dot_position;
}
- void set_dot_position(const Point& dot_position)
+ void set_dot_position(const MscPoint& dot_position)
{
m_dot_position = dot_position;
}
- const std::string& get_instance_label() const
+ const std::wstring& get_instance_label() const
{
return m_instance_label;
}
@@ -1359,7 +1344,7 @@
/**
* Relative position of the event to the respective instance/area.
*/
- Point m_position;
+ MscPoint m_position;
/**
* Label of message whose this is send or receive event.
@@ -1482,7 +1467,7 @@
*/
virtual EventArea* get_general_area() const=0;
- const std::string& get_receiver_label() const
+ const std::wstring& get_receiver_label() const
{
if(is_matched())
{
@@ -1503,7 +1488,7 @@
}
}
- const std::string& get_sender_label() const
+ const std::wstring& get_sender_label() const
{
if(is_matched())
{
@@ -1524,12 +1509,12 @@
}
}
- void set_position(const Point& position)
+ void set_position(const MscPoint& position)
{
m_position = position;
}
- const Point& get_position() const
+ const MscPoint& get_position() const
{
return m_position;
}
Added: trunk/src/data/msc_types.cpp
===================================================================
--- trunk/src/data/msc_types.cpp (rev 0)
+++ trunk/src/data/msc_types.cpp 2009-05-03 19:05:14 UTC (rev 243)
@@ -0,0 +1,45 @@
+/*
+ * 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_types.h"
+
+std::wstring TOWSTRING(const std::string& s)
+{
+ std::wstring result;
+
+ size_t size = s.length();
+ const char* pos = s.data();
+
+ while(size > 0)
+ {
+ wchar_t wc;
+ int inc = mbtowc(&wc, pos, size);
+
+ if(inc > 0)
+ {
+ result.push_back(wc);
+
+ size = size - inc;
+ pos = pos + inc;
+ }
+ }
+
+ return result;
+}
+
+// $Id$
Property changes on: trunk/src/data/msc_types.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Copied: trunk/src/data/msc_types.h (from rev 239, trunk/src/data/msc_visual.h)
===================================================================
--- trunk/src/data/msc_types.h (rev 0)
+++ trunk/src/data/msc_types.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -0,0 +1,108 @@
+/*
+ * 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) 2008 Jindra Babica <ba...@ma...>
+ *
+ * $Id$
+ */
+
+#ifndef _MSC_TYPES_H
+#define _MSC_TYPES_H
+
+#include "data/export.h"
+
+#include <list>
+
+template <class T>
+struct nocase_comparator: public std::binary_function<std::basic_string<T>, std::basic_string<T>, bool>
+{
+ struct nocase_compare: public std::binary_function<T, T, bool>
+ {
+ bool operator() (const T& c1, const T& c2) const
+ { return tolower(c1) < tolower(c2); };
+ };
+
+ bool operator() (const std::basic_string<T>& s1, const std::basic_string<T>& s2) const
+ {
+ return std::lexicographical_compare(
+ s1.begin(), s1.end(), s2.begin(), s2.end(), nocase_compare());
+ }
+};
+
+char SCMSC_EXPORT strip_diacritics(wchar_t ch);
+
+std::wstring SCMSC_EXPORT TOWSTRING(const std::string& s);
+
+typedef double Coordinate;
+typedef double Size;
+
+/**
+ * Denotes form of instance's axis as described by ITU-T
+ */
+typedef enum
+{
+ LINE,
+ COLUMN
+} InstanceAxisForm;
+
+class MscPoint
+{
+private:
+ Coordinate m_x;
+ Coordinate m_y;
+
+public:
+
+ MscPoint(Coordinate x=0,Coordinate y=0)
+ {
+ m_x = x;
+ m_y = y;
+ }
+
+ Coordinate get_x() const
+ {
+ return m_x;
+ }
+
+ void set_x(Coordinate x)
+ {
+ m_x = x;
+ }
+
+ Coordinate get_y() const
+ {
+ return m_y;
+ }
+
+ void set_y(Coordinate y)
+ {
+ m_y = y;
+ }
+};
+
+class PolyLine
+{
+ std::list<MscPoint> m_points;
+
+public:
+
+ const std::list<MscPoint>& get_points()
+ {
+ return m_points;
+ }
+
+};
+
+#endif /* _MSC_TYPES_H */
+
+// $Id$
Property changes on: trunk/src/data/msc_types.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Deleted: trunk/src/data/msc_visual.h
===================================================================
--- trunk/src/data/msc_visual.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/data/msc_visual.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -1,86 +0,0 @@
-/*
- * 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) 2008 Jindra Babica <ba...@ma...>
- *
- * $Id$
- */
-
-#ifndef _MSC_VISUAL_H
-#define _MSC_VISUAL_H
-
-#include <list>
-
-typedef double Coordinate;
-typedef double Size;
-
-/**
- * Denotes form of instance's axis as described by ITU-T
- */
-typedef enum
-{
- LINE,
- COLUMN
-} InstanceAxisForm;
-
-class Point
-{
-private:
- Coordinate m_x;
- Coordinate m_y;
-
-public:
-
- Point(Coordinate x=0,Coordinate y=0)
- {
- m_x = x;
- m_y = y;
- }
-
- Coordinate get_x() const
- {
- return m_x;
- }
-
- void set_x(Coordinate x)
- {
- m_x = x;
- }
-
- Coordinate get_y() const
- {
- return m_y;
- }
-
- void set_y(Coordinate y)
- {
- m_y = y;
- }
-};
-
-class PolyLine
-{
- std::list<Point> m_points;
-
-public:
-
- const std::list<Point>& get_points()
- {
- return m_points;
- }
-
-};
-
-#endif /* _MSC_VISUAL_H */
-
-// $Id$
Modified: trunk/src/data/reporter.h
===================================================================
--- trunk/src/data/reporter.h 2009-05-03 15:45:34 UTC (rev 242)
+++ trunk/src/data/reporter.h 2009-05-03 19:05:14 UTC (rev 243)
@@ -20,6 +20,9 @@
#define _REPORTER_H
#include <sstream>
+#if defined(_MSC_VER)
+#include <comutil.h> // _bstr_t
+#endif
enum TReportSeverity
{
@@ -35,23 +38,23 @@
public:
virtual ~ReportPrinter() {}
- virtual int print(TReportSeverity severity, const std::string& message) = 0;
+ virtual int print(TReportSeverity severity, const std::wstring& message) = 0;
};
class StreamReportPrinter : public ReportPrinter
{
public:
- StreamReportPrinter(std::ostream& stream)
+ StreamReportPrinter(std::wostream& stream)
: m_stream(stream) {}
- virtual int print(TReportSeverity severity, const std::string& message)
+ virtual int print(TReportSeverity severity, const std::wstring& message)
{
m_stream << message << std::endl;
return 0;
}
private:
- std::ostream& m_stream;
+ std::wostream& m_stream;
};
class Reporter
@@ -62,7 +65,7 @@
void set_printer(ReportPrinter* printer)
{ m_printer = printer; }
- int print_report(TReportSeverity severity, const std::string& message)
+ int print_report(TReportSeverity severity, const std::wstring& message)
{ return m_printer ? m_printer->print(severity, message) : 1; }
private:
@@ -77,12 +80,23 @@
struct basic_stringize
{
template<typename T>
- basic_stringize<C> & operator << (T const& t)
+ basic_stringize<C> & operator << (const T& t)
{
m_s << t;
return *this;
}
+#if defined(_MSC_VER)
+ template<>
+ basic_stringize<C> & operator << (const _bstr_t& t)
+ {
+ // choose conversion
+ // _bstr_t has both char* and wchar_t* operators
+ m_s << (const C*)t;
+ return *this;
+ }
+#endif
+
// note: must not return reference
operator const std::basic_string<C>() const
{
@@ -93,7 +107,7 @@
std::basic_stringstream<C> m_s;
};
-typedef basic_stringize<char> stringize;
+typedef basic_stringize<wchar_t> stringize;
#endif /* _REPORTER_H */
Added: trunk/src/data/strip_diacritics.cpp
===================================================================
--- trunk/src/data/strip_diacritics.cpp (rev 0)
+++ trunk/src/data/strip_diacritics.cpp 2009-05-03 19:05:14 UTC (rev 243)
@@ -0,0 +1,50 @@
+
+// Generated by diacritics_build.py. Do not edit!
+#include "data/msc_types.h"
+
+static char transliteration_table[570] = {
+'a',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+'o',0,0,0,0,0,'A','A','A','A','A','A',0,'C','E','E',
+'E','E','I','I','I','I',0,'N','O','O','O','O','O',0,0,'U',
+'U','U','U','Y',0,0,'a','a','a','a','a','a',0,'c','e','e',
+'e','e','i','i','i','i',0,'n','o','o','o','o','o',0,0,'u',
+'u','u','u','y',0,'y','A','a','A','a','A','a','C','c','C','c',
+'C','c','C','c','D','d',0,0,'E','e','E','...
[truncated message content] |