Clifford
Matthews
ctm

# `Gestalt` under ROMlib

This article provides information about `Gestalt` under ROMlib. Since Executor and the Carbonless Copies Runtime System both use ROMlib, this information also applies to them.

1999
2002
Abacus Research & Development, Inc.

The information in this paper is not built directly from the ROMlib source. It is provided as-is and is subject to change.

## Apple Selectors

PageMaker 4.2 calls `Gestalt` with the `gestaltAliasMgrAttr` selector and if `Gestalt` returns noErr, proceeds to use the Alias Manager, even the response is 0. PageMaker 4.2 will not use the Alias Manager if in this case `Gestalt` returns gestaltUndefSelectorErr. PageMaker 4.2's use of `Gestalt` doesn't appear to be within spec (IMVI), but that's just another difference where ROMlib has to do what the Mac does, rather than what the specifications suggest.

MacInTax '93 does the same thing with the Edition Manager that PageMaker does with the Alias Manager. Claris Works does the same thing with Apple Events. After ARDI saw three instances of this behavior ARDI stopped keeping track. Because of such behavior, there are a number of selectors that ROMlib deliberately fails to recognize. ROMlib does this when its support for the queried functionality is incomplete. Here are the selectors that ROMlib deliberately fails to recognize:

- `gestaltAliasMgrAttr`
- `gestaltApplEventsAttr`
- `gestaltAppleTalkVersion`
- `gestaltAUXVersion`
- `gestaltConnMgrAttr`
- `gestaltCRMAttr`
- `gestaltCTBVersion`
- `gestaltDBAccessMgrAttr`
- `gestaltEasyAccessAttr`
- `gestaltEditionMgrAttr`
- `gestaltFontMgrAttr`
- `gestaltFXfrMgrAttr`
- `gestaltHardwareAttr`
- `gestaltHelpMgrAttr`
- `gestaltMiscAttr`
- `gestaltNotificatinMgrAttr`
- `gestaltNuBusConnectors`
- `gestaltOSAttr`
- `gestaltPopupAttr`
- `gestaltPowerMgrAttr`
- `gestaltPPCToolboxAttr`
- `gestaltResourceMgrAttr`
- `gestaltScriptCount`
- `gestaltScriptMgrVersion`
- `gestaltSerialAttr`
- `gestaltStdNBPAttr`
- `gestaltTermMgrAttr`
- `gestaltParityAttr`
- `gestaltVMAttr`
- '`icmp`'
- '`sysa`'

ROMlib recognizes and returns information for these selectors:

- `gestaltDITLExtAttr`
- `gestaltFindFolderAttr`
- `gestaltFSAttr`
- `gestaltSoundAttr`
- `gestaltExtToolboxTable`
- `gestaltToolboxTable`
- `gestaltOSTable`
- `gestaltFPUType`
- `gestaltKeyboardType`
- `gestaltLogicalPageSize`
- `gestaltLogicalRAMSize`
- `gestaltLowMemorySize`
- `gestaltMMUType`
- `gestaltPhysicalRAMSize`
- `gestaltProcessorType`
- `gestaltQuickdrawVersion`
- `gestaltQuickdrawFeatures`
- `gestaltTimeMgrVersion`
- `gestaltVersion`
- `gestaltMachineIcon`
- `gestaltMachineType`
- `gestaltROMSize`
- `gestaltROMVersion`
- `gestaltSystemVersion`
- `gestaltTextEditVersion`

ROMlib fails to recognize the following four selectors unless they are specifically enabled by the "pretend" options (Pretend Help, Pretend Edition, Pretend Script, Pretend Alias). The pretend options can be enabled in the preferences panel or via a configuration file.

- `gestaltHelpMgrAttr`
- `gestaltScriptMgrVersion`
- `gestaltEditionMgrAttr`
- `gestaltAliasMgrAttr`

These two selectors are only recognized if the system version is set to 7.0 or higher:

- `gestaltStandardFileAttr`
- `gestaltApplEventsAttr`

## ARDI selectors

ARDI has added one special `gestalt` selector, `gestaltPHYSICAL` ('`MUL8`'). It returns the address of a routine that behaves just like `Gestalt`, but provides access to a completely different set of tables. These tables contain information about the environment in which Executor is running instead the emulated environment that Executor provides.

Example:

    int PhysicalGestalt (long selector, long *responsep)
    {
      int retval;
      pascal int (*physfp) (long sel, long *responsep);

      retval = Gestalt ('MUL8', (void *) &physfp);
      if (retval == noErr)
        retval = physfp (selector, responsep);
      return retval;
    }

    ...

      OSErr err;
      long vers;

      err = PhysicalGestalt ('sysv', &vers);
      /* err should be noErr and vers should be the version of Executor you're
         running, not the version of the System file we're emulating */

These are the PhysicalGestalt selectors supported:

### PhysicalGestalt Selectors

Name | Value | Response
--- | --- | ---
gestaltSystemVersion | '`sysv`' | numeric version of Executor
gestaltExecutorVersionString | '`xqtr`' | address of the string version of Executor
gestaltDemoStatus | '`demo`' | 1, if this is a demo version
gestaltDemoExpiration | '`xpir`' | how many days until the demo expires
gestaltSerialNumber | '`s/n` ' | non-demo version: serial number
gestaltRegisteredName | '`name`' | non-demo version: name
gestaltRegisteredOrg | '`org` ' | non-demo version: organization
gestaltPhysicalRAMSize | '`ram` ' | amount of physical ram on the machine
gestaltScreenSize | '`scrn`' | resolution of the monitor
gestaltGhostScriptVersion | '`gost`' | win32 only: Ghostscript DLL version

ARDI is willing to add PhysicalGestalt selectors as Mac developers require.