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


Groups > comp.lang.postscript > #1553

Re: Checking the stack is empty at the end of the program

From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.postscript
Subject Re: Checking the stack is empty at the end of the program
Organization Decebal Computing
References (2 earlier) <cfac3023-1d88-463d-ae51-927c3f9cfa36@googlegroups.com> <87txj9951i.fsf@Aspire.decebal.nl> <0034540c-4d60-42b6-9d32-f3357f719636@googlegroups.com> <87pptx8zip.fsf@Aspire.decebal.nl> <d7307707-edf3-4dde-805b-e789439e340b@googlegroups.com>
Date 2013-08-01 13:18 +0200
Message-ID <87li4l8xri.fsf@Aspire.decebal.nl> (permalink)

Show all headers | View raw


Op donderdag 1 aug 2013 12:53 CEST schreef luser:

> On Thursday, August 1, 2013 5:40:46 AM UTC-5, Cecil Westerhof wrote:
>> Op donderdag 1 aug 2013 11:37 CEST schreef luser:
>>
>>
>>
>>> On Thursday, August 1, 2013 3:41:29 AM UTC-5, Cecil Westerhof wrote:
>>
>>>
>>
>>>>
>>
>>>> Only one thing is missing. When the stack is not empty, I want to
>>
>>>> signal an error. In this way the calling script will terminate.
>>>> Is
>>
>>>> this possible?
>>
>>>>
>>
>>>
>>
>>> Sure. In ghostscript, use `signalerror`.
>>
>>>
>>
>>> error-object error-name  signalerror  
>>
>>>
>>
>>> Now the error name should be one of the standard postscript
>>
>>> errors if you want to trip the normal mechanism. 
>>
>>> But the error object can be an informative name.
>>
>>>
>>
>>> /STACK-NOT-EMPTY cvx /unregistered signalerror
>>
>>>
>>
>>> which results in:
>>
>>> Error: /unregistered in STACK-NOT-EMPTY
>>
>>> ...(normal error stack dumps)
>>
>>
>>
>> Works, thanks. Only one thing: I already showed the stack. Is it
>>
>> possible to circumvent the stack dumps?
>>
>
> Well, yeah. But aren't you going waaay overboard on this?

A little bit maybe, but this is the foundation I am going to build on,
so better make it a good one. ;-)

I am thinking about letting my preprocessor always add endProgram at
the end. This makes sure I see a certain type of errors in my code.


> Be that as it may, you can install your own error handler
> in errordict.
>
> errordict/unregistered{
> (Error: unregistered in ) print =
> } put
>
> This is the procedure that signalerror looks up and calls.

There is no stack dump, but the program is not terminated also. So
that does not work.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

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


Thread

Checking the stack is empty at the end of the program Cecil Westerhof <Cecil@decebal.nl> - 2013-08-01 00:16 +0200
  Re: Checking the stack is empty at the end of the program luser- -droog <mijoryx@yahoo.com> - 2013-07-31 15:41 -0700
    Re: Checking the stack is empty at the end of the program Cecil Westerhof <Cecil@decebal.nl> - 2013-08-01 02:36 +0200
  Re: Checking the stack is empty at the end of the program Dan Coby <adcoby@earthlink.net> - 2013-07-31 18:36 -0700
    Re: Checking the stack is empty at the end of the program luser- -droog <mijoryx@yahoo.com> - 2013-07-31 23:53 -0700
      Re: Checking the stack is empty at the end of the program Cecil Westerhof <Cecil@decebal.nl> - 2013-08-01 10:41 +0200
        Re: Checking the stack is empty at the end of the program luser- -droog <mijoryx@yahoo.com> - 2013-08-01 02:37 -0700
          Re: Checking the stack is empty at the end of the program Cecil Westerhof <Cecil@decebal.nl> - 2013-08-01 12:40 +0200
            Re: Checking the stack is empty at the end of the program luser- -droog <mijoryx@yahoo.com> - 2013-08-01 03:53 -0700
              Re: Checking the stack is empty at the end of the program luser- -droog <mijoryx@yahoo.com> - 2013-08-01 03:56 -0700
                Re: Checking the stack is empty at the end of the program luser- -droog <mijoryx@yahoo.com> - 2013-08-01 04:23 -0700
                Re: Checking the stack is empty at the end of the program Cecil Westerhof <Cecil@decebal.nl> - 2013-08-01 15:45 +0200
              Re: Checking the stack is empty at the end of the program Cecil Westerhof <Cecil@decebal.nl> - 2013-08-01 13:18 +0200
                Re: Checking the stack is empty at the end of the program luser- -droog <mijoryx@yahoo.com> - 2013-08-01 09:33 -0700
                Re: Checking the stack is empty at the end of the program luser- -droog <mijoryx@yahoo.com> - 2013-08-01 18:25 -0700

csiph-web