Commit ba9e130e authored by Arturo Espinosa's avatar Arturo Espinosa

sins are coming

parent a0190b68
1998-08-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/eval.c: New file. Move the evaluation routines here.
* src/func.c: Functions will go here.
* src/parser.y (alloc_glist): Keep track of argument lists.
*
1998-07-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
* src/sheet.c (canvas_bar_realized):
......
1998-08-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/eval.c: New file. Move the evaluation routines here.
* src/func.c: Functions will go here.
* src/parser.y (alloc_glist): Keep track of argument lists.
*
1998-07-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
* src/sheet.c (canvas_bar_realized):
......
1998-08-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/eval.c: New file. Move the evaluation routines here.
* src/func.c: Functions will go here.
* src/parser.y (alloc_glist): Keep track of argument lists.
*
1998-07-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
* src/sheet.c (canvas_bar_realized):
......
1998-08-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/eval.c: New file. Move the evaluation routines here.
* src/func.c: Functions will go here.
* src/parser.y (alloc_glist): Keep track of argument lists.
*
1998-07-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
* src/sheet.c (canvas_bar_realized):
......
......@@ -2,75 +2,21 @@
GNOME Spread Sheet task list
* New TODO:
* Implement recalculation
* Implement functions
* Implement Ranges.
1. Multiple column selection.
2. Scrolling.
* Edit
* Drawing
** Style
*** Change
A routine based on the GnumericSheet widget (just a derivative of
GnomeCanvas) to decorate the canvas: adding lines, rectangles, colored
zones, etc. This is needed for adding beautification features to
Gnumeric. Should be trivial to do, as the spreadsheet and every other
component displayed on the screen is a Canvas Item running inside the
Canvas.
** Copy
** Paste
** Move
This probably should be done at the extension language level.
* Parser
The parser should understand the Excel syntax for expressions.
This is the API we need (I think we need this one).
GList *evaluate (Sheet *sheet,
char *expression,
Type *result_type,
ValueType *val,
char **error_string);
Input values:
Sheet Is the Sheet the cell is part of.
expression Is the expression to be evaluated
Return value:
GList * A list of any cells referenced.
Output values (pointed destination holds result)
result_type Is set us the type of the expression, check
the header files for details.
val The val union set properly to the computed expression
if no error was set.
error_string if error_string is NULL, then no error was found,
otherwise it points to the error string that gets
displayed by the spreadsheet.
The expressions parsed should be compatible with what Excel accepts.
* Information formatting
Given the Cell structure in cell.h:
if the Cell->content_type is either VALUE_INTEGER or VALUE_FLOAT,
produce a formatted string based Excel-compatible format.
I should mention again this: The format that the routine takes
should be compatible with the Excel format.
Desired API:
char *format_number (char *format_string, Value value, GdkColor *computed_color)
Input values:
value The value that is either a VALUE_INTEGER or
a VALUE_FLOAT
Returned value:
char* The formatted string.
Other Output values:
computed_color This is a GdkColor set to the color computed
by the format_number routine (yes, the format
can include colors for certain conditions).
* Scrolling
** Make current cell always visible
** Nice page scrolling with tooltips
** Scrollbar scrolling
......@@ -14,8 +14,10 @@ GNOME_XML_LIB = -lxml
GNUMERIC_BASE_SOURCES = \
cell.h \
eval.c \
expr.c \
expr.h \
func.c \
gnumeric-sheet.c \
gnumeric-sheet.h \
gnumeric.h \
......
......@@ -77,8 +77,10 @@ gnumeric_sheet_set_current_value (GnumericSheet *sheet)
cell_set_text (sheet->sheet, cell, gtk_entry_get_text (GTK_ENTRY (sheet->entry)));
if (sheet->selection)
stop_cell_selection (sheet);
#if 0
sheet_brute_force_recompute (sheet->sheet);
sheet_redraw_all (sheet->sheet);
#endif
}
void
......
......@@ -77,8 +77,10 @@ gnumeric_sheet_set_current_value (GnumericSheet *sheet)
cell_set_text (sheet->sheet, cell, gtk_entry_get_text (GTK_ENTRY (sheet->entry)));
if (sheet->selection)
stop_cell_selection (sheet);
#if 0
sheet_brute_force_recompute (sheet->sheet);
sheet_redraw_all (sheet->sheet);
#endif
}
void
......
......@@ -11,6 +11,8 @@ main (int argc, char *argv [])
string_init ();
style_init ();
symbol_init ();
functions_init ();
current_workbook = workbook_new_with_sheets (1);
gtk_widget_show (current_workbook->toplevel);
......
......@@ -11,6 +11,8 @@ main (int argc, char *argv [])
string_init ();
style_init ();
symbol_init ();
functions_init ();
current_workbook = workbook_new_with_sheets (1);
gtk_widget_show (current_workbook->toplevel);
......
......@@ -18,11 +18,13 @@
#include "utils.h"
/* Allocation with disposal-on-error */
static void *alloc_buffer (int size);
static void register_symbol (Symbol *sym);
static void register_string (String *sym);
static void alloc_clean (void);
static void alloc_list_free (void);
static void *alloc_buffer (int size);
static void register_symbol (Symbol *sym);
static void register_string (String *sym);
static void alloc_clean (void);
static void alloc_glist (GList *l);
static void forget_glist (GList *list);
static void alloc_list_free (void);
static void *v_new (void);
#define ERROR -1
......@@ -32,7 +34,8 @@ typedef enum {
ALLOC_SYMBOL,
ALLOC_VALUE,
ALLOC_BUFFER,
ALLOC_STRING
ALLOC_STRING,
ALLOC_LIST
} AllocType;
/* How we keep track of them */
......@@ -126,6 +129,13 @@ exp: NUMBER { $$ = $1 }
| CELLREF ':' CELLREF {}
| FUNCALL '(' arg_list ')' {
GList *l;
int i;
for (i = 0, l = $3; l; l = l->next){
printf ("Arg %d\n", i++);
dump_tree (l->data);
}
$$ = p_new (ExprTree);
$$->oper = OP_FUNCALL;
$$->u.function.symbol = $1->u.function.symbol;
......@@ -133,8 +143,15 @@ exp: NUMBER { $$ = $1 }
}
;
arg_list: {}
| exp ',' arg_list { }
arg_list: exp {
$$ = g_list_prepend (NULL, $1);
alloc_glist ($$);
}
| exp ',' arg_list {
forget_glist ($3);
$$ = g_list_prepend ($3, $1);
alloc_glist ($$);
}
;
%%
......@@ -444,6 +461,9 @@ alloc_clean (void)
case ALLOC_VALUE:
clean_value ((Value *)rec->data);
case ALLOC_LIST:
g_list_free ((GList *) rec->data);
}
g_free (rec);
}
......@@ -464,6 +484,31 @@ alloc_list_free (void)
alloc_list = NULL;
}
static void
alloc_glist (GList *list)
{
AllocRec *a_info = g_new (AllocRec, 1);
a_info->type = ALLOC_LIST;
a_info->data = list;
alloc_list = g_list_prepend (alloc_list, a_info);
}
static void
forget_glist (GList *list)
{
GList *l;
for (l = alloc_list; l; l = l->next){
AllocRec *a_info = (AllocRec *) l->data;
if (a_info->type == ALLOC_LIST && a_info->data == list){
alloc_list = g_list_remove_link (alloc_list, l);
return;
}
}
}
/*
* FIXME: For now this is only supporting double/int, not
* mpz/mpf.
......
......@@ -5,45 +5,6 @@
* Author:
* Miguel de Icaza (miguel@gnu.org)
*
* Recomputations:
update_cell (cell)
{
cells_referenced = eval_expression (cell->formula);
if (cells_referenced){
push_refs (cells_referenced);
return;
}
cell->cycle = current_cycle;
return eval (cell);
}
push_refs (list)
{
foreach i in (list){
cell = findcell (i);
if (cell->cell_cycle = current_cycle)
loop;
else
push_cell(cell);
}
}
int
eval_next_cell()
{
cell = pop_cell (cell);
if (cell){
if (cell->cell_cycle == current_cycle)
--loop_counter;
else
loop_counter = 40;
update_cell (cell);
return loop_counter;
} else
return 0;
}
*/
#include <config.h>
#include <gnome.h>
......@@ -62,62 +23,6 @@ sheet_redraw_all (Sheet *sheet)
0, 0, INT_MAX, INT_MAX);
}
static void
sheet_compute_cell (Sheet *sheet, Cell *cell)
{
char *error_msg;
Value *v;
if (cell->text)
string_unref_ptr (&cell->text);
v = eval_expr (sheet, cell->parsed_node,
cell->col->pos,
cell->row->pos,
&error_msg);
if (cell->value)
value_release (cell->value);
if (v == NULL){
cell->text = string_get (error_msg);
cell->value = NULL;
} else {
/* FIXME: Use the format stuff */
char *str = value_string (v);
cell->value = v;
cell->text = string_get (str);
g_free (str);
}
}
static void
recompute_one_cell (Sheet *sheet, int col, int row, Cell *cell, void *closure)
{
if (cell->parsed_node == NULL)
return;
printf ("recomputing %d %d\n", col, row);
sheet_compute_cell (sheet, cell);
sheet_redraw_cell_region (sheet,
cell->col->pos, cell->row->pos,
cell->col->pos, cell->row->pos);
}
void
sheet_brute_force_recompute (Sheet *sheet)
{
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
printf ("mental retarted recomputation in progress!\n");
sheet_cell_foreach_range (sheet, 1,
0, 0,
SHEET_MAX_COLS, SHEET_MAX_ROWS,
recompute_one_cell, NULL);
}
static void
sheet_init_default_styles (Sheet *sheet)
{
......
......@@ -90,7 +90,8 @@ void sheet_selection_extend_horizontal (Sheet *sheet, int count);
void sheet_selection_extend_vertical (Sheet *sheet, int count);
int sheet_selection_is_cell_selected (Sheet *sheet, int col, int row);
void sheet_brute_force_recompute (Sheet *sheet);
/* Computation */
void sheet_compute_cell (Sheet *sheet, Cell *cell);
/* Cell management */
Cell *sheet_cell_new (Sheet *sheet, int col, int row);
......
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