Commit 7a970a68 authored by Morten Welinder's avatar Morten Welinder

Eval: create new eval flag for forcing array context.

parent 41478d55
2012-01-08 Morten Welinder <terra@gnome.org>
* src/expr.c (gnm_expr_top_eval): When we see
GNM_EXPR_EVAL_ARRAY_CONTEXT with no array position, fake it.
* src/gnumeric.h (GnmExprEvalFlags): Introduce new
GNM_EXPR_EVAL_ARRAY_CONTEXT flags.
2012-01-08 Jean Brefort <jean.brefort@normalesup.org>
* src/graph.c (gnm_go_data_vector_load_len): fix a wrong use of
......
......@@ -3032,9 +3032,21 @@ gnm_expr_top_eval (GnmExprTop const *texpr,
GnmExprEvalFlags flags)
{
GnmValue *res;
GnmEvalPos ep;
GnmExprArrayCorner array;
g_return_val_if_fail (IS_GNM_EXPR_TOP (texpr), NULL);
gnm_app_recalc_start ();
if ((flags & GNM_EXPR_EVAL_ARRAY_CONTEXT) && !pos->array) {
array.oper = GNM_EXPR_OP_ARRAY_CORNER;
array.cols = array.rows = 1;
array.value = NULL;
array.expr = texpr->expr;
ep = *pos;
ep.array = &array;
pos = &ep;
}
res = gnm_expr_eval (texpr->expr, pos, flags);
gnm_app_recalc_finish ();
......
......@@ -173,7 +173,8 @@ typedef enum {
GNM_EXPR_EVAL_SCALAR_NON_EMPTY = 0,
GNM_EXPR_EVAL_PERMIT_NON_SCALAR = 0x1,
GNM_EXPR_EVAL_PERMIT_EMPTY = 0x2,
GNM_EXPR_EVAL_WANT_REF = 0x4
GNM_EXPR_EVAL_WANT_REF = 0x4,
GNM_EXPR_EVAL_ARRAY_CONTEXT = 0x8
} GnmExprEvalFlags;
typedef struct _XmlParseContext XmlParseContext;
......
2012-01-08 Morten Welinder <terra@gnome.org>
* gnm-validation-combo-view.c (vcombo_create_list): Use new
GNM_EXPR_EVAL_ARRAY_CONTEXT flag.
2011-12-30 Morten Welinder <terra@gnome.org>
* gnm-format-sel.c (cb_generate_preview): Get the pango context
......
......@@ -102,7 +102,6 @@ vcombo_create_list (SheetObject *so,
GnmValue *v;
GnmValue const *cur_val;
GnmValidation const *val = vcombo->validation;
GnmExprArrayCorner array = { GNM_EXPR_OP_ARRAY_CORNER, 1, 1, NULL, NULL };
SheetView const *sv = vcombo->parent.sv;
g_return_val_if_fail (val != NULL, NULL);
......@@ -111,10 +110,10 @@ vcombo_create_list (SheetObject *so,
g_return_val_if_fail (sv != NULL, NULL);
eval_pos_init_editpos (&ep, sv);
/* Force into 'array' mode by supplying a fake corner */
ep.array = &array;
v = gnm_expr_top_eval (val->texpr[0], &ep,
GNM_EXPR_EVAL_PERMIT_NON_SCALAR | GNM_EXPR_EVAL_PERMIT_EMPTY);
GNM_EXPR_EVAL_PERMIT_NON_SCALAR |
GNM_EXPR_EVAL_PERMIT_EMPTY |
GNM_EXPR_EVAL_ARRAY_CONTEXT);
if (NULL == v)
return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment