[gnumeric] gnm_expr_as_string: Add defaults for debugging.



commit 9a484b5a252016c6879b5018df64754ca409bfc0
Author: Morten Welinder <terra gnome org>
Date:   Fri Apr 24 20:41:57 2009 -0400

    gnm_expr_as_string: Add defaults for debugging.
---
 ChangeLog  |    2 ++
 src/expr.c |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 284016b..ccfa812 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2009-04-24  Morten Welinder  <terra gnome org>
 
+	* src/expr.c (gnm_expr_as_string): Add defaults for debugging.
+
 	* src/sheet.c (gnm_sheet_resize_main): Restrict the selection to
 	the size of the new sheet.
 
diff --git a/src/expr.c b/src/expr.c
index 993ff6c..41a249b 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -27,6 +27,7 @@
 #include "expr-impl.h"
 #include "expr-name.h"
 #include "dependent.h"
+#include "application.h"
 #include "func.h"
 #include "cell.h"
 #include "sheet.h"
@@ -1723,10 +1724,24 @@ gnm_expr_as_string (GnmExpr const *expr, GnmParsePos const *pp,
 		    GnmConventions const *convs)
 {
 	GnmConventionsOut out;
+	GnmParsePos pp0;
 
 	g_return_val_if_fail (expr != NULL, NULL);
 	g_return_val_if_fail (pp != NULL, NULL);
 
+	/*
+	 * Defaults for debugging only!
+	 */
+	if (!convs)
+		convs = gnm_conventions_default;
+	if (!pp) {
+		/* UGH: Just get the first sheet in the first workbook! */
+		Workbook *wb = gnm_app_workbook_get_by_index (0);
+		Sheet *sheet = workbook_sheet_by_index (wb, 0);
+		parse_pos_init (&pp0, NULL, sheet, 0, 0);
+		pp = &pp0;
+	}
+
 	out.accum = g_string_new (NULL);
 	out.pp    = pp;
 	out.convs = convs;



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