Created
August 25, 2011 19:06
-
-
Save Benabik/1171507 to your computer and use it in GitHub Desktop.
die_i_i resumable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test | |
resumed 1 | |
(no message) | |
resumed 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) 2011 Parrot Foundation. | |
.sub 'main' :main | |
push_eh test | |
die 'test' | |
say 'resumed 1' | |
die 0,0 | |
say 'resumed 2' | |
pop_eh | |
exit 0 | |
test: | |
.local pmc exception | |
.local string message | |
.local pmc resume | |
.get_results (exception) | |
unless exception goto no_except | |
message = exception['message'] | |
if message goto have_message | |
message = '(no message)' | |
have_message: | |
say message | |
resume = exception['resume'] | |
unless resume goto no_resume | |
resume() | |
say 'failed to resume' | |
exit 1 | |
no_resume: | |
say 'no resume' | |
exit 1 | |
no_except: | |
say 'no exception' | |
exit 1 | |
end: | |
.end | |
# Local Variables: | |
# mode: pir | |
# fill-column: 100 | |
# End: | |
# vim: expandtab shiftwidth=4 ft=pir: | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment