Please consider a donation to the Higher Intellect project. See https://preterhuman.net/donate.php or the Donate to Higher Intellect page for more info.

Gestalt Manager

From Higher Intellect Vintage Wiki
Jump to navigation Jump to search

The 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.

The Gestalt function 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 Gestalt function, your application passes a selector code (or selector) as a parameter to specify the information it needs. Your application can call the Gestalt function to determine

  • 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)

Your application can use the information returned by Gestalt in 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 Gestalt function 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 Gestalt to 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 Gestalt to 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.

Although the Gestalt function 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 ScreenRes procedure, described in the book Inside Macintosh: Imaging with QuickDraw.

The Gestalt function has replaced both the SysEnvirons function and the Environs procedure. The Gestalt function is simpler to use and provides more information than either of those routines. Applications that use SysEnvirons execute correctly in system software versions 7.0 and later, in which SysEnvirons calls Gestalt.

The SysEnvirons function, 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 SysEnvirons function cannot provide the detailed information supplied by Gestalt.

Like the SysEnvirons function, Gestalt can 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.

See Also