summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-07-17 11:06:15 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-07-24 23:29:26 -0400
commita4728e2de0d3acc6685b1e0ba0fb4606fdbea3e7 (patch)
treef1c6353cf6a3d2be3762a51b08250b307241d1b5
parent932c5679353819b30a1671831d1f591e48df73f0 (diff)
Add dumping capability for ScTokenArray (for debugging).
Change-Id: Ib3f6a87936a6c00b503f5d72b16b3e4712d7d762
-rw-r--r--sc/inc/calcmacros.hxx6
-rw-r--r--sc/inc/token.hxx11
-rw-r--r--sc/inc/tokenarray.hxx5
-rw-r--r--sc/source/core/data/column2.cxx7
-rw-r--r--sc/source/core/tool/token.cxx42
5 files changed, 63 insertions, 8 deletions
diff --git a/sc/inc/calcmacros.hxx b/sc/inc/calcmacros.hxx
index 03ca5909efce..21a51fbba63c 100644
--- a/sc/inc/calcmacros.hxx
+++ b/sc/inc/calcmacros.hxx
@@ -12,11 +12,15 @@
#define DEBUG_COLUMN_STORAGE 0
#define DEBUG_PIVOT_TABLE 0
+#define DEBUG_FORMULA_COMPILER 1
-#if DEBUG_PIVOT_TABLE
+#if DEBUG_PIVOT_TABLE || DEBUG_COLUMN_STORAGE || DEBUG_FORMULA_COMPILER
#include <iostream>
#include <string>
#include <cstdio>
+using std::cout;
+using std::cerr;
+using std::endl;
#endif
#endif
diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx
index b10cbe4fde04..e9ddc8810d5e 100644
--- a/sc/inc/token.hxx
+++ b/sc/inc/token.hxx
@@ -31,6 +31,7 @@
#include "formula/IFunctionDescription.hxx"
#include "formula/token.hxx"
#include "scmatrix.hxx"
+#include "calcmacros.hxx"
class ScJumpMatrix;
@@ -83,6 +84,10 @@ public:
virtual bool TextEqual( const formula::FormulaToken& rToken ) const;
virtual bool Is3DRef() const; // reference with 3D flag set
+#if DEBUG_FORMULA_COMPILER
+ virtual void Dump() const;
+#endif
+
/** If rTok1 and rTok2 both are SingleRef or DoubleRef tokens, extend/merge
ranges as needed for ocRange.
@param rPos
@@ -123,6 +128,9 @@ public:
virtual bool operator==( const formula::FormulaToken& rToken ) const;
virtual FormulaToken* Clone() const { return new ScSingleRefToken(*this); }
+#if DEBUG_FORMULA_COMPILER
+ virtual void Dump() const;
+#endif
DECL_FIXEDMEMPOOL_NEWDEL( ScSingleRefToken );
};
@@ -151,6 +159,9 @@ public:
virtual bool operator==( const formula::FormulaToken& rToken ) const;
virtual FormulaToken* Clone() const { return new ScDoubleRefToken(*this); }
+#if DEBUG_FORMULA_COMPILER
+ virtual void Dump() const;
+#endif
DECL_FIXEDMEMPOOL_NEWDEL( ScDoubleRefToken );
};
diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index 726dac669296..9f0c46357e4b 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -24,6 +24,7 @@
#include <tools/solar.h>
#include "scdllapi.h"
#include "types.hxx"
+#include "calcmacros.hxx"
#include <formula/tokenarray.hxx>
struct ScRawToken;
@@ -111,6 +112,10 @@ public:
* @param bCheckCopyArea should references pointing into the copy area be adjusted independently from being absolute, should be true only for copy&paste between documents
*/
void AdjustAbsoluteRefs( const ScDocument* pOldDoc, const ScAddress& rOldPos, const ScAddress& rNewPos, bool bRangeName = false, bool bCheckCopyArea = false );
+
+#if DEBUG_FORMULA_COMPILER
+ void Dump() const;
+#endif
};
#endif // SC_TOKENARRAY_HXX
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 8695581643b8..4d6c3fe65278 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -66,13 +66,6 @@
#include <boost/scoped_ptr.hpp>
-#if DEBUG_COLUMN_STORAGE
-#include "columniterator.hxx"
-#include <iostream>
-using std::cout;
-using std::endl;
-#endif
-
// -----------------------------------------------------------------------
// factor from font size to optimal cell height (text width)
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 07da54ed8f9f..3447432c3313 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -527,6 +527,13 @@ bool ScToken::Is3DRef() const
return false;
}
+#if DEBUG_FORMULA_COMPILER
+void ScToken::Dump() const
+{
+ cout << "-- ScToken (base class)" << endl;
+}
+#endif
+
FormulaTokenRef ScToken::ExtendRangeReference( FormulaToken & rTok1, FormulaToken & rTok2,
const ScAddress & rPos, bool bReuseDoubleRef )
{
@@ -746,6 +753,15 @@ bool ScSingleRefToken::operator==( const FormulaToken& r ) const
return FormulaToken::operator==( r ) && aSingleRef == static_cast<const ScToken&>(r).GetSingleRef();
}
+#if DEBUG_FORMULA_COMPILER
+void ScSingleRefToken::Dump() const
+{
+ cout << "-- ScSingleRefToken" << endl;
+ cout << " relative column: " << aSingleRef.IsColRel() << " row : " << aSingleRef.IsRowRel() << " sheet: " << aSingleRef.IsTabRel() << endl;
+ cout << " absolute column: " << aSingleRef.nCol << " row: " << aSingleRef.nRow << " sheet: " << aSingleRef.nTab << endl;
+ cout << " relative column: " << aSingleRef.nRelCol << " row: " << aSingleRef.nRelRow << " sheet: " << aSingleRef.nRelTab << endl;
+}
+#endif
const ScSingleRefData& ScDoubleRefToken::GetSingleRef() const { return aDoubleRef.Ref1; }
ScSingleRefData& ScDoubleRefToken::GetSingleRef() { return aDoubleRef.Ref1; }
@@ -760,6 +776,21 @@ bool ScDoubleRefToken::operator==( const FormulaToken& r ) const
return FormulaToken::operator==( r ) && aDoubleRef == static_cast<const ScToken&>(r).GetDoubleRef();
}
+#if DEBUG_FORMULA_COMPILER
+void ScDoubleRefToken::Dump() const
+{
+ cout << "-- ScDoubleRefToken" << endl;
+ cout << " ref 1" << endl;
+ cout << " relative column: " << aDoubleRef.Ref1.IsColRel() << " row: " << aDoubleRef.Ref1.IsRowRel() << " sheet: " << aDoubleRef.Ref1.IsTabRel() << endl;
+ cout << " absolute column: " << aDoubleRef.Ref1.nCol << " row: " << aDoubleRef.Ref1.nRow << " sheet: " << aDoubleRef.Ref1.nTab << endl;
+ cout << " relative column: " << aDoubleRef.Ref1.nRelCol << " row: " << aDoubleRef.Ref1.nRelRow << " sheet: " << aDoubleRef.Ref1.nRelTab << endl;
+
+ cout << " ref 2" << endl;
+ cout << " relative column: " << aDoubleRef.Ref2.IsColRel() << " row: " << aDoubleRef.Ref2.IsRowRel() << " sheet: " << aDoubleRef.Ref2.IsTabRel() << endl;
+ cout << " absolute column: " << aDoubleRef.Ref2.nCol << " row: " << aDoubleRef.Ref2.nRow << " sheet: " << aDoubleRef.Ref2.nTab << endl;
+ cout << " relative column: " << aDoubleRef.Ref2.nRelCol << " row: " << aDoubleRef.Ref2.nRelRow << " sheet: " << aDoubleRef.Ref2.nRelTab << endl;
+}
+#endif
const ScRefList* ScRefListToken::GetRefList() const { return &aRefList; }
ScRefList* ScRefListToken::GetRefList() { return &aRefList; }
@@ -2185,5 +2216,16 @@ void ScTokenArray::AdjustAbsoluteRefs( const ScDocument* pOldDoc, const ScAddres
}
}
+#if DEBUG_FORMULA_COMPILER
+void ScTokenArray::Dump() const
+{
+ for (sal_uInt16 i = 0; i < nLen; ++i)
+ {
+ const ScToken* p = static_cast<const ScToken*>(pCode[i]);
+ p->Dump();
+ }
+}
+#endif
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */