Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!nrl-cmf!ukma!rutgers!att!pegasus!ech From: ech@pegasus.ATT.COM (Edward C Horvath) Newsgroups: comp.sys.mac.programmer Subject: Re: MFTemp calls in LSC? Message-ID: <2704@pegasus.ATT.COM> Date: 17 Mar 89 04:08:42 GMT References: <1426@husc6.harvard.edu> Distribution: usa Organization: AT&T ISL Middletown NJ USA Lines: 97 In article <28414@ucbvax.BERKELEY.EDU> carlton@ji.Berkeley.EDU (Mike Carlton) writes: >Can anyone tell me if the Multifinder temporary memory allocation routines >have been implemented yet in LSC? They've existed for at least a year, but >LSC 3.01p4 doesn't recognize MFTempNewHandle or any of the other new routines >I've tried. From article <1426@husc6.harvard.edu>, by siegel@endor.harvard.edu (Rich Siegel): > They don't seem to be in any of the headers or libraries; they'll > probably be in the next release. In the meantime, your own glue should work > OK. You're a prince, Rich; for those without access to MPW source this is a tad difficult to manage. Herewith an extract from Aztec C's Memory.h (ca 3-88): ------ cut here ------ /* MultiFinder dispatch trap */ #define OSDISPATCH 0xA88F /* Routine selector values */ #define mfMaxMemSel 21 #define mfFreeMemSel 24 #define mfTempNewHandleSel 29 #define mfTempHLockSel 30 #define mfTempHUnLockSel 31 #define mfTempDisposHandleSel 32 #define MFMaxMem(grow) \ cMFMaxMem(grow,mfMaxMemSel) #define MFFreeMem() \ cMFFreeMem(mfFreeMemSel) #define MFTempNewHandle(logicalSize,resultCode) \ cMFTempNewHandle(logicalSize,resultCode,mfTempNewHandleSel) #define MFTempHLock(h,resultCode) \ cMFTempHLock(h,resultCode,mfTempHLockSel) #define MFTempHUnLock(h,resultCode) \ cMFTempHUnLock(h,resultCode,mfTempHUnLockSel) #define MFTempDisposHandle(h,resultCode) \ cMFTempDisposHandle(h,resultCode,mfTempDisposHandleSel) pascal long cMFMaxMem( /* long *grow, short SW */ ) = OSDISPATCH; pascal Size cMFFreeMem( /* short SW */ ) = OSDISPATCH; pascal Handle cMFTempNewHandle( /* unsigned long logicalSize, short *resultCode, short SW */ ) = OSDISPATCH; pascal void cMFTempHLock( /* Handle h, short *resultCode, short SW */ ) = OSDISPATCH; pascal void cMFTempHUnLock( /* Handle h, short *resultCode, short SW */ ) = OSDISPATCH; pascal void cMFTempDisposHandle( /* Handle h, short *resultCode, short SW */ ) = OSDISPATCH; --- end extract --- When I put this into an LSC 3.01p4 window and punched cmd-Y it generated no diagnostics; I presume that means All OK (I did NOT attempt to actually use any of this with LSC). Remove the /* and */ in the cXXX definitions to create appropriate prototypes. In any event, you can use this info to generate appropriate glue. As a simple (untested) example, you might implement MFTempHLock as: pascal void MFTempHLock (h, resultCode) Handle h; short *resultCode; { asm { move.l (sp)+,a0 ; save return address move.w #30,-(sp) ; routine selector move.l a0,-(sp) ; replace return address dc.w 0xAC8F ; OSDISPATCH + AUTOPOP } } The others differ only in the selector used. The advantage of the #define hacks above is that they (should) generate all the code inline, saving the overhead of the jsr and the shenanigans in the sample glue. Good luck, =Ned Horvath= Disclaimer: I don't work for Manx any more. I'll use whatever compiler (including LSC) gets me through the night...