Important: The information in this document is obsolete and should not be used for new development.
Determining if the LAP Manager Is Installed
Before you issue any calls to the LAP Manager, you should check to determine if the LAP Manager is installed on the node that is running your application. The LAP Manager is implemented beginning with AppleTalk version 53. To determine if the
LAP Manager is installed, you can check the low-memory global variableLAPMgrPtr
. However, Apple Computer, Inc. recommends that you use a higher-level method to perform this check, such as the one that the code in Listing 10-1 shows.Listing 10-1 Checking to determine if the LAP Manager is installed
FUNCTION GestaltAvailable: Boolean; CONST _Gestalt = $A1AD; BEGIN GestaltAvailable := TrapAvailable(_Gestalt); END; FUNCTION AppleTalkVersion: Integer; CONST versionRequested = 1; {version of SysEnvRec} VAR refNum: Integer; world: SysEnvRec; attrib: LongInt; BEGIN AppleTalkVersion := 0; {default to no AppleTalk} IF OpenDriver('.MPP', refNum) = noErr THEN {open the AppleTalk driver} IF GestaltAvailable THEN BEGIN IF (Gestalt(gestaltAppleTalkVersion, attrib) = noErr) THEN AppleTalkVersion := BAND(attrib, $000000FF); END ELSE {Gestalt or gestaltAppleTalkVersion selector isn't } { available.} IF SysEnvirons(versionRequested, world) = noErr THEN AppleTalkVersion := world.atDrvrVersNum; END; FUNCTION LAPMgrExists: Boolean; BEGIN {AppleTalk Phase 2 is AppleTalk version 53 and later} LAPMgrExists := (AppleTalkVersion >= 53); END;Here is the declaration for theTrapAvailable
function that the code in
Listing 10-1 calls:
FUNCTION TrapAvailable (theTrap: Integer): Boolean; VAR tType: TrapType; BEGIN tType := GetTrapType(theTrap); IF tType = ToolTrap THEN BEGIN theTrap := BAND(theTrap, $07FF); IF theTrap >= NumToolboxTraps THEN theTrap := _Unimplemented, ToolTrap; END;