Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!ucbvax!dewey.soe.berkeley.edu!oster From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: best way to detect command-. interrupt? Message-ID: <33405@ucbvax.BERKELEY.EDU> Date: 30 Dec 89 04:04:29 GMT References: <694@nems.dt.navy.mil> <33392@ucbvax.BERKELEY.EDU> <9421@hoptoad.uucp> <4539@helios.ee.lbl.gov> <9428@hoptoad.uucp> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 32 It is beginning to sound like what we need is an INIT that launches a command-period driver. The command-period driver would patch the PostEvent trap before multi-finder is installed. Applications interested in command-periods would register a callback address with the driver using a control call, inform the driver of suspend and resume events, using a second control call, and de-register the callback before they quit. If a command period occurs, then the keyboard handler will call PostEvent, the command-period driver will detect it. If the last suspend/resume message was a "resume" the driver will assume that one of the registered applications was frontmost, remove the command-period from the queue, and call the callback address. Otherwise, it will assume an unknown application is frontmost and do nothing. Since the callback address is being called at interrupt time, there is a problem accessing the application's globals. We'll have the command-period driver cache the application's currentA5 when the application registers the callback, and the driver will setup A5 before calling the callback, and restore it afterward. Since the callback address is being called at interrupt time, the callback is limited in what it can do: it can't move memory or make most system calls. It could set a flag, or do a C longjump. If you do a longJump, your ongJump catcher should set a flag that your event loop should check, so that when your event loop next runs, it can execute a cleanup routine to cleanup any structures that were not properly deallocated by the longjump. --- David Phillip Oster -- No, I come from Boston. I just work Arpa: oster@dewey.soe.berkeley.edu -- in cyberspace. Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu