Path: utzoo!news-server.csri.toronto.edu!rutgers!uwm.edu!spool.mu.edu!sol.ctr.columbia.edu!ira.uka.de!smurf!urlichs From: urlichs@smurf.sub.org (Matthias Urlichs) Newsgroups: comp.sys.mac.programmer Subject: Re: Whaddya do in ioCompletion routine? Message-ID: <0d-#h2.1v1@smurf.sub.org> Date: 10 Mar 91 02:11:17 GMT References: <63044@bbn.BBN.COM> <15951@hoptoad.uucp> Organization: University of Karlsruhe, FRG Lines: 27 In comp.sys.mac.programmer, article <15951@hoptoad.uucp>, tim@hoptoad.UUCP (Tim Maroney) writes: < < It's best not to use A5 if you can help it. I prefer to stuff an < unused field of the parameter block with a pointer to some data area < which may be used by the request. [...] To be safe, don't rely on any fields being unused (sometimes the ROM does some really weird things with your parameter blocks) but instead declare a structure like this: struct myPB { HParamBlockRec PB; // or whatever struct myGlobals *Globals; // anything }; This method also comes in handy when you have to do some pseudo-multitasking. For instance, in my SingleShare server there are three pointers to globals in SingleShare's moral equivalent of this structure; one to global state, one for user-related state and one for the state of the current command. You can also have more than one parameter block in there, but in that case you'll have to do some pointer arithmetic. (Beware -- said arithmetic may conceivably trash the A0 pointer you want to get, so better use a temporary variable.) -- Matthias Urlichs -- urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de /(o\ Humboldtstrasse 7 - 7500 Karlsruhe 1 - FRG -- +49-721-621127(0700-2330) \o)/