Commit 81a70b0f authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Bug 3670

1999-12-09  Jody Goldberg <jgoldberg@home.com>

	* src/eval.[ch] (cell_add_explicit_dependency) : New function.

	* src/functions/fn-lookup.c (gnumeric_indirect) : Clear all
	  dependencies the calling cell has and regenerate them anytime the
	  function is called.  This is somewhat wasteful but is IMO a better
	  space time trade off than penalizing all depends to be able to flag
	  which dep is an indirection dep.

	  This method will cause problems if multiple indirection calls are
	  used in a single expression.
parent 7a5c8d8e
1999-12-09 Jody Goldberg <jgoldberg@home.com>
* src/eval.[ch] (cell_add_explicit_dependency) : New function.
* src/functions/fn-lookup.c (gnumeric_indirect) : Clear all
dependencies the calling cell has and regenerate them anytime the
function is called. This is somewhat wasteful but is IMO a better
space time trade off than penalizing all depends to be able to flag
which dep is an indirection dep. This method may cause problems if
multiple indirection calls are using in a single expression.
1999-12-08 Jon K Hellan <hellan@acm.org>
* src/style.h: Declare style_font_equal, style_font_hash_func.
......
1999-12-09 Jody Goldberg <jgoldberg@home.com>
* src/eval.[ch] (cell_add_explicit_dependency) : New function.
* src/functions/fn-lookup.c (gnumeric_indirect) : Clear all
dependencies the calling cell has and regenerate them anytime the
function is called. This is somewhat wasteful but is IMO a better
space time trade off than penalizing all depends to be able to flag
which dep is an indirection dep. This method may cause problems if
multiple indirection calls are using in a single expression.
1999-12-08 Jon K Hellan <hellan@acm.org>
* src/style.h: Declare style_font_equal, style_font_hash_func.
......
......@@ -11,7 +11,7 @@
#include "numbers.h"
#include "utils.h"
#include "func.h"
#include "eval.h"
/***************************************************************************/
......@@ -657,7 +657,7 @@ gnumeric_indirect (FunctionEvalInfo *ei, Value **args)
{
char* text;
gboolean a1_style;
Cell *cell;
Cell *dest_cell, *calling_cell;
CellRef ref;
int col, row;
gboolean error = FALSE;
......@@ -686,12 +686,28 @@ gnumeric_indirect (FunctionEvalInfo *ei, Value **args)
cell_get_abs_col_row (&ref, ei->pos.eval_col, ei->pos.eval_row,
&col, &row);
cell = sheet_cell_get (ei->pos.sheet, col, row);
if (!cell)
dest_cell = sheet_cell_get (ei->pos.sheet, col, row);
/* This is not terribly pretty. We really just want to remove the
* dependency on the indirected cell. However, that would require a
* space penalty to be paid by all dependancies to flag which depend was
* a result of the indirection. So I propose that we just clear all
* deps from this cell and then add them again.
*
* FIXME FIXME FIXME : This will not work for multiple indirection calls
* in a single expression.
*/
calling_cell = sheet_cell_get (ei->pos.sheet,
ei->pos.eval_col, ei->pos.eval_row);
cell_drop_dependencies (calling_cell);
cell_add_dependencies (calling_cell);
cell_add_explicit_dependency (calling_cell, &ref);
if (!dest_cell)
return value_new_int (0);
else
return value_duplicate (cell->value);
return value_duplicate (dest_cell->value);
}
......
......@@ -312,6 +312,13 @@ cell_add_dependencies (Cell *cell)
add_tree_deps (cell, cell->parsed_node);
}
/* Explicitly add a dependency */
void
cell_add_explicit_dependency (Cell *cell, CellRef const *a)
{
add_cell_range_deps (cell, a, a);
}
/*
* List used by cell_drop_dependencies and dependency_remove_cell
* to accumulate all of the "dead" DependencyRange structures.
......
......@@ -22,7 +22,10 @@ typedef struct {
} DependencyRange;
/* Registers all of the dependencies this cell has */
void cell_add_dependencies (Cell *cell);
void cell_add_dependencies (Cell *cell);
/* Explicitly add a dependency */
void cell_add_explicit_dependency (Cell *cell, CellRef const *a);
/* Removes this cell from the list of dependencies */
void cell_drop_dependencies (Cell *cell);
......
......@@ -312,6 +312,13 @@ cell_add_dependencies (Cell *cell)
add_tree_deps (cell, cell->parsed_node);
}
/* Explicitly add a dependency */
void
cell_add_explicit_dependency (Cell *cell, CellRef const *a)
{
add_cell_range_deps (cell, a, a);
}
/*
* List used by cell_drop_dependencies and dependency_remove_cell
* to accumulate all of the "dead" DependencyRange structures.
......
......@@ -22,7 +22,10 @@ typedef struct {
} DependencyRange;
/* Registers all of the dependencies this cell has */
void cell_add_dependencies (Cell *cell);
void cell_add_dependencies (Cell *cell);
/* Explicitly add a dependency */
void cell_add_explicit_dependency (Cell *cell, CellRef const *a);
/* Removes this cell from the list of dependencies */
void cell_drop_dependencies (Cell *cell);
......
......@@ -11,7 +11,7 @@
#include "numbers.h"
#include "utils.h"
#include "func.h"
#include "eval.h"
/***************************************************************************/
......@@ -657,7 +657,7 @@ gnumeric_indirect (FunctionEvalInfo *ei, Value **args)
{
char* text;
gboolean a1_style;
Cell *cell;
Cell *dest_cell, *calling_cell;
CellRef ref;
int col, row;
gboolean error = FALSE;
......@@ -686,12 +686,28 @@ gnumeric_indirect (FunctionEvalInfo *ei, Value **args)
cell_get_abs_col_row (&ref, ei->pos.eval_col, ei->pos.eval_row,
&col, &row);
cell = sheet_cell_get (ei->pos.sheet, col, row);
if (!cell)
dest_cell = sheet_cell_get (ei->pos.sheet, col, row);
/* This is not terribly pretty. We really just want to remove the
* dependency on the indirected cell. However, that would require a
* space penalty to be paid by all dependancies to flag which depend was
* a result of the indirection. So I propose that we just clear all
* deps from this cell and then add them again.
*
* FIXME FIXME FIXME : This will not work for multiple indirection calls
* in a single expression.
*/
calling_cell = sheet_cell_get (ei->pos.sheet,
ei->pos.eval_col, ei->pos.eval_row);
cell_drop_dependencies (calling_cell);
cell_add_dependencies (calling_cell);
cell_add_explicit_dependency (calling_cell, &ref);
if (!dest_cell)
return value_new_int (0);
else
return value_duplicate (cell->value);
return value_duplicate (dest_cell->value);
}
......
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