larsbrinkhoff / forth-mode

Wants to be the SLIME of Forth
GNU General Public License v3.0
61 stars 17 forks source link

Terminal device personality reset #28

Closed ellerh closed 7 years ago

ellerh commented 7 years ago

SwiftForth seems to reset the device personality on errors:

SwiftForth i386-Linux 3.6.3 29-Jun-2016 
'personality @ . 134554011  ok
include swiftforth.fth  ok                                                     
'personality @ . 134756820  ok
abort 
'personality @ . 134554011  ok
larsbrinkhoff commented 7 years ago

I'm trying to inch this forward.

The SwiftForth distribution file lilb/samples/win32/serial.f says:

quit is necessary in both cases to reset the catch frame which maintains the default personality for restoring on throws.

So supposedly, the system maintains a top-level CATCH which changes the personality when an exception is thrown. I haven't found any documentation on this.

The options would be:

The first one may be a good idea anyway, to have more control over what happens when there are exceptions.

ellerh commented 7 years ago

Find out where the default personality is stored, and change that.

Here's an interesting observation about QUIT:

SwiftForth i386-Linux 3.6.3 29-Jun-2016 
'personality @ . 134554011  ok                                                 
include swiftforth.fth  ok                                                     
'personality @ . 134756820  ok
quit 'personality @ . 134756820  ok
abort 
'personality @ . 134756820  ok

Maybe QUIT also overwrites the default personality.

ellerh commented 7 years ago

Disassembling QUIT reveals a call to /INTERPRET. My guess is that this initializes something important. I tried it out with 6b74225. We will see how it works.