{short description of image}

Async Professional

Home
Project Home

Manuals
Delveoper's Guide
Reference Guide
Activex

FAQ
Downloads

The Terminal Components

Traditionally, a terminal is a piece of hardware with a screen and keyboard that provides a method to display information from a host computer and to enter information into the same computer. Today, more often than not, terminals are personal computers that run a program that emulates the original terminal; it interprets the same data in the same fashion and displays it in the same way. Similarly, it emulates the original keyboard and sends the same kind of information back to the host computer in the same format.

The data presented by the host computer takes one of two forms. The first form is intended for display only. The terminal will just send the stream of data directly to the screen without trying to interpret it in any fashion. What you see is what is sent. This is known as teletype mode (abbreviated as TTY).

The other form of data sent to a terminal consists of two types, intermixed: displayable data and embedded terminal control sequences. The Terminal control sequences cause the terminal to move the cursor around the screen, to block off certain parts of the display from being altered, to delete text from areas of the screen, to scroll the display, to switch character sets, and so on. The terminal has to monitor the data being sent by the host computer, be able to identify the terminal control sequences in the stream, and then extract and act on them. All other data would be sent to the screen as usual. We usually refer to this mode as the terminal emulation mode.

All emulation means is that the PC is pretending to be the terminal in such a fashion that the host computer is not aware that there is no real terminal present, just a clever program. Ideally, the PC program emulates the terminal so well that the user cannot tell the difference between the program’s window and the original display. What you see is what was intended. Unfortunately, the same cannot be said of the keyboard; terminal keyboards generally have extra keys not available on a PC keyboard, and so the emulation program has to map available PC keystrokes to the original terminal keyboard keys, and obviously the user has to be aware of these mappings.

There are a variety of standards for terminal control sequences from such companies as IBM, Digital Corporation (DEC), Wyse, and so on. One of the most widely known is the DEC VT100 standard, which helped form the basis for the ANSI standard. Async Professional implements the full VT100 standard, including support for different character sets, scrolling regions, and keyboard application modes. By definition, this is also a subset of the ANSI standard. Also, since the vast majority of PCs running Windows have color monitors, the Async Professional VT100 emulation also supports the terminal control sequences needed to display text in color.

Async Professional provides terminal emulation capabilities with its terminal component, TAdTerminal and its emulators, all descended from TAdTerminalEmulator. These components have been designed with two goals in mind: first, to be usable with the minimum of effort on your part; and, second, to be flexible so that you can extend them to work with other terminal types.

The former goal is important to those programmers who know that having a terminal that is compliant with the VT100 standard (or a subset of the ANSI standard) is all that is required for their application. They do not want to worry about linking this kind of display emulation with that kind of keyboard emulation to the terminal component, they would rather just point the emulator at the terminal component and let the components do the rest.

Catering for the latter goal, extensibility, is more difficult. There are many facets to emulating a terminal. You have to worry about how to store the data from the host; in other words, the actual displayable characters, the character attributes, the colors (both foreground and background), the character sets. You have to worry about interpreting the terminal control sequences being sent by the host and acting upon them. These terminal control sequences may erase parts of the display, insert extra lines, or scroll the text in different ways. You have to track these changes in your data.

Once you have those kind of problems nailed down, you then have to consider the keyboard. Ideally, you would like to emulate the original terminal keyboard completely, but this isn’t generally possible. Apart from the alphabetic part of the keyboard, terminal keyboards have different keys. You must map some PC keys (maybe normal, Control or Alt shifted) onto their terminal keyboard equivalents. You have to consider what control sequence the terminal keyboard would send to the host when a given key was pressed.

After all that, you have to actually draw the terminal display in a normal window on the screen. With the terminal classes in Async Professional, the attempt has been made to simplify this entire process (see Figure 8.1).

  1. Terminal design example diagram.

SourceForge.net Logo

This document maintained by the Async Professional Project.