I've made a simple set of changes that make doing headless squeak much simpler and which might interest you folks. John & I have discussed it a bit previously and he seems to quite like it.
The most obvious glitch when trying to do a headless run of squeak is that the window is created and opened by the vm before the image is started up. Thus there is no easy way to have a headless image without a vm that can understand not having a display. Ian has put a bunch if #ifdefs in his window stuff to do this. Obviously there are a load of other issues such as the communication to some other image/machine for debugging etc, but that's for another day!
I spotted the posibility of a neater way to do this as a side effect of having to change the beDisplay prim to support the Acorn display. I have to call a function in the window.c file to fake out the dispaly bitmap being outside object space, and noticed that it would be a really good place to move the SetupWindow/SetWindowSize etc work. That way, it is only when beDisplay is called that the window need be created and now the image can have complete control over whether a window is used.
The VM changes are very small:- - primitiveBeDisplay needs to call some outside function. For my needs I use ioSetDisplayBitmap(int displayObj, int suggestedSize, int w, int h, int d) where the arguments are the Display oop, the suggested size of the bitmap in bytes, the width, height and depth. This seems a reasonably comprehensive set of information that might be useful, since we can actually specify the window size directly rather than it always being a defaulted size. It also sets a flag value to indicate that the window exists and avoids redoing it. If the window is already open to a different size, it ought to resize the window programmatically. - main() loses the Setupwindow etc calls and they move into the ioSetDisplayBitmap function. - ioScreenSize() checks the above mentioned flag and returns the open window's size or the savedWindowSize as appropriate.
The image changes are simple as well:- the startup sequence has to be fiddled a little, since we need to check to see if the image wants to run headless very early on; I used the existence of a file called 'beheadless' asa trivial test. I suggest that using one of the vm attribute ids might be useful, since that could be tied to the vm build. Obviously, image code could use a variety of tests with no trouble. Since a headless image won't want a display or cursor or source code (probably) we can branch away from starting them up if running headless and go to some other branch that filesin some code or simply hardcodes some work.
Clearly there would be more complicated work to do to handle notifiers when running headless, but one thing at a time.
If you're interested, I can offer up the code; I'll happily do the C code edits for you as well if you're interested but short on time. I can test W95 (in fact I have indirectly got it running anyway) and Mac but I have no unix machine available to test. tim
Tim,
If you're interested, I can offer up the code; I'll happily do the C code edits for you as well if you're interested but short on time. I can test W95 (in fact I have indirectly got it running anyway)
Did you try any networking code? It depends on having a window for async notification of what is happening. Actually, I had a similar idea, however I wanted to create the window invisible (then notification will work) and only make it visible if it is necessary. Even better, one could just make it visible on any errors encountered.
Andreas
squeak-dev@lists.squeakfoundation.org