joe@uw-warp.UUCP (Joe E. Meadows) (03/13/88)
It seems to me that the easiest way to do things would be to go with a library - any cooperating program would simply have to do OpenLibrary() and then call routines in the library which would replace the CreatePort DeletePort PutMsg and Getmsg routines with routines like CreateSharedPort, DeleteSharedPort, PutSharedMsg, and GetSharedMsg. The library would then handle the cases where process A is trying to PutSharedMsg to process B's message port after process B has already done a DeleteSharedPort. The library could contain an array of available shared ports, with a sequence count associated with each array element, i.e. struct PortInfo { struct Port *port; short int sequence } ports[255]; A call to CreateSharedPort would call the real CreatePort, save the address in the array and return an index into this array, and the sequence number. When DeleteSharedPort gets called (with the index and sequence number) the real sequence number could be compared with the one in the array (thus making sure its not bogus) and then the real DeletePort gets called and the sequence number at that array index would get incremented (looping back to zero when the short int overflowed). The GetSharedMsg and PutSharedMsg routines would also get passed the index and sequence number and would easily be able to test to be sure the port was still valid before doing a real GetMsg and PutMsg (by comparing the passed sequence number with the sequence number stored in the array). Okay, so much for hand waving about the low level stuff.. The high level stuff should be much more interesting.. One could use the paradigm of offering services (Hi, I'm an ILBM Editor program), or of sending 'multicast' requests (Hi I need an ILBM editor). This of course could be implemented in the library as well, i.e. DeclareService() or RequestService(), PutSharedMsgMulticast(). There are many other possibilities of course, but in any case, I thought I'd just point out that whatever methodology used, we would need a way to say "Hey, if no one can handle request X load up program Y, because that program can handle it", so that a user could create a default environment like "I use DPAINT for such and such, DIGIPAINT for something else, Soundscape for this Midi stuff" and so forth. It would be quite nice if the utilities got loaded automatically, rather than the user getting a message like "Hey, you want me to SPELL check this buffer but there isn't any SPELL program loaded! Please load on and try again!!" Of course, that could be a valid last step (i.e. if there isn't a default specified). Well, these wild ramblings brought courtesy of Joe Meadows joe@fhcrcvax.bitnet uw-beaver!uw-nsr!uw-warp!joe (is that right?)