summaryrefslogtreecommitdiff
path: root/utils/Automaton.cc
diff options
context:
space:
mode:
Diffstat (limited to 'utils/Automaton.cc')
-rw-r--r--utils/Automaton.cc85
1 files changed, 42 insertions, 43 deletions
diff --git a/utils/Automaton.cc b/utils/Automaton.cc
index 9643bdb..930edc8 100644
--- a/utils/Automaton.cc
+++ b/utils/Automaton.cc
@@ -14,56 +14,56 @@
#include "Automaton.h"
-CcuBaseLink :: CcuBaseLink (CcuBaseState* s)
+IvlBaseLink :: IvlBaseLink (IvlBaseState* s)
: To (s)
{
}
-CcuBaseLink :: ~CcuBaseLink ()
+IvlBaseLink :: ~IvlBaseLink ()
{
}
-CcuBaseState :: CcuBaseState (const char* name, CcuBaseAutomaton& a)
+IvlBaseState :: IvlBaseState (const char* name, IvlBaseAutomaton& a)
: Name (name),
Links (a.Size, a.Hash, a.Copy, a.Delete, a.Compare),
TheAutomaton (&a)
{
}
-CcuBaseState :: ~CcuBaseState ()
+IvlBaseState :: ~IvlBaseState ()
{
- CcuHashIterOf <CcuBaseLink> l = Links;
+ IvlHashIterOf <IvlBaseLink> l = Links;
while (++l)
delete *l;
}
#if 0
void
-CcuBaseState :: CreateLink (CcuBaseState* to, CcuKey* k)
+IvlBaseState :: CreateLink (IvlBaseState* to, IvlKey* k)
{
- CcuHashCellOf <CcuBaseLink>* c = Links.Add (k);
- c->SetInfo (new CcuBaseLink (to));
+ IvlHashCellOf <IvlBaseLink>* c = Links.Add (k);
+ c->SetInfo (new IvlBaseLink (to));
}
#endif
#if 0
void
-CcuBaseState :: Add (CcuKey* key, CcuBaseLink* l)
+IvlBaseState :: Add (IvlKey* key, IvlBaseLink* l)
{
- CcuHashCellOf <CcuLink>* c = Links.Add (key);
+ IvlHashCellOf <IvlLink>* c = Links.Add (key);
c->SetInfo (l);
}
#endif
-CcuBaseState*
-CcuBaseState :: Next (CcuToken* tk, bool peek)
+IvlBaseState*
+IvlBaseState :: Next (IvlToken* tk, bool peek)
{
- CcuKey* k = TheAutomaton->GetKey ? (TheAutomaton->GetKey) (tk) : tk;
- CcuHashCellOf <CcuBaseLink>* c = Links.Get (k);
+ IvlKey* k = TheAutomaton->GetKey ? (TheAutomaton->GetKey) (tk) : tk;
+ IvlHashCellOf <IvlBaseLink>* c = Links.Get (k);
if (!c)
return 0;
- CcuBaseLink* l = c->GetInfo ();
- CcuBaseState* to = l->GetDestination ();
+ IvlBaseLink* l = c->GetInfo ();
+ IvlBaseState* to = l->GetDestination ();
if (!peek) {
Out ();
@@ -73,7 +73,7 @@ CcuBaseState :: Next (CcuToken* tk, bool peek)
return to;
}
-CcuBaseAutomaton :: CcuBaseAutomaton (AKEY_F gk, HASH_F hash, HCP_F cp, HDEL_F del, HCMP_F cmp, int sz)
+IvlBaseAutomaton :: IvlBaseAutomaton (AKEY_F gk, HASH_F hash, HCP_F cp, HDEL_F del, HCMP_F cmp, int sz)
: Size (sz),
Hash (hash),
Copy (cp),
@@ -85,95 +85,94 @@ CcuBaseAutomaton :: CcuBaseAutomaton (AKEY_F gk, HASH_F hash, HCP_F cp, HDEL_F d
{
}
-CcuBaseAutomaton :: ~CcuBaseAutomaton ()
+IvlBaseAutomaton :: ~IvlBaseAutomaton ()
{
- CcuListIterOf <CcuBaseState> s = AllStates;
+ IvlListIterOf <IvlBaseState> s = AllStates;
while (++s)
delete *s;
}
#if 0
-CcuBaseState*
-CcuBaseAutomaton :: CreateState (const char* n);
+IvlBaseState*
+IvlBaseAutomaton :: CreateState (const char* n);
{
- CcuBaseState* s = new CcuBaseState (n, *this);
+ IvlBaseState* s = new IvlBaseState (n, *this);
AllStates.Append (s);
return s;
}
#endif
-
-CcuLink :: CcuLink (CcuState* s, CcuLinkFun fn)
-: CcuBaseLink (s),
+IvlLink :: IvlLink (IvlState* s, IvlLinkFun fn)
+: IvlBaseLink (s),
Fun (fn)
{
}
-CcuLink :: ~CcuLink ()
+IvlLink :: ~IvlLink ()
{
}
void
-CcuLink :: Fire (CcuBaseState* from, CcuBaseState* to, CcuToken* data)
+IvlLink :: Fire (IvlBaseState* from, IvlBaseState* to, IvlToken* data)
{
if (Fun)
- (*Fun) ((CcuState*) from, (CcuState*) to, data);
+ (*Fun) ((IvlState*) from, (IvlState*) to, data);
}
-CcuState :: CcuState (const char* name, CcuAutomaton& a, CcuStateFun* in, CcuStateFun* out)
-: CcuBaseState (name, a),
+IvlState :: IvlState (const char* name, IvlAutomaton& a, IvlStateFun* in, IvlStateFun* out)
+: IvlBaseState (name, a),
InFun (in),
OutFun (out)
{
}
-CcuState :: ~CcuState ()
+IvlState :: ~IvlState ()
{
}
void
-CcuState :: In ()
+IvlState :: In ()
{
if (InFun) (*InFun) (this);
}
void
-CcuState :: Out ()
+IvlState :: Out ()
{
if (OutFun) (*OutFun) (this);
}
void
-CcuState :: CreateLink (CcuState* to, CcuKey* k, CcuLinkFun fn)
+IvlState :: CreateLink (IvlState* to, IvlKey* k, IvlLinkFun fn)
{
- CcuHashCellOf <CcuBaseLink>* c = Links.Add (k);
- c->SetInfo (new CcuLink (to, fn));
+ IvlHashCellOf <IvlBaseLink>* c = Links.Add (k);
+ c->SetInfo (new IvlLink (to, fn));
}
-CcuState*
-CcuAutomaton :: CreateState (const char* n, CcuStateFun in, CcuStateFun out)
+IvlState*
+IvlAutomaton :: CreateState (const char* n, IvlStateFun in, IvlStateFun out)
{
- CcuState* s = new CcuState (n, *this, in, out);
+ IvlState* s = new IvlState (n, *this, in, out);
AllStates.Append (s);
return s;
}
-CcuAutomIter :: CcuAutomIter (CcuBaseAutomaton& a)
+IvlAutomIter :: IvlAutomIter (IvlBaseAutomaton& a)
: TheAutomaton (&a),
CurState (a.GetInitial ())
{
}
-CcuAutomIter :: ~CcuAutomIter ()
+IvlAutomIter :: ~IvlAutomIter ()
{
}
bool
-CcuAutomIter :: Step (CcuToken* tk)
+IvlAutomIter :: Step (IvlToken* tk)
{
if (!CurState && !(CurState = TheAutomaton->GetInitial ()))
return false;
- CcuBaseState* n = CurState->Next (tk);
+ IvlBaseState* n = CurState->Next (tk);
if (!n)
return false;
CurState = n;