Fwd: [GOODIE] Headless Squeak for OS X (Re: Mac VM 3.2.X)

Marcel Weiher marcel at metaobject.com
Wed Jul 24 16:25:50 UTC 2002



Begin forwarded message:
>
> Well, I've always said how trivial this is with the architecture of the 
> CocoaSqueak VM, and today I guess I'm going to put my money where my 
> mouth is:
>
> All you have to do is create a new "Foundation Tool" project, add the 
> Squeak.framework to its frameworks and adjust main to load + run a 
> Squeak image.  I just did it, elapsed time exactly 10 minutes (much of 
> that rummaging around in the image for the code to make the image start 
> up Seaside automatically when starting up).  This is code:
>
>
> ------------- snip --------------
> #import <Foundation/Foundation.h>
> #import <Squeak/SqueakInterpreter.h>
>
> int main (int argc, const char * argv[]) {
>     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
>     id imageName=[NSString stringWithCString:argv[1]];
>     id interpreter =[SqueakInterpreter interpreter];
>
>     [interpreter readImageFile:imageName withHeapSize:64 * 1024 * 1024];
>     [interpreter setStackCacheEntries:64];
>     [interpreter setContextCacheEntries:64];
>     [interpreter startInterpreter];
>
>     [pool release];
>     return 0;
> }
> ----------- snip --------------
>
>
> and this is the complete project.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: squeakserver.tgz
Type: application/x-gzip
Size: 1825 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020724/b1b6c02e/squeakserver.bin
-------------- next part --------------
>
>
> Enhancements / generality left as an exercise to the reader.  A tool 
> like this can't use the bundle features, because there is no bundle, 
> but it is probably possible to build a bundled headless application as 
> well.
>
> Marcel
>
> --
> Marcel Weiher				Metaobject Software Technologies
> marcel at metaobject.com		www.metaobject.com
> Metaprogramming for the Graphic Arts.   HOM, IDEAs, MetaAd etc.


More information about the Squeak-dev mailing list