121 lines
2.1 KiB
Objective-C
121 lines
2.1 KiB
Objective-C
#import <Foundation/Foundation.h>
|
|
#import <AppKit/AppKit.h>
|
|
|
|
#import "SchemeTypes.h"
|
|
#import "Primitive.h"
|
|
|
|
#define GSCHEME @"GScheme by Marko Riedel, mriedel@neuearbeit.de\n"
|
|
|
|
typedef enum {
|
|
MODE_INTERACTIVE,
|
|
MODE_EVALUATE,
|
|
MODE_LOAD
|
|
} PROCESS_MODE;
|
|
|
|
typedef enum {
|
|
DRAW_MOVE,
|
|
DRAW_LINE,
|
|
DRAW_COLOR
|
|
} DRAW_INST;
|
|
|
|
typedef struct _DrawInst {
|
|
DRAW_INST what;
|
|
union {
|
|
NSPoint coord;
|
|
float color[3];
|
|
} data;
|
|
} DrawInst;
|
|
|
|
@interface VScheme : NSObject
|
|
{
|
|
BOOL errflag;
|
|
NSString *errmsg;
|
|
|
|
NSMutableArray *codeStack;
|
|
NSMutableArray *pcStack;
|
|
NSMutableArray *argStack;
|
|
NSMutableArray *envStack;
|
|
|
|
id curcodes;
|
|
int curpc;
|
|
|
|
NSString *output;
|
|
|
|
int maxcode, maxpc, maxarg, maxenv;
|
|
|
|
id delegate;
|
|
|
|
BOOL atImgStart;
|
|
NSPoint imgMin, imgMax;
|
|
NSMutableArray *imgCodes;
|
|
|
|
long int curRecDepth, maxRecDepth;
|
|
}
|
|
|
|
+ (NSString *)valToString:(id)item seen:(NSMutableSet *)mem;
|
|
+ (NSString *)valToString:(id)item;
|
|
|
|
+ printInstr:(Triple *)instr;
|
|
+ printCodes:(NSMutableArray *)codes;
|
|
|
|
- init;
|
|
|
|
- delegate;
|
|
- setDelegate:(id)aDelegate;
|
|
|
|
- makeStartEnvironment;
|
|
|
|
- (int)maxcode;
|
|
- (int)maxpc;
|
|
- (int)maxarg;
|
|
- (int)maxenv;
|
|
|
|
- resetStacks;
|
|
- reset:(id)sender;
|
|
|
|
- appendToOutput:(NSString *)data;
|
|
- (NSString *)output;
|
|
- clearOutput;
|
|
|
|
- recordImgInst:(DrawInst)inst;
|
|
- clearImage;
|
|
- produceImage;
|
|
|
|
- (NSMutableArray *)argStack;
|
|
- (NSMutableArray *)envStack;
|
|
- (NSMutableArray *)codeStack;
|
|
|
|
- (BOOL)errflag;
|
|
- (NSString *)errmsg;
|
|
|
|
- args2list:(int)lower;
|
|
|
|
- pushCodes:(NSMutableArray *)codes;
|
|
- (BOOL)run:(ByteCodes *)prog;
|
|
|
|
- special:(id)data output:(ByteCodes *)codes popenv:(int)ec;
|
|
- sequence:(id)data output:(ByteCodes *)codes popenv:(int)ec;
|
|
- compile:(id)data output:(ByteCodes *)codes popenv:(int)ec;
|
|
|
|
- (BOOL)compile:(id)data output:(ByteCodes *)codes;
|
|
|
|
- (BOOL)processString:(NSString *)data mode:(PROCESS_MODE)pmode;
|
|
|
|
@end
|
|
|
|
@interface SCMImageView : NSView
|
|
{
|
|
NSImage *image;
|
|
}
|
|
|
|
- (id)initWithFrame:(NSRect)frameRect;
|
|
|
|
- (NSImage *)image;
|
|
- setImage:(NSImage *)anImage;
|
|
|
|
- (void)drawRect:(NSRect)aRect;
|
|
|
|
@end
|
|
|
|
|