Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

POSTSCRIPT(1)  —  USER COMMANDS

NAME

postscript − PostScript interpreter

SYNOPSIS

PS [ -isc - ] files . . . 
postscript [ -isc - ] files . . .
viewer

DESCRIPTION

PS is an interpreter for the PostScript language.  The language is intended for driving laser printers, but this implementation is for previewing graphics on a suitable device or for more general programming. 

The implementation conforms to the PostScript Language Manual as closely as possible. 

Postscript is a version of the interpreter which will talk through a pair of pipes to a viewer program, possibly running on a different machine. 

Postscript looks for the environment variable the name of a two-way device or a command with a vertical bar at the front.  This is “|viewer” by default, and may be something like “|rsh workstation viewer”.  Postscript may be run on a compute server with no display, and viewer on a workstation. 

To create a window of A4 size, the A4 command may be used.  If this is specified on the command line (e.g. “PS -c A4”), postscript will not bother to read its standard input unless told to do so with “-”. 

INVOCATION

When postscript starts up it performs the following actions:

It reads a number of definitions from a standard library file.  This file is psrc in the directory given as the environment variable POSTSCRIPTLIB (defaults to /usr/lib/postscript). This contains definitions which are part of the PostScript language and can be defined in PostScript. In particular, it reads a procedure called executive which is the top level interpreter used when postscript is running interactively. 

Next it reads a file called .postscript from the users HOME directory.  This may contain any useful startup routines that are always wanted. 

Next any arguments are processed off the command line.  These can be a mixture of options and files, and are executed in order.  The options are as follows:

-cCauses the next argument to be treated as an executable postscript string. 

-iCauses postscript to behave as if its standard input is a terminal, even if it isn’t.  This involves executing the executive definition from the library.  If this is absent and the standard input is not a terminal and there are no files or -c options on the command line, the standard input will be treated as an ordinary file. 

-sCauses the standard input to be read, even if there are files or commands on the command line. 

-Same as -s. 

CACHING

This implementation does caching of fonts to disk.  Once a font has been selected and used, savecurrentfont may be used (without any arguments) to save the current font into the disk cache.  It saves only those glyphs which have been cached so far, and will fail if the cache directory does not contain sub-directories matching the relevant files in the font directory. 

Loading from the disk cache is automatic - the system is tolerant about absent cached fonts, and simply reads the whole font specification instead.  The intention is that the system should be lazy, so that it doesn’t do work unnecessarily. 

FONT MAPPING

Most installations will have a number of fonts which they may wish to use.  Most files will contain font names such as “Times-Roman” which are inconvenient to change.  thus contains a dictionary in which name pairs can be placed.  This dictionary called FontMap is searched when a font is chosen and the font name is replaced by the value associated with its dictionary entry if one is present; otherwise the name is not changed.  The reason for this is that a previewer gives only an approximation, so it is sometimes useful to use differing fonts, even if the widths are slightly wrong. 

Also, during startup, a file called font-map in the library gets run.  This is assumed to contain default mappings, and may typically be empty. 

NEW OPERATORS

A number of non-standard operators have been added to this version of the interpreter. 

savecurrentfont has been described already. 

setstrokemethod and currentstrokemethod allow thin strokes to be done with line drawing rather than the area fill used for other lines.  The option is an integer.  0 turns off this feature, 1 turns it on and is the default. 

A4 and A5 generate new windows of the suggested sizes.  The old window is deleted unless it is being held in a gsave context. 

ASSUMPTIONS

There are a number of Assumptions that have been made in the absence of more specific documentation. 

That Integer and Real values are only equivalent mathematically, and are normally distinct except where specified in the manual.  The manual requires equivalence in the following places:

The arguments of the arithmetic and mathematical operators. 

The arguments of the relational operators (including eq and ne). 

In particular integers and reals are distinguished as dictionary keys. 

That cvrs is not expected to convert reals to any base. 

That the output from == and pstack can look however we want them to. 

That %stdout and %stderr should not ever be closed - the manual is specific about %stdin, but not the other two. 

That stop can exit a run context. 

That flushfile should close an input stream.  Read will close its file if it reads nothing, but the manual doesn’t say whether other operators should.  It is assumed so. 

That access restrictions on files are implemented using the access restrictions on objects. 

FILES

~/.postscript − profile command source
$POSTSCRIPTLIB/psrc − library of postscript material. $POSTSCRIPTLIB/font-map − library of postscript material.

The POSTSCRIPTLIB directory may contain:

psrcThe POSTSCRIPT initialisation library. 

fonta directory containing font headers, which are executable POSTSCRIPT describing how to load fonts. 

fontsa directory containing font information. 

font-map
a file containing default font name mappings.

cachea directory containing a corresponding set of cached fonts. 

SEE ALSO

The PostScript Language Manual, Adobe Systems Incorporated, 1984. 

AUTHOR

Crispin Goswell.  Tony Williams provided important guidance. 

BUGS

No “virtual memory” − dummy operators which do a gsave and grestore and provided. 

No access protection, the operators are there, but they don’t protect anything. 

Amiga Unix  —  Last change: Rutherford

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026