Commit 1c5eefaa authored by Morten Welinder's avatar Morten Welinder

Large batch of fixes. Improves types of gnumeric_*, fixes leaks and

crashes.  Fixes parts of column/row insert/delete.
parent 6e7e4987
1999-04-29 Morten Welinder <terra@diku.dk>
* src/expr.h (OPER_ANY_BINARY, OPER_ANY_UNARY): new convenience
macros.
(struct _Sheet): declare forward reference so we can use the right
types.
(CellRef, FunctionDefinition, expr_parse_string, expr_decode_tree,
eval_expr): use "struct _Sheet *".
* src/workbook.c (workbook_do_destroy): Carefully clean workbook
before deleting sheets. Do things in the standard way. Get rid
of clipboard leak.
(insert_cols_cmd): Fix name string.
(workbook_detach_sheet): New parameter "force". All callers
changed.
(workbook_fixup_references, workbook_invalidate_references,
workbook_sheets): New functions.
* src/sheet.c (sheet_verify_selection_simple): Mark strings for
translation.
(sheet_insert_col): Fixup references to moved cells.
(sheet_delete_col, sheet_delete_row): Invalidate references to
deleted cells.
* src/sheet-autofill.c (fill_item_new): Fix copying of cell with
error.
* src/parser.y (yylex): "const" fixes.
(gnumeric_expr_parser): New function (to fix memory corruption and
leaks).
* src/fn-stat.c (i1mach): Make static.
(gnumeric_var, gnumeric_varp, gnumeric_stdev, gnumeric_stdevp,
gnumeric_rank, gnumeric_trimmean, gnumeric_covar, gnumeric_correl,
gnumeric_mode, gnumeric_harmean, gnumeric_geomean, gnumeric_count,
gnumeric_counta, gnumeric_average, gnumeric_min, gnumeric_max,
gnumeric_skew, gnumeric_kurt, gnumeric_avedev, gnumeric_devsq,
gnumeric_pearson, gnumeric_rsq, gnumeric_median, gnumeric_large,
gnumeric_small, gnumeric_ztest): Fix type.
* src/fn-math.c (gnumeric_fact, gnumeric_combin): Mark strings for
translation.
(gnumeric_sum, gnumeric_trunc): Fix type.
* src/fn-lookup.c (gnumeric_choose, gnumeric_column,
gnumeric_row): Fix type.
* src/fn-misc.c (gnumeric_iserror): Fix type.
* src/fn-sheet.c (gnumeric_selection): Fix type.
* src/fn-string.c (gnumeric_concatenate): Fix type.
* src/fn-logical.c (gnumeric_and, gnumeric_not, gnumeric_or,
gnumeric_if): Fix type.
* src/fn-financial.c (gnumeric_npv): Fix type.
* src/expr.c (expr_parse_string): Move in part to parser.y.
Delete global variables to communicate.
(do_expr_tree_ref, do_expr_tree_unref, do_expr_decode_tree,
do_expr_tree_relocate): use OPER_ANY_BINARY and OPER_ANY_UNARY.
(function_call_with_values): Mark strings for translation.
(eval_expr, do_expr_decode_tree, expr_decode_tree): Fix type to
use "Sheet *" instead of "void *".
(do_expr_decode_tree): Free sum.
(expr_tree_invalidate_references, expr_tree_fixup_references): New
functions. Not implemented yet.
* src/cell.c (cell_set_formula): "const" fix.
(cell_copy): Ref entered_string also if it exists.
(cell_relocate): Unlink cell from workbook list of cells.
* src/about.c (dialog_about): Add myself. Update copyright.
1999-04-29 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-{math,sheet,logical}.c, src/func.[ch]: Moved logical
......
1999-04-29 Morten Welinder <terra@diku.dk>
* src/expr.h (OPER_ANY_BINARY, OPER_ANY_UNARY): new convenience
macros.
(struct _Sheet): declare forward reference so we can use the right
types.
(CellRef, FunctionDefinition, expr_parse_string, expr_decode_tree,
eval_expr): use "struct _Sheet *".
* src/workbook.c (workbook_do_destroy): Carefully clean workbook
before deleting sheets. Do things in the standard way. Get rid
of clipboard leak.
(insert_cols_cmd): Fix name string.
(workbook_detach_sheet): New parameter "force". All callers
changed.
(workbook_fixup_references, workbook_invalidate_references,
workbook_sheets): New functions.
* src/sheet.c (sheet_verify_selection_simple): Mark strings for
translation.
(sheet_insert_col): Fixup references to moved cells.
(sheet_delete_col, sheet_delete_row): Invalidate references to
deleted cells.
* src/sheet-autofill.c (fill_item_new): Fix copying of cell with
error.
* src/parser.y (yylex): "const" fixes.
(gnumeric_expr_parser): New function (to fix memory corruption and
leaks).
* src/fn-stat.c (i1mach): Make static.
(gnumeric_var, gnumeric_varp, gnumeric_stdev, gnumeric_stdevp,
gnumeric_rank, gnumeric_trimmean, gnumeric_covar, gnumeric_correl,
gnumeric_mode, gnumeric_harmean, gnumeric_geomean, gnumeric_count,
gnumeric_counta, gnumeric_average, gnumeric_min, gnumeric_max,
gnumeric_skew, gnumeric_kurt, gnumeric_avedev, gnumeric_devsq,
gnumeric_pearson, gnumeric_rsq, gnumeric_median, gnumeric_large,
gnumeric_small, gnumeric_ztest): Fix type.
* src/fn-math.c (gnumeric_fact, gnumeric_combin): Mark strings for
translation.
(gnumeric_sum, gnumeric_trunc): Fix type.
* src/fn-lookup.c (gnumeric_choose, gnumeric_column,
gnumeric_row): Fix type.
* src/fn-misc.c (gnumeric_iserror): Fix type.
* src/fn-sheet.c (gnumeric_selection): Fix type.
* src/fn-string.c (gnumeric_concatenate): Fix type.
* src/fn-logical.c (gnumeric_and, gnumeric_not, gnumeric_or,
gnumeric_if): Fix type.
* src/fn-financial.c (gnumeric_npv): Fix type.
* src/expr.c (expr_parse_string): Move in part to parser.y.
Delete global variables to communicate.
(do_expr_tree_ref, do_expr_tree_unref, do_expr_decode_tree,
do_expr_tree_relocate): use OPER_ANY_BINARY and OPER_ANY_UNARY.
(function_call_with_values): Mark strings for translation.
(eval_expr, do_expr_decode_tree, expr_decode_tree): Fix type to
use "Sheet *" instead of "void *".
(do_expr_decode_tree): Free sum.
(expr_tree_invalidate_references, expr_tree_fixup_references): New
functions. Not implemented yet.
* src/cell.c (cell_set_formula): "const" fix.
(cell_copy): Ref entered_string also if it exists.
(cell_relocate): Unlink cell from workbook list of cells.
* src/about.c (dialog_about): Add myself. Update copyright.
1999-04-29 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-{math,sheet,logical}.c, src/func.[ch]: Moved logical
......
1999-04-29 Morten Welinder <terra@diku.dk>
* src/expr.h (OPER_ANY_BINARY, OPER_ANY_UNARY): new convenience
macros.
(struct _Sheet): declare forward reference so we can use the right
types.
(CellRef, FunctionDefinition, expr_parse_string, expr_decode_tree,
eval_expr): use "struct _Sheet *".
* src/workbook.c (workbook_do_destroy): Carefully clean workbook
before deleting sheets. Do things in the standard way. Get rid
of clipboard leak.
(insert_cols_cmd): Fix name string.
(workbook_detach_sheet): New parameter "force". All callers
changed.
(workbook_fixup_references, workbook_invalidate_references,
workbook_sheets): New functions.
* src/sheet.c (sheet_verify_selection_simple): Mark strings for
translation.
(sheet_insert_col): Fixup references to moved cells.
(sheet_delete_col, sheet_delete_row): Invalidate references to
deleted cells.
* src/sheet-autofill.c (fill_item_new): Fix copying of cell with
error.
* src/parser.y (yylex): "const" fixes.
(gnumeric_expr_parser): New function (to fix memory corruption and
leaks).
* src/fn-stat.c (i1mach): Make static.
(gnumeric_var, gnumeric_varp, gnumeric_stdev, gnumeric_stdevp,
gnumeric_rank, gnumeric_trimmean, gnumeric_covar, gnumeric_correl,
gnumeric_mode, gnumeric_harmean, gnumeric_geomean, gnumeric_count,
gnumeric_counta, gnumeric_average, gnumeric_min, gnumeric_max,
gnumeric_skew, gnumeric_kurt, gnumeric_avedev, gnumeric_devsq,
gnumeric_pearson, gnumeric_rsq, gnumeric_median, gnumeric_large,
gnumeric_small, gnumeric_ztest): Fix type.
* src/fn-math.c (gnumeric_fact, gnumeric_combin): Mark strings for
translation.
(gnumeric_sum, gnumeric_trunc): Fix type.
* src/fn-lookup.c (gnumeric_choose, gnumeric_column,
gnumeric_row): Fix type.
* src/fn-misc.c (gnumeric_iserror): Fix type.
* src/fn-sheet.c (gnumeric_selection): Fix type.
* src/fn-string.c (gnumeric_concatenate): Fix type.
* src/fn-logical.c (gnumeric_and, gnumeric_not, gnumeric_or,
gnumeric_if): Fix type.
* src/fn-financial.c (gnumeric_npv): Fix type.
* src/expr.c (expr_parse_string): Move in part to parser.y.
Delete global variables to communicate.
(do_expr_tree_ref, do_expr_tree_unref, do_expr_decode_tree,
do_expr_tree_relocate): use OPER_ANY_BINARY and OPER_ANY_UNARY.
(function_call_with_values): Mark strings for translation.
(eval_expr, do_expr_decode_tree, expr_decode_tree): Fix type to
use "Sheet *" instead of "void *".
(do_expr_decode_tree): Free sum.
(expr_tree_invalidate_references, expr_tree_fixup_references): New
functions. Not implemented yet.
* src/cell.c (cell_set_formula): "const" fix.
(cell_copy): Ref entered_string also if it exists.
(cell_relocate): Unlink cell from workbook list of cells.
* src/about.c (dialog_about): Add myself. Update copyright.
1999-04-29 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-{math,sheet,logical}.c, src/func.[ch]: Moved logical
......
1999-04-29 Morten Welinder <terra@diku.dk>
* src/expr.h (OPER_ANY_BINARY, OPER_ANY_UNARY): new convenience
macros.
(struct _Sheet): declare forward reference so we can use the right
types.
(CellRef, FunctionDefinition, expr_parse_string, expr_decode_tree,
eval_expr): use "struct _Sheet *".
* src/workbook.c (workbook_do_destroy): Carefully clean workbook
before deleting sheets. Do things in the standard way. Get rid
of clipboard leak.
(insert_cols_cmd): Fix name string.
(workbook_detach_sheet): New parameter "force". All callers
changed.
(workbook_fixup_references, workbook_invalidate_references,
workbook_sheets): New functions.
* src/sheet.c (sheet_verify_selection_simple): Mark strings for
translation.
(sheet_insert_col): Fixup references to moved cells.
(sheet_delete_col, sheet_delete_row): Invalidate references to
deleted cells.
* src/sheet-autofill.c (fill_item_new): Fix copying of cell with
error.
* src/parser.y (yylex): "const" fixes.
(gnumeric_expr_parser): New function (to fix memory corruption and
leaks).
* src/fn-stat.c (i1mach): Make static.
(gnumeric_var, gnumeric_varp, gnumeric_stdev, gnumeric_stdevp,
gnumeric_rank, gnumeric_trimmean, gnumeric_covar, gnumeric_correl,
gnumeric_mode, gnumeric_harmean, gnumeric_geomean, gnumeric_count,
gnumeric_counta, gnumeric_average, gnumeric_min, gnumeric_max,
gnumeric_skew, gnumeric_kurt, gnumeric_avedev, gnumeric_devsq,
gnumeric_pearson, gnumeric_rsq, gnumeric_median, gnumeric_large,
gnumeric_small, gnumeric_ztest): Fix type.
* src/fn-math.c (gnumeric_fact, gnumeric_combin): Mark strings for
translation.
(gnumeric_sum, gnumeric_trunc): Fix type.
* src/fn-lookup.c (gnumeric_choose, gnumeric_column,
gnumeric_row): Fix type.
* src/fn-misc.c (gnumeric_iserror): Fix type.
* src/fn-sheet.c (gnumeric_selection): Fix type.
* src/fn-string.c (gnumeric_concatenate): Fix type.
* src/fn-logical.c (gnumeric_and, gnumeric_not, gnumeric_or,
gnumeric_if): Fix type.
* src/fn-financial.c (gnumeric_npv): Fix type.
* src/expr.c (expr_parse_string): Move in part to parser.y.
Delete global variables to communicate.
(do_expr_tree_ref, do_expr_tree_unref, do_expr_decode_tree,
do_expr_tree_relocate): use OPER_ANY_BINARY and OPER_ANY_UNARY.
(function_call_with_values): Mark strings for translation.
(eval_expr, do_expr_decode_tree, expr_decode_tree): Fix type to
use "Sheet *" instead of "void *".
(do_expr_decode_tree): Free sum.
(expr_tree_invalidate_references, expr_tree_fixup_references): New
functions. Not implemented yet.
* src/cell.c (cell_set_formula): "const" fix.
(cell_copy): Ref entered_string also if it exists.
(cell_relocate): Unlink cell from workbook list of cells.
* src/about.c (dialog_about): Add myself. Update copyright.
1999-04-29 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-{math,sheet,logical}.c, src/func.[ch]: Moved logical
......
......@@ -426,10 +426,9 @@ callback_function_npv (Sheet *sheet, Value *value, char **error_string, void *cl
}
static Value *
gnumeric_npv (void *tsheet, GList *expr_node_list, int eval_col, int eval_row, char **error_string)
gnumeric_npv (Sheet *sheet, GList *expr_node_list, int eval_col, int eval_row, char **error_string)
{
financial_npv_t p;
Sheet *sheet = (Sheet *) tsheet;
p.first = TRUE;
p.sum = 0.0;
......
......@@ -64,11 +64,10 @@ callback_function_and (Sheet *sheet, Value *value,
}
static Value *
gnumeric_and (void *tsheet, GList *expr_node_list,
gnumeric_and (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
Value *result;
Sheet *sheet = (Sheet *) tsheet;
result = g_new (Value, 1);
result->type = VALUE_INTEGER;
......@@ -158,11 +157,10 @@ callback_function_or (Sheet *sheet, Value *value,
}
static Value *
gnumeric_or (void *tsheet, GList *expr_node_list,
gnumeric_or (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
Value *result;
Sheet *sheet = (Sheet *) tsheet;
result = g_new (Value, 1);
result->type = VALUE_INTEGER;
......@@ -196,7 +194,7 @@ static char *help_if = {
};
static Value *
gnumeric_if (void *tsheet, GList *expr_node_list,
gnumeric_if (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
ExprTree *expr;
......@@ -211,7 +209,7 @@ gnumeric_if (void *tsheet, GList *expr_node_list,
}
/* Compute the if part */
value = eval_expr (tsheet, (ExprTree *) expr_node_list->data,
value = eval_expr (sheet, (ExprTree *) expr_node_list->data,
eval_col, eval_row, error_string);
if (value == NULL)
return NULL;
......@@ -236,7 +234,7 @@ gnumeric_if (void *tsheet, GList *expr_node_list,
}
/* Return the result */
return eval_expr (tsheet, (ExprTree *) expr, eval_col,
return eval_expr (sheet, (ExprTree *) expr, eval_col,
eval_row, error_string);
}
......
......@@ -28,7 +28,7 @@ static char *help_choose = {
};
static Value *
gnumeric_choose (void *tsheet, GList *expr_node_list, int eval_col, int eval_row, char **error_string)
gnumeric_choose (Sheet *sheet, GList *expr_node_list, int eval_col, int eval_row, char **error_string)
{
int index;
int argc;
......@@ -42,7 +42,7 @@ gnumeric_choose (void *tsheet, GList *expr_node_list, int eval_col, int eval_row
*error_string = _("#ARG!");
return NULL;
}
v = eval_expr (tsheet, l->data, eval_col, eval_row, error_string);
v = eval_expr (sheet, l->data, eval_col, eval_row, error_string);
if (!v) return NULL;
if (v->type != VALUE_INTEGER &&
v->type != VALUE_FLOAT) {
......@@ -55,7 +55,7 @@ gnumeric_choose (void *tsheet, GList *expr_node_list, int eval_col, int eval_row
while (l) {
index--;
if (!index)
return eval_expr (tsheet, l->data, eval_col, eval_row, error_string);
return eval_expr (sheet, l->data, eval_col, eval_row, error_string);
l = g_list_next (l);
}
*error_string = _("#VALUE!");
......@@ -306,23 +306,23 @@ static char *help_column = {
/* FIXME: Needs Array support to be enven slightly meaningful */
static Value *
gnumeric_column (void *tsheet, GList *expr_node_list, int eval_col, int eval_row, char **error_string)
gnumeric_column (Sheet *sheet, GList *expr_node_list, int eval_col, int eval_row, char **error_string)
{
Value *v;
if (!expr_node_list || !expr_node_list->data)
return value_int (eval_col+1);
v = eval_expr (tsheet, expr_node_list->data, eval_col, eval_row, error_string);
v = eval_expr (sheet, expr_node_list->data, eval_col, eval_row, error_string);
if (!v)
return NULL;
switch (v->type){
case VALUE_CELLRANGE:
*error_string = "Arrays not yet supported";
*error_string = _("Arrays not yet supported");
return NULL;
case VALUE_ARRAY:
*error_string = _("Unimplemented\n");
*error_string = _("Unimplemented");
return NULL;
default:
*error_string = _("#VALUE!");
......@@ -405,23 +405,23 @@ static char *help_row = {
/* FIXME: Needs Array support to be enven slightly meaningful */
static Value *
gnumeric_row (void *tsheet, GList *expr_node_list, int eval_col, int eval_row, char **error_string)
gnumeric_row (Sheet *sheet, GList *expr_node_list, int eval_col, int eval_row, char **error_string)
{
Value *v;
if (!expr_node_list || !expr_node_list->data)
return value_int (eval_row+1);
v = eval_expr (tsheet, expr_node_list->data, eval_col, eval_row, error_string);
v = eval_expr (sheet, expr_node_list->data, eval_col, eval_row, error_string);
if (!v)
return NULL;
switch (v->type){
case VALUE_CELLRANGE:
*error_string = "Arrays not yet supported";
*error_string = _("Arrays not yet supported");
return NULL;
case VALUE_ARRAY:
*error_string = _("Unimplemented\n");
*error_string = _("Unimplemented");
return NULL;
default:
*error_string = _("#VALUE!");
......@@ -459,7 +459,3 @@ FunctionDefinition lookup_functions [] = {
{ "vlookup", "?Af|b","val,range,col_idx,approx", &help_vlookup, NULL, gnumeric_vlookup },
{ NULL, NULL }
};
......@@ -13,7 +13,6 @@
#include "utils.h"
#include "func.h"
#if 0
/* help template */
static char *help_ = {
......@@ -446,12 +445,12 @@ gnumeric_fact (struct FunctionDefinition *id,
i = argv [0]->v.v_int;
break;
default:
*error_string = "#NUM!";
*error_string = _("#NUM!");
return NULL;
}
if (i < 0){
*error_string = "#NUM!";
*error_string = _("#NUM!");
return NULL;
}
......@@ -499,7 +498,7 @@ gnumeric_combin (struct FunctionDefinition *id,
n = argv [0]->v.v_int;
k = argv [1]->v.v_int;
} else {
*error_string = "#NUM!";
*error_string = _("#NUM!");
return NULL;
}
......@@ -882,11 +881,10 @@ callback_function_sum (Sheet *sheet, Value *value,
}
Value *
gnumeric_sum (void *tsheet, GList *expr_node_list,
gnumeric_sum (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
Value *result;
Sheet *sheet = (Sheet *) tsheet;
result = g_new (Value, 1);
result->type = VALUE_INTEGER;
......@@ -1141,7 +1139,7 @@ static char *help_trunc = {
"@SEEALSO=")
};
static Value *
gnumeric_trunc (void *tsheet, GList *expr_node_list,
gnumeric_trunc (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
Value *number;
......@@ -1154,7 +1152,7 @@ gnumeric_trunc (void *tsheet, GList *expr_node_list,
return NULL;
}
number = eval_expr (tsheet, (ExprTree *) expr_node_list->data,
number = eval_expr (sheet, (ExprTree *) expr_node_list->data,
eval_col, eval_row, error_string);
if (!number)
return NULL;
......@@ -1165,7 +1163,7 @@ gnumeric_trunc (void *tsheet, GList *expr_node_list,
if (args == 2){
Value *value;
value = eval_expr (tsheet,
value = eval_expr (sheet,
(ExprTree *) expr_node_list->next->data,
eval_col, eval_row, error_string);
if (!value){
......
......@@ -176,7 +176,8 @@ pgamma(double x, double p, double scale)
* (src/nmath/i1match.c) written and copyrighted (1998) by Ross Ihaka.
* Modified for Gnumeric by Jukka-Pekka Iivonen
*/
int i1mach(int i)
static int
i1mach (int i)
{
switch(i) {
case 1:
......@@ -650,11 +651,10 @@ static char *help_varp = {
};
static Value *
gnumeric_varp (void *tsheet, GList *expr_node_list, int eval_col,
gnumeric_varp (Sheet *sheet, GList *expr_node_list, int eval_col,
int eval_row, char **error_string)
{
stat_closure_t cl;
Sheet *sheet = (Sheet *) tsheet;
float_t ans, num;
setup_stat_closure (&cl);
......@@ -685,11 +685,10 @@ static char *help_var = {
};
static Value *
gnumeric_var (void *tsheet, GList *expr_node_list, int eval_col,
gnumeric_var (Sheet *sheet, GList *expr_node_list, int eval_col,
int eval_row, char **error_string)
{
stat_closure_t cl;
Sheet *sheet = (Sheet *) tsheet;
float_t ans, num;
setup_stat_closure (&cl);
......@@ -716,10 +715,10 @@ static char *help_stdev = {
};
static Value *
gnumeric_stdev (void *tsheet, GList *expr_node_list, int eval_col,
gnumeric_stdev (Sheet *sheet, GList *expr_node_list, int eval_col,
int eval_row, char **error_string)
{
Value *ans = gnumeric_var (tsheet, expr_node_list, eval_col, eval_row, error_string);
Value *ans = gnumeric_var (sheet, expr_node_list, eval_col, eval_row, error_string);
if (ans && (ans->type == VALUE_FLOAT))
ans->v.v_float = sqrt (ans->v.v_float);
......@@ -740,10 +739,10 @@ static char *help_stdevp = {
};
static Value *
gnumeric_stdevp (void *tsheet, GList *expr_node_list, int eval_col,
gnumeric_stdevp (Sheet *sheet, GList *expr_node_list, int eval_col,
int eval_row, char **error_string)
{
Value *ans = gnumeric_varp (tsheet, expr_node_list, eval_col, eval_row, error_string);
Value *ans = gnumeric_varp (sheet, expr_node_list, eval_col, eval_row, error_string);
if (ans && (ans->type == VALUE_FLOAT))
ans->v.v_float = sqrt (ans->v.v_float);
......@@ -867,11 +866,10 @@ callback_function_rank (Sheet *sheet, Value *value,
}
static Value *
gnumeric_rank (void *tsheet, GList *expr_node_list,
gnumeric_rank (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
stat_rank_t p;
Sheet *sheet = (Sheet *) tsheet;
GSList *list;
int order, rank;
......@@ -966,11 +964,10 @@ callback_function_trimmean (Sheet *sheet, Value *value,
}
static Value *
gnumeric_trimmean (void *tsheet, GList *expr_node_list,
gnumeric_trimmean (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
stat_trimmean_t p;
Sheet *sheet = (Sheet *) tsheet;
GSList *list;
int trim_count, n, count;
float_t sum;
......@@ -1085,18 +1082,17 @@ callback_function_covar (Sheet *sheet, Value *value,
}
static Value *
gnumeric_covar (void *tsheet, GList *expr_node_list,
gnumeric_covar (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
stat_covar_t pr;
Sheet *sheet = (Sheet *) tsheet;
float_t sum, mean1, mean2;
int count;
GSList *list1, *list2;
pr.first = TRUE;
count = value_get_as_int (gnumeric_count
(tsheet, expr_node_list, eval_col, eval_row, error_string));
(sheet, expr_node_list, eval_col, eval_row, error_string));
if (count % 2 > 0){
*error_string = _("#NUM!");
......@@ -1211,18 +1207,17 @@ callback_function_correl (Sheet *sheet, Value *value,
}
static Value *
gnumeric_correl (void *tsheet, GList *expr_node_list,
gnumeric_correl (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
stat_correl_t pr;
Sheet *sheet = (Sheet *) tsheet;
float_t sum, tmp;
int count;
GSList *list1, *list2;
pr.first = TRUE;
count = value_get_as_int(gnumeric_count
(tsheet, expr_node_list, eval_col, eval_row, error_string));
(sheet, expr_node_list, eval_col, eval_row, error_string));
if (count % 2 > 0){
*error_string = _("#NUM!");
return NULL;
......@@ -1592,12 +1587,11 @@ callback_function_mode (Sheet *sheet, Value *value,
}
static Value *
gnumeric_mode (void *tsheet, GList *expr_node_list,
gnumeric_mode (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
GSList *tmp;
stat_mode_t pr;
Sheet *sheet = (Sheet *) tsheet;
pr.first = TRUE;
......@@ -1626,11 +1620,10 @@ gnumeric_mode (void *tsheet, GList *expr_node_list,
}
static Value *
gnumeric_harmean (void *tsheet, GList *expr_node_list,
gnumeric_harmean (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
stat_inv_sum_t pr;
Sheet *sheet = (Sheet *) tsheet;
float_t ans, num;
pr.first = TRUE;
......@@ -1689,11 +1682,10 @@ callback_function_stat_prod (Sheet *sheet, Value *value,
}
static Value *
gnumeric_geomean (void *tsheet, GList *expr_node_list,
gnumeric_geomean (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
stat_prod_t pr;
Sheet *sheet = (Sheet *) tsheet;
float_t ans, num;
pr.first = TRUE;
......@@ -1744,11 +1736,10 @@ callback_function_count (Sheet *sheet, Value *value,
}
Value *
gnumeric_count (void *tsheet, GList *expr_node_list,
gnumeric_count (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
Value *result;
Sheet *sheet = (Sheet *) tsheet;
result = g_new (Value, 1);
result->type = VALUE_INTEGER;
......@@ -1792,12 +1783,11 @@ closure)
return TRUE;
}
Value *
gnumeric_counta (void *tsheet, GList *expr_node_list,
static Value *
gnumeric_counta (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
Value *result;
Sheet *sheet = (Sheet *) tsheet;
result = g_new (Value, 1);
result->type = VALUE_INTEGER;
......@@ -1823,19 +1813,19 @@ static char *help_average = {
};
Value *
gnumeric_average (void *tsheet, GList *expr_node_list,
gnumeric_average (Sheet *sheet, GList *expr_node_list,
int eval_col, int eval_row, char **error_string)
{
Value *result;
Value *sum, *count;