Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!bu-cs!dartvax!eleazar.dartmouth.edu!earleh From: earleh@eleazar.dartmouth.edu (Earle R. Horton) Newsgroups: comp.sys.mac.programmer Subject: Re: XFCN/XCMD string in LSC C v3.0 Summary: Problem solved! Message-ID: <13204@dartvax.Dartmouth.EDU> Date: 25 Apr 89 04:06:15 GMT References: <2442@ogccse.ogc.edu> <2823@pegasus.ATT.COM> Sender: news@dartvax.Dartmouth.EDU Reply-To: earleh@eleazar.dartmouth.edu (Earle R. Horton) Organization: Thayer School of Engineering Lines: 41 I have a nifty way to solve this problem once and for all, but it requires the cooperation of the host application developer. This won't help you at all if you want to write 'XCMD' resources for the present version of HyperCard, but may help if you are writing a host application for which you are designing the code resource interface. Application writer: Arrange to have in your A5-relative global space an unused area of storage, located at the top of the global area and just below register A5. You can do this with the MPW and Aztec linkers by having an array of whatever size which is (a) declared in your last-mentioned object file on the link line and (b) referenced but not modified in your source code. While linking your program, arrange to have a link map produced, and verify that the unused area of storage is, indeed, at the top of the global data area. Included in the specifications for your code resource type the size of the free area below A5. Custom code resources produced for use with your application will use the area below A5 as their own private global area, and will reference it normally with negative short offsets off of A5. These may initialize their global data in the "normal" manner, i.e. the same method used for application code, when you call them. Make it extremely clear that anyone who uses more A5-relative data space than this will crash your application. The idea here is that the APPLICATION WRITER, when he designs the program at the start, specifically allows for an area of memory which can be used by custom code resources to implement A5-relative global data. (Your application uses the area below this for its own globals.) The code resource globals are even available from within Dialog FilterProcs! (Yes, I have this working in a program, and I am using global variables, A5-relative string constants, A5-relative floating point contstants, and all kinds of stuff like that from within my custom code resources.) Earle R. Horton Graduate Student. Programmer. God to my cats.