summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2005-05-26 09:34:56 +0200
committerTor Andersson <tor@ghostscript.com>2005-05-26 09:34:56 +0200
commit987d58dfaf4030f43b2a8854e2d246f75465cc57 (patch)
tree430eeedbebfdc278a9fc88afa134c96dacc073b4 /include
parent4bb1d274f49678af1612179d632ebcca7666f235 (diff)
downloadmupdf-987d58dfaf4030f43b2a8854e2d246f75465cc57.tar.xz
new stream api
Diffstat (limited to 'include')
-rw-r--r--include/fitz.h27
-rw-r--r--include/fitz/buffer.h41
-rw-r--r--include/fitz/crypt.h9
-rw-r--r--include/fitz/file.h38
-rw-r--r--include/fitz/filter.h58
-rw-r--r--include/fitz/hash.h4
-rw-r--r--include/fitz/object.h6
-rw-r--r--include/fitz/path.h14
-rw-r--r--include/fitz/stream.h103
-rw-r--r--include/fitz/text.h22
-rw-r--r--include/fitz/tree.h7
-rw-r--r--include/mupdf/content.h2
-rw-r--r--include/mupdf/rsrc.h4
-rw-r--r--include/mupdf/syntax.h10
-rw-r--r--include/mupdf/xref.h10
-rw-r--r--include/samus.h1
-rw-r--r--include/samus/pack.h (renamed from include/samus/package.h)3
-rw-r--r--include/samus/xml.h8
-rw-r--r--include/samus/zip.h19
19 files changed, 276 insertions, 110 deletions
diff --git a/include/fitz.h b/include/fitz.h
index 7bcc2b01..942219bb 100644
--- a/include/fitz.h
+++ b/include/fitz.h
@@ -3,6 +3,9 @@
#endif
#define _FITZ_H_
+/*
+ * Base library
+ */
#include "fitz/sysdep.h"
#include "fitz/cpudep.h"
#include "fitz/base.h"
@@ -10,23 +13,35 @@
#include "fitz/geometry.h"
#include "fitz/hash.h"
+/*
+ * Streams and dynamic objects
+ */
+#include "fitz/crypt.h"
+#include "fitz/object.h"
+#include "fitz/buffer.h"
+#include "fitz/filter.h"
+#include "fitz/stream.h"
+
+/*
+ * Resources
+ */
#include "fitz/cmap.h"
#include "fitz/font.h"
-
#include "fitz/pixmap.h"
#include "fitz/colorspace.h"
#include "fitz/image.h"
#include "fitz/shade.h"
+/*
+ * Display tree
+ */
#include "fitz/tree.h"
#include "fitz/path.h"
#include "fitz/text.h"
+/*
+ * Renderer
+ */
#include "fitz/pathscan.h"
#include "fitz/render.h"
-#include "fitz/crypt.h"
-#include "fitz/object.h"
-#include "fitz/filter.h"
-#include "fitz/file.h"
-
diff --git a/include/fitz/buffer.h b/include/fitz/buffer.h
new file mode 100644
index 00000000..1a6f34ad
--- /dev/null
+++ b/include/fitz/buffer.h
@@ -0,0 +1,41 @@
+/*
+ * Data buffers for streams and filters.
+ *
+ * bp is the pointer to the allocated memory
+ * rp is read-position (*in->rp++ to read data)
+ * wp is write-position (*out->wp++ to write data)
+ * ep is the sentinel
+ *
+ * Only the data between rp and wp is valid data.
+ *
+ * Writers set eof to true at the end.
+ * Readers look at eof.
+ *
+ * A buffer owns the memory it has allocated, unless ownsdata is false,
+ * in which case the creator of the buffer owns it.
+ */
+
+typedef struct fz_buffer_s fz_buffer;
+
+#define FZ_BUFSIZE (8 * 1024)
+
+struct fz_buffer_s
+{
+ int refs;
+ int ownsdata;
+ unsigned char *bp;
+ unsigned char *rp;
+ unsigned char *wp;
+ unsigned char *ep;
+ int eof;
+};
+
+fz_error *fz_newbuffer(fz_buffer **bufp, int size);
+fz_error *fz_newbufferwithmemory(fz_buffer **bufp, unsigned char *data, int size);
+
+fz_error *fz_rewindbuffer(fz_buffer *buf);
+fz_error *fz_growbuffer(fz_buffer *buf);
+
+fz_buffer *fz_keepbuffer(fz_buffer *buf);
+void fz_dropbuffer(fz_buffer *buf);
+
diff --git a/include/fitz/crypt.h b/include/fitz/crypt.h
index 647a1eda..15191caa 100644
--- a/include/fitz/crypt.h
+++ b/include/fitz/crypt.h
@@ -1,3 +1,9 @@
+/*
+ * Basic crypto functions.
+ * Independent of the rest of fitz.
+ * For further encapsulation in filters, or not.
+ */
+
/* md5 digests */
typedef struct fz_md5_s fz_md5;
@@ -28,3 +34,6 @@ void fz_arc4init(fz_arc4 *state, unsigned char *key, unsigned len);
unsigned char fz_arc4next(fz_arc4 *state);
void fz_arc4encrypt(fz_arc4 *state, unsigned char *dest, unsigned char *src, unsigned len);
+/* TODO: sha1 */
+/* TODO: aes */
+
diff --git a/include/fitz/file.h b/include/fitz/file.h
deleted file mode 100644
index c87ccf5d..00000000
--- a/include/fitz/file.h
+++ /dev/null
@@ -1,38 +0,0 @@
-typedef struct fz_file_s fz_file;
-
-enum { FZ_READ, FZ_WRITE, FZ_APPEND };
-
-struct fz_file_s
-{
- int mode; /* FZ_READ or FZ_WRITE */
- int fd;
- int depth;
- fz_filter *filter;
- fz_buffer *in;
- fz_buffer *out;
- fz_error *error;
-};
-
-fz_error *fz_openfile(fz_file **filep, char *path, int mode);
-fz_error *fz_openbuffer(fz_file **filep, fz_buffer *buf, int mode);
-fz_error *fz_pushfilter(fz_file *file, fz_filter *filter);
-void fz_popfilter(fz_file *file);
-void fz_closefile(fz_file *file);
-fz_error *fz_ferror(fz_file *f);
-
-int fz_seek(fz_file *f, int ofs, int whence);
-int fz_tell(fz_file *f);
-
-int fz_readbyte(fz_file *f);
-int fz_peekbyte(fz_file *f);
-int fz_readline(fz_file *f, char *buf, int n);
-int fz_read(fz_file *f, unsigned char *buf, int n);
-
-fz_error *fz_readfile(fz_buffer **bufp, fz_file *file);
-
-int fz_printstring(fz_file *f, char *s);
-int fz_printobj(fz_file *f, fz_obj *o, int tight);
-int fz_print(fz_file *f, char *fmt, ...);
-int fz_write(fz_file *f, unsigned char *buf, int n);
-int fz_flush(fz_file *f);
-
diff --git a/include/fitz/filter.h b/include/fitz/filter.h
index bb33b8eb..f8902f98 100644
--- a/include/fitz/filter.h
+++ b/include/fitz/filter.h
@@ -1,7 +1,29 @@
-typedef struct fz_filter_s fz_filter;
-typedef struct fz_buffer_s fz_buffer;
+/*
+ * Data filters for encryption, compression and decompression.
+ *
+ * A filter has one method, process, that takes an input and an output buffer.
+ *
+ * It returns one of three statuses:
+ * ioneedin -- input buffer exhausted, please give me more data (wp-rp)
+ * ioneedout -- output buffer exhausted, please provide more space (ep-wp)
+ * iodone -- finished, please never call me again. ever!
+ * or...
+ * any other error object -- oops, something blew up.
+ *
+ * To make using the filter easier, three variables are updated:
+ * produced -- if we actually produced any new data
+ * consumed -- like above
+ * count -- number of bytes produced in total since the beginning
+ *
+ * Most filters take fz_obj as a way to specify parameters.
+ * In most cases, this is a dictionary that contains the same keys
+ * that the corresponding PDF filter would expect.
+ *
+ * The pipeline filter is special, and needs some care when chaining
+ * and unchaining new filters.
+ */
-#define FZ_BUFSIZE (32 * 1024)
+typedef struct fz_filter_s fz_filter;
#define fz_ioneedin (&fz_kioneedin)
#define fz_ioneedout (&fz_kioneedout)
@@ -11,6 +33,10 @@ extern fz_error fz_kioneedin;
extern fz_error fz_kioneedout;
extern fz_error fz_kiodone;
+/*
+ * Evil looking macro to create an initialize a filter struct.
+ */
+
#define FZ_NEWFILTER(TYPE,VAR,NAME) \
fz_error * fz_process ## NAME (fz_filter*,fz_buffer*,fz_buffer*); \
void fz_drop ## NAME (fz_filter*); \
@@ -35,35 +61,19 @@ struct fz_filter_s
int count;
};
-struct fz_buffer_s
-{
- int refs;
- int ownsdata;
- unsigned char *bp;
- unsigned char *rp;
- unsigned char *wp;
- unsigned char *ep;
- int eof;
-};
-
fz_error *fz_process(fz_filter *f, fz_buffer *in, fz_buffer *out);
fz_filter *fz_keepfilter(fz_filter *f);
void fz_dropfilter(fz_filter *f);
-fz_error *fz_newnullfilter(fz_filter **fp, int len);
-fz_error *fz_newarc4filter(fz_filter **fp, unsigned char *key, unsigned keylen);
fz_error *fz_newpipeline(fz_filter **fp, fz_filter *head, fz_filter *tail);
-
fz_error *fz_chainpipeline(fz_filter **fp, fz_filter *head, fz_filter *tail, fz_buffer *buf);
void fz_unchainpipeline(fz_filter *pipe, fz_filter **oldfp, fz_buffer **oldbp);
-fz_error *fz_newbuffer(fz_buffer **bufp, int size);
-fz_error *fz_newbufferwithdata(fz_buffer **bufp, unsigned char *data, int size);
-fz_error *fz_rewindbuffer(fz_buffer *buf);
-fz_error *fz_growbuffer(fz_buffer *buf);
-fz_buffer *fz_keepbuffer(fz_buffer *buf);
-void fz_dropbuffer(fz_buffer *buf);
+/* stop and reverse! special case needed for postscript only */
+void fz_pushbackahxd(fz_filter *filter, fz_buffer *in, fz_buffer *out, int n);
+fz_error *fz_newnullfilter(fz_filter **fp, int len);
+fz_error *fz_newarc4filter(fz_filter **fp, unsigned char *key, unsigned keylen);
fz_error *fz_newa85d(fz_filter **filterp, fz_obj *param);
fz_error *fz_newa85e(fz_filter **filterp, fz_obj *param);
fz_error *fz_newahxd(fz_filter **filterp, fz_obj *param);
@@ -83,5 +93,3 @@ fz_error *fz_newpredicte(fz_filter **filterp, fz_obj *param);
fz_error *fz_newjbig2d(fz_filter **filterp, fz_obj *param);
fz_error *fz_newjpxd(fz_filter **filterp, fz_obj *param);
-void fz_pushbackahxd(fz_filter *filter, fz_buffer *in, fz_buffer *out, int n);
-
diff --git a/include/fitz/hash.h b/include/fitz/hash.h
index 2ada17f4..5d2ec1b5 100644
--- a/include/fitz/hash.h
+++ b/include/fitz/hash.h
@@ -1,3 +1,7 @@
+/*
+ * Generic hash-table with fixed-length keys.
+ */
+
typedef struct fz_hashtable_s fz_hashtable;
fz_error *fz_newhash(fz_hashtable **tablep, int initialsize, int keylen);
diff --git a/include/fitz/object.h b/include/fitz/object.h
index 34b62f59..fe9c12e5 100644
--- a/include/fitz/object.h
+++ b/include/fitz/object.h
@@ -1,3 +1,9 @@
+/*
+ * Dynamic objects.
+ * The same type of objects as found in PDF and PostScript.
+ * Used by the filter library and the mupdf parser.
+ */
+
typedef struct fz_obj_s fz_obj;
typedef struct fz_keyval_s fz_keyval;
diff --git a/include/fitz/path.h b/include/fitz/path.h
index 75b3060d..6a7c55b7 100644
--- a/include/fitz/path.h
+++ b/include/fitz/path.h
@@ -1,3 +1,17 @@
+/*
+ * Vector path nodes in the display tree.
+ * They can be stroked and dashed, or be filled.
+ * They have a fill rule (nonzero or evenodd).
+ *
+ * When rendering, they are flattened, stroked and dashed straight
+ * into the Global Edge List.
+ *
+ * TODO flatten, stroke and dash into another path
+ * TODO set operations on flat paths (union, intersect, difference)
+ * TODO decide whether dashing should be part of the tree and renderer,
+ * or if it is something the client has to do (with a util function).
+ */
+
typedef struct fz_stroke_s fz_stroke;
typedef struct fz_dash_s fz_dash;
typedef union fz_pathel_s fz_pathel;
diff --git a/include/fitz/stream.h b/include/fitz/stream.h
new file mode 100644
index 00000000..5140fcca
--- /dev/null
+++ b/include/fitz/stream.h
@@ -0,0 +1,103 @@
+/*
+ * Stream API for Fitz.
+ * Read and write data to and from files, memory buffers and filters.
+ */
+
+typedef struct fz_stream_s fz_stream;
+
+enum { FZ_SFILE, FZ_SBUFFER, FZ_SFILTER };
+enum { FZ_SREAD, FZ_SWRITE };
+
+struct fz_stream_s
+{
+ int refs;
+ int kind;
+ int mode;
+ int dead;
+ fz_buffer *buffer;
+ fz_filter *filter;
+ fz_stream *chain;
+ int file;
+};
+
+/*
+ * Various stream creation functions.
+ */
+
+/* open() and creat() & co */
+fz_error *fz_openrfile(fz_stream **stmp, char *filename);
+fz_error *fz_openwfile(fz_stream **stmp, char *filename);
+fz_error *fz_openafile(fz_stream **stmp, char *filename);
+
+/* write to memory buffers! */
+fz_error *fz_openrmemory(fz_stream **stmp, char *buf, int len);
+fz_error *fz_openrbuffer(fz_stream **stmp, fz_buffer *buf);
+fz_error *fz_openwbuffer(fz_stream **stmp, fz_buffer *buf);
+
+/* almost like fork() exec() pipe() */
+fz_error *fz_openrfilter(fz_stream **stmp, fz_filter *flt, fz_stream *chain);
+fz_error *fz_openwfilter(fz_stream **stmp, fz_filter *flt, fz_stream *chain);
+
+/*
+ * Functions that are common to both input and output streams.
+ */
+
+/* behave like dup() */
+fz_stream *fz_keepstream(fz_stream *stm);
+
+/* essentially your close() */
+void fz_dropstream(fz_stream *stm);
+
+int fz_tell(fz_stream *stm);
+int fz_seek(fz_stream *stm, int offset, int whence);
+
+/*
+ * Input stream functions.
+ * Return EOF (-1) on errors.
+ */
+
+int fz_rtell(fz_stream *stm);
+int fz_rseek(fz_stream *stm, int offset, int whence);
+
+int fz_makedata(fz_stream *stm);
+int fz_read(fz_stream *stm, unsigned char *buf, int len);
+
+int fz_readall(fz_buffer **bufp, fz_stream *stm);
+int fz_readline(fz_stream *stm, char *buf, int max);
+
+int fz_readbytex(fz_stream *stm);
+int fz_peekbytex(fz_stream *stm);
+
+#if 1
+#define fz_readbyte fz_readbytex
+#define fz_peekbyte fz_peekbytex
+#else
+
+#define FZ_READBYTE(XXX) { \
+ fz_buffer *buf = stm->buffer; \
+ if (buf->rp == buf->wp) \
+ if (fz_makedata(stm) < 0) \
+ return EOF; \
+ return buf->rp < buf->wp ? XXX : EOF ; \
+}
+
+static inline int fz_readbyte(fz_stream *stm) FZ_READBYTE(*buf->rp++)
+static inline int fz_peekbyte(fz_stream *stm) FZ_READBYTE(*buf->rp)
+
+#endif
+
+/*
+ * Output stream functions.
+ * Return N or 0 on success, -1 on failure.
+ */
+
+int fz_wtell(fz_stream *stm);
+int fz_wseek(fz_stream *stm, int offset, int whence);
+
+int fz_write(fz_stream *stm, unsigned char *buf, int n);
+int fz_flush(fz_stream *stm);
+
+int fz_printstr(fz_stream *stm, char *s);
+int fz_printobj(fz_stream *stm, fz_obj *obj, int tight);
+int fz_print(fz_stream *stm, char *fmt, ...);
+
diff --git a/include/fitz/text.h b/include/fitz/text.h
index 8bb6ee5a..619aae83 100644
--- a/include/fitz/text.h
+++ b/include/fitz/text.h
@@ -1,3 +1,25 @@
+/*
+ * Fitz display tree text node.
+ *
+ * The text node is an optimization to reference glyphs in a font resource
+ * and specifying an individual transform matrix for each one.
+ *
+ * The trm field contains the a, b, c and d coefficients.
+ * The e and f coefficients come from the individual elements,
+ * together they form the transform matrix for the glyph.
+ *
+ * Glyphs are referenced by glyph ID.
+ * The Unicode text equivalent is kept in a separate array
+ * with indexes into the glyph array.
+ *
+
+TODO the unicode textels
+
+struct fz_textgid_s { float e, f; int gid; };
+struct fz_textucs_s { int idx; int ucs; };
+
+ */
+
typedef struct fz_textel_s fz_textel;
struct fz_textel_s
diff --git a/include/fitz/tree.h b/include/fitz/tree.h
index ced3b491..9f76f167 100644
--- a/include/fitz/tree.h
+++ b/include/fitz/tree.h
@@ -1,3 +1,10 @@
+/*
+ * The display tree is at the center of attention in Fitz.
+ * The tree and most of its minor nodes.
+ * Paths and text nodes are found elsewhere.
+ * Resources used are also found elsewhere.
+ */
+
typedef struct fz_tree_s fz_tree;
typedef struct fz_node_s fz_node;
diff --git a/include/mupdf/content.h b/include/mupdf/content.h
index adc5757a..ad6b824d 100644
--- a/include/mupdf/content.h
+++ b/include/mupdf/content.h
@@ -105,6 +105,6 @@ fz_error *pdf_showimage(pdf_csi*, pdf_image *img);
/* interpret.c */
fz_error *pdf_newcsi(pdf_csi **csip, int maskonly);
-fz_error *pdf_runcsi(pdf_csi *, pdf_xref *xref, fz_obj *rdb, fz_file *);
+fz_error *pdf_runcsi(pdf_csi *, pdf_xref *xref, fz_obj *rdb, fz_stream *);
void pdf_dropcsi(pdf_csi *csi);
diff --git a/include/mupdf/rsrc.h b/include/mupdf/rsrc.h
index 5b78a1e8..1b245987 100644
--- a/include/mupdf/rsrc.h
+++ b/include/mupdf/rsrc.h
@@ -135,7 +135,7 @@ struct pdf_image_s
fz_buffer *samples;
};
-fz_error *pdf_loadinlineimage(pdf_image **imgp, pdf_xref *xref, fz_obj *rdb, fz_obj *dict, fz_file *file);
+fz_error *pdf_loadinlineimage(pdf_image **imgp, pdf_xref *xref, fz_obj *rdb, fz_obj *dict, fz_stream *file);
fz_error *pdf_loadimage(pdf_image **imgp, pdf_xref *xref, fz_obj *obj, fz_obj *ref);
fz_error *pdf_loadtile(fz_image *image, fz_pixmap *tile);
@@ -197,7 +197,7 @@ struct pdf_font_s
};
/* cmap.c */
-fz_error *pdf_parsecmap(fz_cmap **cmapp, fz_file *file);
+fz_error *pdf_parsecmap(fz_cmap **cmapp, fz_stream *file);
fz_error *pdf_loadembeddedcmap(fz_cmap **cmapp, pdf_xref *xref, fz_obj *ref);
fz_error *pdf_loadsystemcmap(fz_cmap **cmapp, char *name);
fz_error *pdf_makeidentitycmap(fz_cmap **cmapp, int wmode, int bytes);
diff --git a/include/mupdf/syntax.h b/include/mupdf/syntax.h
index 87fc946a..d5598cd5 100644
--- a/include/mupdf/syntax.h
+++ b/include/mupdf/syntax.h
@@ -17,13 +17,13 @@ enum
};
/* lex.c */
-int pdf_lex(fz_file *f, unsigned char *buf, int n, int *len);
+int pdf_lex(fz_stream *f, unsigned char *buf, int n, int *len);
/* parse.c */
-fz_error *pdf_parsearray(fz_obj **op, fz_file *f, char *buf, int cap);
-fz_error *pdf_parsedict(fz_obj **op, fz_file *f, char *buf, int cap);
-fz_error *pdf_parsestmobj(fz_obj **op, fz_file *f, char *buf, int cap);
-fz_error *pdf_parseindobj(fz_obj **op, fz_file *f, char *buf, int cap, int *oid, int *gid, int *stmofs);
+fz_error *pdf_parsearray(fz_obj **op, fz_stream *f, char *buf, int cap);
+fz_error *pdf_parsedict(fz_obj **op, fz_stream *f, char *buf, int cap);
+fz_error *pdf_parsestmobj(fz_obj **op, fz_stream *f, char *buf, int cap);
+fz_error *pdf_parseindobj(fz_obj **op, fz_stream *f, char *buf, int cap, int *oid, int *gid, int *stmofs);
fz_rect pdf_torect(fz_obj *array);
fz_matrix pdf_tomatrix(fz_obj *array);
diff --git a/include/mupdf/xref.h b/include/mupdf/xref.h
index d16d81f4..3143719d 100644
--- a/include/mupdf/xref.h
+++ b/include/mupdf/xref.h
@@ -7,8 +7,7 @@ typedef struct pdf_xref_s pdf_xref;
struct pdf_xref_s
{
- fz_file *file;
- fz_file *stream;
+ fz_stream *file;
float version;
int startxref;
pdf_crypt *crypt;
@@ -61,13 +60,12 @@ fz_error *pdf_loadobject(fz_obj **objp, pdf_xref *, int oid, int gen);
fz_error *pdf_loadindirect(fz_obj **objp, pdf_xref *, fz_obj *ref);
fz_error *pdf_resolve(fz_obj **reforobj, pdf_xref *);
-fz_error *pdf_decodefilter(fz_filter **filterp, fz_obj *stmobj);
int pdf_isstream(pdf_xref *xref, int oid, int gen);
+fz_error *pdf_buildinlinefilter(fz_filter **filterp, fz_obj *stmobj);
fz_error *pdf_loadrawstream(fz_buffer **bufp, pdf_xref *xref, int oid, int gen);
fz_error *pdf_loadstream(fz_buffer **bufp, pdf_xref *xref, int oid, int gen);
-fz_error *pdf_openrawstream(pdf_xref *, int oid, int gen);
-fz_error *pdf_openstream(pdf_xref *, int oid, int gen);
-void pdf_closestream(pdf_xref *);
+fz_error *pdf_openrawstream(fz_stream **stmp, pdf_xref *, int oid, int gen);
+fz_error *pdf_openstream(fz_stream **stmp, pdf_xref *, int oid, int gen);
fz_error *pdf_garbagecollect(pdf_xref *xref);
fz_error *pdf_transplant(pdf_xref *dst, pdf_xref *src, fz_obj **newp, fz_obj *old);
diff --git a/include/samus.h b/include/samus.h
index 215fe573..dd5e4656 100644
--- a/include/samus.h
+++ b/include/samus.h
@@ -9,4 +9,5 @@
#include "samus/zip.h"
#include "samus/xml.h"
+#include "samus/pack.h"
diff --git a/include/samus/package.h b/include/samus/pack.h
index 4c8512f7..bba55d2f 100644
--- a/include/samus/package.h
+++ b/include/samus/pack.h
@@ -6,7 +6,6 @@ typedef struct sa_package_s sa_package;
fz_error *sa_openpackage(sa_package **packp, char *filename);
char *sa_accesspart(sa_package *pack, char *partname);
-fz_error *sa_openpart(fz_file **filep, sa_package *pack, char *partname);
-void sa_closepart(sa_package *pack, fz_file *file);
+fz_error *sa_openpart(fz_stream **filep, sa_package *pack, char *partname);
void sa_closepackage(sa_package *pack);
diff --git a/include/samus/xml.h b/include/samus/xml.h
index 56c19b0a..b72fbe56 100644
--- a/include/samus/xml.h
+++ b/include/samus/xml.h
@@ -7,7 +7,7 @@
typedef struct sa_xmlparser_s sa_xmlparser;
typedef struct sa_xmlitem_s sa_xmlitem;
-fz_error *sa_openxml(sa_xmlparser **spp, fz_file *file, int ns);
+fz_error *sa_openxml(sa_xmlparser **spp, fz_stream *file, int ns);
void sa_debugxml(sa_xmlitem *item, int level);
void sa_closexml(sa_xmlparser *sp);
@@ -15,12 +15,6 @@ sa_xmlitem *sa_xmlnext(sa_xmlparser *sp);
void sa_xmldown(sa_xmlparser *sp);
void sa_xmlup(sa_xmlparser *sp);
-int sa_isxmlerror(sa_xmlitem *item);
-int sa_isxmltext(sa_xmlitem *item);
-int sa_isxmltag(sa_xmlitem *item);
-
-char *sa_xmlerror(sa_xmlitem *item);
char *sa_xmlname(sa_xmlitem *item);
char *sa_xmlatt(sa_xmlitem *item, char *att);
-char *sa_xmltext(sa_xmlitem *item);
diff --git a/include/samus/zip.h b/include/samus/zip.h
index 2d3635f7..e06e1e90 100644
--- a/include/samus/zip.h
+++ b/include/samus/zip.h
@@ -3,27 +3,10 @@
*/
typedef struct sa_zip_s sa_zip;
-typedef struct sa_zipent_s sa_zipent;
-
-struct sa_zipent_s
-{
- unsigned offset;
- unsigned csize;
- unsigned usize;
- char *name;
-};
-
-struct sa_zip_s
-{
- fz_file *file;
- int len;
- sa_zipent *table;
-};
fz_error *sa_openzip(sa_zip **zipp, char *filename);
void sa_debugzip(sa_zip *zip);
void sa_closezip(sa_zip *zip);
int sa_accesszipentry(sa_zip *zip, char *name);
-fz_error *sa_openzipentry(sa_zip *zip, char *name);
-void sa_closezipentry(sa_zip *zip);
+fz_error *sa_openzipentry(fz_stream **stmp, sa_zip *zip, char *name);