gnumeric r16664 - in trunk: . plugins/excel plugins/fn-info src
- From: jody svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16664 - in trunk: . plugins/excel plugins/fn-info src
- Date: Wed, 25 Jun 2008 10:53:13 +0000 (UTC)
Author: jody
Date: Wed Jun 25 10:53:13 2008
New Revision: 16664
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16664&view=rev
Log:
- Add GET.FORMULA
- unlink iteration variables in Data -> TABLE if they have expressions
Modified:
trunk/.gitignore
trunk/NEWS
trunk/plugins/excel/ms-formula-read.c
trunk/plugins/fn-info/functions.c
trunk/plugins/fn-info/plugin.xml.in
trunk/src/dependent.c
trunk/src/func-builtin.c
Modified: trunk/.gitignore
==============================================================================
--- trunk/.gitignore (original)
+++ trunk/.gitignore Wed Jun 25 10:53:13 2008
@@ -17,6 +17,8 @@
Makefile
xlibtool
xltmain.sh
+doltcompile
+doltlibtool
depcomp
install-sh
missing
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Wed Jun 25 10:53:13 2008
@@ -20,7 +20,9 @@
* Support Some XLM functions commonly used in charting.
* Fix xls import of charts in charts.
* Fix display confusion when reordering away from RTL sheet. [#499910]
+ * Make xlsx chart export more robust.
* Be more careful with corrupt xls records. [#539666]
+ * Support Data -> Table variables that contain expressions.
Morten:
* Fix Excel export problem for strings that need quoting. [#530704]
Modified: trunk/plugins/excel/ms-formula-read.c
==============================================================================
--- trunk/plugins/excel/ms-formula-read.c (original)
+++ trunk/plugins/excel/ms-formula-read.c Wed Jun 25 10:53:13 2008
@@ -155,8 +155,8 @@
/* 103 */ { "LINKS", -1, -1, XL_XLM },
/* 104 */ { "INPUT", -1, -1, XL_XLM },
/* 105 */ { "ISREF", 1, 1, XL_STD, 1, 'V', "R" }, /* This a guess */
-/* 106 */ { "GET.FORMULA", -1, -1, XL_XLM },
-/* 107 */ { "GET.NAME", -1, -1, XL_XLM },
+/* 106 */ { "GET.FORMULA", 1, 1, XL_XLM, 1, 'V', "R" }, /* This is a guess (wallenbach 'function plot 2D') */
+/* 107 */ { "GET.NAME", 1, 1, XL_XLM, 1, 'V', "R" }, /* This is a guess */
/* 108 */ { "SET.VALUE", -1, -1, XL_XLM },
/* 109 */ { "LOG", 1, 2, XL_STD, 2, 'V', "VV" }, /* Base is optional */
Modified: trunk/plugins/fn-info/functions.c
==============================================================================
--- trunk/plugins/fn-info/functions.c (original)
+++ trunk/plugins/fn-info/functions.c Wed Jun 25 10:53:13 2008
@@ -1204,6 +1204,52 @@
return value_new_empty ();
}
+/***************************************************************************/
+
+static GnmFuncHelp const help_get_formula[] = {
+ { GNM_FUNC_HELP_OLD,
+ F_("@FUNCTION=GET.FORMULA\n"
+ "@SYNTAX=GET.FORMULA(cell)\n"
+ "@DESCRIPTION="
+ "EXPRESSION returns expression in @cell as a string, or "
+ "empty if the cell is not an expression.\n"
+ "@EXAMPLES=\n"
+ "entering '=GET.FORMULA(A3)' in A2 = empty (assuming there is nothing in A3).\n"
+ "entering '=GET.FORMULA(A2)' in A1 = '=GET.FORMULA(A3)'.\n"
+ "\n"
+ "@SEEALSO=EXPRESSION")
+ },
+ { GNM_FUNC_HELP_END }
+};
+
+static GnmValue *
+gnumeric_get_formula (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
+{
+ GnmValue const * const v = argv[0];
+ if (v->type == VALUE_CELLRANGE) {
+ GnmCell *cell;
+ GnmCellRef const * a = &v->v_range.cell.a;
+ GnmCellRef const * b = &v->v_range.cell.b;
+
+ if (a->col != b->col || a->row != b->row || a->sheet !=b->sheet)
+ return value_new_error_REF (ei->pos);
+
+ cell = sheet_cell_get (eval_sheet (a->sheet, ei->pos->sheet),
+ a->col, a->row);
+
+ if (cell && gnm_cell_has_expr (cell)) {
+ GnmConventionsOut out;
+ GnmParsePos pp;
+ out.accum = g_string_new ("=");
+ out.pp = parse_pos_init_cell (&pp, cell);
+ out.convs = gnm_conventions_default;
+ gnm_expr_top_as_gstring (cell->base.texpr, &out);
+ return value_new_string_nocopy (g_string_free (out.accum, FALSE));
+ }
+ }
+
+ return value_new_empty ();
+}
/***************************************************************************/
@@ -1943,12 +1989,19 @@
{ "error", "s", N_("text"), help_error,
gnumeric_error, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
+
{ "expression", "r", N_("cell"), help_expression,
gnumeric_expression, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
+/* XLM : looks common in charts */
+ { "get.formula", "r", N_("cell"), help_get_formula,
+ gnumeric_get_formula, NULL, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
+
{ "getenv", "s", N_("string"), help_getenv,
gnumeric_getenv, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
+
{NULL}
};
Modified: trunk/plugins/fn-info/plugin.xml.in
==============================================================================
--- trunk/plugins/fn-info/plugin.xml.in (original)
+++ trunk/plugins/fn-info/plugin.xml.in Wed Jun 25 10:53:13 2008
@@ -16,6 +16,7 @@
<function name="error"/>
<function name="error.type"/>
<function name="expression"/>
+ <function name="get.formula"/>
<function name="info"/>
<function name="isblank"/>
<function name="iserr"/>
Modified: trunk/src/dependent.c
==============================================================================
--- trunk/src/dependent.c (original)
+++ trunk/src/dependent.c Wed Jun 25 10:53:13 2008
@@ -511,6 +511,9 @@
{
g_return_if_fail (dep != NULL);
+#ifdef DEBUG_EVALUATION
+ g_print ("/* QUEUE (%s) */\n", cell_name (GNM_DEP_TO_CELL (dep)));
+#endif
if (!dependent_needs_recalc (dep)) {
GSList listrec;
listrec.next = NULL;
@@ -1383,7 +1386,8 @@
GnmEvalPos pos;
int max_iteration;
- if (!gnm_cell_has_expr (cell))
+ if (!gnm_cell_has_expr (cell) || /* plain cells without expr */
+ !dependent_is_linked (&cell->base)) /* special case within TABLE */
return TRUE;
/* do this here rather than dependent_eval
@@ -1400,7 +1404,8 @@
GnmParsePos pp;
char *str = gnm_expr_top_as_string (cell->base.texpr,
parse_pos_init_cell (&pp, cell), gnm_conventions_default);
- g_print ("{\nEvaluating %s: %s;\n", cell_name (cell), str);
+ g_print ("{\nEvaluating %s!%s: %s;\n",
+ cell->base.sheet->name_quoted, cell_name (cell), str);
g_free (str);
}
#endif
Modified: trunk/src/func-builtin.c
==============================================================================
--- trunk/src/func-builtin.c (original)
+++ trunk/src/func-builtin.c Wed Jun 25 10:53:13 2008
@@ -33,6 +33,7 @@
#include <expr-impl.h>
#include <sheet.h>
#include <cell.h>
+#include <cell.h>
/***************************************************************************/
@@ -185,8 +186,12 @@
in[x] = sheet_cell_get (ei->pos->sheet, pos.col, pos.row);
if (NULL == in[x])
in[x] = sheet_cell_fetch (ei->pos->sheet, pos.col, pos.row);
- else
+ else {
val[x] = in[x]->value;
+ if (gnm_cell_has_expr (in[x]) &&
+ gnm_cell_expr_is_linked (in[x]))
+ dependent_unlink (&in[x]->base);
+ }
} else
in[x] = NULL;
}
@@ -246,6 +251,12 @@
}
if (NULL != in[2])
value_release (in[2]->value);
+ for (x = 0 ; x < 2 ; x++)
+ if (in[x] &&
+ gnm_cell_has_expr (in[x]) &&
+ !gnm_cell_expr_is_linked (in[x]))
+ dependent_link (&in[x]->base);
+
for (x = 0 ; x < 3 ; x++)
if (in[x]) {
dependent_queue_recalc (&in[x]->base);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]