Commit 680c2888 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

suppress warning. (solver_performance_report) : fix typo.

2002-03-22  Jody Goldberg <jody@gnome.org>

	* reports-write.c (solver_program_report) : suppress warning.
	(solver_performance_report) : fix typo.

2002-03-21  Jody Goldberg <jody@gnome.org>

	* Massive rename
	eval.[ch] -> dependent.[ch]
parent 7dadba75
......@@ -2,6 +2,7 @@
* Massive rename
ExprTree -> GnmExpr
eval.[ch] -> dependent.[ch]
* src/print-info.c (load_formats) : suppress some warnings.
......
......@@ -2,6 +2,7 @@
* Massive rename
ExprTree -> GnmExpr
eval.[ch] -> dependent.[ch]
* src/print-info.c (load_formats) : suppress some warnings.
......
......@@ -2,6 +2,7 @@
* Massive rename
ExprTree -> GnmExpr
eval.[ch] -> dependent.[ch]
* src/print-info.c (load_formats) : suppress some warnings.
......
......@@ -49,9 +49,9 @@ the cells there.
2.1 Evaluation queue vs. recursion
There are two ways in which a cell's recalculation can occur. Firstly
simply traversing the ExprTree (expr.h) will result in many cells being
evaluated. Essentialy each dereference in the ExprTree ( eg. =A1 ) will cause
the re-calculation of A1's ExprTree before we can continue ( recursively ).
simply traversing the GnmExpr (expr.h) will result in many cells being
evaluated. Essentialy each dereference in the GnmExpr ( eg. =A1 ) will cause
the re-calculation of A1's GnmExpr before we can continue ( recursively ).
This is actually fairly expensive when the expression contains a reference like
=sum(a1:a65535)
Each dependent can be in two states
......@@ -118,23 +118,23 @@ could be obviated by creating depended cells, but this would be inelegant.
4. How dependencies are generated and removed
The dependencies are both generated and mostly removed by the
handle_tree_deps function. This traverses the ExprTree either adding or
handle_tree_deps function. This traverses the GnmExpr either adding or
removing dependencies on cells as they are met.
4.1 Handling ExprTrees
The ExprTree is recursively traversed by handle_tree_deps and may
The GnmExpr is recursively traversed by handle_tree_deps and may
terminate with handle_value_deps terminating in either adding or removing
dependencies, according to the 'add' parameter.
4.2 Removal of dependencies
The removal of single dependencies is performed by traversing the
ExprTree again, this saves a search of every cell in the dependency hash
GnmExpr again, this saves a search of every cell in the dependency hash
looking for this Cell's position. This relies on sheet_cell_remove_from_hash,
and sheet_cell_add_to_hash dropping and adding dependencies, and
formula_unlink / link when a cell's formula is changed, since the original
ExprTree is needed to remove its dependencies correctly. The current code
GnmExpr is needed to remove its dependencies correctly. The current code
implements this correctly internaly, but this needs bearing in mind if
extensive work is done to cell.c.
......@@ -180,10 +180,10 @@ evaluation ), and waited on safely. Since each cell is evaluated but once
per re-calc, it would then be safe to read the Cell's value when it dissapeared
from the eval_queue.
5.3 ExprTree recursion
5.3 GnmExpr recursion
Whether it is always entirely neccessary to re-evaluate a cell solely
on the basis that it is in the ExprTree is non-obvious to me. Clearly if this
on the basis that it is in the GnmExpr is non-obvious to me. Clearly if this
cell is in the dependency queue it would make perfect sense, however if there
is as yet no chance that this cell has been changed, it makes little sense
to re-calculate it ( and its tree'd dependencies ). The only problem here is
......
......@@ -27,7 +27,7 @@
#include <func.h>
#include <parse-util.h>
#include <eval.h>
#include <dependent.h>
#include <cell.h>
#include <str.h>
#include <sheet.h>
......
......@@ -69,10 +69,10 @@ GNUMERIC_BASE = \
dates.h \
datetime.c \
datetime.h \
dependent.h \
dependent.c \
error-info.c \
error-info.h \
eval.h \
eval.c \
expr.c \
expr.h \
expr-impl.h \
......
......@@ -2,7 +2,7 @@
#define GNUMERIC_CELL_H
#include "gnumeric.h"
#include "eval.h"
#include "dependent.h"
typedef enum {
/* MUST BE > 0xFFFFFF for Dependent */
......
......@@ -12,7 +12,7 @@
#include "sheet.h"
#include "sheet-style.h"
#include "sheet-merge.h"
#include "eval.h"
#include "dependent.h"
#include "selection.h"
#include "application.h"
#include "rendered-value.h"
......
......@@ -31,7 +31,7 @@
#include "cell.h"
#include "expr.h"
#include "expr-impl.h"
#include "eval.h"
#include "dependent.h"
#include "selection.h"
#include "parse-util.h"
#include "ranges.h"
......
......@@ -37,7 +37,7 @@
#include "workbook.h"
#include "ranges.h"
#include "sort.h"
#include "eval.h"
#include "dependent.h"
#include "value.h"
#include "expr.h"
#include "cell.h"
......
......@@ -24,7 +24,7 @@
#include "consolidate.h"
#include "cell.h"
#include "eval.h"
#include "dependent.h"
#include "expr.h"
#include "func.h"
#include "position.h"
......
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* eval.c: Manage calculation dependencies between objects
* dependent.c: Manage calculation dependencies between objects
*
* Copyright (C) 2000-2002
* Jody Goldberg (jody@gnome.org)
......@@ -21,22 +21,18 @@
*/
#include <gnumeric-config.h>
#include "gnumeric.h"
#include "eval.h"
#include "dependent.h"
#include "parse-util.h"
#include "ranges.h"
#include "value.h"
#include "main.h"
#include "workbook-control.h"
#include "workbook-view.h"
#include "workbook-private.h"
#include "cell.h"
#include "sheet.h"
#include "expr.h"
#include "expr-impl.h"
#include "expr-name.h"
#include "cell.h"
#include "func.h"
#include "sheet.h"
#include "rendered-value.h"
#include "workbook-view.h"
#include "workbook-private.h"
#include "rendered-value.h" /* FIXME : should not be needed with JIT-R */
#include "ranges.h"
#define BUCKET_SIZE 128
......
......@@ -29,7 +29,7 @@
#include <cell.h>
#include <sheet.h>
#include <expr.h>
#include <eval.h>
#include <dependent.h>
#include <format.h>
#include <value.h>
#include <mstyle.h>
......
......@@ -27,7 +27,7 @@
#include <workbook-control-gui.h>
#include <gui-util.h>
#include <clipboard.h>
#include <eval.h>
#include <dependent.h>
#include <libgnome/gnome-i18n.h>
......
This diff is collapsed.
#ifndef GNUMERIC_EVAL_H
#define GNUMERIC_EVAL_H
#include "gnumeric.h"
#include <stdio.h>
struct _Dependent
{
guint flags;
Sheet *sheet;
GnmExpr const *expression;
/* Double-linked list. */
struct _Dependent *next_dep, *prev_dep;
};
typedef struct {
void (*eval) (Dependent *dep);
void (*set_expr) (Dependent *dep, GnmExpr const *new_expr);
void (*debug_name) (Dependent const *dep, FILE *out);
} DependentClass;
typedef enum {
DEPENDENT_NO_FLAG = 0,
/* Types */
DEPENDENT_CELL = 0x00000001,
DEPENDENT_TYPE_MASK = 0x00000fff,
/* Linked into the workbook wide expression list */
DEPENDENT_IS_LINKED = 0x00001000,
DEPENDENT_NEEDS_RECALC = 0x00002000,
DEPENDENT_BEING_CALCULATED = 0x00004000,
/* Dependent is in the midst of a cyclic calculation */
DEPENDENT_BEING_ITERATED = 0x00008000,
DEPENDENT_GOES_INTERSHEET = 0x00010000,
DEPENDENT_GOES_INTERBOOK = 0x00020000,
DEPENDENT_HAS_3D = 0x00040000,
DEPENDENT_ALWAYS_UNLINK = 0x00080000,
DEPENDENT_LINK_FLAGS = 0x000ff000,
/* An internal utility flag */
DEPENDENT_FLAGGED = 0x00100000
} DependentFlags;
#define dependent_type(dep) ((dep)->flags & DEPENDENT_TYPE_MASK)
#define dependent_is_cell(dep) (dependent_type (dep) == DEPENDENT_CELL)
#define dependent_needs_recalc(dep) ((dep)->flags & DEPENDENT_NEEDS_RECALC)
#define dependent_is_linked(dep) ((dep)->flags & DEPENDENT_IS_LINKED)
struct _DependencyContainer {
Dependent *dependent_list;
/* Large ranges hashed on 'range' to accelerate duplicate culling. This
* is tranversed by g_hash_table_foreach mostly.
*/
GHashTable **range_hash;
/* Single ranges, this maps an EvalPos * to a GSList of its
* dependencies.
*/
GHashTable *single_hash;
/* All of the ExprNames that refer to this sheet */
GHashTable *names;
};
typedef void (*DepFunc) (Dependent *dep, gpointer user);
guint32 dependent_type_register (DependentClass const *klass);
void dependent_types_init (void);
void dependent_types_shutdown (void);
void dependent_set_expr (Dependent *dependent, GnmExpr const *new_expr);
void dependent_set_sheet (Dependent *dependent, Sheet *sheet);
void dependent_link (Dependent *dep, CellPos const *pos);
void dependent_unlink (Dependent *dep, CellPos const *pos);
gboolean dependent_eval (Dependent *dep);
void cb_dependent_queue_recalc (Dependent *dep, gpointer ignore);
GSList *dependents_relocate (GnmExprRelocateInfo const *info);
void dependents_unrelocate (GSList *info);
void dependents_unrelocate_free (GSList *info);
void cell_queue_recalc (Cell const *cell);
void cell_foreach_dep (Cell const *cell, DepFunc func, gpointer user);
void cell_eval (Cell *cell);
void sheet_region_queue_recalc (Sheet const *sheet, Range const *range);
/* Do we need this ?
void sheet_foreach_dep (Sheet *sheet, DepFunc func, gpointer user);
*/
void sheet_deps_destroy (Sheet *sheet);
void workbook_deps_destroy (Workbook *wb);
void workbook_queue_all_recalc (Workbook *wb);
DependencyContainer *dependency_data_new (void);
void sheet_dump_dependencies (Sheet const *sheet);
void dependent_debug_name (Dependent const *dep, FILE *out);
#define DEPENDENT_CONTAINER_FOREACH_DEPENDENT(dc, dep, code) \
do { \
Dependent *dep = (dc)->dependent_list; \
while (dep) { \
Dependent *_next = dep->next_dep; \
code; \
dep = _next; \
} \
} while (0)
#define DEPENDENT_MAKE_TYPE(t, set_expr_handler) \
guint \
t ## _get_dep_type (void) \
{ \
static guint32 type = 0; \
if (type == 0) { \
static DependentClass klass; \
klass.eval = &t ## _eval; \
klass.set_expr = set_expr_handler; \
klass.debug_name = &t ## _debug_name; \
type = dependent_type_register (&klass); \
} \
return type; \
}
#endif /* GNUMERIC_EVAL_H */
......@@ -11,7 +11,7 @@
#include "gnumeric.h"
#include "expr-name.h"
#include "eval.h"
#include "dependent.h"
#include "cell.h"
#include "value.h"
#include "workbook.h"
......
......@@ -11,7 +11,7 @@
#include "expr-impl.h"
#include "expr-name.h"
#include "eval.h"
#include "dependent.h"
#include "format.h"
#include "func.h"
#include "cell.h"
......
......@@ -14,7 +14,7 @@
#include "func.h"
#include "parse-util.h"
#include "eval.h"
#include "dependent.h"
#include "expr.h"
#include "expr-impl.h"
#include "cell.h"
......
......@@ -2,7 +2,7 @@
#define GNUMERIC_FUNC_H
#include "gnumeric.h"
#include "eval.h"
#include "dependent.h"
/* Setup of the symbol table */
void functions_init (void);
......
......@@ -27,7 +27,7 @@
#include <func.h>
#include <parse-util.h>
#include <eval.h>
#include <dependent.h>
#include <cell.h>
#include <str.h>
#include <sheet.h>
......
......@@ -25,7 +25,7 @@
#include "gnumeric.h"
#include "gnumeric-graph.h"
#include "eval.h"
#include "dependent.h"
#include "expr.h"
#include "value.h"
#include "cell.h"
......
......@@ -32,7 +32,7 @@
#include "style.h"
#include "style-color.h"
#include "str.h"
#include "eval.h"
#include "dependent.h"
#include "sheet-autofill.h"
#include "xml-io.h"
......
......@@ -32,7 +32,7 @@
#include "style.h"
#include "style-color.h"
#include "str.h"
#include "eval.h"
#include "dependent.h"
#include "sheet-autofill.h"
#include "xml-io.h"
......
......@@ -10,7 +10,7 @@
#include "gnumeric.h"
#include "print-cell.h"
#include "eval.h"
#include "dependent.h"
#include "format.h"
#include "style-color.h"
#include "parse-util.h"
......
......@@ -25,7 +25,7 @@
#include "sheet-object-widget.h"
#include "gui-util.h"
#include "eval.h"
#include "dependent.h"
#include "gnumeric-canvas.h"
#include "sheet-control-gui.h"
#include "sheet-object-impl.h"
......
......@@ -19,7 +19,7 @@
#include "workbook-private.h"
#include "workbook-edit.h"
#include "parse-util.h"
#include "eval.h"
#include "dependent.h"
#include "value.h"
#include "number-match.h"
#include "format.h"
......
#ifndef GNUMERIC_STYLE_CONDITION_H
#define GNUMERIC_STYLE_CONDITION_H
#include "eval.h"
#include "dependent.h"
#include "gnumeric.h"
typedef enum {
......
2002-03-22 Jody Goldberg <jody@gnome.org>
* reports-write.c (solver_program_report) : suppress warning.
(solver_performance_report) : fix typo.
2002-03-22 Jukka-Pekka Iivonen <jiivonen@hutcs.cs.hut.fi>
* api.c (w_lp_solve_set_option): Max time setting added.
......
......@@ -31,7 +31,7 @@
#include "cell.h"
#include "sheet.h"
#include "sheet-style.h"
#include "eval.h"
#include "dependent.h"
#include "dialogs.h"
#include "mstyle.h"
#include "value.h"
......
......@@ -33,7 +33,7 @@
#include "sheet.h"
#include "workbook.h"
#include "sheet-style.h"
#include "eval.h"
#include "dependent.h"
#include "dialogs.h"
#include "mstyle.h"
#include "value.h"
......@@ -691,7 +691,7 @@ solver_performance_report (WorkbookControl *wbc,
dao_set_cell_value (&dao, 3, 19, value_new_float (res->time_system));
/* Set the `Real Time'. */
dao_set_cell_value (&dao, 4, 19,0
dao_set_cell_value (&dao, 4, 19,
value_new_float (gnumeric_fake_round
(res->time_real * 100) / 100.0));
......@@ -779,7 +779,6 @@ solver_program_report (WorkbookControl *wbc,
SolverResults *res)
{
data_analysis_output_t dao;
Cell *cell;
int i, col, row, max_col, n, vars;
dao_init (&dao, NewSheetOutput);
......
......@@ -33,7 +33,7 @@
#include "sheet.h"
#include "workbook.h"
#include "sheet-style.h"
#include "eval.h"
#include "dependent.h"
#include "dialogs.h"
#include "mstyle.h"
#include "value.h"
......@@ -105,7 +105,6 @@ get_input_variable_names (SolverResults *res, Sheet *sheet)
static void
get_constraint_names (SolverResults *res, Sheet *sheet)
{
Cell *cell;
int i;
for (i = 0; i < res->param->n_total_constraints; i++) {
......@@ -255,8 +254,6 @@ solver_prepare_reports (SolverProgram *program, SolverResults *res,
Sheet *sheet)
{
SolverParameters *param = res->param;
Cell *cell;
int i;
SolverLPAlgorithm *alg;
if (res->param->options.model_type == SolverLPModel)
......@@ -330,7 +327,7 @@ solver_prepare_reports_success (SolverProgram *program, SolverResults *res,
/* Get allowable increase and decrease for constraints. */
if (param->options.sensitivity_report && ! res->ilp_flag) {
gnum_float *store = g_new (gnum_float, param->n_variables);
/* gnum_float *store = g_new (gnum_float, param->n_variables);*/
for (i = 0; i < param->n_total_constraints; i++) {
SolverConstraint *c = res->constraints_array[i];
......
......@@ -31,7 +31,7 @@
#include "cell.h"
#include "sheet.h"
#include "sheet-style.h"
#include "eval.h"
#include "dependent.h"
#include "dialogs.h"
#include "mstyle.h"
#include "value.h"
......
......@@ -21,7 +21,7 @@
#include <ranges.h>
#include <value.h>
#include <expr.h>
#include <eval.h>
#include <dependent.h>
#include <sheet.h>
#include <commands.h>
#include <gnm-marshalers.h>
......
......@@ -10,7 +10,7 @@
#include "gnumeric.h"
#include "workbook-cmd-format.h"
#include "eval.h"
#include "dependent.h"
#include "ranges.h"
#include "gui-util.h"
#include "selection.h"
......
......@@ -46,7 +46,7 @@
#include "gui-clipboard.h"
#include "workbook-edit.h"
#include "main.h"
#include "eval.h"
#include "dependent.h"
#include "expr.h"
#include "position.h"
#include "parse-util.h"
......
......@@ -24,7 +24,7 @@
#include "sheet-control.h"
#include "expr.h"
#include "expr-name.h"
#include "eval.h"
#include "dependent.h"
#include "value.h"
#include "ranges.h"
#include "history.h"
......
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