Terminal Output
TERM Command
The TERM command allows a user to query or establish certain characteristics of the terminal. When used from the shell as an interactive command:
TERM
the command displays the terminal characteristics. The terminal “type” can also be set from the command line, for example,
TERM VT220
sets the terminal to have the characteristics of a DEC VT220.
The characteristics of the terminal are usually set from a program, however, where the command format is
TERM swidth,sdepth,,,,,pwidth,pdepth,termtype
where:
-
swidth and sdepth are the screen width (in characters) and depth (in lines)
-
pwidth and pdepth are the printer width and depth (also in characters and lines, respectively)
-
termtype is the terminal type identifier and can appear anywhere in the command as a non-numeric argument
Arguments 3, 4, 6, and 10 of the command are no longer used; if present, they will be ignored.
The TERM command also supports single character terminal names which are synonyms for other terminal names. For example,
TERM W
selects the Wyse 60 terminal. To list the supported terminals and their single character synonym (if any), use the CHOOSE.TERM command.
The CHOOSE.TERM Command
The CHOOSE.TERM command allows you to see what terminals are supported on your system and then allows you to select a terminal type by entering a number, the name, or the short name. For example,
USER:CHOOSE.TERM Terminal Description Term Name Short Name -------------------- --------- ---------- 1) ansi/pc-term compatible with co ANSI 2) AT&T 605 80 column 102key keybo ATT605 Z 3) cache terminal based on vt220 CACHE 4) Hazeltine Esprit I, ESPRIT E ... ... ... 31) xterm terminal emulator (X Wind XTERM Choose number, term name or short name :
The Short Name field is where the terminal definition has a “termtype=Xentry” and so allows the terminal to be selected via the TERM command using a single character synonym.
The SYSTEM() Function
The MVBasic SYSTEM () function is used to return a limited set of information about the terminal in use. The format is
SYSTEM(code)
where code is an integer that specifies the information desired. The following code values are used for terminal information:
-
1: return a non-zero value if output is not directed to a terminal
-
2: returns the screen width
-
3: returns the screen depth
-
7: returns the type name of this terminal
The @() Function
MultiValue Basic provides terminal output independence using the @ function call, as follows:
-
@(m,n) where m is a positive integer
Moves the cursor to column m and row n, where @(0,0) is the top left hand side of a terminal.
-
@(m) where m is a positive integer
Moves the cursor to column m on the current row.
-
@(m) where m is negative integer
Generates video effect character strings. The value of m and the effect intended are emulation dependent and given by the table below.
-
@(m,n) where m is a negative integer
The same as @(m), except some video effects take an optional argument n, as shown by (nn) in the table below.
Predefined Names
The table below shows all the values we use from a terminfo definition. Caché does not use them all; it only use the ones necessary to support MultiValue Basic. In this table, there are some Caché defined names. These are shown by the name starting with an 'x' and the word "NEW" in the description field.
In the table below, the @(-nn) values vary between emulation. The values shown are for Cache Ideal (aka UniVerse) emulation, unless otherwise noted. The expression 'video attributes' refer to effects such as bold, dim, reverse and so on.
Name | Description | Usage |
---|---|---|
bel | Bell sounds | @(-108) or @(-19) in Unidata emulation |
blink | Start blinking video attribute | @(-5) |
bold | Start bold video attribute | @(-58) |
civis | Make cursor invisible | @(-31) |
clear | Clear screen and move cursor home | @(-1) |
cnorm | Turn cursor back on | @(-32) |
cub | Move the cursor left a number of columns | @(-9,nn). @(-9) when cub1 not available |
cub1 | Move the cursor left a single column | @(-9). @(-9,nn) when cub not available |
cud | Move the cursor down a number of rows | @(-33,nn). @(-33) when cud1 not available |
cud1 | Move the cursor down a single row | @(-33). @(-33,nn) when cud not available |
cuf | Move the cursor right a number of columns | @(-nn) and @(-34,nn). @(-34) when cuf1 not available |
cuf1 | Move the cursor right a single column | @(-34). @(n) and @(-34,nn) when cuf not available. |
cup | Position the cursor at a specific column and row | @(col,row) cursor function call |
cuu | Move the cursor up a number of rows | @(-10,nn). @(-10) when cuu1 not available |
cuu1 | Move the cursor up a single row | @(-10). @(-10,nn) when cuu not available |
dch | Delete a number of characters | @(-22,nn). @(-22) when dch1 not available |
dch1 | Delete one character | @(-22) . @(-22,nn) when dch not available |
dim | Start dimmed mode attribute | @(-11) |
dl | Delete a number of lines | @(-18,nn). @(-18) when dl1 not available |
dl1 | Delete one line | @(-18) . @(-18,nn) when dl not available |
ech | Erase a number of characters | @(-71,nn) |
ed | Clear screen from cursor to end of screen | @(-3) |
el | Clear screen from cursor to end of line | @(-4) |
home | Move cursor to home position | @(-2) |
ich | Insert a number of characters | @(-19,nn). @(-19) when ich1 not available |
ich1 | Insert one character | @(-19) . @(-19,nn) when ich not available |
il | Insert a number of lines | @(-17,nn). @(-17) when il1 not available |
il1 | Insert one line | @(-17) . @(-17,nn) when il not available |
ind | Scroll up a single lines | @(-48). @(-48,nn) when indn not available |
indn | Scroll up a number of lines | @(-48,nn). @(-48) when ind not available |
mc0 | Dump contents of screen to printer | @(-28) |
mc4 | Reset auxiliary printing | @(-24). @(-26) if xmc4i not available |
mc5 | Start auxiliary printing to screen and printer | @(-23). @(-25) if xmc5i not available |
prot | Start protected field attribute | @(-7) |
rev | Start reverse video attribute | @(-13) |
ri | Scroll up a single line | @(-49). @(-49,nn) when rin not available |
rin | Scroll up a number of lines | @(-49,nn). @(-49) when ri not available |
rmir | Reset insert mode | @(-21) |
rmso | Exit standout attribute | @(-59) |
rmul | Reset underscore attribute | @(-16) |
setab | Set a background color | @(-38) and @(-38,nn) |
setaf | Set a foreground color | @(-37) and @(-37,nn) |
sgr | Reset specific video attributes Bit mapped video attribute calls. sgr0 = Reset all video attributes | @(-128) function call. When other reset attributes not found |
smir | Start insert mode | @(-20) |
smul | Start underscore attribute | @(-15) |
xblink | NEW Reset blinking video attribute | @(-6) |
xbold | NEW Reset bold video attribute | @(-59) if rmso is not available |
xdim | NEW Reset dimmed mode attribute | @(-12) |
xdisableprotect | Disable protected field handling | @(-63) or @(-12) in D3 mode |
xdmi | NEW Disable manual input | @(-42) |
xemi | NEW Enable manual input | @(-43) |
xenableprotect | Enable protected field handling | @(-62) or @(-11) in D3 mode |
xenter132 | NEW Enter 132 column mode | @(-30) |
xenter80 | NEW Enter 80 column mode | @(-29) |
xhpa | NEW Position the cursor at a specific column (This is used in preference to the hpa value which not all terminals work successfully with) | @(col) cursor function calls |
xhpa1 | NEW Set column position | @(-70). @(-70,nn) if hpa not available |
xmc4i | NEW Reset auxiliary printing to printer only | @(-26) |
xmc5i | NEW Start auxiliary printing to printer only | @(-25) |
xprot | NEW Reset protected field attribute | @(-8) |
xrev | NEW Reset reverse video attribute | @(-14) |
xrnumeric | NEW Reset numeric keypad | @(-57) |
xrtrunc | NEW Reset line truncate | @(-55) |
xscl | NEW Scroll left a single column | @(-51). @(-51,nn) when xscl1 not available |
xscl1 | NEW Scroll left a number of columns | @(-51,nn). @(-51) when xscl not available |
xscr | NEW Scroll right a single column | @(-50). @(-50,nn) when xscr1 not available |
xscr1 | NEW Scroll right a number of columns | @(-50,nn). @(-50) when xscr not available |
xsetafdim | NEW Set foreground color dimmed | @(-109 through @(-116) or @(-57) to @(-64) in D3 emulation |
xsmul | NEW Reset underscore attribute | @(-16) if rmul is not available |
xsnumeric | NEW Set numeric keypad | @(-56) |
xstrunc | NEW Set line truncate | @(-54) |
jBASE- And Reality-specific Codes
Values -128 through -191 are for Reality video effects and are a bit map of video effects as shown in the list below. Caché supports these values for ALL emulations as there is no conflict. These values are additive. The only values Caché supports are:
-
0x01 – Half intensity
-
0x02 – Blink
-
0x04 – Reverse
-
0x08 – Blanked
-
0x10 – Underscore
-
0x20 – Bold
-
0x40 – (not defined)
-
0x80 – Always 1
Value @(-128), which turns off ALL video effects, is available for all emulations.
MVBASE-Specific Codes
The color sequences @(-57) through @(-64) are used in the MVBASE emulation to produce dimmed foreground colors. The dimmed colors are white, yellow, magenta, red, cyan, green, blue, and black, respectively.