1 #import <Cocoa/Cocoa.h>
5 void c_to_factor_toplevel(CELL quot)
13 dpush(allot_alien(F,(CELL)localException));
14 quot = userenv[COCOA_EXCEPTION_ENV];
15 if(type_of(quot) != QUOTATION_TYPE)
17 /* No Cocoa exception handler was registered, so
18 extra/cocoa/ is not loaded. So we pass the exception
20 [localException raise];
29 Gestalt(gestaltSystemVersion,&version);
32 printf("Factor requires Mac OS X 10.5 or later.\n");
36 [[NSAutoreleasePool alloc] init];
39 const char *vm_executable_path(void)
41 return [[[NSBundle mainBundle] executablePath] UTF8String];
44 const char *default_image_path(void)
46 NSBundle *bundle = [NSBundle mainBundle];
47 NSString *path = [bundle bundlePath];
48 NSString *executable = [[bundle executablePath] lastPathComponent];
49 NSString *image = [executable stringByAppendingString:@".image"];
53 if([path hasSuffix:@".app"] || [path hasSuffix:@".app/"])
55 NSFileManager *mgr = [NSFileManager defaultManager];
57 NSString *imageInBundle = [[path stringByAppendingPathComponent:@"Contents/Resources"] stringByAppendingPathComponent:image];
58 NSString *imageAlongBundle = [[path stringByDeletingLastPathComponent] stringByAppendingPathComponent:image];
60 returnVal = ([mgr fileExistsAtPath:imageInBundle]
61 ? imageInBundle : imageAlongBundle);
64 returnVal = [path stringByAppendingPathComponent:image];
66 return [returnVal UTF8String];
69 void init_signals(void)
75 /* Amateurs at Apple: implement this function, properly! */
76 Protocol *objc_getProtocol(char *name)
78 if(strcmp(name,"NSTextInput") == 0)
79 return @protocol(NSTextInput);