summaryrefslogtreecommitdiff
path: root/utils/Automaton.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/Automaton.h')
-rw-r--r--utils/Automaton.h132
1 files changed, 63 insertions, 69 deletions
diff --git a/utils/Automaton.h b/utils/Automaton.h
index a85d911..c865b76 100644
--- a/utils/Automaton.h
+++ b/utils/Automaton.h
@@ -12,8 +12,8 @@
* $CurLog$
*/
-#ifndef CcuAutomaton_H_
-#define CcuAutomaton_H_
+#ifndef IvlAutomaton_H_
+#define IvlAutomaton_H_
#include "cplus_bugs.h"
#include "List.h"
@@ -21,52 +21,50 @@
#include "String.h"
#include "bool.h"
-typedef void CcuToken;
-typedef void CcuKey;
-class CcuBaseState;
-class CcuBaseAutomaton;
+typedef void IvlToken;
+typedef void IvlKey;
+class IvlBaseState;
+class IvlBaseAutomaton;
-class CcuBaseLink {
+class IvlBaseLink {
protected:
- CcuBaseState* To;
+ IvlBaseState* To;
public:
- CcuBaseLink (CcuBaseState*);
-virtual ~CcuBaseLink ();
-virtual void Fire (CcuBaseState*, CcuBaseState*, CcuToken*) = 0;
-inline CcuBaseState* GetDestination () const { return To;}
+ IvlBaseLink (IvlBaseState*);
+virtual ~IvlBaseLink ();
+virtual void Fire (IvlBaseState*, IvlBaseState*, IvlToken*) = 0;
+inline IvlBaseState* GetDestination () const { return To;}
};
-class CcuBaseState {
+class IvlBaseState {
protected:
- CcuString Name;
- CcuHashTableOf <CcuBaseLink> Links;
- CcuBaseAutomaton* TheAutomaton;
+ IvlString Name;
+ IvlHashTableOf <IvlBaseLink> Links;
+ IvlBaseAutomaton* TheAutomaton;
virtual void In () = 0;
virtual void Out () = 0;
public:
- CcuBaseState (const char*, CcuBaseAutomaton&);
-virtual ~CcuBaseState ();
- void Add (CcuBaseLink*);
- void CreateLink (CcuBaseState*, CcuKey*);
- void RemoveLink (CcuBaseLink*);
- CcuBaseState* Next (CcuToken*, bool = false);
+ IvlBaseState (const char*, IvlBaseAutomaton&);
+virtual ~IvlBaseState ();
+ void Add (IvlBaseLink*);
+ void CreateLink (IvlBaseState*, IvlKey*);
+ void RemoveLink (IvlBaseLink*);
+ IvlBaseState* Next (IvlToken*, bool = false);
};
-
#if 0
-typedef unsigned int (*HASH_F) (const CcuKey*, int);
-typedef int (*HCMP_F) (const CcuKey*, const CcuKey*);
-typedef CcuKey* (*HCP_F) (const CcuKey*);
-typedef void (*HDEL_F) (const CcuKey*);
+typedef unsigned int (*HASH_F) (const IvlKey*, int);
+typedef int (*HCMP_F) (const IvlKey*, const IvlKey*);
+typedef IvlKey* (*HCP_F) (const IvlKey*);
+typedef void (*HDEL_F) (const IvlKey*);
#endif
-typedef CcuKey* (*AKEY_F) (CcuToken*);
-
+typedef IvlKey* (*AKEY_F) (IvlToken*);
-class CcuBaseAutomaton {
-friend class CcuBaseState;
-friend class CcuAutomIter;
+class IvlBaseAutomaton {
+friend class IvlBaseState;
+friend class IvlAutomIter;
protected:
int Size;
HASH_F Hash;
@@ -74,64 +72,60 @@ protected:
HDEL_F Delete;
HCMP_F Compare;
AKEY_F GetKey;
- CcuBaseState* Initial;
- CcuListOf <CcuBaseState> AllStates;
+ IvlBaseState* Initial;
+ IvlListOf <IvlBaseState> AllStates;
public:
- CcuBaseAutomaton (AKEY_F = 0, HASH_F = 0, HCP_F = 0, HDEL_F = 0, HCMP_F = 0, int sz = 4);
- ~CcuBaseAutomaton ();
-inline CcuBaseState* GetInitial () { return Initial; }
-inline void SetInitial (CcuBaseState* s) { Initial = s; }
- CcuBaseState* CreateState (const char* = 0);
+ IvlBaseAutomaton (AKEY_F = 0, HASH_F = 0, HCP_F = 0, HDEL_F = 0, HCMP_F = 0, int sz = 4);
+ ~IvlBaseAutomaton ();
+inline IvlBaseState* GetInitial () { return Initial; }
+inline void SetInitial (IvlBaseState* s) { Initial = s; }
+ IvlBaseState* CreateState (const char* = 0);
};
+class IvlState;
+typedef void (IvlLinkFun) (IvlState*, IvlState*, IvlToken*);
-class CcuState;
-typedef void (CcuLinkFun) (CcuState*, CcuState*, CcuToken*);
-
-class CcuLink : public CcuBaseLink {
+class IvlLink : public IvlBaseLink {
protected:
- CcuLinkFun* Fun;
+ IvlLinkFun* Fun;
public:
- CcuLink (CcuState*, CcuLinkFun*);
- ~CcuLink ();
- void Fire (CcuBaseState*, CcuBaseState*, CcuToken*);
+ IvlLink (IvlState*, IvlLinkFun*);
+ ~IvlLink ();
+ void Fire (IvlBaseState*, IvlBaseState*, IvlToken*);
};
-typedef void (CcuStateFun) (CcuState*);
-class CcuAutomaton;
+typedef void (IvlStateFun) (IvlState*);
+class IvlAutomaton;
-class CcuState : public CcuBaseState {
+class IvlState : public IvlBaseState {
protected:
- CcuStateFun* InFun;
- CcuStateFun* OutFun;
+ IvlStateFun* InFun;
+ IvlStateFun* OutFun;
void In ();
void Out ();
public:
- CcuState (const char*, CcuAutomaton&, CcuStateFun* = 0, CcuStateFun* = 0);
- ~CcuState ();
- void CreateLink (CcuState*, CcuKey*, CcuLinkFun);
+ IvlState (const char*, IvlAutomaton&, IvlStateFun* = 0, IvlStateFun* = 0);
+ ~IvlState ();
+ void CreateLink (IvlState*, IvlKey*, IvlLinkFun);
};
-
-class CcuAutomaton : public CcuBaseAutomaton {
+class IvlAutomaton : public IvlBaseAutomaton {
public:
-inline CcuAutomaton () : CcuBaseAutomaton () {}
-inline ~CcuAutomaton () {}
- CcuState* CreateState (const char* = 0, CcuStateFun = 0, CcuStateFun = 0);
+inline IvlAutomaton () : IvlBaseAutomaton () {}
+inline ~IvlAutomaton () {}
+ IvlState* CreateState (const char* = 0, IvlStateFun = 0, IvlStateFun = 0);
};
-class CcuAutomIter {
+class IvlAutomIter {
protected:
- CcuBaseAutomaton* TheAutomaton;
- CcuBaseState* CurState;
+ IvlBaseAutomaton* TheAutomaton;
+ IvlBaseState* CurState;
public:
- CcuAutomIter (CcuBaseAutomaton&);
- ~CcuAutomIter ();
- bool Step (CcuToken*);
+ IvlAutomIter (IvlBaseAutomaton&);
+ ~IvlAutomIter ();
+ bool Step (IvlToken*);
};
-
-
-#endif /* CcuAutomaton_H_ */
+#endif /* IvlAutomaton_H_ */