[Libreoffice-commits] core.git: starmath/inc starmath/source starmath/workben

Takeshi Abe tabe at fixedpoint.jp
Thu Mar 3 08:47:02 UTC 2016


 starmath/inc/node.hxx                |   10 ---
 starmath/source/node.cxx             |   99 -----------------------------------
 starmath/source/view.cxx             |    9 ---
 starmath/workben/smath-dump-watch.sh |   33 -----------
 4 files changed, 151 deletions(-)

New commits:
commit ad82b7bac267f1680ba869f5f0d46202d09cbeea
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Mon Feb 22 13:44:31 2016 +0900

    starmath: Drop ENABLE_DEBUG_DUMPASDOT feature
    
    The feature for debugging seems unused so long that defining
    ENABLE_DEBUG_DUMPASDOT breaks the build but no one complains.
    So let's ditch it.
    
    Change-Id: I0b472cd1acbcfd0c2550c3bd36661c91bc2e2986
    Reviewed-on: https://gerrit.libreoffice.org/22608
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>

diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index bd30531..b4e5b1d 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -186,16 +186,6 @@ public:
     bool IsSelected() const {return mbIsSelected;}
     void SetSelected(bool Selected = true) {mbIsSelected = Selected;}
 
-#ifdef DEBUG_ENABLE_DUMPASDOT
-    /** The tree as dot graph for graphviz, usable for debugging
-     * Convert the output to a image using $ dot graph.gv -Tpng > graph.png
-     */
-    inline void DumpAsDot(std::ostream &out, OUString* label = NULL) const{
-        int id = 0;
-        DumpAsDot(out, label, -1, id, -1);
-    }
-#endif /* DEBUG_ENABLE_DUMPASDOT */
-
     /** Get the parent node of this node */
     SmStructureNode* GetParent(){ return mpParentNode; }
     const SmStructureNode* GetParent() const { return mpParentNode; }
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 77a825a..6a9c07d 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -413,105 +413,6 @@ const SmNode * SmNode::FindNodeWithAccessibleIndex(sal_Int32 nAccIdx) const
     return pResult;
 }
 
