[Avida-SVN] r2491 - development/source/script
brysonda at myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Sun Mar 23 11:25:19 PDT 2008
Author: brysonda
Date: 2008-03-23 14:25:19 -0400 (Sun, 23 Mar 2008)
New Revision: 2491
Modified:
development/source/script/cDirectInterpretASTVisitor.cc
Log:
AS:
Correct matrix row assignments.
Modified: development/source/script/cDirectInterpretASTVisitor.cc
===================================================================
--- development/source/script/cDirectInterpretASTVisitor.cc 2008-03-23 17:49:07 UTC (rev 2490)
+++ development/source/script/cDirectInterpretASTVisitor.cc 2008-03-23 18:25:19 UTC (rev 2491)
@@ -2177,14 +2177,10 @@
if (idxi < 0 || idxi >= m_var.as_matrix->GetNumRows()) return false;
- if (m_var.as_matrix->GetNumCols() > 1) {
- if (val.type.type != TYPE(ARRAY)) return false;
- m_var.as_matrix->Set(idxi, val.value.as_array);
- } else if (m_var.as_matrix->GetNumCols() == 0) {
- m_var.as_matrix->GetRow(idxi)->Set(0, val);
- } else {
- return false;
- }
+ if (m_var.as_matrix->GetNumCols() == 0) return false;
+ if (val.type.type != TYPE(ARRAY)) return false;
+ if (val.value.as_array->GetSize() != m_var.as_matrix->GetNumCols()) return false;
+ m_var.as_matrix->Set(idxi, val.value.as_array);
return true;
}
@@ -2316,14 +2312,10 @@
}
if (idxi < 0 || idxi >= mat->GetNumRows()) return false;
- if (mat->GetNumCols() > 1) {
- if (val.type.type != TYPE(ARRAY)) return false;
- mat->Set(idxi, val.value.as_array);
- } else if (mat->GetNumCols() == 0) {
- mat->GetRow(idxi)->Set(0, val);
- } else {
- return false;
- }
+ if (mat->GetNumCols() == 0) return false;
+ if (val.type.type != TYPE(ARRAY)) return false;
+ if (val.value.as_array->GetSize() != mat->GetNumCols()) return false;
+ mat->Set(idxi, val.value.as_array);
}
return true;
More information about the Avida-cvs
mailing list