Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!mm3d+ From: mm3d+@andrew.cmu.edu (Matt McNally) Newsgroups: comp.sys.mac.programmer Subject: Re: determining if MF is running... Message-ID: Date: 1 Dec 89 14:58:36 GMT References: <64583@tiger.oxy.edu> Organization: Computing Systems, Carnegie Mellon, Pittsburgh, PA Lines: 81 In-Reply-To: <64583@tiger.oxy.edu> For those of you who don't have access to the "Programmers Guide To MultiFinder" here are some MPW Pascal Code segments that will check for the existance of MF functionality and a few simple functions that use them. These were basically extracted from some examples found in the aforementioned 'Guide'. Hope they help. -Matt ------ Function TrapAvailable(trapNum:Integer; tType: TrapType):Boolean; { *** TrapAvailable ***: This routine verifies the existance of a 'trap'. } Const BadTrap = $A89F; Begin TrapAvailable := (NGetTrapAddress(trapNum,tType) <> GetTrapAddress(BadTrap)); End; { ~ of Function TrapAvailable } Function MFMemIsAvail:Boolean; { *** MFMemIsAvail ***: This function returns true if MF Memory Calls are available. Note: No need to check for seperate trap tables since memory calls are OS Traps. } Const MemTrap = $A88F; Begin MFMemIsAvail:= TrapAvailable(MemTrap,ToolTrap); End; { ~ of Function MFMemIsAvail } Function WNEIsAvail:Boolean; { *** WNEIsAvail ***: Returns true if WaitNextEvent() is available.} Const WNEvtTrap = $A860; Var tmpErr: OSErr; tmpEnv: SysEnvRec; Begin tmpErr:=SysEnvirons(1,tmpEnv); if tmpEnv.machineType<0 Then WNEIsAvail:=False Else WNEIsAvail:=TrapAvailable(WNEvtTrap, ToolTrap); End; { ~ of Function WNEIsAvail} Function MacMemTotal:Integer; { *** MacMemTotal ***: Returns the total memory (in K ) available on the machine, NOT the total available to the application.} Begin If MFMemIsAvail then MacMemTotal:=(Ord4(MFTopMem) div 1024) Else MacMemTotal:=(Ord4(TopMem) div 1024); End; { ~ of Function MacMemTotal} =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Matt M. McNally - 'Macintosh II Project' Research Programmer/Dugan Carnegie Mellon, H&SS Dean's Office, Pittsburgh, PA 15213 Office: Baker Hall 369-B, (412) 268-6990 ARPANET Address: mm3d@andrew.cmu.edu =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=