Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #1374

Re: Make ghostscript signal an /interrupt error when it received a SIGINT

From Helge Blischke <h.blischke@acm.org>
Newsgroups comp.lang.postscript
Subject Re: Make ghostscript signal an /interrupt error when it received a SIGINT
Followup-To comp.lang.postscript
Date 2013-04-30 18:35 +0200
Message-ID <auaa6dFmu6pU1@mid.individual.net> (permalink)
References <a167181f-d7b2-4457-94e0-21239c955b6a@googlegroups.com>

Followups directed to: comp.lang.postscript

Show all headers | View raw


luser- -droog wrote:

> With my Mandelbrot explorer
> (https://code.google.com/p/xpost/downloads/detail?name=mandel2.ps), I'd
> like to be able to interrupt the drawing and return to the menu if the
> resolution is too high and it's taking too long.
> 
> The PLRM, 1ed, says
> 
>> interrupt  (error)
> 
>> processes an external request to interrupt execution of a PostScript
>> program. When the interpreter receives an interrupt request, it executes
>> interrupt as if it were an error (i.e. it looks up the name 'interrupt'
>> in errordict). Execution of interrupt is sandwiched between execution of
>> two objects being interpreted in normal sequence.
> 
>> The precise nature of an external interrupt request depends on the en-
>> vironment in which the PostScript interpreter is running. In typical
>> environments, receipt of a control-C character from a serial communi-
>> cation channel gives rise to the interrupt error. This permits a user to
>> explicitly abort a PostScript computation. The default definition of
>> interrupt executes a stop.
> 
> 
> I tried wrapping the drawing functions in a stopped context.
> 
> % The Main Loop
> % - draw the object according to currrent parameters
> % - enter menu loop
> % - showpage
> {
>     {
>         createtable findmaxmin sketch flushpage
>     } stopped clear
>     menu
>     showpage
> } loop
> 
> But ctrl-C just kills the whole interpreter.
> 
> Is there a special mode or flag to enable /interrupt errors with GS?

Looking (not too deeply) into the Ghostscript sources reveals: 
it seems that capturing signals like this is mainly restricted to
events associated with the PostScript input (currentfile and friends).
I guess it is not trivial to enhance gs to treat CTRL-C as an interrupt 
error without fidling around with the kernel of ghostscript's ps interpreter
ans how it is hooked up to the operating system (to be precise: the OS 
abstraction level).

So I'd suggest you file a feature request at bugs.ghostscript.com.

Helge

Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Make ghostscript signal an /interrupt error when it received a SIGINT luser- -droog <mijoryx@yahoo.com> - 2013-04-25 16:32 -0700
  Re: Make ghostscript signal an /interrupt error when it received a SIGINT luser- -droog <mijoryx@yahoo.com> - 2013-04-26 15:33 -0700
  Re: Make ghostscript signal an /interrupt error when it received a SIGINT Helge Blischke <h.blischke@acm.org> - 2013-04-30 18:35 +0200
    Re: Make ghostscript signal an /interrupt error when it received a SIGINT luser- -droog <mijoryx@yahoo.com> - 2013-04-30 20:26 -0700

csiph-web