Save Environment

Host application programs that have been designed to interface with other (possibly unknown) applications which might also be using AiF facilities may experience "conflicts of AiF interest" with the other applications, such as loading AiF menus into the same menu set number, changing but not resetting screen colours and so on.

These conflicts may be avoided by ensuring that applications "save" their AiF environment at an appropriate point by using the AiF sequence in the following sections.

Push environment

ESC [ = 99 p    

Pop environment

ESC [ = 99 q    

Push environment will essentially save everything except backpages for the currently active session including:

  • The current screen.

  • The screen mode (row & column settings).

  • AiF windows.

  • Screen attributes.

  • AiF stacks and slots, menus and selection boxes.

  • The screen's background fill character and attribute.

Session dependent attributes saved include:

  • Cap lock and num lock status.

  • Mouse status.

  • Function keys, AiF exit keys and key changes.

  • Current emulation in use.

Application Environment Examples

Applications providing gateways out to other applications that might themselves make use of AiF should save their own environments before shelling out to the gateway. Obviously, the application would want to restore its original environment once control has been returned from the gateway.

You should ensure that the "environments" saved stack is popped in the correct order to properly restore environments for earlier programs. Saving environments can consume sizeable chunks of the PC's memory depending upon the number and size of menu and selection boxes loaded, the number of screens pushed on to the screen slots stack etc.