-#ifdef DEBUG_ENABLE_DUMPASDOT
-void SmNode::DumpAsDot(std::ostream &out, OUString* label, int number, int& id, int parent) const
-{
-    //If this is the root start the file
-    if(number == -1){
-        out<<"digraph {"<<std::endl;
-        if(label){
-            out<<"labelloc = \"t\";"<<std::endl;
-            OUString eq(*label);
-            //CreateTextFromNode(eq);
-            eq = eq.replaceAll("\n", " ");
-            eq = eq.replaceAll("\\", "\\\\");
-            eq = eq.replaceAll("\"", "\\\"");
-            out<<"label= \"Equation: \\\"";
-            out<< OUStringToOString(eq, RTL_TEXTENCODING_UTF8).getStr();
-            out<<"\\\"\";"<<std::endl;
-        }
-    }
-
-    //Some how out<<(int)this; doesn't work... So we  do this nasty workaround...
-    char strid[100];
-    sprintf(strid, "%i", id);
-
-    char strnr[100];
-    sprintf(strnr, "%i", number);
-
-    //Dump connection to this node
-    if( parent != -1 ){
-        char pid[100];
-        sprintf(pid, "%i", parent);
-        out<<"n"<<pid<<" -> n"<<strid<<" [label=\""<<strnr<<"\"];"<<std::endl;
-    //If doesn't have parent and isn't a rootnode:
-    } else if(number != -1) {
-        out<<"orphaned -> n"<<strid<<" [label=\""<<strnr<<"\"];"<<std::endl;
-    }
-
-    //Dump this node
-    out<<"n"<< strid<<" [label=\"";
-    switch( GetType() ) {
-        case NTABLE:           out<<"SmTableNode"; break;
-        case NBRACE:           out<<"SmBraceNode"; break;
-        case NBRACEBODY:       out<<"SmBracebodyNode"; break;
-        case NOPER:            out<<"SmOperNode"; break;
-        case NALIGN:           out<<"SmAlignNode"; break;
-        case NATTRIBUT:        out<<"SmAttributNode"; break;
-        case NFONT:            out<<"SmFontNode"; break;
-        case NUNHOR:           out<<"SmUnHorNode"; break;
-        case NBINHOR:          out<<"SmBinHorNode"; break;
-        case NBINVER:          out<<"SmBinVerNode"; break;
-        case NBINDIAGONAL:     out<<"SmBinDiagonalNode"; break;
-        case NSUBSUP:          out<<"SmSubSupNode"; break;
-        case NMATRIX:          out<<"SmMatrixNode"; break;
-        case NPLACE:           out<<"SmPlaceNode"; break;
-        case NTEXT:
-            out<<"SmTextNode: ";
-            out<< OUStringToOString(((SmTextNode*)this)->GetText(), RTL_TEXTENCODING_UTF8).getStr();
-            break;
-        case NSPECIAL:             out<<"SmSpecialNode"; break;
-        case NGLYPH_SPECIAL:   out<<"SmGlyphSpecialNode"; break;
-        case NMATH:
-            out<<"SmMathSymbolNode: ";
-            out<< OUStringToOString(((SmMathSymbolNode*)this)->GetText(), RTL_TEXTENCODING_UTF8).getStr();
-            break;
-        case NBLANK:           out<<"SmBlankNode"; break;
-        case NERROR:           out<<"SmErrorNode"; break;
-        case NLINE:            out<<"SmLineNode"; break;
-        case NEXPRESSION:      out<<"SmExpressionNode"; break;
-        case NPOLYLINE:        out<<"SmPolyLineNode"; break;
-        case NROOT:            out<<"SmRootNode"; break;
-        case NROOTSYMBOL:      out<<"SmRootSymbolNode"; break;
-        case NRECTANGLE:       out<<"SmRectangleNode"; break;
-        case NVERTICAL_BRACE:  out<<"SmVerticalBraceNode"; break;
-        case NMATHIDENT:       out<<"SmMathIdentifierNode"; break;
-        case NINTDYNSYMBOL:            out<<"SmDynIntegralSymbolNode"; break;
-        case NINTDYN:            out<<"SmDynIntegralNode"; break;
-        default:
-            out<<"Unknown Node";
-    }
-    out<<"\"";
-    if(IsSelected())
-        out<<", style=dashed";
-    out<<"];"<<std::endl;
-
-    //Dump subnodes
-    int myid = id;
-    sal_uInt16 nSize = GetNumSubNodes();
-    for (sal_uInt16 i = 0; i < nSize;  i++)
-    {
-        const SmNode *pNode = GetSubNode(i);
-        if (pNode)
-            pNode->DumpAsDot(out, NULL, i, ++id, myid);
-    }
-
-    //If this is the root end the file
-    if( number == -1 )
-        out<<"}"<<std::endl;
-}
-#endif /* DEBUG_ENABLE_DUMPASDOT */
-
 long SmNode::GetFormulaBaseline() const
 {
     SAL_WARN("starmath", "This dummy implementation should not have been called.");
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 2808448..7d6eb4f 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -467,15 +467,6 @@ void SmGraphicWindow::KeyInput(const KeyEvent& rKEvt)
         {
             if(!rKEvt.GetKeyCode().IsShift())
                 rCursor.InsertRow();
-#ifdef DEBUG_ENABLE_DUMPASDOT
-            else {
-                SmNode *pTree = (SmNode*)pViewShell->GetDoc()->GetFormulaTree();
-                std::fstream file("/tmp/smath-dump.gv", std::fstream::out);
-                OUString label(pViewShell->GetDoc()->GetText());
-                pTree->DumpAsDot(file, &label);
-                file.close();
-            }
-#endif /* DEBUG_ENABLE_DUMPASDOT */
         }break;
         case KEY_DELETE:
         {
diff --git a/starmath/workben/smath-dump-watch.sh b/starmath/workben/smath-dump-watch.sh
deleted file mode 100755
index af377d7..0000000
--- a/starmath/workben/smath-dump-watch.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-#    Watches for formula dumps by starmath and renders them
-# If starmath is compiled with the macro DEBUG_ENABLE_DUMPASDOT defined.
-# shift+enter, in the visual formula editor will make starmath dump a
-# graphviz graph of the formula tree structure. This is very useful when
-# debugging. The formula is dumped to /tmp/smath-dump.gv-
-# This script monitors this file and renders the graph when written,
-# after which the formula is displayed using feh.
-#
-# Usage: Let this script run in the background, e.g. start it in a terminal
-# (and don't close the terminal). Then compile starmath with DEBUG_ENABLE_DUMPASDOT
-# defined, use the visual formula editor to write something and hit shift+enter.
-#
-# Note: This won't work on Windows as the /tmp/ folder will be missing.
-#
-# Author: "Jonas Finnemann Jensen" <jopsen at gmail.com>
-
-touch /tmp/smath-dump.gv;
-while inotifywait -q -e close_write /tmp/smath-dump.gv;
-do
-    dot -Tpng < /tmp/smath-dump.gv > /tmp/smath-dump.png; > /dev/null
-    kill `pidof -s feh`; > /dev/null
-    feh /tmp/smath-dump.png & > /dev/null
-done


More information about the Libreoffice-commits mailing list