mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-06 05:01:26 +00:00
bc73af37f2
collector a bit.
30 lines
546 B
R
30 lines
546 B
R
#include "Primitive.h"
|
|
#include "Machine.h"
|
|
|
|
@implementation Primitive
|
|
+ (id) newFromFunc: (primfunc_t) f
|
|
{
|
|
return [[self alloc] initWithFunc: f];
|
|
}
|
|
- (id) initWithFunc: (primfunc_t) f
|
|
{
|
|
self = [super init];
|
|
func = f;
|
|
return self;
|
|
}
|
|
- (SchemeObject) invokeOnMachine: (Machine) m
|
|
{
|
|
local SchemeObject value = func ([m stack], m);
|
|
[super invokeOnMachine: m];
|
|
if (value) {
|
|
[m value: value];
|
|
[[m continuation] restoreOnMachine: m];
|
|
}
|
|
}
|
|
|
|
- (string) printForm
|
|
{
|
|
return "<primitive>";
|
|
}
|
|
|
|
@end
|