Xref: utzoo comp.sys.mac.programmer:5485 comp.sys.mac.hypercard:1793 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!dartvax!eleazar.dartmouth.edu!earleh From: earleh@eleazar.dartmouth.edu (Earle R. Horton) Newsgroups: comp.sys.mac.programmer,comp.sys.mac.hypercard Subject: Re: XFCN/XCMD string in MPW C v3.0 Message-ID: <12964@dartvax.Dartmouth.EDU> Date: 8 Apr 89 18:46:26 GMT References: Sender: news@dartvax.Dartmouth.EDU Reply-To: earleh@eleazar.dartmouth.edu (Earle R. Horton) Followup-To: comp.sys.mac.programmer Organization: Thayer School of Engineering Lines: 27 In article wb1j+@andrew.cmu.edu (William M. Bumgarner) writes: >I'm in the process of converting a set of XFCN's from LSC to MPW C v3.0. > >The LSC code contained inline assembly to set-up and restore the A4 register >so that global (?) strings could be used... > >Something similar must be required in MPW C v3.0, but is A4 valid? Should I >use the same inline code (code that worked under a different environment)? > There is no way to implement global variables in non-application code resources created using MPW C. You will have to find an alternate means of storing this information. I suggest putting everything in a data structure, and passing the pointer to the data structure down your function chain. Strings which are considered constant, you might want to store in a 'STR#' resource. Using A4 as a base for global variables is a hack, anyway. There are situations I know of which will invalidate A4, making your global variables useless. (Dialog filter procs, for example.) There is a package on sumex which you might find useful, /info-mac/hypercard/xfcn-xcmd-glue.hqx. It contains source for a bunch of hypercard XCMDs implemented in MPW C and MPW Pascal. Earle R. Horton Graduate Student. Programmer. God to my cats.