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
bb93beaa
Commit
bb93beaa
authored
Feb 12, 1999
by
Michael Meeks
Browse files
Fixed up string tables, implemented correct string support, new XL icon
parent
f0e596ef
Changes
15
Hide whitespace changes
Inline
Side-by-side
ChangeLog-1999-07-09
View file @
bb93beaa
1999-02-12 Michael Meeks <sca20@cam.ac.uk>
* plugins/excel/ms-excel.c (biff_get_global_string):
Drasticly simplified, accelerated and in-lined out.
(biff_get_text): Fixed using unicode spec, various
updates to calls to it, fixing offsets.
Removed lots of debug output to speedup
1999-02-10 Sean Atkinson <sca20@cam.ac.uk>
* src/fn-math.c (callback_function_sum): enhanced warning for
unknown value->type.
1999-02-12 Frederic Devernay <devernay@istar.fr>
* plugins/perl/perl.c: Handle the #define dirty in perl-thread.
...
...
ChangeLog-2000-02-23
View file @
bb93beaa
1999-02-12 Michael Meeks <sca20@cam.ac.uk>
* plugins/excel/ms-excel.c (biff_get_global_string):
Drasticly simplified, accelerated and in-lined out.
(biff_get_text): Fixed using unicode spec, various
updates to calls to it, fixing offsets.
Removed lots of debug output to speedup
1999-02-10 Sean Atkinson <sca20@cam.ac.uk>
* src/fn-math.c (callback_function_sum): enhanced warning for
unknown value->type.
1999-02-12 Frederic Devernay <devernay@istar.fr>
* plugins/perl/perl.c: Handle the #define dirty in perl-thread.
...
...
OChangeLog-1999-07-09
View file @
bb93beaa
1999-02-12 Michael Meeks <sca20@cam.ac.uk>
* plugins/excel/ms-excel.c (biff_get_global_string):
Drasticly simplified, accelerated and in-lined out.
(biff_get_text): Fixed using unicode spec, various
updates to calls to it, fixing offsets.
Removed lots of debug output to speedup
1999-02-10 Sean Atkinson <sca20@cam.ac.uk>
* src/fn-math.c (callback_function_sum): enhanced warning for
unknown value->type.
1999-02-12 Frederic Devernay <devernay@istar.fr>
* plugins/perl/perl.c: Handle the #define dirty in perl-thread.
...
...
OChangeLog-2000-02-23
View file @
bb93beaa
1999-02-12 Michael Meeks <sca20@cam.ac.uk>
* plugins/excel/ms-excel.c (biff_get_global_string):
Drasticly simplified, accelerated and in-lined out.
(biff_get_text): Fixed using unicode spec, various
updates to calls to it, fixing offsets.
Removed lots of debug output to speedup
1999-02-10 Sean Atkinson <sca20@cam.ac.uk>
* src/fn-math.c (callback_function_sum): enhanced warning for
unknown value->type.
1999-02-12 Frederic Devernay <devernay@istar.fr>
* plugins/perl/perl.c: Handle the #define dirty in perl-thread.
...
...
gnome-gnumeric-xl.png
0 → 100644
View file @
bb93beaa
4.42 KB
plugins/excel/ms-excel-read.c
View file @
bb93beaa
...
...
@@ -31,60 +31,81 @@
#include
"ms-excel.h"
#include
"ms-excel-biff.h"
#define STRNPRINTF(ptr,n){ int xxxlp; printf ("'") ; for (xxxlp=0;xxxlp<(n);xxxlp++) printf ("%c", (ptr)[xxxlp]) ; printf ("'\n") ; }
/* Forward references */
static
MS_EXCEL_SHEET
*
ms_excel_sheet_new
(
MS_EXCEL_WORKBOOK
*
wb
,
char
*
name
)
;
static
void
ms_excel_workbook_attach
(
MS_EXCEL_WORKBOOK
*
wb
,
MS_EXCEL_SHEET
*
ans
)
;
/*
* FIXME: This needs proper unicode support ! current support is a guess
* see S59D47.HTM for full description
*/
/**
* This function takes a length argument as Biff V7 has a byte length
* ( seemingly ).
* FIXME: see S59D47.HTM for full description
**/
static
char
*
biff_get_text
(
BYTE
*
ptr
,
int
length
)
{
int
lp
,
unicode
;
int
lp
;
char
*
ans
;
BYTE
*
inb
;
BYTE
header
;
gboolean
high_byte
;
gboolean
ext_str
;
gboolean
rich_str
;
if
(
!
length
)
return
0
;
ans
=
(
char
*
)
g_malloc
(
sizeof
(
char
)
*
length
+
2
);
/*
* Magic unicode number
*/
unicode
=
(
ptr
[
0
]
==
0x1
);
inb
=
unicode
?
ptr
+
1
:
ptr
;
header
=
BIFF_GETBYTE
(
ptr
)
;
/* I assume that this header is backwards compatible with raw ASCII */
if
(((
header
&
0xf0
)
==
0
)
&&
((
header
&
0x02
)
==
0
))
/* Its a proper Unicode header grbit byte */
{
high_byte
=
(
header
&
0x1
)
!=
0
;
ext_str
=
(
header
&
0x4
)
!=
0
;
rich_str
=
(
header
&
0x8
)
!=
0
;
ptr
++
;
}
else
/* Some assumptions: FIXME ? */
{
high_byte
=
0
;
ext_str
=
0
;
rich_str
=
0
;
}
for
(
lp
=
0
;
lp
<
length
;
lp
++
){
ans
[
lp
]
=
(
char
)
*
inb
;
inb
+=
unicode
?
2
:
1
;
/* A few friendly warnings */
if
(
high_byte
)
printf
(
"FIXME: unicode support unimplemented: truncating
\n
"
)
;
if
(
rich_str
)
/* The data for this appears after the string */
{
guint16
formatting_runs
=
BIFF_GETWORD
(
ptr
)
;
ptr
+=
2
;
printf
(
"FIXME: rich string support unimplemented: discarding %d runs
\n
"
,
formatting_runs
)
;
}
if
(
ext_str
)
/* NB this data always comes after the rich_str data */
{
guint32
len_ext_rst
=
BIFF_GETLONG
(
ptr
)
;
printf
(
"FIXME: extended string support unimplemented: ignoring %d bytes
\n
"
,
len_ext_rst
)
;
ptr
+=
4
;
}
for
(
lp
=
0
;
lp
<
length
;
lp
++
)
{
ans
[
lp
]
=
(
char
)
*
ptr
;
ptr
+=
high_byte
?
2
:
1
;
}
ans
[
lp
]
=
0
;
ans
[
lp
]
=
0
;
return
ans
;
}
static
char
*
biff_get_global_string
(
MS_EXCEL_SHEET
*
sheet
,
int
number
)
{
char
*
temp
;
int
length
,
k
;
MS_EXCEL_WORKBOOK
*
wb
=
sheet
->
wb
;
if
(
number
>=
wb
->
global_string_max
)
return
"Too Weird"
;
temp
=
wb
->
global_strings
;
for
(
k
=
0
;
k
<
number
;
k
++
){
length
=
BIFF_GETWORD
(
temp
);
temp
+=
length
+
3
;
}
length
=
BIFF_GETWORD
(
temp
);
return
biff_get_text
(
temp
+
3
,
length
);
return
wb
->
global_strings
[
number
]
;
}
/**
...
...
@@ -181,6 +202,9 @@ ms_biff_bof_data_destroy (BIFF_BOF_DATA * data)
g_free
(
data
);
}
/**
* See S59D61.HTM
**/
static
void
biff_boundsheet_data_new
(
MS_EXCEL_WORKBOOK
*
wb
,
BIFF_QUERY
*
q
,
eBiff_version
ver
)
{
...
...
@@ -229,9 +253,8 @@ biff_boundsheet_data_new (MS_EXCEL_WORKBOOK *wb, BIFF_QUERY * q, eBiff_version v
ans
->
hidden
=
eBiffHVisible
;
break
;
}
if
(
ver
==
eBiffV8
){
if
(
ver
==
eBiffV8
)
{
int
strlen
=
BIFF_GETWORD
(
q
->
data
+
6
);
ans
->
name
=
biff_get_text
(
q
->
data
+
8
,
strlen
);
}
else
{
int
strlen
=
BIFF_GETBYTE
(
q
->
data
+
6
);
...
...
@@ -1067,7 +1090,6 @@ ms_excel_read_cell (BIFF_QUERY * q, MS_EXCEL_SHEET * sheet)
/*
printf ("Cell [%d, %d] = ", EX_GETCOL(q), EX_GETROW(q));
dump (q->data, q->length);
STRNPRINTF(q->data + 8, EX_GETSTRLEN(q));
*/
printf
(
"Rstring
\n
"
)
;
ms_excel_sheet_insert
(
sheet
,
EX_GETXF
(
q
),
EX_GETCOL
(
q
),
EX_GETROW
(
q
),
...
...
@@ -1159,11 +1181,16 @@ ms_excel_read_cell (BIFF_QUERY * q, MS_EXCEL_SHEET * sheet)
case
BIFF_LABELSST
:
{
char
*
str
;
guint32
idx
=
BIFF_GETLONG
(
q
->
data
+
6
)
;
str
=
biff_get_global_string
(
sheet
,
BIFF_GETLONG
(
q
->
data
+
6
));
if
(
idx
>=
sheet
->
wb
->
global_string_max
)
{
printf
(
"string index 0x%x out of range
\n
"
,
idx
)
;
break
;
}
str
=
sheet
->
wb
->
global_strings
[
idx
]
;
ms_excel_sheet_insert
(
sheet
,
EX_GETXF
(
q
),
EX_GETCOL
(
q
),
EX_GETROW
(
q
),
str
);
g_free
(
str
);
break
;
}
default:
...
...
@@ -1388,8 +1415,8 @@ ms_excelReadWorkbook (MS_OLE * file)
{
BIFF_FONT_DATA
*
ptr
;
printf
(
"Read Font
\n
"
);
dump
(
q
->
data
,
q
->
length
);
/*
printf ("Read Font\n");
dump (q->data, q->length);
*/
biff_font_data_new
(
wb
,
q
);
}
break
;
...
...
@@ -1406,13 +1433,21 @@ ms_excelReadWorkbook (MS_OLE * file)
biff_xf_data_new
(
wb
,
q
,
ver
->
version
)
;
break
;
case
BIFF_SST
:
/* see S59DE7.HTM */
wb
->
global_strings
=
g_malloc
(
q
->
length
-
8
);
memcpy
(
wb
->
global_strings
,
q
->
data
+
8
,
q
->
length
-
8
);
{
int
length
,
k
;
char
*
temp
;
wb
->
global_string_max
=
BIFF_GETLONG
(
q
->
data
+
4
);
printf
(
"There are apparently %d strings
\n
"
,
wb
->
global_string_max
);
dump
(
q
->
data
+
8
,
q
->
length
-
8
)
;
wb
->
global_strings
=
g_new
(
char
*
,
wb
->
global_string_max
)
;
temp
=
q
->
data
+
8
;
for
(
k
=
0
;
k
<
wb
->
global_string_max
;
k
++
)
{
length
=
BIFF_GETWORD
(
temp
)
;
wb
->
global_strings
[
k
]
=
biff_get_text
(
temp
+
2
,
length
)
;
temp
+=
length
+
3
;
}
break
;
}
case
BIFF_EXTERNSHEET
:
{
if
(
ver
->
version
==
eBiffV8
)
...
...
plugins/excel/ms-excel-read.h
View file @
bb93beaa
...
...
@@ -72,11 +72,7 @@ typedef struct _MS_EXCEL_WORKBOOK
BIFF_EXTERNSHEET_DATA
*
extern_sheets
;
guint16
num_extern_sheets
;
MS_EXCEL_PALETTE
*
palette
;
/**
* Global strings kludge, works for me,
* Caveat Emptor -- njl195@zepler.org
**/
char
*
global_strings
;
char
**
global_strings
;
int
global_string_max
;
/**
...
...
plugins/excel/ms-excel.c
View file @
bb93beaa
...
...
@@ -31,60 +31,81 @@
#include
"ms-excel.h"
#include
"ms-excel-biff.h"
#define STRNPRINTF(ptr,n){ int xxxlp; printf ("'") ; for (xxxlp=0;xxxlp<(n);xxxlp++) printf ("%c", (ptr)[xxxlp]) ; printf ("'\n") ; }
/* Forward references */
static
MS_EXCEL_SHEET
*
ms_excel_sheet_new
(
MS_EXCEL_WORKBOOK
*
wb
,
char
*
name
)
;
static
void
ms_excel_workbook_attach
(
MS_EXCEL_WORKBOOK
*
wb
,
MS_EXCEL_SHEET
*
ans
)
;
/*
* FIXME: This needs proper unicode support ! current support is a guess
* see S59D47.HTM for full description
*/
/**
* This function takes a length argument as Biff V7 has a byte length
* ( seemingly ).
* FIXME: see S59D47.HTM for full description
**/
static
char
*
biff_get_text
(
BYTE
*
ptr
,
int
length
)
{
int
lp
,
unicode
;
int
lp
;
char
*
ans
;
BYTE
*
inb
;
BYTE
header
;
gboolean
high_byte
;
gboolean
ext_str
;
gboolean
rich_str
;
if
(
!
length
)
return
0
;
ans
=
(
char
*
)
g_malloc
(
sizeof
(
char
)
*
length
+
2
);
/*
* Magic unicode number
*/
unicode
=
(
ptr
[
0
]
==
0x1
);
inb
=
unicode
?
ptr
+
1
:
ptr
;
header
=
BIFF_GETBYTE
(
ptr
)
;
/* I assume that this header is backwards compatible with raw ASCII */
if
(((
header
&
0xf0
)
==
0
)
&&
((
header
&
0x02
)
==
0
))
/* Its a proper Unicode header grbit byte */
{
high_byte
=
(
header
&
0x1
)
!=
0
;
ext_str
=
(
header
&
0x4
)
!=
0
;
rich_str
=
(
header
&
0x8
)
!=
0
;
ptr
++
;
}
else
/* Some assumptions: FIXME ? */
{
high_byte
=
0
;
ext_str
=
0
;
rich_str
=
0
;
}
for
(
lp
=
0
;
lp
<
length
;
lp
++
){
ans
[
lp
]
=
(
char
)
*
inb
;
inb
+=
unicode
?
2
:
1
;
/* A few friendly warnings */
if
(
high_byte
)
printf
(
"FIXME: unicode support unimplemented: truncating
\n
"
)
;
if
(
rich_str
)
/* The data for this appears after the string */
{
guint16
formatting_runs
=
BIFF_GETWORD
(
ptr
)
;
ptr
+=
2
;
printf
(
"FIXME: rich string support unimplemented: discarding %d runs
\n
"
,
formatting_runs
)
;
}
if
(
ext_str
)
/* NB this data always comes after the rich_str data */
{
guint32
len_ext_rst
=
BIFF_GETLONG
(
ptr
)
;
printf
(
"FIXME: extended string support unimplemented: ignoring %d bytes
\n
"
,
len_ext_rst
)
;
ptr
+=
4
;
}
for
(
lp
=
0
;
lp
<
length
;
lp
++
)
{
ans
[
lp
]
=
(
char
)
*
ptr
;
ptr
+=
high_byte
?
2
:
1
;
}
ans
[
lp
]
=
0
;
ans
[
lp
]
=
0
;
return
ans
;
}
static
char
*
biff_get_global_string
(
MS_EXCEL_SHEET
*
sheet
,
int
number
)
{
char
*
temp
;
int
length
,
k
;
MS_EXCEL_WORKBOOK
*
wb
=
sheet
->
wb
;
if
(
number
>=
wb
->
global_string_max
)
return
"Too Weird"
;
temp
=
wb
->
global_strings
;
for
(
k
=
0
;
k
<
number
;
k
++
){
length
=
BIFF_GETWORD
(
temp
);
temp
+=
length
+
3
;
}
length
=
BIFF_GETWORD
(
temp
);
return
biff_get_text
(
temp
+
3
,
length
);
return
wb
->
global_strings
[
number
]
;
}
/**
...
...
@@ -181,6 +202,9 @@ ms_biff_bof_data_destroy (BIFF_BOF_DATA * data)
g_free
(
data
);
}
/**
* See S59D61.HTM
**/
static
void
biff_boundsheet_data_new
(
MS_EXCEL_WORKBOOK
*
wb
,
BIFF_QUERY
*
q
,
eBiff_version
ver
)
{
...
...
@@ -229,9 +253,8 @@ biff_boundsheet_data_new (MS_EXCEL_WORKBOOK *wb, BIFF_QUERY * q, eBiff_version v
ans
->
hidden
=
eBiffHVisible
;
break
;
}
if
(
ver
==
eBiffV8
){
if
(
ver
==
eBiffV8
)
{
int
strlen
=
BIFF_GETWORD
(
q
->
data
+
6
);
ans
->
name
=
biff_get_text
(
q
->
data
+
8
,
strlen
);
}
else
{
int
strlen
=
BIFF_GETBYTE
(
q
->
data
+
6
);
...
...
@@ -1067,7 +1090,6 @@ ms_excel_read_cell (BIFF_QUERY * q, MS_EXCEL_SHEET * sheet)
/*
printf ("Cell [%d, %d] = ", EX_GETCOL(q), EX_GETROW(q));
dump (q->data, q->length);
STRNPRINTF(q->data + 8, EX_GETSTRLEN(q));
*/
printf
(
"Rstring
\n
"
)
;
ms_excel_sheet_insert
(
sheet
,
EX_GETXF
(
q
),
EX_GETCOL
(
q
),
EX_GETROW
(
q
),
...
...
@@ -1159,11 +1181,16 @@ ms_excel_read_cell (BIFF_QUERY * q, MS_EXCEL_SHEET * sheet)
case
BIFF_LABELSST
:
{
char
*
str
;
guint32
idx
=
BIFF_GETLONG
(
q
->
data
+
6
)
;
str
=
biff_get_global_string
(
sheet
,
BIFF_GETLONG
(
q
->
data
+
6
));
if
(
idx
>=
sheet
->
wb
->
global_string_max
)
{
printf
(
"string index 0x%x out of range
\n
"
,
idx
)
;
break
;
}
str
=
sheet
->
wb
->
global_strings
[
idx
]
;
ms_excel_sheet_insert
(
sheet
,
EX_GETXF
(
q
),
EX_GETCOL
(
q
),
EX_GETROW
(
q
),
str
);
g_free
(
str
);
break
;
}
default:
...
...
@@ -1388,8 +1415,8 @@ ms_excelReadWorkbook (MS_OLE * file)
{
BIFF_FONT_DATA
*
ptr
;
printf
(
"Read Font
\n
"
);
dump
(
q
->
data
,
q
->
length
);
/*
printf ("Read Font\n");
dump (q->data, q->length);
*/
biff_font_data_new
(
wb
,
q
);
}
break
;
...
...
@@ -1406,13 +1433,21 @@ ms_excelReadWorkbook (MS_OLE * file)
biff_xf_data_new
(
wb
,
q
,
ver
->
version
)
;
break
;
case
BIFF_SST
:
/* see S59DE7.HTM */
wb
->
global_strings
=
g_malloc
(
q
->
length
-
8
);
memcpy
(
wb
->
global_strings
,
q
->
data
+
8
,
q
->
length
-
8
);
{
int
length
,
k
;
char
*
temp
;
wb
->
global_string_max
=
BIFF_GETLONG
(
q
->
data
+
4
);
printf
(
"There are apparently %d strings
\n
"
,
wb
->
global_string_max
);
dump
(
q
->
data
+
8
,
q
->
length
-
8
)
;
wb
->
global_strings
=
g_new
(
char
*
,
wb
->
global_string_max
)
;
temp
=
q
->
data
+
8
;
for
(
k
=
0
;
k
<
wb
->
global_string_max
;
k
++
)
{
length
=
BIFF_GETWORD
(
temp
)
;
wb
->
global_strings
[
k
]
=
biff_get_text
(
temp
+
2
,
length
)
;
temp
+=
length
+
3
;
}
break
;
}
case
BIFF_EXTERNSHEET
:
{
if
(
ver
->
version
==
eBiffV8
)
...
...
plugins/excel/ms-excel.h
View file @
bb93beaa
...
...
@@ -72,11 +72,7 @@ typedef struct _MS_EXCEL_WORKBOOK
BIFF_EXTERNSHEET_DATA
*
extern_sheets
;
guint16
num_extern_sheets
;
MS_EXCEL_PALETTE
*
palette
;
/**
* Global strings kludge, works for me,
* Caveat Emptor -- njl195@zepler.org
**/
char
*
global_strings
;
char
**
global_strings
;
int
global_string_max
;
/**
...
...
plugins/excel/ms-formula-read.c
View file @
bb93beaa
...
...
@@ -251,7 +251,7 @@ static char *parse_list_to_equation (PARSE_LIST *list)
strcpy
(
formula
,
"="
)
;
strcat
(
formula
,
pd
->
name
)
;
printf
(
"Formula : '%s'
\n
"
,
formula
)
;
/*
printf ("Formula : '%s'\n", formula) ;
*/
return
formula
;
}
else
...
...
plugins/excel/ms-formula.c
View file @
bb93beaa
...
...
@@ -251,7 +251,7 @@ static char *parse_list_to_equation (PARSE_LIST *list)
strcpy
(
formula
,
"="
)
;
strcat
(
formula
,
pd
->
name
)
;
printf
(
"Formula : '%s'
\n
"
,
formula
)
;
/*
printf ("Formula : '%s'\n", formula) ;
*/
return
formula
;
}
else
...
...
plugins/excel/ms-ole.c
View file @
bb93beaa
...
...
@@ -332,7 +332,7 @@ ms_ole_analyse (MS_OLE *f)
dump_header
(
f
);
dump_allocation
(
f
);
{
/*
{
int lp;
for (lp=0;lp<BB_BLOCK_SIZE/PPS_BLOCK_SIZE;lp++)
{
...
...
@@ -340,7 +340,7 @@ ms_ole_analyse (MS_OLE *f)
PPS_GET_PREV(f,lp), PPS_GET_NEXT(f,lp), PPS_GET_DIR(f,lp));
dump (PPS_PTR(f, lp), PPS_BLOCK_SIZE);
}
}
}
*/
return
1
;
}
...
...
plugins/fn-math/functions.c
View file @
bb93beaa
...
...
@@ -1026,7 +1026,10 @@ callback_function_sum (Sheet *sheet, Value *value, char **error_string, void *cl
break
;
default:
g_warning
(
"Unknown VALUE type in callback_function_sum"
);
g_warning
(
"Unimplemented value->type in callback_function_sum : %s (%d)"
,
(
value
->
type
==
VALUE_CELLRANGE
)
?
"CELLRANGE"
:
(
value
->
type
==
VALUE_ARRAY
)
?
"ARRAY"
:
"UNKOWN!"
,
value
->
type
);
break
;
}
return
TRUE
;
...
...
src/fn-math.c
View file @
bb93beaa
...
...
@@ -1026,7 +1026,10 @@ callback_function_sum (Sheet *sheet, Value *value, char **error_string, void *cl
break
;
default:
g_warning
(
"Unknown VALUE type in callback_function_sum"
);
g_warning
(
"Unimplemented value->type in callback_function_sum : %s (%d)"
,
(
value
->
type
==
VALUE_CELLRANGE
)
?
"CELLRANGE"
:
(
value
->
type
==
VALUE_ARRAY
)
?
"ARRAY"
:
"UNKOWN!"
,
value
->
type
);
break
;
}
return
TRUE
;
...
...
src/functions/fn-math.c
View file @
bb93beaa
...
...
@@ -1026,7 +1026,10 @@ callback_function_sum (Sheet *sheet, Value *value, char **error_string, void *cl
break
;
default:
g_warning
(
"Unknown VALUE type in callback_function_sum"
);
g_warning
(
"Unimplemented value->type in callback_function_sum : %s (%d)"
,
(
value
->
type
==
VALUE_CELLRANGE
)
?
"CELLRANGE"
:
(
value
->
type
==
VALUE_ARRAY
)
?
"ARRAY"
:
"UNKOWN!"
,
value
->
type
);
break
;
}
return
TRUE
;
...
...
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