Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


Gestalt

Tool

SYNTAX

Gestalt [selector1] [selector2]… [-addr] [-attr] [-c] [-e] [-env] [-h]
[-k] [-p] [-s] [-sel[ector[s]]] [-size] [-slots] [-t n] [-type] [-t1 n]
[-vers] [-w n]

DESCRIPTION

The Gestalt tool generates numerical codes in response to the specified Gestalt selectors or selector aliases. These selectors correspond to features of the operating environment, allowing you to determine which software and hardware features are available for your program's use. To do this, Gestalt uses the Gestalt Manager, available with System 7.

In addition to retrieving Gestalt responses under the default behavior, Gestalt allows you to do such things as

limit selectors to those of a specified type (-addr, -attr, -size, -type, -vers)

retrieve information on all active slots in the target machine (-slots)

change the response output from numerical codes to the number of bits in the responses (-c), hexadecimal numbers (-h), or strings (-s)

change the format of the output to include more information (-k or -sel[ector[s]]) or insert tabs or spaces (-t, -t1, or -w)

use the SysEnvirons function instead of the Gestalt Manager to retrieve information on the specified selectors (-env)

Note
All the selectors supported by the Gestalt tool are contained as a database in the tool's resource fork. The resource has the special type 'gstl' and can be modified to add additional selectors to the database. You can edit the 'gstl' resource using a resource editor such as ResEdit. A 'TMPL' resource is also included, and contains a complete description of how to edit the database. •

INPUT

Gestalt selectors or their corresponding aliases (selector1 [selector2]…).

OUTPUT

Standard output. The Gestalt tool writes each selector's title with its value. You can control the spacing between the value and its title by using -t, -t1, or -w.

If you specify one or more selectors (selector), Gestalt provides this information for those selectors only. If you do not specify any selectors, Gestalt generates information on all selectors.

If you specify only one selector, Gestalt writes only the value of the specified selector, although you can use -k or -sel[ector[s]] to override this.

STATUS

Gestalt can return the following status codes:

0

no errors

1

syntax error

2

execution error

3

invalid selectors skipped (-e)

PARAMETERS

[selector1] [selector2]…

Specifies one or more Gestalt selectors or their corresponding aliases. Selectors are case-sensitive four-character strings. If a selector contains fewer than four characters, you must supply blanks to pad the string (for example, 'os  ').

In addition, each selector has one or more aliases that you can specify instead of the selector. Unlike selectors, these aliases are not case sensitive and are of arbitrary length.

The following tables contain a complete list of the selectors and their aliases that are supported by Gestalt. Note that the first alias for each selector is the title used to identify it in the output (see "Output"). Although you can use this alias to specify the selector on the command line, it is suggested that you use one of the other aliases or the selector itself.

Table 1: Environmental selectors and their aliases

Selector

First alias--"Title"

Second alias

Third alias

'a/ux'

Unix version

UnixVersion

Unix

'addr'

32-bit addressing

Addressing

32BitAddressing

'alis'

AliasMgr

Alias

 

'atlk'

AppleTalk version

AppleTalkVersion

AppleTalk*

'BSDa'

CloseView attributes

CloseViewAttr

 

'cfrg'

CodeFragMgr attributes

CFM Attributes

CFMAttr

'conn'

Connection mgr

ConnectionMgr

 

'cput'

Native CPU type

NativeCPUtype

CPUtype

'conn'

Connection mgr

ConnectionMgr

Connection

'crm '

Comm rsrc mgr

CommRsrcMgr

CommRsrc

'csvr'

Control Strip version

ControlStripversion

 

'ctbv'

CTB version

CTBVersion

CommToolBoxVersion

'dbac'

Data access mgr

DBAccessMgr

DBAccess

'dict'

Dictionary mgr

DictionaryMgr

Dictionary

'ditl'

DITL extensions

DITLExtensions

 

'dply'

DisplayMgrAttr

 

 

'dplv'

