Document #: US-13273,EN ------------------------------------------------------------------------------ Major subject: analysis Minor subjects: tech_notes Keywords: Abstract: Terminal State Management in the INGRES Forms System - Equivalent to Release 6 INGRES Technical Note #33 or Release 5 Technical Note #90. Expert note: Terminal State Management in the INGRES Forms System ==================================================== Overview -------- A forms system (FRS) optimization to cut down the number of characters sent to the screen was introduced in INGRES Version 5.0/05. This enhancement can affect applications that do UNIX fork and VMS lib$spawn calls, as well as users who switch sessions via a communications server. This document describes the change and gives suggestions for avoiding related problems you may encounter in your INGRES FRS applications. o FRS Tracks Terminal State o Work Arounds For Applications o Other Related Notes FRS Tracks Terminal State ------------------------- The FRS keeps pace with what state (normal, reverse video, underline...) your terminal is currently in. For example, if your terminal is in reverse video mode, then every character sent to your terminal will be displayed as reverse video. Before INGRES version 5.0/05, the FRS was very conservative, and regu- larly sent escape sequences to reset the terminal state. For example, prior to EVERY character echoed in response to the user typing, the FRS would send an escape sequence according to how that character should be displayed. Following the character, it sent an escape sequence to set the terminal back to a normal state. For example, if you typed the string "Hi" into an underlined field, the FRS would echo the following back to the terminal (on a full duplex sys- tem, like VMS or UNIX, you always see what the FRS echoes back, rather than a local echo of what you type, as on IBM systems):H i Under the old method, the FRS set the terminal back to a normal state after every refresh sequence (single character echo, cursor movement, ^W, or display of a form). Thus, if the user did a fork or lib$spawn when the cursor was positioned in a field with attributes such as highlighting or reverse video, the terminal wouldn't be left in highlighted or reverse video mode. The drawback to these frequent refreshes, particularly for INGRES users on packet switching networks, was the overhead associated with fre- quently sending escape sequences to the terminal. Therefore the FRS was modified to do fewer refreshes. Starting with 5.0/05 the FRS works harder at tracking what mode the ter- minal is in, and optimizes what it sends, so as not to send an escape sequence to reset the mode unless it's necessary. For example, the above turns into: H i Note that the terminal is left in underline mode. This is faster and more efficient but, because the terminal is not reset out of underline mode after the 'i' is sent, if your program then forks, or lib$spawns to a subprocess or if you switch to another session via a communications server, then all your typing will be underlined. Work Arounds For Applications ----------------------------- o CALL SYSTEM in ABF/4GL, and in ESQL/EQUEL starting with INGRES 6.2, automatically refreshes terminal state. Use CALL SYSTEM in Embedded Language applications when available instead of fork or lib$spawn. o To refresh the terminal state in EQL routines that do a fork or lib$spawn, issue: exec frs MESSAGE ' ' ; /* ESQL */ or ## MESSAGE " " /* EQUEL */ prior to forking or calling lib$spawn. That causes the FRS to send out an escape sequence which resets the terminal state so the message will not appear in reverse video or underlined, etc (PROMPT will work too). If you issue the MESSAGE when no menuline is displayed, you may need to make the string non-blank in order to get a refresh. o Switching to another session via a communications server: Type ^W or hit the menu key (e.g. PF1) BEFORE you switch; they both set the termi- nal state back to normal. You can also Reset your terminal (for example, in the vt220 setup menu). Other Related Notes ------------------- o The Embedded language command ENDFORMS resets the state of the termi- nal back to normal. ESQL & EQUEL/FORMS applications that ENDFORMS before they exit the application should have no problem. If they don't ENDFORMS before exiting, then the terminal will be left in the state of the field the cursor was in before the EXIT. o If you display a form, or tab to a new enhanced-attribute field, and keep the cursor in the first position of this field, then forking of lib$spawning a new process will not change the terminal's state. The field's enhanced state isn't carried to the forked or spawned process unless something is actually typed into the field. If you haven't typed into the field, then the terminal state will be that of the last character sent to the terminal during the form display. For example, if you display a form, and the last field on the form is a reverse video field in the lower right hand corner of the screen, then your terminal will be left in reverse video mode, even though your cur- sor is then placed on a normal video-attributes field. If your program then lib$spawns to the operating system, and you don't use the wor- karound above, then characters you type from that point will be reverse video. o The above discussion applies to the majority of ASCII terminals, such as the vt100 and vt220. Some terminals reset their state without the Forms System asking them to. For example on some HP terminals, the state is automatically set back to normal whenever the cursor moves to a new line. The FRS has to know about this behavior and account for it on those terminals. o If you have a VT220, you can watch all the escape sequences being sent to your terminal by entering the Display Set-Up menu and changing "Interpret Controls" to "Display Controls". Then type some data, tab to a new field or press the menu key and watch what the FRS sends to your terminal. Releases affected: all(all.all) - Releases not affected: Errors: Bugs/SIRS: ------------------------------------------------------------------------------
© William Yuan 2000
Email William