A recursive inspection library for PostScript, stylised in the vein of Node.js's colourful util.inspect()
output:
-
Download
inspect.ps
to wherever you store your PostScript libraries:$ curl https://git.io/JOsbC > /path/to/ghostscript/lib/inspect.ps
-
Configure GhostScript to whitelist the path, if necessary.
$ export GS_LIB="/path/to/ghostscript/libs:$GS_LIB"
-
Verify successful installation by running:
$ echo '(/path/to/ghostscript/libs) run << /Foo 1 >> ===' \ | gs -sDEVICE=txtwrite -sOutputFile=- -q -sBATCH -dNOPAUSE -
Use ===
to inspect a single operand:
userdict ===
Use ?
to inspect the entire stack à la pstack
:
(A) (B) (C) (D) ?
Neither procedure modifies the stack, so dup
-ing before inspection is unnecessary.