DisplayMgrVers

 

 

'drag'

Drag Manager attributes

DragMgrAttr

 

'easy'

Easy Access attribute

EasyAccess

 

'edtn'

Edition mgr

EditionMgr

 

'evnt'

AppleEvents

 

 

'fndr'

Finder attributes

Fndr

 

'fold'

FindFolders attributes

 

 

'font'

Outline fonts

OutlineFonts

FontMgr

'fpu '

FPU type

FPUType

FPU

'fs  '

File System

FileSystem

FileSystemMgr

'fxfr'

File xfer mgr

FXfrMgr

FXferMgr

'hdwr'

Hardware config

Hardware

Configuration

'help'

Help mgr

HelpMgr

Help

'icon'

Icon Utilities

IconUtil

Icon

'icmp'

Compression Manager

CompressionMgr

 

'kbd '

Keyboard type

KeyboardType

Keyboard*

'lmem'

Low memory size

LoMemSize

 

'lram'

Logical RAM size

LogicalRamSize

LogicalRam

'misc'

Miscellaneous

Misc

 

'mixd'

Mixed Mode Version

MixedModeVersion

Mixed Mode

'mmu '

MMU type

MMUtype

 

'nlup'

Name binding protocol

StandardNBP

NameBinding

'nmgr'

Notification Mgr

NotificationMgr

 

'nubs'

NuBusSlotCount

 

 

'os  '

OS info

OS

 

'ostt'

OS trap base

OSTrapBase

 

'pcxg'

PC Exchange

PCExchange

PCX

'pgsz'

Logical page size

PageSize

LogicalPageSize

'pop!'

Popup CDEF

Popup

 

'powr'

Power mgr

PowerMgr

 

'ppc '

PPC toolbox

PPCtoolbox

 

'proc'

Processor type

ProcessorType

Processor*

'prty'

Parity

 

 

'qd  '

QuickDraw version

QuickDrawVersion

QuickDraw*

'qdrw'

QuickDraw features

QDFeatures

QuickDrawFeatures

'qtim'

QuickTime Version

QuickTimeVersion

QuickTime

'qtrs'

QuickTime Features

QuickTimeFeatures

 

'ram '

Physical RAM size

PhysicalRAM

PhysicalRAMsize

'rsrc'

Partial resources

PartialResources

ResourceMgr

'rtmr'

Realtime mgr attributes

RealtimeMgrAttr

 

'scr#'

# active script systems

ScriptSystems

ScriptCount

'scra'

Scrap Manager

ScrapMgr

Scrap

'scri'

Script mgr version

ScriptMgrVersion

ScriptMgr

'scsi'

SCSI Manager attributes

SCSIMgrAttr

 

'ser '

Serial attributes

Serial

 

'sltc'

NuBus slot locations

NuBusMgr

NuBusConnectors

'snd '

Sound

 

 

'stdf'

Standard File

Standard File

 

'sysa'

Native Sys Architecture

SysArchitecture

 

'tbtt'

Toolbox trap base

ToolboxTrapBase

 

'te  '

TextEdit version

TextEditVersion

TextEdit

'term'

Terminal mgr

TerminalMgr

Terminal

'thds'

Thread Mgr attributes

ThreadMgrAttr

Threads

'tmgr'

Time mgr

TimeMgr

Time

'tsmv'

Text Services mgr vers

TextServicesMgrVersion

TSMVersion

'ttsc'

Speech Mgr attributes

SpeechAttr

Speech

'tv  '

TV attributes

TVAttr

 

'vm  '

Virtual memory

VirtualMemory

VM

'xlat'

Translation Manager

TranslationMgr

Translation

'xttt'

Ext toolbox trap base

ExtToolBoxTrapBase

 

* See Limitations

 
Table 2: Informational selectors and their aliases

Selector

First alias--"Title"

Second alias

Third alias

'mach'

Machine Type

MachineType

Machine*

'micn'

Machine ICON rsrc ID  

