Path: utzoo!attcan!uunet!husc6!uwvax!oddjob!tank!nucsrl!bob From: bob@eecs.nwu.edu (Bob Hablutzel) Newsgroups: comp.sys.mac.programmer Subject: Re: Multifinder: how do I patch GetNextEvent? Message-ID: <10050030@eecs.nwu.edu> Date: 14 Oct 88 13:29:31 GMT References: <747@ttrdf.UUCP> Organization: Northwestern U, Evanston IL, USA Lines: 55 > In article <10050025@eecs.nwu.edu> bob@eecs.nwu.edu (Bob Hablutzel) writes: > >>What I'm still trying to figure out is this: Why does Apple persist in > >>forbidding a very useful type of patch? > > > >The reason is that > [very lucid explanation not repeated here.] > > Thank you, Bob. Now I understand. But I still don't like it :-( You're welcome. > There are some traps (like GetNextEvent) which are usefully patched at > the end. There are lots of people (like me) who want to accomplish something > that can only be accomplished by tail patching this trap. So our application > works today, but may someday cause strange failures in other areas. Well, there actually is another way, if you don't mind getting your feet a little wet (assembler, or at least glue routines). There exists a low memory global variables jGNEFilter, which, if not nil, contains the address of a function to call before returning from _GetNextEvent. _GetNextEvent calls the routines with A1 (I think) pointing to the event record for the _GetNextEvent call. You can play with this record in any way you like. > As I understand it (now), the only traps which must not be tail patched are > those which: > 1. Are relatively small, and > 2. Are called from other (bigger) traps. This seems right to me, although one can never tell. We may be missing something. But, like I say, it seems right. > Is it thus possible for Apple to classify traps according to these criteria, > and to declare some traps as safe for tail patching? I would hope that > GetNextEvent could be declared safe. Anyone from Apple want to comment on > this issue? While it may be possible, I doubt Apple will do it. They have to leave their options open. > I guess it's unavoidable, but it's still annoying that subtle new rules keep > popping up, documented in obscure places: > 1. Avoid tail patches. > 2. Call GetNextEvent three or four times before opening a window. > 3. Don't use the application events for application events. Did I miss something? I thought the only application event retroactively nonexistant was APP4. (Personally, I don't know why Apple didn't take over network events for multifinder events, since network events don't exist anymore anyhow. Sigh). But, like you say, the documentation is sometimes obscure. :-) Bob Hablutzel BOB@NUACC.ACNS.NWU.EDU