C-PLOT

Scientific Graphics and Data Analysis

A.6. - Optimizing terminal capabilities for PseudoGraphics



Most installations of UNIX operating systems include a facility for describing the capabilities and special character sequences of terminals in a uniform way. On some versions of the operating system, the file /etc/termcap contains the capabilities. On other systems, files in the directory /usr/lib/terminfo are used. The following termcap/terminfo capabilities are used for PseudoGraphics, where the two-letter code is the conventional name of the capability.

 Code   Description 
 as   Start alternate character set 
 ae   End alternate character set 
 cl   Clear screen and home cursor 
 ho   Home cursor 
 cm   Cursor motion 
 up   Cursor up 
 md   Begin bold mode 
 so   Begin stand-out mode 
 se   End stand-out mode 
 ti   Initialize terminal 
 te   Reset terminal 
 li   Lines 
 co   Columns 

Values for the number of lines and columns on the tty screen are taken from the environment variables LINES and COLUMNS, rather than the termcap or terminfo databases, if available. If these values aren't present, the defaults of 24 lines and 80 columns are used. If the TIOCGWINSZ ioctl() mode is present on windowing systems, that command is used to obtain the window size.

Stand-out mode is used in the C-PLOT package when highlighting data points in the video-display version of the command gd 7 (see Chapter 3), as well in highlighting text displayed with the help command.

The capabilities as and ae are often missing from standard data bases. Their function is to start and end translation to the terminal's alternate character set. The PseudoGraphics features use characters from the alternate character set, if available, to outline the axis, show the tick marks and plot the points. The codes for the alternate characters themselves are not generally part of the terminal capabilities databases. Thus, the codes for these characters are built into the plot program, but only for a selected number of terminals.

There are five alternate character sets built into the program. One of these character sets is automatically chosen when the plot program starts up based on the value of the TERM variable. The recognized names are shown in the following table. The first entry is used when TERM doesn't match any of the other names.

 Special Characters   TERM names   Other name 
 none   dumb   plot0 
 VT100   vt100 vt52 v132 xterm   plot1 
 Zenith   h19 Z19 z29 Z29   plot4 
 IBM PC   ibmpc pc PC   plot5 
 Televideo   tvi950   plot6 

If one of the built-in character sets might be appropriate for your terminal but the TERM name you use isn't built into the program, you can use the gr command to select the appropriate name from the last column of the table. If the plot program can't find the name you give with the gr command in the terminal-capability database, it will switch to the alternate characters associated with that name but will continue to use the control sequences it had been using.