summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/fitz/object.h15
-rw-r--r--include/mupdf/annot.h23
-rw-r--r--include/mupdf/page.h42
-rw-r--r--include/mupdf/rsrc.h1
-rw-r--r--include/mupdf/syntax.h1
-rw-r--r--include/mupdf/xref.h28
6 files changed, 48 insertions, 62 deletions
diff --git a/include/fitz/object.h b/include/fitz/object.h
index 015f1e74..34b62f59 100644
--- a/include/fitz/object.h
+++ b/include/fitz/object.h
@@ -1,4 +1,5 @@
typedef struct fz_obj_s fz_obj;
+typedef struct fz_keyval_s fz_keyval;
typedef enum fz_objkind_e
{
@@ -23,7 +24,7 @@ struct fz_keyval_s
struct fz_obj_s
{
unsigned short refs;
- unsigned short kind; /* fz_objkind takes 4 bytes :( */
+ char kind; /* fz_objkind takes 4 bytes :( */
union
{
int b;
@@ -40,9 +41,10 @@ struct fz_obj_s
fz_obj **items;
} a;
struct {
+ char sorted;
int len;
int cap;
- struct fz_keyval_s *items;
+ fz_keyval *items;
} d;
struct {
int oid;
@@ -83,19 +85,21 @@ int fz_isdict(fz_obj *obj);
int fz_isindirect(fz_obj *obj);
int fz_ispointer(fz_obj *obj);
-int fz_cmpobj(fz_obj *a, fz_obj *b);
+int fz_objcmp(fz_obj *a, fz_obj *b);
/* silent failure, no error reporting */
int fz_tobool(fz_obj *obj);
int fz_toint(fz_obj *obj);
float fz_toreal(fz_obj *obj);
char *fz_toname(fz_obj *obj);
-char *fz_tostringbuf(fz_obj *obj);
-int fz_tostringlen(fz_obj *obj);
+char *fz_tostrbuf(fz_obj *obj);
+int fz_tostrlen(fz_obj *obj);
int fz_tonum(fz_obj *obj);
int fz_togen(fz_obj *obj);
void *fz_topointer(fz_obj *obj);
+fz_error *fz_newnamefromstring(fz_obj **op, fz_obj *str);
+
int fz_arraylen(fz_obj *array);
fz_obj *fz_arrayget(fz_obj *array, int i);
fz_error *fz_arrayput(fz_obj *array, int i, fz_obj *obj);
@@ -111,6 +115,7 @@ fz_error *fz_dictput(fz_obj *dict, fz_obj *key, fz_obj *val);
fz_error *fz_dictputs(fz_obj *dict, char *key, fz_obj *val);
fz_error *fz_dictdel(fz_obj *dict, fz_obj *key);
fz_error *fz_dictdels(fz_obj *dict, char *key);
+void fz_sortdict(fz_obj *dict);
int fz_sprintobj(char *s, int n, fz_obj *obj, int tight);
void fz_debugobj(fz_obj *obj);
diff --git a/include/mupdf/annot.h b/include/mupdf/annot.h
index ac017735..47e7a9f8 100644
--- a/include/mupdf/annot.h
+++ b/include/mupdf/annot.h
@@ -5,6 +5,7 @@
typedef struct pdf_link_s pdf_link;
typedef struct pdf_comment_s pdf_comment;
typedef struct pdf_widget_s pdf_widget;
+typedef struct pdf_outline_s pdf_outline;
typedef enum pdf_linkkind_e
{
@@ -16,9 +17,7 @@ struct pdf_link_s
{
pdf_linkkind kind;
fz_rect rect;
- fz_obj *page;
- fz_obj *uri;
- int ismap;
+ fz_obj *dest;
pdf_link *next;
};
@@ -46,8 +45,24 @@ struct pdf_comment_s
pdf_comment *next;
};
-fz_error * pdf_newlink(pdf_link**, fz_rect rect, int ismap, fz_obj *page, fz_obj *uri);
+struct pdf_outline_s
+{
+ char *title;
+ pdf_link *link;
+ pdf_outline *child;
+ pdf_outline *next;
+};
+
+fz_error *pdf_loadnametree(fz_obj **dictp, pdf_xref *xref, fz_obj *root);
+fz_error *pdf_loadnametrees(pdf_xref *xref);
+
+fz_error *pdf_newlink(pdf_link**, fz_rect rect, fz_obj *dest);
+fz_error *pdf_loadlink(pdf_link **linkp, pdf_xref *xref, fz_obj *dict);
void pdf_droplink(pdf_link *link);
+fz_error *pdf_loadoutline(pdf_outline **outlinep, pdf_xref *xref);
+void pdf_debugoutline(pdf_outline *outline, int level);
+void pdf_dropoutline(pdf_outline *outline);
+
fz_error *pdf_loadannots(pdf_comment **, pdf_link **, pdf_xref *, fz_obj *annots);
diff --git a/include/mupdf/page.h b/include/mupdf/page.h
index f027ac89..648fe54d 100644
--- a/include/mupdf/page.h
+++ b/include/mupdf/page.h
@@ -2,40 +2,11 @@
* Page tree, pages and related objects
*/
-typedef struct pdf_outlinetree_s pdf_outlinetree;
-typedef struct pdf_outline_s pdf_outline;
-typedef struct pdf_nametree_s pdf_nametree;
typedef struct pdf_pagetree_s pdf_pagetree;
typedef struct pdf_page_s pdf_page;
typedef struct pdf_textline_s pdf_textline;
typedef struct pdf_textchar_s pdf_textchar;
-struct pdf_outlinetree_s
-{
- pdf_outline *first;
- int count;
-};
-
-struct pdf_outline_s
-{
- char *title;
- pdf_outline *next;
- pdf_outline *first;
- int count;
- fz_obj *dest;
- fz_obj *a;
- fz_obj *se;
- float c[3];
- int f;
-};
-
-struct pdf_nametree_s
-{
- int len;
- int cap;
- struct fz_keyval_s *items;
-};
-
struct pdf_pagetree_s
{
int count;
@@ -67,19 +38,6 @@ struct pdf_textline_s
pdf_textline *next;
};
-/* outline.c */
-fz_error *pdf_loadoutlinetree(pdf_outlinetree **oo, pdf_xref *xref);
-void pdf_debugoutlinetree(pdf_outlinetree *outlinetree);
-void pdf_dropoutlinetree(pdf_outlinetree *outlinetree);
-
-/* nametree.c */
-fz_error *pdf_loadnametrees(pdf_xref *xref);
-fz_error *pdf_loadnametree(pdf_nametree **treep, pdf_xref *xref, fz_obj *root);
-void pdf_dropnametree(pdf_nametree *tree);
-void pdf_debugnametree(pdf_nametree *tree);
-fz_obj *pdf_lookupname(pdf_nametree *tree, fz_obj *name);
-fz_obj *pdf_lookupnames(pdf_nametree *tree, char *name);
-
/* pagetree.c */
fz_error *pdf_loadpagetree(pdf_pagetree **pp, pdf_xref *xref);
int pdf_getpagecount(pdf_pagetree *pages);
diff --git a/include/mupdf/rsrc.h b/include/mupdf/rsrc.h
index 29c8fa97..34aefea2 100644
--- a/include/mupdf/rsrc.h
+++ b/include/mupdf/rsrc.h
@@ -150,6 +150,7 @@ extern int pdf_adobeglyphlen;
void pdf_loadencoding(char **estrings, char *encoding);
int pdf_lookupagl(char *name);
+extern unsigned short pdf_docencoding[256];
extern char *pdf_macroman[256];
extern char *pdf_macexpert[256];
extern char *pdf_winansi[256];
diff --git a/include/mupdf/syntax.h b/include/mupdf/syntax.h
index 786147bd..c25dcb01 100644
--- a/include/mupdf/syntax.h
+++ b/include/mupdf/syntax.h
@@ -27,6 +27,7 @@ fz_error *pdf_parseindobj(fz_obj **op, fz_file *f, char *buf, int cap, int *oid,
fz_rect pdf_torect(fz_obj *array);
fz_matrix pdf_tomatrix(fz_obj *array);
+fz_error *pdf_toutf8(char **dstp, fz_obj *src);
/*
* Encryption
diff --git a/include/mupdf/xref.h b/include/mupdf/xref.h
index 3721e09a..98f45a39 100644
--- a/include/mupdf/xref.h
+++ b/include/mupdf/xref.h
@@ -11,15 +11,20 @@ struct pdf_xref_s
fz_file *stream;
float version;
int startxref;
- fz_obj *trailer; /* TODO split this into root/info/encrypt/id */
pdf_crypt *crypt;
+ fz_obj *trailer; /* TODO split this into root/info/encrypt/id */
+ fz_obj *root; /* resolved catalog dict */
+ fz_obj *info; /* resolved info dict */
+ fz_obj *dests; /* flattened dests nametree */
+
int len;
int cap;
pdf_xrefentry *table;
- struct pdf_nametree_s *dests;
struct pdf_store_s *store;
+ struct pdf_pagetree_s *pages;
+ struct pdf_outline_s *outlines;
};
struct pdf_xrefentry_s
@@ -33,16 +38,17 @@ struct pdf_xrefentry_s
fz_obj *obj; /* stored/cached object */
};
-fz_error *pdf_repairpdf(pdf_xref **, char *filename);
-fz_error *pdf_openpdf(pdf_xref **, char *filename);
-fz_error *pdf_newpdf(pdf_xref **);
+fz_error *pdf_newxref(pdf_xref **);
+fz_error *pdf_repairxref(pdf_xref *, char *filename);
+fz_error *pdf_loadxref(pdf_xref *, char *filename);
-fz_error *pdf_updatepdf(pdf_xref *, char *filename);
-fz_error *pdf_savepdf(pdf_xref *, char *filename, pdf_crypt *encrypt);
+fz_error *pdf_openpdf(pdf_xref **, char *filename);
+fz_error *pdf_updatexref(pdf_xref *, char *filename);
+fz_error *pdf_savexref(pdf_xref *, char *filename, pdf_crypt *encrypt);
-void pdf_debugpdf(pdf_xref *);
-void pdf_flushpdf(pdf_xref *, int force);
-void pdf_closepdf(pdf_xref *);
+void pdf_debugxref(pdf_xref *);
+void pdf_flushxref(pdf_xref *, int force);
+void pdf_closexref(pdf_xref *);
fz_error *pdf_allocobject(pdf_xref *, int *oidp, int *genp);
fz_error *pdf_deleteobject(pdf_xref *, int oid, int gen);
@@ -67,5 +73,5 @@ fz_error *pdf_transplant(pdf_xref *dst, pdf_xref *src, fz_obj **newp, fz_obj *ol
/* private */
fz_error *pdf_loadobjstm(pdf_xref *xref, int oid, int gen, char *buf, int cap);
-fz_error *pdf_decryptpdf(pdf_xref *xref);
+fz_error *pdf_decryptxref(pdf_xref *xref);