diff --git a/plugins/lotus-123/ChangeLog b/plugins/lotus-123/ChangeLog index 1e0332688820500e8d9dbf708025d5bf70bf1876..5cfbb1559f7b556601e320d20dcd6234a061c8a4 100644 --- a/plugins/lotus-123/ChangeLog +++ b/plugins/lotus-123/ChangeLog @@ -1,3 +1,7 @@ +2002-07-15 Jody Goldberg + + * lotus-formula.c : NA has no args + 2002-07-15 Jody Goldberg * lotus.c (read_workbook) : use cell_set_expr_and_value for formulas. diff --git a/plugins/lotus-123/lotus-formula.c b/plugins/lotus-123/lotus-formula.c index ccf12ac4d0fe047767798bc562ec8e17d84d0866..e06c37f00067b3d91b4a915bb7310ac944759755 100644 --- a/plugins/lotus-123/lotus-formula.c +++ b/plugins/lotus-123/lotus-formula.c @@ -43,7 +43,7 @@ const func_struct_t functions[] = { { 2, 0x15, "bit-or", BINOP, OPER_OR }, FIXME */ { 1, 0x16, "NOT", NORMAL, 0 }, { 1, 0x17, "+", UNARY, GNM_EXPR_OP_UNARY_PLUS }, - { 1, 0x1F, "NA", NORMAL, 0 }, + { 0, 0x1F, "NA", NORMAL, 0 }, { 1, 0x20, "ERR", NORMAL, 0 }, { 1, 0x21, "abs", NORMAL, 0 }, { 1, 0x22, "floor", NORMAL, 0 }, diff --git a/plugins/lotus-123/lotus.c b/plugins/lotus-123/lotus.c index 910a6bf83ff9266999ea3766eb353fd8b779de64..3cd19d6e5c3b5a818e8198985b65163c71f048b7 100644 --- a/plugins/lotus-123/lotus.c +++ b/plugins/lotus-123/lotus.c @@ -287,24 +287,32 @@ read_workbook (Workbook *wb, GsfInput *input) if (r->len >= 15) { int col = gnumeric_get_le_uint16 (r->data + 1); int row = gnumeric_get_le_uint16 (r->data + 3); - guint16 const magic = gnumeric_get_le_uint16 (r->data + 11) & 0x7ff8; int len = gnumeric_get_le_int16 (r->data + 13); GnmExpr const *expr; fmt = r->data[0]; +#if DEBUG puts (cell_coord_name (col, row)); gsf_mem_dump (r->data+5,8); +#endif if (r->len < (15+len)) break; expr = lotus_parse_formula (sheet, col, row, r->data + 15, len); v = NULL; - if (0x7ff0 == (gnumeric_get_le_uint16 (r->data + 11) & 0x7ff8) && - LOTUS_STRING == record_peek_next (r)) { - record_next (r); - v = value_new_string (r->data + 5); + if (0x7ff0 == (gnumeric_get_le_uint16 (r->data + 11) & 0x7ff8)) { + /* I can not find normative definition + * for when this is an error, an when + * a string, so we cheat, and peek + * at the next record. + */ + if (LOTUS_STRING == record_peek_next (r)) { + record_next (r); + v = value_new_string (r->data + 5); + } else + v = value_new_error (NULL, gnumeric_err_VALUE); } else v = value_new_float (gnumeric_get_le_double (r->data + 5)); cell = sheet_cell_fetch (sheet, col, row),