|
From: <ba...@us...> - 2008-03-06 19:14:55
|
Revision: 3
http://scstudio.svn.sourceforge.net/scstudio/?rev=3&view=rev
Author: babicaj
Date: 2008-03-06 11:14:47 -0800 (Thu, 06 Mar 2008)
Log Message:
-----------
First version of MSC hierarchical structure and MSC path which should be used for displaying erroneous traces.
Added Paths:
-----------
trunk/src/data/msc.h
trunk/src/data/msc_path.h
Added: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h (rev 0)
+++ trunk/src/data/msc.h 2008-03-06 19:14:47 UTC (rev 3)
@@ -0,0 +1,143 @@
+/*
+* 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 _HMSC_STRUCTURE_H
+#define _HMSC_STRUCTURE_H
+
+#include <list>
+#include <string>
+#include "counted_ptr.h"
+
+class HmscNode;
+class Process;
+class Event;
+class Msc;
+class HmscNode;
+class Bmsc;
+
+typedef counted_ptr<Msc> MSC;
+typedef counted_ptr<Bmsc> BMSC;
+typedef counted_ptr<Event> EVENT;
+typedef counted_ptr<Process> PROCESS;
+typedef counter_ptr<HmscNode> HMSC_NODE;
+typedef std::list<HMSC_NODE> HMSC_NODES;
+typedef std::list<PROCESS> PROCESSES;
+typedef std::list<EVENT> EVENTS;
+
+/**
+ * Represents virtual base class for Bmsc and Hmsc.
+ */
+class Msc{
+
+ /**
+ * Label of MSC.
+ */
+ string m_label;
+
+};
+
+/**
+ * Represents Basic MSC.
+ */
+class Bmsc:public Msc{
+
+ /**
+ * Processes' instances which are contained in Bmsc.
+ */
+ PROCESSES m_processes;
+};
+
+/**
+ * Represents High-level MSC.
+ */
+class Hmsc:public Msc{
+
+ /**
+ * Start nodes of Hmsc.
+ */
+ HMSC_NODES m_start_nodes;
+};
+
+class HmscNode{
+
+ /**
+ * Succesors of HmscNode
+ */
+ HMSC_NODES m_successors;
+
+ /**
+ * MSC which is contained in this node
+ */
+ MSC m_msc;
+};
+
+/**
+ * Represents process (vertical line) in Basic MSC.
+ */
+class Process{
+
+ /**
+ * Label of process.
+ */
+ string m_label;
+
+ /**
+ * Events which occures at process.
+ *
+ * Events are ordered in list, moreover they have order numbers, see Event.
+ */
+ EVENTS m_events;
+
+};
+
+/**
+ * Event which occures at process.
+ */
+class Event{
+
+ /**
+ * Specifies whether event is sending (true) or receiving (false).
+ */
+ bool m_send;
+
+ /**
+ * Specifies order of event at Process.
+ *
+ * Note that if two events have same m_order it means that they are
+ * unordered (coregion like).
+ */
+ int m_order;
+
+ /**
+ * Label of message whose this is send or receive event.
+ */
+ string m_message;
+
+ /**
+ * Process that this event occures at.
+ */
+ PROCESS m_process;
+
+ /**
+ * Oposite (send/receive) event of this event.
+ */
+ EVENT m_matching_event;
+};
+
+#endif /* _HMSC_STRUCTURE_H */
+
Added: trunk/src/data/msc_path.h
===================================================================
--- trunk/src/data/msc_path.h (rev 0)
+++ trunk/src/data/msc_path.h 2008-03-06 19:14:47 UTC (rev 3)
@@ -0,0 +1,80 @@
+/*
+* 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 _PATH_H
+#define _PATH_H
+
+#include "msc.h"
+#include <list>
+
+typedef counted_ptr<PathNode> PATH_NODE;
+typedef std::list<PATH_NODE> PATH_NODES;
+
+/**
+ * Describes structured path through Hmsc.
+ *
+ * As same as Hmsc is structured, path through that structure is designed to be
+ * structured too. I.e. path is list of particular nodes, where these nodes
+ * contains either Bmsc or nested MscPath.
+ */
+class MscPath{
+
+ /**
+ * Path at current level of structure.
+ */
+ PATH_NODES m_nodes;
+
+};
+
+/**
+ * Element of MscPath.
+ */
+class PathNode{
+
+ /**
+ * HmscNode which path goes through.
+ */
+ HMSC_NODE m_node;
+
+};
+
+/**
+ * PathNode which isn't more structured - contains only Bmsc.
+ */
+class BmscPathNode:public PathNode{
+
+ /**
+ * Bmsc that is represented by this PathNode.
+ */
+ BMSC m_bmsc;
+
+};
+
+/**
+ * PathNode which is more structured - contains other MscPath.
+ */
+class HmscPathNode:public PathNode{
+
+ /**
+ * MscPath that is represented by this PathNode.
+ */
+ PATH_NODE m_path;
+
+};
+#endif /* _PATH_H */
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-03-07 19:06:25
|
Revision: 5
http://scstudio.svn.sourceforge.net/scstudio/?rev=5&view=rev
Author: babicaj
Date: 2008-03-07 11:06:21 -0800 (Fri, 07 Mar 2008)
Log Message:
-----------
Event areas with different event order interpretation added and modifications of arrangement of code.
Modified Paths:
--------------
trunk/src/data/msc.h
trunk/src/data/msc_path.h
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2008-03-06 21:01:17 UTC (rev 4)
+++ trunk/src/data/msc.h 2008-03-07 19:06:21 UTC (rev 5)
@@ -1,20 +1,20 @@
/*
-* 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$
-*/
+ * 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 _HMSC_STRUCTURE_H
#define _HMSC_STRUCTURE_H
@@ -24,123 +24,233 @@
#include "counted_ptr.h"
class HmscNode;
-class Process;
+class Instance;
class Event;
class Msc;
class HmscNode;
-class Bmsc;
+class BMsc;
+class MscMessage;
+class EventArea;
-typedef counted_ptr<Msc> MSC;
-typedef counted_ptr<Bmsc> BMSC;
-typedef counted_ptr<Event> EVENT;
-typedef counted_ptr<Process> PROCESS;
-typedef counter_ptr<HmscNode> HMSC_NODE;
-typedef std::list<HMSC_NODE> HMSC_NODES;
-typedef std::list<PROCESS> PROCESSES;
-typedef std::list<EVENT> EVENTS;
+typedef counted_ptr<Msc> MscPtr;
+typedef counted_ptr<BMsc> BMscPtr;
+
+typedef counter_ptr<HmscNode> HmscNodePtr;
+typedef std::list<HmscNodePtr> HmscNodePtrList;
+
+typedef counted_ptr<Instance> InstancePtr;
+typedef std::list<InstancePtr> InstancePtrList;
+
+typedef counted_ptr<Event> EventPtr;
+typedef std::list<EventPtr> EventPtrList;
+
+typedef counted_ptr<MscMessage> MscMessagePtr;
+
+typedef counted_ptr<EventArea> EventAreaPtr;
+typedef std::list<EventAreaPtr> EventAreaPtrList;
+
/**
- * Represents virtual base class for Bmsc and Hmsc.
+ * Represents virtual base class for BMsc and HMsc.
*/
-class Msc{
-
- /**
- * Label of MSC.
- */
- string m_label;
-
+class Msc
+{
+
+ /**
+ * Label of MSC.
+ */
+ string m_label;
+
};
/**
* Represents Basic MSC.
*/
-class Bmsc:public Msc{
-
- /**
- * Processes' instances which are contained in Bmsc.
- */
- PROCESSES m_processes;
+class BMsc:public Msc
+{
+
+ /**
+ * Processes' instances which are contained in Bmsc.
+ */
+ InstancePtrList m_processes;
};
/**
* Represents High-level MSC.
*/
-class Hmsc:public Msc{
-
- /**
- * Start nodes of Hmsc.
- */
- HMSC_NODES m_start_nodes;
+class HMsc:public Msc
+{
+
+ /**
+ * Start nodes of HMsc.
+ */
+ HmscNodePtrList m_start_nodes;
};
-class HmscNode{
-
- /**
- * Succesors of HmscNode
- */
- HMSC_NODES m_successors;
-
- /**
- * MSC which is contained in this node
- */
- MSC m_msc;
+class HmscNode
+{
+
+ /**
+ * Succesors of HmscNode
+ */
+ HmscNodePtrList m_successors;
+
+ /**
+ * MSC which is contained in this node
+ */
+ MscPtr m_msc;
};
/**
* Represents process (vertical line) in Basic MSC.
*/
-class Process{
-
- /**
- * Label of process.
- */
- string m_label;
-
- /**
- * Events which occures at process.
- *
- * Events are ordered in list, moreover they have order numbers, see Event.
- */
- EVENTS m_events;
-
+class Instance
+{
+
+ /**
+ * Label of process.
+ */
+ string m_label;
+
+ /**
+ * Events which occures at process.
+ *
+ * Events are ordered in list, moreover they have order numbers, see Event.
+ */
+ EventPtrList m_events;
+
};
/**
+ * General base area which contains events.
+ */
+class EventArea
+{
+
+}
+
+/**
+ * EventArea whose events are ordered lineary as they follow each other.
+ */
+class StrictOrderArea:public EventArea
+{
+
+ /**
+ * List of Events which occure in this area.
+ */
+ EventPtrList m_events;
+}
+
+/**
+ * EventArea whose events are ordered like directed acyclic graph.
+ */
+class GeneralOrderArea:public EventArea
+{
+
+ /**
+ * Directed acyclic graph representing events' ordering.
+ */
+ Dag<EventPtr> m_events;
+}
+
+/**
+ * Area of Instance that represents area where Events at this Instance are located.
+ */
+class InstanceArea
+{
+
+ /**
+ * EventAreas which occure at instance.
+ */
+ EventAreaPtrList m_areas
+
+}
+
+/**
+ * Message sent by Instances.
+ */
+class MscMessage
+{
+ /**
+ * Label of message.
+ */
+ string m_label;
+}
+
+/**
* Event which occures at process.
*/
-class Event{
-
- /**
- * Specifies whether event is sending (true) or receiving (false).
- */
- bool m_send;
-
- /**
- * Specifies order of event at Process.
- *
- * Note that if two events have same m_order it means that they are
- * unordered (coregion like).
- * @warning this must be remake, consider situation of three events a,b,c
- * where only a<b but the rest is unordered. Event order(at process) representation must
- * be refined in the sense of being able to describe acyclic directed graph.
- */
- int m_order;
-
- /**
- * Label of message whose this is send or receive event.
- */
- string m_message;
-
- /**
- * Process that this event occures at.
- */
- PROCESS m_process;
-
- /**
- * Oposite (send/receive) event of this event.
- */
- EVENT m_matching_event;
+class Event
+{
+
+ /**
+ * Specifies whether event is sending or receiving.
+ */
+ enum {SEND, RECEIVE} m_send;
+
+ /**
+ * Label of message whose this is send or receive event.
+ */
+ string m_message;
+
+ /**
+ * Instance that this event occures at.
+ */
+ InstancePtr m_process;
+
+ /**
+ * Oposite (send/receive) event of this event.
+ */
+ EventPtr m_matching_event;
};
+/**
+ * Directed acyclic graph.
+ */
+template <class T>
+class Dag
+{
+
+ /**
+ * List of pointered DagNodes.
+ */
+ typedef std::list<DagNode<T>::DagNodePtr> DagNodePtrList;
+
+ /**
+ * Events which aren't successors of any other events.
+ */
+ Dag<T>::DagNodePtrList m_minimal_events;
+}
+
+/**
+ * Node of directed acyclic graph.
+ */
+template <class T>
+class DagNode{
+
+ /**
+ * Pointered alternative to DagNode.
+ */
+ typedef counted_ptr<DagNode<T>> DagNodePtr;
+
+ /**
+ * Object which is contained in this DagNode.
+ */
+ T m_content;
+
+ /**
+ * Successors of this node.
+ */
+ std::list<T> m_successors;
+
+ /**
+ * Used when traversing Dag in a way of depth-first search.
+ *
+ * Depth-first search is efficient way how to detect eventual
+ * cycles which are forbidden in Dag.
+ */
+ enum{FREE,VISITED,FINISHED} m_color;
+}
+
#endif /* _HMSC_STRUCTURE_H */
Modified: trunk/src/data/msc_path.h
===================================================================
--- trunk/src/data/msc_path.h 2008-03-06 21:01:17 UTC (rev 4)
+++ trunk/src/data/msc_path.h 2008-03-07 19:06:21 UTC (rev 5)
@@ -1,20 +1,20 @@
/*
-* 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$
-*/
+ * 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 _PATH_H
#define _PATH_H
@@ -22,8 +22,8 @@
#include "msc.h"
#include <list>
-typedef counted_ptr<PathNode> PATH_NODE;
-typedef std::list<PATH_NODE> PATH_NODES;
+typedef counted_ptr<PathNode> PathNodePtr;
+typedef std::list<PathNodePtr> PathNodePtrList;
/**
* Describes structured path through Hmsc.
@@ -33,24 +33,24 @@
* contains either Bmsc or nested MscPath.
*/
class MscPath{
-
- /**
- * Path at current level of structure.
- */
- PATH_NODES m_nodes;
-
+
+ /**
+ * Path at current level of structure.
+ */
+ PathNodePtrList m_nodes;
+
};
/**
* Element of MscPath.
*/
class PathNode{
-
- /**
- * HmscNode which path goes through.
- */
- HMSC_NODE m_node;
-
+
+ /**
+ * HmscNode which path goes through.
+ */
+ HmscNodePtr m_node;
+
};
/**
@@ -58,11 +58,11 @@
*/
class BmscPathNode:public PathNode{
- /**
- * Bmsc that is represented by this PathNode.
- */
- BMSC m_bmsc;
-
+ /**
+ * Bmsc that is represented by this PathNode.
+ */
+ BMscPtr m_bmsc;
+
};
/**
@@ -70,11 +70,11 @@
*/
class HmscPathNode:public PathNode{
- /**
- * MscPath that is represented by this PathNode.
- */
- PATH_NODE m_path;
-
+ /**
+ * MscPath that is represented by this PathNode.
+ */
+ PathNodePtr m_path;
+
};
#endif /* _PATH_H */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-03-09 13:32:34
|
Revision: 6
http://scstudio.svn.sourceforge.net/scstudio/?rev=6&view=rev
Author: babicaj
Date: 2008-03-09 06:32:22 -0700 (Sun, 09 Mar 2008)
Log Message:
-----------
Msc modifications container added.
Modified Paths:
--------------
trunk/src/data/msc.h
trunk/src/data/msc_path.h
Added Paths:
-----------
trunk/src/data/msc_modifications.h
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2008-03-07 19:06:21 UTC (rev 5)
+++ trunk/src/data/msc.h 2008-03-09 13:32:22 UTC (rev 6)
@@ -16,8 +16,8 @@
* $Id: $
*/
-#ifndef _HMSC_STRUCTURE_H
-#define _HMSC_STRUCTURE_H
+#ifndef _MSC_H
+#define _MSC_H
#include <list>
#include <string>
@@ -127,7 +127,7 @@
class EventArea
{
-}
+};
/**
* EventArea whose events are ordered lineary as they follow each other.
@@ -139,7 +139,7 @@
* List of Events which occure in this area.
*/
EventPtrList m_events;
-}
+};
/**
* EventArea whose events are ordered like directed acyclic graph.
@@ -151,7 +151,7 @@
* Directed acyclic graph representing events' ordering.
*/
Dag<EventPtr> m_events;
-}
+};
/**
* Area of Instance that represents area where Events at this Instance are located.
@@ -164,7 +164,7 @@
*/
EventAreaPtrList m_areas
-}
+};
/**
* Message sent by Instances.
@@ -175,7 +175,7 @@
* Label of message.
*/
string m_label;
-}
+};
/**
* Event which occures at process.
@@ -220,7 +220,7 @@
* Events which aren't successors of any other events.
*/
Dag<T>::DagNodePtrList m_minimal_events;
-}
+};
/**
* Node of directed acyclic graph.
@@ -242,15 +242,7 @@
* Successors of this node.
*/
std::list<T> m_successors;
+};
- /**
- * Used when traversing Dag in a way of depth-first search.
- *
- * Depth-first search is efficient way how to detect eventual
- * cycles which are forbidden in Dag.
- */
- enum{FREE,VISITED,FINISHED} m_color;
-}
+#endif /* _MSC_H */
-#endif /* _HMSC_STRUCTURE_H */
-
Added: trunk/src/data/msc_modifications.h
===================================================================
--- trunk/src/data/msc_modifications.h (rev 0)
+++ trunk/src/data/msc_modifications.h 2008-03-09 13:32:22 UTC (rev 6)
@@ -0,0 +1,143 @@
+/*
+ * 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_MODIFICATIONS_H
+#define _MSC_MODIFICATIONS_H
+
+#include "msc.h"
+
+/**
+ * General base class for modification of MSC.
+ */
+class MscModification{
+
+};
+
+/**
+ * Modification of BMsc.
+ *
+ * Used to express modification of BMsc, i.e. new process added,
+ * removed events, added events etc.
+ */
+class BMscModification:public MscModification{
+
+ /**
+ * Old version of BMsc.
+ *
+ * Pointer to previous version of BMsc. If NULL then m_new didn't
+ * have previous version (i.e. m_new is original).
+ */
+ BMscPtr m_old;
+
+ /**
+ * New version of BMsc.
+ *
+ * Pointer to modified version of BMsc. If NULL then original (m_old)
+ * BMsc was removed.
+ */
+ BMscPtr m_new;
+
+};
+
+/**
+ * Modification of HMsc.
+ *
+ * Usefull when either whole HMsc is new or was completly removed
+ * and checking algorithms do not already need to keep results from
+ * previous version for this HMsc.
+ */
+class HMscNodeModification:public MscModification{
+
+ /**
+ * Old version of HMscNode.
+ *
+ * Pointer to previous version of HMscNode. If NULL then m_new didn't
+ * have previous version (i.e. m_new is original).
+ */
+ HMscNodePtr m_old;
+
+ /**
+ * New version of HMscNode.
+ *
+ * Pointer to modified version of HMscNode. If NULL then original (m_old)
+ * HMscNode was removed.
+ */
+ HMscNodePtr m_new;
+
+};
+
+/**
+ * Modification of HMscNode in HMsc.
+ *
+ * Usage of this modification is essential when edges are added
+ * or removed between nodes of HMsc. Such modifications shpouldn't
+ * be described using HMscModification because it would be neccessary
+ * to find out which ones nodes are different from the previous ones.
+ * Such approach would increase computing complexity of checking
+ * algorithms.
+ */
+class HMscModification:public MscModification{
+
+ /**
+ * Old version of HMsc.
+ *
+ * Pointer to previous version of HMsc. If NULL then m_new didn't
+ * have previous version (i.e. m_new is original).
+ */
+ HMscPtr m_old;
+
+ /**
+ * New version of HMsc.
+ *
+ * Pointer to modified version of HMsc. If NULL then original (m_old)
+ * HMsc was removed.
+ */
+ HMscPtr m_new;
+
+};
+
+typedef counted_ptr<MscModification> MscModificationPtr;
+typedef std::set<MscModificationPtr> MscModificationPtrSet;
+
+/**
+ * Container of modifications.
+ *
+ * Encapsulates container of modifications performed in previous
+ * version of Msc. These modifications are ordered in descending
+ * order by level of hierarchical structure which they reside in.
+ * However, modifications can be accessed in both directions.
+ *
+ * Purpose of this container will be seen when we use iterative
+ * type of checking algorithms of particular property of Msc.
+ * This type of algorithms is capable to use results from previous
+ * version of Msc to decrease computing complexity. Withou this
+ * approach (container of modifications) it would be neccessary to
+ * involve searching of modifications into complexity.
+ */
+class MscModificationContainer{
+
+ /**
+ * Container of sorted modifications.
+ */
+ MscModificationPtrSet m_modifications;
+
+};
+
+
+#endif /* _MSC_MODIFICATIONS_H */
+
Modified: trunk/src/data/msc_path.h
===================================================================
--- trunk/src/data/msc_path.h 2008-03-07 19:06:21 UTC (rev 5)
+++ trunk/src/data/msc_path.h 2008-03-09 13:32:22 UTC (rev 6)
@@ -16,8 +16,8 @@
* $Id: $
*/
-#ifndef _PATH_H
-#define _PATH_H
+#ifndef _MSC_PATH_H
+#define _MSC_PATH_H
#include "msc.h"
#include <list>
@@ -76,5 +76,5 @@
PathNodePtr m_path;
};
-#endif /* _PATH_H */
+#endif /* _MSC_PATH_H */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-03-12 20:49:21
|
Revision: 8
http://scstudio.svn.sourceforge.net/scstudio/?rev=8&view=rev
Author: babicaj
Date: 2008-03-12 13:49:11 -0700 (Wed, 12 Mar 2008)
Log Message:
-----------
New typedefs included in msc.h and completely revised idea of modifications in msc_modifications.h
Modified Paths:
--------------
trunk/src/data/msc.h
trunk/src/data/msc_modifications.h
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2008-03-10 20:31:26 UTC (rev 7)
+++ trunk/src/data/msc.h 2008-03-12 20:49:11 UTC (rev 8)
@@ -31,6 +31,8 @@
class BMsc;
class MscMessage;
class EventArea;
+class StrictOrderArea;
+class GeneralOrderArea;
typedef counted_ptr<Msc> MscPtr;
@@ -50,8 +52,12 @@
typedef counted_ptr<EventArea> EventAreaPtr;
typedef std::list<EventAreaPtr> EventAreaPtrList;
-typedef counted_ptr<Instance> InstancePtr;
+typedef counted_ptr<InstanceArea> InstanceAreaPtr;
+typedef counted_ptr<StrictOrderArea> StrictOrderAreaPtr;
+
+typedef counted_ptr<GeneralOrderArea> GeneralOrderAreaPtr;
+
/**
* Represents virtual base class for BMsc and HMsc.
*/
@@ -230,6 +236,11 @@
typedef std::list<DagNode<T>::DagNodePtr> DagNodePtrList;
/**
+ * Set of pointered DagNodes.
+ */
+ typedef std::set<DagNode<T>::DagNodePtr> DagNodePtrSet;
+
+ /**
* Events which aren't successors of any other events.
*/
Dag<T>::DagNodePtrList m_minimal_events;
Modified: trunk/src/data/msc_modifications.h
===================================================================
--- trunk/src/data/msc_modifications.h 2008-03-10 20:31:26 UTC (rev 7)
+++ trunk/src/data/msc_modifications.h 2008-03-12 20:49:11 UTC (rev 8)
@@ -19,6 +19,7 @@
#ifndef _MSC_MODIFICATIONS_H
#define _MSC_MODIFICATIONS_H
+#include <set>
#include "msc.h"
/**
@@ -28,116 +29,192 @@
};
+typedef counted_ptr<MscModification> MscModificationPtr;
+typedef std::set<MscModificationPtr> MscModificationPtrSet;
+
/**
- * Modification of BMsc.
+ * Container of modifications.
*
- * Used to express modification of BMsc, i.e. new process added,
- * removed events, added events etc.
+ * Encapsulates container of modifications performed in previous
+ * version of Msc. These modifications are ordered in descending
+ * order by level of hierarchical structure which they reside in.
+ * However, modifications can be accessed in both directions.
+ *
+ * Purpose of this container will be seen when we use iterative
+ * type of checking algorithms of particular property of Msc.
+ * This type of algorithms is capable to use results from previous
+ * version of Msc to decrease computing complexity. Withou this
+ * approach (container of modifications) it would be neccessary to
+ * involve searching of modifications into complexity.
*/
-class BMscModification:public MscModification{
+class MscModificationContainer{
/**
- * Old version of BMsc.
- *
- * Pointer to previous version of BMsc. If NULL then m_new didn't
- * have previous version (i.e. m_new is original).
+ * Container of sorted modifications.
*/
- BMscPtr m_old;
+ MscModificationPtrSet m_modifications;
+};
+
+
+
+/**
+ * Base class for modifications in EventArea.
+ */
+class EventAreaModification:public MscModification{
+
/**
- * New version of BMsc.
- *
- * Pointer to modified version of BMsc. If NULL then original (m_old)
- * BMsc was removed.
+ * Events which were removed from EventArea.
*/
- BMscPtr m_new;
+ stl::set<Event> m_removed_events;
+ /**
+ * Events which are new in EventArea.
+ */
+ stl::set<Event> m_new_events;
+
};
/**
- * Modification of HMsc.
- *
- * Usefull when either whole HMsc is new or was completly removed
- * and checking algorithms do not already need to keep results from
- * previous version for this HMsc.
+ * Modifications which are performed in StrictOrderArea.
*/
-class HMscNodeModification:public MscModification{
+class StrictOrderModification:public EventAreaModification{
+
+ /**
+ * Previous version of StrictOrderArea.
+ */
+ StrictOrderAreaPtr m_previous;
/**
- * Old version of HMscNode.
- *
- * Pointer to previous version of HMscNode. If NULL then m_new didn't
- * have previous version (i.e. m_new is original).
+ * New order of events.
*/
- HMscNodePtr m_old;
+ EventPtrList m_events;
+};
+
+/**
+ * Modifications which are performed in GeneralOrderArea.
+ */
+class GeneralOrderModification:public EventAreaModification{
+
/**
- * New version of HMscNode.
- *
- * Pointer to modified version of HMscNode. If NULL then original (m_old)
- * HMscNode was removed.
+ * Previous version of GeneralOrderArea.
*/
- HMscNodePtr m_new;
+ GeneralOrderAreaPtr m_previous;
+ /**
+ * Events which are newly minimimal in modified version.
+ */
+ Dag<Event>::DagNodePtrSet m_minimal_events;
+
+ /**
+ * Events with modified successors.
+ */
+ Dag<Event>::DagNodePtrSet m_modified_events;
+
};
/**
- * Modification of HMscNode in HMsc.
- *
- * Usage of this modification is essential when edges are added
- * or removed between nodes of HMsc. Such modifications shpouldn't
- * be described using HMscModification because it would be neccessary
- * to find out which ones nodes are different from the previous ones.
- * Such approach would increase computing complexity of checking
- * algorithms.
+ * Modification of instance.
*/
-class HMscModification:public MscModification{
+class InstanceModification:public MscModification{
/**
- * Old version of HMsc.
- *
- * Pointer to previous version of HMsc. If NULL then m_new didn't
- * have previous version (i.e. m_new is original).
+ * Previous version of Instance.
*/
- HMscPtr m_old;
+ InstancePtr m_previous;
/**
- * New version of HMsc.
- *
- * Pointer to modified version of HMsc. If NULL then original (m_old)
- * HMsc was removed.
+ * Removed EventAreas from Instance.
*/
- HMscPtr m_new;
+ std::set<EventAreaPtr> m_removed_areas;
+ /**
+ * New EventAreas at instance.
+ */
+ std::set<EventAreaPtr> m_new_areas;
+
+ /**
+ * Modified InstanceArea.
+ */
+ InstanceAreaPtrList m_modified_instance_area;
+
};
-typedef counted_ptr<MscModification> MscModificationPtr;
-typedef std::set<MscModificationPtr> MscModificationPtrSet;
+/**
+ * Modification of BMsc.
+ */
+class BMscModification: public MscModification
+{
+ /**
+ * Previous version of BMsc.
+ */
+ BMscPtr m_previous;
+
+ /**
+ * Removed Instances.
+ */
+ std::set<EventAreaPtr> m_removed_instances;
+
+ /**
+ * New Instances.
+ */
+ std::set<EventAreaPtr> m_new_instances;
+
+};
+
/**
- * Container of modifications.
- *
- * Encapsulates container of modifications performed in previous
- * version of Msc. These modifications are ordered in descending
- * order by level of hierarchical structure which they reside in.
- * However, modifications can be accessed in both directions.
- *
- * Purpose of this container will be seen when we use iterative
- * type of checking algorithms of particular property of Msc.
- * This type of algorithms is capable to use results from previous
- * version of Msc to decrease computing complexity. Withou this
- * approach (container of modifications) it would be neccessary to
- * involve searching of modifications into complexity.
+ * Modification of HMscNode.
*/
-class MscModificationContainer{
+class HMscNodeModification: public MscModification
+{
/**
- * Container of sorted modifications.
+ * Previous version of HMscNode.
*/
- MscModificationPtrSet m_modifications;
+ HMscNodePtr m_previous;
+ /**
+ * Removed successors.
+ */
+ std::set<HMscNodePtr> m_removed_successors;
+
+ /**
+ * New successors.
+ */
+ std::set<HMscNodePtr> m_new_successors;
+
+ /**
+ * Changed Msc of the HMscNode.
+ *
+ * If NULL then Msc points to the same one (doesn't care if it was
+ * internally modified).
+ */
+ MscPtr m_changed_msc;
};
+/**
+ * Modification of HMsc
+ */
+class HMscModification:public MscModification{
+ /**
+ * Previous version of HMsc.
+ */
+ HMscPtr m_previous;
+
+ /**
+ * Removed start nodes.
+ */
+ std::set<HMscNodePtr> m_removed_start_nodes;
+
+ /**
+ * New start nodes.
+ */
+ std::set<HMscNodePtr> m_new_start_nodes;
+
+}
+
#endif /* _MSC_MODIFICATIONS_H */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-04-03 17:22:46
|
Revision: 10
http://scstudio.svn.sourceforge.net/scstudio/?rev=10&view=rev
Author: babicaj
Date: 2008-04-03 10:21:55 -0700 (Thu, 03 Apr 2008)
Log Message:
-----------
Syntax checked
Modified Paths:
--------------
trunk/src/data/msc.h
trunk/src/data/msc_modifications.h
trunk/src/data/msc_path.h
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2008-03-13 20:56:06 UTC (rev 9)
+++ trunk/src/data/msc.h 2008-04-03 17:21:55 UTC (rev 10)
@@ -21,6 +21,8 @@
#include <list>
#include <string>
+#include <set>
+
#include "counted_ptr.h"
class HMscNode;
@@ -31,21 +33,27 @@
class Event;
class Msc;
class BMsc;
+class HMsc;
class MscMessage;
class EventArea;
class StrictOrderArea;
class GeneralOrderArea;
+class InstanceArea;
+template <class T> class Dag;
+template <class T> class DagNode;
typedef counted_ptr<Msc> MscPtr;
typedef counted_ptr<BMsc> BMscPtr;
-typedef counter_ptr<ReferenceNode> ReferenceNodePtr;
+typedef counted_ptr<HMsc> HMscPtr;
+
+typedef counted_ptr<ReferenceNode> ReferenceNodePtr;
typedef std::list<ReferenceNodePtr> ReferenceNodePtrList;
-typedef counter_ptr<StartNode> StartNodePtr;
+typedef counted_ptr<StartNode> StartNodePtr;
-typedef counter_ptr<EndNode> EndNodePtr;
+typedef counted_ptr<EndNode> EndNodePtr;
typedef counted_ptr<Instance> InstancePtr;
typedef std::list<InstancePtr> InstancePtrList;
@@ -64,7 +72,55 @@
typedef counted_ptr<GeneralOrderArea> GeneralOrderAreaPtr;
+
/**
+ * Node of directed acyclic graph.
+ */
+template <class T>
+class DagNode{
+
+ /**
+ * Object which is contained in this DagNode.
+ */
+ T m_content;
+
+ /**
+ * Successors of this node.
+ */
+ std::list<T> m_successors;
+};
+
+/**
+ * Directed acyclic graph.
+ */
+template <class T>
+class Dag
+{
+public:
+ /**
+ * Pointered alternative to DagNode.
+ */
+ typedef counted_ptr<DagNode<T> > DagNodePtr;
+
+ /**
+ * List of pointered DagNodes.
+ */
+ typedef std::list<DagNodePtr> DagNodePtrList;
+
+ /**
+ * Set of pointered DagNodes.
+ */
+ typedef std::set<DagNodePtr> DagNodePtrSet;
+
+private:
+ /**
+ * Events which aren't successors of any other events.
+ */
+ DagNodePtrList m_minimal_events;
+
+};
+
+/**
* Represents virtual base class for BMsc and HMsc.
*/
class Msc
@@ -73,7 +129,7 @@
/**
* Label of MSC.
*/
- string m_label;
+ std::string m_label;
};
@@ -172,7 +228,7 @@
/**
* Label of process.
*/
- string m_label;
+ std::string m_label;
/**
* Events which occures at instance.
@@ -224,7 +280,7 @@
/**
* EventAreas which occure at instance.
*/
- EventAreaPtrList m_areas
+ EventAreaPtrList m_areas;
};
@@ -236,7 +292,7 @@
/**
* Label of message.
*/
- string m_label;
+ std::string m_label;
/**
* Sender of message.
@@ -277,50 +333,5 @@
EventPtr m_matching_event;
};
-/**
- * Directed acyclic graph.
- */
-template <class T>
-class Dag
-{
-
- /**
- * List of pointered DagNodes.
- */
- typedef std::list<DagNode<T>::DagNodePtr> DagNodePtrList;
-
- /**
- * Set of pointered DagNodes.
- */
- typedef std::set<DagNode<T>::DagNodePtr> DagNodePtrSet;
-
- /**
- * Events which aren't successors of any other events.
- */
- Dag<T>::DagNodePtrList m_minimal_events;
-};
-
-/**
- * Node of directed acyclic graph.
- */
-template <class T>
-class DagNode{
-
- /**
- * Pointered alternative to DagNode.
- */
- typedef counted_ptr<DagNode<T>> DagNodePtr;
-
- /**
- * Object which is contained in this DagNode.
- */
- T m_content;
-
- /**
- * Successors of this node.
- */
- std::list<T> m_successors;
-};
-
#endif /* _MSC_H */
Modified: trunk/src/data/msc_modifications.h
===================================================================
--- trunk/src/data/msc_modifications.h 2008-03-13 20:56:06 UTC (rev 9)
+++ trunk/src/data/msc_modifications.h 2008-04-03 17:21:55 UTC (rev 10)
@@ -66,12 +66,12 @@
/**
* Events which were removed from EventArea.
*/
- stl::set<Event> m_removed_events;
+ std::set<Event> m_removed_events;
/**
* Events which are new in EventArea.
*/
- stl::set<Event> m_new_events;
+ std::set<Event> m_new_events;
};
@@ -224,7 +224,7 @@
*/
std::set<ReferenceNodePtr> m_new_nodes;
-}
+};
#endif /* _MSC_MODIFICATIONS_H */
Modified: trunk/src/data/msc_path.h
===================================================================
--- trunk/src/data/msc_path.h 2008-03-13 20:56:06 UTC (rev 9)
+++ trunk/src/data/msc_path.h 2008-04-03 17:21:55 UTC (rev 10)
@@ -19,9 +19,12 @@
#ifndef _MSC_PATH_H
#define _MSC_PATH_H
+#include <list>
#include "msc.h"
-#include <list>
+#include "counted_ptr.h"
+class PathNode;
+
typedef counted_ptr<PathNode> PathNodePtr;
typedef std::list<PathNodePtr> PathNodePtrList;
@@ -47,9 +50,9 @@
class PathNode{
/**
- * HmscNode which path goes through.
+ * ReferenceNode which path goes through.
*/
- HmscNodePtr m_node;
+ ReferenceNodePtr m_node;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-04-10 14:38:28
|
Revision: 22
http://scstudio.svn.sourceforge.net/scstudio/?rev=22&view=rev
Author: babicaj
Date: 2008-04-10 07:38:17 -0700 (Thu, 10 Apr 2008)
Log Message:
-----------
GeneralOrderArea renamed to CoregionArea, GeneralEvent renamed to CoregionEvent, GeneralOrderModification renamed to CoregionModification
Modified Paths:
--------------
trunk/src/data/msc.h
trunk/src/data/msc_modifications.h
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2008-04-09 10:50:42 UTC (rev 21)
+++ trunk/src/data/msc.h 2008-04-10 14:38:17 UTC (rev 22)
@@ -32,14 +32,14 @@
class Instance;
class Event;
class StrictEvent;
-class GeneralEvent;
+class CoregionEvent;
class Msc;
class BMsc;
class HMsc;
class MscMessage;
class EventArea;
class StrictOrderArea;
-class GeneralOrderArea;
+class CoregionArea;
class InstanceArea;
typedef counted_ptr<Msc> MscPtr;
@@ -64,8 +64,8 @@
typedef counted_ptr<StrictEvent> StrictEventPtr;
typedef std::list<StrictEventPtr> StrictEventPtrList;
-typedef counted_ptr<GeneralEvent> GeneralEventPtr;
-typedef std::list<GeneralEventPtr> GeneralEventPtrList;
+typedef counted_ptr<CoregionEvent> CoregionEventPtr;
+typedef std::list<CoregionEventPtr> CoregionEventPtrList;
typedef counted_ptr<MscMessage> MscMessagePtr;
@@ -76,7 +76,7 @@
typedef counted_ptr<StrictOrderArea> StrictOrderAreaPtr;
-typedef counted_ptr<GeneralOrderArea> GeneralOrderAreaPtr;
+typedef counted_ptr<CoregionArea> CoregionAreaPtr;
/**
* Represents virtual base class for BMsc and HMsc.
@@ -230,13 +230,13 @@
/**
* EventArea whose events are ordered like directed acyclic graph.
*/
-class GeneralOrderArea:public EventArea
+class CoregionArea:public EventArea
{
/**
* Events which aren't successors of any other events.
*/
- GeneralEventPtrList m_minimal_events;
+ CoregionEventPtrList m_minimal_events;
};
/**
@@ -314,14 +314,14 @@
};
/**
- * Event occuring in GeneralOrderArea
+ * Event occuring in CoregionArea
*/
-class GeneralEvent: public Event
+class CoregionEvent: public Event
{
/**
* Successors of this event
*/
- GeneralEventPtrList m_successors;
+ CoregionEventPtrList m_successors;
};
#endif /* _MSC_H */
Modified: trunk/src/data/msc_modifications.h
===================================================================
--- trunk/src/data/msc_modifications.h 2008-04-09 10:50:42 UTC (rev 21)
+++ trunk/src/data/msc_modifications.h 2008-04-10 14:38:17 UTC (rev 22)
@@ -32,8 +32,8 @@
typedef counted_ptr<MscModification> MscModificationPtr;
typedef std::set<MscModificationPtr> MscModificationPtrSet;
-typedef counted_ptr<GeneralEvent> GeneralEventPtr;
-typedef std::set<GeneralEventPtr> GeneralEventPtrSet;
+typedef counted_ptr<CoregionEvent> CoregionEventPtr;
+typedef std::set<CoregionEventPtr> CoregionEventPtrSet;
typedef counted_ptr<StrictEvent> StrictEventPtr;
typedef std::set<StrictEventPtr> StrictEventPtrSet;
@@ -104,24 +104,24 @@
};
/**
- * Modifications which are performed in GeneralOrderArea.
+ * Modifications which are performed in CoregionArea.
*/
-class GeneralOrderModification:public EventAreaModification{
+class CoregionModification:public EventAreaModification{
/**
- * Previous version of GeneralOrderArea.
+ * Previous version of CoregionArea.
*/
- GeneralOrderAreaPtr m_previous;
+ CoregionAreaPtr m_previous;
/**
* Events which are newly minimimal in modified version.
*/
- GeneralEventPtrSet m_minimal_events;
+ CoregionEventPtrSet m_minimal_events;
/**
* Events with modified successors.
*/
- GeneralEventPtrSet m_modified_events;
+ CoregionEventPtrSet m_modified_events;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2008-05-10 21:53:48
|
Revision: 68
http://scstudio.svn.sourceforge.net/scstudio/?rev=68&view=rev
Author: gotthardp
Date: 2008-05-10 14:53:44 -0700 (Sat, 10 May 2008)
Log Message:
-----------
First draft of a Z.120 parser.
Added Paths:
-----------
trunk/src/data/Z120/
trunk/src/data/Z120/CMakeLists.txt
trunk/src/data/Z120/README
trunk/src/data/Z120/Z120.cpp
trunk/src/data/Z120/Z120.g
trunk/src/data/Z120/Z120.h
trunk/src/data/Z120/main.cpp
trunk/src/data/Z120/test.msc
Added: trunk/src/data/Z120/CMakeLists.txt
===================================================================
--- trunk/src/data/Z120/CMakeLists.txt (rev 0)
+++ trunk/src/data/Z120/CMakeLists.txt 2008-05-10 21:53:44 UTC (rev 68)
@@ -0,0 +1,14 @@
+PROJECT(parser C CXX)
+# SET(CMAKE_VERBOSE_MAKEFILE ON)
+
+INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include)
+
+ADD_EXECUTABLE(parser
+ main.cpp
+ Z120.cpp
+ Z120Lexer.c
+ Z120Parser.c)
+
+TARGET_LINK_LIBRARIES(parser
+ antlr3c)
+
\ No newline at end of file
Added: trunk/src/data/Z120/README
===================================================================
--- trunk/src/data/Z120/README (rev 0)
+++ trunk/src/data/Z120/README 2008-05-10 21:53:44 UTC (rev 68)
@@ -0,0 +1,16 @@
+A.1. Build instructions
+-----------------------
+
+1) Install the ANTLR v3 (http://www.antlr.org)
+ - download immediate build antlr-2008-05-07.18.tar.gz
+ - install the ANTLR tool
+ - install the C runtime library
+
+
+Configure and build the application by executing
+ java org.antlr.Tool Z120.g
+ cmake . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr/local
+ make
+
+
+$Id: README 31 2007-10-25 17:18:57Z gotthardp $
Added: trunk/src/data/Z120/Z120.cpp
===================================================================
--- trunk/src/data/Z120/Z120.cpp (rev 0)
+++ trunk/src/data/Z120/Z120.cpp 2008-05-10 21:53:44 UTC (rev 68)
@@ -0,0 +1,109 @@
+/*
+ * 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 Petr Gotthard <pet...@ce...>
+ *
+ * $Id: Z120.g 43 2008-04-24 12:05:24Z gotthardp $
+ */
+
+#include "Z120.h"
+
+// Process "Z120.g" with antlr-2008-05-07 to produce the following files.
+#include "Z120Lexer.h"
+#include "Z120Parser.h"
+
+#include <assert.h>
+
+inline std::string getTokenString(pANTLR3_COMMON_TOKEN token)
+{
+ return std::string((char*)token->getStartIndex(token),
+ token->getStopIndex(token)-token->getStartIndex(token)+1);
+}
+
+static void walk(pANTLR3_BASE_TREE tree)
+{
+ assert(tree != NULL);
+ switch(tree->getType(tree))
+ {
+ case NAME:
+ {
+ std::string pp = getTokenString(tree->getToken(tree));
+ printf("NAME %s\n", pp.c_str());
+ break;
+ }
+
+ case MSC:
+ printf("MSC\n");
+ walk((pANTLR3_BASE_TREE)tree->getChild(tree, 0));
+ printf(";\n\n");
+ break;
+
+ default:
+ fprintf(stderr, "Unexpected node<%d>\n", tree->getType(tree));
+ break;
+ }
+}
+
+int Z120::readFile(const std::string& filename)
+{
+ pANTLR3_INPUT_STREAM input =
+ antlr3AsciiFileStreamNew((pANTLR3_UINT8)filename.c_str());
+ if (input == NULL || (int)input < 0)
+ {
+ fprintf(stderr, "Unable to open file %s\n", filename.c_str());
+ exit(1);
+ }
+
+ pZ120Lexer lxr = Z120LexerNew(input);
+
+ if (lxr == NULL)
+ {
+ fprintf(stderr, "Unable to create the lexer\n");
+ exit(1);
+ }
+
+ pANTLR3_COMMON_TOKEN_STREAM tstream =
+ antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT, lxr->pLexer->rec->state->tokSource);
+ if (tstream == NULL)
+ {
+ fprintf(stderr, "Out of memory trying to allocate token stream\n");
+ exit(1);
+ }
+
+ pZ120Parser psr = Z120ParserNew(tstream);
+ if (psr == NULL)
+ {
+ fprintf(stderr, "Out of memory trying to allocate parser\n");
+ exit(1);
+ }
+
+ struct Z120Parser_textual_msc_file_return_struct langAST =
+ psr->textual_msc_file(psr);
+ if (psr->pParser->rec->state->errorCount > 0)
+ {
+ fprintf(stderr, "The parser returned %d errors, tree walking aborted.\n", psr->pParser->rec->state->errorCount);
+ }
+ else
+ {
+ walk(langAST.tree);
+ }
+
+ psr->free(psr); psr = NULL;
+ tstream->free(tstream); tstream = NULL;
+ lxr->free(lxr); lxr = NULL;
+ input->close(input); input = NULL;
+
+ return 0;
+}
+
+// end of file
Added: trunk/src/data/Z120/Z120.g
===================================================================
--- trunk/src/data/Z120/Z120.g (rev 0)
+++ trunk/src/data/Z120/Z120.g 2008-05-10 21:53:44 UTC (rev 68)
@@ -0,0 +1,1475 @@
+/*
+ * 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 Petr Gotthard <pet...@ce...>
+ *
+ * $Id: Z120.g 43 2008-04-24 12:05:24Z gotthardp $
+ */
+
+grammar Z120;
+
+options
+{
+ output = AST;
+ language = C;
+ backtrack = true;
+}
+
+tokens
+{
+ // imaginary tokens
+ MSC;
+}
+
+// ----- Lexical Rules
+
+fragment
+Alphanumeric:
+ Letter
+ | Decimal_Digit
+ | National
+;
+
+fragment
+Letter:
+ 'a'..'z' | 'A'..'Z'
+;
+
+fragment
+Decimal_Digit:
+ '0'..'9'
+;
+
+fragment
+National:
+ '`' | '\\'
+ | Left_Curly_Bracket
+ | Vertical_Line
+ | Right_Curly_Bracket
+ | Overline
+ | Upward_Arrow_Head
+;
+
+fragment
+Left_Square_Bracket:
+ '['
+;
+
+fragment
+Right_Square_Bracket:
+ ']'
+;
+
+fragment
+Left_Curly_Bracket:
+ '{'
+;
+
+fragment
+Vertical_Line:
+ '|'
+;
+
+fragment
+Right_Curly_Bracket:
+ '}'
+;
+
+fragment
+Left_Open:
+ '('
+;
+
+fragment
+Left_Closed:
+ Left_Square_Bracket
+;
+
+fragment
+Right_Open:
+ ')'
+;
+
+fragment
+Right_Closed:
+ Right_Square_Bracket
+;
+
+fragment
+Abs_Time_Mark:
+ '@'
+;
+
+fragment
+Rel_Time_Mark:
+ '&'
+;
+
+fragment
+Overline:
+ '~'
+;
+
+fragment
+Upward_Arrow_Head:
+ '^'
+;
+
+fragment
+Full_Stop:
+ '.'
+;
+
+fragment
+Underline:
+ '_'
+;
+
+fragment
+Left_Angular_Bracket:
+ '<'
+;
+
+fragment
+Right_Angular_Bracket:
+ '>'
+;
+
+fragment
+Character_String:
+ Apostrophe (Alphanumeric
+ | Other_Character
+ | Special
+ | '.' | '_' | ' '
+ | Apostrophe Apostrophe)* Apostrophe
+;
+
+fragment
+Text:
+ (Alphanumeric
+ | Other_Character
+ | Special
+ | '.' | '_' | ' '
+ | Apostrophe)*
+;
+
+fragment
+Apostrophe:
+ '\''
+;
+
+fragment
+Other_Character:
+ '?' | '%' | '+' | '-' | '!' | '/' | '*' | '"' | '='
+;
+
+fragment
+Special:
+ Abs_Time_Mark | Rel_Time_Mark
+ | Left_Open | Right_Open
+ | Left_Closed | Right_Closed
+ | Left_Angular_Bracket | Right_Angular_Bracket
+ | '#' | ',' | ';' | ':'
+;
+
+fragment
+Qualifier_Left:
+ '<<'
+;
+
+fragment
+Qualifier_Right:
+ '>>'
+;
+
+fragment
+Qualifier:
+ Qualifier_Left Text Qualifier_Right
+;
+
+NAME:
+ (Alphanumeric | '_' | '.')+
+;
+
+fragment
+STRING:
+ Pure_Data_String
+;
+
+fragment
+Pure_Data_String:
+ Non_Parenthesis /*(parenthesis)? (Pure_Data_String)?*/
+;
+
+parenthesis:
+ nestable_par | equal_par | non_nestable_par
+;
+
+nestable_par:
+ Par Pure_Data_String Par
+;
+
+Non_Parenthesis:
+ (Non_Par_Non_Escape /*|
+ escapechar (escapechar | par)*/)
+;
+
+Non_Par_Non_Escape:
+ Character_String
+;
+
+non_nestable_par:
+ Par Text Par
+;
+
+// non-standard: Z.120 doesn't specify whitespaces
+WHITESPACE:
+ ('\t' | ' ' | '\r' | '\n')+ { $channel = HIDDEN; }
+;
+
+
+// ----- Comment
+
+end:
+ (comment)? ';'
+;
+
+comment:
+ 'comment' Character_String
+;
+
+text_definition:
+ 'text' Character_String end
+;
+
+
+// ----- Message Sequence Chart Document
+
+// non-standard: Z.120 doesn't define top-level nonterminal
+textual_msc_file:
+ (message_sequence_chart)*
+;
+
+textual_msc_document:
+ document_head
+ textual_defining_part textual_utility_part
+;
+
+document_head:
+ 'mscdocument' instance_kind ('related' 'to' sdl_reference)?
+ (inheritance)? end
+ (parenthesis_declaration)?
+ data_definition
+ using_clause
+ containing_clause
+ message_decl_clause
+ timer_decl_clause
+;
+
+textual_defining_part:
+ (defining_msc_reference)*
+;
+
+textual_utility_part:
+ 'utilities' (containing_clause)? (defining_msc_reference)*
+;
+
+defining_msc_reference:
+ 'reference' (virtuality)? NAME
+;
+
+virtuality:
+ 'virtual' | 'redefined' | 'finalized'
+;
+
+using_clause:
+ ('using' instance_kind end)*
+;
+
+containing_clause:
+ ('inst' instance_item)+
+;
+
+instance_item:
+ NAME (':' instance_kind)? (inheritance)?
+ (decomposition)?
+ (dynamic_decl_list | end)
+;
+
+inheritance:
+ 'inherits' instance_kind
+;
+
+message_decl_clause:
+ ('msg' message_decl end)*
+;
+
+timer_decl_clause:
+ ('timer' timer_decl end)*
+;
+
+sdl_reference:
+ identifier
+;
+
+identifier:
+ (Qualifier)? NAME
+;
+
+
+// ----- Basic MSC
+
+message_sequence_chart:
+ (virtuality)? 'msc' msc_head (msc | hmsc) 'endmsc' end
+;
+
+msc:
+ msc_body
+;
+
+msc_head:
+ NAME (msc_parameter_decl)? (time_offset)? end
+ (msc_inst_interface)? msc_gate_interface
+;
+
+msc_parameter_decl:
+ '(' msc_parm_decl_list ')'
+;
+
+msc_parm_decl_list:
+ msc_parm_decl_block (end msc_parm_decl_list)?
+;
+
+msc_parm_decl_block:
+ data_parameter_decl
+ | instance_parameter_decl
+ | message_parameter_decl
+ | timer_parameter_decl
+;
+
+instance_parameter_decl:
+ 'inst' instance_parm_decl_list
+;
+
+instance_parm_decl_list:
+ instance_parameter_name (':' instance_kind)? (',' instance_parm_decl_list)?
+;
+
+instance_parameter_name:
+ NAME
+;
+
+message_parameter_decl:
+ 'msg' message_parm_decl_list
+;
+
+message_parm_decl_list:
+ message_decl_list
+;
+
+timer_parameter_decl:
+ 'timer' timer_parm_decl_list
+;
+
+timer_parm_decl_list:
+ timer_decl_list
+;
+
+msc_inst_interface:
+ containing_clause
+;
+
+instance_kind:
+ (kind_denominator)? identifier
+;
+
+kind_denominator:
+ NAME
+;
+
+msc_gate_interface:
+ (msc_gate_def)*
+;
+
+msc_gate_def:
+ 'gate' (msg_gate | method_call_gate | reply_gate |
+ create_gate | order_gate) end
+;
+
+msg_gate:
+ def_in_gate | def_out_gate
+;
+
+method_call_gate:
+ def_out_call_gate | def_in_call_gate
+;
+
+reply_gate:
+ def_out_reply_gate | def_in_reply_gate
+;
+
+create_gate:
+ def_create_in_gate | def_create_out_gate
+;
+
+order_gate:
+ def_order_in_gate | def_order_out_gate
+;
+
+msc_body:
+ (msc_statement)*
+;
+
+msc_statement:
+ text_definition | event_definition
+;
+
+event_definition:
+ NAME ':' instance_event_list
+ | instance_name_list ':' multi_instance_event_list
+;
+
+instance_event_list:
+ (instance_event)+
+;
+
+instance_event:
+ orderable_event | non_orderable_event
+;
+
+orderable_event:
+ ('label' NAME end)?
+ (message_event | incomplete_message_event |
+ method_call_event | incomplete_method_call_event | create |
+ timer_statement | action)
+ ('before' order_dest_list)? ('after' order_dest_list)? end
+ ('time' time_dest_list end)?
+;
+
+order_dest_list:
+ order_dest (',' order_dest_list)?
+;
+
+time_dest_list:
+ (time_dest ('origin')?)? time_interval (',' time_dest_list)?
+;
+
+time_dest:
+ NAME | ('top' | 'bottom') (reference_identification | NAME)
+;
+
+non_orderable_event:
+ start_method | end_method | start_suspension | end_suspension |
+ start_coregion | end_coregion | shared_condition |
+ shared_msc_reference | shared_inline_expr |
+ instance_head_statement | instance_end_statement | stop
+;
+
+instance_name_list:
+ NAME (',' NAME)* | 'all'
+;
+
+multi_instance_event_list:
+ (multi_instance_event)+
+;
+
+multi_instance_event:
+ condition | msc_reference | inline_expr
+;
+
+
+// ----- Instance
+
+instance_head_statement:
+ 'instance' (instance_kind)? (decomposition)? end
+;
+
+instance_end_statement:
+ 'endinstance' end
+;
+
+
+// ----- Message
+
+message_event:
+ message_output | message_input
+;
+
+message_output:
+ 'out' msg_identification 'to' input_address
+;
+
+message_input:
+ 'in' msg_identification 'from' output_address
+;
+
+incomplete_message_event:
+ incomplete_message_output | incomplete_message_input
+;
+
+incomplete_message_output:
+ 'out' msg_identification 'to' 'lost' (input_address)?
+;
+
+incomplete_message_input:
+ 'in' msg_identification 'from' 'found' (output_address)?
+;
+
+msg_identification:
+ NAME (',' NAME)? ('(' parameter_list ')')?
+;
+
+output_address:
+ NAME | ('env' | reference_identification) ('via' NAME)?
+;
+
+reference_identification:
+ 'reference' msc_reference_identification
+ | 'inline' inline_expr_identification
+;
+
+input_address:
+ NAME | ('env' | reference_identification) ('via' NAME)?
+;
+
+
+// ----- Control Flow
+
+method_call_event:
+ call_out | call_in | reply_out | reply_in
+;
+
+call_out:
+ 'call' msg_identification 'to' input_address
+;
+
+call_in:
+ 'receive' msg_identification 'from' output_address
+;
+
+reply_out:
+ 'replyout' msg_identification 'to' input_address
+;
+
+reply_in:
+ 'replyin' msg_identification 'from' output_address
+;
+
+incomplete_method_call_event:
+ incomplete_call_out | incomplete_call_in |
+ incomplete_reply_out | incomplete_reply_in
+;
+
+incomplete_call_out:
+ 'call' msg_identification 'to' 'lost' (input_address)?
+;
+
+incomplete_call_in:
+ 'receive' msg_identification 'from' 'found' (output_address)?
+;
+
+incomplete_reply_out:
+ 'replyout' msg_identification 'to' 'lost' (input_address)?
+;
+
+incomplete_reply_in:
+ 'replyin' msg_identification 'from' 'found' (output_address)?
+;
+
+start_method:
+ 'method' end
+;
+
+end_method:
+ 'endmethod' end
+;
+
+start_suspension:
+ 'suspension' end
+;
+
+end_suspension:
+ 'endsuspension' end
+;
+
+
+// ----- Environment and Gates
+
+actual_out_gate:
+ (NAME)? 'out' msg_identification 'to' input_dest
+;
+
+actual_in_gate:
+ (NAME)? 'in' msg_identification 'from' output_dest
+;
+
+input_dest:
+ 'lost' (input_address)? | input_address
+;
+
+output_dest:
+ 'found' (output_address)? | output_address
+;
+
+def_in_gate:
+ (NAME)? 'out' msg_identification 'to' input_dest
+;
+
+def_out_gate:
+ (NAME)? 'in' msg_identification 'from' output_dest
+;
+
+actual_order_out_gate:
+ NAME 'before' order_dest
+;
+
+order_dest:
+ NAME | ('env' | reference_identification) 'via' NAME
+;
+
+actual_order_in_gate:
+ NAME
+ ('after' order_dest_list)?
+;
+
+def_order_in_gate:
+ NAME 'before' order_dest
+;
+
+def_order_out_gate:
+ NAME
+ ('after' order_dest_list)?
+;
+
+actual_create_out_gate:
+ 'create' 'out' create_gate_identification 'create' create_target
+;
+
+actual_create_in_gate:
+ 'create' 'in' create_gate_identification
+;
+
+create_target:
+ NAME | ('env' | reference_identification) ('via' NAME)?
+;
+
+def_create_in_gate:
+ 'create' 'out' (create_gate_identification)? 'create' create_target
+;
+
+def_create_out_gate:
+ 'create' 'in' create_gate_identification
+;
+
+inline_out_gate:
+ def_out_gate
+ ('external' 'out' msg_identification 'to' input_dest)?
+;
+
+inline_in_gate:
+ def_in_gate
+ ('external' 'in' msg_identification 'from' output_dest)?
+;
+
+inline_out_call_gate:
+ def_out_call_gate
+ ('external' 'call' msg_identification 'to' input_dest)?
+;
+
+inline_in_call_gate:
+ def_in_call_gate
+ ('external' 'receive' msg_identification 'from' output_dest)?
+;
+
+inline_out_reply_gate:
+ def_out_reply_gate
+ ('external' 'replyout' msg_identification 'to' input_dest)?
+;
+
+inline_in_reply_gate:
+ def_in_reply_gate
+ ('external' 'replyin' msg_identification 'from' output_dest)?
+;
+
+inline_create_out_gate:
+ def_create_out_gate
+ ('external' create)?
+;
+
+inline_create_in_gate:
+ def_create_in_gate
+ ('external' 'create' 'from' create_source)?
+;
+
+create_source:
+ NAME |
+ ('env' | reference_identification) ('via' create_gate_identification)?
+;
+
+inline_order_out_gate:
+ NAME
+ (('after' order_dest_list)? 'external' 'before' order_dest)?
+;
+
+inline_order_in_gate:
+ NAME 'before' order_dest
+ ('external' ('after' order_dest_list)?)?
+;
+
+actual_out_call_gate:
+ (NAME)? 'call' msg_identification 'to' input_dest
+;
+
+actual_in_call_gate:
+ (NAME)? 'receive' msg_identification 'from' output_dest
+;
+
+def_in_call_gate:
+ (NAME)? 'call' msg_identification 'to' input_dest
+;
+
+def_out_call_gate:
+ (NAME)? 'receive' msg_identification 'from' output_dest
+;
+
+actual_out_reply_gate:
+ (NAME)? 'replyout' msg_identification 'to' input_dest
+;
+
+actual_in_reply_gate:
+ (NAME)? 'replyin' msg_identification 'from' output_dest
+;
+
+def_in_reply_gate:
+ (NAME)? 'replyout' msg_identification 'to' input_dest
+;
+
+def_out_reply_gate:
+ (NAME)? 'replyin' msg_identification 'from' output_dest
+;
+
+gate_identification:
+ NAME
+;
+
+create_gate_identification:
+ (gate_identification ':')? instance_kind
+;
+
+
+// ----- Condition
+
+shared_condition:
+ (shared)? condition_identification shared end
+;
+
+condition_identification:
+ 'condition' condition_text
+;
+
+condition_text:
+ condition_name_list | 'when' (condition_name_list | '(' expression ')') |
+ 'otherwise'
+;
+
+condition_name_list:
+ NAME (',' NAME)*
+;
+
+shared:
+ 'shared' ((shared_instance_list)? | 'all')
+;
+
+shared_instance_list:
+ NAME (',' shared_instance_list)?
+;
+
+condition:
+ (shared)? condition_identification end
+;
+
+
+// ----- Timer
+
+timer_statement:
+ starttimer | stoptimer | timeout
+;
+
+starttimer:
+ 'starttimer' NAME (',' NAME)?
+ (duration)? ('(' parameter_list ')')?
+;
+
+duration:
+ Left_Square_Bracket
+ (durationlimit)? (',' durationlimit)? Right_Square_Bracket
+;
+
+durationlimit:
+ STRING | 'inf'
+;
+
+stoptimer:
+ 'stoptimer' NAME (',' NAME)?
+;
+
+timeout:
+ 'timeout' NAME (',' NAME)?
+ ('(' parameter_list ')')?
+;
+
+
+// ----- Action
+
+action:
+ 'action' action_statement
+;
+
+action_statement:
+ informal_action | data_statement_list
+;
+
+informal_action:
+ Character_String
+;
+
+
+// ----- Instance creation
+
+create:
+ 'create' NAME ('(' parameter_list ')')?
+;
+
+
+// ----- Instance stop
+
+stop:
+ 'stop' end
+;
+
+
+// ----- Data concepts
+
+parenthesis_declaration:
+ 'parenthesis' par_decl_list end
+;
+
+par_decl_list:
+ (nestable_par_pair | non_nestable_par_pair | equal_par_decl | escape_decl)
+ (par_decl_list)?
+;
+
+nestable_par_pair:
+ 'nestable' pair_par_list end
+;
+
+non_nestable_par_pair:
+ 'nonnestable' pair_par_list end
+;
+
+equal_par_decl:
+ 'equalpar' equal_par_list end
+;
+
+escape_decl:
+ 'escape' Escapechar
+;
+
+pair_par_list:
+ pair_par (escape_decl)? (',' pair_par_list)?
+;
+
+pair_par:
+ Delim Par Delim Par Delim
+;
+
+equal_par_list:
+ equal_par (escape_decl)? (',' equal_par_list)?
+;
+
+equal_par:
+ Delim Par Delim
+;
+
+Delim:
+ Apostrophe
+ | Alphanumeric
+ | Other_Character
+ | Special
+ | Full_Stop
+ | Underline
+;
+
+Par:
+ Character_String
+;
+
+Escapechar:
+ Delim Character_String Delim
+;
+
+
+// ----- Declaring data
+
+message_decl_list:
+ message_decl (end message_decl_list)?
+;
+
+message_decl:
+ message_name_list (':' '(' type_ref_list ')')?
+;
+
+message_name_list:
+ NAME (',' message_name_list)?
+;
+
+timer_decl_list:
+ timer_decl (end timer_decl_list)?
+;
+
+timer_decl:
+ timer_name_list (duration)? (':' '(' type_ref_list ')')?
+;
+
+timer_name_list:
+ NAME (',' timer_name_list)?
+;
+
+type_ref_list:
+ STRING (',' type_ref_list)?
+;
+
+dynamic_decl_list:
+ 'variables' variable_decl_list end
+;
+
+variable_decl_list:
+ variable_decl_item (end variable_decl_list)?
+;
+
+variable_decl_item:
+ variable_list ':' STRING
+;
+
+variable_list:
+ STRING (',' variable_list)?
+;
+
+data_definition:
+ ('language' NAME end)?
+ (wildcard_decl)?
+ ('data' STRING end)?
+;
+
+wildcard_decl:
+ 'wildcards' variable_decl_list end
+;
+
+
+// ----- Static Data
+
+data_parameter_decl:
+ ('variables')? variable_decl_list
+;
+
+actual_data_parameters:
+ ('variables')? actual_data_parameter_list
+;
+
+actual_data_parameter_list:
+ STRING (',' actual_data_parameter_list)?
+;
+
+
+// ----- Bindings
+
+binding:
+ left_binding | right_binding
+;
+
+left_binding:
+ pattern LEFT_BIND_SYMBOL expression
+;
+
+LEFT_BIND_SYMBOL:
+ ':='
+;
+
+right_binding:
+ expression RIGHT_BIND_SYMBOL pattern
+;
+
+RIGHT_BIND_SYMBOL:
+ '=:'
+;
+
+expression:
+ STRING
+;
+
+pattern:
+ STRING | wildcard
+;
+
+wildcard:
+ STRING
+;
+
+
+// ----- Data in message and timer paramerers
+
+parameter_list:
+ parameter_defn (',' parameter_list)?
+;
+
+parameter_defn:
+ binding | expression | pattern
+;
+
+
+// ----- Data in action boxes
+
+data_statement_list:
+ data_statement (',' data_statement_list)?
+;
+
+data_statement:
+ define_statement | undefine_statement | binding
+;
+
+define_statement:
+ 'def' STRING
+;
+
+undefine_statement:
+ 'undef' STRING
+;
+
+
+// ----- Time Offset
+
+time_offset:
+ 'offset' expression
+;
+
+
+// ----- Time Points
+
+time_point:
+ (Abs_Time_Mark)? expression
+;
+
+
+// ----- Measurements
+
+measurement:
+ rel_measurement
+ | abs_measurement
+;
+
+rel_measurement:
+ Rel_Time_Mark pattern
+;
+
+abs_measurement:
+ Abs_Time_Mark pattern
+;
+
+
+// ----- Time Interval
+
+time_interval:
+ (interval_label)? singular_time
+ | (interval_label)? bounded_time
+ (measurement)?
+;
+
+interval_label:
+ ('int_boundary')? NAME
+;
+
+singular_time:
+ Left_Closed time_point Right_Closed
+ | measurement
+;
+
+bounded_time:
+ (Abs_Time_Mark)? (Left_Open | Left_Closed)
+ (time_point)? ',' (time_point)?
+ (Right_Open | Right_Closed)
+;
+
+
+// ----- Coregion
+
+start_coregion:
+ 'concurrent' end
+;
+
+end_coregion:
+ 'endconcurrent' end
+;
+
+
+// ----- Inline expression
+
+shared_inline_expr:
+ (extra_global)? (shared_loop_expr | shared_opt_expr |
+ shared_alt_expr | shared_seq_expr | shared_par_expr | shared_exc_expr)
+ ('time' time_interval end)?
+ ('top' time_dest_list end)?
+ ('bottom' time_dest_list end)?
+;
+
+extra_global:
+ 'external'
+;
+
+shared_loop_expr:
+ 'loop' (loop_boundary)? 'begin' (inline_expr_identification)? shared end
+ (inline_gate_interface)? (instance_event_list)?
+ 'loop' 'end' end
+;
+
+shared_opt_expr:
+ 'opt' 'begin' (inline_expr_identification)? shared end
+ (inline_gate_interface)? (instance_event_list)?
+ 'opt' 'end' end
+;
+
+shared_exc_expr:
+ 'exc' 'begin' (inline_expr_identification)? shared end
+ (inline_gate_interface)? (instance_event_list)?
+ 'exc' 'end' end
+;
+
+shared_alt_expr:
+ 'alt' 'begin' (inline_expr_identification)? shared end
+ (inline_gate_interface)? (instance_event_list)?
+ ('alt' end (inline_gate_interface)? (instance_event_list)?)*
+ 'alt' 'end' end
+;
+
+shared_seq_expr:
+ 'seq' 'begin' (inline_expr_identification)? shared end
+ (inline_gate_interface)? (instance_event_list)?
+ ('seq' end (inline_gate_interface)? (instance_event_list)?)*
+ 'seq' 'end' end
+;
+
+shared_par_expr:
+ 'par' 'begin' (inline_expr_identification)? shared end
+ (inline_gate_interface)? (instance_event_list)?
+ ('par' end (inline_gate_interface)? (instance_event_list)?)*
+ 'par' 'end' (time_interval)? end
+;
+
+inline_expr:
+ (extra_global)? (loop_expr | opt_expr | alt_expr |
+ seq_expr | par_expr | exc_expr)
+ ('time' time_interval end)?
+ ('top' time_dest_list end)?
+ ('bottom' time_dest_list end)?
+;
+
+loop_expr:
+ 'loop' (loop_boundary)? 'begin' (inline_expr_identification)? end
+ (inline_gate_interface)? msc_body
+ 'loop' 'end' end
+;
+
+opt_expr:
+ 'opt' 'begin' (inline_expr_identification)? end
+ (inline_gate_interface)? msc_body
+ 'opt' 'end' end
+;
+
+exc_expr:
+ 'exc' 'begin' (inline_expr_identification)? end
+ (inline_gate_interface)? msc_body
+ 'exc' 'end' end
+;
+
+alt_expr:
+ 'alt' 'begin' (inline_expr_identification)? end
+ (inline_gate_interface)? msc_body
+ ('alt' end (inline_gate_interface)? msc_body)*
+ 'alt' 'end' end
+;
+
+seq_expr:
+ 'seq' 'begin' (inline_expr_identification)? end
+ (inline_gate_interface)? msc_body
+ ('seq' end (inline_gate_interface)? msc_body)*
+ 'seq' 'end' end
+;
+
+par_expr:
+ 'par' 'begin' (inline_expr_identification)? end
+ (inline_gate_interface)? msc_body
+ ('par' end (inline_gate_interface)? msc_body)*
+ 'par' 'end' end
+;
+
+loop_boundary:
+ Left_Angular_Bracket inf_natural (',' inf_natural)?
+ Right_Angular_Bracket
+;
+
+inf_natural:
+ 'inf' | expression
+;
+
+inline_expr_identification:
+ NAME
+;
+
+inline_gate_interface:
+ ('gate' inline_gate end)+
+;
+
+inline_gate:
+ inline_out_gate | inline_in_gate |
+ inline_create_out_gate | inline_create_in_gate |
+ inline_out_call_gate | inline_in_call_gate |
+ inline_out_reply_gate | inline_in_reply_gate |
+ inline_order_out_gate | inline_order_in_gate
+;
+
+
+// ----- MSC reference
+
+shared_msc_reference:
+ 'reference' (msc_reference_identification ':')?
+ msc_ref_expr shared end
+ ('time' time_interval end)?
+ ('top' time_dest_list end)?
+ ('bottom' time_dest_list end)?
+ reference_gate_interface
+;
+
+msc_reference:
+ 'reference' (msc_reference_identification ':')?
+ msc_ref_expr end
+ ('time' time_interval end)?
+ ('top' time_dest_list end)?
+ ('bottom' time_dest_list end)?
+ reference_gate_interface
+;
+
+msc_reference_identification:
+ NAME
+;
+
+msc_ref_expr:
+ msc_ref_par_expr ('alt' msc_ref_par_expr)*
+;
+
+msc_ref_par_expr:
+ msc_ref_seq_expr ('par' msc_ref_seq_expr)*
+;
+
+msc_ref_seq_expr:
+ msc_ref_ident_expr ('seq' msc_ref_ident_expr)*
+;
+
+msc_ref_ident_expr:
+ 'loop' (loop_boundary)? msc_ref_ident_expr |
+ 'exc' msc_ref_ident_expr |
+ 'opt' msc_ref_ident_expr |
+ 'empty' |
+ (parent)* NAME (actual_parameters)? |
+ '(' msc_ref_expr ')'
+;
+
+actual_parameters:
+ '(' actual_parameters_list ')'
+;
+
+actual_parameters_list:
+ actual_parameters_block (end actual_parameters_list)?
+;
+
+actual_parameters_block:
+ actual_data_parameters
+ | actual_instance_parameters
+ | actual_message_parameters
+ | actual_timer_parameters
+;
+
+actual_instance_parameters:
+ 'inst' actual_instance_parm_list
+;
+
+actual_instance_parm_list:
+ actual_instance_parameter (',' actual_instance_parm_list)?
+;
+
+actual_instance_parameter:
+ NAME
+;
+
+actual_message_parameters:
+ 'msg' actual_message_list
+;
+
+actual_message_list:
+ NAME (',' actual_message_list)?
+;
+
+actual_timer_parameters:
+ 'timer' actual_timer_list
+;
+
+actual_timer_list:
+ NAME (',' actual_timer_list)?
+;
+
+parent:
+ '#'
+;
+
+reference_gate_interface:
+ (end 'gate' ref_gate)*
+;
+
+ref_gate:
+ actual_out_gate | actual_in_gate |
+ actual_order_out_gate | actual_order_in_gate |
+ actual_create_out_gate | actual_create_in_gate |
+ actual_out_call_gate | actual_in_call_gate |
+ actual_out_reply_gate | actual_in_reply_gate
+;
+
+
+// ----- Instance decomposition
+
+decomposition:
+ 'decomposed' (substructure_reference)?
+;
+
+substructure_reference:
+ 'as' NAME
+;
+
+
+// ----- High-level MSC (HMSC)
+
+hmsc:
+ hmsc_body
+;
+
+hmsc_body:
+ (hmsc_statement)*
+;
+
+hmsc_statement:
+ text_definition | node_definition
+;
+
+node_definition:
+ initial_node | final_node | intermediate_node
+;
+
+initial_node:
+ 'initial' connection_list end
+;
+
+final_node:
+ NAME ':' 'final' end
+;
+
+connection_list:
+ 'connect' label_list
+;
+
+label_list:
+ NAME ',' label_list
+;
+
+intermediate_node:
+ NAME ':' intermediate_node_type connection_list end
+;
+
+intermediate_node_type:
+ timeable_node | untimeable_node
+;
+
+untimeable_node:
+ hmsc_connection_node | hmsc_condition_node
+;
+
+hmsc_connection_node:
+ /* empty */
+;
+
+hmsc_condition_node:
+ condition_identification (shared)?
+;
+
+timeable_node:
+ (hmsc_ref_expr_node | hmsc_expression)?
+ ('time' time_interval end)?
+ ('top' time_dest_list end)?
+ ('bottom' time_dest_list end)?
+;
+
+hmsc_ref_expr_node:
+ 'reference' (msc_reference_identification ':')? msc_ref_expr
+;
+
+hmsc_expression:
+ (hmsc_loop_expr | hmsc_opt_expr | hmsc_alt_expr |
+ hmsc_seq_expr | hmsc_par_expr | hmsc_exc_expr)
+;
+
+hmsc_loop_expr:
+ 'loop' (loop_boundary)? 'begin' (inline_expr_identification)? end
+ hmsc_body
+ 'loop' 'end'
+;
+
+hmsc_opt_expr:
+ 'opt' 'begin' (inline_expr_identification)? end
+ hmsc_body
+ 'opt' 'end'
+;
+
+hmsc_alt_expr:
+ 'alt' 'begin' (inline_expr_identification)? end
+ hmsc_body
+ ('alt' end hmsc_body)*
+ 'alt' 'end'
+;
+
+hmsc_seq_expr:
+ 'seq' 'begin' (inline_expr_identification)? end
+ hmsc_body
+ ('seq' end hmsc_body)*
+ 'seq' 'end'
+;
+
+hmsc_par_expr:
+ 'par' 'begin' (inline_expr_identification)? end
+ hmsc_body
+ ('par' end hmsc_body)*
+ 'par' 'end'
+;
+
+hmsc_exc_expr:
+ 'exc' 'begin' (inline_expr_identification)? end
+ hmsc_body
+ 'exc' 'end'
+;
+
+// end of file
Added: trunk/src/data/Z120/Z120.h
===================================================================
--- trunk/src/data/Z120/Z120.h (rev 0)
+++ trunk/src/data/Z120/Z120.h 2008-05-10 21:53:44 UTC (rev 68)
@@ -0,0 +1,28 @@
+/*
+ * 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.
+...
[truncated message content] |
|
From: <ba...@us...> - 2008-07-16 07:16:39
|
Revision: 102
http://scstudio.svn.sourceforge.net/scstudio/?rev=102&view=rev
Author: babicaj
Date: 2008-07-16 00:16:36 -0700 (Wed, 16 Jul 2008)
Log Message:
-----------
StartNode can now reference EndNode
Modified Paths:
--------------
trunk/src/data/msc.cpp
trunk/src/data/msc.h
Modified: trunk/src/data/msc.cpp
===================================================================
--- trunk/src/data/msc.cpp 2008-06-18 08:13:32 UTC (rev 101)
+++ trunk/src/data/msc.cpp 2008-07-16 07:16:36 UTC (rev 102)
@@ -26,6 +26,12 @@
}
+void StartNode::add_successor(ReferenceNode* n)
+{
+ m_successors.insert(n);
+ n->set_owner(m_owner);
+}
+
inline Instance* Event::get_instance()
{
return m_area->get_instance();
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2008-06-18 08:13:32 UTC (rev 101)
+++ trunk/src/data/msc.h 2008-07-16 07:16:36 UTC (rev 102)
@@ -348,9 +348,13 @@
* Base abstract class for node of HMsc
*/
class HMscNode:public MscElement{
+
std::string m_label;
protected:
+
+ HMsc* m_owner;
+
/**
* This is an abstract class
*/
@@ -381,6 +385,16 @@
{
return m_label;
}
+
+ HMsc* get_owner()
+ {
+ return m_owner;
+ }
+
+ void set_owner(HMsc* owner)
+ {
+ m_owner = owner;
+ }
};
@@ -414,7 +428,13 @@
* Succesors of StartNode.
*/
ReferenceNodePSet m_successors;
-
+
+ /**
+ * EndNode which this StartNode is connected to,
+ * undefined if there isn't any such connection.
+ */
+ EndNodePtr m_end;
+
public:
StartNode()
@@ -437,10 +457,7 @@
/**
* Adds successor.
*/
- void add_successor(ReferenceNode* n)
- {
- m_successors.insert(n);
- }
+ void add_successor(ReferenceNode* n);
/**
* Removes successor.
@@ -449,6 +466,16 @@
{
m_successors.erase(n);
}
+
+ EndNodePtr get_end()
+ {
+ return m_end;
+ }
+
+ void set_end(EndNodePtr end)
+ {
+ m_end = end;
+ }
};
/**
@@ -472,9 +499,15 @@
HMsc()
{
StartNodePtr start(new StartNode);
+ start->set_owner(this);
m_start = start;
}
+ HMsc(HMsc* original)
+ {
+ m_original = original;
+ }
+
/**
* Initializes m_label
*/
@@ -505,6 +538,8 @@
class ReferenceNode:public HMscNode
{
private:
+
+
/**
* Succesors of ReferenceNode.
@@ -565,6 +600,7 @@
{
m_successors.insert(n);
n->m_predecessors.insert(this);
+ n->set_owner(m_owner);
}
/**
@@ -598,6 +634,7 @@
EndNodePtr set_end()
{
EndNodePtr end(new EndNode);
+ end->set_owner(m_owner);
return m_end = end;
}
@@ -644,6 +681,23 @@
}
/**
+ * Tries to overcast m_msc into BMscPtr.
+ *
+ * If not successfull undefined BMscPtr is returned.
+ */
+ BMscPtr get_bmsc()
+ {
+ BMscPtr p;
+ try
+ {
+ p = m_msc;
+ return p;
+ }
+ catch(std::bad_cast& c){}
+ return p;
+ }
+
+ /**
* Returns true iff m_end is defined.
*/
bool is_end_node()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-03-13 21:58:37
|
Revision: 9
http://scstudio.svn.sourceforge.net/scstudio/?rev=9&view=rev
Author: babicaj
Date: 2008-03-13 13:56:06 -0700 (Thu, 13 Mar 2008)
Log Message:
-----------
To be more conform to ITU-T specification there were suggested new types of nodes in HMsc: StartNode, EndNode and ReferenceNode. These types have common parent HMscNode. New attributes were added to HMscModification to be more capable to recognize new and removed ReferenceNodes.
Modified Paths:
--------------
trunk/src/data/msc.h
trunk/src/data/msc_modifications.h
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2008-03-12 20:49:11 UTC (rev 8)
+++ trunk/src/data/msc.h 2008-03-13 20:56:06 UTC (rev 9)
@@ -23,11 +23,13 @@
#include <string>
#include "counted_ptr.h"
-class HmscNode;
+class HMscNode;
+class ReferenceNode;
+class EndNode;
+class StartNode;
class Instance;
class Event;
class Msc;
-class HmscNode;
class BMsc;
class MscMessage;
class EventArea;
@@ -38,9 +40,13 @@
typedef counted_ptr<BMsc> BMscPtr;
-typedef counter_ptr<HmscNode> HmscNodePtr;
-typedef std::list<HmscNodePtr> HmscNodePtrList;
+typedef counter_ptr<ReferenceNode> ReferenceNodePtr;
+typedef std::list<ReferenceNodePtr> ReferenceNodePtrList;
+typedef counter_ptr<StartNode> StartNodePtr;
+
+typedef counter_ptr<EndNode> EndNodePtr;
+
typedef counted_ptr<Instance> InstancePtr;
typedef std::list<InstancePtr> InstancePtrList;
@@ -90,23 +96,71 @@
{
/**
- * Start nodes of HMsc.
+ * Start node of HMsc.
+ *
+ * Mandatory element in HMsc, should be initialized in constructor.
*/
- HmscNodePtrList m_start_nodes;
+ StartNodePtr m_start;
+
+ /**
+ * All ReferenceNodes of HMsc.
+ */
+ ReferenceNodePtrList m_nodes;
};
-class HmscNode
+/**
+ * Base abstract class for node of HMsc
+ */
+class HMscNode{
+
+};
+
+/**
+ * Start node of HMsc.
+ *
+ * According to ITU-T standard, each HMsc has got exactly
+ * one start node.
+ */
+class StartNode:public HMscNode
{
+
+ /**
+ * Succesors of StartNode.
+ */
+ ReferenceNodePtrList m_successors;
+};
+
+/**
+ * End node of HMsc.
+ */
+class EndNode:public HMscNode
+{
+
+
+};
+
+/**
+ * HMscNode which references either BMsc or HMsc.
+ */
+class ReferenceNode:public HMscNode
+{
+
/**
- * Succesors of HmscNode
+ * Succesors of ReferenceNode.
*/
- HmscNodePtrList m_successors;
+ ReferenceNodePtrList m_successors;
/**
- * MSC which is contained in this node
+ * MSC which is contained in this node.
*/
MscPtr m_msc;
+
+ /**
+ * EndNode which this ReferenceNode is connected to,
+ * NULL if there isn't any such connection.
+ */
+ EndNodePtr m_end;
};
/**
Modified: trunk/src/data/msc_modifications.h
===================================================================
--- trunk/src/data/msc_modifications.h 2008-03-12 20:49:11 UTC (rev 8)
+++ trunk/src/data/msc_modifications.h 2008-03-13 20:56:06 UTC (rev 9)
@@ -137,7 +137,7 @@
/**
* Modified InstanceArea.
*/
- InstanceAreaPtrList m_modified_instance_area;
+ InstanceAreaPtr m_modified_area;
};
@@ -165,28 +165,28 @@
};
/**
- * Modification of HMscNode.
+ * Modification of ReferenceNode.
*/
-class HMscNodeModification: public MscModification
+class ReferenceNodeModification: public MscModification
{
/**
- * Previous version of HMscNode.
+ * Previous version of ReferenceNode.
*/
- HMscNodePtr m_previous;
+ ReferenceNodePtr m_previous;
/**
* Removed successors.
*/
- std::set<HMscNodePtr> m_removed_successors;
+ std::set<ReferenceNodePtr> m_removed_successors;
/**
* New successors.
*/
- std::set<HMscNodePtr> m_new_successors;
+ std::set<ReferenceNodePtr> m_new_successors;
/**
- * Changed Msc of the HMscNode.
+ * Changed Msc of the ReferenceNode.
*
* If NULL then Msc points to the same one (doesn't care if it was
* internally modified).
@@ -205,15 +205,25 @@
HMscPtr m_previous;
/**
- * Removed start nodes.
+ * Removed successors of StartNode.
*/
- std::set<HMscNodePtr> m_removed_start_nodes;
+ std::set<ReferenceNodePtr> m_removed_beginners;
/**
- * New start nodes.
+ * New successors of StartNode.
*/
- std::set<HMscNodePtr> m_new_start_nodes;
+ std::set<ReferenceNodePtr> m_new_beginners;
+ /**
+ * Removed nodes.
+ */
+ std::set<ReferenceNodePtr> m_removed_nodes;
+
+ /**
+ * New nodes.
+ */
+ std::set<ReferenceNodePtr> m_new_nodes;
+
}
#endif /* _MSC_MODIFICATIONS_H */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-04-08 19:34:59
|
Revision: 17
http://scstudio.svn.sourceforge.net/scstudio/?rev=17&view=rev
Author: babicaj
Date: 2008-04-08 12:34:50 -0700 (Tue, 08 Apr 2008)
Log Message:
-----------
Previous version of structure supported traversing events only at same instance - there wasn't any information in Event.m_matching_event how to recognize successors of the matching events. Current version should support traversing events across instances and doesn't lose any information from previous version.
Modified Paths:
--------------
trunk/src/data/counted_ptr.h
trunk/src/data/msc.h
trunk/src/data/msc_modifications.h
Modified: trunk/src/data/counted_ptr.h
===================================================================
--- trunk/src/data/counted_ptr.h 2008-04-08 11:29:14 UTC (rev 16)
+++ trunk/src/data/counted_ptr.h 2008-04-08 19:34:50 UTC (rev 17)
@@ -39,6 +39,9 @@
class counted_ptr
{
public:
+
+ void doNothing();
+
counted_ptr()
{
m_pointer = NULL;
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2008-04-08 11:29:14 UTC (rev 16)
+++ trunk/src/data/msc.h 2008-04-08 19:34:50 UTC (rev 17)
@@ -31,6 +31,8 @@
class StartNode;
class Instance;
class Event;
+class StrictEvent;
+class GeneralEvent;
class Msc;
class BMsc;
class HMsc;
@@ -39,8 +41,6 @@
class StrictOrderArea;
class GeneralOrderArea;
class InstanceArea;
-template <class T> class Dag;
-template <class T> class DagNode;
typedef counted_ptr<Msc> MscPtr;
@@ -61,6 +61,12 @@
typedef counted_ptr<Event> EventPtr;
typedef std::list<EventPtr> EventPtrList;
+typedef counted_ptr<StrictEvent> StrictEventPtr;
+typedef std::list<StrictEventPtr> StrictEventPtrList;
+
+typedef counted_ptr<GeneralEvent> GeneralEventPtr;
+typedef std::list<GeneralEventPtr> GeneralEventPtrList;
+
typedef counted_ptr<MscMessage> MscMessagePtr;
typedef counted_ptr<EventArea> EventAreaPtr;
@@ -72,55 +78,7 @@
typedef counted_ptr<GeneralOrderArea> GeneralOrderAreaPtr;
-
/**
- * Node of directed acyclic graph.
- */
-template <class T>
-class DagNode{
-
- /**
- * Object which is contained in this DagNode.
- */
- T m_content;
-
- /**
- * Successors of this node.
- */
- std::list<T> m_successors;
-};
-
-/**
- * Directed acyclic graph.
- */
-template <class T>
-class Dag
-{
-public:
- /**
- * Pointered alternative to DagNode.
- */
- typedef counted_ptr<DagNode<T> > DagNodePtr;
-
- /**
- * List of pointered DagNodes.
- */
- typedef std::list<DagNodePtr> DagNodePtrList;
-
- /**
- * Set of pointered DagNodes.
- */
- typedef std::set<DagNodePtr> DagNodePtrSet;
-
-private:
- /**
- * Events which aren't successors of any other events.
- */
- DagNodePtrList m_minimal_events;
-
-};
-
-/**
* Represents virtual base class for BMsc and HMsc.
*/
class Msc
@@ -256,7 +214,7 @@
/**
* List of Events which occure in this area.
*/
- EventPtrList m_events;
+ StrictEventPtr m_first;
};
/**
@@ -266,9 +224,9 @@
{
/**
- * Directed acyclic graph representing events' ordering.
+ * Events which aren't successors of any other events.
*/
- Dag<EventPtr> m_events;
+ GeneralEventPtrList m_minimal_events;
};
/**
@@ -312,7 +270,7 @@
};
/**
- * Event which occures at process.
+ * Event which occures in EventArea.
*/
class Event
{
@@ -333,5 +291,27 @@
EventPtr m_matching_event;
};
+/**
+ * Event occuring in StrictOrderArea
+ */
+class StrictEvent: public Event
+{
+ /**
+ * Successor of this event
+ */
+ StrictEventPtr m_successor;
+};
+
+/**
+ * Event occuring in GeneralOrderArea
+ */
+class GeneralEvent: public Event
+{
+ /**
+ * Successors of this event
+ */
+ GeneralEventPtrList m_successors;
+};
+
#endif /* _MSC_H */
Modified: trunk/src/data/msc_modifications.h
===================================================================
--- trunk/src/data/msc_modifications.h 2008-04-08 11:29:14 UTC (rev 16)
+++ trunk/src/data/msc_modifications.h 2008-04-08 19:34:50 UTC (rev 17)
@@ -32,6 +32,12 @@
typedef counted_ptr<MscModification> MscModificationPtr;
typedef std::set<MscModificationPtr> MscModificationPtrSet;
+typedef counted_ptr<GeneralEvent> GeneralEventPtr;
+typedef std::set<GeneralEventPtr> GeneralEventPtrSet;
+
+typedef counted_ptr<StrictEvent> StrictEventPtr;
+typedef std::set<StrictEventPtr> StrictEventPtrSet;
+
/**
* Container of modifications.
*
@@ -86,9 +92,14 @@
StrictOrderAreaPtr m_previous;
/**
- * New order of events.
+ * Events with modified successor.
*/
- EventPtrList m_events;
+ StrictEventPtrSet m_modified_events;
+
+ /**
+ * New first event.
+ */
+ StrictEventPtr m_first;
};
@@ -105,12 +116,12 @@
/**
* Events which are newly minimimal in modified version.
*/
- Dag<Event>::DagNodePtrSet m_minimal_events;
+ GeneralEventPtrSet m_minimal_events;
/**
* Events with modified successors.
*/
- Dag<Event>::DagNodePtrSet m_modified_events;
+ GeneralEventPtrSet m_modified_events;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-04-10 15:08:28
|
Revision: 23
http://scstudio.svn.sourceforge.net/scstudio/?rev=23&view=rev
Author: babicaj
Date: 2008-04-10 08:07:30 -0700 (Thu, 10 Apr 2008)
Log Message:
-----------
In spite of first attempt to allow traversing events across instances this wasn't still able. List of EventAreas in InstanceArea replaced by first item of this list and pointers to following EventArea added to EventArea. Pointer to parent EventArea was appended to Event.
Modified Paths:
--------------
trunk/src/data/msc.h
trunk/src/data/msc_modifications.h
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2008-04-10 14:38:17 UTC (rev 22)
+++ trunk/src/data/msc.h 2008-04-10 15:07:30 UTC (rev 23)
@@ -213,6 +213,10 @@
class EventArea
{
+ /**
+ * Following EventArea in InstanceArea.
+ */
+ EventAreaPtr m_next;
};
/**
@@ -246,9 +250,9 @@
{
/**
- * EventAreas which occure at instance.
+ * EventAreas which occure at instance as first one.
*/
- EventAreaPtrList m_areas;
+ EventAreaPtr m_first;
};
@@ -300,6 +304,11 @@
* found message.
*/
EventPtr m_matching_event;
+
+ /**
+ * EventArea which this Event occures in.
+ */
+ EventArea* m_area;
};
/**
Modified: trunk/src/data/msc_modifications.h
===================================================================
--- trunk/src/data/msc_modifications.h 2008-04-10 14:38:17 UTC (rev 22)
+++ trunk/src/data/msc_modifications.h 2008-04-10 15:07:30 UTC (rev 23)
@@ -146,9 +146,9 @@
std::set<EventAreaPtr> m_new_areas;
/**
- * Modified InstanceArea.
+ * Modified first area, undefined if no change.
*/
- InstanceAreaPtr m_modified_area;
+ EventAreaPtr m_first_area;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-05-15 14:05:35
|
Revision: 78
http://scstudio.svn.sourceforge.net/scstudio/?rev=78&view=rev
Author: babicaj
Date: 2008-05-15 07:04:20 -0700 (Thu, 15 May 2008)
Log Message:
-----------
Bug fixed: HMsc::~HMsc() destructor - ReferenceNode* memory release corrected
Modified Paths:
--------------
trunk/src/data/msc.cpp
trunk/src/data/msc.h
Modified: trunk/src/data/msc.cpp
===================================================================
--- trunk/src/data/msc.cpp 2008-05-15 00:47:26 UTC (rev 77)
+++ trunk/src/data/msc.cpp 2008-05-15 14:04:20 UTC (rev 78)
@@ -16,8 +16,16 @@
* $Id$
*/
+#include <stack>
+
+
#include "data/msc.h"
+Msc::~Msc()
+{
+
+}
+
inline Instance* Event::get_instance()
{
return m_area->get_instance();
@@ -90,22 +98,28 @@
HMsc::~HMsc()
{
- ReferenceNodePSet::iterator n;
+ ReferenceNodePSet::const_iterator n;
+ ReferenceNodePStack to_delete;
for(n=m_start->get_successors().begin();n!=m_start->get_successors().end();n++)
{
- delete_reference_node(*n);
+ to_delete.push(*n);
}
-}
-
-void HMsc::delete_reference_node(ReferenceNode* node)
-{
- if(node->has_successors())
+ while(!to_delete.empty())
{
- ReferenceNodePSet::iterator n;
- for(n=node->m_predecessors.begin();n!=node->m_predecessors.end();n++)
- (*n)->m_successors.erase(node);
- for(n=node->m_successors.begin();n!=node->m_successors.end();n++)
- delete_reference_node(*n);
+ ReferenceNode* node = to_delete.top();
+ to_delete.pop();
+ ReferenceNodePSet::iterator i;
+ for(i=node->m_predecessors.begin();i!=node->m_predecessors.end();i++)
+ {
+ (*i)->m_successors.erase(node);
+
+ }
+ ReferenceNodePSet::iterator m;
+ for(m=node->m_successors.begin();m!=node->m_successors.end();m++)
+ {
+ (*m)->m_predecessors.erase(node);
+ to_delete.push(*m);
+ }
+ delete node;
}
- delete node;
}
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2008-05-15 00:47:26 UTC (rev 77)
+++ trunk/src/data/msc.h 2008-05-15 14:04:20 UTC (rev 78)
@@ -24,6 +24,7 @@
#include <set>
#include <map>
#include <typeinfo>
+#include <stack>
#include "data/counted_ptr.h"
@@ -55,6 +56,7 @@
typedef counted_ptr<ReferenceNode> ReferenceNodePtr;
typedef std::list<ReferenceNodePtr> ReferenceNodePtrList;
typedef std::set<ReferenceNode*> ReferenceNodePSet;
+typedef std::stack<ReferenceNode*> ReferenceNodePStack;
typedef counted_ptr<StartNode> StartNodePtr;
@@ -238,9 +240,7 @@
/**
* Virtual destructor.
*/
- virtual ~Msc()
- {
- }
+ virtual ~Msc();
void set_label(const std::string label) { m_label = label; }
@@ -266,6 +266,11 @@
}
+ virtual ~BMsc()
+ {
+
+ }
+
/**
*Adds instance.
*/
@@ -294,6 +299,12 @@
* This is an abstract class
*/
HMscNode(){}
+
+ virtual ~HMscNode()
+ {
+
+ }
+
public:
void set_label(const std::string label) { m_label = label; }
@@ -307,6 +318,12 @@
class EndNode:public HMscNode
{
+public:
+
+ virtual ~EndNode()
+ {
+
+ }
};
@@ -329,7 +346,12 @@
StartNode()
{
}
+
+ virtual ~StartNode()
+ {
+ }
+
/**
* Getter for m_successors.
*/
@@ -367,11 +389,6 @@
* Mandatory element in HMsc, should be initialized in constructor.
*/
StartNodePtr m_start;
-
- /**
- * Deletes ReferenceNode's pointer and its successors
- */
- void delete_reference_node(ReferenceNode* node);
public:
@@ -384,7 +401,7 @@
/**
* Removes all nodes inside
*/
- ~HMsc();
+ virtual ~HMsc();
/**
* Getter for m_start.
@@ -429,6 +446,11 @@
EndNodePtr m_end;
public:
+
+ virtual ~ReferenceNode()
+ {
+
+ }
/**
* Getter for m_successors
@@ -565,6 +587,11 @@
{
}
+ virtual ~Instance()
+ {
+
+ }
+
/**
* Set the first EventArea
*/
@@ -624,7 +651,12 @@
Instance* m_receiver;
public:
+
+ virtual ~MscMessage()
+ {
+ }
+
/**
* Getter for m_sender.
*/
@@ -765,7 +797,12 @@
* Sets m_area to area
*/
StrictEvent(StrictOrderArea* area);
+
+ virtual ~StrictEvent()
+ {
+ }
+
/**
* Getter for m_successor.
*/
@@ -839,7 +876,7 @@
*/
CoregionEvent(CoregionArea* area);
- ~CoregionEvent();
+ virtual ~CoregionEvent();
/**
* Getter for m_successors
@@ -1010,6 +1047,11 @@
}
+ virtual ~StrictOrderArea()
+ {
+
+ }
+
/**
* Sets m_instance to instance
*/
@@ -1109,7 +1151,7 @@
/**
* Removes all referenced CoregionEvents
*/
- ~CoregionArea();
+ virtual ~CoregionArea();
/**
* Getter for m_minimal_events.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|