From 325530e630c68c7c10a2f4339f5b43434fcd0329 Mon Sep 17 00:00:00 2001 From: sc Date: Tue, 28 Nov 2000 14:19:35 +0000 Subject: Incorporation into IvyLeague Ccu -> Ivl ccu -> ivl Smart pointers disappear (too dangerous) Imakefile disappears (Makefile now) An empty cplus_bugs.h has been created locally --- utils/Automaton.cc | 85 +++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 43 deletions(-) (limited to 'utils/Automaton.cc') 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 l = Links; + IvlHashIterOf l = Links; while (++l) delete *l; } #if 0 void -CcuBaseState :: CreateLink (CcuBaseState* to, CcuKey* k) +IvlBaseState :: CreateLink (IvlBaseState* to, IvlKey* k) { - CcuHashCellOf * c = Links.Add (k); - c->SetInfo (new CcuBaseLink (to)); + IvlHashCellOf * 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 * c = Links.Add (key); + IvlHashCellOf * 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 * c = Links.Get (k); + IvlKey* k = TheAutomaton->GetKey ? (TheAutomaton->GetKey) (tk) : tk; + IvlHashCellOf * 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 s = AllStates; + IvlListIterOf 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 * c = Links.Add (k); - c->SetInfo (new CcuLink (to, fn)); + IvlHashCellOf * 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; -- cgit v1.1