summaryrefslogtreecommitdiff
path: root/source/gprf
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-09-16 19:32:47 +0100
committerRobin Watts <robin.watts@artifex.com>2016-09-16 19:35:30 +0100
commit514508fcac199d8c33ffdb6e46b54ea39a706d9c (patch)
treec6e5fa7ca2109abaf5faae01ee942b5ad17abe21 /source/gprf
parentdc05813dccf6b76b1c052c6be197abfc6a63bc1b (diff)
downloadmupdf-514508fcac199d8c33ffdb6e46b54ea39a706d9c.tar.xz
More tweaking of gproof device gs invocation.
If USE_GS_API is defined, we use the gsapi interface to call gs. The gsapi interface is defined in iapi.h, which is not included in the mupdf source code. We therefore include a potted version of this API inline. To use the original, pass HAVE_IAPI_H at compile time.
Diffstat (limited to 'source/gprf')
-rw-r--r--source/gprf/gprf-doc.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/source/gprf/gprf-doc.c b/source/gprf/gprf-doc.c
index 259153e3..ccf5dbf9 100644
--- a/source/gprf/gprf-doc.c
+++ b/source/gprf/gprf-doc.c
@@ -10,25 +10,37 @@
#define GS_API_NULL_STDIO
#endif
-/* Avoid having to #include the gs api */
-#ifdef USE_GS_API
-extern int gsapi_new_instance(void **, void *);
-extern int gsapi_init_with_args(void *, int, char *argv[]);
-extern void gsapi_delete_instance(void *);
-#ifdef GS_API_NULL_STDIO
-extern int gsapi_set_stdio(void *, int (*)(void *, char *, int), int (*)(void *, const char *, int), int (*)(void *, const char *, int));
-#endif
-#endif
-
#include "mupdf/fitz.h"
-#if defined(USE_GS_API) && !defined(__ANDROID__)
-#ifdef _MSC_VER
+
+#if defined(USE_GS_API)
+
+/* We are assumed to be using the DLL here */
#define GSDLLEXPORT
-#define GSDLLAPI __stdcall
#define GSDLLCALL
+#ifdef _MSC_VER
+#define GSDLLAPI __stdcall
+#else
+#define GSDLLAPI
#endif
+
+/*
+ We can either rely on the official iapi.h from ghostscript
+ (which is not supplied in the MuPDF source), or we can use
+ a potted version of it inline here (which suffices for
+ android, but has not been verified on all platforms).
+*/
+#if HAVE_IAPI_H
#include "iapi.h"
-#endif
+#else
+/* Avoid having to #include the gs api */
+extern GSDLLEXPORT int GSDLLAPI gsapi_new_instance(void **, void *);
+extern GSDLLEXPORT int GSDLLAPI gsapi_init_with_args(void *, int, char *argv[]);
+extern GSDLLEXPORT void GSDLLAPI gsapi_delete_instance(void *);
+#ifdef GS_API_NULL_STDIO
+extern GSDLLEXPORT int GSDLLAPI gsapi_set_stdio(void *, int (GSDLLCALL *)(void *, char *, int), int (GSDLLCALL *)(void *, const char *, int), int (GSDLLCALL *)(void *, const char *, int));
+#endif /* GS_API_NULL_STDIO */
+#endif /* HAVE_IAPI_H */
+#endif /* USE_GS_API */
typedef struct gprf_document_s gprf_document;
typedef struct gprf_chapter_s gprf_chapter;