Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!storethat.news.telefonica.de!telefonica.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Helge Blischke Newsgroups: comp.lang.postscript Subject: Re: Make ghostscript signal an /interrupt error when it received a SIGINT Followup-To: comp.lang.postscript Date: Tue, 30 Apr 2013 18:35:23 +0200 Lines: 55 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit X-Trace: individual.net 9XW19Z7U84AbX1f2mLztRwkRpzBDAYY1dPqQufaZZBM5zYN9Us Cancel-Lock: sha1:kV3/dMfLNyuMyIP5pdLkSlk2Yi4= User-Agent: KNode/0.99.01 Xref: csiph.com comp.lang.postscript:1374 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