[comp.sys.mac.programmer] jGNEFilter stuff

resnick@cogsci.uiuc.edu (Pete Resnick) (03/19/91)

Gee, two postings in one day!

How much damage am I allowed to do in a jGNEFilter routine? Can I move
memory? Can I use registers? Should I be using one at all? Basically,
what things can I do at all, and what are the things least likely to
break under future releases of MacOS?

Thanks,
pr
--
Pete Resnick             (...so what is a mojo, and why would one be rising?)
Graduate assistant - Philosophy Department, Gregory Hall, UIUC
System manager - Cognitive Science Group, Beckman Institute, UIUC
Internet/ARPAnet/EDUnet  : resnick@cogsci.uiuc.edu
BITNET (if no other way) : FREE0285@UIUCVMD

stevec@Apple.COM (Steve Christensen) (03/20/91)

resnick@cogsci.uiuc.edu (Pete Resnick) writes:
>How much damage am I allowed to do in a jGNEFilter routine? Can I move
>memory?

Yes.  GetNextEvent isn't called at interrupt time, so move all the memory
you like (I do).

>Can I use registers?

Yes, but you should put them back the way you found them.  You'll be passed
a pointer to the EventRecord in A1, and the current GetNextEvent() result
in both D0 and at 4(SP) (unless someone else trashed D0), so you should at
least preserve those registers.  Remember that the jGNEFilter hook points
to a chain of procedures, and that other procedures down the chain will expect
everything to be setup the same way you do.  Oh, and since GNE is a toolbox
call, you shouldn't trash anything other than D0-D2 and A0-A1 anyway.

>Should I be using one at all?  Basically, what things can I do at all, and
>what are the things least likely to break under future releases of MacOS?

I guess it depends on what you're planning to do.  As far as I know you can
do pretty much what you like, but remember that GNE gets called *a lot*, so
you shouldn't take up too much time doing whatever this thing is.

What will break?  Beats me.  Knowing how things work around here, the slimier
you are, the more likely you'll break, even on a near-term OS, let alone a
future release...

steve

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Steve Christensen			Never hit a man with glasses.
  stevec@apple.com			Hit him with a baseball bat.