Gestalt (Mac OS)
Encyclopedia
Gestalt was the name of a system call
introduced into the Apple Macintosh operating system
System Software 6.0.4 in 1989 to allow applications to dynamically query what capabilities were present in the running system configuration.
By this time, the pace of Mac development had produced such a proliferation of hardware configurations and hardware and software add-ons from Apple and third parties that a simple version check was no longer enough to determine the features of the system. Instead, Gestalt maintains a dynamically-extensible table of OSType
selector codes.
For instance, instead of checking the system version to deduce what version of the Sound Manager
might be present, there is a separate Gestalt selector for directly querying the capabilities of the Sound Manager. Thus, it could be made possible for an application
dependent on capabilities introduced in a newer Sound Manager to run on an older system which had the updated Sound Manager installed as an add-on, as well as on a newer system which had the new Sound Manager built-in. And of course the Sound Manager add-on could also query this Gestalt selector first to decide whether there was any point in installing itself into the current system.
The value returned by querying a selector code is 32 bit
s, whose meaning depends on the selector. Some selectors define this as a version code, while others use it as a bit mask of available capabilities. Some subsystems define both types of selectors, allowing querying of both the version number and the capabilities. Some even use a Gestalt selector to pass the address of a shared block of data, or even the address of code that could be called. Since the piece of code that installed a Gestalt selector could either install a simple static value or a callback
that Gestalt would invoke every time somebody queried the selector, it was possible for the value returned to vary dynamically from call to call, to reflect information about the current state of the subsystem.
The Macintosh Programmer's Workshop
also provided a tool named Gestalt which allowed the developer to test for various features using the command line.
is a school of psychology that attempts to describe the whole of mental activity by analyzing its parts, and is often associated with the phrase "The whole is different than (or "more than") the sum of its parts". In the German language
, this word means shape.
System call
In computing, a system call is how a program requests a service from an operating system's kernel. This may include hardware related services , creating and executing new processes, and communicating with integral kernel services...
introduced into the Apple Macintosh operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...
System Software 6.0.4 in 1989 to allow applications to dynamically query what capabilities were present in the running system configuration.
By this time, the pace of Mac development had produced such a proliferation of hardware configurations and hardware and software add-ons from Apple and third parties that a simple version check was no longer enough to determine the features of the system. Instead, Gestalt maintains a dynamically-extensible table of OSType
OSType
OSType is the name of a four-byte sequence commonly used as an identifier in Mac OS. While the bytes can have any value, they usually display figures characterized in software programs such as those utilized in ASCII or Mac OS Roman character sets.OSType values are used to identify file data...
selector codes.
For instance, instead of checking the system version to deduce what version of the Sound Manager
Sound Manager
The Sound Manager is a part of the classic Apple Macintosh operating system, in Mac OS. It is used to control the production and manipulation of sounds on Macintosh computers. The Sound Manager is also used by other parts of the Macintosh system software that produce sounds, such as the Speech...
might be present, there is a separate Gestalt selector for directly querying the capabilities of the Sound Manager. Thus, it could be made possible for an application
Application software
Application software, also known as an application or an "app", is computer software designed to help the user to perform specific tasks. Examples include enterprise software, accounting software, office suites, graphics software and media players. Many application programs deal principally with...
dependent on capabilities introduced in a newer Sound Manager to run on an older system which had the updated Sound Manager installed as an add-on, as well as on a newer system which had the new Sound Manager built-in. And of course the Sound Manager add-on could also query this Gestalt selector first to decide whether there was any point in installing itself into the current system.
The value returned by querying a selector code is 32 bit
Bit
A bit is the basic unit of information in computing and telecommunications; it is the amount of information stored by a digital device or other physical system that exists in one of two possible distinct states...
s, whose meaning depends on the selector. Some selectors define this as a version code, while others use it as a bit mask of available capabilities. Some subsystems define both types of selectors, allowing querying of both the version number and the capabilities. Some even use a Gestalt selector to pass the address of a shared block of data, or even the address of code that could be called. Since the piece of code that installed a Gestalt selector could either install a simple static value or a callback
Callback (computer science)
In computer programming, a callback is a reference to executable code, or a piece of executable code, that is passed as an argument to other code. This allows a lower-level software layer to call a subroutine defined in a higher-level layer....
that Gestalt would invoke every time somebody queried the selector, it was possible for the value returned to vary dynamically from call to call, to reflect information about the current state of the subsystem.
The Macintosh Programmer's Workshop
Macintosh Programmer's Workshop
Macintosh Programmer's Workshop or MPW, is a software development environment for the Classic Mac OS, written by Apple Computer. For Macintosh developers, it was one of the primary tools for building applications for System 7.x and Mac OS 8.x and 9.x. Initially, MPW was sold as a commercial product...
also provided a tool named Gestalt which allowed the developer to test for various features using the command line.
Origin of the name
GestaltGestalt psychology
Gestalt psychology or gestaltism is a theory of mind and brain of the Berlin School; the operational principle of gestalt psychology is that the brain is holistic, parallel, and analog, with self-organizing tendencies...
is a school of psychology that attempts to describe the whole of mental activity by analyzing its parts, and is often associated with the phrase "The whole is different than (or "more than") the sum of its parts". In the German language
German language
German is a West Germanic language, related to and classified alongside English and Dutch. With an estimated 90 – 98 million native speakers, German is one of the world's major languages and is the most widely-spoken first language in the European Union....
, this word means shape.