Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
gnumeric
Commits
f945774c
Commit
f945774c
authored
May 02, 1999
by
Michael Meeks
Browse files
Major re-write of internals if ms-formula.
Huge clean, and mean.
parent
4eac2ae1
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
ChangeLog-1999-07-09
View file @
f945774c
1999-05-02 Michael Meeks <michael@imaginator.com>
* src/expr.h: Spelling fix 'substract' :-)
* src/expr.c (expr_tree_new): Added for convenience.
1999-05-02 Michael Meeks <michael@imaginator.com>
* src/cell.c (cell_set_value): Created.
...
...
ChangeLog-2000-02-23
View file @
f945774c
1999-05-02 Michael Meeks <michael@imaginator.com>
* src/expr.h: Spelling fix 'substract' :-)
* src/expr.c (expr_tree_new): Added for convenience.
1999-05-02 Michael Meeks <michael@imaginator.com>
* src/cell.c (cell_set_value): Created.
...
...
OChangeLog-1999-07-09
View file @
f945774c
1999-05-02 Michael Meeks <michael@imaginator.com>
* src/expr.h: Spelling fix 'substract' :-)
* src/expr.c (expr_tree_new): Added for convenience.
1999-05-02 Michael Meeks <michael@imaginator.com>
* src/cell.c (cell_set_value): Created.
...
...
OChangeLog-2000-02-23
View file @
f945774c
1999-05-02 Michael Meeks <michael@imaginator.com>
* src/expr.h: Spelling fix 'substract' :-)
* src/expr.c (expr_tree_new): Added for convenience.
1999-05-02 Michael Meeks <michael@imaginator.com>
* src/cell.c (cell_set_value): Created.
...
...
plugins/excel/ChangeLog
View file @
f945774c
1999-05-02 Michael Meeks <michael@imaginator.com>
* ms-excel.c (biff_get_externsheet_name): Converted to return
a Sheet *
(ms_excel_sheet_shared_formula): Returns ExprTree.
(biff_boundsheet_data_new): Added EXCEL_SHEET * to BOUNDSHEET_DATA
this really needs rationalising !
Fixed all things that use ms_formula stuff...
* ms-formula.c: The most comprehensive re-write of the entire
formula parsing structure. 80% + of code changed. Now smaller,
cleaner, meaner, leaner ... and featuring all your favorite bugs.
1999-05-02 Michael Meeks <michael@imaginator.com>
* ms-excel.c (biff_xf_data_destroy): Changed prototype.
...
...
plugins/excel/README
View file @
f945774c
...
...
@@ -25,3 +25,10 @@ It will also dump the contents of drawing streams inside the BIFF do:
./ole somefile.xls draw workbook
1999-04-13 Michael Meeks <michael@imaginator.com>
Notes on ms-formula.c Changeover to ExprTrees for speed.
No precedence data needed. Can get rid of the parse_list_data array,
use GList as will make function args quicker.
All PARSE_DATA -> ExprTree
PARSE_LIST -> GList...
plugins/excel/ms-excel-read.c
View file @
f945774c
...
...
@@ -406,8 +406,8 @@ biff_boundsheet_data_new (MS_EXCEL_WORKBOOK *wb, BIFF_QUERY * q, eBiff_version v
&
ans
->
streamStartPos
,
ans
)
;
g_assert
(
ans
->
streamStartPos
==
BIFF_GETLONG
(
q
->
data
))
;
sheet
=
ms_excel_sheet_new
(
wb
,
ans
->
name
);
ms_excel_workbook_attach
(
wb
,
sheet
);
ans
->
sheet
=
ms_excel_sheet_new
(
wb
,
ans
->
name
);
ms_excel_workbook_attach
(
wb
,
ans
->
sheet
);
}
static
gboolean
...
...
@@ -1183,7 +1183,7 @@ ms_excel_sheet_new (MS_EXCEL_WORKBOOK * wb, char *name)
return
ans
;
}
char
*
ExprTree
*
ms_excel_sheet_shared_formula
(
MS_EXCEL_SHEET
*
sheet
,
int
shr_col
,
int
shr_row
,
int
col
,
int
row
)
...
...
@@ -1199,7 +1199,7 @@ ms_excel_sheet_shared_formula (MS_EXCEL_SHEET *sheet,
sf
->
data_len
)
;
if
(
EXCEL_DEBUG
>
0
)
printf
(
"Duff shared formula index %d %d
\n
"
,
col
,
row
)
;
return
strdup
(
"00"
)
;
return
NULL
;
}
static
void
...
...
@@ -1224,6 +1224,22 @@ ms_excel_sheet_insert (MS_EXCEL_SHEET * sheet, int xfidx,
ms_excel_set_cell_xf
(
sheet
,
cell
,
xfidx
);
}
static
void
ms_excel_sheet_insert_form
(
MS_EXCEL_SHEET
*
sheet
,
int
xfidx
,
int
col
,
int
row
,
ExprTree
*
tr
)
{
Cell
*
cell
=
sheet_cell_fetch
(
sheet
->
gnum_sheet
,
col
,
row
);
/* NB. cell_set_text _certainly_ strdups *text */
if
(
tr
)
{
sheet
->
blank
=
0
;
cell_set_formula_tree_simple
(
cell
,
tr
);
}
else
cell_set_text_simple
(
cell
,
""
)
;
ms_excel_set_cell_xf
(
sheet
,
cell
,
xfidx
);
}
static
void
ms_excel_sheet_insert_val
(
MS_EXCEL_SHEET
*
sheet
,
int
xfidx
,
int
col
,
int
row
,
const
Value
*
v
)
...
...
@@ -1623,7 +1639,7 @@ ms_excel_read_cell (BIFF_QUERY * q, MS_EXCEL_SHEET * sheet)
int
array_row_first
,
array_row_last
;
BYTE
*
data
;
guint16
data_len
;
char
*
t
xt
;
ExprTree
*
t
r
;
Cell
*
cell
;
BIFF_SHARED_FORMULA
*
sf
;
...
...
@@ -1644,15 +1660,16 @@ ms_excel_read_cell (BIFF_QUERY * q, MS_EXCEL_SHEET * sheet)
if
(
EXCEL_DEBUG
>
0
)
printf
(
"Shared formula of extent %d %d %d %d
\n
"
,
array_col_first
,
array_row_first
,
array_col_last
,
array_row_last
)
;
t
xt
=
ms_excel_parse_formula
(
sheet
,
data
,
t
r
=
ms_excel_parse_formula
(
sheet
,
data
,
array_col_first
,
array_row_first
,
1
,
data_len
)
;
/* NB. This keeps the pre-set XF record */
cell
=
sheet_cell_fetch
(
sheet
->
gnum_sheet
,
array_col_first
,
array_row_first
);
if
(
txt
)
{
cell_set_text_simple
(
cell
,
txt
);
g_free
(
txt
)
;
if
(
tr
)
{
cell
=
sheet_cell_fetch
(
sheet
->
gnum_sheet
,
array_col_first
,
array_row_first
);
if
(
cell
)
cell_set_formula_tree_simple
(
cell
,
tr
);
expr_tree_unref
(
tr
);
}
break
;
}
...
...
@@ -1678,30 +1695,32 @@ ms_excel_read_cell (BIFF_QUERY * q, MS_EXCEL_SHEET * sheet)
for
(
xlp
=
array_col_first
;
xlp
<=
array_col_last
;
xlp
++
)
for
(
ylp
=
array_row_first
;
ylp
<=
array_row_last
;
ylp
++
)
{
char
*
t
xt
=
ms_excel_parse_formula
(
sheet
,
data
,
xlp
,
ylp
,
0
,
data_len
)
;
ExprTree
*
t
r
=
ms_excel_parse_formula
(
sheet
,
data
,
xlp
,
ylp
,
0
,
data_len
)
;
/* NB. This keeps the pre-set XF record */
Cell
*
cell
=
sheet_cell_fetch
(
sheet
->
gnum_sheet
,
xlp
,
ylp
);
if
(
cell
)
cell_set_text_simple
(
cell
,
txt
);
g_free
(
txt
)
;
if
(
tr
)
{
Cell
*
cell
=
sheet_cell_fetch
(
sheet
->
gnum_sheet
,
xlp
,
ylp
);
if
(
cell
)
cell_set_formula_tree_simple
(
cell
,
tr
);
expr_tree_unref
(
tr
);
}
}
break
;
}
case
BIFF_FORMULA
:
/* See: S59D8F.HTM */
{
char
*
txt
;
ExprTree
*
tr
;
if
(
q
->
length
<
22
||
q
->
length
<
22
+
BIFF_GETWORD
(
q
->
data
+
20
))
{
printf
(
"FIXME: serious formula error
\n
"
);
break
;
}
t
xt
=
ms_excel_parse_formula
(
sheet
,
(
q
->
data
+
22
),
EX_GETCOL
(
q
),
EX_GETROW
(
q
),
0
,
BIFF_GETWORD
(
q
->
data
+
20
));
ms_excel_sheet_insert
(
sheet
,
EX_GETXF
(
q
),
EX_GETCOL
(
q
),
EX_GETROW
(
q
),
t
xt
)
;
g_free
(
txt
)
;
t
r
=
ms_excel_parse_formula
(
sheet
,
(
q
->
data
+
22
),
EX_GETCOL
(
q
),
EX_GETROW
(
q
),
0
,
BIFF_GETWORD
(
q
->
data
+
20
));
ms_excel_sheet_insert
_form
(
sheet
,
EX_GETXF
(
q
),
EX_GETCOL
(
q
),
EX_GETROW
(
q
),
t
r
)
;
expr_tree_unref
(
tr
)
;
break
;
}
case
BIFF_LABELSST
:
...
...
@@ -1964,7 +1983,7 @@ ms_excel_read_sheet (MS_EXCEL_SHEET *sheet, BIFF_QUERY * q, MS_EXCEL_WORKBOOK *
return
;
}
char
*
Sheet
*
biff_get_externsheet_name
(
MS_EXCEL_WORKBOOK
*
wb
,
guint16
idx
,
gboolean
get_first
)
{
BIFF_EXTERNSHEET_DATA
*
bed
;
...
...
@@ -1972,14 +1991,15 @@ biff_get_externsheet_name(MS_EXCEL_WORKBOOK *wb, guint16 idx, gboolean get_first
guint16
index
;
if
(
idx
>=
wb
->
num_extern_sheets
)
return
"Unknown"
;
return
NULL
;
bed
=
&
wb
->
extern_sheets
[
idx
]
;
index
=
get_first
?
bed
->
first_tab
:
bed
->
last_tab
;
bsd
=
g_hash_table_lookup
(
wb
->
boundsheet_data_by_index
,
&
index
)
;
if
(
!
bsd
)
return
0
;
return
bsd
->
name
;
if
(
!
bsd
)
printf
(
"Duff sheet index %d
\n
"
,
index
);
return
bsd
->
sheet
->
gnum_sheet
;
}
/**
...
...
plugins/excel/ms-excel-read.h
View file @
f945774c
...
...
@@ -13,15 +13,6 @@
extern
Workbook
*
ms_excelReadWorkbook
(
MS_OLE
*
file
)
;
typedef
struct
_BIFF_BOUNDSHEET_DATA
{
guint16
index
;
guint32
streamStartPos
;
eBiff_filetype
type
;
eBiff_hidden
hidden
;
char
*
name
;
}
BIFF_BOUNDSHEET_DATA
;
typedef
struct
_MS_EXCEL_SHEET
{
int
blank
;
...
...
@@ -31,6 +22,16 @@ typedef struct _MS_EXCEL_SHEET
GHashTable
*
shared_formulae
;
}
MS_EXCEL_SHEET
;
typedef
struct
_BIFF_BOUNDSHEET_DATA
{
guint16
index
;
guint32
streamStartPos
;
eBiff_filetype
type
;
eBiff_hidden
hidden
;
char
*
name
;
MS_EXCEL_SHEET
*
sheet
;
}
BIFF_BOUNDSHEET_DATA
;
typedef
struct
{
guint16
col
;
guint16
row
;
...
...
@@ -42,9 +43,9 @@ typedef struct {
guint32
data_len
;
}
BIFF_SHARED_FORMULA
;
extern
char
*
ms_excel_sheet_shared_formula
(
MS_EXCEL_SHEET
*
sheet
,
int
shr_col
,
int
shr_row
,
int
col
,
int
row
)
;
extern
ExprTree
*
ms_excel_sheet_shared_formula
(
MS_EXCEL_SHEET
*
sheet
,
int
shr_col
,
int
shr_row
,
int
col
,
int
row
)
;
typedef
struct
_MS_EXCEL_PALETTE
{
...
...
@@ -106,7 +107,7 @@ typedef struct _MS_EXCEL_WORKBOOK
#define MS_EXCEL_DOUBLE_FORMAT "%.16G"
#define MS_EXCEL_DOUBLE_FORMAT_LEN 65
extern
char
*
biff_get_externsheet_name
(
MS_EXCEL_WORKBOOK
*
wb
,
guint16
idx
,
gboolean
get_first
)
;
extern
Sheet
*
biff_get_externsheet_name
(
MS_EXCEL_WORKBOOK
*
wb
,
guint16
idx
,
gboolean
get_first
)
;
extern
char
*
biff_get_text
(
BYTE
*
ptr
,
guint32
length
,
guint32
*
byte_length
)
;
extern
const
char
*
biff_get_error_text
(
const
guint8
err
)
;
extern
char
*
biff_name_data_get_name
(
MS_EXCEL_SHEET
*
sheet
,
guint16
idx
)
;
...
...
plugins/excel/ms-excel.c
View file @
f945774c
...
...
@@ -406,8 +406,8 @@ biff_boundsheet_data_new (MS_EXCEL_WORKBOOK *wb, BIFF_QUERY * q, eBiff_version v
&
ans
->
streamStartPos
,
ans
)
;
g_assert
(
ans
->
streamStartPos
==
BIFF_GETLONG
(
q
->
data
))
;
sheet
=
ms_excel_sheet_new
(
wb
,
ans
->
name
);
ms_excel_workbook_attach
(
wb
,
sheet
);
ans
->
sheet
=
ms_excel_sheet_new
(
wb
,
ans
->
name
);
ms_excel_workbook_attach
(
wb
,
ans
->
sheet
);
}
static
gboolean
...
...
@@ -1183,7 +1183,7 @@ ms_excel_sheet_new (MS_EXCEL_WORKBOOK * wb, char *name)
return
ans
;
}
char
*
ExprTree
*
ms_excel_sheet_shared_formula
(
MS_EXCEL_SHEET
*
sheet
,
int
shr_col
,
int
shr_row
,
int
col
,
int
row
)
...
...
@@ -1199,7 +1199,7 @@ ms_excel_sheet_shared_formula (MS_EXCEL_SHEET *sheet,
sf
->
data_len
)
;
if
(
EXCEL_DEBUG
>
0
)
printf
(
"Duff shared formula index %d %d
\n
"
,
col
,
row
)
;
return
strdup
(
"00"
)
;
return
NULL
;
}
static
void
...
...
@@ -1224,6 +1224,22 @@ ms_excel_sheet_insert (MS_EXCEL_SHEET * sheet, int xfidx,
ms_excel_set_cell_xf
(
sheet
,
cell
,
xfidx
);
}
static
void
ms_excel_sheet_insert_form
(
MS_EXCEL_SHEET
*
sheet
,
int
xfidx
,
int
col
,
int
row
,
ExprTree
*
tr
)
{
Cell
*
cell
=
sheet_cell_fetch
(
sheet
->
gnum_sheet
,
col
,
row
);
/* NB. cell_set_text _certainly_ strdups *text */
if
(
tr
)
{
sheet
->
blank
=
0
;
cell_set_formula_tree_simple
(
cell
,
tr
);
}
else
cell_set_text_simple
(
cell
,
""
)
;
ms_excel_set_cell_xf
(
sheet
,
cell
,
xfidx
);
}
static
void
ms_excel_sheet_insert_val
(
MS_EXCEL_SHEET
*
sheet
,
int
xfidx
,
int
col
,
int
row
,
const
Value
*
v
)
...
...
@@ -1623,7 +1639,7 @@ ms_excel_read_cell (BIFF_QUERY * q, MS_EXCEL_SHEET * sheet)
int
array_row_first
,
array_row_last
;
BYTE
*
data
;
guint16
data_len
;
char
*
t
xt
;
ExprTree
*
t
r
;
Cell
*
cell
;
BIFF_SHARED_FORMULA
*
sf
;
...
...
@@ -1644,15 +1660,16 @@ ms_excel_read_cell (BIFF_QUERY * q, MS_EXCEL_SHEET * sheet)
if
(
EXCEL_DEBUG
>
0
)
printf
(
"Shared formula of extent %d %d %d %d
\n
"
,
array_col_first
,
array_row_first
,
array_col_last
,
array_row_last
)
;
t
xt
=
ms_excel_parse_formula
(
sheet
,
data
,
t
r
=
ms_excel_parse_formula
(
sheet
,
data
,
array_col_first
,
array_row_first
,
1
,
data_len
)
;
/* NB. This keeps the pre-set XF record */
cell
=
sheet_cell_fetch
(
sheet
->
gnum_sheet
,
array_col_first
,
array_row_first
);
if
(
txt
)
{
cell_set_text_simple
(
cell
,
txt
);
g_free
(
txt
)
;
if
(
tr
)
{
cell
=
sheet_cell_fetch
(
sheet
->
gnum_sheet
,
array_col_first
,
array_row_first
);
if
(
cell
)
cell_set_formula_tree_simple
(
cell
,
tr
);
expr_tree_unref
(
tr
);
}
break
;
}
...
...
@@ -1678,30 +1695,32 @@ ms_excel_read_cell (BIFF_QUERY * q, MS_EXCEL_SHEET * sheet)
for
(
xlp
=
array_col_first
;
xlp
<=
array_col_last
;
xlp
++
)
for
(
ylp
=
array_row_first
;
ylp
<=
array_row_last
;
ylp
++
)
{
char
*
t
xt
=
ms_excel_parse_formula
(
sheet
,
data
,
xlp
,
ylp
,
0
,
data_len
)
;
ExprTree
*
t
r
=
ms_excel_parse_formula
(
sheet
,
data
,
xlp
,
ylp
,
0
,
data_len
)
;
/* NB. This keeps the pre-set XF record */
Cell
*
cell
=
sheet_cell_fetch
(
sheet
->
gnum_sheet
,
xlp
,
ylp
);
if
(
cell
)
cell_set_text_simple
(
cell
,
txt
);
g_free
(
txt
)
;
if
(
tr
)
{
Cell
*
cell
=
sheet_cell_fetch
(
sheet
->
gnum_sheet
,
xlp
,
ylp
);
if
(
cell
)
cell_set_formula_tree_simple
(
cell
,
tr
);
expr_tree_unref
(
tr
);
}
}
break
;
}
case
BIFF_FORMULA
:
/* See: S59D8F.HTM */
{
char
*
txt
;
ExprTree
*
tr
;
if
(
q
->
length
<
22
||
q
->
length
<
22
+
BIFF_GETWORD
(
q
->
data
+
20
))
{
printf
(
"FIXME: serious formula error
\n
"
);
break
;
}
t
xt
=
ms_excel_parse_formula
(
sheet
,
(
q
->
data
+
22
),
EX_GETCOL
(
q
),
EX_GETROW
(
q
),
0
,
BIFF_GETWORD
(
q
->
data
+
20
));
ms_excel_sheet_insert
(
sheet
,
EX_GETXF
(
q
),
EX_GETCOL
(
q
),
EX_GETROW
(
q
),
t
xt
)
;
g_free
(
txt
)
;
t
r
=
ms_excel_parse_formula
(
sheet
,
(
q
->
data
+
22
),
EX_GETCOL
(
q
),
EX_GETROW
(
q
),
0
,
BIFF_GETWORD
(
q
->
data
+
20
));
ms_excel_sheet_insert
_form
(
sheet
,
EX_GETXF
(
q
),
EX_GETCOL
(
q
),
EX_GETROW
(
q
),
t
r
)
;
expr_tree_unref
(
tr
)
;
break
;
}
case
BIFF_LABELSST
:
...
...
@@ -1964,7 +1983,7 @@ ms_excel_read_sheet (MS_EXCEL_SHEET *sheet, BIFF_QUERY * q, MS_EXCEL_WORKBOOK *
return
;
}
char
*
Sheet
*
biff_get_externsheet_name
(
MS_EXCEL_WORKBOOK
*
wb
,
guint16
idx
,
gboolean
get_first
)
{
BIFF_EXTERNSHEET_DATA
*
bed
;
...
...
@@ -1972,14 +1991,15 @@ biff_get_externsheet_name(MS_EXCEL_WORKBOOK *wb, guint16 idx, gboolean get_first
guint16
index
;
if
(
idx
>=
wb
->
num_extern_sheets
)
return
"Unknown"
;
return
NULL
;
bed
=
&
wb
->
extern_sheets
[
idx
]
;
index
=
get_first
?
bed
->
first_tab
:
bed
->
last_tab
;
bsd
=
g_hash_table_lookup
(
wb
->
boundsheet_data_by_index
,
&
index
)
;
if
(
!
bsd
)
return
0
;
return
bsd
->
name
;
if
(
!
bsd
)
printf
(
"Duff sheet index %d
\n
"
,
index
);
return
bsd
->
sheet
->
gnum_sheet
;
}
/**
...
...
plugins/excel/ms-excel.h
View file @
f945774c
...
...
@@ -13,15 +13,6 @@
extern
Workbook
*
ms_excelReadWorkbook
(
MS_OLE
*
file
)
;
typedef
struct
_BIFF_BOUNDSHEET_DATA
{
guint16
index
;
guint32
streamStartPos
;
eBiff_filetype
type
;
eBiff_hidden
hidden
;
char
*
name
;
}
BIFF_BOUNDSHEET_DATA
;
typedef
struct
_MS_EXCEL_SHEET
{
int
blank
;
...
...
@@ -31,6 +22,16 @@ typedef struct _MS_EXCEL_SHEET
GHashTable
*
shared_formulae
;
}
MS_EXCEL_SHEET
;
typedef
struct
_BIFF_BOUNDSHEET_DATA
{
guint16
index
;
guint32
streamStartPos
;
eBiff_filetype
type
;
eBiff_hidden
hidden
;
char
*
name
;
MS_EXCEL_SHEET
*
sheet
;
}
BIFF_BOUNDSHEET_DATA
;
typedef
struct
{
guint16
col
;
guint16
row
;
...
...
@@ -42,9 +43,9 @@ typedef struct {
guint32
data_len
;
}
BIFF_SHARED_FORMULA
;
extern
char
*
ms_excel_sheet_shared_formula
(
MS_EXCEL_SHEET
*
sheet
,
int
shr_col
,
int
shr_row
,
int
col
,
int
row
)
;
extern
ExprTree
*
ms_excel_sheet_shared_formula
(
MS_EXCEL_SHEET
*
sheet
,
int
shr_col
,
int
shr_row
,
int
col
,
int
row
)
;
typedef
struct
_MS_EXCEL_PALETTE
{
...
...
@@ -106,7 +107,7 @@ typedef struct _MS_EXCEL_WORKBOOK
#define MS_EXCEL_DOUBLE_FORMAT "%.16G"
#define MS_EXCEL_DOUBLE_FORMAT_LEN 65
extern
char
*
biff_get_externsheet_name
(
MS_EXCEL_WORKBOOK
*
wb
,
guint16
idx
,
gboolean
get_first
)
;
extern
Sheet
*
biff_get_externsheet_name
(
MS_EXCEL_WORKBOOK
*
wb
,
guint16
idx
,
gboolean
get_first
)
;
extern
char
*
biff_get_text
(
BYTE
*
ptr
,
guint32
length
,
guint32
*
byte_length
)
;
extern
const
char
*
biff_get_error_text
(
const
guint8
err
)
;
extern
char
*
biff_name_data_get_name
(
MS_EXCEL_SHEET
*
sheet
,
guint16
idx
)
;
...
...
plugins/excel/ms-formula-read.c
View file @
f945774c
This diff is collapsed.
Click to expand it.
plugins/excel/ms-formula-read.h
View file @
f945774c
...
...
@@ -12,9 +12,10 @@
#include
"ms-excel.h"
#include
"ms-biff.h"
char
*
ms_excel_parse_formula
(
MS_EXCEL_SHEET
*
sheet
,
guint8
*
mem
,
int
fn_col
,
int
fn_row
,
int
shared
,
guint16
length
)
;
ExprTree
*
ms_excel_parse_formula
(
MS_EXCEL_SHEET
*
sheet
,
guint8
*
mem
,
int
fn_col
,
int
fn_row
,
int
shared
,
guint16
length
)
;
/**
* See S59E2B.HTM
...
...
@@ -49,17 +50,4 @@ typedef struct _FORMULA_ARRAY_DATA
int
src_col
,
src_row
,
dest_col
,
dest_row
;
}
FORMULA_ARRAY_DATA
;
typedef
struct
_FORMULA_OP_DATA
{
gboolean
infix
;
/* ie. not unary */
char
*
mid
;
int
precedence
;
}
FORMULA_OP_DATA
;
typedef
struct
_FORMULA_FUNC_DATA
{
char
*
prefix
;
int
num_args
;
/* -1 for multi-arg */
}
FORMULA_FUNC_DATA
;
#endif
plugins/excel/ms-formula.c
View file @
f945774c
This diff is collapsed.
Click to expand it.
plugins/excel/ms-formula.h
View file @
f945774c
...
...
@@ -12,9 +12,10 @@
#include
"ms-excel.h"
#include
"ms-biff.h"
char
*
ms_excel_parse_formula
(
MS_EXCEL_SHEET
*
sheet
,
guint8
*
mem
,
int
fn_col
,
int
fn_row
,
int
shared
,
guint16
length
)
;
ExprTree
*
ms_excel_parse_formula
(
MS_EXCEL_SHEET
*
sheet
,
guint8
*
mem
,
int
fn_col
,
int
fn_row
,
int
shared
,
guint16
length
)
;
/**
* See S59E2B.HTM
...
...
@@ -49,17 +50,4 @@ typedef struct _FORMULA_ARRAY_DATA
int
src_col
,
src_row
,
dest_col
,
dest_row
;
}
FORMULA_ARRAY_DATA
;
typedef
struct
_FORMULA_OP_DATA
{
gboolean
infix
;
/* ie. not unary */
char
*
mid
;
int
precedence
;
}
FORMULA_OP_DATA
;
typedef
struct
_FORMULA_FUNC_DATA
{
char
*
prefix
;
int
num_args
;
/* -1 for multi-arg */
}
FORMULA_FUNC_DATA
;
#endif
src/expr.c
View file @
f945774c
...
...
@@ -67,6 +67,17 @@ do_expr_tree_ref (ExprTree *tree)
}
}
ExprTree
*
expr_tree_new
()
{
ExprTree
*
ans
=
g_new
(
ExprTree
,
1
);
if
(
!
ans
)
return
NULL
;
ans
->
ref_count
=
1
;
ans
->
oper
=
OPER_CONSTANT
;
ans
->
u
.
constant
=
NULL
;
return
ans
;
}
/*
* expr_tree_ref:
* Increments the ref_count for part of a tree
...
...
src/expr.h
View file @
f945774c
...
...
@@ -20,7 +20,7 @@ typedef enum {
OPER_NOT_EQUAL
,
/* Compare for non equivalence */
OPER_ADD
,
/* Add */
OPER_SUB
,
/* Sub
s
tract */
OPER_SUB
,
/* Subtract */
OPER_MULT
,
/* Multiply */
OPER_DIV
,
/* Divide */
OPER_EXP
,
/* Exponentiate */
...
...
@@ -163,6 +163,7 @@ ExprTree *expr_tree_relocate (ExprTree *expr, int col_diff, int row_diff);
char
*
expr_decode_tree
(
ExprTree
*
tree
,
Sheet
*
sheet
,
int
col
,
int
row
);
ExprTree
*
expr_tree_new
();
void
expr_tree_ref
(
ExprTree
*
tree
);
void
expr_tree_unref
(
ExprTree
*
tree
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment