[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - 2 commits - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Thu Jun 20 09:59:03 PDT 2013
sc/inc/scmatrix.hxx | 6 ++++
sc/source/core/data/dociter.cxx | 4 +--
sc/source/core/tool/scmatrix.cxx | 52 +++++++++++++++++++++++++++++++++++++++
3 files changed, 60 insertions(+), 2 deletions(-)
New commits:
commit d7d96ec83f0ecb028e60de0cb18a877a37ddab0a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Jun 20 13:01:15 2013 -0400
Fix ScCellIterator, which also fixes matrix handling in the formula engine.
This one alone fixes 2 unit test failures.
Change-Id: I3392f4567888447d867ed29f7ecda2474fae1547
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 6ba2b7f..66b271b 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -28,7 +28,7 @@
#include <boost/intrusive_ptr.hpp>
-#define DEBUG_MATRIX 1
+#define DEBUG_MATRIX 0
class ScInterpreter;
class SvNumberFormatter;
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 207c305..e9053d3 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1049,7 +1049,7 @@ bool ScCellIterator::first()
bool ScCellIterator::next()
{
- maCurPos.IncRow();
+ incPos();
return getCurrent();
}
@@ -1839,7 +1839,7 @@ void ScHorizontalCellIterator::Advance()
return;
}
- if (nNextRow > MAXROW)
+ if (nNextRow > static_cast<size_t>(MAXROW))
{
// No more blocks to search.
bMore = false;
commit 0fa527827ac64274a4b18a48f454ddaba7c35cd1
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Jun 20 12:06:11 2013 -0400
Add Dump() method to ScMatrix, which is useful when debugging.
Change-Id: I45e6c28b58a03782814ef1089b49a52b873573a6
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index c91b0ca..6ba2b7f 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -28,6 +28,8 @@
#include <boost/intrusive_ptr.hpp>
+#define DEBUG_MATRIX 1
+
class ScInterpreter;
class SvNumberFormatter;
class ScMatrixImpl;
@@ -349,6 +351,10 @@ public:
// All other matrix functions MatMult, MInv, ... are in ScInterpreter
// to be numerically safe.
+
+#if DEBUG_MATRIX
+ void Dump() const;
+#endif
};
inline void intrusive_ptr_add_ref(const ScMatrix* p)
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 9b2c634..010f8dc 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -37,6 +37,12 @@
#include <mdds/multi_type_vector_types.hpp>
#include <mdds/multi_type_vector_trait.hpp>
+#if DEBUG_MATRIX
+#include <iostream>
+using std::cout;
+using std::endl;
+#endif
+
using ::std::pair;
using ::std::for_each;
using ::std::count_if;
@@ -216,6 +222,10 @@ public:
ScMatrix::IterateResult Product(bool bTextAsZero) const;
size_t Count(bool bCountStrings) const;
+#if DEBUG_MATRIX
+ void Dump() const;
+#endif
+
private:
void CalcPosition(SCSIZE nIndex, SCSIZE& rC, SCSIZE& rR) const;
};
@@ -957,6 +967,41 @@ size_t ScMatrixImpl::Count(bool bCountStrings) const
return aFunc.getCount();
}
+#if DEBUG_MATRIX
+void ScMatrixImpl::Dump() const
+{
+ cout << "-- matrix content" << endl;
+ SCSIZE nCols, nRows;
+ GetDimensions(nCols, nRows);
+ for (SCSIZE nRow = 0; nRow < nRows; ++nRow)
+ {
+ for (SCSIZE nCol = 0; nCol < nCols; ++nCol)
+ {
+ cout << " row=" << nRow << ", col=" << nCol << " : ";
+ switch (maMat.get_type(nRow, nCol))
+ {
+ case mdds::mtm::element_string:
+ cout << "string (" << maMat.get_string(nRow, nCol) << ")";
+ break;
+ case mdds::mtm::element_numeric:
+ cout << "numeric (" << maMat.get_numeric(nRow, nCol) << ")";
+ break;
+ case mdds::mtm::element_boolean:
+ cout << "boolean (" << maMat.get_boolean(nRow, nCol) << ")";
+ break;
+ case mdds::mtm::element_empty:
+ cout << "empty";
+ break;
+ default:
+ ;
+ }
+
+ cout << endl;
+ }
+ }
+}
+#endif
+
void ScMatrixImpl::CalcPosition(SCSIZE nIndex, SCSIZE& rC, SCSIZE& rR) const
{
SCSIZE nRowSize = maMat.size().row;
@@ -1264,4 +1309,11 @@ size_t ScMatrix::Count(bool bCountStrings) const
return pImpl->Count(bCountStrings);
}
+#if DEBUG_MATRIX
+void ScMatrix::Dump() const
+{
+ pImpl->Dump();
+}
+#endif
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list