Configuration Guide |
Panther is designed to run on many character-mode displays with numerous differences between them. For example, some displays are 80 columns wide, while others have 132 columns. Similarly, control sequences used to position the cursor and highlight data on the display often differ from model to model.
Panther uses a video file specific to a given terminal type to determine how to handle that terminal's display characteristics, and so display screens and messages correctly. Each video file defines the display characteristics for a given character-mode terminal type. The Panther distribution includes video files in the config
directory that support around 35 character-mode terminal types. One of the distributed video files should work for you.
Note: GUI platforms do not require a video file.
This chapter covers the following topics:
Finding the Correct Video File |
As distributed, Panther can be configured to support around 35 character-mode terminals as well as those that emulate other terminals:
SMVARS
source file (in the config
directory) that supports your terminal: among the SMVIDEO
settings, find the one with a parenthetic mnemonic for your terminal type. For example, the SMVIDEO
entry for a vt100
terminal looks like this:
SMVIDEO = (vt100) $SMBASE/config/vt100vid.bin
SMTERM
variable to the mnemonic—in the previous example, SMTERM
= vt100
. Or, enter the mnemonic when prompted for terminal type when you invoke prodev
. prodev
and check whether basic functions work correctly.
If the screen does not clear or characters are positioned incorrectly, try one of these approaches:
Table 7-1 provides a listing of popular terminal types. After you determine the family of terminals (there may be more than one video file to support a single family), try each of the files associated with the family of terminals by setting SMTERM
to the appropriate terminal mnemonic.
The Role of the Video File |
Panther video files are based on the termcap
and terminfo
databases. These databases were originally developed to handle display of the earliest full-screen editors such as emacs and vi. Because these editors use the screen non-sequentially, they need terminal-specific ways to move the cursor, clear the screen, insert lines, and so on. Although closely associated with UNIX, termcap
and terminfo
are also used on other operating systems, and list idiosyncrasies of many terminal types.
Text editors use visual attributes sparingly, if at all. Thus, termcap
contains minimal information about handling them. Usually there are entries to start and end "stand-out" and sometimes entries to start and end "underline." Notably missing are entries that explain how to combine attributes, like reverse video and blinking simultaneously. The terminfo
database can combine attributes; in practice, however, the appropriate entries are usually missing.
Panther makes extensive use of attributes in all combinations, and supports color. Rather than extending termcap
with additional codes, which might conflict with other extensions, Panther uses an independent file to describe the terminal specific information. Furthermore, some machines, notably PCs, lack terminfo
capability.
Panther developed a set of commands that extend the limited set of commands used by termcap
and abbreviates verbose sequences used by terminfo
. Both syntaxes are supported. All the commands needed in the video file can be written using terminfo
syntax; many can be written using the simpler termcap
syntax and a few can benefit by using the extended commands.
A summary of the commands used to process parameters is described in this chapter; details and examples are also included.
At a minimum, a video file requires two entries:
CUP
for positioning the cursor.
Although character-mode Panther functions with these two entries, it does so with a limited set of display capabilities—for example, visual attributes are unavailable. Speed can also be affected adversely—many video file entries serve to decrease the number of characters transmitted to the terminal.
Unless otherwise indicated, Panther assumes a 24-line by 80-column screen. Line 24 is used for status text and error messages, and the remaining 23 are available for screens. The non-display attribute is supported and available. The underline attribute is simulated by underscores placed wherever blanks appear in an underlined field. Clearing a line is done by writing spaces. Borders are available, and consist of printable characters only. Refer to "Enhancing a Basic Video File" for specific details on enhancing a basic video file to include display attributes, such as reverse, underline, and so on.
A stack is used to process a keyword in the video file—parameters are kept in a separate list. The stack is initially empty and parameters are generally pushed on the stack as needed. The parameters are ordered and a pointer is used to access them. It initially points to the first one. The stack is four levels deep; anything pushed off the end is lost. There are commands that push a parameter or constant onto the stack, but no explicit pop commands. Output commands transmit the value on top of the stack, then remove it.
Arithmetic and logical operations take one or two operands from the top of the stack, and replace them with one result; thus, they perform an implicit pop. These types of operations use postfix notation. The operands are pushed, then the operation takes place. So the sequence Refer to "Parameters for Keyword Sequences" for information about specific parameters.
Processing Keywords—Automatic Parameter Sequencing
%p1 %p2 %p3 %+ %*
leaves parameter1 + (parameter2 * parameter3) on the stack. This same mechanism is used by terminfo
.
Supporting termcap commands
termcap
commands do not use a stack mechanism. To support them, Panther uses an automatic parameter sequencing scheme where a current index into the parameter list is maintained. When a parameter is needed on the stack, the following actions occur:
The effect of this scheme is that Although it is possible to use automatic sequencing and explicit parameter pushes in the same sequence, it is not recommended. Explicit pushes of constants with automatic parameter sequencing, however, is a useful combination. For example:
termcap
-style commands are translated into terminfo
-style.
REPT= %p1 %c ESC F %'?' %p2 %+ %c
Video File Syntax |
A video file is initially created and edited as an ASCII text file, which is accessible with any text editor. Lines that start with a pound sign (#) are treated as comments and ignored by the vid2bin
utility when it converts the ASCII source file to binary format. All distributed video source files are documented with comments.
A video file consists of many instructions, one per line, and has the following format:
keyword = variable-data
When you add entries to a video file, it is essential that you use the formats described for the specific video instruction. No error checking is done at runtime. The vid2bin utility checks for errors like missing, misspelled, and superfluous keywords, but ignores duplicate or conflicting entries.
variable-data
depends on the keyword. Refer to "Parameters for Keyword Sequences" for information on keywords that use specific parameters as variable-data.
To continue a logical line on the next physical line, end the first line with a backslash. Do not leave a space between the backslash and carriage return. All white space (spaces and tabs) is skipped, except where noted. To enter a backslash as the last character of a line, use two backslashes (without spaces). Thus
text \ |
Continuation line |
text \\ |
Ends with a backslash |
text \\\ |
Backslash and a continuation |
A double quote "
starts a string. Text between it and the next double quote (or the end of the line) is taken literally, including spaces. To include a double quote in a quoted string, use backslash quote \"
with no space between.
"stty tabs" |
Has an embedded space |
stty tabs |
No embedded space |
The percent sign is a control character (refer to Table 7-3 for a list of percent commands). To enter a literal percent sign, enter it twice—for example, %%
).
You can enter in a video file non-printing characters such as control characters with these strings:
0x
followed by two hexadecimal digits. For example, use 0x41
for A
, or 0x01
for control-A. This method is useful for entering codes in the range 0x80
to 0xff
(extended ASCII control characters).
Refer to Table 6-4 for a list of mnemonics and hexadecimal values.
Extended ASCII control codes can be transmitted only if the communication line and terminal use eight data bits. Otherwise, the eight-bit code can be replaced by two seven-bit codes—the first code is
Note:
Some computers internally toggle the high bit of a character. The numbers given in this guide are always standard ASCII.
Certain keywords take values or sequences that cannot be completely specified in advance. For example, the cursor position sequence requires the line and column number before moving. The commands using these sequences are passed extra parameters.
Table 7-2 lists those keywords that are passed parameters. The number in parentheses is the number of parameters for each keyword.
Parameters are encoded in sequences by percent commands where the sequence starts with the ESC
(0x1b
), the second is 0x40
less than the desired eight-bit control character. For example, CSI
(0x9b
) is replaced by ESC 0x5b
, or ESC
[. If your video file contains extended ASCII control codes, Panther assumes they can be used; it does not transmit the two-character sequence automatically.
Parameters for Keyword Sequences
Percent Commands
%
symbol. Percent commands perform these tasks:
Panther uses a stack mechanism like that used by Percent commands are summarized in Table 7-3. They are organized by function, and their source is indicated (C for Percent commands that take a count (represented by a
Commands are available to push parameters and constants. Only four levels of stack are supported, and anything pushed off the end is discarded.
Various arithmetic and logical operations such as The automatic parameter sequencing mechanism works well in the above example. Because bitwise OR requires two parameters and there is only one on the stack, a push is performed. No push is required to process In the following sequence the first parameter is pushed, then a space character ( With automatic sequencing of parameters, sometimes it is necessary to access the parameters in a different order. The following percent commands can be specified:
Parameter changing commands either increment parameters or reverse them
Control flow commands conditionally execute command sequences. Some specify the number of times to repeat the sequence, and others select operations from a list.
This is the general if-then-else clause, which can be abbreviated by omitting the then-part and else-part can be any sequence, including the empty sequence. If else-part is empty, If In this sequence, In the next example, the constant (binary) 1 is pushed, the parameter is compared with 1, and the boolean value is left on the stack. If the value is true, nothing is done; otherwise the parameter is output as a decimal.
The following sequence exhibits a simple "either-or" condition that is sometimes used to toggle an attribute on or off. It outputs Performs the same action for several parameters. It is used with automatic parameter sequencing, and is almost useless if explicit parameter pushes are used. The count is specified after the percent sign. All the commands between %# (and %) are executed the specified number of times. For example, the first outputs three decimals, and the second outputs up to three non-zero parameters:
%3( %t %d %; %)
Available as an alternative to an if-then-else-if construction, but is seldom needed. It implements a simple select or case conditional. The general format is:
The values are single character constants representing the various cases. The expression is executed if the value matches the top of stack. At most one expression is executed (i.e., each case contains a break). If the value is missing, the expression is evaluated as a default. For correct operation, the default case must occur last in the list. The colons do not have a leading percent sign, so no selector can be a colon. The %; after the last element of the list is not required.
The parameter on the stack (automatically pushed, if necessary) is popped and tested against the various cases. The parameter index is incremented by one after the entire list is processed, even if the expressions use parameters. The following sequence outputs nothing if the parameter is 0; Certain terminals (or tty drivers) require extra time to execute instructions. Some terminal documentation specifies the delay required for each command. If random characters appear on the screen, particularly characters that are part of command sequences, time delays may be required. Delays can be introduced in two ways:
terminfo
; refer to "Parameters for Keyword Sequences" for a description. However, use percent commands with care, because all sequences go through the same processing, even those that do not use runtime arguments. In particular, to enter a percent sign as a literal, you must use %%
.
termcap
; I for terminfo
; E for Panther extended command). Descriptions and examples are provided in subsequent sections.
#
immediately after a %
) do not need to have a count specified. If none is specified, the count is assumed to be 1
. For example, %w
is equivalent to %1w
. (This does not apply to %d
.)
Output Commands
Stack Manipulation and Arithmetic Commands
%+, %/, %&, %>
are supported. They require one or two operands on the stack. If necessary an automatic push is generated, using the next parameter.
%'@' %| %| %| %c
Bitwise OR 3 parameters with @
, then output result
%c
because an entry already exists on the stack. Thus only three parameters are consumed and the result of the bitwise OR is output.
0x20
) is pushed. The %+
command pops and adds these values and puts the answer on the stack. %c
then pops this value and transmits it to the terminal.
%p1 %'SP' %+ %c
Parameter Sequencing Commands
Parameter Changing Commands
Control Flow Commands
Conditional Command
%? expr %t then-part%e else-part%;
if
:
expr %t then-part %e else-part %;.
expr
is any sequence including the empty sequence. The %t
, which is required, pops a value from the stack and tests it, executing then-part if it is true (non-zero) and else-part
otherwise.
%e
can be omitted. They can also contain conditionals, so else-if can be implemented. However, this can produce undecipherable sequences. It is provided for terminfo
compatibility. The list command (below) is an alternative.
%t
finds the stack is empty, it generates an automatic push of the next parameter. %t
consumes one parameter; however, the incrementing of the parameter index is delayed until after the entire conditional is executed. A conditional always consumes exactly one parameter, regardless of which branch is taken or of the content of then-part or else-part. If either of those use automatic parameter sequencing, they use a local index. Thus even if they consume two parameters, at the end of the conditional the parameter index is reset. When the next command is reached, only one parameter has been consumed.
%t ; %c %
;, one parameter is consumed. It outputs and a character if the parameter is non-zero, otherwise it skips the parameter.
%? %{1} %p1 %= %t %e %p1 %d %;
ESC
(if the parameter is non-zero, and ESC
) otherwise:
ESC %t ( %e ) %;
Repeat Command
%# (... %)
%3( %d %)
List Command
%l(... %)
%l(value1: expr1 %; value2: expr2 %; ... %)
ESC
if it is 1; FS
otherwise: %l( 0:%; 1:ESC%; :FS %)
Padding
Creating and Modifying a Video File |
If none of the distributed video files is suitable for your terminal type, you can create one with one of these methods:
term2vid
utility to create a video file from your terminal's termcap
or terminfo
data.
After you have a video file that displays Panther correctly on your terminal, you can enhance it to provide greater functionality.
It is easiest to create a video file by basing it on an existing one that you modify:
Modifying an Existing Video File
SMTERM
variable in your environment to the mnemonic (for example, SMTERM = vt100
) for the selected video file. (Or leave it unset and type the name in when prodev
prompts you for it.)prodev
and retrieve an existing screen or try creating one.If things seem to work closely to the way you would expect them to—you probably have a good, modifiable video file.
testvid
. ED
(erase display) entry and CUP
(cursor position) entry.vid2bin
.SMVARS
source file. Add the following entry after the last SMVIDEO
entry:
SMVIDEO = testvid.bin
SMVARS
source file to binary with var2bin
.prodev
and check the basic functions.The term2vid
utility uses your system's termcap/terminfo
entry to create a rudimentary video source file. The utility has this syntax:
term2vid [-f] terminalType
-f
allows the output to overwrite an existing file; terminalType
is the name of the terminal type, the value of the system TERM
variable.
The ASCII output file is named after terminalType
. If necessary, modify the source to include features not listed in the source termcap/terminfo
. After you edit the source, convert it to binary format with vid2bin
and test it.
After you have a basic working video file, you can enhance it to provide greater functionality. Incrementally add and test various features until you have a fully operational video file. The easiest way to add the recommended sequences is to copy them from an existing video file or, if available, from your terminal's documentation. The following features are commonly added:
CMFLGS.
(See "CMFLGS.")
SGR
, ASGR
, LATCHATT
, AREAATT
entries. (See "Display Attributes.")
CON
and COF
entries. (See "COF.")
Video File Keywords |
Table 7-4 includes a list of all video file entry keywords, arranged by function. Detailed information on each keyword is available on the indicated pages. Refer to the sample video file for syntax examples.
BOTTOMRT
BUFSIZ
BUFSIZ
to a large value; that effectively disables the delayed-write feature, which can interfere with debugging.
COLMS
LINES
and COLMS
are overridden by the number of lines and columns in the active window.
INIT
sm_initcrt. There is no default; and the keyword can be omitted. INIT
is typically used to change the mode of the terminal, to map function keys, select attribute styles, and so on. Padding is sometimes required, either with %#z or %#w
.
# map 2 function keys, then wait 2 seconds
INIT = %S( "/etc/keyset f1 ^a P ^m" %) \
%S( "/etc/keyset f2 ^a Q ^m" %) \
%2w
# load alternate character sets
INIT = ESC)F ESC*| ESC+}
INIT
and RESET
strings in the normal fashion. The format is
INIT = C n1, n2[, n3, flag]
RESET = C n1, n2[, n3]
1 |
no cursor |
2 |
fast blink (the default) |
3 |
slow blink |
0 |
fast blink (Not always valid on non-IBM systems) |
For a monochrome monitor: |
INIT = C 0, 13, 0 |
For a CGA monitor: |
INIT = C 0, 7, 0 |
For a EGA monitor: |
INIT = C 0, 13, 2 |
KBD_DELAY
If you use key sequences that are lead-ins of other sequences, you must assign a timing interval via KBD_DELAY
to determine when a key sequence ends.
LINES
OMSG and CMSG
for exceptions.)
REPMAX
REPT
can repeat. To determine the proper value of REPMAX
, omit the entry from the video file; then using prodev
, create a field that extends the entire width of the screen. Once you choose XMIT
, if the entire field has the underline attribute, you do not need the REPMAX
entry. If the field is not underlined, gradually shorten the field until the underlines fill the field. The resulting number determines the largest possible value of REPMAX
.
REPT
REPT
entry. The repeat sequence is used whenever possible, usually for borders and for clearing areas of the screen. If borders do not appear correctly, your sequence could be incorrect. A repeat sequence is not used to repeat a control character, and it never extends to more than one line.
For example, the following entry outputs the character, then ESC F
and the count with 0x3f (the ASCII value of '?') added:
REPT= %c ESC F %+ ?
REPT
entry. Anything over this count splits into more sequences.
REPMAX= 64
RESET
RESET
sequence should be set to undo the effects of INIT
. For many terminals a hard reset that resets the terminal to the state stored in non-volatile memory is appropriate.
ED
termcap
as cl
. Some terminals require padding after this command. The following example is common for ANSI terminals
ED = ESC [ J
EL
EL
is not in the video file, Panther erases the line by writing blanks. You can find the sequence in termcap
as ce
. Some terminals require padding after this command. The first example is common for ANSI terminals; the second illustrates a padded entry:
EL = ESC [ K
EL = ESC [ 0 K %100z
EW
CMFLGS
Note:
The AM
setting of CMFLGS
must match the auto-wrap setting of the terminal. If the setting is not correct, the terminal display may be irregular. Consider using INIT
and RESET
to turn terminal auto-wrap on and off as desired.
Most terminals are capable of the first three. The fourth can frequently be found in termcap
as am
. It cannot be used on terminals with the xen1
glitch (i.e., VT100-style delayed auto margin).
CUB
CUB = ESC [ %d D
CUD
CUD = ESC [ %d B
CUF
CUF = ESC [ % C
CUU
CUU = ESC [ %d A
CUP
termcap
as cm
. It takes two parameters: the target line and the target column, in that order and relative to 0. %i
(increment) is used to convert them to be relative to one. ANSI terminals need the line and column as decimals. Other terminals add a fixed value to the line and column to make them printable characters; %+
is used. The following example is for an ANSI terminal:
CUP = ESC [ %i %d;%d H
SP
. The entry might look like the following example:
CUP = FS C %+SP %+SP
COF
COF
and CON
should be specified. Menus (using a block cursor) look better with the regular cursor off. Also Panther often must move the cursor around the screen to put text in fields, to scroll arrays, and so on. If the cursor is off during these operations, the user is not disturbed by its flickering all over the screen.
CON
Note:
You can use the INIT
and RESET
sequences to switch between the cursor style used in Panther applications and that used on the command line.
Many terminals have no ability to turn the cursor on and off. Although Panther attempts to minimize cursor movement, some flickering is unavoidable.
CON
and COF
can sometimes be found in the terminal manual as cursor attributes and in termcap
as CO
and CF
. The following entries are an example of a pair of COF
and CON
sequences for some ANSI terminals:
CON = ESC [>5l
COF = ESC [>5h
INSOFF
and INSON
INSOFF
and INSON
, change the cursor style so that you can easily see which mode you are in: insert or overstrike. By convention, the insert cursor is about one-half the size of the regular, overstrike cursor. INSOFF
or INSON
is issued to the terminal when you toggle Panther's data entry mode using the INSERT
key. On many terminals, changing the cursor style also turns it on; in this case, the INSOFF
is the same as COF
, so you can omit it altogether. If the cursor style can be changed without turning it on or off, use both INSON
and INSOFF
. Uses the same escape sequence format as INIT
and RESET
.
RCP
and SCP
SCP
) and restores (RCP
) cursor position and attribute.
Panther supports highlight, blink, underline and reverse video attributes. If either highlight or blink is not available, low intensity is supported in its place. An additional attribute, standout, can be assigned to any other desired attribute—for example dim or italics, if available. The display attribute keywords AREAATT
and LATCHATT
are used to list the attributes available in each style and associate a character with each attribute.
Panther supports three different kinds of attribute handling.
You can set several modes on your terminal. Many terminals support both area and onscreen attributes. If so, you should select area ("non-embedded" or "no space") rather than onscreen ("embedded" or "spacing") attributes. Some terminals support one latch attribute and several area attributes simultaneously.
If your terminal has only one attribute style available, it is recommended that you select reverse video. Panther supports non-display in software, so you can omit that attribute. Underlines are simulated (by writing an underscore character) if that attribute is not available.
You can find attribute information in your terminal's documentation or, perhaps, in your If you find something like these, ANSI latch attributes are available. If you find entries termcap
database (if applicable). The codes so
, ul
and bl
specify standout (usually reverse video), underline, and bold respectively. The codes se, ue and be specify the sequence to end the attributes. The standard ANSI sequences are:
so=\E[7m:se=\E[0m:ul=\E[4m:ue=\E[0m:bl=\E[1m:be=\E[0m
ug#1:sg#1
, onscreen attributes are available.
AREAATT
In addition, flags are available that specify how the attributes are implemented by the terminal. The flags are:
Area and onscreen attributes modify all characters from the start attribute to the next attribute or to an \Qend', whichever is closer. (An \Qend' is either the end of the screen or the end of the line.) If there is no \Qend', use SCREENWRAP
. If the end is the end of screen, use LINEWRAP
. If end is the end of the line, omit both wrap flags. Some terminals allow you to select the style. For onscreen attributes, SCREENWRAP
is best and LINEWRAP
a good second; for area attributes the choices are about the same. If the attribute takes up a screen position, use the ONSCREEN
flag.
AREAATT= BLINK= 2 DIM= p REVERSE= 4 UNDERLN= 8 \
ONSCREEN LINEWRAP
ASGR = ESC G %u %'0' %5( %| %) %c
On some terminals writing a character at the position where an attribute was set can remove the attribute. Immediately after placing the attribute, the character may be written with no problems; however, the next time a character is written there, the attribute disappears. In this case, use the REWRITE
flag to reset the attribute before writing to that position. The following example illustrates how the REWRITE
flag is used (in Televideo 925 video file):
AREAATT = REVERSE = 4 UNDERLN = 8 BLINK = 2 REWRITE
ASGR = ESC G %'0' %9( %| %) %c
Some terminals restrict the number of attributes, use an ARGR
entry to remove attributes.
ARGR
ASGR
) that are available on a given line. If possible, use an ARGR
entry. Changing an attribute to normal does not remove it; a normal attribute stops the propagation of a previous attribute only. The following example illustrates how the ARGR entry might appear in your video file:
AREAATT = REVERSE = Q UNDERLN = \Q
ASGR = ESC d %u %'@' %5( %| %) %c
ARGR = ESC e
ARGR
entry to remove repeated attributes, to avoid exceeding the maximum number of attributes on a line. If there is no maximum, the remove attribute sequence can be omitted; it sometimes makes the screen "wiggle."
If the maximum number of attributes is small, Panther's performance can be limited. ARGR
is desirable because having many attributes onscreen can dramatically slow performance, because Panther must keep rewriting them as attributes change.
ASGR
AREAATT
, is passed twelve parameters. The first nine are the same as used by terminfo
. The parameters, in order, represent:
SGR
. If the attribute is not desired, the parameter passed is (binary) 0.
If no attributes are specified in the video file, Panther supports only two attributes: non-display (done in software anyway) and underline (using the underscore character).
COLOR
LATCHATT
associates a character with each attribute. Panther supports eight foreground and background colors. The CTYPE
entry has flags that tell Panther what background color is available. You only need to specify the three primary colors in the video file. If other colors are not specified, they are generated according to the following rules:
BLACK = |
RED & GREEN & BLUE |
BLUE |
Must be specified |
GREEN |
Must be specified |
CYAN = |
GREEN | BLUE |
RED |
Must be specified |
MAGENTA = |
RED | BLUE |
YELLOW = |
RED | GREEN |
WHITE = |
RED | GREEN | BLUE |
SGR
or ASGR
is the character representing the foreground color; the eleventh represents the background color (it is 0 if background color is not available). Many ANSI terminals set foreground color with the following sequence: ESC [ 3x m
– where x
ranges from 0 for black to 7 for white. Background color is often set with ESC [4x m
. The order of the colors varies from terminal to terminal.
On color terminals, REVERSE
often means black on white. If background color is available, Panther prefers that REVERSE
is not specified in the video file. It uses the specified color as the background, and either black or white as the foreground. The following example is suitable for a color ANSI terminal:
LATCHATT = HILIGHT = 1 BLINK = 5
COLOR = RED = 4 GREEN = 2 BLUE = 1 BACKGRND
SGR = %3u ESC [ 0 %3( %?%t ; %c %; %) ; %3u 3%c ; 4%c m
If the terminal has a unique sequence for each color, a list command works well. In the following example, the ANSI attribute sequence ESC [ 0 ; p1 ; p2 ; ... m)
is used:
LATCHATT = REVERSE = 7 HILIGHT = 2
COLOR = CYAN = 0 MAGENTA = 1 BLUE = 2 YELLOW =3 \
GREEN = 4 RED = 5 BLACK = 6 WHITE = 7
SGR = ESC [ 0 %p3%t;7%; %p6%t;2%; \
%l( 0:;>1%; 1:;5%; 2:;5;>1%; 3:;4%; \
4:;4;>1%; 5:;4;5%; 6:;4;5;>1 %) m
The values for the colors are:
cyan >1
magenta 5
blue 5 ; > 1
yellow 4
green 4 ; > 1
red 4 ; 5
black 4 ; 5 ; > 1
Some terminals use ESC [ 2 ; x ; y
m to set color and other attributes—x is the foreground color and y is the background color; both numbers range from 0 to 7. If highlight is desired in the foreground, 8
should be added to x. If blink is desired, 8 should be added to y. The following video entries satisfy these requirements:
LATCHATT = HILIGHT = 8 BLINK = 8
COLOR = RED = 4 GREEN = 2 BLUE = 1 BACKGRND
SGR = ESC [ 2 ; %p10 %p6 %+ %d ; %p11 %p4 %+ %d m
EMPHASIS_KEEPATT
HILIGHT
. This variable is used in conjunction with the EMPHASIS
setup variable. You can change this setting at runtime with the library function sm_pset. Refer to Table 2-1 for a list of display attribute keywords.
EMPHASIS_SETATT
REVERSE
and DIM
. This variable is used in conjunction with the EMPHASIS
setup variable. You can change attributes at runtime with the library function sm_pset. Refer to Table 2-1 for a list of display attribute keywords.
LATCHATT
LATCHATT = attribute = value attribute = value ...
So a typical LATCHATT
might look like:
LATCHATT = HILIGHT =1
BLINK =5
UNDERLN =4
REVERSE =7
If the equal sign and value are missing, the attribute is given the value (binary) 1.
Most ANSI terminals use latch attributes, and the codes are fairly standardized. To determine which attributes are supported and how attributes can be combined, if at all, examine the SGR
entry that usually follows the LATCHATT
entry. Some ANSI terminals support color, either foreground only or foreground and background. The sequences for color are far less standard.
Terminal manuals often describe the sequence as "set graphics rendition." A common description reads:
ESC [ p1 ; p2 ; ... m
where p n= |
0 for normal |
|
1 for bold |
|
5 for blink |
Thus ESC
[ 0 m is normal, ESC
[ 1 m is bold, ESC
[ 1 ;5 m is bold and blinking. Often, setting an attribute does not remove others, so it is best to reset to normal first, using ESC
[0; 1 m for bold, ESC
[0;1;5m for blinking bold, and so on. The coding in the video file is as follows:
LATCHATT = HILIGHT = 1 BLINK = 5 UNDERLN = 4 REVERSE = 7
SGR = ESC [ 0 %9(%t ; %c %; %) m
The meaning of the above SGR
sequence is as follows. The sequence is passed 11 parameters, each 0 (if the attribute is not to be set) or the character in the LATCHATT
list. First, ESC
[ 0 is output. The %t
test, repeated 9 times, causes the zero parameters to be skipped. A non-zero parameter causes a semicolon and the parameter to be output. Finally, the character m
is output. If the normal attribute is wanted, all parameters are 0, and the output sequence is ESC
[ 0 m. For underline SGR
is ESC
[ 0 ; 4 m.
If highlighted, blinking, and reverse video are desired, the output is
ESC [ 0; 7 ; 5 ;1 m.
Some terminals (or emulators) do not accept the method of combining attributes used above. In that case, one sequence followed by the next might work—for example, ESC
[ 1
m ESC
[ 7m
. Some terminals cannot combine attributes at all. Here are some more ANSI and near-ANSI examples:
Standard ANSI terminal
LATCHATT= HILIGHT=1 BLINK=5 UNDERLN=4 REVERSE=7
ANSI with low intensity but no highlight
LATCHATT= DIM=2 REVERSE=7 UNDERLN=4 BLINK=5
Only one attribute available:
LATCHATT= REVERSE=7
Repeat of above SGR example
SGR = ESC [ 0 %9(%t ; %c %; %) m
Attributes cannot be combined
SGR = ESC [ 0 m %9(%t ESC [ %c m %; %)
Skip parameters that are always 0
SGR = %u ESC [ 0 %5(%t ; %c %; %) m
In the next LATCHATT/SGR
example explicit pushes are used to select the appropriate parameter. The second pair is the same as the first, but the attribute is treated as a boolean. The first uses the optional %?
, the second omits it.
LATCHATT = DIM = 2
SGR = ESC [ m %? %p5 %t ESC [ 2 m %;
LATCHATT = DIM
SGR = ESC [ m %t ESC [ 2 m %;
The following is suitable for terminals that support all attributes but cannot combine them. It selects one attribute giving preference to REVERSE
, UNDERLN
, BLINK
, and HILIGHT
in that order. It uses a complicated "if-then-elseif-elseif-elseif" structure. Automatic parameter sequencing cannot be relied on, so explicit parameter pushes are used.
LATCHATT = HILIGHT BLINK UNDERLN REVERSE
SGR = ESC [ %p3 %t 7 %e %p2 %t 4 %e %p4 %t 5 %e \
%p6 %t 1 %; %; %; %; m
Some terminals use bit-mapped attributes. Terminal manuals are not usually explicit on this. Often they use tables like that described in Table 7-5.
After poring over the ASCII table for a while, it becomes clear that this is bit-mapped, with the four high-order bits constant (0x30) and the four low-order bits varying, like this:
This can be coded in the video file as follows. The attributes are OR-ed with a starting value of '0' (0x30).
LATCHATT = BLINK = 2 REVERSE = 4 UNDERLN = 8
SGR = ESC G %'0' %9( %| %) %c
Following are examples of LATCHATT
entries that can be used with a Videotex terminal. The LATCHATT
entries, when used with the SGR
entry, have equivalent equivalent results. The bits are OR-ed together with a starting value of 0x40, or @
, and the result is output as a character.
LATCHATT= UNDERLN=DLE BLINK=STX REVERSE=EOT HILIGHT=SP
LATCHATT= UNDERLN= ^P BLINK= ^B REVERSE= ^D HILIGHT= SP
LATCHATT= UNDERLN= 0x10 BLINK= 0x02 REVERSE= 0x04 \
HILIGHT= 0x20
LATCHATT= UNDERLN= P BLINK= B REVERSE= D HILIGHT= \Q
SGR = FS G %'@' %9( %| %) %c
Some terminals that use area attributes support a single latch attribute. It is often called "protected" and is used to indicate protected areas when the terminal is operated in block mode. The following example switches between protected and unprotected modes in order to use low intensity. (Be aware that a terminal might become very slow when using the protect feature.) The SGR
sequence depends only on the attribute being non-zero, so no value is necessary:
LATCHATT = DIM
SGR = ESC %?%t ) %e ( %;
SGR
LATCHATT
sequence, is passed twelve parameters.
If an attribute is desired, the parameter passed is the character associated with the attribute, as explained below. If the attribute is not desired, the parameter passed is (binary) 0.
For example, a video file might contain this entry:
LATCHATT = REVERSE = 7 HILIGHT = 1 BLINK = 5 UNDERLN = 4
If a field is to be highlighted and underlined, the SGR
sequence is passed (0, '4', 0, 0, 0, '1', 0, 0, 0). The second and sixth parameters represent underline and highlight; they are set to the corresponding values in the LATCHATT
entry. The rest are zero. To make the field reverse video and blinking, SGR
is passed (0, 0, '7', '5', 0, 0, 0, 0, 0) .
If no attributes are specified in the video file, Panther supports only two attributes: non-display (done in software anyway) and underline (using the underscore character).
SPXATT
SPXATT = BOLD DIM BLANK BLINK COLOR
For efficiency, this entry reduces the number of characters sent to a screen. It defaults to COLOR BLANK HILIGHT DIM
. To turn it off entirely, use:
SPXATT =
Panther usually uses a line from the screen to display status text and error messages. Thus a 25-line screen (as specified in the LINES
keyword) has 24 lines for the screen, and one for messages. This use of a normal screen line for messages is the default.
Terminals that use a separate status line can use different attributes on the status line than on the screen itself. Panther provides some support for this ability; for very complicated status lines, you must write a routine and install it with sm_install using the STAT_FUNC
function type. For more information on installing a status line function, refer to "Status Line Function" on page 44-45 in Application Development Guide.
OMSG
and CMSG
OMSG
entry to open the status line, and CMSG
to close it. These entries are used primarily for those terminals that have a special status line that cannot be addressed by normal cursor positioning. All text between these sequences appears on the status line. No assumption is made about clearing the line; Panther always writes blanks to the end of the line.
OMSG = ESC f
CMSG = CR ESC g
If the OMSG
entry is present in your video file, Panther uses all the lines specified in the LINES
entry for screens.
MSGATT
The attribute for the status line is specified as either a latch (LATCHATT
) or area (AREAATT
) attribute, and the sequence to set it must is given in the SGR
or ASGR
keyword. For example, if REVERSE
is listed in MSGATT
and REVERSE
is a latch attribute, then SGR
sets it. Attributes that appear in MSGATT
and do not appear in either LATCHATT
or AREAATT
are ignored.
In order for Panther to determine the correct length of a line, it is important to know whether area attributes are onscreen or not. It is not uncommon for area attributes to be non-embedded on the screen but embedded on the status line. Use the ONSCREEN
flag in MSGATT
to inform Panther of this condition.
LATCHATT = DIM
AREAATT = REVERSE UNDERLN BLINK
MSGATT = REVERSE UNDERLN BLINK ONSCREEN
MSGATT = AREAATT ONSCREEN
The two MSGATT
entries are equivalent. They show a case where only area attributes are available on the status line and they take a screen position. The area attributes in the normal screen area do not.
Panther has support for eight-bit ASCII codes as well as any graphics that the terminal can support in text mode. Bitmapped graphics are not supported.
GRAPH
Some terminals have a special compose key, active in eight-bit mode. Generally, you would press the compose key followed by one or two more keys, generating a character in the range 0xa0
to 0xff
. Panther can process such characters as normal display characters, with no special treatment in the video file.
Other terminals have special keys that produce sequences representing special characters. The key translation file can be used to map such sequences to single values in the range 0xa0
to 0xfe
. (Refer to the Developer's Guide for a way to use values outside that range.) The video file can then specify how these values are output to the terminal.
Often, to display graphics characters, a terminal must be told to "shift" to an alternate character set (in reality, to address a different character ROM). The video file's GRAPH
entries tell which alternate set to use for each graphics character, and how to shift to it. Whenever Panther is required to display a character, it looks in the GRAPH
table for that character (refer to the description on MODE0
through MODE6
for information on what happens). If it is not there, the character is sent to the terminal unchanged.
GRTYPE
GRTYPE
keywords can be combined. The format is:
GRTYPE = [GRTYPE] keyword...
The GRTYPE
keyword can be any of the following:
|
|
|
same as |
|
|
|
|
|
|
An entry in the GRAPH
table is made for each character in the indicated range, with mode 0. If the mode is not 0, you must construct the GRAPH
table by hand.
MODE0
through MODE6
MODES0
through MODE3
are locking shifts. All characters following are shifted, until a different shift sequence is sent.
MODES4
through MODE6
are non-locking or single shifts, which apply only to the next character.
You may need to use the INIT
entry to load the character sets you want for access by the mode changes.
|
switch to standard character set |
|
alternate set 1 |
|
alternate set 2 |
|
alternate set 3 |
|
... |
|
|
|
|
Different modes can be used to support foreign characters, currency symbols, graphics, and so on. Panther makes no assumption as to whether the mode changing sequences latch to the alternate character set or not. To output a character in alternate set 2, Panther first outputs the sequence defined by MODE2
, then a character, and finally the sequence defined by MODE0
(which may be empty, if the others are all non-locking). Here are three examples:
MODE0 = SI
MODE1 = SO
MODE2 = ESC n
MODE3 = ESC o
Sample of ANSI standard
MODE0 = ESC [ 10 m
MODE1 = ESC [ 11 m
MODE2 = ESC [ 12 m
MODE3 = ESC [ 13 m
MODE0 =
MODE1 = SS1
MODE2 = SS2
Any of the MODE
n strings may also contain a list of attributes. When a character in that mode is displayed, that attribute is added to whatever attribute is already in effect. On some terminals, like the HP, only an attribute is required. For example:
MODE4 = ACS
This forces all mode 4 characters to be displayed using the alternate character set.
Any character in the range 0x01
to 0xff
can be mapped to an alternate character set by use of the keyword GRAPH
. The value of GRAPH
is a list of equations. The left side of each equation is the character to be mapped; the right side is the number of the character set (0, 1, 2, 3), followed by the character to be output. Any character not so mapped is output as itself. For example, suppose that 0x90 =1 d appears in the GRAPH
list. First the sequence listed for MODE1
is sent, then the letter d, and then the sequence listed for MODE0
.
In the following example, 0x81
is output as SO / SI
, 0xb2
as SO 2 SI
, and 0x82
as ESC o a SI. LF, BEL
and CR
are output as a space, and all other characters are output without change. This output processing applies to all data coming from Panther. No translation is made for direct calls to printf
, putchar
, and so on. Thus \n
and \r
will still work correctly in printf
, and putchar
(BEL
) still rings the terminal bell.
MODE0 = SI
MODE1 = SO
MODE2 = ESC
nMODE3 = ESC o
GRAPH = 0x81 = 1 / 0xb2 = 1 2 0x82 = 3 a LF = 0 SP\
BEL = 0 SP CR = 0 SP
For efficiency, use single shifts to obtain accented letters, currency symbols, and other characters that appear mixed in with unshifted characters. Graphics characters, especially for borders, are good candidates for a locking shift.
It is possible, though not recommended, to map the usual display characters to alternates. For example, GRAPH = y = 0 z
causes the y key to display as z
. Graphics characters are non-portable across different displays, unless care is taken to ensure that the same characters are used on the left-hand side for similar graphics, and only for a common subset of the different graphics available.
The characters constituting the border and line drawing styles can be specified in the video file.
BORDER
BORDER
entry is portable across different platforms because Panther saves a border as a style number in the screen file. Style 1 is the default.
0. 1.
IIIII _____
I I | |
IIIII _____
2. 3.
+++++ =====
+ + | |
+++++ =====
4. 5.
%%%%% .....
% % : :
%%%%% .....
6. 7.
***** \\\\\
* * \ \
***** \\\\\
8. 9.
///// #####
/ / # #
///// #####
The data for BORDER
is a list of 8 characters per border, in the order: upper left corner, top, upper right corner, left side, right side, lower left corner, bottom, lower right corner. The default border set is:
BORDER = SP SP SP SP SP SP SP SP \
SP _ SP | | | _ | \
+ + + + + + + + \
SP = SP | | SP = SP \
% % % % % % % % \
. . . : : : . : \
* * * * * * * * \
\ \ \ \ \ \ \ \ \
/ / / / / / / / \
# # # # # # # #
In addition, attributes can be specified for each set of border characters. For example:
BORDER = SP SP ... SP REVERSE \
; A ... + ACS \
If there is a GRAPH
entry in the video file, you can use the graphics character set of the terminal for borders. Choose some numbers to represent the various border parts. The GRAPH
option can be used to map these numbers to a graphics character set. The numbers chosen are arbitrary, except that they should not conflict with ordinary display characters. Even if the extended 8-bit character set is used, there are unused values in the ranges 0x01 to 0x1f and 0x80 to 0x9f.
BOX
BOX
entry lists either five or thirteen characters per set. If only five characters are specified the remaining eight are taken from the corresponding BORDER
set.
Although the format in the video file is similar, Panther uses BOX
and BORDER
differently. While BORDER
entries are portable across platforms, Panther saves line drawing as display data. To ensure portability, avoid assigning graphic characters to the BOX
keyword. Instead, use characters that are displayable on all terminals.
BRDATT
BRDATT
entry to limit the attributes available in the border. Normally HILIGHT
(or DIM
) and REVERSE
are used; however, if your terminal uses onscreen attributes or can accommodate only a few attributes per line, it may be better to prohibit attributes in borders—use the entry BRDATT
= NONE
.
The flags used in MSGATT
can also be used with BRDATT
; however, the only attributes available are HILIGHT
, DIM
, and REVERSE
.
ARROWS
<, >, X for shifting
^, v, X for scrolling
The character X is used when two shifting/scrolling fields are next to each other; it represents a combination of both <
and >
.
ARROWS = < > X ^ v X
Shift/scroll indicators are black on screens with background colors of white, yellow, or cyan. They are white on all other screen background colors. You cannot alter indicator colors.
BELL
BELL
sequence can sometimes be found in the termcap
file under vb
.
CBDSEL
and CBSEL
CBSEL
) and deselection (CBDSEL
) characters for groups. If there are no entries for CBSEL
and CBDSEL
in your video file, the internal defaults are X for CBSEL
and a blank for CBDSEL
. For radio button or checklist widgets, these characters are used to indicate which fields are selected and which are not. You can add these entries to the video file to override the defaults. For example:
CBSEL = y
CBDSEL = n
As a result, Panther uses a y
to indicate a selected occurrence; NL deselects the occurrence, and Panther inserts an n
in the box.
MARKCHAR
X
. For example, the following example specifies the square root symbol (/) as the mark character. This variable is optional for supporting those character-mode applications that use menu bars and is most useful in video files that support reasonable graphical characters.
MARKCHAR = 0xFB
OPTMNUIND
v
. This variable is optional for character-mode applications.
SLIDER
SLIDER = left-arrow right-arrow bar thumb \
up-arrow down-arrow bar thumb
For example, these characters are defined in vt100vid
:
SLIDER = < > = # ^ v / #
You can use hex values of graphics characters for those terminals that support them. For example:
SLIDER = 0x11 0x10 0xb0 0xb2 0x1e 0x1f 0xb0 0xb2
SUBMNSTR
MOUSEDRIVER
AT
, SCO
, Jterm
, and xterm
.
COMPRESS
COMPRESS = JTERM
CURPOS
CURPOS
entry causes the current cursor position to be displayed on the status line at the specified intervals:
CURPOS = 1
CURPOS = 3
CURPOS = 7
CURPOS = 0
When possible, Panther uses non-blocking keyboard reads. If no key is received within a specified time, the cursor position display is updated. This allows fast typists to type at full speed; when the typist pauses, the cursor position display is updated.
The delay depends on the baud rate and your terminal. If there is no non-blocking read, a non-zero value of CURPOS
enables the display and zero disables it. If the terminal has its own display, omit CURPOS
.
Sample Video File |
This sample video file is for a basic ANSI terminal (like a VT100) It contains the basic capabilities, plus control sequences to erase a line and to apply the reverse video, underlined, blinking, and highlighted visual attributes. The entries for CUP
and SGR
are more complicated because they require additional parameters at runtime.
# Display size (these are actually the default # values)
LINES = 24
COLMS = 80
# Erase whole screen and single line
ED = ESC [ 2 J
EL = ESC [ 0 K
# Position cursor
CUP = ESC [ %i %d ; %d H
# Standard ANSI attributes, four available
LATCHATT = REVERSE = 7 UNDERLN = 4 BLINK = 5 HILIGHT = 1
SGR = ESC [ 0 %u %5(%t ; %c %; %) m