[gnumeric] ISREF: Fix XL compatibility.



commit b273c33f0574379be6de4e13772c0364ac287b39
Author: Morten Welinder <terra gnome org>
Date:   Fri Dec 29 13:38:34 2017 -0500

    ISREF: Fix XL compatibility.
    
    ISREF cannot be computed by looking at the expression only.
    
    isref(b1:b2) -- fixed; now true
    isref((b2)) -- fixed; now true
    isref(if(rand()>0.5,b1,2)) -- fixed; now true half the time

 NEWS                        |    1 +
 plugins/fn-info/ChangeLog   |    4 ++++
 plugins/fn-info/functions.c |   12 ++++++++++--
 3 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 23388bb..992f697 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ Gnumeric 1.12.39
 
 Morten:
        * Fix ssdiff problem.  [#792038]
+       * Fix ISREF.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.38
diff --git a/plugins/fn-info/ChangeLog b/plugins/fn-info/ChangeLog
index bb3da87..8592007 100644
--- a/plugins/fn-info/ChangeLog
+++ b/plugins/fn-info/ChangeLog
@@ -1,3 +1,7 @@
+2017-12-29  Morten Welinder  <terra gnome org>
+
+       * functions.c (gnumeric_isref): Fix XL compatibility.
+
 2017-12-28  Morten Welinder <terra gnome org>
 
        * Release 1.12.38
diff --git a/plugins/fn-info/functions.c b/plugins/fn-info/functions.c
index 9e876a0..ebb01b9 100644
--- a/plugins/fn-info/functions.c
+++ b/plugins/fn-info/functions.c
@@ -42,7 +42,6 @@
 #include <style-font.h>
 #include <value.h>
 #include <expr.h>
-#include <expr-impl.h>
 #include <workbook.h>
 #include <sheet-style.h>
 #include <number-match.h>
@@ -1687,11 +1686,20 @@ static GnmFuncHelp const help_isref[] = {
 static GnmValue *
 gnumeric_isref (GnmFuncEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
 {
+       GnmValue *v;
+       gboolean res;
+
        if (argc != 1)
                return value_new_error (ei->pos,
                                        _("Invalid number of arguments"));
 
-       return value_new_bool (GNM_EXPR_GET_OPER (argv[0]) == GNM_EXPR_OP_CELLREF);
+       v = gnm_expr_eval (argv[0], ei->pos,
+                          GNM_EXPR_EVAL_PERMIT_NON_SCALAR |
+                          GNM_EXPR_EVAL_WANT_REF);
+       res = VALUE_IS_CELLRANGE (v);
+       value_release (v);
+
+       return value_new_bool (res);
 }
 
 /***************************************************************************/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]