Commit d5ca094d authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

eval_expr now takes an EvalPosition rather than a FunctionEvalInfo.


2000-01-13  Jody Goldberg <jgoldberg@home.com>

	* *.[ch] : eval_expr now takes an EvalPosition rather than a FunctionEvalInfo.

	* src/workbook.c (workbook_set_title) : Moved to workbook_view_set_title.
	(workbook_new) : Use workbook_view_set_size.
parent 0b2ea3c7
2000-01-13 Jody Goldberg <jgoldberg@home.com>
* *.[ch] : eval_expr now takes an EvalPosition rather than a FunctionEvalInfo.
* src/workbook.c (workbook_set_title) : Moved to workbook_view_set_title.
(workbook_new) : Use workbook_view_set_size.
2000-01-13 Sergey Panov <sipan@mit.edu>
* src/functions(fn-eng.c fn-financial.c fn-logical.c
......@@ -5,7 +12,6 @@
Applied patches from Valek Filippov <frob@df.ru> ---
correcting format of the function descr. messages.
2000-01-13 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/dialogs/dialog-autosave.c: Implemented ``Auto Save'' tool.
......
2000-01-13 Jody Goldberg <jgoldberg@home.com>
* *.[ch] : eval_expr now takes an EvalPosition rather than a FunctionEvalInfo.
* src/workbook.c (workbook_set_title) : Moved to workbook_view_set_title.
(workbook_new) : Use workbook_view_set_size.
2000-01-13 Sergey Panov <sipan@mit.edu>
* src/functions(fn-eng.c fn-financial.c fn-logical.c
......@@ -5,7 +12,6 @@
Applied patches from Valek Filippov <frob@df.ru> ---
correcting format of the function descr. messages.
2000-01-13 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/dialogs/dialog-autosave.c: Implemented ``Auto Save'' tool.
......
2000-01-13 Jody Goldberg <jgoldberg@home.com>
* ms-excel-read.c (ms_excel_read_workbook) : Move magic scale hack
into a single #define. Use workbook_view_set_size.
2000-01-10 Jody Goldberg <jgoldberg@home.com>
* ms-obj.c (ms_read_TXO) : Return the string generated rather than
......
......@@ -22,6 +22,7 @@
#include "ranges.h"
#include "ms-excel-util.h"
#include "ms-excel-xf.h"
#include "workbook-view.h"
/* #define NO_DEBUG_EXCEL */
......@@ -45,6 +46,11 @@ static ExcelSheet *ms_excel_sheet_new (ExcelWorkbook *wb,
static void ms_excel_workbook_attach (ExcelWorkbook *wb,
ExcelSheet *ans);
/* FIXME : MS quotes its measurments in 'pts' but scales that
* to the screen somehow. This is a crude approximation
* just scales things by 1.4.
*/
#define MAGIC_ZOOM 1.4
void
ms_excel_unexpected_biff (BiffQuery *q, char const *const state)
......@@ -1934,7 +1940,7 @@ ms_excel_sheet_new (ExcelWorkbook *wb, const char *name)
/* HACK HACK HACK : default zoom to 1.4 for now.
* See SCL for details.
*/
sheet_set_zoom_factor (ans->gnum_sheet, 1.4);
sheet_set_zoom_factor (ans->gnum_sheet, MAGIC_ZOOM);
ans->wb = wb;
ans->obj_queue = NULL;
......@@ -3295,7 +3301,7 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
* the points -> pixels depending on the monitor size.
* Pick a quick scale factor to avoid looking really ugly.
*/
sheet_set_zoom_factor (sheet->gnum_sheet, zoom*1.4);
sheet_set_zoom_factor (sheet->gnum_sheet, zoom*MAGIC_ZOOM);
} else
g_warning ("Duff BIFF_SCL record");
break;
......@@ -3875,8 +3881,6 @@ ms_excel_read_workbook (Workbook *workbook, MsOle *file)
case BIFF_WINDOW1 : /* 0 NOT 1 */
if (q->length >= 16) {
int const screen_width = gdk_screen_width ();
int const screen_height = gdk_screen_height ();
#if 0
/* In 1/20ths of a point */
guint16 const xPos = MS_OLE_GET_GUINT16(q->data + 0);
......@@ -3894,16 +3898,9 @@ ms_excel_read_workbook (Workbook *workbook, MsOle *file)
guint16 const ratio = MS_OLE_GET_GUINT32(q->data + 16);
#endif
/* FIXME : MS quotes its measurments in 'pts' but scales that
* to the screen somehow. This is a crude approximation
* that assumes that it uses the resolution of the screen and
* scales relative to an 800x600 screen.
*/
gtk_window_set_default_size (GTK_WINDOW (wb->gnum_wb->toplevel),
MIN (screen_width - 64,
(screen_width * width)/(800 * 20)),
MIN (screen_height - 64,
(screen_height*height)/(600 * 20)));
workbook_view_set_size (wb->gnum_wb,
width*MAGIC_ZOOM / 20.,
height*MAGIC_ZOOM / 20.);
if (options & 0x0001)
printf ("Unsupported : Hidden sheet\n");
......
......@@ -635,7 +635,7 @@ make_inter_sheet_ref_v7 (ExcelWorkbook *wb, guint16 extn_idx,
static Value *
unknownFunctionHandler (FunctionEvalInfo *ei, GList *expr_node_list)
{
return value_new_error (&ei->pos, gnumeric_err_NAME);
return value_new_error (ei->pos, gnumeric_err_NAME);
}
static Symbol *
......
......@@ -425,15 +425,15 @@ gnumeric_daverage (FunctionEvalInfo *ei, Value **argv)
database = argv[0];
criteria = argv[2];
field = find_column_of_field (&ei->pos, database, argv[1]);
field = find_column_of_field (ei->pos, database, argv[1]);
if (field < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
criterias = parse_database_criteria (&ei->pos, database, criteria);
criterias = parse_database_criteria (ei->pos, database, criteria);
if (criterias == NULL)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
cells = find_cells_that_match (&ei->pos, database, field, criterias);
cells = find_cells_that_match (ei->pos, database, field, criterias);
current = cells;
count = 0;
......@@ -486,15 +486,15 @@ gnumeric_dcount (FunctionEvalInfo *ei, Value **argv)
database = argv[0];
criteria = argv[2];
field = find_column_of_field (&ei->pos, database, argv[1]);
field = find_column_of_field (ei->pos, database, argv[1]);
if (field < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
criterias = parse_database_criteria (&ei->pos, database, criteria);
criterias = parse_database_criteria (ei->pos, database, criteria);
if (criterias == NULL)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
cells = find_cells_that_match (&ei->pos, database, field, criterias);
cells = find_cells_that_match (ei->pos, database, field, criterias);
current = cells;
count = 0;
......@@ -544,15 +544,15 @@ gnumeric_dcounta (FunctionEvalInfo *ei, Value **argv)
database = argv[0];
criteria = argv[2];
field = find_column_of_field (&ei->pos, database, argv[1]);
field = find_column_of_field (ei->pos, database, argv[1]);
if (field < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
criterias = parse_database_criteria (&ei->pos, database, criteria);
criterias = parse_database_criteria (ei->pos, database, criteria);
if (criterias == NULL)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
cells = find_cells_that_match (&ei->pos, database, field, criterias);
cells = find_cells_that_match (ei->pos, database, field, criterias);
current = cells;
count = 0;
......@@ -604,17 +604,17 @@ gnumeric_dget (FunctionEvalInfo *ei, Value **argv)
database = argv[0];
criteria = argv[2];
field = find_column_of_field (&ei->pos, database, argv[1]);
field = find_column_of_field (ei->pos, database, argv[1]);
if (field < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
criterias = parse_database_criteria (&ei->pos, database, criteria);
criterias = parse_database_criteria (ei->pos, database, criteria);
if (criterias == NULL)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
cells = find_cells_that_match (&ei->pos, database, field, criterias);
cells = find_cells_that_match (ei->pos, database, field, criterias);
current = cells;
count = 0;
......@@ -629,10 +629,10 @@ gnumeric_dget (FunctionEvalInfo *ei, Value **argv)
free_criterias(criterias);
if (count == 0)
return value_new_error (&ei->pos, gnumeric_err_VALUE);
return value_new_error (ei->pos, gnumeric_err_VALUE);
if (count > 1)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_duplicate (cell->value);
}
......@@ -669,17 +669,17 @@ gnumeric_dmax (FunctionEvalInfo *ei, Value **argv)
database = argv[0];
criteria = argv[2];
field = find_column_of_field (&ei->pos, database, argv[1]);
field = find_column_of_field (ei->pos, database, argv[1]);
if (field < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
criterias = parse_database_criteria (&ei->pos, database, criteria);
criterias = parse_database_criteria (ei->pos, database, criteria);
if (criterias == NULL)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
cells = find_cells_that_match (&ei->pos, database, field, criterias);
cells = find_cells_that_match (ei->pos, database, field, criterias);
if (cells == NULL)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
current = cells;
cell = current->data;
......@@ -734,18 +734,18 @@ gnumeric_dmin (FunctionEvalInfo *ei, Value **argv)
database = argv[0];
criteria = argv[2];
field = find_column_of_field (&ei->pos, database, argv[1]);
field = find_column_of_field (ei->pos, database, argv[1]);
if (field < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
criterias = parse_database_criteria (&ei->pos, database, criteria);
criterias = parse_database_criteria (ei->pos, database, criteria);
if (criterias == NULL)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
cells = find_cells_that_match (&ei->pos, database, field, criterias);
cells = find_cells_that_match (ei->pos, database, field, criterias);
if (cells == NULL) {
free_criterias (criterias);
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
}
current = cells;
......@@ -800,20 +800,20 @@ gnumeric_dproduct (FunctionEvalInfo *ei, Value **argv)
database = argv[0];
criteria = argv[2];
field = find_column_of_field (&ei->pos, database, argv[1]);
field = find_column_of_field (ei->pos, database, argv[1]);
if (field < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
criterias = parse_database_criteria (&ei->pos, database, criteria);
criterias = parse_database_criteria (ei->pos, database, criteria);
if (criterias == NULL)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
cells = find_cells_that_match (&ei->pos, database, field, criterias);
cells = find_cells_that_match (ei->pos, database, field, criterias);
if (cells == NULL) {
free_criterias (criterias);
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
}
current = cells;
......@@ -866,17 +866,17 @@ gnumeric_dstdev (FunctionEvalInfo *ei, Value **argv)
database = argv[0];
criteria = argv[2];
field = find_column_of_field (&ei->pos, database, argv[1]);
field = find_column_of_field (ei->pos, database, argv[1]);
if (field < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
criterias = parse_database_criteria (&ei->pos, database, criteria);
criterias = parse_database_criteria (ei->pos, database, criteria);
if (criterias == NULL)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
cells = find_cells_that_match (&ei->pos, database, field, criterias);
cells = find_cells_that_match (ei->pos, database, field, criterias);
if (cells == NULL)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
current = cells;
setup_stat_closure (&p);
......@@ -893,7 +893,7 @@ gnumeric_dstdev (FunctionEvalInfo *ei, Value **argv)
free_criterias(criterias);
if (p.N - 1 == 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_float (sqrt(p.Q / (p.N - 1)));
}
......@@ -929,18 +929,18 @@ gnumeric_dstdevp (FunctionEvalInfo *ei, Value **argv)
database = argv[0];
criteria = argv[2];
field = find_column_of_field (&ei->pos, database, argv[1]);
field = find_column_of_field (ei->pos, database, argv[1]);
if (field < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
criterias = parse_database_criteria (&ei->pos, database, criteria);
criterias = parse_database_criteria (ei->pos, database, criteria);
if (criterias == NULL)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
cells = find_cells_that_match (&ei->pos, database, field, criterias);
cells = find_cells_that_match (ei->pos, database, field, criterias);
if (cells == NULL) {
free_criterias (criterias);
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
}
current = cells;
......@@ -958,7 +958,7 @@ gnumeric_dstdevp (FunctionEvalInfo *ei, Value **argv)
free_criterias(criterias);
if (p.N == 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_float (sqrt(p.Q / p.N));
}
......@@ -994,18 +994,18 @@ gnumeric_dsum (FunctionEvalInfo *ei, Value **argv)
database = argv[0];
criteria = argv[2];
field = find_column_of_field (&ei->pos, database, argv[1]);
field = find_column_of_field (ei->pos, database, argv[1]);
if (field < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
criterias = parse_database_criteria (&ei->pos, database, criteria);
criterias = parse_database_criteria (ei->pos, database, criteria);
if (criterias == NULL)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
cells = find_cells_that_match (&ei->pos, database, field, criterias);
cells = find_cells_that_match (ei->pos, database, field, criterias);
if (cells == NULL) {
free_criterias (criterias);
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
}
current = cells;
......@@ -1058,18 +1058,18 @@ gnumeric_dvar (FunctionEvalInfo *ei, Value **argv)
database = argv[0];
criteria = argv[2];
field = find_column_of_field (&ei->pos, database, argv[1]);
field = find_column_of_field (ei->pos, database, argv[1]);
if (field < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
criterias = parse_database_criteria (&ei->pos, database, criteria);
criterias = parse_database_criteria (ei->pos, database, criteria);
if (criterias == NULL)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
cells = find_cells_that_match (&ei->pos, database, field, criterias);
cells = find_cells_that_match (ei->pos, database, field, criterias);
if (cells == NULL) {
free_criterias (criterias);
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
}
current = cells;
......@@ -1087,7 +1087,7 @@ gnumeric_dvar (FunctionEvalInfo *ei, Value **argv)
free_criterias(criterias);
if (p.N - 1 == 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_float (p.Q / (p.N - 1));
}
......@@ -1123,20 +1123,20 @@ gnumeric_dvarp (FunctionEvalInfo *ei, Value **argv)
database = argv[0];
criteria = argv[2];
field = find_column_of_field (&ei->pos, database, argv[1]);
field = find_column_of_field (ei->pos, database, argv[1]);
if (field < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
criterias = parse_database_criteria (&ei->pos, database, criteria);
criterias = parse_database_criteria (ei->pos, database, criteria);
if (criterias == NULL)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
cells = find_cells_that_match (&ei->pos, database, field, criterias);
cells = find_cells_that_match (ei->pos, database, field, criterias);
if (cells == NULL) {
free_criterias (criterias);
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
}
current = cells;
......@@ -1154,7 +1154,7 @@ gnumeric_dvarp (FunctionEvalInfo *ei, Value **argv)
free_criterias(criterias);
if (p.N == 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_float (p.Q / p.N);
}
......@@ -1183,18 +1183,18 @@ gnumeric_getpivotdata (FunctionEvalInfo *ei, Value **argv)
int col, row;
Cell *cell;
col = find_column_of_field (&ei->pos, argv[0], argv[1]);
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 (ei->pos, gnumeric_err_REF);
row = argv[0]->v.cell_range.cell_b.row;
cell = sheet_cell_get(ei->pos.sheet, col, row);
cell = sheet_cell_get(ei->pos->sheet, col, row);
/* FIXME: Lots of stuff missing */
if (cell == NULL || cell->value == NULL ||
!VALUE_IS_NUMBER(cell->value))
return value_new_error (&ei->pos, gnumeric_err_REF);
return value_new_error (ei->pos, gnumeric_err_REF);
return value_new_float (value_get_as_float(cell->value));
}
......
......@@ -106,7 +106,7 @@ gnumeric_date (FunctionEvalInfo *ei, Value **argv)
year += 1900;
if (!g_date_valid_dmy(1, month, year))
return value_new_error (&ei->pos, _("Invalid month or year"));
return value_new_error (ei->pos, _("Invalid month or year"));
g_date_clear(&date, 1);
......@@ -118,7 +118,7 @@ gnumeric_date (FunctionEvalInfo *ei, Value **argv)
g_date_subtract_days (&date, -day + 1);
if (!g_date_valid(&date))
return value_new_error (&ei->pos, _("Invalid day"));
return value_new_error (ei->pos, _("Invalid day"));
v = value_new_int (g_date_serial (&date));
......@@ -180,7 +180,7 @@ gnumeric_edate (FunctionEvalInfo *ei, Value **argv)
date = g_date_new_serial (serial);
if (!g_date_valid(date))
return value_new_error (&ei->pos, gnumeric_err_VALUE);
return value_new_error (ei->pos, gnumeric_err_VALUE);
if (months > 0)
g_date_add_months (date, months);
......@@ -188,7 +188,7 @@ gnumeric_edate (FunctionEvalInfo *ei, Value **argv)
g_date_subtract_months (date, -months);
if (!g_date_valid(date))
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
res = value_new_int (g_date_serial (date));
g_date_free (date);
......@@ -555,7 +555,7 @@ gnumeric_days360 (FunctionEvalInfo *ei, Value **argv)
method = value_get_as_bool (argv[2], &err) ? METHOD_EUROPE :
METHOD_US;
if (err)
return value_new_error (&ei->pos, _("Unsupported method"));
return value_new_error (ei->pos, _("Unsupported method"));
} else
method = METHOD_US;
......@@ -638,7 +638,7 @@ gnumeric_eomonth (FunctionEvalInfo *ei, Value **argv)
GDate *date = get_date (argv[0]);
if (date == NULL || !g_date_valid(date))
return value_new_error (&ei->pos, gnumeric_err_VALUE);
return value_new_error (ei->pos, gnumeric_err_VALUE);
if (argv[1] != NULL)
months = value_get_as_int (argv[1]);
......@@ -683,13 +683,13 @@ gnumeric_workday (FunctionEvalInfo *ei, Value **argv)
GDate *date = get_date (argv[0]);
if (date == NULL || !g_date_valid(date))
return value_new_error (&ei->pos, gnumeric_err_VALUE);
return value_new_error (ei->pos, gnumeric_err_VALUE);
weekday = g_date_weekday(date);
days = value_get_as_int (argv[1]);
if (argv[2] != NULL)
return value_new_error (&ei->pos, _("Unimplemented"));
return value_new_error (ei->pos, _("Unimplemented"));
/* FIXME : How to deal with starting dates that are weekends
* or holidays ?? */
......@@ -817,13 +817,13 @@ gnumeric_networkdays (FunctionEvalInfo *ei, Value **argv)
start_serial = get_serial_weekday (start_serial, &start_offset);
end_serial = get_serial_weekday (end_serial, &end_offset);
if (start_serial < 0 || end_serial < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
res = end_serial - start_serial;
res -= ((res/7)*2); /* Remove weekends */
if (argv[2] != NULL) {
value_area_foreach (&ei->pos, argv[2],
value_area_foreach (ei->pos, argv[2],
&networkdays_holiday_callback,
&close);
}
......
......@@ -54,7 +54,7 @@ val_to_base (FunctionEvalInfo *ei, Value **argv, int num_argv,
int digit;
if (src_base <= 1 || dest_base <= 1 || dest_base > 36)
return value_new_error (&ei->pos, _("Base error"));
return value_new_error (ei->pos, _("Base error"));
value = argv[0];
if (num_argv > 1)
......@@ -64,7 +64,7 @@ val_to_base (FunctionEvalInfo *ei, Value **argv, int num_argv,
if (val_places) {
if (!VALUE_IS_NUMBER (val_places))
return value_new_error (&ei->pos, gnumeric_err_VALUE);
return value_new_error (ei->pos, gnumeric_err_VALUE);
places = value_get_as_int (val_places);
} else
places = 0;
......@@ -90,12 +90,12 @@ val_to_base (FunctionEvalInfo *ei, Value **argv, int num_argv,
break;
case VALUE_EMPTY:
default:
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
}
v = strtol (str, &err, src_base);
if (*err)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
b10 = pow (src_base, 10);
if (v >= b10 / 2) /* N's complement */
......@@ -117,7 +117,7 @@ val_to_base (FunctionEvalInfo *ei, Value **argv, int num_argv,
if (places > max)
max = places;
if (max >= sizeof (buffer))
return value_new_error (&ei->pos, _("Unimplemented"));
return value_new_error (ei->pos, _("Unimplemented"));
for (digit = max - 1; digit >= 0; digit--) {
int thisdigit;
......@@ -467,7 +467,7 @@ gnumeric_besseli (FunctionEvalInfo *ei, Value **argv)
order = value_get_as_float (argv[1]); /* the order */
if (order < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
result = bessel_i (x, order, 1.0);
return value_new_float (result);
......@@ -507,7 +507,7 @@ gnumeric_besselk (FunctionEvalInfo *ei, Value **argv)
order = value_get_as_float (argv[1]); /* the order */
if (order < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
result = bessel_k (x, order, 1.0);
return value_new_float (result);
......@@ -544,7 +544,7 @@ gnumeric_besselj (FunctionEvalInfo *ei, Value **argv)
y = value_get_as_int (argv [1]);
if (y < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_float (jn (y, value_get_as_float (argv [0])));
}
......@@ -580,10 +580,10 @@ gnumeric_bessely (FunctionEvalInfo *ei, Value **argv)
argv[1]->type != VALUE_INTEGER &&
argv[0]->type != VALUE_FLOAT &&
argv[1]->type != VALUE_FLOAT)
return value_new_error (&ei->pos, gnumeric_err_VALUE);
return value_new_error (ei->pos, gnumeric_err_VALUE);
if ((y = value_get_as_int (argv [1])) < 0)
return value_new_error (&ei->pos, gnumeric_err_NUM);
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_float (yn (y, value_get_as_float (argv [0])));
}
......@@ -664,7 +664,7 @@ gnumeric_complex (FunctionEvalInfo *ei, Value **argv)
if (strcmp(suffix, "i") != 0 &&
strcmp(suffix, "j") != 0)
return value_new_error (&ei->pos, gnumeric_err_VALUE);
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_complex (&c, *suffix);
}
......@@ -695,7 +695,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 (ei->pos, gnumeric_err_VALUE);
return value_new_float (c.im);
}
......@@ -726,7 +726,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 (ei->pos, gnumeric_err_VALUE);
return value_new_float (c.re);
}
......@@ -754,10 +754,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 (ei->pos, gnumeric_err_VALUE);
if (argv [0]->type != VALUE_STRING)
return value_new_error (&ei->pos, gnumeric_err_VALUE);
return value_new_error (ei->pos, gnumeric_err_VALUE);
return value_new_float (complex_mod (&c));
}
......@@ -784,10 +784,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 (ei->pos, gnumeric_err_VALUE);
if (argv[0]->type != VALUE_STRING)
return value_new_error (&ei->pos, gnumeric_err_VALUE);
return value_new_error (ei->pos, gnumeric_err_VALUE);
complex_conj (&res, &c);
return value_new_complex (&res, imunit);
......@@ -815,7 +815,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 (ei->pos, gnumeric_err_VALUE);
complex_cos (&res, &c);
return value_new_complex (&res, imunit);
......@@ -842,7 +842,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 (ei->pos, gnumeric_err_VALUE);
complex_tan (&res, &c);
return value_new_complex