home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-25 | 1.4 KB | 53 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: Environs.cpp
- // Release Version: $ ODF 1 $
- //
- // Author: Greg Friedman
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef ENVIRONS_H
- #include "Environs.h"
- #endif
-
- #ifndef __GESTALT__
- #include <Gestalt.h>
- #endif
-
- #ifndef __OSA__
- #include <OSA.h>
- #endif
-
- //----------------------------------------------------------------------------------------
- // HasGestaltAttribute
- //----------------------------------------------------------------------------------------
-
- FW_Boolean HasGestaltAttribute(OSType itsAttr, short itsBit)
- {
- long response;
- return (Gestalt(itsAttr, &response) == noErr) && (((response >> itsBit) & 1) != 0);
- }
-
- //----------------------------------------------------------------------------------------
- // HasAppleScript
- //----------------------------------------------------------------------------------------
-
- FW_Boolean HasAppleScript()
- {
- static FW_Boolean checked = FALSE;
- static FW_Boolean hasFeature = FALSE;
-
- if (!checked)
- {
- hasFeature = HasGestaltAttribute(gestaltAppleEventsAttr, gestaltScriptingSupport);
- hasFeature &= ((Ptr)OSALoad != (Ptr)kUnresolvedCFragSymbolAddress);
- checked = TRUE;
- }
-
- return hasFeature;
- }
-
-