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 /apps | |
parent | 6d6313687bd06e15d0d4b2a40f6c3a2c8a87b086 (diff) | |
download | mupdf-168da05a84e78b209f10da076e25a70c46985e3c.tar.xz |
Scrap samus (aborted XPS parser) completely, part 2.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/samshow.c | 188 |
1 files changed, 0 insertions, 188 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; -} - |