Gestalt
Gestalt(selector)
Returns information about the Newton system; the type of information returned depends on the value of the selector parameter.
DISCUSSION
- selector
- A constant that specifies the type of information that is returned on the system. The following values are currently allowed:
kGestalt_SystemInfo
,kGestalt_Backlight
,kGestaltArg_HasSoftContrast
, andkGestaltArg_VolumeInfo
.
- return value
- Depends on selector, see DISCUSSION.
The return value of this function depends on the value of selector, as follows:
Slot Descriptions
- If selector is
kGestalt_SystemInfo
, *Gestalt
returns a frame with the following slots:
manufacturer
- An integer indicating the manufacturer of the Newton Device.
machineType
- An integer indicating the hardware type this ROM was built for.
ROMStage
- A decimal integer indicating the language (English, German, French) and the stage of the ROM (alpha, beta, final).
ROMVersion
- A packed integer indicating the major and minor ROM version numbers. You can use the following function to convert this number into an array, containing an integer for the ROM major and minor version numbers:
func (ROMVersionInteger)
begin local minor := BAND(ROMVersionInteger, 0xFFFF); local major := BAND(ROMVersionInteger>>16, 0xFFFF); [ Floor(StringToNumber(BAND(major>>12, 0xF) & BAND(major>>8, 0xF) & BAND(major>>4, 0xF) & BAND(major, 0xF))), Floor(StringToNumber(BAND(minor>>12, 0xF) & BAND(minor>>8, 0xF) & BAND(minor>>4, 0xF) & BAND(minor, 0xF)))] end
- Here is another example of code to test if your Newton is running 2.x. The following expression evaluates to a non-
nil
value if the major version is 2:BAND((*Gestalt(kGestalt_SystemInfo).ROMVersion)>>16, 0xFFFF) = 0x0002
IMPORTANT - Do not assume that if the Newton is running version 2.0 or later that a particular feature exists. You still need to test the Newton to make sure the feature exists.
![]()
- Note
- The
machineType
,ROMStage
andROMVersion
slots provide internal configuration information and should not be relied on.![]()
screenWidth
- An integer representing the width of the screen in pixels. The width takes into account the current screen orientation.
- For example, on the MessagePad 120, because the screen width is 240 and the screen height is 320, in portrait orientation *
Gestalt
returns a width of 240. If the screen is rotated, *Gestalt
returns a width of 320.screenHeight
- An integer representing the height of the screen in pixels.
screenResolutionX
- An integer representing the number of horizontal pixels per inch. For screens with square pixels,
screenResolutionX
equalsscreenResolutionY
. On the MessagePad 120, for example, bothscreenResolutionX
andscreenResolutionY
equal 85.screenResolutionY
- An integer representing the number of vertical pixels per inch.
screenDepth
- The bit depth of the LCD screen. For the MessagePad 120, the LCD supports a monochrome screen depth of 1. The eMate 300 and MessagePad 200 have 4 bit depth LCD screens.
patchVersion
- Returns 0 on an unpatched Newton and nonzero on a patched Newton.
ROMVersionString
- The user-visible string that identifies the version of the installed ROM and the installed patch, if any.
- The first part of the string is a "functionality level" indicating the OS version, such as 1.3, 2.0 or 2.1.
- The second part of the string is a six-digit number in parentheses that is an encoded representation of ROM and system update information.
cpuType
- A symbol specifying the type of CPU, possible values are '
strongArm
,'arm710a
, and'arm610a
.cpuSpeed
- A real indicating the speed of the CPU in megahertz.
- If selector is
kGestalt_Backlight
, *Gestalt
returns eithernil
, indicating the unit does not have backlight hardware, or a one element array. If an array is returned the unique element contains eithernil
or a non-nil
value, indicating whether backlight hardware is present. The following code correctly tests if a unit has a backlight:
local result := Gestalt(kGestalt_Backlight);
if result and result[0] then // unit has backlighting else // unit does not have backlighting
Array Element Descriptions
- If selector is
kGestaltArg_HasSoftContrast
, *Gestalt
returns eithernil
, or a 3 element array of the following form:[hasSoftContrast,
minContrast,
maxContrast]
- hasSoftContrast
True
ornil
depending on whether there is a soft contrast control.
- minContrast
- Integer for the minimum contrast.
- maxContrast
- Integer for the maximum contrast.
You can use the values returned by this selector to set the
LCDContrast
user configuration variable.
Array Element Descriptions
- If selector is
kGestaltArg_VolumeInfo
, *Gestalt
returns eithernil
, or a 7 element array of the following form:[hasInput,
hasOutput,
hardwareVolControl,
headphoneJack,
minAudibleDB,
numDVLevels,
devicesBitfield]
- hasInput
True
ornil
depending on whether the device can support sound input.- hasOutput
True
ornil
depending on whether the device can support sound output.- hardwareVolControl
True
ornil
depending on whether the device has a hardware volume control.- headphoneJack
True
ornil
depending on whether the device has a built-in headphone jack.- minAudibleDB
- An integer, the minimal decibel level for output. The MessagePad 2000 is set to -31.9760.
- numDVLevels
- An integer, the number of levels between minAudibleDB and 0. The dB increment per level is minAudibleDB
/numDVLevels.
The MessagePad 2000 is set to 14.- devicesBitfield
- A packed integer with information about the built-in sound devices. This integer contains the summation of the applicable device constants. Device constants are described in "Device Constants" in Chapter 7, "Sound." The two important ones are
kInternalSpeaker
andkInternalMic
.- The following function returns
nil
/ non-nil
if the current device has an internal microphone (usekInternalSpeaker
to check for an internal speaker):COMPATIBILITYHasMic := func()
begin local volInfo := Gestalt(kGestaltArg_VolumeInfo) ; return volInfo AND (BAND(volInfo[6], kInternalMic) <> 0); end
The
kGestalt_Backlight
andkGestaltArg_VolumeInfo
selectors are not supported on 2.0 devices.
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help