diff options
author | Tor Andersson <tor@ghostscript.com> | 2008-03-17 19:26:44 +0100 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2008-03-17 19:26:44 +0100 |
commit | 168da05a84e78b209f10da076e25a70c46985e3c (patch) | |
tree | 71165b7780863df9696bbd41bb0a0a8fc883c4e2 | |
parent | 6d6313687bd06e15d0d4b2a40f6c3a2c8a87b086 (diff) | |
download | mupdf-168da05a84e78b209f10da076e25a70c46985e3c.tar.xz |
Scrap samus (aborted XPS parser) completely, part 2.
-rw-r--r-- | apps/samshow.c | 188 | ||||
-rw-r--r-- | include/samus.h | 25 | ||||
-rw-r--r-- | include/samus/fixdoc.h | 13 | ||||
-rw-r--r-- | include/samus/misc.h | 7 | ||||
-rw-r--r-- | include/samus/names.h | 96 | ||||
-rw-r--r-- | include/samus/pack.h | 28 | ||||
-rw-r--r-- | include/samus/xml.h | 20 | ||||
-rw-r--r-- | include/samus/zip.h | 12 |
8 files changed, 0 insertions, 389 deletions
diff --git a/apps/samshow.c b/apps/samshow.c deleted file mode 100644 index 770be25e..00000000 --- a/apps/samshow.c +++ /dev/null @@ -1,188 +0,0 @@ -#include "fitz.h" -#include "samus.h" - -void die(fz_error *eo) -{ - fflush(stdout); - fprintf(stderr, "%s:%d: %s(): %s\n", eo->file, eo->line, eo->func, eo->msg); - fflush(stderr); - abort(); -} - -void showfixdocseq(sa_package *pack, char *part) -{ - fz_error *error; - sa_fixdocseq *seq; - - error = sa_loadfixdocseq(&seq, pack, part); - if (error) - die(error); - - sa_debugfixdocseq(seq); - - sa_dropfixdocseq(seq); -} - -void showreach(sa_package *pack, sa_relation *rels) -{ - while (rels) - { - if (!strcmp(rels->type, SA_REL_FIXEDREPRESENTATION)) - { - if (!rels->external) - showfixdocseq(pack, rels->target); - } - rels = rels->next; - } -} - -int runpack(int argc, char **argv) -{ - fz_error *error; - sa_package *pack; - sa_relation *rels; - char *s; - int i; - - error = sa_openpackage(&pack, argv[1]); - if (error) - die(error); - - sa_debugpackage(pack); - printf("\n"); - - error = sa_loadrelations(&rels, pack, "/"); - if (error) - die(error); - sa_debugrelations(rels); - printf("\n"); - - if (argc == 2) - { - showreach(pack, rels); - return 0; - } - - for (i = 2; i < argc; i++) - { - printf("part %s\n", argv[i]); - - s = sa_typepart(pack, argv[i]); - if (!s) - printf("has no type!\n"); - else - printf("type %s\n", s); - - error = sa_loadrelations(&rels, pack, argv[i]); - if (error) - die(error); - sa_debugrelations(rels); - sa_droprelations(rels); - - printf("\n"); - } - - sa_closepackage(pack); - - return 0; -} - -int runzip(int argc, char **argv) -{ - fz_error *error; - fz_buffer *buf; - fz_stream *stm; - sa_zip *zip; - int i, n; - - error = sa_openzip(&zip, argv[1]); - if (error) - die(error); - - if (argc == 2) - sa_debugzip(zip); - - for (i = 2; i < argc; i++) - { - error = sa_openzipentry(&stm, zip, argv[i]); - if (error) - die(error); - n = fz_readall(&buf, stm); - if (n < 0) - die(fz_ioerror(stm)); - fz_dropstream(stm); - - fwrite(buf->rp, 1, buf->wp - buf->rp, stdout); - - fz_dropbuffer(buf); - } - - sa_closezip(zip); - - return 0; -} - -int runxml(int argc, char **argv) -{ - fz_error *error; - fz_stream *file; - sa_xmlparser *parser; - sa_xmlitem *item; - - error = fz_openrfile(&file, argv[1]); - if (error) - die(error); - - error = sa_openxml(&parser, file, 0); - if (error) - die(error); - - item = sa_xmlnext(parser); - if (item) - sa_debugxml(item, 0); - - sa_closexml(parser); - fz_dropstream(file); - - return 0; -} - -extern fz_error *sa_readtiff(fz_stream *); - -int runtiff(int argc, char **argv) -{ - fz_error *error; - fz_stream *file; - - error = fz_openrfile(&file, argv[1]); - if (error) - die(error); - - error = sa_readtiff(file); - if (error) - die(error); - - fz_dropstream(file); - - return 0; -} - -int main(int argc, char **argv) -{ - if (argc >= 2) - { - if (strstr(argv[1], "zip")) - return runzip(argc, argv); - if (strstr(argv[1], "xml")) - return runxml(argc, argv); - if (strstr(argv[1], "tif")) - return runtiff(argc, argv); - return runpack(argc, argv); - } - - fprintf(stderr, "usage: samshow <file>\n"); - fprintf(stderr, "usage: samshow <zipfile> <partname>\n"); - fprintf(stderr, "usage: samshow <package> <partname>\n"); - return 1; -} - diff --git a/include/samus.h b/include/samus.h deleted file mode 100644 index a7b39482..00000000 --- a/include/samus.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifdef _SAMUS_H_ -#error "samus.h must only be included once" -#endif -#define _SAMUS_H_ - -#ifndef _FITZ_BASE_H_ -#error "fitz-base.h must be included before mupdf.h" -#endif - -#ifndef _FITZ_STREAM_H_ -#error "fitz-stream.h must be included before mupdf.h" -#endif - -#ifndef _FITZ_WORLD_H_ -#error "fitz-world.h must be included before mupdf.h" -#endif - -#include "samus/misc.h" -#include "samus/zip.h" -#include "samus/xml.h" -#include "samus/pack.h" - -#include "samus/names.h" -#include "samus/fixdoc.h" - diff --git a/include/samus/fixdoc.h b/include/samus/fixdoc.h deleted file mode 100644 index 1b0caad1..00000000 --- a/include/samus/fixdoc.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * FixedDocumentSequence -- the list of pages - */ - -typedef struct sa_fixdocseq_s sa_fixdocseq; - -fz_error *sa_loadfixdocseq(sa_fixdocseq **seqp, sa_package *pack, char *part); -void sa_debugfixdocseq(sa_fixdocseq *seq); -void sa_dropfixdocseq(sa_fixdocseq *seq); - -int sa_getpagecount(sa_fixdocseq *seq); -char *sa_getpagepart(sa_fixdocseq *seq, int idx); - diff --git a/include/samus/misc.h b/include/samus/misc.h deleted file mode 100644 index 50170a04..00000000 --- a/include/samus/misc.h +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Misc utility functions that Samus needs. - */ - -char *sa_resolvepath(char *dst, char *base, char *part, int dstlen); -int sa_strcmp(char *s0, char *s1); - diff --git a/include/samus/names.h b/include/samus/names.h deleted file mode 100644 index 03a0e505..00000000 --- a/include/samus/names.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Various long string constants - */ - -/* - * XML Namespaces - */ - -#define SA_NS_CONTENTTYPES \ - "http://schemas.microsoft.com/metro/2005/02/content-types" -#define SA_NS_COREPROPERTIES \ - "http://schemas.microsoft.com/metro/2005/02/md/core-properties" -#define SA_NS_SIGNATURES \ - "http://schemas.microsoft.com/metro/2005/02/digsig" -#define SA_NS_RELATIONSHIPS \ - "http://schemas.microsoft.com/metro/2005/02/relationships" -#define SA_NS_VERSIONING \ - "http://schemas.microsoft.com/winfx/markup-compatibility/2005" - -#define SA_NS_DISCARDCONTROL \ - "http://schemas.microsoft.com/metro/2005/02/rp/discard-control" -#define SA_NS_FIXEDDOCUMENT \ - "http://schemas.microsoft.com/metro/2005/02/rp" -#define SA_NS_FIXEDDOCUMENTSEQUENCE \ - "http://schemas.microsoft.com/metro/2005/02/rp" -#define SA_NS_FIXEDPAGE \ - "http://schemas.microsoft.com/metro/2005/02/rp" -#define SA_NS_PRINTSCHEMAFRAMEWORK \ - "http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework" -#define SA_NS_PRINTSCHEMAKEYWORDS \ - "http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords" -#define SA_NS_RESOURCEDICTIONARY \ - "http://schemas.microsoft.com/metro/2005/02/rp/resourcedictionary-key" - -/* - * Content types - */ - -#define SA_TYPE_COREPROPERTIES \ - "application/vnd.ms-metro.core-properties+xml" -#define SA_TYPE_CERTIFICATE \ - "application/vnd.ms-metro.ds-certificate" -#define SA_TYPE_ORIGIN \ - "application/vnd.ms-metro.ds-origin" -#define SA_TYPE_SIGNATURE \ - "application/vnd.ms-metro.ds-xmlsignature+xml" -#define SA_TYPE_RELATIONSHIPS \ - "application/vnd.ms-metro.relationships+xml" - -#define SA_TYPE_FIXEDDOCUMENT \ - "application/vnd.ms-metro.rp-fixeddocument+xml" -#define SA_TYPE_FIXEDDOCUMENTSEQUENCE \ - "application/vnd.ms-metro.rp-fixeddocumentsequence+xml" -#define SA_TYPE_FIXEDPAGE \ - "application/vnd.ms-metro.rp-fixedpage+xml" -#define SA_TYPE_FONT \ - "application/vnd.ms-opentype" -#define SA_TYPE_OBFUSCATEDFONT \ - "application/vnd.ms-metro.obfuscated-opentype" -#define SA_TYPE_PRINTTICKET \ - "application/vnd.ms-printing.printticket+xml" -#define SA_TYPE_JPEGIMAGE \ - "image/jpeg" -#define SA_TYPE_PNGIMAGE \ - "image/png" -#define SA_TYPE_TIFFIMAGE \ - "image/tiff" - -/* - * Relationship types - */ - -#define SA_REL_COREPROPERTIES \ - "http://schemas.microsoft.com/metro/2005/02/md/core-properties" -#define SA_REL_SIGNATURE \ - "http://schemas.microsoft.com/metro/2005/02/ds/signature" -#define SA_REL_CERTIFICATE \ - "http://schemas.microsoft.com/metro/2005/02/ds/certificate" -#define SA_REL_ORIGIN \ - "http://schemas.microsoft.com/metro/2005/02/ds/origin" -#define SA_REL_THUMBNAIL \ - "http://schemas.microsoft.com/metro/2005/02/md/thumbnail" - -#define SA_REL_ANNOTATIONS \ - "http://schemas.microsoft.com/metro/2005/02/rp/annotations" -#define SA_REL_DISCARDCONTROL \ - "http://schemas.microsoft.com/metro/2005/02/rp/discard-control" -#define SA_REL_PRINTTICKET \ - "http://schemas.microsoft.com/metro/2005/02/rp/printticket" -#define SA_REL_FIXEDREPRESENTATION \ - "http://schemas.microsoft.com/metro/2005/02/rp/fixedrepresentation" -#define SA_REL_REQUIREDRESOURCE \ - "http://schemas.microsoft.com/metro/2005/02/rp/required-resource" -#define SA_REL_RESTRICTEDFONT \ - "http://schemas.microsoft.com/metro/2005/02/rp/restricted-font" - diff --git a/include/samus/pack.h b/include/samus/pack.h deleted file mode 100644 index cdacc217..00000000 --- a/include/samus/pack.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Metro Package and Parts - */ - -typedef struct sa_package_s sa_package; -typedef struct sa_relation_s sa_relation; - -struct sa_relation_s -{ - int external; - char *target; - char *id; - char *type; - sa_relation *next; -}; - -fz_error *sa_openpackage(sa_package **packp, char *filename); -void sa_debugpackage(sa_package *pack); -void sa_closepackage(sa_package *pack); - -fz_error *sa_openpart(fz_stream **stmp, sa_package *pack, char *partname); - -char *sa_typepart(sa_package *pack, char *partname); - -fz_error *sa_loadrelations(sa_relation **relsp, sa_package *pack, char *partname); -void sa_debugrelations(sa_relation *rels); -void sa_droprelations(sa_relation *rels); - diff --git a/include/samus/xml.h b/include/samus/xml.h deleted file mode 100644 index b72fbe56..00000000 --- a/include/samus/xml.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * A simple XML parsing API based on Inferno's. - * Under the surface this one uses expat and in-memory objects, - * but that should not be visible through the API. - */ - -typedef struct sa_xmlparser_s sa_xmlparser; -typedef struct sa_xmlitem_s sa_xmlitem; - -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); - -sa_xmlitem *sa_xmlnext(sa_xmlparser *sp); -void sa_xmldown(sa_xmlparser *sp); -void sa_xmlup(sa_xmlparser *sp); - -char *sa_xmlname(sa_xmlitem *item); -char *sa_xmlatt(sa_xmlitem *item, char *att); - diff --git a/include/samus/zip.h b/include/samus/zip.h deleted file mode 100644 index e06e1e90..00000000 --- a/include/samus/zip.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * ZIP archive - */ - -typedef struct sa_zip_s sa_zip; - -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(fz_stream **stmp, sa_zip *zip, char *name); - |