Doing ABORT" interactively

143 views
Skip to first unread message

minf...@arcor.de

unread,
Jun 28, 2022, 5:44:15 AMJun 28
to
I am getting addlebrained...

: T abort" kkk" ; ok
0 t ok 1
1 t
*the terminal*:3:4: error: kkk
1 >>>t<<<
Backtrace:
kernel/basics.fs:269:17 0 $6FFFFF7F78B8 throw
*terminal*:1:12 1 $6FFFFF877220 c(abort")

What's wrong?

none albert

unread,
Jun 28, 2022, 5:57:59 AMJun 28
to
In article <74577042-a1c8-4ec1...@googlegroups.com>,
That is more or less it is supposed to work.
The error "kkk" is mentioned, and the Forth gives you some more
information that could be useful.

Groetjes Albert
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

minf...@arcor.de

unread,
Jun 28, 2022, 6:18:54 AMJun 28
to
none albert schrieb am Dienstag, 28. Juni 2022 um 11:57:59 UTC+2:
> In article <74577042-a1c8-4ec1...@googlegroups.com>,
> minf...@arcor.de <minf...@arcor.de> wrote:
> >I am getting addlebrained...
> >
> >: T abort" kkk" ; ok
> >0 t ok 1
> >1 t
> >*the terminal*:3:4: error: kkk
> >1 >>>t<<<
> >Backtrace:
> >kernel/basics.fs:269:17 0 $6FFFFF7F78B8 throw
> >*terminal*:1:12 1 $6FFFFF877220 c(abort")
> >
> >What's wrong?
> That is more or less it is supposed to work.
> The error "kkk" is mentioned, and the Forth gives you some more
> information that could be useful.

Gosh, yes. Addlebrained I am. :o(

Hans Bezemer

unread,
Jun 30, 2022, 11:02:35 AMJun 30
to
On Tuesday, June 28, 2022 at 12:18:54 PM UTC+2, minf...@arcor.de wrote:
> > That is more or less it is supposed to work.
> > The error "kkk" is mentioned, and the Forth gives you some more
> > information that could be useful.
> Gosh, yes. Addlebrained I am. :o(

Sir, I have a complaint about your theater. Every time I enter a door labeled "EXIT"
I end up outside. ;-)

Hans Bezemer

minf...@arcor.de

unread,
Jun 30, 2022, 12:17:15 PMJun 30
to
Even worse, I have been roaming in the 2nd floor. ;-)
(ABORT" behind a long forgotten exception frame..)

dxforth

unread,
Jun 30, 2022, 10:49:30 PMJun 30
to
Except in this case it's finding the EXIT. Theatres that obscure exits
would be in breach of safety laws. I recently re-evaluated what my
compiler spits out on error and concluded 'less is more'.

none albert

unread,
Jul 1, 2022, 2:14:04 AMJul 1
to
In article <f15c3df7-d0f6-4848...@googlegroups.com>,
I have made ABORT" a loadable extension in ciforth.
If you intend to use it, you better mean it.

Hans Bezemer

unread,
Jul 1, 2022, 2:19:10 AMJul 1
to
On Friday, July 1, 2022 at 8:14:04 AM UTC+2, none albert wrote:
> In article <f15c3df7-d0f6-4848...@googlegroups.com>,
> minf...@arcor.de <minf...@arcor.de> wrote:
> >the.bee...@gmail.com schrieb am Donnerstag, 30. Juni 2022 um 17:02:35 UTC+2:
> >> On Tuesday, June 28, 2022 at 12:18:54 PM UTC+2, minf...@arcor.de wrote:
> >> > > That is more or less it is supposed to work.
> >> > > The error "kkk" is mentioned, and the Forth gives you some more
> >> > > information that could be useful.
> >> > Gosh, yes. Addlebrained I am. :o(
> >> Sir, I have a complaint about your theater. Every time I enter a door labeled "EXIT"
> >> I end up outside. ;-)
> >
> >Even worse, I have been roaming in the 2nd floor. ;-)
> >(ABORT" behind a long forgotten exception frame..)
> I have made ABORT" a loadable extension in ciforth.
> If you intend to use it, you better mean it.

"This computer will self destruct in 10 seconds. 9, 8, 7, 6.."
;-)

Hans Bezemer

dxforth

unread,
Jul 1, 2022, 5:46:19 AMJul 1
to
On 1/07/2022 16:19, Hans Bezemer wrote:
> On Friday, July 1, 2022 at 8:14:04 AM UTC+2, none albert wrote:
>> In article <f15c3df7-d0f6-4848...@googlegroups.com>,
>> minf...@arcor.de <minf...@arcor.de> wrote:
>> >the.bee...@gmail.com schrieb am Donnerstag, 30. Juni 2022 um 17:02:35 UTC+2:
>> >> On Tuesday, June 28, 2022 at 12:18:54 PM UTC+2, minf...@arcor.de wrote:
>> >> > > That is more or less it is supposed to work.
>> >> > > The error "kkk" is mentioned, and the Forth gives you some more
>> >> > > information that could be useful.
>> >> > Gosh, yes. Addlebrained I am. :o(
>> >> Sir, I have a complaint about your theater. Every time I enter a door labeled "EXIT"
>> >> I end up outside. ;-)
>> >
>> >Even worse, I have been roaming in the 2nd floor. ;-)
>> >(ABORT" behind a long forgotten exception frame..)
>> I have made ABORT" a loadable extension in ciforth.
>> If you intend to use it, you better mean it.
>
> "This computer will self destruct in 10 seconds. 9, 8, 7, 6.."
> ;-)
>
> Hans Bezemer

: program 1 abort" Let me out of here!" ;

: run
['] program catch -2 of
cr ." Sorry - ANS says no. Press a key." key drop recurse
then ;

Tested on gforth :)

Hans Bezemer

unread,
Jul 1, 2022, 6:27:56 AMJul 1
to
On Friday, July 1, 2022 at 8:14:04 AM UTC+2, none albert wrote:
> >Even worse, I have been roaming in the 2nd floor. ;-)
> >(ABORT" behind a long forgotten exception frame..)
> I have made ABORT" a loadable extension in ciforth.
> If you intend to use it, you better mean it.

All fun on a sticky - in 4tH ABORT does just that: it quits, no questions asked.
Which IMHO is logical - if you want to quit, quit. If you wanted to get CAUGHT,
you would have THROWn an exception. So - if you use ABORT" in 4tH, it
shows a message on stdout and goes bye-bye.

If you THROW an exception without getting CAUGHT, it will show:
"Uncaught exception". Recently, a new keyword was added to 4tH:
THROW". This will show still a message, but can be CAUGHT. It is mostly
used in libraries where returning an error code or setting a status is
not easily feasible.

Hans Bezemer

minf...@arcor.de

unread,
Jul 1, 2022, 9:48:35 AMJul 1
to
IMO acc. to standard 9.6.2.0680 & 9.6.1.2275 it should be as:

: t1 abort" xxx" ;
1 0 t1 .s 1 ok \ nothing happens
drop
0 1 t1 .s xxx ok \ show message, do CORE ABORT that resumes to QUIT

: t2 ['] t1 catch ;
1 0 t2 .s 1 0 ok \ nothing happens, flag 0 replace by exception code 0
2drop
0 1 t2 .s 0 -2 ok \ don't show message, flag 1 replaced by exception code -2

However it seems all unclear because different Forths seem to behave differently.

Hans Bezemer

unread,
Jul 1, 2022, 10:41:39 AMJul 1
to
On Friday, July 1, 2022 at 3:48:35 PM UTC+2, minf...@arcor.de wrote:
> IMO acc. to standard 9.6.2.0680 & 9.6.1.2275 it should be as:
>
> : t1 abort" xxx" ;
> 1 0 t1 .s 1 ok \ nothing happens
> drop
> 0 1 t1 .s xxx ok \ show message, do CORE ABORT that resumes to QUIT
>
> : t2 ['] t1 catch ;
> 1 0 t2 .s 1 0 ok \ nothing happens, flag 0 replace by exception code 0
> 2drop
> 0 1 t2 .s 0 -2 ok \ don't show message, flag 1 replaced by exception code -2
>
> However it seems all unclear because different Forths seem to behave differently.

You're completely right - according to the standard, ABORT should be called. And
according to the standard (Exception EXT) perform the function of -1 THROW.

However - if one does *not* implement Exception Ext, the Core definition should
be executed - which is: Empty the data stack and perform the function of QUIT,
which includes emptying the return stack, without displaying a message.

Again - according to Core - ABORT" should perform an implementation-defined
abort sequence *that includes* the function of ABORT. However, according to
Exception Ext, ABORT" should perform the function of -2 THROW.

So the only thing I can imagine is that *some* implementations DO NOT implement
Exception Ext or do not comply to it (for ABORT and ABORT").

You can leave 4tH out of the equation though - the behavior of ABORT and ABORT"
and their non compliance was intentional - for the reasons given above.

Hans Bezemer

dxforth

unread,
Jul 1, 2022, 10:47:04 PMJul 1
to
On 1/07/2022 23:48, minf...@arcor.de wrote:
>
> 0 1 t2 .s 0 -2 ok \ don't show message, flag 1 replaced by exception code -2

On that one I get:

0 x -2

where x is unknown. Which IMO is correct. The flag was consumed by ABORT"
but CATCH is required to maintain the data stack level at the point it was
invoked (excluding the xt).

dxforth

unread,
Jul 2, 2022, 4:37:02 AMJul 2
to
On 2/07/2022 00:41, Hans Bezemer wrote:
> On Friday, July 1, 2022 at 3:48:35 PM UTC+2, minf...@arcor.de wrote:
>> IMO acc. to standard 9.6.2.0680 & 9.6.1.2275 it should be as:
>>
>> : t1 abort" xxx" ;
>> 1 0 t1 .s 1 ok \ nothing happens
>> drop
>> 0 1 t1 .s xxx ok \ show message, do CORE ABORT that resumes to QUIT
>>
>> : t2 ['] t1 catch ;
>> 1 0 t2 .s 1 0 ok \ nothing happens, flag 0 replace by exception code 0
>> 2drop
>> 0 1 t2 .s 0 -2 ok \ don't show message, flag 1 replaced by exception code -2
>>
>> However it seems all unclear because different Forths seem to behave differently.
>
> You're completely right - according to the standard, ABORT should be called. And
> according to the standard (Exception EXT) perform the function of -1 THROW.
>
> However - if one does *not* implement Exception Ext, the Core definition should
> be executed - which is: Empty the data stack and perform the function of QUIT,
> which includes emptying the return stack, without displaying a message.
>
> Again - according to Core - ABORT" should perform an implementation-defined
> abort sequence *that includes* the function of ABORT. However, according to
> Exception Ext, ABORT" should perform the function of -2 THROW.
>
> So the only thing I can imagine is that *some* implementations DO NOT implement
> Exception Ext or do not comply to it (for ABORT and ABORT").

If the exception is re-thrown the result is the same as executing t1 directly.

: t2 ['] t1 catch throw ;

The code reported by CATCH conforms to the table in ANS. It's premature to
say it won't perform ABORT aka -1 THROW if allowed to proceed. Am I missing
something?

none albert

unread,
Jul 2, 2022, 2:06:40 PMJul 2
to
In article <7dd80561-eab6-4d1b...@googlegroups.com>,
Hans Bezemer <the.bee...@gmail.com> wrote:
>On Friday, July 1, 2022 at 8:14:04 AM UTC+2, none albert wrote:
>> >Even worse, I have been roaming in the 2nd floor. ;-)
>> >(ABORT" behind a long forgotten exception frame..)
>> I have made ABORT" a loadable extension in ciforth.
>> If you intend to use it, you better mean it.
>
>All fun on a sticky - in 4tH ABORT does just that: it quits, no questions asked.
>Which IMHO is logical - if you want to quit, quit. If you wanted to get CAUGHT,
>you would have THROWn an exception. So - if you use ABORT" in 4tH, it
>shows a message on stdout and goes bye-bye.

Same in ciforth. The standard *allows* to execute ABORT by -1 THROW ,
but you and I agree that makes no sense.
By the way you can't then you use ABORT as a factor of ABORT" because
ABORT" must use -2 as the exception number!

<SNIP>
ABORT is an entry point for the system, in TURNKEY it is revectored
to execute whatever the turnkey has to do.
For the functionality both ABORT and QUIT are misnomers.

>
>Hans Bezemer

none albert

unread,
Jul 2, 2022, 2:10:58 PMJul 2
to
In article <3f483a76-f41b-4f5f...@googlegroups.com>,
Hans Bezemer <the.bee...@gmail.com> wrote:

>You're completely right - according to the standard, ABORT should be called. And
>according to the standard (Exception EXT) perform the function of -1 THROW.

Not true. If the implementor decides to implement ABORT via a THROW than
-1 is obligatory. There is no requirement to use THROW though.
So ciforth is standard in this respect.

Hans Bezemer

unread,
Jul 2, 2022, 4:42:51 PMJul 2
to
On Saturday, July 2, 2022 at 8:10:58 PM UTC+2, none albert wrote:
> In article <3f483a76-f41b-4f5f...@googlegroups.com>,
> Hans Bezemer <the.bee...@gmail.com> wrote:
>
> >You're completely right - according to the standard, ABORT should be called. And
> >according to the standard (Exception EXT) perform the function of -1 THROW.
> Not true. If the implementor decides to implement ABORT via a THROW than
> -1 is obligatory. There is no requirement to use THROW though.
> So ciforth is standard in this respect.
There is a difference between the Core and Exception Ext definitions.
In Core, ABORT" calls ABORT. In Exception Ext, ABORT does -1 THROW
and ABORT" does -2 THROW. No need there to call ABORT here.

HB

minf...@arcor.de

unread,
Jul 2, 2022, 4:51:05 PMJul 2
to
the.bee...@gmail.com schrieb am Samstag, 2. Juli 2022 um 22:42:51 UTC+2:
> On Saturday, July 2, 2022 at 8:10:58 PM UTC+2, none albert wrote:
> > In article <3f483a76-f41b-4f5f...@googlegroups.com>,
> > Hans Bezemer <the.bee...@gmail.com> wrote:
> >
> > >You're completely right - according to the standard, ABORT should be called. And
> > >according to the standard (Exception EXT) perform the function of -1 THROW.
> > Not true. If the implementor decides to implement ABORT via a THROW than
> > -1 is obligatory. There is no requirement to use THROW though.
> > So ciforth is standard in this respect.
> There is a difference between the Core and Exception Ext definitions.
> In Core, ABORT" calls ABORT. In Exception Ext, ABORT does -1 THROW
> and ABORT" does -2 THROW. No need there to call ABORT here.

-1 THROW performs Core ABORT
-2 THROW performs Core ABORT" that performs Core ABORT

dxforth

unread,
Jul 3, 2022, 12:16:20 AMJul 3
to
On 3/07/2022 04:06, albert wrote:
> In article <7dd80561-eab6-4d1b...@googlegroups.com>,
> Hans Bezemer <the.bee...@gmail.com> wrote:
>>On Friday, July 1, 2022 at 8:14:04 AM UTC+2, none albert wrote:
>>> >Even worse, I have been roaming in the 2nd floor. ;-)
>>> >(ABORT" behind a long forgotten exception frame..)
>>> I have made ABORT" a loadable extension in ciforth.
>>> If you intend to use it, you better mean it.
>>
>>All fun on a sticky - in 4tH ABORT does just that: it quits, no questions asked.
>>Which IMHO is logical - if you want to quit, quit. If you wanted to get CAUGHT,
>>you would have THROWn an exception. So - if you use ABORT" in 4tH, it
>>shows a message on stdout and goes bye-bye.
>
> Same in ciforth. The standard *allows* to execute ABORT by -1 THROW ,
> but you and I agree that makes no sense.
> By the way you can't then you use ABORT as a factor of ABORT" because
> ABORT" must use -2 as the exception number!
>
> <SNIP>
> ABORT is an entry point for the system, in TURNKEY it is revectored
> to execute whatever the turnkey has to do.
> For the functionality both ABORT and QUIT are misnomers.

That was your choice (or perhaps more accurately Fig-Forth's :)

Hans Bezemer

unread,
Jul 3, 2022, 4:26:14 AMJul 3
to
No - the standard explicitly states that when the THROW code is minus two, the core version of ABORT has to be performed.

HB

Marcel Hendrix

unread,
Jul 3, 2022, 6:03:21 AMJul 3
to
On Friday, July 1, 2022 at 11:46:19 AM UTC+2, dxforth wrote:
[..]
> : program 1 abort" Let me out of here!" ;
>
> : run
> ['] program catch -2 of
> cr ." Sorry - ANS says no. Press a key." key drop recurse
> then ;
>
> Tested on gforth :)

No, you didn't.

Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
: program 1 abort" Let me out of here!" ; ok
: run compiled
['] program catch -2 of compiled
cr ." Sorry - ANS says no. Press a key." key drop recurse compiled
then ;
:5: Invalid memory address
>>>then<<< ;
Backtrace:

Maybe you meant ... -2 = if ... ?

run
Sorry - ANS says no. Press a key.
Sorry - ANS says no. Press a key.
Sorry - ANS says no. Press a key.
Sorry - ANS says no. Press a key.
...

On iForth it still gives the extra CATCH information:

FORTH> run
**** RETURN STACK DUMP **** for MAIN-THREAD
CATCH
$01125FA8 (17981352)
$01136000 (18046976)
$01157000 (18182144)
$01155C00 (18177024)
$2CA5F7D0 (749074384)
$00000000 (0)
$00000003 (3)
$00000003 (3)
$2111FC00 (554826752)
Sorry - ANS says no. Press a key.
...

-marcel

dxforth

unread,
Jul 3, 2022, 6:39:16 AMJul 3
to
On 3/07/2022 20:03, Marcel Hendrix wrote:
> On Friday, July 1, 2022 at 11:46:19 AM UTC+2, dxforth wrote:
> [..]
>> : program 1 abort" Let me out of here!" ;
>>
>> : run
>> ['] program catch -2 of
>> cr ." Sorry - ANS says no. Press a key." key drop recurse
>> then ;
>>
>> Tested on gforth :)
>
> No, you didn't.
>
> Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc.

Gforth has progressed since 2008. It surprised me too.

Hans Bezemer

unread,
Jul 3, 2022, 6:57:21 AMJul 3
to
On Sunday, July 3, 2022 at 6:16:20 AM UTC+2, dxforth wrote:
> > Same in ciforth. The standard *allows* to execute ABORT by -1 THROW ,
> > but you and I agree that makes no sense.
We agree it makes no sense - however the "-1 THROW" is another wordset.
Just like S" it enhances or overrides previous behavior. If you want to claim
FULL COMPLIANCE to that particular wordset, I guess you'd have to include
it. If not, you're still compliant - but only to the CORE wordset.

As I interpret it, ABORT is a kind of "warm reboot" (since it leaves the
dictionary intact). In 4tH that makes no sense, since there is no interactive
Forth VM involved.

> > ABORT is an entry point for the system, in TURNKEY it is revectored
> > to execute whatever the turnkey has to do.
> > For the functionality both ABORT and QUIT are misnomers.
Agreed again - I think I'd called them RESTART or something. However - as
far as they work out on 4tH, I'm quite happy with those names - since they
actually abort or quit (indirectly). In 4tH, what they do is set the program counter
past the last instruction - so it stops. Just like the original LEAVE. So, it's more
like a jump to the end of the program.

> That was your choice (or perhaps more accurately Fig-Forth's :)
When I remember correctly the Forth-79's on the Sinclair Spectrum had entry
points for WARM and COLD restarts - so you might not be too far off. I'd have
to delve into the old assembler sources to confirm this, however.

Hans Bezemer
Reply all
Reply to author
Forward
0 new messages