Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exceptions failing hayes test #106

Open
mitra42 opened this issue Aug 3, 2023 · 1 comment
Open

Exceptions failing hayes test #106

mitra42 opened this issue Aug 3, 2023 · 1 comment

Comments

@mitra42
Copy link
Owner

mitra42 commented Aug 3, 2023

Exceptions should be working, but fail the Hayes tests (see issue #83)
S" exceptiontest.fth" INCLUDED
TESTING CATCH THROW
TESTING ABORT ABORT"

WRONG NUMBER OF RESULTS: T{ 1 2 ' T6 C6 -> 1 2 11 }T \ Test that ABORT is caught
WRONG NUMBER OF RESULTS: T{ 4 5 ' T10 C6 -> 4 77 12 }T \ ABORT" caught, no messageTESTING a system generated exception

333 $$QWEQWEQWERT$$ 334
^^^^^^^^^^^^^^^^^^^^
$$QWEQWEQWERT$$ ? ok
ok
ok
ok

@mitra42
Copy link
Owner Author

mitra42 commented Aug 3, 2023

Fixed ABORT - now returns -1 instead of pointer to NULL$
ABORT" is harder
(abort") uses do$ to get string (approx line 1164), but passes it to THROW (approx line 965)
If we pass -2 it will be (correctly) passed to the line after the CATCH
BUT if there is no CATCH (i.e. ABORT" used outside of a CATCH), it is supposed to print an error , and we don't have a way of finding that error from inside the THROW or the CATCH since we've replaced the string address with -2|
For now we've stuck with returning an error string address from ABORT"

https://forth-standard.org/standard/core/ABORTq says ABORT" should display the message
https://forth-standard.org/standard/exception/ABORTq says should only display if no handler
https://forth-standard.org/standard/exception/THROW gives a standard, but erroneous, definition (Comment made, but doesn't look like they ever make it through to the text, as I posted a bug on another problem in this word three years ago which was accepted but the text never changed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant