[comp.lang.postscript] Finding available functions

perry@ccssrv.UUCP (Perry Hutchison) (09/20/89)

In article <1408@inria.inria.fr> morain@inria.inria.fr (Francois Morain) writes:

> Each time a new printer comes around, we have problems with tex.ps ...

> Is there any standard postscript command that [lists] the functions ...

Every function which is available to a PostScript program is in one of the
dictionaries.  This will list the names in systemdict:

   systemdict
   { exch ==
     pop
   } forall

The "==" displays the name (on the printer's "standard output", not on the
page), and the "pop" throws away the associated value.  By replacing the
"pop" with additional code, it is possible to walk through the entire
collection of dictionaries reachable from systemdict and thereby obtain a
list of all names which a PostScript program can use, together with their
types and (in some cases) values.

If you decide to try this, remember that systemdict contains an entry which
points to itself.  A program which attempts to dump every dictionary
encountered without checking for such things will loop infinitely.