From 5683517dff57e3f68ca29d9f27a54bdb8c5792e6 Mon Sep 17 00:00:00 2001 From: Paul Bignier Date: Thu, 11 Jun 2015 08:55:55 +0200 Subject: [PATCH] Xcos MVC: allow column vectors for all properties * 'thick', 'ct', 'state', 'dstate', 'nzcross', 'nmode' and 'context' only allowed row vectors. Allow column vectors for backward compatibility. They are always stored and returned as row vectors anyway! Change-Id: Ibcef4c2db4a05d14197214e97a6791744819ad1e --- .../scicos/src/cpp/view_scilab/LinkAdapter.cpp | 4 ++-- .../scicos/src/cpp/view_scilab/ModelAdapter.cpp | 12 ++++++++---- .../scicos/src/cpp/view_scilab/ParamsAdapter.cpp | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/scilab/modules/scicos/src/cpp/view_scilab/LinkAdapter.cpp b/scilab/modules/scicos/src/cpp/view_scilab/LinkAdapter.cpp index 31945e7..2f27e83 100644 --- a/scilab/modules/scicos/src/cpp/view_scilab/LinkAdapter.cpp +++ b/scilab/modules/scicos/src/cpp/view_scilab/LinkAdapter.cpp @@ -229,7 +229,7 @@ struct thick } types::Double* current = v->getAs(); - if (current->getRows() != 1 || current->getCols() != 2) + if (current->getSize() != 2) { return false; } @@ -273,7 +273,7 @@ struct ct } types::Double* current = v->getAs(); - if (current->getRows() != 1 || current->getCols() != 2) + if (current->getSize() != 2) { return false; } diff --git a/scilab/modules/scicos/src/cpp/view_scilab/ModelAdapter.cpp b/scilab/modules/scicos/src/cpp/view_scilab/ModelAdapter.cpp index 1c4123d..3d931e9 100644 --- a/scilab/modules/scicos/src/cpp/view_scilab/ModelAdapter.cpp +++ b/scilab/modules/scicos/src/cpp/view_scilab/ModelAdapter.cpp @@ -298,7 +298,8 @@ struct state } types::Double* current = v->getAs(); - if (current->getCols() != 0 && current->getCols() != 1) + // Only allow vectors and empty matrices + if (!current->isVector() && current->getSize() != 0) { return false; } @@ -356,7 +357,8 @@ struct dstate return false; } types::Double* current = v->getAs(); - if (current->getCols() != 0 && current->getCols() != 1) + // Only allow vectors and empty matrices + if (!current->isVector() && current->getSize() != 0) { return false; } @@ -920,7 +922,8 @@ struct nzcross } types::Double* current = v->getAs(); - if (current->getCols() != 0 && current->getCols() != 1) + // Only allow vectors and empty matrices + if (!current->isVector() && current->getSize() != 0) { return false; } @@ -971,7 +974,8 @@ struct nmode } types::Double* current = v->getAs(); - if (current->getCols() != 0 && current->getCols() != 1) + // Only allow vectors and empty matrices + if (!current->isVector() && current->getSize() != 0) { return false; } diff --git a/scilab/modules/scicos/src/cpp/view_scilab/ParamsAdapter.cpp b/scilab/modules/scicos/src/cpp/view_scilab/ParamsAdapter.cpp index 3f3f969..aaecf0c 100644 --- a/scilab/modules/scicos/src/cpp/view_scilab/ParamsAdapter.cpp +++ b/scilab/modules/scicos/src/cpp/view_scilab/ParamsAdapter.cpp @@ -237,7 +237,8 @@ struct context if (v->getType() == types::InternalType::ScilabString) { types::String* current = v->getAs(); - if (current->getCols() != 0 && current->getCols() != 1) + // Only allow vectors and empty matrices + if (!current->isVector() && current->getSize() != 0) { return false; } -- 1.7.9.5