[gs-cvs] rev 8338 - in trunk/gs: doc lib src
giles at ghostscript.com
giles at ghostscript.com
Wed Oct 31 10:00:57 PDT 2007
Author: giles
Date: 2007-10-31 10:00:55 -0700 (Wed, 31 Oct 2007)
New Revision: 8338
Modified:
trunk/gs/doc/Language.htm
trunk/gs/lib/gs_init.ps
trunk/gs/src/zdevice.c
Log:
Add Postcript bindings to gs_getdefaultdevice() and use them to set the
default device in the interpreter. Bug 689273.
Modified: trunk/gs/doc/Language.htm
===================================================================
--- trunk/gs/doc/Language.htm 2007-10-31 17:00:51 UTC (rev 8337)
+++ trunk/gs/doc/Language.htm 2007-10-31 17:00:55 UTC (rev 8338)
@@ -1401,14 +1401,22 @@
<dl>
<dt><b><tt><index> .getdevice <device></tt></b>
<dd>Returns a device from the set of devices known to the system. The
-first device, which is the default, is numbered 0. If the
-<b><tt>index</tt></b> is out of range, causes a <b><tt>rangecheck</tt></b>
-error. This device is actually a prototype, not a directly usable device,
+first device is numbered 0. If the <b><tt>index</tt></b> is out of
+range, a <b><tt>rangecheck</tt></b> error occurs.
+This device is actually a prototype, not a directly usable device,
and is marked read-only; it cannot have its parameters changed or be
installed as the current device.
</dl>
<dl>
+<dt><b><tt>- .getdefaultdevice <device></tt></b>
+<dd>Returns the default device. This device is actually a prototype,
+and is marked read-only; it cannot have its parameters changed or
+be installed as the current device.
+Use <tt><b>copydevice</b></tt> to obtain a workable device.
+</dl>
+
+<dl>
<dt><b><tt><matrix> <width> <height> <palette> makeimagedevice <device></tt></b>
<dd>Makes a new device that accumulates an image in memory. <b><tt>
matrix</tt></b> is the initial transformation matrix: it must be orthogonal
Modified: trunk/gs/lib/gs_init.ps
===================================================================
--- trunk/gs/lib/gs_init.ps 2007-10-31 17:00:51 UTC (rev 8337)
+++ trunk/gs/lib/gs_init.ps 2007-10-31 17:00:55 UTC (rev 8338)
@@ -1284,7 +1284,7 @@
}
if
}
- { 0 .getdevice .devicename
+ { .getdefaultdevice .devicename
}
ifelse
}
Modified: trunk/gs/src/zdevice.c
===================================================================
--- trunk/gs/src/zdevice.c 2007-10-31 17:00:51 UTC (rev 8337)
+++ trunk/gs/src/zdevice.c 2007-10-31 17:00:55 UTC (rev 8338)
@@ -207,6 +207,22 @@
return 0;
}
+/* - .getdefaultdevice <device> */
+static int
+zgetdefaultdevice(i_ctx_t *i_ctx_p)
+{
+ os_ptr op = osp;
+ const gx_device *dev;
+
+ dev = gs_getdefaultdevice();
+ if (dev == 0) /* couldn't find a default device */
+ return_error(e_unknownerror);
+ push(1);
+ make_tav(op, t_device, avm_foreign | a_readonly, pdevice,
+ (gx_device *) dev);
+ return 0;
+}
+
/* Common functionality of zgethardwareparms & zgetdeviceparams */
static int
zget_device_params(i_ctx_t *i_ctx_p, bool is_hardware)
@@ -460,6 +476,7 @@
{"0flushpage", zflushpage},
{"7.getbitsrect", zgetbitsrect},
{"1.getdevice", zgetdevice},
+ {"1.getdefaultdevice", zgetdefaultdevice},
{"2.getdeviceparams", zgetdeviceparams},
{"2.gethardwareparams", zgethardwareparams},
{"5makewordimagedevice", zmakewordimagedevice},
More information about the gs-cvs
mailing list