Commit e6e55e26 authored by Morten Welinder's avatar Morten Welinder

R1C1: Eliminate gnm_expr_parse_str_simple and thus many R1C1 bugs.

parent dc3e27ee
2009-05-22 Morten Welinder <terra@gnome.org>
* src/parse-util.c (gnm_expr_parse_str_simple): Remove. Interface
invites R1C1 bugs. All callers fixed.
2009-05-21 Morten Welinder <terra@gnome.org>
* src/wbc-gtk.c (cb_graph_dim_editor_update): Suppress the initial
......
......@@ -26,6 +26,7 @@ Morten:
* Hide scrollbars as requested. [#583005]
* Fix date conventions in graphs.
* Improve GUI for date/time axes. [#574681]
* Fix R1C1 issues.
Paul Fitzpatrick:
* Extend ssconvert to also merge multiple sheets. [#581616]
......
......@@ -1119,7 +1119,10 @@ cmd_area_set_text_redo (GnmCommand *cmd, WorkbookControl *wbc)
expr_txt = gnm_expr_char_start_p (me->text);
if (expr_txt != NULL)
texpr = gnm_expr_parse_str_simple (expr_txt, &me->pp);
texpr = gnm_expr_parse_str
(expr_txt, &me->pp, GNM_EXPR_PARSE_DEFAULT,
sheet_get_conventions (me->cmd.sheet), NULL);
if (me->as_array) {
if (texpr == NULL)
return TRUE;
......
......@@ -1404,12 +1404,6 @@ parse_util_shutdown (void)
gnm_conventions_xls_r1c1 = NULL;
}
GnmExprTop const *
gnm_expr_parse_str_simple (char const *str, GnmParsePos const *pp)
{
return gnm_expr_parse_str (str, pp, GNM_EXPR_PARSE_DEFAULT, NULL, NULL);
}
/* ------------------------------------------------------------------------- */
/**
* gnm_expr_conv_quote:
......
......@@ -195,9 +195,6 @@ GnmExprTop const *gnm_expr_parse_str (char const *str, GnmParsePos const *pp,
GnmConventions const *convs,
GnmParseError *error);
GnmExprTop const *gnm_expr_parse_str_simple (char const *str,
GnmParsePos const *pp);
/* Is this string potentially the start of an expression */
char const *gnm_expr_char_start_p (char const *c);
......
......@@ -268,7 +268,9 @@ read_dep (GnmDependent *dep, char const *name,
GnmParsePos pos;
parse_pos_init_sheet (&pos, context->sheet);
dep->texpr = gnm_expr_parse_str_simple (CC2XML (txt), &pos);
dep->texpr = gnm_expr_parse_str
(CC2XML (txt), &pos, GNM_EXPR_PARSE_DEFAULT,
sheet_get_conventions (pos.sheet), NULL);
xmlFree (txt);
}
}
......
......@@ -107,14 +107,19 @@ define_name (const char *name, const char *expr_txt, gpointer scope)
GnmParsePos pos;
GnmExprTop const *texpr;
GnmNamedExpr const *nexpr;
GnmConventions const *convs;
if (IS_SHEET (scope)) {
parse_pos_init_sheet (&pos, scope);
convs = sheet_get_conventions (pos.sheet);
} else {
parse_pos_init (&pos, WORKBOOK (scope), NULL, 0, 0);
convs = gnm_conventions_default;
}
texpr = gnm_expr_parse_str_simple (expr_txt, &pos);
texpr = gnm_expr_parse_str (expr_txt, &pos,
GNM_EXPR_PARSE_DEFAULT,
convs, NULL);
if (!texpr) {
g_printerr ("Failed to parse %s for name %s\n",
expr_txt, name);
......
......@@ -4058,6 +4058,7 @@ cb_select_auto_expr (GtkWidget *widget, GdkEventButton *event, WBCGtk *wbcg)
};
WorkbookView *wbv = wb_control_view (WORKBOOK_CONTROL (wbcg));
Sheet *sheet = wb_view_cur_sheet (wbv);
GtkWidget *item, *menu;
int i;
......@@ -4066,26 +4067,33 @@ cb_select_auto_expr (GtkWidget *widget, GdkEventButton *event, WBCGtk *wbcg)
menu = gtk_menu_new ();
for (i = 0; quick_compute_routines [i].displayed_name; i++) {
for (i = 0; quick_compute_routines[i].displayed_name; i++) {
GnmParsePos pp;
char const *expr = quick_compute_routines [i].function;
char const *fname = quick_compute_routines[i].function;
char const *dispname =
_(quick_compute_routines[i].displayed_name);
GnmExprTop const *new_auto_expr;
GtkWidget *item;
char *expr_txt;
/* Test the expression... */
parse_pos_init (&pp, wb_control_get_workbook (WORKBOOK_CONTROL (wbcg)), NULL, 0, 0);
new_auto_expr = gnm_expr_parse_str_simple (expr, &pp);
parse_pos_init (&pp, sheet->workbook, sheet, 0, 0);
expr_txt = g_strconcat (fname, "(",
parsepos_as_string (&pp),
")", NULL);
new_auto_expr = gnm_expr_parse_str
(expr_txt, &pp, GNM_EXPR_PARSE_DEFAULT,
sheet_get_conventions (sheet), NULL);
g_free (expr_txt);
if (!new_auto_expr)
continue;
gnm_expr_top_unref (new_auto_expr);
item = gtk_menu_item_new_with_label (
_(quick_compute_routines [i].displayed_name));
item = gtk_menu_item_new_with_label (dispname);
g_object_set_data (G_OBJECT (item),
"func",
gnm_func_lookup (expr, NULL));
g_object_set_data (G_OBJECT (item), "descr",
(gpointer)_(quick_compute_routines [i].displayed_name));
"func", gnm_func_lookup (fname, NULL));
g_object_set_data (G_OBJECT (item),
"descr", (gpointer)dispname);
g_signal_connect (G_OBJECT (item),
"activate",
G_CALLBACK (cb_auto_expr_changed), wbcg);
......
2009-05-22 Morten Welinder <terra@gnome.org>
* gnumeric-expr-entry.c (cb_gee_key_press_event,
gnm_expr_entry_parse): Fix R1C1 problem.
2009-05-21 Morten Welinder <terra@gnome.org>
* gnumeric-expr-entry.c: Add GogDataEditor interface.
......
......@@ -590,7 +590,10 @@ cb_gee_key_press_event (GtkEntry *entry,
return FALSE;
str = gtk_editable_get_chars (editable, start, end);
texpr = gnm_expr_parse_str_simple (str, &gee->pp);
texpr = gnm_expr_parse_str (str, &gee->pp,
GNM_EXPR_PARSE_DEFAULT,
gee_convs (gee),
NULL);
if (texpr) {
GnmValue *v;
GnmEvalPos ep;
......@@ -1612,7 +1615,8 @@ gnm_expr_entry_parse (GnmExprEntry *gee, GnmParsePos const *pp,
}
if (!texpr)
texpr = gnm_expr_parse_str (text, pp, flags, NULL, perr);
texpr = gnm_expr_parse_str (text, pp, flags,
gee_convs (gee), perr);
if (texpr == NULL)
return NULL;
......
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