Commit 67cc9216 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

New function.

2000-01-18  Morten Welinder  <terra@diku.dk>

	* src/expr.c (eval_expr_empty): New function.

	* src/func.c (function_iterate_argument_values): New new
 	eval_expr_empty and ignore empty values.

	* src/collect.c (callback_function_collect): Handle NULL value.
parent df9dbb4e
2000-01-18 Morten Welinder <terra@diku.dk>
* src/expr.c (eval_expr_empty): New function.
* src/func.c (function_iterate_argument_values): New new
eval_expr_empty and ignore empty values.
* src/collect.c (callback_function_collect): Handle NULL value.
2000-01-18 Morten Welinder <terra@diku.dk>
* src/parser.y (exp -> + exp): treat as 0+exp. Remove duplicate
......
2000-01-18 Morten Welinder <terra@diku.dk>
* src/expr.c (eval_expr_empty): New function.
* src/func.c (function_iterate_argument_values): New new
eval_expr_empty and ignore empty values.
* src/collect.c (callback_function_collect): Handle NULL value.
2000-01-18 Morten Welinder <terra@diku.dk>
* src/parser.y (exp -> + exp): treat as 0+exp. Remove duplicate
......
No preview for this file type
......@@ -26,6 +26,9 @@ callback_function_collect (const EvalPosition *ep, Value *value, void *closure)
float_t x;
collect_floats_t *cl = (collect_floats_t *)closure;
if (!value)
return NULL;
switch (value->type) {
case VALUE_EMPTY:
return NULL;
......
......@@ -1042,6 +1042,20 @@ eval_expr (EvalPosition const * const pos, ExprTree const *tree)
return res;
}
Value *
eval_expr_empty (EvalPosition const * const pos, ExprTree const * const tree)
{
Value * res = eval_expr_real (pos, tree);
if (res && res->type == VALUE_EMPTY) {
value_release (res);
res = NULL;
}
return res;
}
int
cell_ref_get_abs_col (CellRef const * const ref, EvalPosition const * const pos)
{
......
......@@ -194,6 +194,10 @@ void expr_dump_tree (const ExprTree *tree);
Value *eval_expr (EvalPosition const * const pos,
ExprTree const * const tree);
/* Same as eval_expr, except that this return NULL for empty values. */
Value *eval_expr_empty (EvalPosition const * const pos,
ExprTree const * const tree);
Value *expr_implicit_intersection (EvalPosition const * const pos,
Value * const v);
......
......@@ -139,21 +139,15 @@ function_iterate_argument_values (const EvalPosition *ep,
ExprTree const * tree = (ExprTree const *) expr_node_list->data;
Value *val;
val = eval_expr (ep, tree);
val = eval_expr_empty (ep, tree);
if (strict) {
if (value_is_empty_cell (val)) {
/* A strict function with a blank/missing arg. */
if (val)
value_release (val);
/* TODO : Say which argument is empty to improve error messages */
return value_new_error (ep, _("Missing argument"));
} else if (val->type == VALUE_ERROR) {
/* A strict function with an error */
/* FIXME : Make the new position of the error here */
return val;
}
if (val == NULL)
continue;
if (strict && val->type == VALUE_ERROR) {
/* A strict function with an error */
/* FIXME : Make the new position of the error here */
return val;
}
result = function_iterate_do_value (ep, callback, callback_closure,
......
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