[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: KSpread crash - possible solution
From:       John Dailey <dailey () vt ! edu>
Date:       2002-08-27 1:56:04
[Download RAW message or body]

Now I remember why I didn't implement the 'dependancy' error  :-)

The attached patch will fix the problem so that in the case you gave, the 
result of the formula will be updated.  Basically, don't erase the parse 
structure when the evaluate() fails.

The reason a separate dependancy error won't be easily done is that a formula 
like '=A1 + shw3aks5sg4i7ea' parses correctly as addition(cell, variable).  
There is no quick way to tell how the error occurs within the evaluate().

-John

On Monday 26 August 2002 01:18 pm, John Dailey wrote:
> > About the dependancies:
> >
> > A1:  10
> > A2:   b
> > A3:  =A1/A2 => you get a parse error.
> > Changing A2 to e.g. 5, doesn't update A3, but I think we should try to.
> >
> > But you are right if we don't know what the problem with parsing is, we
> > can't create the dependancy list.
> >
> > Hmm. Would be nice to have though.
>
> When I first put the different error types in, I intended a separate
> "Dependancy" error separate from a parse error.  Apparently it isn't
> working
>
> :-)  I'll try to get to that tonight.
>
> As far as I can tell, it should be safe to say that anything that fails on
> the parse() function should have a parse error and anything failing on the
> evaluate() function should have either a circular or dependancy error. 
> Does that sound right?
>
> -John
> _______________________________________________
> koffice-devel mailing list
> koffice-devel@mail.kde.org
> http://mail.kde.org/mailman/listinfo/koffice-devel

["retainParse.diff" (text/x-diff)]

Index: kspread_cell.cc
===================================================================
RCS file: /home/kde/koffice/kspread/kspread_cell.cc,v
retrieving revision 1.438
diff -p -u -3 -r1.438 kspread_cell.cc
--- kspread_cell.cc	2002/08/20 18:58:41	1.438
+++ kspread_cell.cc	2002/08/27 01:51:31
@@ -1615,16 +1615,9 @@ bool KSpreadCell::calc(bool delay)
   if ( !m_pTable->doc()->interpreter()->evaluate( context, m_pCode, m_pTable ) )
   {
     // If we got an error during evaluation ...
-    if (!hasError())
-    {
-      // if the error wasn't already set during the evaluation, it must
-      // be a parse error.
-
-      clearFormula();
-      setFlag(Flag_ParseError);
-      m_strFormulaOut = "####";
-      m_dataType = StringData; //correct?
-    }
+    setFlag(Flag_ParseError);
+    m_strFormulaOut = "####";
+    m_dataType = StringData; //correct?
     setFlag(Flag_LayoutDirty);
     // Print out exception if any
     if ( context.exception() && m_pTable->doc()->getShowMessageError())
@@ -1750,7 +1743,7 @@ bool KSpreadCell::calc(bool delay)
   clearFlag(Flag_Progress);
 
   // if our value changed the cells that depend on us need to be updated
-  if ( m_strFormulaOut != m_strOutText ) 
+  if ( m_strFormulaOut != m_strOutText )
   {
     setFlag(Flag_UpdatingDeps);
 

_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic