Tutorial by Examples

Yield true on the stack if currentpoint executes successfully, or false if it signals a /nocurrentpoint error. {currentpoint pop pop} stopped not % bool
The sequence for an error is usually: error is triggered by looking up the error name in errordict and executing this procedure. the errordict procedure calls signalerror, passing it the error name. signalerror takes snapshots of the stacks, saving the snapshots in $error, and then calls stop. ...
Most of the tools are standardized with the exception of the name of the operator to throw an error. In Adobe interpreters, it is called .error. In ghostscript, it is called signalerror. So with this line you can use signalerror in postscript code for Adobe interpreters or ghostscript or xpost. /.e...
Since the final action of the default error handler is to call stop, you can catch errors from operators by enclosing code in a { ... } stopped construct. { 0 array 1 get } stopped { $error /errorname get = } if will print "rangecheck", the error signaled by get when t...
This snippet implements a procedure which behaves like a postscript looping operator. If the user proc calls exit, it catches the invalidexit error to fix the dictstack for the end at the end. Any other error except invalidexit is re-thrown by calling stop. % array n proc . - % Like `forall` but...

Page 1 of 1