[Libreoffice-commits] core.git: sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Mon Apr 28 12:30:29 PDT 2014


 sc/source/core/tool/token.cxx |   45 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)

New commits:
commit 8a421be2b155a24ac673456284652214c72bd645
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Apr 28 15:27:55 2014 -0400

    Dump more info from ScTokenArray (for debugging).
    
    Change-Id: I57897c0b3c7f5974f2b9e510f03c91e23e362096

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 8bb53c3..5344454 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3784,14 +3784,55 @@ void ScTokenArray::WrapReference( const ScAddress& rPos, SCCOL nMaxCol, SCROW nM
 }
 
 #if DEBUG_FORMULA_COMPILER
+
+namespace {
+
+void dumpFormulaToken( const FormulaToken& rToken )
+{
+    cout << "-- FormulaToken" << endl;
+    cout << "  opcode: " << rToken.GetOpCode() << endl;
+    cout << "  type: " << static_cast<int>(rToken.GetType()) << endl;
+    switch (rToken.GetType())
+    {
+        case svDouble:
+            cout << "  value: " << rToken.GetDouble() << endl;
+        break;
+        case svString:
+            cout << "  string: "
+                << OUStringToOString(rToken.GetString().getString(), RTL_TEXTENCODING_UTF8).getStr()
+                << endl;
+        break;
+        default:
+            ;
+    }
+}
+
+}
+
 void ScTokenArray::Dump() const
 {
+    cout << "+++ Normal Tokens +++" << endl;
     for (sal_uInt16 i = 0; i < nLen; ++i)
     {
-        const ScToken* p = dynamic_cast<const ScToken*>(pCode[i]);
+        const FormulaToken* pToken = pCode[i];
+        const ScToken* p = dynamic_cast<const ScToken*>(pToken);
+        if (!p)
+        {
+            dumpFormulaToken(*pToken);
+            continue;
+        }
+
+        p->Dump();
+    }
+
+    cout << "+++ RPN Tokens +++" << endl;
+    for (sal_uInt16 i = 0; i < nRPN; ++i)
+    {
+        const FormulaToken* pToken = pRPN[i];
+        const ScToken* p = dynamic_cast<const ScToken*>(pToken);
         if (!p)
         {
-            cout << "-- (non ScToken)" << endl;
+            dumpFormulaToken(*pToken);
             continue;
         }
 


More information about the Libreoffice-commits mailing list