factor/vm/os-macosx.m

55 lines
1021 B
Matlab
Raw Normal View History

2006-07-07 00:07:18 -04:00
#include "factor.h"
2006-03-19 02:42:40 -05:00
#import "Foundation/NSAutoreleasePool.h"
#import "Foundation/NSBundle.h"
#import "Foundation/NSException.h"
2006-03-19 02:42:40 -05:00
#import "Foundation/NSString.h"
static CELL error;
/* This code is convoluted because Cocoa places restrictions on longjmp and
exception handling. In particular, a longjmp can never cross an NS_DURING,
NS_HANDLER or NS_ENDHANDLER. */
void platform_run()
{
error = F;
for(;;)
{
NS_DURING
SETJMP(stack_chain->toplevel);
handle_error();
if(error != F)
{
CELL e = error;
error = F;
2006-05-15 00:03:55 -04:00
general_error(ERROR_OBJECTIVE_C,e,F,true);
}
run();
NS_VOIDRETURN;
NS_HANDLER
error = tag_object(make_alien(F,(CELL)localException));
NS_ENDHANDLER
}
}
2006-03-19 02:42:40 -05:00
void early_init(void)
{
[[NSAutoreleasePool alloc] init];
}
const char *default_image_path(void)
{
NSBundle *bundle = [NSBundle mainBundle];
2006-04-09 19:14:30 -04:00
NSString *image = [[bundle resourcePath] stringByAppendingString:@"/factor.image"];
2006-03-19 02:42:40 -05:00
return [image cString];
}
2006-07-07 00:07:18 -04:00
void init_signals(void)
{
unix_init_signals();
mach_initialize();
}