Commit 077928ec authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Don't setup error variables any more. (gnumeric_error_init): Delete.

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

	* src/number-match.c (format_match_init): Don't setup error
	variables any more.
	(gnumeric_error_init): Delete.

	* src/value.c (value_error_name): New function.

	* src/parse-util.c (def_expr_name_handler): Use value_error_name
	to get proper spelling of the REF error.

	* src/collect.c (float_range_function, float_range_function2,
	string_range_function): Take a GnmStdError, not a string.

	* src/value.c (value_error_classify): New function.

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

	* ms-excel-write.c (excel_write_map_errcode): Base on
	value_error_classify.

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

	* functions.c (validate_range_numeric_matrix): Return errors as
	GnmStdError.  All callers changed.

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

	* functions.c (database_float_range_function): Use type
	GnmStdError for error flags.
	(database_value_range_function): Ditto.
parent 127a8eb6
2002-12-16 Morten Welinder <terra@diku.dk>
* src/number-match.c (format_match_init): Don't setup error
variables any more.
(gnumeric_error_init): Delete.
* src/value.c (value_error_name): New function.
* src/parse-util.c (def_expr_name_handler): Use value_error_name
to get proper spelling of the REF error.
* src/collect.c (float_range_function, float_range_function2,
string_range_function): Take a GnmStdError, not a string.
* src/value.c (value_error_classify): New function.
* src/expr.c (gnm_expr_is_err): Take a GnmStdError, not a string.
All callers changed.
* src/value.c (value_init): Build table of translated error names.
(value_shutdown): Tear it down.
(value_new_error_NULL, value_new_error_DIV0,
......
2002-12-16 Morten Welinder <terra@diku.dk>
* src/number-match.c (format_match_init): Don't setup error
variables any more.
(gnumeric_error_init): Delete.
* src/value.c (value_error_name): New function.
* src/parse-util.c (def_expr_name_handler): Use value_error_name
to get proper spelling of the REF error.
* src/collect.c (float_range_function, float_range_function2,
string_range_function): Take a GnmStdError, not a string.
* src/value.c (value_error_classify): New function.
* src/expr.c (gnm_expr_is_err): Take a GnmStdError, not a string.
All callers changed.
* src/value.c (value_init): Build table of translated error names.
(value_shutdown): Tear it down.
(value_new_error_NULL, value_new_error_DIV0,
......
2002-12-16 Morten Welinder <terra@diku.dk>
* src/number-match.c (format_match_init): Don't setup error
variables any more.
(gnumeric_error_init): Delete.
* src/value.c (value_error_name): New function.
* src/parse-util.c (def_expr_name_handler): Use value_error_name
to get proper spelling of the REF error.
* src/collect.c (float_range_function, float_range_function2,
string_range_function): Take a GnmStdError, not a string.
* src/value.c (value_error_classify): New function.
* src/expr.c (gnm_expr_is_err): Take a GnmStdError, not a string.
All callers changed.
* src/value.c (value_init): Build table of translated error names.
(value_shutdown): Tear it down.
(value_new_error_NULL, value_new_error_DIV0,
......
2002-12-16 Morten Welinder <terra@diku.dk>
* ms-excel-write.c (excel_write_map_errcode): Base on
value_error_classify.
2002-12-16 Morten Welinder <terra@diku.dk>
* ms-excel-read.c (biff_get_error): Rename from
......
......@@ -2304,24 +2304,17 @@ excel_write_XFs (ExcelWriteState *ewb)
int
excel_write_map_errcode (Value const *v)
{
char const * const mesg = v->v_err.mesg->str;
if (!strcmp (gnumeric_err_NULL, mesg))
return 0;
if (!strcmp (gnumeric_err_DIV0, mesg))
return 7;
if (!strcmp (gnumeric_err_VALUE, mesg))
return 15;
if (!strcmp (gnumeric_err_REF, mesg))
return 23;
if (!strcmp (gnumeric_err_NAME, mesg))
return 29;
if (!strcmp (gnumeric_err_NUM, mesg))
return 36;
if (!strcmp (gnumeric_err_NA, mesg))
return 42;
switch (value_error_classify (v)) {
case GNM_ERROR_NULL: return 0;
case GNM_ERROR_DIV0: return 7;
case GNM_ERROR_VALUE: return 15;
case GNM_ERROR_REF: return 23;
default:
/* Map non-excel errors to #!NAME */
return 29;
case GNM_ERROR_NAME: return 29;
case GNM_ERROR_NUM: return 36;
case GNM_ERROR_NA: return 42;
}
}
/**
......
2002-12-16 Morten Welinder <terra@diku.dk>
* functions.c (database_float_range_function): Use type
GnmStdError for error flags.
(database_value_range_function): Ditto.
2002-11-15 Jody Goldberg <jody@gnome.org>
* Release 1.1.12
......
......@@ -154,8 +154,8 @@ database_float_range_function (FunctionEvalInfo *ei,
Value *criteria,
float_range_function_t func,
CollectFlags flags,
const char *zero_count_error,
const char *func_error)
GnmStdError zero_count_error,
GnmStdError func_error)
{
int fieldno;
GSList *criterias = NULL;
......@@ -184,14 +184,14 @@ database_float_range_function (FunctionEvalInfo *ei,
goto out;
}
if (count == 0 && zero_count_error) {
res = value_new_error (ei->pos, zero_count_error);
if (count == 0 && zero_count_error != GNM_ERROR_UNKNOWN) {
res = value_new_error_std (ei->pos, zero_count_error);
goto out;
}
err = func (vals, count, &fres);
if (err)
res = value_new_error (ei->pos, func_error);
res = value_new_error_std (ei->pos, func_error);
else
res = value_new_float (fres);
......@@ -213,8 +213,8 @@ database_value_range_function (FunctionEvalInfo *ei,
Value *criteria,
value_range_function_t func,
CollectFlags flags,
const char *zero_count_error,
const char *func_error)
GnmStdError zero_count_error,
GnmStdError func_error)
{
int fieldno;
GSList *criterias = NULL;
......@@ -242,14 +242,14 @@ database_value_range_function (FunctionEvalInfo *ei,
goto out;
}
if (count == 0 && zero_count_error) {
res = value_new_error (ei->pos, zero_count_error);
if (count == 0 && zero_count_error != GNM_ERROR_UNKNOWN) {
res = value_new_error_std (ei->pos, zero_count_error);
goto out;
}
err = func (vals, count, &res);
if (err)
res = value_new_error (ei->pos, func_error);
res = value_new_error_std (ei->pos, func_error);
out:
if (criterias)
......@@ -327,8 +327,8 @@ gnumeric_daverage (FunctionEvalInfo *ei, Value **argv)
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS |
COLLECT_IGNORE_BLANKS,
gnumeric_err_NUM,
gnumeric_err_NUM);
GNM_ERROR_NUM,
GNM_ERROR_NUM);
}
/***************************************************************************/
......@@ -399,8 +399,8 @@ gnumeric_dcount (FunctionEvalInfo *ei, Value **argv)
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS |
COLLECT_IGNORE_BLANKS,
NULL,
gnumeric_err_NUM);
GNM_ERROR_UNKNOWN,
GNM_ERROR_NUM);
}
/***************************************************************************/
......@@ -469,8 +469,8 @@ gnumeric_dcounta (FunctionEvalInfo *ei, Value **argv)
argv[2],
range_count,
COLLECT_IGNORE_BLANKS,
NULL,
gnumeric_err_NUM);
GNM_ERROR_UNKNOWN,
GNM_ERROR_NUM);
}
/***************************************************************************/
......@@ -553,8 +553,8 @@ gnumeric_dget (FunctionEvalInfo *ei, Value **argv)
argv[2],
range_first,
COLLECT_IGNORE_BLANKS,
gnumeric_err_VALUE,
gnumeric_err_NUM);
GNM_ERROR_VALUE,
GNM_ERROR_NUM);
}
static const char *help_dmax = {
......@@ -625,8 +625,8 @@ gnumeric_dmax (FunctionEvalInfo *ei, Value **argv)
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS |
COLLECT_IGNORE_BLANKS,
gnumeric_err_NUM,
gnumeric_err_NUM);
GNM_ERROR_NUM,
GNM_ERROR_NUM);
}
/***************************************************************************/
......@@ -696,8 +696,8 @@ gnumeric_dmin (FunctionEvalInfo *ei, Value **argv)
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS |
COLLECT_IGNORE_BLANKS,
gnumeric_err_NUM,
gnumeric_err_NUM);
GNM_ERROR_NUM,
GNM_ERROR_NUM);
}
/***************************************************************************/
......@@ -767,8 +767,8 @@ gnumeric_dproduct (FunctionEvalInfo *ei, Value **argv)
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS |
COLLECT_IGNORE_BLANKS,
NULL,
gnumeric_err_NUM);
GNM_ERROR_UNKNOWN,
GNM_ERROR_NUM);
}
/***************************************************************************/
......@@ -839,8 +839,8 @@ gnumeric_dstdev (FunctionEvalInfo *ei, Value **argv)
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS |
COLLECT_IGNORE_BLANKS,
NULL,
gnumeric_err_NUM);
GNM_ERROR_UNKNOWN,
GNM_ERROR_NUM);
}
/***************************************************************************/
......@@ -911,8 +911,8 @@ gnumeric_dstdevp (FunctionEvalInfo *ei, Value **argv)
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS |
COLLECT_IGNORE_BLANKS,
NULL,
gnumeric_err_NUM);
GNM_ERROR_UNKNOWN,
GNM_ERROR_NUM);
}
/***************************************************************************/
......@@ -983,8 +983,8 @@ gnumeric_dsum (FunctionEvalInfo *ei, Value **argv)
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS |
COLLECT_IGNORE_BLANKS,
NULL,
gnumeric_err_NUM);
GNM_ERROR_UNKNOWN,
GNM_ERROR_NUM);
}
/***************************************************************************/
......@@ -1055,8 +1055,8 @@ gnumeric_dvar (FunctionEvalInfo *ei, Value **argv)
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS |
COLLECT_IGNORE_BLANKS,
NULL,
gnumeric_err_NUM);
GNM_ERROR_UNKNOWN,
GNM_ERROR_NUM);
}
/***************************************************************************/
......@@ -1127,8 +1127,8 @@ gnumeric_dvarp (FunctionEvalInfo *ei, Value **argv)
COLLECT_IGNORE_STRINGS |
COLLECT_IGNORE_BOOLS |
COLLECT_IGNORE_BLANKS,
NULL,
gnumeric_err_NUM);
GNM_ERROR_UNKNOWN,
GNM_ERROR_NUM);
}
/***************************************************************************/
......
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