About the Gestalt ManagerThe Macintosh family of computers includes models that use a number of different processors, some accompanied by a floating-point unit (FPU) or memory management unit (MMU). Also, a single hardware configuration can have various versions of system software, drivers, and QuickDraw routines.
In general, applications should communicate with the system software and hardware through the available managers and device drivers. However, if your application takes advantage of hardware or software components that may not be present on all Macintosh computers, then you need some mechanism to determine whether those components are available.
Gestaltfunction provides a simple, efficient way to determine the hardware and software configurations so your application can exploit as fully as possible whatever environment it is running in. When your application calls the
Gestaltfunction, your application passes a selector code (or selector) as a parameter to specify the information it needs. Your application can call the
Gestaltfunction to determine
Your application can use the information returned by
- the version and features of QuickDraw
- the versions and features of various other managers and drivers
- the type of floating-point unit (FPU), if any
- the type of memory management unit (MMU), if any
- the amount of available RAM
- the amount of available virtual memory
- the version of the A/UX operating system, if it's running
- the type of keyboard
- the model of computer
- the version number of the System file
- the type of central processing unit (CPU)
Gestaltin various ways. It might branch to alternate code, for example, depending on the version of QuickDraw, or cancel an operation and present an alert box if a critical but optional hardware component is unavailable.
Associated with the
Gestaltfunction are two other functions--one that allows an application to register new features with the Gestalt Manager and another that allows an application to change the function used by
Gestaltto retrieve a particular piece of information. These two functions make it easy for your software to announce its presence to other applications. A debugger, for example, can register itself with the Gestalt Manager during system initialization; afterward, debugging code in an application under development can call
Gestaltto verify that the special routines provided by the debugger are available on the local machine. In this way, the Gestalt Manager can act as a central clearinghouse for information on the available software and hardware features of the operating environment and enhance cooperation and awareness among third-party products.
Gestaltfunction can provide much of the information your application needs, you might still need to call some special-purpose routines supplied by various parts of the system software. To determine the resolution of the main Macintosh screen, for example, you call the
ScreenResprocedure, described in the book Inside Macintosh: Imaging with QuickDraw.
Gestaltfunction has replaced both the
SysEnvironsfunction and the
Gestaltfunction is simpler to use and provides more information than either of those routines. Applications that use
SysEnvironsexecute correctly in system software versions 7.0 and later, in which
SysEnvironsfunction, introduced with the Macintosh SE and Macintosh II computers, fills in and returns a pointer to a system environment record, a data structure that describes some features of the operating environment. The
SysEnvironsfunction cannot provide the detailed information supplied by
Gestaltcan provide objective configuration information such as ROM version and size, but you should not infer the presence or absence of particular hardware or software features from that information. When you need to know whether a feature is present, you should request information about it directly by using the appropriate selector code. ("Getting Information About the Operating Environment" beginning on page 1-6, lists the Apple-defined selector codes for