gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gforth] Deactivate the backtrace message?


From: Bernd Paysan
Subject: Re: [gforth] Deactivate the backtrace message?
Date: Thu, 17 Dec 2015 15:21:27 +0100
User-agent: KMail/4.14.10 (Linux/4.3.0-2-default; KDE/4.14.14; x86_64; ; )

Am Donnerstag, 17. Dezember 2015, 13:42:57 schrieb Anton Ertl:
> On Wed, Dec 16, 2015 at 08:51:52PM +0100, Marcos Cruz wrote:
> > And
> > anyway this is a command line tool intended to be used in tool chains,
> > concatenated commands, Makefile...   (so `quit` or `bye` are not an
> > option, because the Forth system must exit with an error).
> 
> 1 (BYE)
> 
> Maybe have a word
> 
> : typecr ( c-addr u -- )
> 
>   type cr ;
> 
> : ?error-exit ( f c-addr u -- )
> 
>   rot if
>     ['] typecr stderr outfile-execute 1 (bye)
>   then 2drop ;
> 
> Used as in
> ... ( f ) s" Wrong size for the card type." ?error-exit

Using quotations, and built-in functions:

: simple-error [: .error-string cr ;] stderr outfile-execute 1 (bye) ;
' simple-error is DoError

So you still can work with ABORT" and s" <string>" exception constant xxx ... 
xxx THROW; also all system errors will be properly displayed, like "file not 
found" and such.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
net2o ID: kQusJzA;address@hidden(dQ*
http://bernd-paysan.de/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]