Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcdc!hpislx!bayes From: bayes@hpislx.HP.COM (Scott Bayes) Newsgroups: comp.sys.mac Subject: Re: Real Multifinder (was Re: Hey Apple Mac engineers, answer->Ma) Message-ID: <5880013@hpislx.HP.COM> Date: 17 Aug 89 15:06:53 GMT References: <24626@iuvax.cs.indiana.edu> Organization: HP Measurement Systems Operation - Loveland, CO Lines: 40 > So much code has been written for the Macintosh which works without > callbacks, making it unlikely that future versions of the system will take > advantage of callbacks. But, if Apple could figure out a way of making both > systems work, then future programmers would be spared a great deal of pain. > One way to achieve this (callback with main event loop compatibility) may be to provide the callback with a boolean return variable, with some name like "continue". The callback gets first crack at the event, with the system running its own "main event loop". The system sets continue to TRUE and calls the callback for the event. If the callback wants to handle it, it sets continue to FALSE, processes the event and returns. In odd circumstances (such as remapping a key or mouseclick), it may process the event, but leave continue TRUE. If continue is TRUE on return from the callback, the event stays in the queue, and is seen by old application main event loop code, thus maintaining compatibility. At bootup, the system installs dummy routines in all callbacks. The dummies' only jobs are to return, leaving continue TRUE, ensuring that code that doesn't install callbacks runs in main event loop mode. The dummies are replaced by new applications (or INITs, whatever) that want to use callbacks through a system procedure call, and are restored by the system when the callback is removed, again by a system procedure; no global access allowed here! (This maps fairly well onto the operations used in the OS I worked on for >5 years, in which _everything_ is hooked together in this fashion.) Scott Bayes for a good time, call back! >+----------------------------------------------------+-------------------------+ >|There is a club if you would like to go. | Edan Kabatchnik | >|You could meet somebody who really loves you. +-------------------------+ >|So you go, and you stand on your own. | MIT | >|And you leave on your own. | enk@wheaties.ai.mit.edu | > |And you go home, and you cry, and you want to die. |Schlumberger Technologies| >| - The Smiths | enk@slcs.slb.com | >+----------------------------------------------------+-------------------------+ ----------