Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!apple!well!wdh From: wdh@well.UUCP (Bill Hofmann) Newsgroups: comp.sys.mac.programmer Subject: Re: Standard File and Desk Accessories Message-ID: <12068@well.UUCP> Date: 8 Jun 89 14:14:52 GMT References: <50967@tut.cis.ohio-state.edu> <7547@hoptoad.uucp> <4972@umd5.umd.edu> <51276@tut.cis.ohio-state.edu> <4975@umd5.umd.edu> Reply-To: wdh@well.UUCP (Bill Hofmann) Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 22 In article <4975@umd5.umd.edu> zben@umd5.umd.edu (Ben Cranston) writes: >Re: using one of the development packages that implements local variables for >DAs and other data-less code resources by using A4 as an ersatz global pointer. > >Standard File saves A4 on entry and uses it to point to other things! For >much of the routine it points to the SFReply record, however several of the >subroutines save it and use it for local purposes! > >Therefore it would not work to access DA globals from hook routines... Not so. I've been using a4 in standard file hooks and dialog filter procs for years. All one has to do is save a4 first, then restore at completion. Really, folks, it's a solved problem, at least in any environment other than MPW. Lightspeed makes it quite easy, with SetUpA4() and RestoreA4(), and Manx (typically for Manx) requires a bit of hacking, but look at the sample code in the explorer da, and generalize the save and restore routines. Note that the Dialog manager uses A4 when it calls user item routines (another gotcha). -Bill Hofmann Flashpoint