The Tclgestalt Tcl extension implements the MacOS Gestalt() function as a Tcl command: this makes this ToolBox function accessible from Tcl scripts. This command is specific to the Mac OS system. This file documents version 1.0.1.
gestalt selector
The selector is a four characters string. The Tcl interpreter returns an integer value which has to be interpreted (see examples below). Possible values for the selector codes are listed in the table below.
This command implements the Gestalt function used with the MacOS ToolBox to get information about the state of a machine, its components etc. The Gestalt function allows you to determine the hardware and software configurations so an application can fully exploit whatever environment it is running in. When your script calls the gestalt Tcl command, it passes a selector code (or selector) as a parameter to specify the information it needs. Your script can call the gestalt command to determine :
Here is some information, excerpted from "Inside Macintosh", about the different categories of values retruned by the Gestalt() function.
The meaning of the value that Gestalt returns in the response parameter depends on the selector code with which it was called. For example, if you call Gestalt using the gestaltTimeMgrVersion selector, it returns a version code in the response parameter. In this case, a returned value of 3 indicates that the extended Time Manager is available.
In most cases, the last few characters in the selector's symbolic name form a suffix that indicates what type of value you can expect Gestalt to place in the response parameter. For example, if the suffix in a Gestalt selector is Size, then Gestalt returns a size in the response parameter. Table 1-1 lists the meaningful suffixes.
Selectors that have the suffix Attr deserve special attention. They cause Gestalt to return a bit field that your application must interpret to determine whether a desired feature is present. To determine whether a particular feature is available, you need to look at the designated bit.
You get different kinds of information from Gestalt by passing selectors from two kinds of Apple-defined selector codes:
| gestaltAddressingModeAttr | 'addr' | addressing-mode attributes |
| gestaltAliasMgrAttr | 'alis' | Alias Manager attributes |
| gestaltAppleEventsAttr | 'evnt' | Apple events attributes |
| gestaltAppleTalkVersion | 'atlk' | old format AppleTalk version |
| gestaltATalkVersion | 'atkv' | new format AppleTalk version |
| gestaltAUXVersion | 'a/ux' | A/UX version, if present |
| gestaltCFMAttr | 'cfrg' | Code Fragment Manager attributes |
| gestaltCloseViewAttr | 'BSDa' | CloseView attributes |
| gestaltComponentMgr | 'cpnt' | Component Manager version |
| gestaltCompressionMgr | 'icmp' | Image Compression Manager version |
| gestaltConnMgrAttr | 'conn' | Connection Manager attributes |
| gestaltCRMAttr | 'crm ' | Communication Resource Manager attributes |
| gestaltCTBVersion | 'ctbv' | Communication Toolbox version |
| gestaltDBAccessMgrAttr | 'dbac' | Data Access Manager attributes |
| gestaltDictionaryMgrAttr | 'dict' | Dictionary Manager attributes |
| gestaltDisplayMgrAttr | 'dply' | Display Manager atributes |
| gestaltDisplayMgrVers | 'dplv' | Display Manager version |
| gestaltDITLExtAttr | 'ditl' | Dialog Manager extensions |
| gestaltDragMgrAttr | 'drag' | Drag Manager attributes |
| gestaltEasyAccessAttr | 'easy' | Easy Access attributes |
| gestaltEditionMgrAttr | 'edtn' | Edition Manager attributes |
| gestaltExtToolboxTable | 'xttt' | Toolbox trap dispatch table info |
| gestaltFinderAttr | 'fndr' | Finder attributes |
| gestaltFindFolderAttr | 'fold' | FindFolder attributes |
| gestaltFirstSlotNumber | 'slt1' | first physical slot |
| gestaltFontMgrAttr | 'font' | Font Manager attributes |
| gestaltFPUType | 'fpu ' | floating-point unit (FPU) type |
| gestaltFSAttr | 'fs ' | file system attributes |
| gestaltFXfrMgrAttr | 'fxfr' | File Transfer Manager attributes |
| gestaltHelpMgrAttr | 'help' | Help Manager attributes |
| gestaltIconUtilitiesAttr | 'icon' | Icon Utilities attributes |
| gestaltKeyboardType | 'kbd ' | keyboard type code |
| gestaltLogicalPageSize | 'pgsz' | logical page size |
| gestaltLogicalRAMSize | 'lram' | logical RAM size |
| gestaltLowMemorySize | 'lmem' | size of low memory |
| gestaltMiscAttr | 'misc' | miscellaneous attributes |
| gestaltMixedModeVersion | 'mixd' | MixedMode version |
| gestaltMMUType | 'mmu ' | MMU type |
| gestaltNativeCPUtype | 'cput' | native CPU type |
| gestaltNotificationMgrAttr | 'nmgr' | Notification Manager attributes |
| gestaltNuBusConnectors | 'sltc' | NuBus connector bitmap |
| gestaltNuBusSlotCount | 'nubs' | number of logical NuBus slots |
| gestaltOSAttr | 'os' | Operating System attributes |
| gestaltOSTable | 'ostt' | base address of Operating System trap dispatch table |
| gestaltParityAttr | 'prty' | parity attributes |
| gestaltPCXAttr | 'pcxg' | PC exchange attributes |
| gestaltPhysicalRAMSize | 'ram ' | physical RAM size |
| gestaltPopupAttr | 'pop!' | pop-up 'CDEF' attributes |
| gestaltPowerMgrAttr | 'powr' | Power Manager attributes |
| gestaltPPCToolboxAttr | 'ppc ' | Program-to-Program Communications (PPC) Toolboxattributes |
| gestaltProcessorType | 'proc' | microprocessor type code |
| gestaltQuickdrawFeatures | 'qdrw' | QuickDraw features |
| gestaltQuickdrawVersion | 'qd' | QuickDraw version |
| gestaltQuickTimeVersion | 'qtim' | QuickTime version |
| gestaltRealTimeMgrAttr | 'rtmr' | Realtime Manager attributes |
| gestaltResourceMgrAttr | 'rsrc' | Resource Manager attributes |
| gestaltScrapMgrAttr | 'scra' | Scrap Manager attributes |
| gestaltScriptCount | 'scr#' | number of active script systems |
| gestaltScriptMgrVersion | 'scri' | Script Manager version |
| gestaltSerialAttr | 'ser ' | serial hardware attributes |
| gestaltSlotAttr | 'slot' | slot attributes |
| gestaltSoundAttr | 'snd ' | sound attributes |
| gestaltSpeechAttr | 'ttsc' | Speech Manager attributes |
| gestaltStandardFileAttr | 'stdf' | Standard File attributes |
| gestaltStdNBPAttr | 'nlup' | StandardNBP attributes |
| gestaltSysArchitecture | 'sysa' | Native System Architecture |
| gestaltTEAttr | 'teat' | TextEdit attributes |
| gestaltTermMgrAttr | 'term' | Terminal Manager attributes |
| gestaltTextEditVersion | 'te' | TextEdit version code |
| gestaltThreadMgrAttr | 'thds' | Thread Manager attributes |
| gestaltTimeMgrVersion | 'tmgr' | Time Manager version code |
| gestaltToolboxTable | 'tbtt' | base address of Toolbox trap dispatch table |
| gestaltTranslationAttr | 'xlat' | Translation Manager attributes |
| gestaltTSMgrVersion | 'tsmv' | Text Services Manager version |
| gestaltVersion | 'vers' | Gestalt version |
| gestaltVMAttr | 'vm ' | virtual memory attributes |
| gestaltHardwareAttr | 'hdwr' | hardware attributes |
| gestaltMachineIcon | 'micn' | machine 'ICON'/'cicn' resource ID |
| gestaltMachineType | 'mach' | Macintosh model code |
| gestaltROMSize | 'rom ' | ROM size |
| gestaltROMVersion | 'romv' | ROM version |
| gestaltSystemVersion | 'sysv' | System file version number |
Here are a few examples and their interpretation. Results may vary on different implementations. If the following command
gestalt sysvreturns the value 2144, this is hexadecimal 0x860 : this means that version 8.6.0 of the system is installed.
If the command
gestalt evntreturns 7, this is binary 111 : the three first low bits are set which means that the Apple Event Manager is present, that there is scripting support and that OSL is in the system.
If the command
gestalt "te"returns 5, it means that TextEdit TE5 is present.
The gestalt command does not make sense on other systems than the Macintosh.
Please e-mail any problem or bug you encounter: bdesgraupes@users.sourceforge.net
The official web page is here.
Tclgestalt is distributed under the same BSD License as the Tcl language itself: see the file License_terms in the distribution or the Open Source Initiative site.
Last updated 2005-12-30 12:42:34