Commit 127a8eb6 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Build table of translated error names. (value_shutdown): Tear it down.

2002-12-16  Morten Welinder  <terra@diku.dk>

	* src/value.c (value_init): Build table of translated error names.
	(value_shutdown): Tear it down.
	(value_new_error_NULL, value_new_error_DIV0,
	value_new_error_VALUE, value_new_error_REF, value_new_error_NAME,
	value_new_error_NUM, value_new_error_NA, value_new_error_RECALC):
	New functions.
	* */*.c */*/*.c: Elminate most occurrences of gnumeric_err_*.

	* src/libgnumeric.c (gnm_common_init): Move string initialization
	to before values.
	(gnm_shutdown): Similarly.
parent f35df2af
2002-12-16 Morten Welinder <terra@diku.dk>
* src/value.c (value_init): Build table of translated error names.
(value_shutdown): Tear it down.
(value_new_error_NULL, value_new_error_DIV0,
value_new_error_VALUE, value_new_error_REF, value_new_error_NAME,
value_new_error_NUM, value_new_error_NA, value_new_error_RECALC):
New functions.
* */*.c */*/*.c: Elminate most occurrences of gnumeric_err_*.
* src/libgnumeric.c (gnm_common_init): Move string initialization
to before values.
(gnm_shutdown): Similarly.
2002-12-15 Morten Welinder <terra@diku.dk>
* src/expr.c (gnm_expr_as_gstring): New function.
......
2002-12-16 Morten Welinder <terra@diku.dk>
* src/value.c (value_init): Build table of translated error names.
(value_shutdown): Tear it down.
(value_new_error_NULL, value_new_error_DIV0,
value_new_error_VALUE, value_new_error_REF, value_new_error_NAME,
value_new_error_NUM, value_new_error_NA, value_new_error_RECALC):
New functions.
* */*.c */*/*.c: Elminate most occurrences of gnumeric_err_*.
* src/libgnumeric.c (gnm_common_init): Move string initialization
to before values.
(gnm_shutdown): Similarly.
2002-12-15 Morten Welinder <terra@diku.dk>
* src/expr.c (gnm_expr_as_gstring): New function.
......
2002-12-16 Morten Welinder <terra@diku.dk>
* src/value.c (value_init): Build table of translated error names.
(value_shutdown): Tear it down.
(value_new_error_NULL, value_new_error_DIV0,
value_new_error_VALUE, value_new_error_REF, value_new_error_NAME,
value_new_error_NUM, value_new_error_NA, value_new_error_RECALC):
New functions.
* */*.c */*/*.c: Elminate most occurrences of gnumeric_err_*.
* src/libgnumeric.c (gnm_common_init): Move string initialization
to before values.
(gnm_shutdown): Similarly.
2002-12-15 Morten Welinder <terra@diku.dk>
* src/expr.c (gnm_expr_as_gstring): New function.
......
This diff is collapsed.
2002-12-16 Morten Welinder <terra@diku.dk>
* ms-excel-read.c (biff_get_error): Rename from
biff_get_error_text and return a full error instead. Add evalpos
argument. All callers changed.
2002-12-15 Jody Goldberg <jody@gnome.org>
* ms-container.c (ms_container_finalize) : cull out unused
......
......@@ -973,22 +973,19 @@ excel_read_EXSST (BiffQuery *q, ExcelWorkbook *ewb)
GSF_LE_GET_GUINT16 (q->data), (q->length - 2) / 8););
}
char const *
biff_get_error_text (guint8 const err)
Value *
biff_get_error (EvalPos const *pos, guint8 const err)
{
char const *buf;
switch (err) {
case 0: buf = gnumeric_err_NULL; break;
case 7: buf = gnumeric_err_DIV0; break;
case 15: buf = gnumeric_err_VALUE; break;
case 23: buf = gnumeric_err_REF; break;
case 29: buf = gnumeric_err_NAME; break;
case 36: buf = gnumeric_err_NUM; break;
case 42: buf = gnumeric_err_NA; break;
default:
buf = _("#UNKNOWN!"); break;
case 0: return value_new_error_NULL (pos);
case 7: return value_new_error_DIV0 (pos);
case 15: return value_new_error_VALUE (pos);
case 23: return value_new_error_REF (pos);
case 29: return value_new_error_NAME (pos);
case 36: return value_new_error_NUM (pos);
case 42: return value_new_error_NA (pos);
default: return value_new_error (pos, _("#UNKNOWN!"));
}
return buf;
}
/**
......@@ -2186,7 +2183,7 @@ excel_read_FORMULA (BiffQuery *q, ExcelSheet *esheet)
case 2: { /* Error */
guint8 const v = GSF_LE_GET_GUINT8 (q->data + val_offset + 2);
val = value_new_error (NULL, biff_get_error_text (v));
val = biff_get_error (NULL, v);
break;
}
......@@ -2663,8 +2660,7 @@ excel_parse_name (ExcelWorkbook *ewb, Sheet *sheet, char *name,
expr_data, expr_len, FALSE, NULL);
if (expr == NULL) {
gnm_io_warning (ewb->context, _("Failure parsing name '%s'"), name);
expr = gnm_expr_new_constant (value_new_error (NULL,
gnumeric_err_REF));
expr = gnm_expr_new_constant (value_new_error_REF (NULL));
} else d (2, {
char *tmp;
ParsePos pp;
......@@ -2985,8 +2981,7 @@ excel_read_XCT (BiffQuery *q, ExcelWorkbook *ewb)
data += 9;
break;
case 16: v = value_new_error (&ep,
biff_get_error_text (GSF_LE_GET_GUINT16 (data+1)));
case 16: v = biff_get_error (&ep, GSF_LE_GET_GUINT16 (data+1));
data += 9;
break;
......@@ -4235,7 +4230,7 @@ read_DOPER (guint8 const *doper, gboolean is_equal,
*str_len = 0;
*op = GNM_FILTER_UNUSED;
switch (doper [0]) {
switch (doper[0]) {
case 0: return NULL; /* ignore */
case 2: res = biff_get_rk (doper + 2);
......@@ -4245,11 +4240,10 @@ read_DOPER (guint8 const *doper, gboolean is_equal,
case 6: *str_len = doper[6];
break;
case 8: if (doper [2])
res = value_new_error (NULL,
biff_get_error_text (doper [3]));
case 8: if (doper[2])
res = biff_get_error (NULL, doper[3]);
else
res = value_new_bool (doper [3] ? TRUE : FALSE);
res = value_new_bool (doper[3] ? TRUE : FALSE);
break;
case 0xC: *op = GNM_FILTER_OP_BLANKS;
......@@ -4258,8 +4252,8 @@ read_DOPER (guint8 const *doper, gboolean is_equal,
return NULL;
};
g_return_val_if_fail (doper[1] > 0 && doper [1] <=6, NULL);
*op = ops [doper [1] - 1];
g_return_val_if_fail (doper[1] > 0 && doper[1] <=6, NULL);
*op = ops [doper[1] - 1];
return res;
}
......@@ -4637,9 +4631,7 @@ excel_read_sheet (BiffQuery *q, ExcelWorkbook *ewb,
if (GSF_LE_GET_GUINT8 (q->data + 7)) {
EvalPos ep;
v = value_new_error (
eval_pos_init (&ep, esheet->sheet, &pos),
biff_get_error_text (val));
v = biff_get_error (eval_pos_init (&ep, esheet->sheet, &pos), val);
} else
v = value_new_bool (val);
excel_sheet_insert_val (esheet,
......
......@@ -123,7 +123,7 @@ struct _ExcelWorkbook {
};
char *biff_get_text (guint8 const *ptr, guint32 length, guint32 *byte_length);
char const *biff_get_error_text (guint8 err);
Value *biff_get_error (EvalPos const *pos, guint8 const err);
Sheet *excel_externsheet_v7 (MSContainer const *container, gint16 i);
ExcelExternSheetV8 const *excel_externsheet_v8 (ExcelWorkbook const *wb, gint16 i);
......
......@@ -1017,8 +1017,7 @@ excel_parse_formula (MSContainer const *container,
break;
case FORMULA_PTG_ERR: {
const char *errtxt = biff_get_error_text (GSF_LE_GET_GUINT8 (cur));
parse_list_push_raw (&stack, value_new_error (NULL, errtxt));
parse_list_push_raw (&stack, biff_get_error (NULL, GSF_LE_GET_GUINT8 (cur)));
ptg_length = 1;
break;
}
......@@ -1248,8 +1247,7 @@ excel_parse_formula (MSContainer const *container,
elem_len = 9;
break;
case 16:
elem = value_new_error (NULL,
biff_get_error_text (array_data [1]));
elem = biff_get_error (NULL, array_data [1]);
elem_len = 9;
break;
......@@ -1311,7 +1309,7 @@ excel_parse_formula (MSContainer const *container,
g_warning ("EXCEL: %x (of %x) UNKNOWN name %p.",
name_idx, a ? a->len : -1, container);
name = gnm_expr_new_constant (
value_new_error (NULL, gnumeric_err_REF));
value_new_error_REF (NULL));
} else
name = gnm_expr_new_name (nexpr, NULL, NULL);
......@@ -1322,12 +1320,12 @@ excel_parse_formula (MSContainer const *container,
case FORMULA_PTG_REF_ERR:
ptg_length = (ver >= MS_BIFF_V8) ? 4 : 3;
parse_list_push_raw (&stack, value_new_error (NULL, gnumeric_err_REF));
parse_list_push_raw (&stack, value_new_error_REF (NULL));
break;
case FORMULA_PTG_AREA_ERR:
ptg_length = (ver >= MS_BIFF_V8) ? 8 : 6;
parse_list_push_raw (&stack, value_new_error (NULL, gnumeric_err_REF));
parse_list_push_raw (&stack, value_new_error_REF (NULL));
break;
case FORMULA_PTG_REF: case FORMULA_PTG_REFN: {
......@@ -1437,7 +1435,7 @@ excel_parse_formula (MSContainer const *container,
g_warning ("EXCEL: %x (of %x) UNKNOWN name %p.",
name_idx, a ? a->len : -1, container);
name = gnm_expr_new_constant (
value_new_error (NULL, gnumeric_err_REF));
value_new_error_REF (NULL));
} else {
/* See supbook_get_sheet for details */
if (sheet == (Sheet *)1) {
......@@ -1472,7 +1470,7 @@ excel_parse_formula (MSContainer const *container,
}
if (excel_formula_parses_ref_sheets (container, cur, &first.sheet, &last.sheet))
parse_list_push_raw (&stack, value_new_error (NULL, gnumeric_err_REF));
parse_list_push_raw (&stack, value_new_error_REF (NULL));
else if (first.sheet != last.sheet)
parse_list_push_raw (&stack, value_new_cellrange (&first, &last, fn_col, fn_row));
else
......@@ -1506,7 +1504,7 @@ excel_parse_formula (MSContainer const *container,
ptg_length = 20;
}
if (excel_formula_parses_ref_sheets (container, cur, &first.sheet, &last.sheet))
parse_list_push_raw (&stack, value_new_error (NULL, gnumeric_err_REF));
parse_list_push_raw (&stack, value_new_error_REF (NULL));
else
parse_list_push_raw (&stack, value_new_cellrange (&first, &last, fn_col, fn_row));
break;
......@@ -1514,12 +1512,12 @@ excel_parse_formula (MSContainer const *container,
case FORMULA_PTG_REF_ERR_3D :
ptg_length = (ver >= MS_BIFF_V8) ? 6 : 17;
parse_list_push_raw (&stack, value_new_error (NULL, gnumeric_err_REF));
parse_list_push_raw (&stack, value_new_error_REF (NULL));
break;
case FORMULA_PTG_AREA_ERR_3D :
ptg_length = (ver >= MS_BIFF_V8) ? 10 : 20;
parse_list_push_raw (&stack, value_new_error (NULL, gnumeric_err_REF));
parse_list_push_raw (&stack, value_new_error_REF (NULL));
break;
default:
......
......@@ -108,7 +108,7 @@ gnumeric_complex (FunctionEvalInfo *ei, Value **argv)
suffix = argv[2] ? value_peek_string (argv[2]) : "i";
if (strcmp (suffix, "i") != 0 && strcmp (suffix, "j") != 0)
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
return value_new_complex (&c, *suffix);
}
......@@ -141,7 +141,7 @@ gnumeric_imaginary (FunctionEvalInfo *ei, Value **argv)
return value_new_float (0.0);
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
return value_new_float (c.im);
}
......@@ -171,10 +171,10 @@ gnumeric_imabs (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
if (argv[0]->type != VALUE_STRING)
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
return value_new_float (complex_mod (&c));
}
......@@ -207,7 +207,7 @@ gnumeric_imreal (FunctionEvalInfo *ei, Value **argv)
return value_duplicate (argv[0]);
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
return value_new_float (c.re);
}
......@@ -237,10 +237,10 @@ gnumeric_imconjugate (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
if (argv[0]->type != VALUE_STRING)
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
complex_conj (&res, &c);
return value_new_complex (&res, imunit);
......@@ -271,7 +271,7 @@ gnumeric_iminv (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_inverse (&c, &res);
return value_new_complex (&res, imunit);
......@@ -302,7 +302,7 @@ gnumeric_imneg (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_negative (&c, &res);
return value_new_complex (&res, imunit);
......@@ -333,7 +333,7 @@ gnumeric_imcos (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
complex_cos (&res, &c);
return value_new_complex (&res, imunit);
......@@ -364,7 +364,7 @@ gnumeric_imtan (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
complex_tan (&res, &c);
return value_new_complex (&res, imunit);
......@@ -396,7 +396,7 @@ gnumeric_imsec (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
complex_cos (&res, &c);
gsl_complex_inverse (&res, &res);
......@@ -429,7 +429,7 @@ gnumeric_imcsc (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
complex_sin (&res, &c);
gsl_complex_inverse (&res, &res);
......@@ -462,7 +462,7 @@ gnumeric_imcot (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
complex_tan (&res, &c);
gsl_complex_inverse (&res, &res);
......@@ -494,7 +494,7 @@ gnumeric_imexp (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
complex_exp (&res, &c);
return value_new_complex (&res, imunit);
......@@ -527,7 +527,7 @@ gnumeric_imargument (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
return value_new_float (complex_angle (&c));
}
......@@ -562,7 +562,7 @@ gnumeric_imln (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
complex_ln (&res, &c);
return value_new_complex (&res, imunit);
......@@ -593,7 +593,7 @@ gnumeric_imlog2 (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
complex_ln (&res, &c);
complex_scale_real (&res, 1 / M_LN2gnum);
......@@ -625,7 +625,7 @@ gnumeric_imlog10 (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
complex_ln (&res, &c);
complex_scale_real (&res, 1 / M_LN10gnum);
......@@ -659,13 +659,13 @@ gnumeric_impower (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &a, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
if (value_get_as_complex (argv[1], &b, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
if (complex_real_p (&a) && a.re <= 0 && !complex_real_p (&b))
return value_new_error (ei->pos, gnumeric_err_DIV0);
return value_new_error_DIV0 (ei->pos);
complex_pow (&res, &a, &b);
return value_new_complex (&res, imunit);
......@@ -696,13 +696,13 @@ gnumeric_imdiv (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &a, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
if (value_get_as_complex (argv[1], &b, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
if (complex_zero_p (&b))
return value_new_error (ei->pos, gnumeric_err_DIV0);
return value_new_error_DIV0 (ei->pos);
complex_div (&res, &a, &b);
return value_new_complex (&res, imunit);
......@@ -732,7 +732,7 @@ gnumeric_imsin (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
complex_sin (&res, &c);
return value_new_complex (&res, imunit);
......@@ -764,7 +764,7 @@ gnumeric_imsinh (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_sinh (&c, &res);
return value_new_complex (&res, imunit);
......@@ -795,7 +795,7 @@ gnumeric_imcosh (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_cosh (&c, &res);
return value_new_complex (&res, imunit);
......@@ -826,7 +826,7 @@ gnumeric_imtanh (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_tanh (&c, &res);
return value_new_complex (&res, imunit);
......@@ -857,7 +857,7 @@ gnumeric_imsech (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_sech (&c, &res);
return value_new_complex (&res, imunit);
......@@ -888,7 +888,7 @@ gnumeric_imcsch (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_csch (&c, &res);
return value_new_complex (&res, imunit);
......@@ -919,7 +919,7 @@ gnumeric_imcoth (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_coth (&c, &res);
return value_new_complex (&res, imunit);
......@@ -951,7 +951,7 @@ gnumeric_imarcsin (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_arcsin (&c, &res);
return value_new_complex (&res, imunit);
......@@ -983,7 +983,7 @@ gnumeric_imarccos (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_arccos (&c, &res);
return value_new_complex (&res, imunit);
......@@ -1015,7 +1015,7 @@ gnumeric_imarctan (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_arctan (&c, &res);
return value_new_complex (&res, imunit);
......@@ -1046,7 +1046,7 @@ gnumeric_imarcsec (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_arcsec (&c, &res);
return value_new_complex (&res, imunit);
......@@ -1077,7 +1077,7 @@ gnumeric_imarccsc (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_arccsc (&c, &res);
return value_new_complex (&res, imunit);
......@@ -1108,7 +1108,7 @@ gnumeric_imarccot (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_arccot (&c, &res);
return value_new_complex (&res, imunit);
......@@ -1140,7 +1140,7 @@ gnumeric_imarcsinh (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_arcsinh (&c, &res);
return value_new_complex (&res, imunit);
......@@ -1172,7 +1172,7 @@ gnumeric_imarccosh (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_arccosh (&c, &res);
return value_new_complex (&res, imunit);
......@@ -1204,7 +1204,7 @@ gnumeric_imarctanh (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_arctanh (&c, &res);
return value_new_complex (&res, imunit);
......@@ -1236,7 +1236,7 @@ gnumeric_imarcsech (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_arcsech (&c, &res);
return value_new_complex (&res, imunit);
......@@ -1267,7 +1267,7 @@ gnumeric_imarccsch (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_arccsch (&c, &res);
return value_new_complex (&res, imunit);
......@@ -1299,7 +1299,7 @@ gnumeric_imarccoth (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
gsl_complex_arccoth (&c, &res);
return value_new_complex (&res, imunit);
......@@ -1330,7 +1330,7 @@ gnumeric_imsqrt (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &c, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
complex_sqrt (&res, &c);
return value_new_complex (&res, imunit);
......@@ -1361,10 +1361,10 @@ gnumeric_imsub (FunctionEvalInfo *ei, Value **argv)
char imunit;
if (value_get_as_complex (argv[0], &a, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
if (value_get_as_complex (argv[1], &b, &imunit))
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_error_VALUE (ei->pos);
complex_sub (&res, &a, &b);
return value_new_complex (&res, imunit);
......@@ -1408,7 +1408,7 @@ callback_function_imoper (const EvalPos *ep, Value *value, void *closure)
imptr = VALUE_IS_NUMBER (value) ? &dummy : &result->imunit;
if (value_get_as_complex (value, &c, imptr))
return value_new_error (ep, gnumeric_err_VALUE);
return value_new_error_VALUE (ep);
switch (result->type) {
case Improduct:
......
......@@ -168,11 +168,11 @@ database_float_range_function (FunctionEvalInfo *ei,
fieldno = find_column_of_field (ei->pos, database, field);
if (fieldno < 0)
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_error_NUM (ei->pos);
criterias = parse_database_criteria (ei->pos, database, criteria);
if (criterias == NULL)
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_error_NUM (ei->pos);
sheet = eval_sheet (database->v_range.cell.a.sheet,
ei->pos->sheet);
......@@ -226,11 +226,11 @@ database_value_range_function (FunctionEvalInfo *ei,
fieldno = find_column_of_field (ei->pos, database, field);
if (fieldno < 0)
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_error_NUM (ei->pos);
criterias = parse_database_criteria (ei->pos, database, criteria);
if (criterias == NULL)
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_error_NUM (ei->pos);
sheet = eval_sheet (database->v_range.cell.a.sheet,
ei->pos->sheet);
......@@ -1159,7 +1159,7 @@ gnumeric_getpivotdata (FunctionEvalInfo *ei, Value **argv)
col = find_column_of_field (ei->pos, argv[0], argv[1]);
if (col == -1)
return value_new_error (ei->pos, gnumeric_err_REF);
return value_new_error_REF (ei->pos);
row = argv[0]->v_range.cell.b.row;
cell = sheet_cell_get (ei->pos->sheet, col, row);
......@@ -1171,7 +1171,7 @@ gnumeric_getpivotdata (FunctionEvalInfo *ei, Value **argv)
if (cell_is_blank (cell) ||
!VALUE_IS_NUMBER (cell->value))
return value_new_error (ei->pos, gnumeric_err_REF);
return value_new_error_REF (ei->pos);
return value_new_float (value_get_as_float (cell->value));
}
......
......@@ -118,7 +118,7 @@ gnumeric_date (FunctionEvalInfo *ei, Value **argv)
return make_date (value_new_int (datetime_g_to_serial (&date)));
error:
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_error_NUM (ei->pos);
}