Created
December 3, 2008 23:54
-
-
Save tene/31767 to your computer and use it in GitHub Desktop.
This file contains 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
.sub main :main | |
.local int redux | |
.local pmc cont | |
redux = 0 | |
print "calling test\n" | |
cont = test() | |
print "back from test\n" | |
if redux goto done | |
redux = 1 | |
print "calling cont\n" | |
cont() | |
print "never.\n" | |
done: | |
print "done.\n" | |
.end | |
.sub test | |
## Push a handler around the foo() call. | |
push_eh handle_errs | |
print " calling foo\n" | |
.local pmc cont | |
cont = foo() | |
print " returning from test.\n" | |
.return (cont) | |
handle_errs: | |
pop_eh | |
print " test: caught error\n" | |
.return () | |
.end | |
.sub foo | |
## Take a continuation. | |
.local pmc cont | |
cont = new 'Continuation' | |
set_addr cont, over_there | |
print " returning from foo\n" | |
.return (cont) | |
over_there: | |
print " got over there.\n" | |
.local pmc ex | |
ex = new 'Exception' | |
throw ex | |
.end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment