summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-01-03 16:37:48 +0000
committerRobin Watts <robin.watts@artifex.com>2012-01-03 18:42:23 +0000
commit94439d77f23763d59457b9946ba35bd354ea4841 (patch)
treecf957fe1465b49c530882a0c5f8cb56f1e7f4963 /apps
parenta842269cb43fcb5f1d0bdd594d8d0839a7dcbdf7 (diff)
downloadmupdf-94439d77f23763d59457b9946ba35bd354ea4841.tar.xz
Add mubusy build
Add simple combined exe build for mupdf/muxps tools.
Diffstat (limited to 'apps')
-rw-r--r--apps/mubusy.c54
-rw-r--r--apps/mubusy_pdfclean.c2
-rw-r--r--apps/mubusy_pdfdraw.c2
-rw-r--r--apps/mubusy_pdfextract.c2
-rw-r--r--apps/mubusy_pdfinfo.c2
-rw-r--r--apps/mubusy_pdfshow.c2
-rw-r--r--apps/mubusy_xpsdraw.c2
-rw-r--r--apps/pdfclean.c4
-rw-r--r--apps/pdfdraw.c44
-rw-r--r--apps/pdfextract.c4
-rw-r--r--apps/pdfinfo.c4
-rw-r--r--apps/pdfshow.c4
-rw-r--r--apps/xpsdraw.c4
13 files changed, 110 insertions, 20 deletions
diff --git a/apps/mubusy.c b/apps/mubusy.c
new file mode 100644
index 00000000..8e215959
--- /dev/null
+++ b/apps/mubusy.c
@@ -0,0 +1,54 @@
+/*
+ * pdfbusy -- combined exe build
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int pdfclean_main(int argc, char *argv[]);
+int pdfdraw_main(int argc, char *argv[]);
+int pdfextract_main(int argc, char *argv[]);
+int pdfinfo_main(int argc, char *argv[]);
+int pdfshow_main(int argc, char *argv[]);
+int xpsdraw_main(int argc, char *argv[]);
+
+static int
+namematch(const char *end, const char *start, const char *match, int len)
+{
+ return ((end-len >= start) && (strncmp(end-len, match, len) == 0));
+}
+
+int main(int argc, char **argv)
+{
+ char *start, *end;
+ if (argc == 0)
+ {
+ fprintf(stderr, "No command name found!\n");
+ exit(EXIT_FAILURE);
+ }
+
+ end = start = argv[0];
+ while (*end)
+ end++;
+ if ((end-4 >= start) && (end[-4] == '.') && (end[-3] == 'e') && (end[-2] == 'x') && (end[-1] == 'e'))
+ end = end-4;
+ if (namematch(end, start, "pdfdraw", 7))
+ return pdfdraw_main(argc, argv);
+ if (namematch(end, start, "pdfclean", 8))
+ return pdfclean_main(argc, argv);
+ if (namematch(end, start, "pdfextract", 10))
+ return pdfextract_main(argc, argv);
+ if (namematch(end, start, "pdfshow", 7))
+ return pdfshow_main(argc, argv);
+ if (namematch(end, start, "pdfinfo", 7))
+ return pdfinfo_main(argc, argv);
+ if (namematch(end, start, "xpsdraw", 7))
+ return xpsdraw_main(argc, argv);
+
+ fprintf(stderr, "mubusy: Combined build of mupdf/muxps tools.\n\n");
+ fprintf(stderr, "Invoke as one of the following:\n");
+ fprintf(stderr, "\tpdfclean, pdfdraw, pdfextract, pdfinfo, pdfshow, xpsdraw.\n");
+
+ return 0;
+}
diff --git a/apps/mubusy_pdfclean.c b/apps/mubusy_pdfclean.c
new file mode 100644
index 00000000..225f30c8
--- /dev/null
+++ b/apps/mubusy_pdfclean.c
@@ -0,0 +1,2 @@
+#define MUPDF_COMBINED_EXE
+#include "pdfclean.c"
diff --git a/apps/mubusy_pdfdraw.c b/apps/mubusy_pdfdraw.c
new file mode 100644
index 00000000..638b0206
--- /dev/null
+++ b/apps/mubusy_pdfdraw.c
@@ -0,0 +1,2 @@
+#define MUPDF_COMBINED_EXE
+#include "pdfdraw.c"
diff --git a/apps/mubusy_pdfextract.c b/apps/mubusy_pdfextract.c
new file mode 100644
index 00000000..aa07f78f
--- /dev/null
+++ b/apps/mubusy_pdfextract.c
@@ -0,0 +1,2 @@
+#define MUPDF_COMBINED_EXE
+#include "pdfextract.c"
diff --git a/apps/mubusy_pdfinfo.c b/apps/mubusy_pdfinfo.c
new file mode 100644
index 00000000..0c9eaa97
--- /dev/null
+++ b/apps/mubusy_pdfinfo.c
@@ -0,0 +1,2 @@
+#define MUPDF_COMBINED_EXE
+#include "pdfinfo.c"
diff --git a/apps/mubusy_pdfshow.c b/apps/mubusy_pdfshow.c
new file mode 100644
index 00000000..e1a6d573
--- /dev/null
+++ b/apps/mubusy_pdfshow.c
@@ -0,0 +1,2 @@
+#define MUPDF_COMBINED_EXE
+#include "pdfshow.c"
diff --git a/apps/mubusy_xpsdraw.c b/apps/mubusy_xpsdraw.c
new file mode 100644
index 00000000..76a3f7df
--- /dev/null
+++ b/apps/mubusy_xpsdraw.c
@@ -0,0 +1,2 @@
+#define MUPDF_COMBINED_EXE
+#include "xpsdraw.c"
diff --git a/apps/pdfclean.c b/apps/pdfclean.c
index 37381306..dba60734 100644
--- a/apps/pdfclean.c
+++ b/apps/pdfclean.c
@@ -730,7 +730,11 @@ static void writepdf(void)
writexref();
}
+#ifdef MUPDF_COMBINED_EXE
+int pdfclean_main(int argc, char **argv)
+#else
int main(int argc, char **argv)
+#endif
{
char *infile;
char *outfile = "out.pdf";
diff --git a/apps/pdfdraw.c b/apps/pdfdraw.c
index 3d11729e..6b2923c1 100644
--- a/apps/pdfdraw.c
+++ b/apps/pdfdraw.c
@@ -11,26 +11,26 @@
#include <sys/time.h>
#endif
-char *output = NULL;
-float resolution = 72;
-float rotation = 0;
-
-int showxml = 0;
-int showtext = 0;
-int showtime = 0;
-int showmd5 = 0;
-int showoutline = 0;
-int savealpha = 0;
-int uselist = 1;
-int alphabits = 8;
-float gamma_value = 1;
-int invert = 0;
-
-fz_colorspace *colorspace;
-fz_glyph_cache *glyphcache;
-char *filename;
-
-struct {
+static char *output = NULL;
+static float resolution = 72;
+static float rotation = 0;
+
+static int showxml = 0;
+static int showtext = 0;
+static int showtime = 0;
+static int showmd5 = 0;
+static int showoutline = 0;
+static int savealpha = 0;
+static int uselist = 1;
+static int alphabits = 8;
+static float gamma_value = 1;
+static int invert = 0;
+
+static fz_colorspace *colorspace;
+static fz_glyph_cache *glyphcache;
+static char *filename;
+
+static struct {
int count, total;
int min, max;
int minpage, maxpage;
@@ -358,7 +358,11 @@ static void drawoutline(pdf_xref *xref)
fz_free_outline(outline);
}
+#ifdef MUPDF_COMBINED_EXE
+int pdfdraw_main(int argc, char **argv)
+#else
int main(int argc, char **argv)
+#endif
{
char *password = "";
int grayscale = 0;
diff --git a/apps/pdfextract.c b/apps/pdfextract.c
index 5b1fca0b..486090e0 100644
--- a/apps/pdfextract.c
+++ b/apps/pdfextract.c
@@ -157,7 +157,11 @@ static void showobject(int num)
fz_drop_obj(obj);
}
+#ifdef MUPDF_COMBINED_EXE
+int pdfextract_main(int argc, char **argv)
+#else
int main(int argc, char **argv)
+#endif
{
char *infile;
char *password = "";
diff --git a/apps/pdfinfo.c b/apps/pdfinfo.c
index 4dfbd461..049e4617 100644
--- a/apps/pdfinfo.c
+++ b/apps/pdfinfo.c
@@ -939,7 +939,11 @@ showinfo(char *filename, int show, char *pagelist)
printinfo(filename, show, -1);
}
+#ifdef MUPDF_COMBINED_EXE
+int pdfinfo_main(int argc, char **argv)
+#else
int main(int argc, char **argv)
+#endif
{
enum { NO_FILE_OPENED, NO_INFO_GATHERED, INFO_SHOWN } state;
char *filename = "";
diff --git a/apps/pdfshow.c b/apps/pdfshow.c
index 3f142264..86743de3 100644
--- a/apps/pdfshow.c
+++ b/apps/pdfshow.c
@@ -167,7 +167,11 @@ static void showgrep(char *filename)
fz_fprint_obj(stdout, xref->trailer, 1);
}
+#ifdef MUPDF_COMBINED_EXE
+int pdfshow_main(int argc, char **argv)
+#else
int main(int argc, char **argv)
+#endif
{
char *password = NULL; /* don't throw errors if encrypted */
char *filename;
diff --git a/apps/xpsdraw.c b/apps/xpsdraw.c
index f8828f7e..ced38357 100644
--- a/apps/xpsdraw.c
+++ b/apps/xpsdraw.c
@@ -276,7 +276,11 @@ static void drawoutline(xps_document *doc)
fz_free_outline(outline);
}
+#ifdef MUPDF_COMBINED_EXE
+int xpsdraw_main(int argc, char **argv)
+#else
int main(int argc, char **argv)
+#endif
{
int grayscale = 0;
int accelerate = 1;