home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-05-03 | 4.1 KB | 114 lines | [TEXT/MPS ] |
- (* ****************************************************************
-
- HasFPUICnd.p
- Written in MPW Pascal by Darryl Lovato (dgl)
- and Jim Merritt (jam).
-
- Copyright © 1993 Aladdin Systems, Inc.
- All Rights Reserved.
-
- In combination with the associated make file
- (HasFPUICnd.make), this source text produces an ICnd
- installer extension, which can be called by a Product
- Installer during the installation process. Specifications
- for IBeg, IMid, ICnd, and IEnd extensions are given in the
- documentation for StuffIt InstallerMaker™.
-
- This subroutine performs the following function:
-
- • Returns 0 (i.e., install the associated item) if (Custom
- Condition Bits 0 and 1 are both off or both on).
- • Returns 1 (i.e., do NOT install the associated item) if
- (Custom Condition Bit 0 is on) AND (FPU is NOT present)
- or if (Custom Condition Bit 1 is on) AND (FPU is present).
-
- Note that the Gestalt feature of InstallerMaker 2.0 makes
- it possible to check this condition without using an
- InstallerMaker extension. However, if you must check
- several conditions at once, you may want to use a combination
- of the built-in Gestalt feature and an ICnd routine that
- checks other Gestalt conditions. In such situations, you
- may use this routine as your model.
-
- CHANGE HISTORY:
-
- VER DATE ENGR DESCRIPTION
- 1 93.06.21 dgl Prototype version.
- 2 93.06.23 jam Added commentary, modified style to
- match other source files in the
- InstallerMaker suite, increased
- portability across various Pascal
- compilers, and rearranged logic to
- provide for "care/don't care"
- interpretation of custom condition
- bit 0 setting in the installermaker
- archive window.
- 3 93.11.10 jam Fixed sense of Gestalt result check.
- 4 94.03.14 jam Modified CustomConditionCheck to observe
- new packages parameter.
- 5 94.03.23 jam Modified CustomConditionCheck to use
- two flags, one for "install this only if
- FPU Present," and the other for "install
- this only if FPU NOT present."
- Also added NeedsFPU and NeedsNoFPU
- constants.
- ****************************************************************** *)
-
- (*$Z+*) (* Allows linker to find CustomConditionCheck without declaring it
- in the interface *)
- UNIT ICnd;
-
- INTERFACE
-
- IMPLEMENTATION
-
- USES
- Types,
- GestaltEqu;
-
- FUNCTION CustomConditionCheck(theFlags : INTEGER;
- packages: INTEGER): INTEGER;
- (* Bit 0, 1, and 2 in theFlags are passed from the installer.
- Return 0 to install the item, and 1 to NOT install the item.
- *)
- CONST
- CCBit0= $0001;
- CCBit1= $0002;
- CCBit2= $0004;
-
- OKToContinue= 0; (* Return value to install the current item. *)
- SkipThisItem= 1; (* Return value to skip the current item. *)
-
- (* In the InstallerMaker archive window, setting custom-condition
- flag bit 0 implies that we care about an FPU, and that the
- associated item will only be installed if an FPU is present.
- Setting custom-condition flag bit 1 implies that we care about
- an FPU, and that the associated item will only be installed if
- an FPU is NOT present. Setting both bits is a contradiction,
- but we will interpret it as meaning that the associated item will
- be installed for all cases.
- *)
- NeedsFPU= CCBit0;
- NeedsNoFPU= CCBit1;
-
- VAR
- err: INTEGER;
- result: LongInt;
- BEGIN (* CustomConditionCheck *)
- (* Install the item unless we determine otherwise. *)
- CustomConditionCheck := OKToContinue;
- IF ((BAND(NeedsFPU+NeedsNoFPU,theFlags) <> 0)
- AND (BAND(NeedsFPU+NeedsNoFPU,theFlags) <> (NeedsFPU+NeedsNoFPU))) THEN
- BEGIN (* One of the two flag bits was set, so we care about FPU *)
- IF (Gestalt(gestaltFPUType, result) = noErr) THEN
- (* Gestalt worked, so we can check for FPU *)
- BEGIN
- IF (result = gestaltNoFPU) THEN
- CustomConditionCheck := SkipThisItem;
- END
- ELSE (* Assume no Gestalt = No FPU *)
- CustomConditionCheck := SkipThisItem;
- END (* IF We care about FPU *);
- END (* CustomConditionCheck *);
-
- END (* ICnd *).