mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
6d494bfcdf
-Wall still isn't used yet due to a missing method in Array, and overzealous warnings in qfcc, but this covers the necessary fixes.
31 lines
572 B
R
31 lines
572 B
R
#include "Primitive.h"
|
|
#include "Machine.h"
|
|
#include "Continuation.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
|