|Powered by QM on a Linux server|
KnowledgeBase 00017: Terminal Support
How are terminals defined?
QM uses the a derivative of the terminfo terminal definition database found on Unix and Linux systems.
Every supported terminal has an entry in the terminfo database. This consists of a small file holding a compiled definition of the terminal's control codes and key bindings. The master source from which these are built is provided in a text file named terminfo.src. This contains the definition of many of the most popular terminal types.
How is this data used?
When a terminal type is selected, either from the TERM environment variable or by use of the TERM command, QM reads the associated definition from the terminfo database. This is stored in memory and used by the QMBasic @() function and the TERMINFO() function.
How do terminfo source files work?
Despite the compiled form being standard across most implementations of terminfo, different vendors use variations of the source format. In the QM implementation, each definition consists of a series of tokens separated by commas. A definition may span many lines by ending each line except the last with a comma.
The first token identifies the terminal definition(s) to be compiled from the source entry. Each terminal type is separated by a vertical bar character (|). The final component is descriptive text rather than a terminal name.
The remaining tokens define characteristics of the terminal. These may be of three types; boolean, numeric and string. A boolean entry simply states that a terminal has some capability. A numeric entry defines a value such as the number of columns. A string entry contains a control string to be sent to the terminal to perform some operation or the character sequence sent by the terminal when a key is pressed.
Each token has a capability name which is standardised over most terminfo implementations. Although QM only uses a small number of capabilities, it recognises and stores all of the standard basic set in the terminfo database.
How do I compile a terminal definition?
The qmtic utility, described in the QM Reference Manual, can be used to compile specific or all terminal definitions.
Why might I need to compile a terminal definition?
You might find a reason to need to modify a terminal definition. Perhaps you have a terminal which differs slightly from the standard definition. You might want to insert additional capability entries. There might be a defect in an entry (Yes, we admit it can happen!).
Can I add new terminal types?
If you have a terminal that is not in the standard set of definitions, we may be able to supply the source form of its terminfo entry. We recommend that you store these in a file named terminfo.mods in the QMSYS account directory. The install process will recompile these automatically if you upgrade to a new version of QM.
You can also obtain definitions for many terminals via the Internet but beware that they may need some modification to our source format.
Can I decompile an existing definition to see how it works?
Yes, the qmtic utility has a decompile mode. This can decompile specific definitions or the entire database.
How do I find out what terminals are defined?
Again, the qmtic utility can help as it has an indexing mode. Alternatively, just examine the directory hierarchy that forms the terminfo database.
What terminal emulator should I use?
QM works with most terminal emulators. We have adopted AccuTerm as our preferred terminal emulator and it is bundled in with QM for all commercial licences issued on or after 1 January 2005. This includes some advanced file transfer and GUI features for QM applications. See the Downloads area of this web site for a link to obtain the latest version of this software.
What about QM's own terminal emulator, QMTerm?
QM comes with a simple terminal emulator named QMTerm which is largely obsolete now that we have adopted AccuTerm as our preferred emulator. QMTerm provides only basic facilities but includes some special screen handling modes that enable the QMBasic debugger to operate in the full screen mode used by Windows QMConsole sessions. These modes are also in the AccuTerm terminal emulations that have a '-at' suffix.
Where can I find more information?
You can read more about terminfo definitions and use of terminal devices from QMBasic programs in the QM Reference Manual. There is also a Technical Note on terminal handling available for download as a pdf by clicking here.
00019: Keyboard Input Problems