2005-05-08 03:44:18 +00:00
|
|
|
#include "BaseContinuation.h"
|
2010-12-16 11:01:49 +00:00
|
|
|
#include "Cons.h"
|
2005-05-08 03:44:18 +00:00
|
|
|
|
|
|
|
instruction_t returninst;
|
2011-02-14 13:39:43 +00:00
|
|
|
BaseContinuation *base;
|
2005-05-08 03:44:18 +00:00
|
|
|
|
|
|
|
@implementation BaseContinuation
|
|
|
|
+ (void) initialize
|
|
|
|
{
|
|
|
|
returninst.opcode = RETURN;
|
|
|
|
base = [BaseContinuation new];
|
|
|
|
}
|
|
|
|
+ (id) baseContinuation
|
|
|
|
{
|
|
|
|
return base;
|
|
|
|
}
|
|
|
|
|
2011-02-14 13:39:43 +00:00
|
|
|
- (void) restoreOnMachine: (Machine *) m
|
2005-05-08 03:44:18 +00:00
|
|
|
{
|
|
|
|
[m state].program = &returninst;
|
|
|
|
}
|
|
|
|
|
2011-02-14 13:39:43 +00:00
|
|
|
- (void) invokeOnMachine: (Machine *) m
|
2005-05-08 03:44:18 +00:00
|
|
|
{
|
2011-02-14 13:39:43 +00:00
|
|
|
[m value: [(Cons *) [m stack] car]];
|
2005-05-08 03:44:18 +00:00
|
|
|
[m state].program = &returninst;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|