Commit 8d7fce82 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

get closer to matching the classes for the more obscure variants, OOo is


2004-08-15  Jody Goldberg <jody@gnome.org>

	* ms-formula-write.c (write_node) : get closer to matching the classes
	  for the more obscure variants, OOo is wrong, but I don't have a
	  clear map on what is right yet.

	* ms-excel-write.c (excel_write_BOF) : update the version in the BOF a
	  bit.

	* ms-formula-read.c : tweak the expected return types for SUM,
	  TRANSPOSE, MINVERSE, and MMULT
parent 65da6672
2004-08-15 Jody Goldberg <jody@gnome.org>
* ms-formula-write.c (write_node) : get closer to matching the classes
for the more obscure variants, OOo is wrong, but I don't have a
clear map on what is right yet.
* ms-excel-write.c (excel_write_BOF) : update the version in the BOF a
bit.
* ms-formula-read.c : tweak the expected return types for SUM,
TRANSPOSE, MINVERSE, and MMULT
2004-08-11 Jon K Hellan <hellan@acm.org>
* ms-excel-read.c (excel_formula_shared): Simplify using g_memdup.
......@@ -13,7 +25,7 @@
2004-08-11 Jon K Hellan <hellan@acm.org>
Export images.
Export images.
* Makefile.am (excel_la_SOURCES): Add crypt-md4.[ch]
......
......@@ -306,7 +306,7 @@ excel_write_BOF (BiffPut *bp, MsBiffFileType type)
GSF_LE_SET_GUINT16 (data+ 0, 0x0600); /* worksheet */
GSF_LE_SET_GUINT16 (data+ 4, 0x2775); /* build id == XP SP3 */
GSF_LE_SET_GUINT16 (data+ 6, 0x07cd); /* build year (= 1997) */
GSF_LE_SET_GUINT32 (data+ 8, 0x000080c1); /* flags */
GSF_LE_SET_GUINT32 (data+ 8, 0x000080c9); /* flags */
GSF_LE_SET_GUINT32 (data+12, 0x00000206);
break;
......@@ -2610,7 +2610,11 @@ excel_write_FORMULA (ExcelWriteState *ewb, ExcelWriteSheet *esheet, GnmCell cons
GSF_LE_SET_GUINT16 (data + 14, /* alwaysCalc & calcOnLoad */
(cell->base.flags & DEPENDENT_HAS_DYNAMIC_DEPS) ? 1 : 0);
/*** This is why XL produces a warning when exiting with files we generate
* and complains about them being from 'older' versions. The numbers
* have no obvious pattern but I have not looked terribly hard. */
GSF_LE_SET_GUINT32 (data + 16, 0x0);
GSF_LE_SET_GUINT16 (data + 20, 0x0); /* bogus len, fill in later */
ms_biff_put_var_write (ewb->bp, data, 22);
len = excel_write_formula (ewb, expr, esheet->gnum_sheet,
......
......@@ -41,7 +41,7 @@ ExcelFuncDesc const excel_func_desc [] = {
/* 1 */ { "IF", XL_VARARG, 2, 'V', "VVV" },
/* 2 */ { "ISNA", XL_FIXED, 1, 'V', "V" },
/* 3 */ { "ISERROR", XL_FIXED, 1, 'V', "V" },
/* 4 */ { "SUM", XL_VARARG, 1, 'V', "V" },
/* 4 */ { "SUM", XL_VARARG, 1, 'V', "R" },
/* 5 */ { "AVERAGE", XL_VARARG, 1, 'V', "R" },
/* 6 */ { "MIN", XL_VARARG, 1, 'V', "R" },
/* 7 */ { "MAX", XL_VARARG, 1, 'V', "R" },
......@@ -120,7 +120,7 @@ ExcelFuncDesc const excel_func_desc [] = {
/* 80 */ { "RELREF", XL_XLM },
/* 81 */ { "ARGUMENT", XL_XLM },
/* 82 */ { "SEARCH", XL_VARARG, 1, 'V', "V" }, /* Start_num is optional */
/* 83 */ { "TRANSPOSE", XL_FIXED, 1, 'V', "A" },
/* 83 */ { "TRANSPOSE", XL_FIXED, 1, 'A', "A" },
/* 84 */ { "ERROR", XL_XLM },
/* 85 */ { "STEP", XL_XLM },
/* 86 */ { "TYPE", XL_FIXED, 1, 'V', "V" },
......@@ -201,8 +201,8 @@ ExcelFuncDesc const excel_func_desc [] = {
/* 161 */ { "DIALOGBOX", XL_XLM },
/* 162 */ { "CLEAN", XL_FIXED, 1, 'V', "V" },
/* 163 */ { "MDETERM", XL_FIXED, 1, 'V', "A" },
/* 164 */ { "MINVERSE", XL_FIXED, 1, 'V', "A" },
/* 165 */ { "MMULT", XL_FIXED, 2, 'V', "AA" },
/* 164 */ { "MINVERSE", XL_FIXED, 1, 'A', "A" },
/* 165 */ { "MMULT", XL_FIXED, 2, 'A', "AA" },
/* 166 */ { "FILES", XL_XLM },
/* 167 */ { "IPMT", XL_VARARG, 1, 'V', "V" }, /* Type is optional */
/* 168 */ { "PPMT", XL_VARARG, 1, 'V', "V" }, /* Type is optional */
......@@ -816,11 +816,10 @@ excel_parse_formula (MSContainer const *container,
*array_element = FALSE;
#ifndef NO_DEBUG_EXCEL
if (ms_excel_formula_debug > 0) {
if (ms_excel_formula_debug > 1) {
ms_excel_dump_cellname (container->ewb, esheet, fn_col, fn_row);
fprintf (stderr, "\n");
if (ms_excel_formula_debug > 1) {
fprintf (stderr, "--> len = %d\n", length);
gsf_mem_dump (mem, length);
}
}
......
......@@ -223,13 +223,13 @@ static void write_node (PolishData *pd, GnmExpr const *expr,
static guint8 xl_op_class[NUM_CTXTS][NUM_XL_TYPES][NUM_XL_TYPES+1] = {
{ /* CELL | Wants REF Wants VAL Wants ARR From Root */
/* From REF */ { CLASS_REF, CLASS_VAL, CLASS_ARRAY, CLASS_VAL },
/* From VAL */ { CLASS_VAL, CLASS_VAL, CLASS_ARRAY, CLASS_VAL },
/* From VAL */ { CLASS_VAL, CLASS_VAL, CLASS_VAL, CLASS_VAL },
/* From ARRAY */ { CLASS_ARRAY, CLASS_VAL, CLASS_ARRAY, CLASS_VAL },
},
{ /* ARR | Wants REF Wants VAL Wants ARR From Root */
/* From REF */ { CLASS_REF, CLASS_VAL, CLASS_ARRAY, CLASS_VAL },
/* From VAL */ { CLASS_ARRAY, CLASS_VAL, CLASS_ARRAY, CLASS_VAL },
/* From ARRAY */ { CLASS_ARRAY, CLASS_VAL, CLASS_ARRAY, CLASS_VAL },
/* From ARRAY */ { CLASS_ARRAY, CLASS_VAL, CLASS_ARRAY, CLASS_ARRAY },
},
{ /* NAME | Wants REF Wants VAL Wants ARR From Root */
/* From REF */ { CLASS_REF, CLASS_ARRAY, CLASS_ARRAY, CLASS_REF },
......@@ -486,7 +486,7 @@ static void
write_funcall (PolishData *pd, GnmExpr const *expr,
XLOpType target_type)
{
static guint8 zeros[12] = { 0,0,0,0,0,0,0,0,0,0,0,0 };
static guint8 const zeros [12];
/* excel is limited to 128 args max */
int max_args = 126, num_args = 0;
......@@ -682,9 +682,12 @@ write_node (PolishData *pd, GnmExpr const *expr, int paren_level,
op = expr->any.oper;
switch (op) {
case GNM_EXPR_OP_ANY_BINARY :
if (target_type != XL_ARRAY)
target_type = XL_VAL;
case GNM_EXPR_OP_RANGE_CTOR:
case GNM_EXPR_OP_INTERSECT:
case GNM_EXPR_OP_ANY_BINARY : {
case GNM_EXPR_OP_INTERSECT: {
int const prec = operations[op].prec;
write_node (pd, expr->binary.value_a,
......@@ -760,8 +763,7 @@ write_node (PolishData *pd, GnmExpr const *expr, int paren_level,
target_type);
break;
/* See S59E2B.HTM for some really duff docs */
case VALUE_ARRAY : { /* Guestimation */
case VALUE_ARRAY : {
guint8 data[8];
if (v->v_array.x > 256 || v->v_array.y > 65536)
......@@ -797,7 +799,7 @@ write_node (PolishData *pd, GnmExpr const *expr, int paren_level,
int const prec = operations[op].prec;
write_node (pd, expr->unary.value, operations[op].prec,
target_type);
(target_type != XL_ARRAY) ? XL_VAL : XL_ARRAY);
push_guint8 (pd, operations[op].xl_op);
if (prec <= paren_level)
push_guint8 (pd, FORMULA_PTG_PAREN);
......
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