Is it possible to embed squeak in a host C application with it's own thread (if needed)?
Is so, how could I get started? ;-)
The Squeak interpreter is essentially a while loop with a switch statement in it for each of the 255 bytecodes. Memory is allocated on the heap but in a platform dependent manner. There might be issues with resource contention between Squeak and your application, but it should be perfectly possible to integrate Squeak in another application.
The VM is automatically converted from Smalltalk to C using VMMaker. The generated code is mostly readable.
Start at http://www.squeakvm.org/, and search http://wiki.squeak.org/ (i.e. Google for "squeak vm build instructions site:wiki.squeak.org") for instructions for building the VM. You can customise the platform-specific code for opening files, allocating memory, loading the image etc if they cause problems. You'll probably also want to disable Squeak's video output, which shouldn't be difficult.
Igor has recently done some interesting work in essentially running Squeak as an embedded application in itself. Read his postings about the Hydra VM on the main squeak-dev mailing list for more info.
could be examined too, it was written mostly by Bert Freudenberg with
changes by myself to let you start a netscape plugin os-x safari/
firefox which setups a shared
memory area (non-trival because instructions how to do this are vague)
and two pipes to let the plugin code stuff interact with a headless VM
via execv(plugin->vmName, plugin->argv);
The pipes are used to pass control information between the plugin stub
and the headless VM
The shared memory area is the quartz window canvas, other operating
such as windows and X11 let you deal with remote surface display in an
There is a bunch of nasty semaphore logic to deal with preventing the
VM from burying the browser with update requests, plus code to figure
out if the browser has gone away.
Thus the headless VM is feed UI events and serves back UI images to
On Feb 22, 2008, at 6:55 PM, tim Rowledge wrote:
> Gulik's reply reminds me that you might find the code that allows
> the VM to be a browser plugin instructive. Part of your interest
> will likely be that there is so little needing changing.
> I'll leave it to John McI to explain the details since he's probably
> done most of the code fudging involved.
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim > Never write software that patronizes the user.
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com =