[gnumeric] Help: allow array results such as from COLUMN and ROW.



commit fc55f2590de7924c6e4c98712ba256c9c5c3b98d
Author: Morten Welinder <terra gnome org>
Date:   Thu Jul 2 11:03:00 2009 -0400

    Help: allow array results such as from COLUMN and ROW.

 plugins/fn-lookup/functions.c        |   14 +++++++-------
 src/dialogs/ChangeLog                |    5 +++++
 src/dialogs/dialog-function-select.c |    3 ++-
 3 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/plugins/fn-lookup/functions.c b/plugins/fn-lookup/functions.c
index 58abb15..22ae978 100644
--- a/plugins/fn-lookup/functions.c
+++ b/plugins/fn-lookup/functions.c
@@ -1298,7 +1298,7 @@ gnumeric_index (GnmFuncEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
 
 static GnmFuncHelp const help_column[] = {
 	{ GNM_FUNC_HELP_NAME, F_("COLUMN:vector of column numbers.") },
-	{ GNM_FUNC_HELP_ARG, F_("[reference].") },
+	{ GNM_FUNC_HELP_ARG, F_("x:reference.") },
 	{ GNM_FUNC_HELP_DESCRIPTION, F_(
 	   "COLUMN function returns a Nx1 array containing the series of integers "
 	   "from the first column to the last column of @reference."
@@ -1307,8 +1307,8 @@ static GnmFuncHelp const help_column[] = {
 	   "\n"
 	   "* If @reference is neither an array nor a reference nor a range, "
 	   "returns #VALUE! error.\n") },
-	{ GNM_FUNC_HELP_EXAMPLES, F_("COLUMN(A1:C4) equals {1,2,3}") },
-	{ GNM_FUNC_HELP_EXAMPLES, F_("COLUMN(A:C) equals {1,2,3}") },
+	{ GNM_FUNC_HELP_EXAMPLES, "=COLUMN(A1:C4)" },
+	{ GNM_FUNC_HELP_EXAMPLES, "=COLUMN(A:C)" },
 	{ GNM_FUNC_HELP_EXAMPLES, F_("COLUMN() in G13 equals 7.") },
 	{ GNM_FUNC_HELP_SEEALSO, "COLUMNS,ROW,ROWS" },
 	{ GNM_FUNC_HELP_END }
@@ -1479,7 +1479,7 @@ gnumeric_offset (GnmFuncEvalInfo *ei, GnmValue const * const *args)
 
 static GnmFuncHelp const help_row[] = {
 	{ GNM_FUNC_HELP_NAME, F_("ROW:vector of row numbers.") },
-	{ GNM_FUNC_HELP_ARG, F_("[reference].") },
+	{ GNM_FUNC_HELP_ARG, F_("x:reference.") },
 	{ GNM_FUNC_HELP_DESCRIPTION, F_(
 	   "ROW function returns a 1xN array containing the series of integers "
 	   "from the first row to the last row of @reference."
@@ -1488,9 +1488,9 @@ static GnmFuncHelp const help_row[] = {
 	   "\n"
 	   "* If @reference is neither an array nor a reference nor a range, "
 	   "returns #VALUE! error.\n") },
-	{ GNM_FUNC_HELP_EXAMPLES, F_("ROW(A1:D3) equals {1;2;3}") },
-	{ GNM_FUNC_HELP_EXAMPLES, F_("ROW(1:3) equals {1;2;3}") },
-	{ GNM_FUNC_HELP_EXAMPLES, F_("ROW() in G13 equals 13.") },
+	{ GNM_FUNC_HELP_EXAMPLES, "=ROW(A1:D3)" },
+	{ GNM_FUNC_HELP_EXAMPLES, "=ROW(1:3)" },
+	{ GNM_FUNC_HELP_EXAMPLES, F_("=ROW() in G13 equals 13.") },
 	{ GNM_FUNC_HELP_SEEALSO, "COLUMN,COLUMNS,ROWS" },
 	{ GNM_FUNC_HELP_END }
 };
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index cb66b1e..08b4be7 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-02  Morten Welinder  <terra gnome org>
+
+	* dialog-function-select.c (make_expr_example): Allow array
+	result.
+
 2009-07-01  Morten Welinder  <terra gnome org>
 
 	* dialog-preferences.c: Cleanup using gnumeric-gconf's new
diff --git a/src/dialogs/dialog-function-select.c b/src/dialogs/dialog-function-select.c
index ce19759..cd6a5d2 100644
--- a/src/dialogs/dialog-function-select.c
+++ b/src/dialogs/dialog-function-select.c
@@ -427,7 +427,8 @@ make_expr_example (Sheet *sheet, const char *text, gboolean localized)
 
 	if (texpr) {
 		char *etxt = gnm_expr_top_as_string (texpr, &pp, convs);
-		GnmValue *val = gnm_expr_top_eval (texpr, &ep, 0);
+		GnmValue *val = gnm_expr_top_eval
+			(texpr, &ep, GNM_EXPR_EVAL_PERMIT_NON_SCALAR);
 		GnmExprTop const *texpr_res = gnm_expr_top_new_constant (val);
 		char *vtxt = gnm_expr_top_as_string (texpr_res, &pp, convs);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]