Commit cda74447 authored by Michael Meeks's avatar Michael Meeks

Auto Expr fixes for Miguel,

Function stuff cleaned in plugins,
Working Excel formula writing.
parent 1fe5ad13
1999-07-05 Michael Meeks <michael@edenproject.org>
* src/sheet.c (sheet_update_auto_expr): Removed parsing.
* src/workbook.c (workbook_set_auto_expr): Moved unsafe parser
call in here.
* src/sheet.h: Changed auto_expr_text to ExprTree auto_expr.
* src/parser.y (gnumeric_expr_parser): Added.
(gnumeric_unsafe_expr_parser): Renamed and changed arguments.
* plugins/guile/plugin.c (init_plugin): New function stuff.
(func_scm_apply): ditto.
(func_scm_eval): ditto.
(func_marshal_func): ditto.
(scm_register_function): ditto.
* plugins/python/python.c (__register_function): Updated to
new function stuff.
(marshal_func): ditto.
* plugins/perl/ext/Makefile.PL.in: Added GNOME_PRINT bits.
1999-07-04 Michael Meeks <michael@edenproject.org>
* src/workbook.c (workbook_sheet_get_free_name): Made more
similar to Excel: base sheet no. = 1 + no space.
(workbook_new_with_sheets): Update to more Excel friendly
names.
1999-07-02 Miguel de Icaza <miguel@gnu.org>
* doc/Design, doc/translating.sgml: small touchups.
......
1999-07-05 Michael Meeks <michael@edenproject.org>
* src/sheet.c (sheet_update_auto_expr): Removed parsing.
* src/workbook.c (workbook_set_auto_expr): Moved unsafe parser
call in here.
* src/sheet.h: Changed auto_expr_text to ExprTree auto_expr.
* src/parser.y (gnumeric_expr_parser): Added.
(gnumeric_unsafe_expr_parser): Renamed and changed arguments.
* plugins/guile/plugin.c (init_plugin): New function stuff.
(func_scm_apply): ditto.
(func_scm_eval): ditto.
(func_marshal_func): ditto.
(scm_register_function): ditto.
* plugins/python/python.c (__register_function): Updated to
new function stuff.
(marshal_func): ditto.
* plugins/perl/ext/Makefile.PL.in: Added GNOME_PRINT bits.
1999-07-04 Michael Meeks <michael@edenproject.org>
* src/workbook.c (workbook_sheet_get_free_name): Made more
similar to Excel: base sheet no. = 1 + no space.
(workbook_new_with_sheets): Update to more Excel friendly
names.
1999-07-02 Miguel de Icaza <miguel@gnu.org>
* doc/Design, doc/translating.sgml: small touchups.
......
1999-07-05 Michael Meeks <michael@edenproject.org>
* src/sheet.c (sheet_update_auto_expr): Removed parsing.
* src/workbook.c (workbook_set_auto_expr): Moved unsafe parser
call in here.
* src/sheet.h: Changed auto_expr_text to ExprTree auto_expr.
* src/parser.y (gnumeric_expr_parser): Added.
(gnumeric_unsafe_expr_parser): Renamed and changed arguments.
* plugins/guile/plugin.c (init_plugin): New function stuff.
(func_scm_apply): ditto.
(func_scm_eval): ditto.
(func_marshal_func): ditto.
(scm_register_function): ditto.
* plugins/python/python.c (__register_function): Updated to
new function stuff.
(marshal_func): ditto.
* plugins/perl/ext/Makefile.PL.in: Added GNOME_PRINT bits.
1999-07-04 Michael Meeks <michael@edenproject.org>
* src/workbook.c (workbook_sheet_get_free_name): Made more
similar to Excel: base sheet no. = 1 + no space.
(workbook_new_with_sheets): Update to more Excel friendly
names.
1999-07-02 Miguel de Icaza <miguel@gnu.org>
* doc/Design, doc/translating.sgml: small touchups.
......
1999-07-05 Michael Meeks <michael@edenproject.org>
* src/sheet.c (sheet_update_auto_expr): Removed parsing.
* src/workbook.c (workbook_set_auto_expr): Moved unsafe parser
call in here.
* src/sheet.h: Changed auto_expr_text to ExprTree auto_expr.
* src/parser.y (gnumeric_expr_parser): Added.
(gnumeric_unsafe_expr_parser): Renamed and changed arguments.
* plugins/guile/plugin.c (init_plugin): New function stuff.
(func_scm_apply): ditto.
(func_scm_eval): ditto.
(func_marshal_func): ditto.
(scm_register_function): ditto.
* plugins/python/python.c (__register_function): Updated to
new function stuff.
(marshal_func): ditto.
* plugins/perl/ext/Makefile.PL.in: Added GNOME_PRINT bits.
1999-07-04 Michael Meeks <michael@edenproject.org>
* src/workbook.c (workbook_sheet_get_free_name): Made more
similar to Excel: base sheet no. = 1 + no space.
(workbook_new_with_sheets): Update to more Excel friendly
names.
1999-07-02 Miguel de Icaza <miguel@gnu.org>
* doc/Design, doc/translating.sgml: small touchups.
......
1999-07-04 Michael Meeks <michael@edenproject.org>
* ms-formula-read.c (formula_func_data): Fixed ISREF, ISPMT.
* ms-excel-write.c (write_mulblank): Add 0x200 to BLANK
* biff-types.h (BIFF_PASSWORD): convert back from
PASSguint16 :-)
* ms-formula-write.c (write_arrays): Fix memory leak.
* ms-excel-read.c (ms_excel_read_formula): Add S59DE9 reference.
* ms-excel-write.c (write_cell): Updated constant so formulae get
evaluated correctly.
(write_formula): Split out complexity, Added STRING result storage.
* ms-formula-write.c (write_string): Un-dofus the string writing
fix Excel crash on any formula string.
* ms-excel-write.c (write_cell): Fixup always calc. & on load,
don't seem to be needed.
Implement class specifiers throughout where needed.
* ms-formula-write.c (OP_*): Helper macros for getting the class
right on each PTG.
* formula-types.h: Added class defines.
* ms-excel-write.c (write_sheet_bools): Removed magic 0x44 from
last byte of BIFF_COLINFO. Commented out GCW: unneccessary and
wrong.
(write_window1): Fiddled with the magic numbers.
(write_sheet_bools): Add 0x200 to DEFAULTROWHEIGHT.
(write_sheet): ditto to INDEX.
1999-07-03 Michael Meeks <michael@edenproject.org>
* ms-formula-write.c (ms_excel_write_formula): Added critical
magic 3 padding bytes s Array's are saved properly.
* ms-excel-write.c (write_sheet): Size optimisation for blank
rows.
1999-07-02 Michael Meeks <michael@edenproject.org>
* ole.c (syntax_error): Update help.
(read_records, dump_summary, do_summary): Start of summary info
reading.
(do_biff_raw): Cleaned unused var.
(esh_header_contained): commented out.
1999-07-02 Michael Meeks <michael@edenproject.org>
* ms-formula-read.c: more stylistic fiddling on great
new debug stuff from Jody...
* *.[ch]:
s/MsOle_SEEK_SET/MsOleSeekSet/g
s/MsOle_SEEK_CUR/MsOleSeekCur/g
s/ms_ole_seek_t/MsOleSeek/g
s/MsOle_PPS_STORAGE/MsOlePPSStorage/g
s/MsOle_PPS_STREAM/MsOlePPSStream/g
s/MsOle_PPS_ROOT/MsOlePPSRoot/g
s/PPS_TYPE/PPSType/g
s/ms_ole_pos_t/MsOlePos/g
1999-07-02 Jody Goldberg <jgoldberg@home.com>
* ms-chart.c : Stylistic consistancy.
......
......@@ -2,8 +2,7 @@ Michael
* Change all structure names ToCapitalisedLikeThisNames
* In ms-formula-write.c
* Booleans
* IF
* Arrays
* test IF and CHOOSE: need 'optimising'
* Sort out silly things with massive sized sheets
* Deeper DBCELL records
* Truncated Index records
......@@ -16,7 +15,7 @@ Michael
* Fix inter-sheet dependencies ... well broken.
* Lookup Harvest and see if we can help with doc summary info for
searches.
* Implement document summary information, S59FD3.HTM
* Implement document summary information, S59FD3.HTM ( wrong ).
* Use same XML as Office for elegance (?)
Jody
......
......@@ -29,7 +29,7 @@
#define BIFF_DELTA 0x10 /* 0 */
#define BIFF_ITERATION 0x11 /* 0 */
#define BIFF_PROTECT 0x12 /* 0 */
#define BIFF_PASSguint16 0x13 /* 0 */
#define BIFF_PASSWORD 0x13 /* 0 */
#define BIFF_HEADER 0x14 /* 0, NOT 10 */
#define BIFF_FOOTER 0x15 /* 0, NOT 10 */
#define BIFF_EXTERNCOUNT 0x16 /* 0, NOT 10 */
......
......@@ -51,3 +51,14 @@
#define FORMULA_PTG_NAME_X 0x39
#define FORMULA_PTG_REF_3D 0x3a
#define FORMULA_PTG_AREA_3D 0x3b
/*
* Classes of Formulae Values
* These apply mainly to references and arrays
* Ignore for:
* operators
* simple values (integer, string ... ) [ string ? ]
*/
#define FORMULA_CLASS_REF 0x00
#define FORMULA_CLASS_VALUE 0x20
#define FORMULA_CLASS_ARRAY 0x40
1999-07-03 Michael Meeks <michael@edenproject.org>
* ms-ole.c (ms_ole_read_copy_sb, ms_ole_read_copy_bb):
Added check on ptr.
1999-07-02 Michael Meeks <michael@edenproject.org>
* ms-ole.h: Indented nicely again.
1999-07-03 Michael Meeks <michael@edenproject.org>
* ms-ole.[ch]: Clean.
s/MS_OLE_STREAM/MsOleStream/g
s/MS_OLE_DIRECTORY/MsOleDirectory/g
s/MS_OLE/MsOle/g
s/MsOle_SEEK_SET/MsOleSeekSet/g
s/MsOle_SEEK_CUR/MsOleSeekCur/g
s/ms_ole_seek_t/MsOleSeek/g
s/MsOle_PPS_STORAGE/MsOlePPSStorage/g
s/MsOle_PPS_STREAM/MsOlePPSStream/g
s/MsOle_PPS_ROOT/MsOlePPSRoot/g
s/PPS_TYPE/PPSType/g
s/ms_ole_pos_t/MsOlePos/g
s/MsOle_SMALL_BLOCK/MsOleSmallBlock/g
s/MsOle_LARGE_BLOCK/MsOleLargeBlock/g
s/BB_BLK_ATTR/BBBlkAttr/g
1999-06-28 Michael Meeks <michael@edenproject.org>
* ms-ole.c (pps_encode_tree_initial): Added different
......
......@@ -76,7 +76,7 @@ struct _PPS {
PPS *parent;
guint32 size;
BLP start;
PPS_TYPE type;
PPSType type;
PPS_IDX idx; /* Only used on write */
};
......@@ -101,12 +101,12 @@ typedef struct {
gboolean dirty;
int usage;
guint8 *data;
} BB_BLK_ATTR;
} BBBlkAttr;
static BB_BLK_ATTR *
static BBBlkAttr *
bb_blk_attr_new (guint32 blk)
{
BB_BLK_ATTR *attr = g_new (BB_BLK_ATTR, 1);
BBBlkAttr *attr = g_new (BBBlkAttr, 1);
attr->blk = blk;
attr->dirty = FALSE;
attr->usage = 0;
......@@ -117,13 +117,13 @@ bb_blk_attr_new (guint32 blk)
static void
set_blk_dirty (MsOle *f, BLP b)
{
BB_BLK_ATTR *attr = g_ptr_array_index (f->bbattr, b);
BBBlkAttr *attr = g_ptr_array_index (f->bbattr, b);
g_assert (attr);
attr->dirty = TRUE;
}
static void
write_cache_block (MsOle *f, BB_BLK_ATTR *attr)
write_cache_block (MsOle *f, BBBlkAttr *attr)
{
size_t offset;
......@@ -145,7 +145,7 @@ write_cache_block (MsOle *f, BB_BLK_ATTR *attr)
static guint8 *
get_block_ptr (MsOle *f, BLP b, gboolean forwrite)
{
BB_BLK_ATTR *attr, *tmp, *min;
BBBlkAttr *attr, *tmp, *min;
size_t offset;
guint32 i, blks;
......@@ -238,7 +238,7 @@ get_block_ptr (MsOle *f, BLP b, gboolean forwrite)
/* These get other interesting stuff from the PPS record */
#define PPS_GET_STARTBLOCK(p) ( GET_GUINT32(p + 0x74))
#define PPS_GET_SIZE(p) ( GET_GUINT32(p + 0x78))
#define PPS_GET_TYPE(p) ((PPS_TYPE)( GET_GUINT8(p + 0x42)))
#define PPS_GET_TYPE(p) ((PPSType)( GET_GUINT8(p + 0x42)))
#define PPS_SET_STARTBLOCK(p,i) ( SET_GUINT32(p + 0x74, i))
#define PPS_SET_SIZE(p,i) ( SET_GUINT32(p + 0x78, i))
#define PPS_SET_TYPE(p,i) ( SET_GUINT8 (p + 0x42, i))
......@@ -444,7 +444,7 @@ static void
extend_file (MsOle *f, guint blocks)
{
#if !OLE_MMAP
BB_BLK_ATTR *s;
BBBlkAttr *s;
guint32 blkidx, i;
if (f->bbattr->len) {
......@@ -855,7 +855,7 @@ pps_encode_tree_chain (MsOle *f, GList *list)
#if OLE_DEBUG > 0
printf ("Chaining previous for '%s'\n", p->name);
#endif
if (p->type == MsOle_PPS_STORAGE)
if (p->type == MsOlePPSStorage)
pps_encode_tree_chain (f, l);
mem = get_pps_ptr (f, p->idx, TRUE);
......@@ -891,7 +891,7 @@ pps_encode_tree_chain (MsOle *f, GList *list)
#if OLE_DEBUG > 0
printf ("Chaining next for '%s'\n", p->name);
#endif
if (p->type == MsOle_PPS_STORAGE)
if (p->type == MsOlePPSStorage)
pps_encode_tree_chain (f, l);
mem = get_pps_ptr (f, p->idx, TRUE);
......@@ -1282,7 +1282,7 @@ ms_ole_create (const char *name)
p = g_new(PPS, 1);
p->name = g_strdup ("Root Entry");
p->start = END_OF_CHAIN;
p->type = MsOle_PPS_ROOT;
p->type = MsOlePPSRoot;
p->size = 0;
p->children = NULL;
p->parent = NULL;
......@@ -1333,7 +1333,7 @@ ms_ole_destroy (MsOle *f)
munmap (f->mem, f->length);
#else
for (i=0; (f->bbattr) && (i < f->bbattr->len);i++) {
BB_BLK_ATTR *attr = g_ptr_array_index (f->bbattr, i);
BBBlkAttr *attr = g_ptr_array_index (f->bbattr, i);
if (f->dirty && attr->dirty)
write_cache_block (f, attr);
g_free (attr->data);
......@@ -1396,7 +1396,7 @@ check_stream (MsOleStream *s)
g_return_if_fail (p);
blk = p->start;
idx = 0;
if (s->strtype == MsOle_SMALL_BLOCK) {
if (s->strtype == MsOleSmallBlock) {
while (blk != END_OF_CHAIN) {
g_assert (g_array_index (s->blocks, BLP, idx) ==
blk);
......@@ -1419,7 +1419,7 @@ check_stream (MsOleStream *s)
}
}
static ms_ole_pos_t
static MsOlePos
tell_pos (MsOleStream *s)
{
return s->position;
......@@ -1510,11 +1510,11 @@ free_allocation (MsOle *f, guint32 startblock, gboolean is_big_block_stream)
}
static void
ms_ole_lseek (MsOleStream *s, gint32 bytes, ms_ole_seek_t type)
ms_ole_lseek (MsOleStream *s, gint32 bytes, MsOleSeek type)
{
g_return_if_fail (s);
if (type == MsOle_SEEK_SET)
if (type == MsOleSeekSet)
s->position = bytes;
else
s->position+= bytes;
......@@ -1552,7 +1552,7 @@ ms_ole_read_ptr_bb (MsOleStream *s, guint32 length)
/* Straight map, simply return a pointer */
ans = BB_R_PTR(s->file, ms_array_index (s->blocks, BLP, s->position/BB_BLOCK_SIZE))
+ s->position%BB_BLOCK_SIZE;
ms_ole_lseek (s, length, MsOle_SEEK_CUR);
ms_ole_lseek (s, length, MsOleSeekCur);
check_stream (s);
return ans;
}
......@@ -1585,7 +1585,7 @@ ms_ole_read_ptr_sb (MsOleStream *s, guint32 length)
/* Straight map, simply return a pointer */
ans = GET_SB_R_PTR(s->file, ms_array_index (s->blocks, BLP, s->position/SB_BLOCK_SIZE))
+ s->position%SB_BLOCK_SIZE;
ms_ole_lseek (s, length, MsOle_SEEK_CUR);
ms_ole_lseek (s, length, MsOleSeekCur);
check_stream (s);
return ans;
}
......@@ -1603,6 +1603,7 @@ ms_ole_read_copy_bb (MsOleStream *s, guint8 *ptr, guint32 length)
guint8 *src;
g_return_val_if_fail (s, 0);
g_return_val_if_fail (ptr, 0);
if (!s->blocks) {
printf ("Reading from NULL file\n");
......@@ -1647,6 +1648,7 @@ ms_ole_read_copy_sb (MsOleStream *s, guint8 *ptr, guint32 length)
guint8 *src;
g_return_val_if_fail (s, 0);
g_return_val_if_fail (ptr, 0);
if (!s->blocks) {
printf ("Reading from NULL file\n");
......@@ -1689,7 +1691,7 @@ ms_ole_append_block (MsOleStream *s)
BLP lastblk = END_OF_CHAIN;
BLP eoc = END_OF_CHAIN;
if (s->strtype==MsOle_SMALL_BLOCK) {
if (s->strtype==MsOleSmallBlock) {
if (!s->blocks)
s->blocks = g_array_new (FALSE, FALSE, sizeof(BLP));
......@@ -1788,7 +1790,7 @@ ms_ole_write_bb (MsOleStream *s, guint8 *ptr, guint32 length)
if (lengthen > 0)
s->size+=lengthen;
s->lseek (s, length, MsOle_SEEK_CUR);
s->lseek (s, length, MsOleSeekCur);
check_stream (s);
return;
}
......@@ -1834,11 +1836,11 @@ ms_ole_write_sb (MsOleStream *s, guint8 *ptr, guint32 length)
if (s->size >= BB_THRESHOLD)
{
PPS *p = s->pps;
ms_ole_pos_t oldlen;
MsOlePos oldlen;
guint8 *buffer;
buffer = g_new (guint8, s->size);
s->lseek (s, 0, MsOle_SEEK_SET);
s->lseek (s, 0, MsOleSeekSet);
oldlen = s->size;
s->read_copy (s, buffer, oldlen);
......@@ -1858,7 +1860,7 @@ ms_ole_write_sb (MsOleStream *s, guint8 *ptr, guint32 length)
/* Convert the file to BBlocks */
s->size = 0;
s->position = 0;
s->strtype = MsOle_LARGE_BLOCK;
s->strtype = MsOleLargeBlock;
g_array_free (s->blocks, TRUE);
s->blocks = 0;
......@@ -1878,7 +1880,7 @@ ms_ole_write_sb (MsOleStream *s, guint8 *ptr, guint32 length)
blkidx++;
check_stream (s);
}
s->lseek (s, length, MsOle_SEEK_CUR);
s->lseek (s, length, MsOleSeekCur);
return;
}
......@@ -1922,7 +1924,7 @@ ms_ole_stream_open (MsOleDirectory *d, char mode)
s->write = ms_ole_write_bb;
s->blocks = g_array_new (FALSE, FALSE, sizeof(BLP));
s->strtype = MsOle_LARGE_BLOCK;
s->strtype = MsOleLargeBlock;
for (lp=0;lp<(s->size+BB_BLOCK_SIZE-1)/BB_BLOCK_SIZE;lp++)
{
g_array_append_val (s->blocks, b);
......@@ -1956,7 +1958,7 @@ ms_ole_stream_open (MsOleDirectory *d, char mode)
else
s->blocks = NULL;
s->strtype = MsOle_SMALL_BLOCK;
s->strtype = MsOleSmallBlock;
for (lp=0;lp<(s->size+SB_BLOCK_SIZE-1)/SB_BLOCK_SIZE;lp++)
{
......@@ -2079,9 +2081,9 @@ ms_ole_directory_enter (MsOleDirectory *d)
d->first = 1;
if (d->type != MsOle_PPS_STORAGE &&
d->type != MsOle_PPS_ROOT) {
printf ("Bad type %d %d\n", d->type, MsOle_PPS_ROOT);
if (d->type != MsOlePPSStorage &&
d->type != MsOlePPSRoot) {
printf ("Bad type %d %d\n", d->type, MsOlePPSRoot);
return;
}
......@@ -2121,7 +2123,7 @@ ms_ole_directory_unlink (MsOleDirectory *d)
* new stream / directory.
**/
MsOleDirectory *
ms_ole_directory_create (MsOleDirectory *d, char *name, PPS_TYPE type)
ms_ole_directory_create (MsOleDirectory *d, char *name, PPSType type)
{
/* Find a free PPS */
PPS *p;
......
......@@ -20,32 +20,32 @@ typedef struct _MsOle MsOle;
typedef struct _MsOleStream MsOleStream;
typedef struct _MsOleDirectory MsOleDirectory;
typedef enum { MsOle_SEEK_SET, MsOle_SEEK_CUR } ms_ole_seek_t;
typedef enum { MsOleSeekSet, MsOleSeekCur } MsOleSeek;
#ifdef G_HAVE_GINT64
typedef guint32 ms_ole_pos_t;
typedef guint32 MsOlePos;
#else
typedef guint32 ms_ole_pos_t;
typedef guint32 MsOlePos;
#endif
typedef guint32 PPS_IDX ;
typedef enum _PPS_TYPE { MsOle_PPS_STORAGE = 1,
MsOle_PPS_STREAM = 2,
MsOle_PPS_ROOT = 5} PPS_TYPE ;
typedef enum _PPSType { MsOlePPSStorage = 1,
MsOlePPSStream = 2,
MsOlePPSRoot = 5} PPSType ;
/**
* Structure describing an OLE file
**/
struct _MsOle
{
guint8 *mem ;
guint32 length ;
guint8 *mem ;
guint32 length ;
/**
* To be considered private
**/
char mode;
int file_des;
int dirty;
char mode;
int file_des;
int dirty;
GArray *bb; /* Big blocks status */
#if !OLE_MMAP
GPtrArray *bbattr; /* Pointers to block structures */
......@@ -66,13 +66,13 @@ extern void ms_ole_destroy (MsOle *ptr) ;
struct _MsOleDirectory
{
char *name;
ms_ole_pos_t length;
PPS_TYPE type;
GList *pps;
int first;
char *name;
MsOlePos length;
PPSType type;
GList *pps;
int first;
/* Private */
MsOle *file ;
MsOle *file ;
};
extern MsOleDirectory *ms_ole_directory_new (MsOle *) ;
......@@ -81,41 +81,41 @@ extern void ms_ole_directory_enter (MsOleDirectory *) ;
/* Pointer to the directory in which to create a new stream / storage object */
extern MsOleDirectory *ms_ole_directory_create (MsOleDirectory *d,
char *name,
PPS_TYPE type) ;
PPSType type) ;
extern void ms_ole_directory_unlink (MsOleDirectory *) ;
extern void ms_ole_directory_destroy (MsOleDirectory *) ;
struct _MsOleStream
{
GArray *blocks; /* A list of the blocks in the file if NULL: no file */
ms_ole_pos_t position; /* Current offset into file. Points to the next byte to read */
ms_ole_pos_t size;
enum { MsOle_SMALL_BLOCK, MsOle_LARGE_BLOCK } strtype; /* Type of stream */
GArray *blocks; /* A list of the blocks in the file if NULL: no file */
MsOlePos position; /* Current offset into file. Points to the next byte to read */
MsOlePos size;
enum { MsOleSmallBlock, MsOleLargeBlock } strtype; /* Type of stream */
/**
* Attempts to copy length bytes into *ptr, returns true if
* successful, _does_ advance the stream pointer.
**/
gboolean (*read_copy )(MsOleStream *, guint8 *ptr, guint32 length) ;
gboolean (*read_copy )(MsOleStream *, guint8 *ptr, guint32 length) ;
/**
* Acertains whether there is a contiguous block length bytes,
* if so returns a pointer to it and _does_ advance the stream pointer.
* otherwise returns NULL and does _not_ advance the stream pointer.
**/
guint8* (*read_ptr )(MsOleStream *, guint32 length) ;
void (*lseek )(MsOleStream *, gint32 guint8S, ms_ole_seek_t type) ;
ms_ole_pos_t (*tell )(MsOleStream *);
guint8* (*read_ptr )(MsOleStream *, guint32 length) ;
void (*lseek )(MsOleStream *, gint32 bytes, MsOleSeek type) ;
MsOlePos (*tell )(MsOleStream *);
/**
* This writes length bytes at *ptr to the stream, and advances
* the stream pointer.
**/
void (*write )(MsOleStream *, guint8 *ptr, guint32 length) ;
void (*write )(MsOleStream *, guint8 *ptr, guint32 length) ;
/**
* PRIVATE
**/
MsOle *file ;
void *pps ; /* Straight PPS * */
MsOle *file ;
void *pps ; /* Straight PPS * */
};
/* Mode = 'r' or 'w' */
......
......@@ -185,7 +185,7 @@ ms_biff_merge_continues (BiffQuery *bq, guint32 len)
chunk.length = BIFF_GET_GUINT16 (tmp+2);
bq->num_merges++;
} while ((BIFF_GET_GUINT16(tmp) & 0xff) == BIFF_CONTINUE);
bq->pos->lseek (bq->pos, -4, MsOle_SEEK_CUR); /* back back off */
bq->pos->lseek (bq->pos, -4, MsOleSeekCur); /* back back off */
bq->data = g_malloc (total_len);
if (!bq->data)
......@@ -258,7 +258,7 @@ ms_biff_query_next_merge (BiffQuery *bq, gboolean do_merge)
bq->pos->read_copy (bq->pos, tmp, 4)) {
if ((BIFF_GET_GUINT16(tmp) & 0xff) == BIFF_CONTINUE)
return ms_biff_merge_continues (bq, BIFF_GET_GUINT16(tmp+2));
bq->pos->lseek (bq->pos, -4, MsOle_SEEK_CUR); /* back back off */
bq->pos->lseek (bq->pos, -4, MsOleSeekCur); /* back back off */
#if BIFF_DEBUG > 4
printf ("Backed off\n");
#endif
......@@ -282,7 +282,7 @@ ms_biff_query_unmerge (BiffQuery *bq)
if (!bq || !bq->num_merges)
return;
bq->pos->lseek (bq->pos, -(4*(bq->num_merges+1) - (bq->num_merges*bq->padding)
+ bq->length), MsOle_SEEK_CUR);
+ bq->length), MsOleSeekCur);
ms_biff_query_next_merge (bq, FALSE);
}
......@@ -392,21 +392,21 @@ ms_biff_put_var_write (BiffPut *bp, guint8 *data, guint32 len)
bp->length = bp->curpos;
}
void
ms_biff_put_var_seekto (BiffPut *bp, ms_ole_pos_t pos)
ms_biff_put_var_seekto (BiffPut *bp, MsOlePos pos)
{
g_return_if_fail (bp);
g_return_if_fail (!bp->len_fixed);
g_return_if_fail (!bp->data);
bp->curpos = pos;
bp->pos->lseek (bp->pos, bp->streamPos + bp->curpos + 4, MsOle_SEEK_SET);
bp->pos->lseek (bp->pos, bp->streamPos + bp->curpos + 4, MsOleSeekSet);
}
static void
ms_biff_put_var_commit (BiffPut *bp)
{
guint8 tmp[4];
ms_ole_pos_t endpos;
MsOlePos endpos;
g_return_if_fail (bp);
g_return_if_fail (bp->pos);
......@@ -414,13 +414,13 @@ ms_biff_put_var_commit (BiffPut *bp)
g_return_if_fail (!bp->data);
endpos = bp->streamPos + bp->length + 4;
bp->pos->lseek (bp->pos, bp->streamPos, MsOle_SEEK_SET);
bp->pos->lseek (bp->pos, bp->streamPos, MsOleSeekSet);
BIFF_SET_GUINT16 (tmp, (bp->ms_op<<8) + bp->ls_op);
BIFF_SET_GUINT16 (tmp+2, bp->length);
bp->pos->write (bp->pos, tmp, 4);
bp->pos->lseek (bp->pos, endpos, MsOle_SEEK_SET);
bp->pos->lseek (bp->pos, endpos, MsOleSeekSet);
bp->streamPos = endpos;
bp->curpos = 0;
}
......@@ -436,7 +436,7 @@ ms_biff_put_len_commit (BiffPut *bp)
g_return_if_fail (bp->length < MAX_LIKED_BIFF_LEN);
/* if (!bp->data_malloced) Unimplemented optimisation
bp->pos->lseek (bp->pos, bp->length, MsOle_SEEK_CUR);
bp->pos->lseek (bp->pos, bp->length, MsOleSeekCur);
else */
BIFF_SET_GUINT16 (tmp, (bp->ms_op<<8) + bp->ls_op);
BIFF_SET_GUINT16 (tmp+2, bp->length);
......
......@@ -79,8 +79,8 @@ typedef struct _BiffPut
guint8 ls_op;
guint32 length; /* NB. can be extended by a continue opcode */
guint8 *data;
ms_ole_pos_t streamPos;
ms_ole_pos_t curpos; /* Curpos is offset from beggining of header */
MsOlePos streamPos;
MsOlePos curpos; /* Curpos is offset from beggining of header */
guint16 num_merges;
gint16 padding;
int data_malloced;
......@@ -101,7 +101,7 @@ extern guint8 *ms_biff_put_len_next (BiffPut *, guint16 opcode, guint32
extern void ms_biff_put_var_next (BiffPut *, guint16 opcode);
extern void ms_biff_put_var_write (BiffPut *, guint8 *, guint32 len);
/* Seeks to pos bytes after the beggining of the record */
extern void ms_biff_put_var_seekto (BiffPut *, ms_ole_pos_t pos);