From b273c33f0574379be6de4e13772c0364ac287b39 Mon Sep 17 00:00:00 2001 From: Morten Welinder Date: Fri, 29 Dec 2017 13:38:34 -0500 Subject: [PATCH] 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 23388bb24..992f6974d 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 bb3da8797..859200709 100644 --- a/plugins/fn-info/ChangeLog +++ b/plugins/fn-info/ChangeLog @@ -1,3 +1,7 @@ +2017-12-29 Morten Welinder + + * functions.c (gnumeric_isref): Fix XL compatibility. + 2017-12-28 Morten Welinder * Release 1.12.38 diff --git a/plugins/fn-info/functions.c b/plugins/fn-info/functions.c index 9e876a044..ebb01b92e 100644 --- a/plugins/fn-info/functions.c +++ b/plugins/fn-info/functions.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -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); } /***************************************************************************/ -- 2.11.4.GIT