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

exception wordset #583

Merged
merged 42 commits into from
Dec 27, 2024
Merged

exception wordset #583

merged 42 commits into from
Dec 27, 2024

Conversation

jkotlinski
Copy link
Owner

No description provided.

@jkotlinski
Copy link
Owner Author

to solve:

When a THROW returns control to a CATCH, the system shall un-nest not only definitions, but also, if present, locals and input source specifications, to return the system to its proper state for continued execution past the CATCH.

@jkotlinski
Copy link
Owner Author

OK, so all the tests pass, which means it basically works. But need to find a good way to keep the helpful error messages.

rts

.print_error_and_abort
jsr RVS
Copy link
Contributor

@ekipan ekipan Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe put a jump vector here whose address is given as a value. The asm code could just print err but the forth code could later give it something proper, once . exists.

Copy link
Owner Author

@jkotlinski jkotlinski Dec 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I solved error messages in the most simple way I could imagine now.

Not sure if it is better than a jump vector, but it works.

lda #'r'
jsr PUTCHR
jsr PUTCHR
.print_cr_and_abort
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe insert a JSR NOP between lines 85 and 86. Later ' . could be stored there. Just as something simple.

@jkotlinski
Copy link
Owner Author

I messed around a little, now it prints custom error messages for some error codes.

Something still to solve: when parsing a file, and a word is not found, I want it to print the missing word.

@jkotlinski jkotlinski changed the title Draft: exception wordset exception wordset Dec 22, 2024
@jkotlinski
Copy link
Owner Author

jkotlinski commented Dec 22, 2024

OK, I think it is more or less done now, except for all the things I did not think of yet.

I am not sure what implications this has for ioabort, or if there are other things that should be done differently, now that exceptions are available.

@jkotlinski jkotlinski changed the title exception wordset Draft: exception wordset Dec 23, 2024
@jkotlinski
Copy link
Owner Author

TODO: Update manual.

@jkotlinski
Copy link
Owner Author

TODO: Figure out if anything ought to change related to File I/O error handling.

@Whammo
Copy link
Collaborator

Whammo commented Dec 25, 2024

Very cool. Thank you.
Perhaps a simple example?

@jkotlinski
Copy link
Owner Author

jkotlinski commented Dec 25, 2024

What do you think of this?

: loop begin again ;
: demo ['] loop catch . ;
demo

To break out of the endless loop, press RESTORE to raise "user interrupt" exception -28.
demo will catch and print the exception number.

@jkotlinski jkotlinski changed the title Draft: exception wordset exception wordset Dec 26, 2024
@jkotlinski
Copy link
Owner Author

Mulled things over, and it is probably O.K. if exceptions -13 (Undefined Word) and -37 (File I/O Error) print error messages before THROW, rather than in the exception handler.

@jkotlinski
Copy link
Owner Author

Probably good to go.

@jkotlinski
Copy link
Owner Author

TODO: print unknown exception numbers.

@jkotlinski jkotlinski merged commit 93e68ac into master Dec 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants