summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Giles <ralph.giles@artifex.com>2003-04-18 14:57:59 +0000
committerRalph Giles <ralph.giles@artifex.com>2003-04-18 14:57:59 +0000
commit64e63de21ddf561b691231ab9849796aabf29b54 (patch)
tree71fadcb20e3bb5d5a33a0b83ac43bc790a1aa1f4
parent1b2acb5bfdb86098eec2dc82a66fad28b7a4166e (diff)
Calling the gsapi polling function from the Macintosh gp_check_interruptsghostscript-8.15ghostscript-8.14ghostscript-8.13
function violates the layering of the interpreter over the graphics library. Therefore we isolate the offending code to a separate module 'macpoll.dev' in a fashion analogous to the mspoll feature dev available on the windows build. Enable this by default in the CodeWarrior build. Partial fix for Bug 686810. After a patch by Russell Lang. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@3850 a1074d23-0009-0410-80fe-cf8c14f379e6
-rw-r--r--gs/src/gp_mac.c31
-rw-r--r--gs/src/gp_macpoll.c74
-rw-r--r--gs/src/macos-mcp.mak15
3 files changed, 87 insertions, 33 deletions
diff --git a/gs/src/gp_mac.c b/gs/src/gp_mac.c
index 7023ca9d3..657f5c2bc 100644
--- a/gs/src/gp_mac.c
+++ b/gs/src/gp_mac.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989 - 1995, 2001 artofcode LLC. All rights reserved.
+/* Copyright (C) 1989 - 1995, 2001-2003 artofcode LLC. All rights reserved.
This software is provided AS-IS with no warranty, either express or
implied.
@@ -330,32 +330,3 @@ gp_getenv_display(void)
return NULL;
}
-#ifdef CHECK_INTERRUPTS
-int gp_check_interrupts(void)
-{
- static unsigned long lastYieldTicks = 0;
- int iRetVal = 0;
-
- if ((TickCount() - lastYieldTicks) > 2) {
- lastYieldTicks = TickCount();
- if (pgsdll_callback) {
- /* WARNING: The use of the old gsdll interface is deprecated.
- * The caller should use the newer gsapi_set_poll.
- * If the caller needs access to "hwndtext", it should do
- * this via caller_handle which is passed to poll_fn.
- */
- /* the hwnd parameter which is submitted in gsdll_init
- * to the DLL is returned in every gsdll_poll message
- * in the count parameter
- */
- iRetVal = (*pgsdll_callback)(GSDLL_POLL, 0, (long) hwndtext);
- }
- else {
- gs_main_instance *minst = gs_main_instance_default();
- if (minst && minst->poll_fn)
- iRetVal = (*minst->poll_fn)(minst->caller_handle);
- }
- }
- return iRetVal;
-}
-#endif
diff --git a/gs/src/gp_macpoll.c b/gs/src/gp_macpoll.c
new file mode 100644
index 000000000..b4e5ff4f6
--- /dev/null
+++ b/gs/src/gp_macpoll.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2001-2003 artofcode LLC. All rights reserved.
+
+ This software is provided AS-IS with no warranty, either express or
+ implied.
+
+ This software is distributed under license and may not be copied,
+ modified or distributed except as expressly authorized under the terms
+ of the license contained in the file LICENSE in this distribution.
+
+ For more information about licensing, please refer to
+ http://www.ghostscript.com/licensing/. For information on
+ commercial licensing, go to http://www.artifex.com/licensing/ or
+ contact Artifex Software, Inc., 101 Lucas Valley Road #110,
+ San Rafael, CA 94903, U.S.A., +1(415)492-9861.
+*/
+
+/* $Id$ */
+/*
+ * Macintosh platform polling support for Ghostscript.
+ *
+ */
+
+#ifndef __CARBON__
+#include <Timer.h>
+#else
+#include <Carbon.h>
+#endif
+
+#include "gx.h"
+#include "gp.h"
+#include "gsdll.h"
+#include "gpcheck.h"
+#include "iapi.h"
+#include "iref.h"
+#include "iminst.h"
+#include "imain.h"
+
+#ifdef CHECK_INTERRUPTS
+
+extern HWND hwndtext;
+
+/* ------ Process message loop ------ */
+/*
+ * Check messages and interrupts; return true if interrupted.
+ * This is called frequently - it must be quick!
+ */
+int gp_check_interrupts(void)
+{
+ static unsigned long lastYieldTicks = 0;
+ int iRetVal = 0;
+
+ if ((TickCount() - lastYieldTicks) > 2) {
+ lastYieldTicks = TickCount();
+ if (pgsdll_callback) {
+ /* WARNING: The use of the old gsdll interface is deprecated.
+ * The caller should use the newer gsapi_set_poll.
+ * If the caller needs access to "hwndtext", it should do
+ * this via caller_handle which is passed to poll_fn.
+ */
+ /* the hwnd parameter which is submitted in gsdll_init
+ * to the DLL is returned in every gsdll_poll message
+ * in the count parameter
+ */
+ iRetVal = (*pgsdll_callback)(GSDLL_POLL, 0, (long) hwndtext);
+ }
+ else {
+ gs_main_instance *minst = gs_main_instance_default();
+ if (minst && minst->poll_fn)
+ iRetVal = (*minst->poll_fn)(minst->caller_handle);
+ }
+ }
+ return iRetVal;
+}
+#endif
diff --git a/gs/src/macos-mcp.mak b/gs/src/macos-mcp.mak
index 5b4809081..9228318ca 100644
--- a/gs/src/macos-mcp.mak
+++ b/gs/src/macos-mcp.mak
@@ -1,4 +1,4 @@
-# Copyright (C) 1997-2002 artofcode LLC. All rights reserved.
+# Copyright (C) 1997-2003 artofcode LLC. All rights reserved.
#
# This software is provided AS-IS with no warranty, either express or
# implied.
@@ -172,11 +172,11 @@ SYNC=nosync
# Choose the language feature(s) to include. See gs.mak for details.
-FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(GLD)pipe.dev $(PSD)jbig2.dev
+FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(GLD)pipe.dev $(PSD)jbig2.dev $(PSD)macpoll.dev
#FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev
#FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)rasterop.dev $(GLD)pipe.dev
# The following is strictly for testing.
-FEATURE_DEVS_ALL=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)rasterop.dev $(PSD)double.dev $(PSD)trapping.dev $(PSD)stocht.dev $(GLD)pipe.dev $(GLD)macres.dev $(PSD)jbig2.dev
+FEATURE_DEVS_ALL=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)rasterop.dev $(PSD)double.dev $(PSD)trapping.dev $(PSD)stocht.dev $(GLD)pipe.dev $(GLD)macres.dev $(PSD)jbig2.dev $(PSD)macpoll.dev
#FEATURE_DEVS=$(FEATURE_DEVS_ALL)
# Choose whether to compile the .ps initialization files into the executable.
@@ -353,6 +353,15 @@ $(GLD)macos_.dev: $(MAC1)
$(ADDMOD) $(DD)macos_ -obj $(MAC2)
$(ADDMOD) $(DD)macos_ -iodev macstdio # stdout does not work with MSL!!!
+# Define polling as a separable feature because it is not needed by the gslib.
+macpoll_=$(GLOBJ)gp_macpoll.$(OBJ)
+$(GLD)macpoll.dev: $(ECHOGS_XE) $(macpoll_)
+ $(SETMOD) $(GLD)macpoll $(macpoll_)
+
+$(GLOBJ)gp_macpoll.$(OBJ): $(GLSRC)gp_macpoll.c $(AK)\
+ $(gx_h) $(gp_h) $(gpcheck_h) $(iapi_h) $(iref_h) $(iminst_h) $(imain_h)
+
+
# ------------------------------------------------------------------- #
# -------------------------- Auxiliary files ------------------------ #