summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-02-26 11:15:16 -0800
committerRobin Watts <robin@ghostscript.com>2012-02-26 19:36:30 +0000
commitbbfe635555dce16858403706e2031dd3bfa1a9f1 (patch)
tree6e414005f04f233a83dbeec5607c0665a6d498bc /apps
parentca578b08dc1243dc6cbb3235272d52d9e2336925 (diff)
downloadmupdf-bbfe635555dce16858403706e2031dd3bfa1a9f1.tar.xz
Move fz_obj to be pdf_obj.
Currently, we are in the slightly strange position of having the PDF specific object types as part of fitz. Here we pull them out into the pdf layer instead. This has been made possible by the recent changes to make the store no longer be tied to having fz_obj's as keys. Most of this work is a simple huge rename; to help customers who may have code that use such functions we have provided a sed script to do the renaming; scripts/rename2.sed. Various other small tweaks are required; the store used to have some debugging code that still required knowledge of fz_obj types - we extract that into a nicer 'type' based function pointer. Also, the type 3 font handling used to have an fz_obj pointer for type 3 resources, and therefore needed to know how to free this; this has become a void * with a function to free it.
Diffstat (limited to 'apps')
-rw-r--r--apps/mupdfclean.c314
-rw-r--r--apps/mupdfextract.c46
-rw-r--r--apps/mupdfinfo.c412
-rw-r--r--apps/mupdfshow.c24
4 files changed, 398 insertions, 398 deletions
diff --git a/apps/mupdfclean.c b/apps/mupdfclean.c
index 3130e3f0..f47ea2b5 100644
--- a/apps/mupdfclean.c
+++ b/apps/mupdfclean.c
@@ -53,34 +53,34 @@ static void usage(void)
* Garbage collect objects not reachable from the trailer.
*/
-static void sweepref(fz_obj *ref);
+static void sweepref(pdf_obj *ref);
-static void sweepobj(fz_obj *obj)
+static void sweepobj(pdf_obj *obj)
{
int i;
- if (fz_is_indirect(obj))
+ if (pdf_is_indirect(obj))
sweepref(obj);
- else if (fz_is_dict(obj))
+ else if (pdf_is_dict(obj))
{
- int n = fz_dict_len(obj);
+ int n = pdf_dict_len(obj);
for (i = 0; i < n; i++)
- sweepobj(fz_dict_get_val(obj, i));
+ sweepobj(pdf_dict_get_val(obj, i));
}
- else if (fz_is_array(obj))
+ else if (pdf_is_array(obj))
{
- int n = fz_array_len(obj);
+ int n = pdf_array_len(obj);
for (i = 0; i < n; i++)
- sweepobj(fz_array_get(obj, i));
+ sweepobj(pdf_array_get(obj, i));
}
}
-static void sweepref(fz_obj *obj)
+static void sweepref(pdf_obj *obj)
{
- int num = fz_to_num(obj);
- int gen = fz_to_gen(obj);
+ int num = pdf_to_num(obj);
+ int gen = pdf_to_gen(obj);
if (num < 0 || num >= xref->len)
return;
@@ -94,12 +94,12 @@ static void sweepref(fz_obj *obj)
{
if (pdf_is_stream(xref, num, gen))
{
- fz_obj *len = fz_dict_gets(obj, "Length");
- if (fz_is_indirect(len))
+ pdf_obj *len = pdf_dict_gets(obj, "Length");
+ if (pdf_is_indirect(len))
{
- uselist[fz_to_num(len)] = 0;
- len = fz_resolve_indirect(len);
- fz_dict_puts(obj, "Length", len);
+ uselist[pdf_to_num(len)] = 0;
+ len = pdf_resolve_indirect(len);
+ pdf_dict_puts(obj, "Length", len);
}
}
}
@@ -108,7 +108,7 @@ static void sweepref(fz_obj *obj)
/* Leave broken */
}
- sweepobj(fz_resolve_indirect(obj));
+ sweepobj(pdf_resolve_indirect(obj));
}
/*
@@ -124,7 +124,7 @@ static void removeduplicateobjs(void)
/* Only compare an object to objects preceding it */
for (other = 1; other < num; other++)
{
- fz_obj *a, *b;
+ pdf_obj *a, *b;
if (num == other || !uselist[num] || !uselist[other])
continue;
@@ -148,10 +148,10 @@ static void removeduplicateobjs(void)
a = xref->table[num].obj;
b = xref->table[other].obj;
- a = fz_resolve_indirect(a);
- b = fz_resolve_indirect(b);
+ a = pdf_resolve_indirect(a);
+ b = pdf_resolve_indirect(b);
- if (fz_objcmp(a, b))
+ if (pdf_objcmp(a, b))
continue;
/* Keep the lowest numbered object */
@@ -195,23 +195,23 @@ static void compactxref(void)
* removing duplicate objects and compacting the xref.
*/
-static void renumberobj(fz_obj *obj)
+static void renumberobj(pdf_obj *obj)
{
int i;
fz_context *ctx = xref->ctx;
- if (fz_is_dict(obj))
+ if (pdf_is_dict(obj))
{
- int n = fz_dict_len(obj);
+ int n = pdf_dict_len(obj);
for (i = 0; i < n; i++)
{
- fz_obj *key = fz_dict_get_key(obj, i);
- fz_obj *val = fz_dict_get_val(obj, i);
- if (fz_is_indirect(val))
+ pdf_obj *key = pdf_dict_get_key(obj, i);
+ pdf_obj *val = pdf_dict_get_val(obj, i);
+ if (pdf_is_indirect(val))
{
- val = fz_new_indirect(ctx, renumbermap[fz_to_num(val)], 0, xref);
+ val = pdf_new_indirect(ctx, renumbermap[pdf_to_num(val)], 0, xref);
fz_dict_put(obj, key, val);
- fz_drop_obj(val);
+ pdf_drop_obj(val);
}
else
{
@@ -220,17 +220,17 @@ static void renumberobj(fz_obj *obj)
}
}
- else if (fz_is_array(obj))
+ else if (pdf_is_array(obj))
{
- int n = fz_array_len(obj);
+ int n = pdf_array_len(obj);
for (i = 0; i < n; i++)
{
- fz_obj *val = fz_array_get(obj, i);
- if (fz_is_indirect(val))
+ pdf_obj *val = pdf_array_get(obj, i);
+ if (pdf_is_indirect(val))
{
- val = fz_new_indirect(ctx, renumbermap[fz_to_num(val)], 0, xref);
- fz_array_put(obj, i, val);
- fz_drop_obj(val);
+ val = pdf_new_indirect(ctx, renumbermap[pdf_to_num(val)], 0, xref);
+ pdf_array_put(obj, i, val);
+ pdf_drop_obj(val);
}
else
{
@@ -250,13 +250,13 @@ static void renumberobjs(void)
renumberobj(xref->trailer);
for (num = 0; num < xref->len; num++)
{
- fz_obj *obj = xref->table[num].obj;
+ pdf_obj *obj = xref->table[num].obj;
- if (fz_is_indirect(obj))
+ if (pdf_is_indirect(obj))
{
- obj = fz_new_indirect(ctx, renumbermap[fz_to_num(obj)], 0, xref);
+ obj = pdf_new_indirect(ctx, renumbermap[pdf_to_num(obj)], 0, xref);
pdf_update_object(xref, num, 0, obj);
- fz_drop_obj(obj);
+ pdf_drop_obj(obj);
}
else
{
@@ -282,7 +282,7 @@ static void renumberobjs(void)
else
{
if (oldxref[num].obj)
- fz_drop_obj(oldxref[num].obj);
+ pdf_drop_obj(oldxref[num].obj);
}
}
@@ -302,25 +302,25 @@ static void renumberobjs(void)
static void retainpages(int argc, char **argv)
{
- fz_obj *oldroot, *root, *pages, *kids, *countobj, *parent, *olddests;
+ pdf_obj *oldroot, *root, *pages, *kids, *countobj, *parent, *olddests;
/* Keep only pages/type and (reduced) dest entries to avoid
* references to unretained pages */
- oldroot = fz_dict_gets(xref->trailer, "Root");
- pages = fz_dict_gets(oldroot, "Pages");
+ oldroot = pdf_dict_gets(xref->trailer, "Root");
+ pages = pdf_dict_gets(oldroot, "Pages");
olddests = pdf_load_name_tree(xref, "Dests");
- root = fz_new_dict(ctx, 2);
- fz_dict_puts(root, "Type", fz_dict_gets(oldroot, "Type"));
- fz_dict_puts(root, "Pages", fz_dict_gets(oldroot, "Pages"));
+ root = pdf_new_dict(ctx, 2);
+ pdf_dict_puts(root, "Type", pdf_dict_gets(oldroot, "Type"));
+ pdf_dict_puts(root, "Pages", pdf_dict_gets(oldroot, "Pages"));
- pdf_update_object(xref, fz_to_num(oldroot), fz_to_gen(oldroot), root);
+ pdf_update_object(xref, pdf_to_num(oldroot), pdf_to_gen(oldroot), root);
- fz_drop_obj(root);
+ pdf_drop_obj(root);
/* Create a new kids array with only the pages we want to keep */
- parent = fz_new_indirect(ctx, fz_to_num(pages), fz_to_gen(pages), xref);
- kids = fz_new_array(ctx, 1);
+ parent = pdf_new_indirect(ctx, pdf_to_num(pages), pdf_to_gen(pages), xref);
+ kids = pdf_new_array(ctx, 1);
/* Retain pages specified */
while (argc - fz_optind)
@@ -357,13 +357,13 @@ static void retainpages(int argc, char **argv)
for (page = spage; page <= epage; page++)
{
- fz_obj *pageobj = xref->page_objs[page-1];
- fz_obj *pageref = xref->page_refs[page-1];
+ pdf_obj *pageobj = xref->page_objs[page-1];
+ pdf_obj *pageref = xref->page_refs[page-1];
- fz_dict_puts(pageobj, "Parent", parent);
+ pdf_dict_puts(pageobj, "Parent", parent);
/* Store page object in new kids array */
- fz_array_push(kids, pageref);
+ pdf_array_push(kids, pageref);
}
spec = fz_strsep(&pagelist, ",");
@@ -372,48 +372,48 @@ static void retainpages(int argc, char **argv)
fz_optind++;
}
- fz_drop_obj(parent);
+ pdf_drop_obj(parent);
/* Update page count and kids array */
- countobj = fz_new_int(ctx, fz_array_len(kids));
- fz_dict_puts(pages, "Count", countobj);
- fz_drop_obj(countobj);
- fz_dict_puts(pages, "Kids", kids);
- fz_drop_obj(kids);
+ countobj = pdf_new_int(ctx, pdf_array_len(kids));
+ pdf_dict_puts(pages, "Count", countobj);
+ pdf_drop_obj(countobj);
+ pdf_dict_puts(pages, "Kids", kids);
+ pdf_drop_obj(kids);
/* Also preserve the (partial) Dests name tree */
if (olddests)
{
int i;
- fz_obj *names = fz_new_dict(ctx, 1);
- fz_obj *dests = fz_new_dict(ctx, 1);
- fz_obj *names_list = fz_new_array(ctx, 32);
+ pdf_obj *names = pdf_new_dict(ctx, 1);
+ pdf_obj *dests = pdf_new_dict(ctx, 1);
+ pdf_obj *names_list = pdf_new_array(ctx, 32);
- for (i = 0; i < fz_dict_len(olddests); i++)
+ for (i = 0; i < pdf_dict_len(olddests); i++)
{
- fz_obj *key = fz_dict_get_key(olddests, i);
- fz_obj *val = fz_dict_get_val(olddests, i);
- fz_obj *key_str = fz_new_string(ctx, fz_to_name(key), strlen(fz_to_name(key)));
- fz_obj *dest = fz_dict_gets(val, "D");
+ pdf_obj *key = pdf_dict_get_key(olddests, i);
+ pdf_obj *val = pdf_dict_get_val(olddests, i);
+ pdf_obj *key_str = pdf_new_string(ctx, pdf_to_name(key), strlen(pdf_to_name(key)));
+ pdf_obj *dest = pdf_dict_gets(val, "D");
- dest = fz_array_get(dest ? dest : val, 0);
- if (fz_array_contains(fz_dict_gets(pages, "Kids"), dest))
+ dest = pdf_array_get(dest ? dest : val, 0);
+ if (pdf_array_contains(pdf_dict_gets(pages, "Kids"), dest))
{
- fz_array_push(names_list, key_str);
- fz_array_push(names_list, val);
+ pdf_array_push(names_list, key_str);
+ pdf_array_push(names_list, val);
}
- fz_drop_obj(key_str);
+ pdf_drop_obj(key_str);
}
- root = fz_dict_gets(xref->trailer, "Root");
- fz_dict_puts(dests, "Names", names_list);
- fz_dict_puts(names, "Dests", dests);
- fz_dict_puts(root, "Names", names);
+ root = pdf_dict_gets(xref->trailer, "Root");
+ pdf_dict_puts(dests, "Names", names_list);
+ pdf_dict_puts(names, "Dests", dests);
+ pdf_dict_puts(root, "Names", names);
- fz_drop_obj(names);
- fz_drop_obj(dests);
- fz_drop_obj(names_list);
- fz_drop_obj(olddests);
+ pdf_drop_obj(names);
+ pdf_drop_obj(dests);
+ pdf_drop_obj(names_list);
+ pdf_drop_obj(olddests);
}
}
@@ -423,7 +423,7 @@ static void retainpages(int argc, char **argv)
static void preloadobjstms(void)
{
- fz_obj *obj;
+ pdf_obj *obj;
int num;
for (num = 0; num < xref->len; num++)
@@ -431,7 +431,7 @@ static void preloadobjstms(void)
if (xref->table[num].type == 'o')
{
obj = pdf_load_object(xref, num, 0);
- fz_drop_obj(obj);
+ pdf_drop_obj(obj);
}
}
}
@@ -482,57 +482,57 @@ static fz_buffer *hexbuf(unsigned char *p, int n)
return buf;
}
-static void addhexfilter(fz_obj *dict)
+static void addhexfilter(pdf_obj *dict)
{
- fz_obj *f, *dp, *newf, *newdp;
- fz_obj *ahx, *nullobj;
+ pdf_obj *f, *dp, *newf, *newdp;
+ pdf_obj *ahx, *nullobj;
ahx = fz_new_name(ctx, "ASCIIHexDecode");
- nullobj = fz_new_null(ctx);
+ nullobj = pdf_new_null(ctx);
newf = newdp = NULL;
- f = fz_dict_gets(dict, "Filter");
- dp = fz_dict_gets(dict, "DecodeParms");
+ f = pdf_dict_gets(dict, "Filter");
+ dp = pdf_dict_gets(dict, "DecodeParms");
- if (fz_is_name(f))
+ if (pdf_is_name(f))
{
- newf = fz_new_array(ctx, 2);
- fz_array_push(newf, ahx);
- fz_array_push(newf, f);
+ newf = pdf_new_array(ctx, 2);
+ pdf_array_push(newf, ahx);
+ pdf_array_push(newf, f);
f = newf;
- if (fz_is_dict(dp))
+ if (pdf_is_dict(dp))
{
- newdp = fz_new_array(ctx, 2);
- fz_array_push(newdp, nullobj);
- fz_array_push(newdp, dp);
+ newdp = pdf_new_array(ctx, 2);
+ pdf_array_push(newdp, nullobj);
+ pdf_array_push(newdp, dp);
dp = newdp;
}
}
- else if (fz_is_array(f))
+ else if (pdf_is_array(f))
{
- fz_array_insert(f, ahx);
- if (fz_is_array(dp))
- fz_array_insert(dp, nullobj);
+ pdf_array_insert(f, ahx);
+ if (pdf_is_array(dp))
+ pdf_array_insert(dp, nullobj);
}
else
f = ahx;
- fz_dict_puts(dict, "Filter", f);
+ pdf_dict_puts(dict, "Filter", f);
if (dp)
- fz_dict_puts(dict, "DecodeParms", dp);
+ pdf_dict_puts(dict, "DecodeParms", dp);
- fz_drop_obj(ahx);
- fz_drop_obj(nullobj);
+ pdf_drop_obj(ahx);
+ pdf_drop_obj(nullobj);
if (newf)
- fz_drop_obj(newf);
+ pdf_drop_obj(newf);
if (newdp)
- fz_drop_obj(newdp);
+ pdf_drop_obj(newdp);
}
-static void copystream(fz_obj *obj, int num, int gen)
+static void copystream(pdf_obj *obj, int num, int gen)
{
fz_buffer *buf, *tmp;
- fz_obj *newlen;
+ pdf_obj *newlen;
buf = pdf_load_raw_stream(xref, num, gen);
@@ -544,13 +544,13 @@ static void copystream(fz_obj *obj, int num, int gen)
addhexfilter(obj);
- newlen = fz_new_int(ctx, buf->len);
- fz_dict_puts(obj, "Length", newlen);
- fz_drop_obj(newlen);
+ newlen = pdf_new_int(ctx, buf->len);
+ pdf_dict_puts(obj, "Length", newlen);
+ pdf_drop_obj(newlen);
}
fprintf(out, "%d %d obj\n", num, gen);
- fz_fprint_obj(out, obj, doexpand == 0);
+ pdf_fprint_obj(out, obj, doexpand == 0);
fprintf(out, "stream\n");
fwrite(buf->data, 1, buf->len, out);
fprintf(out, "endstream\nendobj\n\n");
@@ -558,15 +558,15 @@ static void copystream(fz_obj *obj, int num, int gen)
fz_drop_buffer(ctx, buf);
}
-static void expandstream(fz_obj *obj, int num, int gen)
+static void expandstream(pdf_obj *obj, int num, int gen)
{
fz_buffer *buf, *tmp;
- fz_obj *newlen;
+ pdf_obj *newlen;
buf = pdf_load_stream(xref, num, gen);
- fz_dict_dels(obj, "Filter");
- fz_dict_dels(obj, "DecodeParms");
+ pdf_dict_dels(obj, "Filter");
+ pdf_dict_dels(obj, "DecodeParms");
if (doascii && isbinarystream(buf))
{
@@ -577,12 +577,12 @@ static void expandstream(fz_obj *obj, int num, int gen)
addhexfilter(obj);
}
- newlen = fz_new_int(ctx, buf->len);
- fz_dict_puts(obj, "Length", newlen);
- fz_drop_obj(newlen);
+ newlen = pdf_new_int(ctx, buf->len);
+ pdf_dict_puts(obj, "Length", newlen);
+ pdf_drop_obj(newlen);
fprintf(out, "%d %d obj\n", num, gen);
- fz_fprint_obj(out, obj, doexpand == 0);
+ pdf_fprint_obj(out, obj, doexpand == 0);
fprintf(out, "stream\n");
fwrite(buf->data, 1, buf->len, out);
fprintf(out, "endstream\nendobj\n\n");
@@ -592,25 +592,25 @@ static void expandstream(fz_obj *obj, int num, int gen)
static void writeobject(int num, int gen)
{
- fz_obj *obj;
- fz_obj *type;
+ pdf_obj *obj;
+ pdf_obj *type;
obj = pdf_load_object(xref, num, gen);
/* skip ObjStm and XRef objects */
- if (fz_is_dict(obj))
+ if (pdf_is_dict(obj))
{
- type = fz_dict_gets(obj, "Type");
- if (fz_is_name(type) && !strcmp(fz_to_name(type), "ObjStm"))
+ type = pdf_dict_gets(obj, "Type");
+ if (pdf_is_name(type) && !strcmp(pdf_to_name(type), "ObjStm"))
{
uselist[num] = 0;
- fz_drop_obj(obj);
+ pdf_drop_obj(obj);
return;
}
- if (fz_is_name(type) && !strcmp(fz_to_name(type), "XRef"))
+ if (pdf_is_name(type) && !strcmp(pdf_to_name(type), "XRef"))
{
uselist[num] = 0;
- fz_drop_obj(obj);
+ pdf_drop_obj(obj);
return;
}
}
@@ -618,7 +618,7 @@ static void writeobject(int num, int gen)
if (!pdf_is_stream(xref, num, gen))
{
fprintf(out, "%d %d obj\n", num, gen);
- fz_fprint_obj(out, obj, doexpand == 0);
+ pdf_fprint_obj(out, obj, doexpand == 0);
fprintf(out, "endobj\n\n");
}
else
@@ -626,24 +626,24 @@ static void writeobject(int num, int gen)
int dontexpand = 0;
if (doexpand != 0 && doexpand != expand_all)
{
- fz_obj *o;
+ pdf_obj *o;
- if ((o = fz_dict_gets(obj, "Type"), !strcmp(fz_to_name(o), "XObject")) &&
- (o = fz_dict_gets(obj, "Subtype"), !strcmp(fz_to_name(o), "Image")))
+ if ((o = pdf_dict_gets(obj, "Type"), !strcmp(pdf_to_name(o), "XObject")) &&
+ (o = pdf_dict_gets(obj, "Subtype"), !strcmp(pdf_to_name(o), "Image")))
dontexpand = !(doexpand & expand_images);
- if (o = fz_dict_gets(obj, "Type"), !strcmp(fz_to_name(o), "Font"))
+ if (o = pdf_dict_gets(obj, "Type"), !strcmp(pdf_to_name(o), "Font"))
dontexpand = !(doexpand & expand_fonts);
- if (o = fz_dict_gets(obj, "Type"), !strcmp(fz_to_name(o), "FontDescriptor"))
+ if (o = pdf_dict_gets(obj, "Type"), !strcmp(pdf_to_name(o), "FontDescriptor"))
dontexpand = !(doexpand & expand_fonts);
- if ((o = fz_dict_gets(obj, "Length1")) != NULL)
+ if ((o = pdf_dict_gets(obj, "Length1")) != NULL)
dontexpand = !(doexpand & expand_fonts);
- if ((o = fz_dict_gets(obj, "Length2")) != NULL)
+ if ((o = pdf_dict_gets(obj, "Length2")) != NULL)
dontexpand = !(doexpand & expand_fonts);
- if ((o = fz_dict_gets(obj, "Length3")) != NULL)
+ if ((o = pdf_dict_gets(obj, "Length3")) != NULL)
dontexpand = !(doexpand & expand_fonts);
- if (o = fz_dict_gets(obj, "Subtype"), !strcmp(fz_to_name(o), "Type1C"))
+ if (o = pdf_dict_gets(obj, "Subtype"), !strcmp(pdf_to_name(o), "Type1C"))
dontexpand = !(doexpand & expand_fonts);
- if (o = fz_dict_gets(obj, "Subtype"), !strcmp(fz_to_name(o), "CIDFontType0C"))
+ if (o = pdf_dict_gets(obj, "Subtype"), !strcmp(pdf_to_name(o), "CIDFontType0C"))
dontexpand = !(doexpand & expand_fonts);
}
if (doexpand && !dontexpand && !pdf_is_jpx_image(ctx, obj))
@@ -652,13 +652,13 @@ static void writeobject(int num, int gen)
copystream(obj, num, gen);
}
- fz_drop_obj(obj);
+ pdf_drop_obj(obj);
}
static void writexref(void)
{
- fz_obj *trailer;
- fz_obj *obj;
+ pdf_obj *trailer;
+ pdf_obj *obj;
int startxref;
int num;
@@ -674,29 +674,29 @@ static void writexref(void)
}
fprintf(out, "\n");
- trailer = fz_new_dict(ctx, 5);
+ trailer = pdf_new_dict(ctx, 5);
- obj = fz_new_int(ctx, xref->len);
- fz_dict_puts(trailer, "Size", obj);
- fz_drop_obj(obj);
+ obj = pdf_new_int(ctx, xref->len);
+ pdf_dict_puts(trailer, "Size", obj);
+ pdf_drop_obj(obj);
- obj = fz_dict_gets(xref->trailer, "Info");
+ obj = pdf_dict_gets(xref->trailer, "Info");
if (obj)
- fz_dict_puts(trailer, "Info", obj);
+ pdf_dict_puts(trailer, "Info", obj);
- obj = fz_dict_gets(xref->trailer, "Root");
+ obj = pdf_dict_gets(xref->trailer, "Root");
if (obj)
- fz_dict_puts(trailer, "Root", obj);
+ pdf_dict_puts(trailer, "Root", obj);
- obj = fz_dict_gets(xref->trailer, "ID");
+ obj = pdf_dict_gets(xref->trailer, "ID");
if (obj)
- fz_dict_puts(trailer, "ID", obj);
+ pdf_dict_puts(trailer, "ID", obj);
fprintf(out, "trailer\n");
- fz_fprint_obj(out, trailer, doexpand == 0);
+ pdf_fprint_obj(out, trailer, doexpand == 0);
fprintf(out, "\n");
- fz_drop_obj(trailer);
+ pdf_drop_obj(trailer);
fprintf(out, "startxref\n%d\n%%%%EOF\n", startxref);
}
diff --git a/apps/mupdfextract.c b/apps/mupdfextract.c
index 239e9ea7..dd3066f5 100644
--- a/apps/mupdfextract.c
+++ b/apps/mupdfextract.c
@@ -17,26 +17,26 @@ static void usage(void)
exit(1);
}
-static int isimage(fz_obj *obj)
+static int isimage(pdf_obj *obj)
{
- fz_obj *type = fz_dict_gets(obj, "Subtype");
- return fz_is_name(type) && !strcmp(fz_to_name(type), "Image");
+ pdf_obj *type = pdf_dict_gets(obj, "Subtype");
+ return pdf_is_name(type) && !strcmp(pdf_to_name(type), "Image");
}
-static int isfontdesc(fz_obj *obj)
+static int isfontdesc(pdf_obj *obj)
{
- fz_obj *type = fz_dict_gets(obj, "Type");
- return fz_is_name(type) && !strcmp(fz_to_name(type), "FontDescriptor");
+ pdf_obj *type = pdf_dict_gets(obj, "Type");
+ return pdf_is_name(type) && !strcmp(pdf_to_name(type), "FontDescriptor");
}
static void saveimage(int num)
{
fz_image *image;
fz_pixmap *img;
- fz_obj *ref;
+ pdf_obj *ref;
char name[1024];
- ref = fz_new_indirect(ctx, num, 0, doc);
+ ref = pdf_new_indirect(ctx, num, 0, doc);
/* TODO: detect DCTD and save as jpeg */
@@ -67,49 +67,49 @@ static void saveimage(int num)
}
fz_drop_pixmap(ctx, img);
- fz_drop_obj(ref);
+ pdf_drop_obj(ref);
}
-static void savefont(fz_obj *dict, int num)
+static void savefont(pdf_obj *dict, int num)
{
char name[1024];
char *subtype;
fz_buffer *buf;
- fz_obj *stream = NULL;
- fz_obj *obj;
+ pdf_obj *stream = NULL;
+ pdf_obj *obj;
char *ext = "";
FILE *f;
char *fontname = "font";
int n;
- obj = fz_dict_gets(dict, "FontName");
+ obj = pdf_dict_gets(dict, "FontName");
if (obj)
- fontname = fz_to_name(obj);
+ fontname = pdf_to_name(obj);
- obj = fz_dict_gets(dict, "FontFile");
+ obj = pdf_dict_gets(dict, "FontFile");
if (obj)
{
stream = obj;
ext = "pfa";
}
- obj = fz_dict_gets(dict, "FontFile2");
+ obj = pdf_dict_gets(dict, "FontFile2");
if (obj)
{
stream = obj;
ext = "ttf";
}
- obj = fz_dict_gets(dict, "FontFile3");
+ obj = pdf_dict_gets(dict, "FontFile3");
if (obj)
{
stream = obj;
- obj = fz_dict_gets(obj, "Subtype");
- if (obj && !fz_is_name(obj))
+ obj = pdf_dict_gets(obj, "Subtype");
+ if (obj && !pdf_is_name(obj))
fz_throw(ctx, "Invalid font descriptor subtype");
- subtype = fz_to_name(obj);
+ subtype = pdf_to_name(obj);
if (!strcmp(subtype, "Type1C"))
ext = "cff";
else if (!strcmp(subtype, "CIDFontType0C"))
@@ -124,7 +124,7 @@ static void savefont(fz_obj *dict, int num)
return;
}
- buf = pdf_load_stream(doc, fz_to_num(stream), fz_to_gen(stream));
+ buf = pdf_load_stream(doc, pdf_to_num(stream), pdf_to_gen(stream));
sprintf(name, "%s-%04d.%s", fontname, num, ext);
printf("extracting font %s\n", name);
@@ -145,7 +145,7 @@ static void savefont(fz_obj *dict, int num)
static void showobject(int num)
{
- fz_obj *obj;
+ pdf_obj *obj;
if (!doc)
fz_throw(ctx, "no file specified");
@@ -157,7 +157,7 @@ static void showobject(int num)
else if (isfontdesc(obj))
savefont(obj, num);
- fz_drop_obj(obj);
+ pdf_drop_obj(obj);
}
#ifdef MUPDF_COMBINED_EXE
diff --git a/apps/mupdfinfo.c b/apps/mupdfinfo.c
index 3c98c772..90316d6f 100644
--- a/apps/mupdfinfo.c
+++ b/apps/mupdfinfo.c
@@ -28,48 +28,48 @@ enum
struct info
{
int page;
- fz_obj *pageref;
- fz_obj *pageobj;
+ pdf_obj *pageref;
+ pdf_obj *pageobj;
union {
struct {
- fz_obj *obj;
+ pdf_obj *obj;
} info;
struct {
- fz_obj *obj;
+ pdf_obj *obj;
} crypt;
struct {
- fz_obj *obj;
+ pdf_obj *obj;
fz_rect *bbox;
} dim;
struct {
- fz_obj *obj;
- fz_obj *subtype;
- fz_obj *name;
+ pdf_obj *obj;
+ pdf_obj *subtype;
+ pdf_obj *name;
} font;
struct {
- fz_obj *obj;
- fz_obj *width;
- fz_obj *height;
- fz_obj *bpc;
- fz_obj *filter;
- fz_obj *cs;
- fz_obj *altcs;
+ pdf_obj *obj;
+ pdf_obj *width;
+ pdf_obj *height;
+ pdf_obj *bpc;
+ pdf_obj *filter;
+ pdf_obj *cs;
+ pdf_obj *altcs;
} image;
struct {
- fz_obj *obj;
- fz_obj *type;
+ pdf_obj *obj;
+ pdf_obj *type;
} shading;
struct {
- fz_obj *obj;
- fz_obj *type;
- fz_obj *paint;
- fz_obj *tiling;
- fz_obj *shading;
+ pdf_obj *obj;
+ pdf_obj *type;
+ pdf_obj *paint;
+ pdf_obj *tiling;
+ pdf_obj *shading;
} pattern;
struct {
- fz_obj *obj;
- fz_obj *groupsubtype;
- fz_obj *reference;
+ pdf_obj *obj;
+ pdf_obj *groupsubtype;
+ pdf_obj *reference;
} form;
} u;
};
@@ -168,36 +168,36 @@ infousage(void)
static void
showglobalinfo(void)
{
- fz_obj *obj;
+ pdf_obj *obj;
printf("\nPDF-%d.%d\n", xref->version / 10, xref->version % 10);
- obj = fz_dict_gets(xref->trailer, "Info");
+ obj = pdf_dict_gets(xref->trailer, "Info");
if (obj)
{
- printf("Info object (%d %d R):\n", fz_to_num(obj), fz_to_gen(obj));
- fz_debug_obj(fz_resolve_indirect(obj));
+ printf("Info object (%d %d R):\n", pdf_to_num(obj), pdf_to_gen(obj));
+ pdf_debug_obj(pdf_resolve_indirect(obj));
}
- obj = fz_dict_gets(xref->trailer, "Encrypt");
+ obj = pdf_dict_gets(xref->trailer, "Encrypt");
if (obj)
{
- printf("\nEncryption object (%d %d R):\n", fz_to_num(obj), fz_to_gen(obj));
- fz_debug_obj(fz_resolve_indirect(obj));
+ printf("\nEncryption object (%d %d R):\n", pdf_to_num(obj), pdf_to_gen(obj));
+ pdf_debug_obj(pdf_resolve_indirect(obj));
}
printf("\nPages: %d\n\n", pagecount);
}
static void
-gatherdimensions(int page, fz_obj *pageref, fz_obj *pageobj)
+gatherdimensions(int page, pdf_obj *pageref, pdf_obj *pageobj)
{
fz_rect bbox;
- fz_obj *obj;
+ pdf_obj *obj;
int j;
- obj = fz_dict_gets(pageobj, "MediaBox");
- if (!fz_is_array(obj))
+ obj = pdf_dict_gets(pageobj, "MediaBox");
+ if (!pdf_is_array(obj))
return;
bbox = pdf_to_rect(ctx, obj);
@@ -222,33 +222,33 @@ gatherdimensions(int page, fz_obj *pageref, fz_obj *pageobj)
}
static void
-gatherfonts(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
+gatherfonts(int page, pdf_obj *pageref, pdf_obj *pageobj, pdf_obj *dict)
{
int i, n;
- n = fz_dict_len(dict);
+ n = pdf_dict_len(dict);
for (i = 0; i < n; i++)
{
- fz_obj *fontdict = NULL;
- fz_obj *subtype = NULL;
- fz_obj *basefont = NULL;
- fz_obj *name = NULL;
+ pdf_obj *fontdict = NULL;
+ pdf_obj *subtype = NULL;
+ pdf_obj *basefont = NULL;
+ pdf_obj *name = NULL;
int k;
- fontdict = fz_dict_get_val(dict, i);
- if (!fz_is_dict(fontdict))
+ fontdict = pdf_dict_get_val(dict, i);
+ if (!pdf_is_dict(fontdict))
{
- fz_warn(ctx, "not a font dict (%d %d R)", fz_to_num(fontdict), fz_to_gen(fontdict));
+ fz_warn(ctx, "not a font dict (%d %d R)", pdf_to_num(fontdict), pdf_to_gen(fontdict));
continue;
}
- subtype = fz_dict_gets(fontdict, "Subtype");
- basefont = fz_dict_gets(fontdict, "BaseFont");
- if (!basefont || fz_is_null(basefont))
- name = fz_dict_gets(fontdict, "Name");
+ subtype = pdf_dict_gets(fontdict, "Subtype");
+ basefont = pdf_dict_gets(fontdict, "BaseFont");
+ if (!basefont || pdf_is_null(basefont))
+ name = pdf_dict_gets(fontdict, "Name");
for (k = 0; k < fonts; k++)
- if (!fz_objcmp(font[k].u.font.obj, fontdict))
+ if (!pdf_objcmp(font[k].u.font.obj, fontdict))
break;
if (k < fonts)
@@ -267,57 +267,57 @@ gatherfonts(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
}
static void
-gatherimages(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
+gatherimages(int page, pdf_obj *pageref, pdf_obj *pageobj, pdf_obj *dict)
{
int i, n;
- n = fz_dict_len(dict);
+ n = pdf_dict_len(dict);
for (i = 0; i < n; i++)
{
- fz_obj *imagedict;
- fz_obj *type;
- fz_obj *width;
- fz_obj *height;
- fz_obj *bpc = NULL;
- fz_obj *filter = NULL;
- fz_obj *cs = NULL;
- fz_obj *altcs;
+ pdf_obj *imagedict;
+ pdf_obj *type;
+ pdf_obj *width;
+ pdf_obj *height;
+ pdf_obj *bpc = NULL;
+ pdf_obj *filter = NULL;
+ pdf_obj *cs = NULL;
+ pdf_obj *altcs;
int k;
- imagedict = fz_dict_get_val(dict, i);
- if (!fz_is_dict(imagedict))
+ imagedict = pdf_dict_get_val(dict, i);
+ if (!pdf_is_dict(imagedict))
{
- fz_warn(ctx, "not an image dict (%d %d R)", fz_to_num(imagedict), fz_to_gen(imagedict));
+ fz_warn(ctx, "not an image dict (%d %d R)", pdf_to_num(imagedict), pdf_to_gen(imagedict));
continue;
}
- type = fz_dict_gets(imagedict, "Subtype");
- if (strcmp(fz_to_name(type), "Image"))
+ type = pdf_dict_gets(imagedict, "Subtype");
+ if (strcmp(pdf_to_name(type), "Image"))
continue;
- filter = fz_dict_gets(imagedict, "Filter");
+ filter = pdf_dict_gets(imagedict, "Filter");
altcs = NULL;
- cs = fz_dict_gets(imagedict, "ColorSpace");
- if (fz_is_array(cs))
+ cs = pdf_dict_gets(imagedict, "ColorSpace");
+ if (pdf_is_array(cs))
{
- fz_obj *cses = cs;
+ pdf_obj *cses = cs;
- cs = fz_array_get(cses, 0);
- if (fz_is_name(cs) && (!strcmp(fz_to_name(cs), "DeviceN") || !strcmp(fz_to_name(cs), "Separation")))
+ cs = pdf_array_get(cses, 0);
+ if (pdf_is_name(cs) && (!strcmp(pdf_to_name(cs), "DeviceN") || !strcmp(pdf_to_name(cs), "Separation")))
{
- altcs = fz_array_get(cses, 2);
- if (fz_is_array(altcs))
- altcs = fz_array_get(altcs, 0);
+ altcs = pdf_array_get(cses, 2);
+ if (pdf_is_array(altcs))
+ altcs = pdf_array_get(altcs, 0);
}
}
- width = fz_dict_gets(imagedict, "Width");
- height = fz_dict_gets(imagedict, "Height");
- bpc = fz_dict_gets(imagedict, "BitsPerComponent");
+ width = pdf_dict_gets(imagedict, "Width");
+ height = pdf_dict_gets(imagedict, "Height");
+ bpc = pdf_dict_gets(imagedict, "BitsPerComponent");
for (k = 0; k < images; k++)
- if (!fz_objcmp(image[k].u.image.obj, imagedict))
+ if (!pdf_objcmp(image[k].u.image.obj, imagedict))
break;
if (k < images)
@@ -340,42 +340,42 @@ gatherimages(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
}
static void
-gatherforms(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
+gatherforms(int page, pdf_obj *pageref, pdf_obj *pageobj, pdf_obj *dict)
{
int i, n;
- n = fz_dict_len(dict);
+ n = pdf_dict_len(dict);
for (i = 0; i < n; i++)
{
- fz_obj *xobjdict;
- fz_obj *type;
- fz_obj *subtype;
- fz_obj *group;
- fz_obj *groupsubtype;
- fz_obj *reference;
+ pdf_obj *xobjdict;
+ pdf_obj *type;
+ pdf_obj *subtype;
+ pdf_obj *group;
+ pdf_obj *groupsubtype;
+ pdf_obj *reference;
int k;
- xobjdict = fz_dict_get_val(dict, i);
- if (!fz_is_dict(xobjdict))
+ xobjdict = pdf_dict_get_val(dict, i);
+ if (!pdf_is_dict(xobjdict))
{
- fz_warn(ctx, "not a xobject dict (%d %d R)", fz_to_num(xobjdict), fz_to_gen(xobjdict));
+ fz_warn(ctx, "not a xobject dict (%d %d R)", pdf_to_num(xobjdict), pdf_to_gen(xobjdict));
continue;
}
- type = fz_dict_gets(xobjdict, "Subtype");
- if (strcmp(fz_to_name(type), "Form"))
+ type = pdf_dict_gets(xobjdict, "Subtype");
+ if (strcmp(pdf_to_name(type), "Form"))
continue;
- subtype = fz_dict_gets(xobjdict, "Subtype2");
- if (!strcmp(fz_to_name(subtype), "PS"))
+ subtype = pdf_dict_gets(xobjdict, "Subtype2");
+ if (!strcmp(pdf_to_name(subtype), "PS"))
continue;
- group = fz_dict_gets(xobjdict, "Group");
- groupsubtype = fz_dict_gets(group, "S");
- reference = fz_dict_gets(xobjdict, "Ref");
+ group = pdf_dict_gets(xobjdict, "Group");
+ groupsubtype = pdf_dict_gets(group, "S");
+ reference = pdf_dict_gets(xobjdict, "Ref");
for (k = 0; k < forms; k++)
- if (!fz_objcmp(form[k].u.form.obj, xobjdict))
+ if (!pdf_objcmp(form[k].u.form.obj, xobjdict))
break;
if (k < forms)
@@ -394,33 +394,33 @@ gatherforms(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
}
static void
-gatherpsobjs(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
+gatherpsobjs(int page, pdf_obj *pageref, pdf_obj *pageobj, pdf_obj *dict)
{
int i, n;
- n = fz_dict_len(dict);
+ n = pdf_dict_len(dict);
for (i = 0; i < n; i++)
{
- fz_obj *xobjdict;
- fz_obj *type;
- fz_obj *subtype;
+ pdf_obj *xobjdict;
+ pdf_obj *type;
+ pdf_obj *subtype;
int k;
- xobjdict = fz_dict_get_val(dict, i);
- if (!fz_is_dict(xobjdict))
+ xobjdict = pdf_dict_get_val(dict, i);
+ if (!pdf_is_dict(xobjdict))
{
- fz_warn(ctx, "not a xobject dict (%d %d R)", fz_to_num(xobjdict), fz_to_gen(xobjdict));
+ fz_warn(ctx, "not a xobject dict (%d %d R)", pdf_to_num(xobjdict), pdf_to_gen(xobjdict));
continue;
}
- type = fz_dict_gets(xobjdict, "Subtype");
- subtype = fz_dict_gets(xobjdict, "Subtype2");
- if (strcmp(fz_to_name(type), "PS") &&
- (strcmp(fz_to_name(type), "Form") || strcmp(fz_to_name(subtype), "PS")))
+ type = pdf_dict_gets(xobjdict, "Subtype");
+ subtype = pdf_dict_gets(xobjdict, "Subtype2");
+ if (strcmp(pdf_to_name(type), "PS") &&
+ (strcmp(pdf_to_name(type), "Form") || strcmp(pdf_to_name(subtype), "PS")))
continue;
for (k = 0; k < psobjs; k++)
- if (!fz_objcmp(psobj[k].u.form.obj, xobjdict))
+ if (!pdf_objcmp(psobj[k].u.form.obj, xobjdict))
break;
if (k < psobjs)
@@ -437,33 +437,33 @@ gatherpsobjs(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
}
static void
-gathershadings(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
+gathershadings(int page, pdf_obj *pageref, pdf_obj *pageobj, pdf_obj *dict)
{
int i, n;
- n = fz_dict_len(dict);
+ n = pdf_dict_len(dict);
for (i = 0; i < n; i++)
{
- fz_obj *shade;
- fz_obj *type;
+ pdf_obj *shade;
+ pdf_obj *type;
int k;
- shade = fz_dict_get_val(dict, i);
- if (!fz_is_dict(shade))
+ shade = pdf_dict_get_val(dict, i);
+ if (!pdf_is_dict(shade))
{
- fz_warn(ctx, "not a shading dict (%d %d R)", fz_to_num(shade), fz_to_gen(shade));
+ fz_warn(ctx, "not a shading dict (%d %d R)", pdf_to_num(shade), pdf_to_gen(shade));
continue;
}
- type = fz_dict_gets(shade, "ShadingType");
- if (!fz_is_int(type) || fz_to_int(type) < 1 || fz_to_int(type) > 7)
+ type = pdf_dict_gets(shade, "ShadingType");
+ if (!pdf_is_int(type) || pdf_to_int(type) < 1 || pdf_to_int(type) > 7)
{
- fz_warn(ctx, "not a shading type (%d %d R)", fz_to_num(shade), fz_to_gen(shade));
+ fz_warn(ctx, "not a shading type (%d %d R)", pdf_to_num(shade), pdf_to_gen(shade));
type = NULL;
}
for (k = 0; k < shadings; k++)
- if (!fz_objcmp(shading[k].u.shading.obj, shade))
+ if (!pdf_objcmp(shading[k].u.shading.obj, shade))
break;
if (k < shadings)
@@ -481,57 +481,57 @@ gathershadings(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
}
static void
-gatherpatterns(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
+gatherpatterns(int page, pdf_obj *pageref, pdf_obj *pageobj, pdf_obj *dict)
{
int i, n;
- n = fz_dict_len(dict);
+ n = pdf_dict_len(dict);
for (i = 0; i < n; i++)
{
- fz_obj *patterndict;
- fz_obj *type;
- fz_obj *paint = NULL;
- fz_obj *tiling = NULL;
- fz_obj *shading = NULL;
+ pdf_obj *patterndict;
+ pdf_obj *type;
+ pdf_obj *paint = NULL;
+ pdf_obj *tiling = NULL;
+ pdf_obj *shading = NULL;
int k;
- patterndict = fz_dict_get_val(dict, i);
- if (!fz_is_dict(patterndict))
+ patterndict = pdf_dict_get_val(dict, i);
+ if (!pdf_is_dict(patterndict))
{
- fz_warn(ctx, "not a pattern dict (%d %d R)", fz_to_num(patterndict), fz_to_gen(patterndict));
+ fz_warn(ctx, "not a pattern dict (%d %d R)", pdf_to_num(patterndict), pdf_to_gen(patterndict));
continue;
}
- type = fz_dict_gets(patterndict, "PatternType");
- if (!fz_is_int(type) || fz_to_int(type) < 1 || fz_to_int(type) > 2)
+ type = pdf_dict_gets(patterndict, "PatternType");
+ if (!pdf_is_int(type) || pdf_to_int(type) < 1 || pdf_to_int(type) > 2)
{
- fz_warn(ctx, "not a pattern type (%d %d R)", fz_to_num(patterndict), fz_to_gen(patterndict));
+ fz_warn(ctx, "not a pattern type (%d %d R)", pdf_to_num(patterndict), pdf_to_gen(patterndict));
type = NULL;
}
- if (fz_to_int(type) == 1)
+ if (pdf_to_int(type) == 1)
{
- paint = fz_dict_gets(patterndict, "PaintType");
- if (!fz_is_int(paint) || fz_to_int(paint) < 1 || fz_to_int(paint) > 2)
+ paint = pdf_dict_gets(patterndict, "PaintType");
+ if (!pdf_is_int(paint) || pdf_to_int(paint) < 1 || pdf_to_int(paint) > 2)
{
- fz_warn(ctx, "not a pattern paint type (%d %d R)", fz_to_num(patterndict), fz_to_gen(patterndict));
+ fz_warn(ctx, "not a pattern paint type (%d %d R)", pdf_to_num(patterndict), pdf_to_gen(patterndict));
paint = NULL;
}
- tiling = fz_dict_gets(patterndict, "TilingType");
- if (!fz_is_int(tiling) || fz_to_int(tiling) < 1 || fz_to_int(tiling) > 3)
+ tiling = pdf_dict_gets(patterndict, "TilingType");
+ if (!pdf_is_int(tiling) || pdf_to_int(tiling) < 1 || pdf_to_int(tiling) > 3)
{
- fz_warn(ctx, "not a pattern tiling type (%d %d R)", fz_to_num(patterndict), fz_to_gen(patterndict));
+ fz_warn(ctx, "not a pattern tiling type (%d %d R)", pdf_to_num(patterndict), pdf_to_gen(patterndict));
tiling = NULL;
}
}
else
{
- shading = fz_dict_gets(patterndict, "Shading");
+ shading = pdf_dict_gets(patterndict, "Shading");
}
for (k = 0; k < patterns; k++)
- if (!fz_objcmp(pattern[k].u.pattern.obj, patterndict))
+ if (!pdf_objcmp(pattern[k].u.pattern.obj, patterndict))
break;
if (k < patterns)
@@ -552,15 +552,15 @@ gatherpatterns(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
}
static void
-gatherresourceinfo(int page, fz_obj *rsrc)
+gatherresourceinfo(int page, pdf_obj *rsrc)
{
- fz_obj *pageobj;
- fz_obj *pageref;
- fz_obj *font;
- fz_obj *xobj;
- fz_obj *shade;
- fz_obj *pattern;
- fz_obj *subrsrc;
+ pdf_obj *pageobj;
+ pdf_obj *pageref;
+ pdf_obj *font;
+ pdf_obj *xobj;
+ pdf_obj *shade;
+ pdf_obj *pattern;
+ pdf_obj *subrsrc;
int i;
pageobj = xref->page_objs[page-1];
@@ -569,24 +569,24 @@ gatherresourceinfo(int page, fz_obj *rsrc)
if (!pageobj)
fz_throw(ctx, "cannot retrieve info from page %d", page);
- font = fz_dict_gets(rsrc, "Font");
+ font = pdf_dict_gets(rsrc, "Font");
if (font)
{
int n;
gatherfonts(page, pageref, pageobj, font);
- n = fz_dict_len(font);
+ n = pdf_dict_len(font);
for (i = 0; i < n; i++)
{
- fz_obj *obj = fz_dict_get_val(font, i);
+ pdf_obj *obj = pdf_dict_get_val(font, i);
- subrsrc = fz_dict_gets(obj, "Resources");
- if (subrsrc && fz_objcmp(rsrc, subrsrc))
+ subrsrc = pdf_dict_gets(obj, "Resources");
+ if (subrsrc && pdf_objcmp(rsrc, subrsrc))
gatherresourceinfo(page, subrsrc);
}
}
- xobj = fz_dict_gets(rsrc, "XObject");
+ xobj = pdf_dict_gets(rsrc, "XObject");
if (xobj)
{
int n;
@@ -594,31 +594,31 @@ gatherresourceinfo(int page, fz_obj *rsrc)
gatherimages(page, pageref, pageobj, xobj);
gatherforms(page, pageref, pageobj, xobj);
gatherpsobjs(page, pageref, pageobj, xobj);
- n = fz_dict_len(xobj);
+ n = pdf_dict_len(xobj);
for (i = 0; i < n; i++)
{
- fz_obj *obj = fz_dict_get_val(xobj, i);
- subrsrc = fz_dict_gets(obj, "Resources");
- if (subrsrc && fz_objcmp(rsrc, subrsrc))
+ pdf_obj *obj = pdf_dict_get_val(xobj, i);
+ subrsrc = pdf_dict_gets(obj, "Resources");
+ if (subrsrc && pdf_objcmp(rsrc, subrsrc))
gatherresourceinfo(page, subrsrc);
}
}
- shade = fz_dict_gets(rsrc, "Shading");
+ shade = pdf_dict_gets(rsrc, "Shading");
if (shade)
gathershadings(page, pageref, pageobj, shade);
- pattern = fz_dict_gets(rsrc, "Pattern");
+ pattern = pdf_dict_gets(rsrc, "Pattern");
if (pattern)
{
int n;
gatherpatterns(page, pageref, pageobj, pattern);
- n = fz_dict_len(pattern);
+ n = pdf_dict_len(pattern);
for (i = 0; i < n; i++)
{
- fz_obj *obj = fz_dict_get_val(pattern, i);
- subrsrc = fz_dict_gets(obj, "Resources");
- if (subrsrc && fz_objcmp(rsrc, subrsrc))
+ pdf_obj *obj = pdf_dict_get_val(pattern, i);
+ subrsrc = pdf_dict_gets(obj, "Resources");
+ if (subrsrc && pdf_objcmp(rsrc, subrsrc))
gatherresourceinfo(page, subrsrc);
}
}
@@ -627,9 +627,9 @@ gatherresourceinfo(int page, fz_obj *rsrc)
static void
gatherpageinfo(int page)
{
- fz_obj *pageobj;
- fz_obj *pageref;
- fz_obj *rsrc;
+ pdf_obj *pageobj;
+ pdf_obj *pageref;
+ pdf_obj *rsrc;
pageobj = xref->page_objs[page-1];
pageref = xref->page_refs[page-1];
@@ -639,7 +639,7 @@ gatherpageinfo(int page)
gatherdimensions(page, pageref, pageobj);
- rsrc = fz_dict_gets(pageobj, "Resources");
+ rsrc = pdf_dict_gets(pageobj, "Resources");
gatherresourceinfo(page, rsrc);
}
@@ -658,7 +658,7 @@ printinfo(char *filename, int show, int page)
{
printf(PAGE_FMT "[ %g %g %g %g ]\n",
dim[i].page,
- fz_to_num(dim[i].pageref), fz_to_gen(dim[i].pageref),
+ pdf_to_num(dim[i].pageref), pdf_to_gen(dim[i].pageref),
dim[i].u.dim.bbox->x0,
dim[i].u.dim.bbox->y0,
dim[i].u.dim.bbox->x1,
@@ -674,10 +674,10 @@ printinfo(char *filename, int show, int page)
{
printf(PAGE_FMT "%s '%s' (%d %d R)\n",
font[i].page,
- fz_to_num(font[i].pageref), fz_to_gen(font[i].pageref),
- fz_to_name(font[i].u.font.subtype),
- fz_to_name(font[i].u.font.name),
- fz_to_num(font[i].u.font.obj), fz_to_gen(font[i].u.font.obj));
+ pdf_to_num(font[i].pageref), pdf_to_gen(font[i].pageref),
+ pdf_to_name(font[i].u.font.subtype),
+ pdf_to_name(font[i].u.font.name),
+ pdf_to_num(font[i].u.font.obj), pdf_to_gen(font[i].u.font.obj));
}
printf("\n");
}
@@ -692,29 +692,29 @@ printinfo(char *filename, int show, int page)
printf(PAGE_FMT "[ ",
image[i].page,
- fz_to_num(image[i].pageref), fz_to_gen(image[i].pageref));
+ pdf_to_num(image[i].pageref), pdf_to_gen(image[i].pageref));
- if (fz_is_array(image[i].u.image.filter))
+ if (pdf_is_array(image[i].u.image.filter))
{
- int n = fz_array_len(image[i].u.image.filter);
+ int n = pdf_array_len(image[i].u.image.filter);
for (j = 0; j < n; j++)
{
- fz_obj *obj = fz_array_get(image[i].u.image.filter, j);
- char *filter = fz_strdup(ctx, fz_to_name(obj));
+ pdf_obj *obj = pdf_array_get(image[i].u.image.filter, j);
+ char *filter = fz_strdup(ctx, pdf_to_name(obj));
if (strstr(filter, "Decode"))
*(strstr(filter, "Decode")) = '\0';
printf("%s%s",
filter,
- j == fz_array_len(image[i].u.image.filter) - 1 ? "" : " ");
+ j == pdf_array_len(image[i].u.image.filter) - 1 ? "" : " ");
fz_free(ctx, filter);
}
}
else if (image[i].u.image.filter)
{
- fz_obj *obj = image[i].u.image.filter;
- char *filter = fz_strdup(ctx, fz_to_name(obj));
+ pdf_obj *obj = image[i].u.image.filter;
+ char *filter = fz_strdup(ctx, pdf_to_name(obj));
if (strstr(filter, "Decode"))
*(strstr(filter, "Decode")) = '\0';
@@ -727,7 +727,7 @@ printinfo(char *filename, int show, int page)
if (image[i].u.image.cs)
{
- cs = fz_strdup(ctx, fz_to_name(image[i].u.image.cs));
+ cs = fz_strdup(ctx, pdf_to_name(image[i].u.image.cs));
if (!strncmp(cs, "Device", 6))
{
@@ -746,7 +746,7 @@ printinfo(char *filename, int show, int page)
}
if (image[i].u.image.altcs)
{
- altcs = fz_strdup(ctx, fz_to_name(image[i].u.image.altcs));
+ altcs = fz_strdup(ctx, pdf_to_name(image[i].u.image.altcs));
if (!strncmp(altcs, "Device", 6))
{
@@ -765,13 +765,13 @@ printinfo(char *filename, int show, int page)
}
printf(" ] %dx%d %dbpc %s%s%s (%d %d R)\n",
- fz_to_int(image[i].u.image.width),
- fz_to_int(image[i].u.image.height),
- image[i].u.image.bpc ? fz_to_int(image[i].u.image.bpc) : 1,
+ pdf_to_int(image[i].u.image.width),
+ pdf_to_int(image[i].u.image.height),
+ image[i].u.image.bpc ? pdf_to_int(image[i].u.image.bpc) : 1,
image[i].u.image.cs ? cs : "ImageMask",
image[i].u.image.altcs ? " " : "",
image[i].u.image.altcs ? altcs : "",
- fz_to_num(image[i].u.image.obj), fz_to_gen(image[i].u.image.obj));
+ pdf_to_num(image[i].u.image.obj), pdf_to_gen(image[i].u.image.obj));
fz_free(ctx, cs);
fz_free(ctx, altcs);
@@ -798,9 +798,9 @@ printinfo(char *filename, int show, int page)
printf(PAGE_FMT "%s (%d %d R)\n",
shading[i].page,
- fz_to_num(shading[i].pageref), fz_to_gen(shading[i].pageref),
- shadingtype[fz_to_int(shading[i].u.shading.type)],
- fz_to_num(shading[i].u.shading.obj), fz_to_gen(shading[i].u.shading.obj));
+ pdf_to_num(shading[i].pageref), pdf_to_gen(shading[i].pageref),
+ shadingtype[pdf_to_int(shading[i].u.shading.type)],
+ pdf_to_num(shading[i].u.shading.obj), pdf_to_gen(shading[i].u.shading.obj));
}
printf("\n");
}
@@ -810,7 +810,7 @@ printinfo(char *filename, int show, int page)
printf("Patterns (%d):\n", patterns);
for (i = 0; i < patterns; i++)
{
- if (fz_to_int(pattern[i].u.pattern.type) == 1)
+ if (pdf_to_int(pattern[i].u.pattern.type) == 1)
{
char *painttype[] =
{
@@ -828,18 +828,18 @@ printinfo(char *filename, int show, int page)
printf(PAGE_FMT "Tiling %s %s (%d %d R)\n",
pattern[i].page,
- fz_to_num(pattern[i].pageref), fz_to_gen(pattern[i].pageref),
- painttype[fz_to_int(pattern[i].u.pattern.paint)],
- tilingtype[fz_to_int(pattern[i].u.pattern.tiling)],
- fz_to_num(pattern[i].u.pattern.obj), fz_to_gen(pattern[i].u.pattern.obj));
+ pdf_to_num(pattern[i].pageref), pdf_to_gen(pattern[i].pageref),
+ painttype[pdf_to_int(pattern[i].u.pattern.paint)],
+ tilingtype[pdf_to_int(pattern[i].u.pattern.tiling)],
+ pdf_to_num(pattern[i].u.pattern.obj), pdf_to_gen(pattern[i].u.pattern.obj));
}
else
{
printf(PAGE_FMT "Shading %d %d R (%d %d R)\n",
pattern[i].page,
- fz_to_num(pattern[i].pageref), fz_to_gen(pattern[i].pageref),
- fz_to_num(pattern[i].u.pattern.shading), fz_to_gen(pattern[i].u.pattern.shading),
- fz_to_num(pattern[i].u.pattern.obj), fz_to_gen(pattern[i].u.pattern.obj));
+ pdf_to_num(pattern[i].pageref), pdf_to_gen(pattern[i].pageref),
+ pdf_to_num(pattern[i].u.pattern.shading), pdf_to_gen(pattern[i].u.pattern.shading),
+ pdf_to_num(pattern[i].u.pattern.obj), pdf_to_gen(pattern[i].u.pattern.obj));
}
}
printf("\n");
@@ -852,12 +852,12 @@ printinfo(char *filename, int show, int page)
{
printf(PAGE_FMT "Form%s%s%s%s (%d %d R)\n",
form[i].page,
- fz_to_num(form[i].pageref), fz_to_gen(form[i].pageref),
+ pdf_to_num(form[i].pageref), pdf_to_gen(form[i].pageref),
form[i].u.form.groupsubtype ? " " : "",
- form[i].u.form.groupsubtype ? fz_to_name(form[i].u.form.groupsubtype) : "",
+ form[i].u.form.groupsubtype ? pdf_to_name(form[i].u.form.groupsubtype) : "",
form[i].u.form.groupsubtype ? " Group" : "",
form[i].u.form.reference ? " Reference" : "",
- fz_to_num(form[i].u.form.obj), fz_to_gen(form[i].u.form.obj));
+ pdf_to_num(form[i].u.form.obj), pdf_to_gen(form[i].u.form.obj));
}
printf("\n");
}
@@ -869,8 +869,8 @@ printinfo(char *filename, int show, int page)
{
printf(PAGE_FMT "(%d %d R)\n",
psobj[i].page,
- fz_to_num(psobj[i].pageref), fz_to_gen(psobj[i].pageref),
- fz_to_num(psobj[i].u.form.obj), fz_to_gen(psobj[i].u.form.obj));
+ pdf_to_num(psobj[i].pageref), pdf_to_gen(psobj[i].pageref),
+ pdf_to_num(psobj[i].u.form.obj), pdf_to_gen(psobj[i].u.form.obj));
}
printf("\n");
}
diff --git a/apps/mupdfshow.c b/apps/mupdfshow.c
index 8dcdd17d..92fcac2d 100644
--- a/apps/mupdfshow.c
+++ b/apps/mupdfshow.c
@@ -25,7 +25,7 @@ static void showtrailer(void)
if (!doc)
fz_throw(ctx, "no file specified");
printf("trailer\n");
- fz_debug_obj(doc->trailer);
+ pdf_debug_obj(doc->trailer);
printf("\n");
}
@@ -39,7 +39,7 @@ static void showxref(void)
static void showpagetree(void)
{
- fz_obj *ref;
+ pdf_obj *ref;
int count;
int i;
@@ -50,7 +50,7 @@ static void showpagetree(void)
for (i = 0; i < count; i++)
{
ref = doc->page_refs[i];
- printf("page %d = %d %d R\n", i + 1, fz_to_num(ref), fz_to_gen(ref));
+ printf("page %d = %d %d R\n", i + 1, pdf_to_num(ref), pdf_to_gen(ref));
}
printf("\n");
}
@@ -107,7 +107,7 @@ static void showstream(int num, int gen)
static void showobject(int num, int gen)
{
- fz_obj *obj;
+ pdf_obj *obj;
if (!doc)
fz_throw(ctx, "no file specified");
@@ -123,7 +123,7 @@ static void showobject(int num, int gen)
else
{
printf("%d %d obj\n", num, gen);
- fz_debug_obj(obj);
+ pdf_debug_obj(obj);
printf("stream\n");
showstream(num, gen);
printf("endstream\n");
@@ -133,16 +133,16 @@ static void showobject(int num, int gen)
else
{
printf("%d %d obj\n", num, gen);
- fz_debug_obj(obj);
+ pdf_debug_obj(obj);
printf("endobj\n\n");
}
- fz_drop_obj(obj);
+ pdf_drop_obj(obj);
}
static void showgrep(char *filename)
{
- fz_obj *obj;
+ pdf_obj *obj;
int i;
for (i = 0; i < doc->len; i++)
@@ -159,17 +159,17 @@ static void showgrep(char *filename)
continue;
}
- fz_sort_dict(obj);
+ pdf_sort_dict(obj);
printf("%s:%d: ", filename, i);
- fz_fprint_obj(stdout, obj, 1);
+ pdf_fprint_obj(stdout, obj, 1);
- fz_drop_obj(obj);
+ pdf_drop_obj(obj);
}
}
printf("%s:trailer: ", filename);
- fz_fprint_obj(stdout, doc->trailer, 1);
+ pdf_fprint_obj(stdout, doc->trailer, 1);
}
#ifdef MUPDF_COMBINED_EXE