Commit 54665134 authored by Jody Goldberg's avatar Jody Goldberg

update function status

parent 11c3125e
......@@ -130,6 +130,8 @@ Misc stuff that should be fixed
: Check xl import of unicode names
: Check scoping changes.
: Is there such a thing as an array formula in a name ?
: Handle pasting an expression with an un-qualified sheet local name into
another sheet
- can_try_save_to uses access(). That's bogus in a number of ways: (a) it
checks the wrong permissions in the set[gu]id case. (b) It reports the
......@@ -199,13 +201,9 @@ Dialogs
-------
- Formula Guru
: Fix keyboard interface
- Import Dialog
: Rewrite main page preview (see Bug #66393)
Function Breakage
-----------------
- There are a number of #UNIMPLEMENTED! things to take care of in the
financial functions. Mostly this is due to incomplete documentation.
- Function range_min_k uses an O(n*log n) algorithm. It should use O(n)
algorithm, see Knuth.
- Functions like SUMPRODUCT need to have better support for sparse ranges.
......
2002-10-15 Jody Goldberg <jody@gnome.org>
* src/value-sheet.c (value_area_foreach) : Add CellIterFlags
2002-10-15 Christopher Benedict <cbenedic@csa.concordia.ab.ca>
* src/sheet-object-widget.c (cb_frame_config_distroy): new
......
2002-10-15 Jody Goldberg <jody@gnome.org>
* src/value-sheet.c (value_area_foreach) : Add CellIterFlags
2002-10-15 Christopher Benedict <cbenedic@csa.concordia.ab.ca>
* src/sheet-object-widget.c (cb_frame_config_distroy): new
......
2002-10-15 Jody Goldberg <jody@gnome.org>
* src/value-sheet.c (value_area_foreach) : Add CellIterFlags
2002-10-15 Christopher Benedict <cbenedic@csa.concordia.ab.ca>
* src/sheet-object-widget.c (cb_frame_config_distroy): new
......
......@@ -246,17 +246,15 @@ function.
Function Tokens
---------------
There are several function tokens to cover most situations.
f : A floating point (gnm_float) value.
s : A string (char*)
b : A boolean
r : A Range eg. A1:A5 - See 'A'
A : Either an Array or a Range: Use the
value_area set of functions to simplify the code.
see expr.h. The content of the regions are guaranteed to have been
evaluated.
S : Scalar, anything OTHER than an array or range
? : Any type, the type must be checked from value->type.
| : This designates that the arguments in the token string
following this character are optional.
With intersection and iteration support
b : boolean identical to f, Do we need this ?
f : float no errors, string conversion attempted
s : string no errors
S : scalar any scalar non-error value
E : scalar including errors
Without intersection or iteration support
r : cell range content is _NOT_ guaranteed to have been evaluated yet
A : area either range or array (range as above)
a : array
? : anything
......@@ -1694,110 +1694,114 @@ static char const *help_opt_extendible_writer = {
GnmFuncDescriptor const derivatives_functions [] = {
{ "opt_bs",
"sfffff|f","call_put_flag, spot, strike, time, rate, volatility, "
"cost_of_carry",
&help_opt_bs, opt_bs, NULL, NULL, NULL },
"sfffff|f", N_("call_put_flag, spot, strike, time, rate, volatility, cost_of_carry"),
&help_opt_bs, opt_bs, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_bs_delta",
"sffffff|f", "call_put_flag, spot, strike, time, rate, volatility, "
"cost_of_carry",
&help_opt_bs_delta, opt_bs_delta, NULL, NULL, NULL },
"sffffff|f", N_("call_put_flag, spot, strike, time, rate, volatility, cost_of_carry"),
&help_opt_bs_delta, opt_bs_delta, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_bs_rho",
"sffffff|f", "call_put_flag, spot, strike, time, rate, volatility, "
"cost_of_carry",
&help_opt_bs_rho, opt_bs_rho, NULL, NULL, NULL },
"sffffff|f", N_("call_put_flag, spot, strike, time, rate, volatility, cost_of_carry"),
&help_opt_bs_rho, opt_bs_rho, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_bs_theta",
"sffffff|f", "call_put_flag, spot, strike, time, rate, volatility, "
"cost_of_carry",
&help_opt_bs_theta, opt_bs_theta, NULL, NULL, NULL },
"sffffff|f", N_("call_put_flag, spot, strike, time, rate, volatility, cost_of_carry"),
&help_opt_bs_theta, opt_bs_theta, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_bs_gamma",
"fffff|f", "spot, strike, time, rate, volatility, cost_of_carry",
&help_opt_bs_gamma, opt_bs_gamma, NULL, NULL, NULL },
"fffff|f", N_("spot, strike, time, rate, volatility, cost_of_carry"),
&help_opt_bs_gamma, opt_bs_gamma, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_bs_vega",
"fffff|f", "spot, strike, time, rate, volatility, cost_of_carry",
&help_opt_bs_vega, opt_bs_vega, NULL, NULL, NULL },
"fffff|f", N_("spot, strike, time, rate, volatility, cost_of_carry"),
&help_opt_bs_vega, opt_bs_vega, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_bs_carrycost",
"sffffff|f", "call_put_flag, spot, strike, time, rate, volatility, "
"cost_of_carry",
&help_opt_bs_carrycost, opt_bs_carrycost, NULL, NULL, NULL },
"sffffff|f", N_("call_put_flag, spot, strike, time, rate, volatility, cost_of_carry"),
&help_opt_bs_carrycost, opt_bs_carrycost, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "cum_biv_norm_dist",
"fff", "a, b, rho",
&help_cum_biv_norm_dist, cum_biv_norm_dist, NULL, NULL, NULL },
"fff", N_("a, b, rho"),
&help_cum_biv_norm_dist, cum_biv_norm_dist, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
{ "opt_garman_kohlhagen",
"sffffff", "call_put_flag, spot, strike, time, domestic_rate, "
"foreign_rate, volatility",
&help_opt_garman_kohlhagen, opt_garman_kohlhagen, NULL, NULL, NULL },
"sffffff", N_("call_put_flag, spot, strike, time, domestic_rate, foreign_rate, volatility"),
&help_opt_garman_kohlhagen, opt_garman_kohlhagen, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_french",
"sfffffff", "call_put_flag, spot, strike, time, t2, rate, "
"volatility, cost of carry",
&help_opt_french, opt_french, NULL, NULL, NULL },
"sfffffff", N_("call_put_flag, spot, strike, time, t2, rate, volatility, cost of carry"),
&help_opt_french, opt_french, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_jump_diff",
"sfffffff", "call_put_flag, spot, strike, time, rate, volatility, "
"lambda, gamma",
&help_opt_jump_diff, opt_jump_diff, NULL, NULL, NULL },
"sfffffff", N_("call_put_flag, spot, strike, time, rate, volatility, lambda, gamma"),
&help_opt_jump_diff, opt_jump_diff, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_exec",
"sfffffff", "call_put_flag, spot, strike, time, rate, volatility, "
"cost_of_carry, lambda",
&help_opt_exec, opt_exec, NULL, NULL, NULL },
"sfffffff", N_("call_put_flag, spot, strike, time, rate, volatility, cost_of_carry, lambda"),
&help_opt_exec, opt_exec, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_bjerStens",
"sffffff", "call_put_flag, spot, strike, time, rate, cost_of_carry, "
"volatility",
&help_opt_bjerStens, opt_bjerStens, NULL, NULL, NULL },
"sffffff", N_("call_put_flag, spot, strike, time, rate, cost_of_carry, volatility"),
&help_opt_bjerStens, opt_bjerStens, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_miltersen_schwartz",
"sfffffffffffff", "call_put_flag, p_t, f_t, x, t1, t2, v_s, v_e, "
"v_f, rho_se, rho_sf, rho_ef, kappa_e, kappa_f)",
&help_opt_miltersen_schwartz, opt_miltersen_schwartz, NULL, NULL, NULL },
"sfffffffffffff", N_("call_put_flag, p_t, f_t, x, t1, t2, v_s, v_e, v_f, rho_se, rho_sf, rho_ef, kappa_e, kappa_f)"),
&help_opt_miltersen_schwartz, opt_miltersen_schwartz, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_BAW_amer",
"sffffff", "call_put_flag, spot, strike, time, rate, cost_of_carry, "
"volatility",
&help_opt_BAW_amer, opt_BAW_amer, NULL, NULL, NULL },
"sffffff", N_("call_put_flag, spot, strike, time, rate, cost_of_carry, volatility"),
&help_opt_BAW_amer, opt_BAW_amer, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_rgw",
"fffffff", "call_put_flag, spot, strike, t1, t2, rate, d, volatility",
&help_opt_rgw, opt_rgw, NULL, NULL, NULL },
"fffffff", N_("call_put_flag, spot, strike, t1, t2, rate, d, volatility"),
&help_opt_rgw, opt_rgw, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_forward_start",
"sfffffff", "call_put_flag, spot, alpha, time1, time, rate, "
"volatility, cost_of_carry",
&help_opt_forward_start, opt_forward_start, NULL, NULL, NULL },
"sfffffff", N_("call_put_flag, spot, alpha, time1, time, rate, volatility, cost_of_carry"),
&help_opt_forward_start, opt_forward_start, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_time_switch",
"sfffffffff", "call_put_flag, spot, strike, a, time, m, dt, rate, "
"cost_of_carry, volatility",
&help_opt_time_switch, opt_time_switch, NULL, NULL, NULL },
"sfffffffff", N_("call_put_flag, spot, strike, a, time, m, dt, rate, cost_of_carry, volatility"),
&help_opt_time_switch, opt_time_switch, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_simple_chooser",
"fffffff", "spot, strike, time1, time2, rate, cost_of_carry, "
"volatility",
&help_opt_simple_chooser, opt_simple_chooser, NULL, NULL, NULL },
"fffffff", N_("spot, strike, time1, time2, rate, cost_of_carry, volatility"),
&help_opt_simple_chooser, opt_simple_chooser, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_complex_chooser",
"fffffffff", "spot, strike_call, strike_put, time, time_call, "
"time_put, rate, cost_of_carry, volatility",
&help_opt_complex_chooser, opt_complex_chooser, NULL, NULL, NULL },
"fffffffff", N_("spot, strike_call, strike_put, time, time_call, time_put, rate, cost_of_carry, volatility"),
&help_opt_complex_chooser, opt_complex_chooser, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_on_options",
"sffffffff", "type_flag, spot, strike1, strike2, time1, time2, "
"rate, cost_of_carry, volatility",
&help_opt_on_options, opt_on_options, NULL, NULL, NULL },
"sffffffff", N_("type_flag, spot, strike1, strike2, time1, time2, rate, cost_of_carry, volatility"),
&help_opt_on_options, opt_on_options, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "opt_extendible_writer",
"sffffffff", "type_flag, spot, strike1, strike2, time1, time2, "
"rate, cost_of_carry, volatility",
&help_opt_extendible_writer, opt_extendible_writer, NULL, NULL, NULL },
"sffffffff", N_("type_flag, spot, strike1, strike2, time1, time2, rate, cost_of_carry, volatility"),
&help_opt_extendible_writer, opt_extendible_writer, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ NULL}
};
......@@ -1531,7 +1531,7 @@ GnmFuncDescriptor const complex_functions[] = {
{ "iminv", "S", N_("inumber"), &help_iminv,
gnumeric_iminv, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_NOT_IN_EXCEL, GNM_FUNC_TEST_STATUS_BASIC },
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
{ "imneg", "S", N_("inumber"), &help_imneg,
gnumeric_imneg, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
......
......@@ -65,6 +65,10 @@ find_cells_that_match (Sheet *sheet, Value *database,
for (row = first_row; row <= last_row; row++) {
cell = sheet_cell_get (sheet, col, row);
if (cell != NULL)
cell_eval (cell);
if (cell_is_blank (cell))
continue;
......@@ -80,6 +84,8 @@ find_cells_that_match (Sheet *sheet, Value *database,
Cell const *tmp = sheet_cell_get (sheet,
cond->column, row);
if (cell != NULL)
cell_eval (cell);
if (cell_is_blank (tmp) ||
!cond->fun (tmp->value, cond->x)) {
add_flag = FALSE;
......@@ -252,49 +258,6 @@ database_value_range_function (FunctionEvalInfo *ei,
return res;
}
/***************************************************************************/
#define DB_ARGUMENT_HELP \
"@database is a range of cells in which rows of related " \
"information are records and columns of data are fields. " \
"The first row of a database contains labels for each column. " \
"\n\n" \
"@field specifies which column is used in the function. If " \
"@field is an integer, for example. 2, the second column is used. " \
"Field can also be the label of a column. For example, ``Age'' " \
"refers to the column with the label ``Age'' in @database range. " \
"\n\n" \
"@criteria is the range of cells which contains the specified " \
"conditions. The first row of a @criteria should contain the " \
"labels of the fields for which the criterias are for. Cells " \
"below the labels specify conditions, for example, ``>3'' or " \
"``<9''. Equality condition can be given simply by specifing a " \
"value, e.g. ``3'' or ``John''. Each row in @criteria specifies " \
"a separate condition, i.e. if a row in @database matches with " \
"one of the rows in @criteria then that row is counted in " \
"(technically speaking boolean OR between the rows in " \
"@criteria). If @criteria specifies more than one columns then " \
"each of the conditions in these columns should be true that " \
"the row in @database matches (again technically speaking " \
"boolean AND between the columns in each row in @criteria). " \
"\n" \
"@EXAMPLES=\n" \
"Let us assume that the range A1:C7 contain the following " \
"values:\n" \
"Name Age Salary\n" \
"John 34 54342\n" \
"Bill 35 22343\n" \
"Clark 29 34323\n" \
"Bob 43 47242\n" \
"Susan 37 42932\n" \
"Jill 45 45324\n" \
"\n" \
"In addition, the cells A9:B11 contain the following values:\n" \
"Age Salary\n" \
"<30\n" \
">40 >46000\n"
/***************************************************************************/
static const char *help_daverage = {
......@@ -1203,6 +1166,9 @@ gnumeric_getpivotdata (FunctionEvalInfo *ei, Value **argv)
/* FIXME: Lots of stuff missing */
if (cell != NULL)
cell_eval (cell);
if (cell_is_blank (cell) ||
!VALUE_IS_NUMBER (cell->value))
return value_new_error (ei->pos, gnumeric_err_REF);
......@@ -1213,45 +1179,47 @@ gnumeric_getpivotdata (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
const GnmFuncDescriptor database_functions[] = {
{ "daverage", "r?r", N_("database,field,criteria"),
{ "daverage", "rSr", N_("database,field,criteria"),
&help_daverage, gnumeric_daverage, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "dcount", "r?r", N_("database,field,criteria"),
{ "dcount", "rSr", N_("database,field,criteria"),
&help_dcount, gnumeric_dcount, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "dcounta", "r?r", N_("database,field,criteria"),
{ "dcounta", "rSr", N_("database,field,criteria"),
&help_dcounta, gnumeric_dcounta, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "dget", "r?r", N_("database,field,criteria"),
{ "dget", "rSr", N_("database,field,criteria"),
&help_dget, gnumeric_dget, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "dmax", "r?r", N_("database,field,criteria"),
{ "dmax", "rSr", N_("database,field,criteria"),
&help_dmax, gnumeric_dmax, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "dmin", "r?r", N_("database,field,criteria"),
{ "dmin", "rSr", N_("database,field,criteria"),
&help_dmin, gnumeric_dmin, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "dproduct", "r?r", N_("database,field,criteria"),
{ "dproduct", "rSr", N_("database,field,criteria"),
&help_dproduct, gnumeric_dproduct, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "dstdev", "r?r", N_("database,field,criteria"),
{ "dstdev", "rSr", N_("database,field,criteria"),
&help_dstdev, gnumeric_dstdev, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "dstdevp", "r?r", N_("database,field,criteria"),
{ "dstdevp", "rSr", N_("database,field,criteria"),
&help_dstdevp, gnumeric_dstdevp, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "dsum", "r?r", N_("database,field,criteria"),
{ "dsum", "rSr", N_("database,field,criteria"),
&help_dsum, gnumeric_dsum, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "dvar", "r?r", N_("database,field,criteria"),
{ "dvar", "rSr", N_("database,field,criteria"),
&help_dvar, gnumeric_dvar, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "dvarp", "r?r", N_("database,field,criteria"),
{ "dvarp", "rSr", N_("database,field,criteria"),
&help_dvarp, gnumeric_dvarp, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
/* XL stores in lookup */
{ "getpivotdata", "rs", N_("pivot_table,field_name"),
&help_getpivotdata, gnumeric_getpivotdata, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_SUBSET, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
{NULL}
};
......@@ -8,7 +8,7 @@
so change most of the functions to take 'f' in place of 'S'
- remove the checks for VALUE_ERROR that is handled in func.c
- Found a missing function 'yearfrac' that was apparently
added in xl 2k. Added a tub
added in xl 2k. Added a stub
- add status
- Assign a format to some of the results
......
......@@ -1115,6 +1115,7 @@ gnumeric_networkdays (FunctionEvalInfo *ei, Value **argv)
if (argv[2] != NULL)
value_area_foreach (argv[2], ei->pos,
CELL_ITER_IGNORE_BLANK,
&networkdays_holiday_callback,
&close);
......@@ -1359,21 +1360,21 @@ GnmFuncDescriptor const datetime_functions[] = {
/* TODO UNIMPLEMENTED and UNTESTED seems new to XL 2k */
{ "yearfrac", "ff|f", N_("date"), &help_yearfrac,
gnumeric_yearfrac, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIMPLEMENTED, GNM_FUNC_TEST_STATUS_UNTESTED },
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIMPLEMENTED, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
{ "unix2date", "f", N_("unixtime"), &help_unix2date,
gnumeric_unix2date, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_NOT_IN_EXCEL, GNM_FUNC_TEST_STATUS_BASIC },
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
{ "date2unix", "f", N_("serial"), &help_date2unix,
gnumeric_date2unix, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_NOT_IN_EXCEL, GNM_FUNC_TEST_STATUS_BASIC },
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
{ "isoweeknum", "f", N_("date"), &help_isoweeknum,
gnumeric_isoweeknum, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_NOT_IN_EXCEL, GNM_FUNC_TEST_STATUS_UNTESTED },
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
{ "isoyear", "f", N_("date"), &help_isoyear,
gnumeric_isoyear, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_NOT_IN_EXCEL, GNM_FUNC_TEST_STATUS_UNTESTED },
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
{NULL}
};
......
......@@ -3763,7 +3763,7 @@ const GnmFuncDescriptor financial_functions[] = {
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "euro", "s", "currency",
&help_euro, gnumeric_euro, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_NOT_IN_EXCEL, GNM_FUNC_TEST_STATUS_BASIC },
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "euroconvert", "fss", "n,source,target",
&help_euroconvert, gnumeric_euroconvert, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
......@@ -3771,11 +3771,11 @@ const GnmFuncDescriptor financial_functions[] = {
&help_fv, gnumeric_fv, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "fvschedule", "fA", "pv,schedule",
&help_fvschedule, gnumeric_fvschedule, NULL, NULL, NULL,
&help_fvschedule, gnumeric_fvschedule, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "g_duration", "fff", "rate,pv,fv",
&help_g_duration, gnumeric_g_duration, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_NOT_IN_EXCEL, GNM_FUNC_TEST_STATUS_BASIC },
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{ "intrate", "ffff|f", "settlement,maturity,investment,redemption[,basis]",
&help_intrate, gnumeric_intrate, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
......
......@@ -163,6 +163,7 @@ retrieve_format_info (Sheet *sheet, int col, int row)
return info;
}
/* TODO : turn this into a range based routine */
static Value *
gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
{
......@@ -1824,7 +1825,7 @@ const GnmFuncDescriptor info_functions[] = {
{ "cell", "sr", N_("info_type, cell"), &help_cell,
gnumeric_cell, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_SUBSET_WITH_EXTENSIONS, GNM_FUNC_TEST_STATUS_BASIC },
{ "error.type", "S", N_("value"), &help_error_type,
{ "error.type", "E", N_("value"), &help_error_type,
gnumeric_error_type, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "info", "s", N_("info_type"), &help_info,
......@@ -1833,25 +1834,25 @@ const GnmFuncDescriptor info_functions[] = {
{ "isblank", NULL, N_("value"), &help_isblank,
NULL, gnumeric_isblank, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "iserr", "S", N_("value"), &help_iserr,
{ "iserr", "E", N_("value"), &help_iserr,
gnumeric_iserr, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "iserror", "S", N_("value"), &help_iserror,
{ "iserror", "E", N_("value"), &help_iserror,
gnumeric_iserror, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "iseven", "S", N_("value"), &help_iseven,
{ "iseven", "f", N_("value"), &help_iseven,
gnumeric_iseven, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "islogical", "S", N_("value"), &help_islogical,
{ "islogical", "f", N_("value"), &help_islogical,
gnumeric_islogical, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "isna", "S", N_("value"), &help_isna,
{ "isna", "E", N_("value"), &help_isna,
gnumeric_isna, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "isnontext", "S", N_("value"), &help_isnontext,
{ "isnontext", "E", N_("value"), &help_isnontext,
gnumeric_isnontext, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "isnumber", "S", N_("value"), &help_isnumber,
{ "isnumber", "E", N_("value"), &help_isnumber,
gnumeric_isnumber, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "isodd", "S", N_("value"), &help_isodd,
......@@ -1860,7 +1861,7 @@ const GnmFuncDescriptor info_functions[] = {
{ "isref", NULL, N_("value"), &help_isref,
NULL, gnumeric_isref, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "istext", "S", N_("value"), &help_istext,
{ "istext", "E", N_("value"), &help_istext,
gnumeric_istext, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "n", "S", N_("value"), &help_n,
......@@ -1869,7 +1870,7 @@ const GnmFuncDescriptor info_functions[] = {
{ "na", "", "", &help_na,
gnumeric_na, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "type", "S", N_("value"), &help_type,
{ "type", "E", N_("value"), &help_type,
gnumeric_type, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
......@@ -1880,13 +1881,13 @@ const GnmFuncDescriptor info_functions[] = {
{ "error", "s", N_("text"), &help_error,
gnumeric_error, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_UNTESTED },
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
{ "expression", "r", N_("cell"), &help_expression,
gnumeric_expression, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_UNTESTED },
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
{ "getenv", "s", N_("string"), &help_getenv,
gnumeric_getenv, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_UNTESTED },
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
{NULL}
};
......@@ -271,7 +271,8 @@ gnumeric_if (FunctionEvalInfo *ei, Value **args)
{
gboolean err;
int res = value_get_as_bool (args[0], &err) ? 1 : 2;
return args[res] ? value_duplicate (args[res]) : value_new_bool (TRUE);
return args[res] ?
value_duplicate (args[res]) : value_new_bool (res == 1);
}
/***************************************************************************/
......@@ -322,40 +323,39 @@ gnumeric_false (FunctionEvalInfo *ei, Value **args)
const GnmFuncDescriptor logical_functions[] = {
{ "and", 0, N_("number,number,"), &help_and, NULL,
gnumeric_and, NULL, NULL },
gnumeric_and, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "or", 0, N_("number,number,"), &help_or, NULL,
gnumeric_or, NULL, NULL },
gnumeric_or, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "not", "b", N_("number"), &help_not, gnumeric_not,
NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "if", "b|EE", N_("condition,if true,if false"), &help_if,
gnumeric_if, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "true", "", "", &help_true, gnumeric_true,
NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_EXHAUSTIVE },
{ "false", "", "", &help_false, gnumeric_false,
NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_EXHAUSTIVE },
/* not in XL */
{ "xor", 0, N_("number,number,"), &help_xor, NULL,
gnumeric_xor, NULL, NULL },
{ "not", "b", N_("number"), &help_not, gnumeric_not, NULL, NULL, NULL },
{ "if", "b|SS", N_("condition,if true,if false"), &help_if,
gnumeric_if, NULL, NULL, NULL },
{ "true", "", "", &help_true, gnumeric_true, NULL, NULL, NULL },
{ "false", "", "", &help_false, gnumeric_false, NULL, NULL, NULL },
gnumeric_xor, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_BASIC },
{NULL}
};
/* FIXME: Should be merged into the above. */
static const struct {
const char *func;
AutoFormatTypes typ;
} af_info[] = {
{ "if", AF_FIRST_ARG_FORMAT2 },
{ NULL, AF_UNKNOWN }
};
void
plugin_init (void)
{
int i;
for (i = 0; af_info[i].func; i++)
auto_format_function_result_by_name (af_info[i].func, af_info[i].typ);
}
void
plugin_cleanup (void)
{
int i;
for (i = 0; af_info[i].func; i++)
auto_format_function_result_remove (af_info[i].func);
}
......@@ -1181,36 +1181,53 @@ gnumeric_transpose (FunctionEvalInfo *ei, Value **argv)
const GnmFuncDescriptor lookup_functions[] = {
{ "address", "ff|ffs", N_("row_num,col_num,abs_num,a1,text"),
&help_address, gnumeric_address, NULL, NULL, NULL },
&help_address, gnumeric_address, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_EXHAUSTIVE },
{ "areas", 0, N_("reference"),
&help_areas, NULL, gnumeric_areas, NULL, NULL },
&help_areas, NULL, gnumeric_areas, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "choose", 0, N_("index,value,"),
&help_choose, NULL, gnumeric_choose, NULL, NULL },
&help_choose, NULL, gnumeric_choose, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "column", "|A", N_("ref"),
&help_column, gnumeric_column, NULL, NULL, NULL },
&help_column, gnumeric_column, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "columns", "A", N_("ref"),
&help_columns, gnumeric_columns, NULL, NULL, NULL },
{ "hlookup", "?Af|bb", N_("val,range,col_idx,approx,as_index"),
&help_hlookup, gnumeric_hlookup, NULL, NULL, NULL },
&help_columns, gnumeric_columns, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "hlookup", "SAf|bb", N_("val,range,col_idx,approx,as_index"),
&help_hlookup, gnumeric_hlookup, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "hyperlink", "s|s", N_("link_location, label"),
&help_hyperlink, gnumeric_hyperlink, NULL, NULL, NULL },
&help_hyperlink, gnumeric_hyperlink, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_SUBSET, GNM_FUNC_TEST_STATUS_BASIC },
{ "indirect", "s|b",N_("ref_string,format"),
&help_indirect, gnumeric_indirect, NULL, NULL, NULL },
&help_indirect, gnumeric_indirect, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "index", "A|fff",N_("reference,row,col,area"),
&help_index, NULL, gnumeric_index, NULL, NULL },
{ "lookup", "?A|r", N_("val,range,range"),
&help_lookup, gnumeric_lookup, NULL, NULL, NULL },
{ "match", "?A|f", N_("val,range,approx"),
&help_match, gnumeric_match, NULL, NULL, NULL },
&help_index, NULL, gnumeric_index, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "lookup", "SA|r", N_("val,range,range"),
&help_lookup, gnumeric_lookup, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
{ "match", "SA|f", N_("val,range,approx"),