Copyright (C) 1989, 1995 Aladdin Enterprises. All rights reserved.
This file is part of GNU Ghostscript.
GNU Ghostscript is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to
anyone for the consequences of using it or for whether it serves any
particular purpose or works at all, unless he says so in writing. Refer
to the GNU Ghostscript General Public License for full details.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This file, language.doc, describes the relationship between the
Ghostscript interpreter and the PostScript language. This file describes
version 3.33 of Ghostscript.
For an overview of Ghostscript and a list of the documentation files, see
The Ghostscript interpreter, except as noted below, is intended to execute
properly any source program written in the (Level 2) PostScript language as
defined in the December 1990 printing of the PostScript Language Reference
Manual (Second Edition) published by Addison-Wesley (ISBN 0-201-18127-4).
However, the interpreter is configurable in ways that can restrict it to
various subsets of this language. Specifically, the base interpreter
accepts the Level 1 subset of the PostScript language, as defined in the
first edition of the PostScript Language Reference Manual, ISBN
0-201-10174-2, Addison-Wesley, 1985, plus the file system, version 25.0
language, and miscellaneous additions listed in sections A.1.6, A.1.7, and
A.1.8 of the Second Edition respectively, including allowing a string
operand for the 'status' operator. The base interpreter may be configured
by adding any combination of the following:
- The ability to process PostScript Type 1 fonts. This facility is
normally included in the interpreter.
- The CMYK color extensions listed in section A.1.4 of the Second
Edition (including colorimage). These facilities are only available if the
color, dps, or level2 feature was selected at the time that Ghostscript was
compiled and linked.
- The Display PostScript extensions listed in section A.1.3
of the Second Edition, but excluding the operators listed in section
A.1.2. These facilities are only available if the dps feature or the
level2 feature was selected at the time that Ghostscript was compiled
- The composite font extensions listed in section A.1.5 of the
Second Edition, and the ability to handle Type 0 fonts. These facilities
are only available if the compfont feature or the level2 feature was
selected at the time that Ghostscript was compiled and linked.
- The PostScript Level 2 "filter" facilities aside from DCTEncode
and DCTDecode filters. These facilities are only available if the filter,
dps, or level2 feature was selected at the time that Ghostscript was
compiled and linked.
- The PostScript Level 2 DCTEncode and DCTDecode filters. These
facilities are only available if the dct or level2 feature was selected at
the time that Ghostscript was compiled and linked.
- All the other PostScript Level 2 operators and facilities listed
in section A.1.1 of the Second Edition and not listed in any of the other
A.1.n sections. These facilities are only available if the level2 feature
was selected at the time that Ghostscript was compiled and linked.
Adding all of these produces a full Level 2 PostScript language
Ghostscript also includes a number of operators defined below that are not
in the PostScript language.
The following implementation limits correspond to those in Table B.1 and
B.2 of the Second Edition. Those marked with * are different from the ones
in the Second Edition.
integer 32-bit two's complement integer
real single-precision IEEE float
On 16-bit systems: 8191 elements
On 32-bit systems: 65535 elements
On 16-bit systems: 8190 elements
On 32-bit systems: 65534 elements
*string 65535 characters
*name 16383 characters
filename 100 characters
*save level none (capacity of memory)
*gsave level none (capacity of memory)
Typical memory limits in Level 1
*operand stack 800
dictionary stack 20
execution stack 250
*interpreter level none (capacity of memory)
*path none (capacity of memory)
*VM capacity of memory
*file determined by operating system
*image 65535 values (samples x components) for 1, 2, 4,
or 8-bit samples; 32767 values for 12-bit samples
Other differences in VM consumption
Packed array elements occupy either 2 bytes or 8 bytes. The average
element size is probably about 5 bytes.
Names occupy 12 bytes plus the space for the string.
^D and ^Z are self-delimiting tokens, like [ and ]. They are initially
defined as empty procedures so that they will be ignored in the input
run can take either a string or a file as its argument. In the latter
case, it just runs the file, closing it at the end, and trapping errors
just as for the string case.
Computes the arc cosine of a number between -1 and 1.
Computes the arc sine of a number between -1 and 1.
Encrypts fromString according to the algorithm for Adobe
Type 1 fonts, writing the result into toString.
toString must be at least as long as fromString or a
rangecheck error occurs. state is the initial state of
the encryption algorithm (a 16-bit non-negative
integer); newState is the new state of the algorithm.
Decrypts fromString according to the algorithm for Adobe
Type 1 fonts, writing the result into toString. Other
specifications are as for type1encrypt.
Returns the larger of two numbers or strings.
Returns the smaller of two numbers or strings.
Opens the file of the given name for reading, searching
through directories as described in use.doc. If the
search fails, findlibfile simply pushes false on the
stack and returns, rather than causing an error.
Pushes back the last-read character onto the front of the
file. If the file is only open for writing, or if the
integer argument is not the same as the last character
read from the file, causes an ioerror error. May also
cause an ioerror if the last operation on the file was not
a reading operation.
Writes the contents of the device, which must be an image
device, onto the file, in Portable PixMap (ppm) format.
Does not close the file.
Appends a rectangle or rectangles to the current path, in
the same manner as rectfill, rectclip, etc. Only
defined if the dps option is selected.
Ghostscript supports all the standard PostScript Level 2 filters. In
addition, Ghostscript supports the following non-standard filters:
Creates a filter for encrypting data into the
eexec encrypted format described in the
Adobe Type 1 Font Format documentation. The
seed_integer must be 55665 for proper operation.
This filter produces binary output and does not
include the initial 4 garbage bytes.
Email addresses listed
on this site may NOTbe used
for unsolicited commercial email.