gnumeric r16480 - in trunk: . plugins/excel plugins/openoffice plugins/sylk src test
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16480 - in trunk: . plugins/excel plugins/openoffice plugins/sylk src test
- Date: Fri, 28 Mar 2008 16:56:28 +0000 (GMT)
Author: mortenw
Date: Fri Mar 28 16:56:28 2008
New Revision: 16480
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16480&view=rev
Log:
2008-03-28 Morten Welinder <terra gnome org>
* src/expr.c (gnm_expr_top_is_array_elem): Take extra arguments
for storing coordinates. All callers changed.
Modified:
trunk/ChangeLog
trunk/plugins/excel/xlsx-write.c
trunk/plugins/openoffice/openoffice-write.c
trunk/plugins/sylk/sylk-write.c
trunk/src/cell.c
trunk/src/expr.c
trunk/src/expr.h
trunk/src/sheet-autofill.c
trunk/src/workbook-view.c
trunk/src/xml-sax-write.c
trunk/test/t8003-valgrind-pdf.pl
Modified: trunk/plugins/excel/xlsx-write.c
==============================================================================
--- trunk/plugins/excel/xlsx-write.c (original)
+++ trunk/plugins/excel/xlsx-write.c Fri Mar 28 16:56:28 2008
@@ -411,7 +411,7 @@
if (gnm_cell_has_expr (cell)) {
texpr = cell->base.texpr;
- if (!gnm_expr_top_is_array_elem (texpr)) {
+ if (!gnm_expr_top_is_array_elem (texpr, NULL, NULL)) {
gsf_xml_out_start_element (xml, "f");
array = gnm_expr_top_get_array_corner (texpr);
Modified: trunk/plugins/openoffice/openoffice-write.c
==============================================================================
--- trunk/plugins/openoffice/openoffice-write.c (original)
+++ trunk/plugins/openoffice/openoffice-write.c Fri Mar 28 16:56:28 2008
@@ -309,15 +309,13 @@
TABLE "number-rows-spanned", rows_spanned);
if (cell != NULL) {
char *rendered_string;
- GnmExprArrayCorner const *ac = NULL;
- if (gnm_cell_has_expr(cell)
- && ((NULL != (ac = gnm_expr_top_get_array_corner
- (cell->base.texpr)))
- || !gnm_expr_top_is_array_elem (cell->base.texpr))) {
+ if (gnm_cell_is_array (cell)) {
+ GnmExprArrayCorner const *ac;
char *formula, *eq_formula;
GnmParsePos pp;
+ ac = gnm_expr_top_get_array_corner (cell->base.texpr);
if (ac != NULL) {
gsf_xml_out_add_uint (state->xml,
TABLE "number-matrix-columns-spanned",
@@ -328,9 +326,9 @@
}
parse_pos_init_cell (&pp, cell);
- formula = gnm_expr_as_string (cell->base.texpr->expr,
- &pp,
- state->conv);
+ formula = gnm_expr_top_as_string (cell->base.texpr,
+ &pp,
+ state->conv);
eq_formula = g_strdup_printf ("oooc:=%s", formula);
#if 0
Modified: trunk/plugins/sylk/sylk-write.c
==============================================================================
--- trunk/plugins/sylk/sylk-write.c (original)
+++ trunk/plugins/sylk/sylk-write.c Fri Mar 28 16:56:28 2008
@@ -119,7 +119,7 @@
gsf_output_printf (state->output, ";R%d;C%d;M",
iter->pp.eval.row + array->rows,
iter->pp.eval.col + array->cols);
- } else if (gnm_expr_top_is_array_elem (texpr)) {
+ } else if (gnm_expr_top_is_array_elem (texpr, NULL, NULL)) {
gsf_output_write (state->output, 2, ";I");
texpr = NULL;
} else
Modified: trunk/src/cell.c
==============================================================================
--- trunk/src/cell.c (original)
+++ trunk/src/cell.c Fri Mar 28 16:56:28 2008
@@ -381,6 +381,7 @@
{
GnmExprTop const *texpr;
GnmExprArrayCorner const *array;
+ int x, y;
if (NULL == cell || !gnm_cell_has_expr (cell))
return FALSE;
@@ -388,10 +389,8 @@
g_return_val_if_fail (res != NULL, FALSE);
texpr = cell->base.texpr;
- if (gnm_expr_top_is_array_elem (texpr)) {
- cell = sheet_cell_get (cell->base.sheet,
- cell->pos.col - texpr->expr->array_elem.x,
- cell->pos.row - texpr->expr->array_elem.y);
+ if (gnm_expr_top_is_array_elem (texpr, &x, &y)) {
+ cell = sheet_cell_get (cell->base.sheet, cell->pos.col - x, cell->pos.row - y);
g_return_val_if_fail (cell != NULL, FALSE);
g_return_val_if_fail (gnm_cell_has_expr (cell), FALSE);
@@ -428,7 +427,7 @@
{
return cell != NULL && gnm_cell_has_expr (cell) &&
(gnm_expr_top_is_array_corner (cell->base.texpr) ||
- gnm_expr_top_is_array_elem (cell->base.texpr));
+ gnm_expr_top_is_array_elem (cell->base.texpr, NULL, NULL));
}
/**
Modified: trunk/src/expr.c
==============================================================================
--- trunk/src/expr.c (original)
+++ trunk/src/expr.c Fri Mar 28 16:56:28 2008
@@ -2935,10 +2935,16 @@
}
gboolean
-gnm_expr_top_is_array_elem (GnmExprTop const *texpr)
+gnm_expr_top_is_array_elem (GnmExprTop const *texpr, int *x, int *y)
{
g_return_val_if_fail (IS_GNM_EXPR_TOP (texpr), FALSE);
- return GNM_EXPR_GET_OPER (texpr->expr) == GNM_EXPR_OP_ARRAY_ELEM;
+
+ if (GNM_EXPR_GET_OPER (texpr->expr) != GNM_EXPR_OP_ARRAY_ELEM)
+ return FALSE;
+
+ if (x) *x = texpr->expr->array_elem.x;
+ if (y) *y = texpr->expr->array_elem.y;
+ return TRUE;
}
GnmExprTop const *
Modified: trunk/src/expr.h
==============================================================================
--- trunk/src/expr.h (original)
+++ trunk/src/expr.h Fri Mar 28 16:56:28 2008
@@ -117,7 +117,7 @@
gboolean gnm_expr_top_is_shared (GnmExprTop const *texpr);
gboolean gnm_expr_top_is_err (GnmExprTop const *texpr, GnmStdError e);
gboolean gnm_expr_top_is_rangeref (GnmExprTop const *texpr);
-gboolean gnm_expr_top_is_array_elem (GnmExprTop const *texpr);
+gboolean gnm_expr_top_is_array_elem (GnmExprTop const *texpr, int *x, int *y);
gboolean gnm_expr_top_is_array_corner (GnmExprTop const *texpr);
GnmExprArrayCorner const *gnm_expr_top_get_array_corner (GnmExprTop const *texpr);
GnmValue *gnm_expr_top_get_range (GnmExprTop const *texpr);
Modified: trunk/src/sheet-autofill.c
==============================================================================
--- trunk/src/sheet-autofill.c (original)
+++ trunk/src/sheet-autofill.c Fri Mar 28 16:56:28 2008
@@ -847,7 +847,7 @@
Sheet *sheet = src->base.sheet;
/* Arrays are always assigned fully at the corner. */
- if (gnm_expr_top_is_array_elem (src_texpr))
+ if (gnm_expr_top_is_array_elem (src_texpr, NULL, NULL))
return NULL;
rinfo.reloc_type = GNM_EXPR_RELOCATE_MOVE_RANGE;
Modified: trunk/src/workbook-view.c
==============================================================================
--- trunk/src/workbook-view.c (original)
+++ trunk/src/workbook-view.c Fri Mar 28 16:56:28 2008
@@ -408,9 +408,7 @@
*/
if (gnm_expr_top_is_array_corner (texpr))
corner = cell;
- else if (gnm_expr_top_is_array_elem (texpr)) {
- x = texpr->expr->array_elem.x;
- y = texpr->expr->array_elem.y;
+ else if (gnm_expr_top_is_array_elem (texpr, &x, &y)) {
corner = sheet_cell_get
(sheet,
cell->pos.col - x,
Modified: trunk/src/xml-sax-write.c
==============================================================================
--- trunk/src/xml-sax-write.c (original)
+++ trunk/src/xml-sax-write.c Fri Mar 28 16:56:28 2008
@@ -732,7 +732,7 @@
gnm_expr_top_is_shared (texpr);
/* Only the top left corner of an array needs to be saved (>= 0.53) */
- if (texpr && gnm_expr_top_is_array_elem (texpr))
+ if (texpr && gnm_expr_top_is_array_elem (texpr, NULL, NULL))
return; /* DOM version would write <Cell Col= Row=/> */
gsf_xml_out_start_element (state->output, GNM "Cell");
Modified: trunk/test/t8003-valgrind-pdf.pl
==============================================================================
--- trunk/test/t8003-valgrind-pdf.pl (original)
+++ trunk/test/t8003-valgrind-pdf.pl Fri Mar 28 16:56:28 2008
@@ -5,6 +5,12 @@
use lib ($0 =~ m|^(.*/)| ? $1 : ".");
use GnumericTest;
+# We get hit by a bitfield error on old Valgrinds.
+my $valgrind_version = `valgrind --version 2>&1`;
+my ($ma,$mi,$rv) = $valgrind_version =~ /^valgrind-?\s*(\d+)\.(\d+)\.(\d+)/;
+&GnumericTest::report_skip ("Valgrind is missing or too old")
+ unless (($ma || 0) * 1000 + ($mi || 0)) * 1000 + ($rv || 0) > 3001001;
+
&message ("Check the pdf exporter with valgrind -- part 1.");
my $src = "$samples/excel/statfuns.xls";
&GnumericTest::report_skip ("file $src does not exist") unless -r $src;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]