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;7*?t=uy@X}1GWr!+0qqp_Cn176t4(dQ* http://bernd-paysan.de/
