[Avida-SVN] r1468 - in branches/uml/source: cpu main
hjg at myxo.css.msu.edu
hjg at myxo.css.msu.edu
Fri Apr 6 12:36:37 PDT 2007
Author: hjg
Date: 2007-04-06 15:36:37 -0400 (Fri, 06 Apr 2007)
New Revision: 1468
Modified:
branches/uml/source/cpu/cHardwareCPU.cc
branches/uml/source/cpu/cHardwareCPU.h
branches/uml/source/main/cOrganism.cc
branches/uml/source/main/cOrganism.h
Log:
New transition instruction that does not require an intermediate label.
Modified: branches/uml/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/uml/source/cpu/cHardwareCPU.cc 2007-04-06 15:39:56 UTC (rev 1467)
+++ branches/uml/source/cpu/cHardwareCPU.cc 2007-04-06 19:36:37 UTC (rev 1468)
@@ -362,6 +362,8 @@
"Add a transition label"),
cInstEntryCPU("addTrans", &cHardwareCPU::Inst_AddTransition, false,
"Add a transition"),
+ cInstEntryCPU("addTransT", &cHardwareCPU::Inst_AddTransitionTotal, false,
+ "Add a transition without adding a label."),
cInstEntryCPU("jump", &cHardwareCPU::Inst_JumpIndex, false,
"Jump to a position in the list"),
cInstEntryCPU("first", &cHardwareCPU::Inst_First, false,
@@ -3624,3 +3626,7 @@
return organism->addTransition();
}
+bool cHardwareCPU::Inst_AddTransitionTotal(cAvidaContext& ctx)
+{
+ return organism->addTransitionTotal();
+}
\ No newline at end of file
Modified: branches/uml/source/cpu/cHardwareCPU.h
===================================================================
--- branches/uml/source/cpu/cHardwareCPU.h 2007-04-06 15:39:56 UTC (rev 1467)
+++ branches/uml/source/cpu/cHardwareCPU.h 2007-04-06 19:36:37 UTC (rev 1468)
@@ -479,6 +479,7 @@
bool Inst_JumpDist(cAvidaContext& ctx);
bool Inst_AddTransitionLabel(cAvidaContext& ctx);
bool Inst_AddTransition(cAvidaContext& ctx);
+ bool Inst_AddTransitionTotal(cAvidaContext& ctx);
bool Inst_Last(cAvidaContext& ctx);
bool Inst_First(cAvidaContext& ctx);
Modified: branches/uml/source/main/cOrganism.cc
===================================================================
--- branches/uml/source/main/cOrganism.cc 2007-04-06 15:39:56 UTC (rev 1467)
+++ branches/uml/source/main/cOrganism.cc 2007-04-06 19:36:37 UTC (rev 1468)
@@ -791,6 +791,37 @@
}
+
+bool cOrganism::addTransitionTotal()
+{
+ if ((states.size() == 0)) {
+
+ return false;
+ }
+
+ transition t;
+ t.orig_state = getOrigState();
+ t.dest_state = getDestState();
+
+ transition_label tl;
+ tl.trigger = getTrigger();
+ tl.guard = getGuard();
+ tl.action = getAction();
+ t.trans = tl;
+
+
+ // no dupes
+ if (findTrans(t)) {
+ return false;
+ }
+
+ transitions.push_back(t);
+
+ return true;
+
+}
+
+
int cOrganism::numStates()
{
return states.size();
Modified: branches/uml/source/main/cOrganism.h
===================================================================
--- branches/uml/source/main/cOrganism.h 2007-04-06 15:39:56 UTC (rev 1467)
+++ branches/uml/source/main/cOrganism.h 2007-04-06 19:36:37 UTC (rev 1468)
@@ -285,6 +285,7 @@
bool addState();
bool addTransitionLabel();
bool addTransition();
+ bool addTransitionTotal();
More information about the Avida-cvs
mailing list