MachineICONs

 

'rom '

ROM size

RomSize

 

'romv'

ROM version

RomVersion

 

'sysv'

System version

SystemVersion*

 

'vers'

Gestalt trap version

GestaltVersion  

 

* See Limitations

OPTIONS

-addr

Provides information for address selectors only (for example, 'ostt' and 'tbtt'). Normally these responses are given as hexadecimal numbers.

-attr

Provides information for attribute selectors only. Normally these responses are given as binary numbers.

-c

Writes the number of bits in a Gestalt response instead of the actual response. This is useful, for example, with attribute selectors.

-e

Generates an error message and skips the selector if it cannot find a specified selector in its database. Normally Gestalt attempts to retrieve responses for all specified selectors so that they can be modified.

-env

Uses SysEnvirons function call instead of the Gestalt Manager even if the Gestalt Manager exists on the target machine.

-h

Writes all Gestalt responses as hexadecimal numbers. For instance, $1234.

Normally Gestalt responses vary according to the type of selector being evaluated. Hexadecimal numbers are given for address selectors, binary numbers for attribute selectors, and decimal numbers for size, type, and version selectors.

-k

Forces Gestalt to write the selector's title along with its value even if you specified only one selector.

-p

Writes version information along with the tool's regular output, which is selector titles and values, to diagnostic output.

Note
The Gestalt tool echoes the output to diagnostic output only if diagnostic output is different from standard output. •

-s

Writes Gestalt responses as alphanumeric strings instead of numerical codes. This applies only if the specified selectors exist in the tool's database.

-sel[ector[s]]

Writes the four-character selector along with its title and value in the output.

-size

Provides information for size selectors only (for example, 'lram' and 'pgsz'). Normally, these responses are given as decimal numbers.

-slots

Provides Slot Manager information for the cards in all active slots of the target machine.

-t n

Puts tabs in the output using the specified tab value. This applies only if Gestalt generates a title and value for each response and if diagnostic output is not the same as standard output.

-type

Provides information for type selectors only (for example, 'fpu ' and 'mmu '). Normally, these responses are given as decimal numbers.

-t1 n

Inserts one tab of tab value n between the title and its value. This applies only if Gestalt generates a title and value for each response and if diagnostic output is not the same as standard output.

-vers

Provides information for version selectors only (for example 'sysv' and 'romv'). Normally, these responses are given as decimal numbers.

-w n

Writes the title as a field of fixed width n, starting at the beginning of the title. This produces trailing blanks before the value, which you can change to tabs by using -t.

Note that the default for n is 24.

EXAMPLES

The following command line names the machine on which the Gestalt tool is running:

Gestalt machine -s

In the case of a Macintosh IIci, Gestalt writes the following string to standard output:

IIci

The following command line performs the same function as the previous example, except that the output appears in a different format:

Gestalt Machine

Instead of writing the output as a string, Gestalt writes the response as a numeric code. For a Macintosh II, Gestalt produces the response:

6

This example uses the Gestalt tool in conjunction with other strings to concatenate the proper ROM map in the MPW folder {MPW}Rom Maps to a previously generated Linker output file called LinkMap :

Catenate "{MPW}ROM Maps:Mac`Gestalt 'mach' -s`ROM.map" >> LinkMap

When executed on a Macintosh IIci, the script generates a filename of

{MPW}ROM Maps:MacIIciROM.map

Note that this command would usually be placed in a makefile when using performance measurement tools.

LIMITATIONS

On systems that do not support the Gestalt Manager, Gestalt attempts to call SysEnvirons; however, SysEnvirons supports only a small subset of the possible selectors.

In Table 1 and Table 2 selectors supported by SysEnvirons are marked * at the right edge of the table. Note that you can use -env to force Gestalt to use the SysEnvirons function even when the Gestalt Manager is available.

SEE ALSO

The discussion of the Gestalt Manager in Inside Macintosh

 
 


Last Updated July 2000