For Squeak on the Macintosh, a straightforward solution immediately comes to mind: Put the image into the data fork of a file, and put the VM into the resource fork. Voila, there's your double-clickable application.
There is a small problem: On PowerPC Macs, the executable code of the application is also in the data fork. The resource fork only contains a little 'cfrg' resource that tells the program loader where to look for the actual program.
But all is not lost. The PowerPC Mac can still execute 68k code (although at a somewhat lesser speed), and there is a cross-architecture calling mechanism called Mixed Mode. With this, you can call shared libraries from 68k code just as you can from PowerPC code.
Now the design of a double-clickable Squeak application is not so difficult anymore:
For those of you who want to try this, I make the stuff available here. You could use the source to build your own VM library, or you could just download the VM, the stub and a Squeak workspace that copies an image file to the data fork of a copy of the stub.
Hans-Martin
By the way, the primitive 149 mentioned is the start of a Squeak 3D engine. If you'd like to play with it, you can file in TriangleFill.st and execute "WarpBlt colorCircle" in a Workspace.
| Binary Files | ||
|---|---|---|
| File | Size | Description |
| SqueakVM.bin | 144.128 | MacBinary II+ encoded shared library containing the Squeak VM, including primitive 149 (triangle filler). |
| SQstub.bin | 3.968 | MacBinary II+ encoded stub. |
| C Source Files and Makefiles | ||
| File | Size | Description |
| sqMacWindow.c | 28.476 | The file contains a couple of #ifdef SHLIB
that generate code for the shared library version of the VM.
|
| SqueakVM.make | 1.799 | Makefile to generate the SqueakVM. You will probably have to adjust this for your environment. |
| SQstub.c | 903 | Source of the stub program. This needs some comments and a reasonable error handling mechanism in case the library is not found. |
| SQstub.make | ||
| Squeak Smalltalk Source Files | ||
| File | Size | Description |
| CopyToStub.ws | 276 | A Squeak Workspace to copy an existing image file onto a copy of the stub. Note that you should always use a fresh copy of the stub with an empty data fork, as the code does not clear out the data fork before copying. |