Storing terminal characteristics

This program creates and maintains a file of terminal characteristics, which is used by the Screen Control Package to find out how to drive a particular terminal. The program is entered by the command TERMCHS(file,commands) where 'file' specifies the terminal characteristics file to be operated on, and 'commands' specifies a file of commands for TERMCHS. If 'file' is null, the name TERMCHSFILE is used, and if 'commands' is null, .IN is used. The user is prompted for the action required. That action is carried out, and the prompt is repeated. The command STOP exits from TERMCHS. All commands may be abbreviated as long as they remain unambiguous. The available commands are given below. A summary of these may be obtained by typing '?' in response to the 'Action:' prompt.

Initialise

The form of this command is: INITIALISE The terminal characteristics file is emptied, after being created if it did not exist.

Edit

The form of this command is: EDIT n The action is to edit record 'n' in the terminal characteristics file. If 'n' is not specified, the prompt Type: is issued, and the response should be a valid terminal record number. The prompt Ed: is then issued, and one of several editing commands may now be given. On completion of the edit, the appropriate record is updated. The characteristics file is manipulated using NEWGEN to avoid problems with users who have it connected during the update.
Users should beware of the fact that some programs (e.g. VIEW) disable disconnection of the terminal characteristics file. Thus, if such a program is used prior to, and in the same session as, an edit to the terminal characteristics file, the effect of the edit cannot be seen without logging off and on again.
Most editing commands consist of a keyword, an equals sign and a value. For example, to set a Clear Screen sequence of three nulls, the command would be: CLEARSCREEN=0,0,0 which could be abbreviated to: CLEARSCREEN=0(3)
Values in sequences may be expressed as: * Hexadecimal numbers (e.g. 1B). Any leading X is ignored * ASCII mnemonics (for non-printing characters and spaces) (e.g ESC) * Single characters within single quotes (e.g. 'A') Repeat counts are in decimal.
Some items are in fact truth values. They may be specified with the keywords TRUE, YES, FALSE and NO as required. TRUE is equivalent to YES, and FALSE is equivalent to NO.
Keywords may be abbreviated as long as they remain unambiguous. A null sequence (i.e. no characters at all) may be entered by giving the keyword and the equals sign only. This should be done if a terminal does not support a particular operation. A summary of available keywords may be obtained by typing '?' in response to the 'Ed:' prompt. These keywords are:

Quit

Abandon the edit without updating the characteristics file.

.End

Complete the edit, updating the characteristics file.

Name

Set the name of the terminal associated with this record. For example: Name={7}

Columns

Set the number of columns available on the terminal associated with this record. This will often be used to update the ITWIDTH option setting.

Lines

Set the number of lines available on the screen of this terminal type. A value of zero should be used for hardcopy devices.

Leadin

Set the lead-in sequence for this terminal type.

Clear

Set the clear screen sequence for this terminal type. The sequence should also return the cursor to the 'home' position.

Chome

Set the 'home' sequence for this terminal type.

Endline

Set the sequence which will cause the terminal to clear the rest of the current line from the current cursor position.

Endscreen

Set the sequence which will cause the terminal to clear the rest of the screen from the current cursor position.

Initialise

Set the sequence which will initialise the terminal in a sensible way. Preferred settings are: * Roll mode * Protection off

Interrupt

Set the single character that is the preferred one for user programs to select as the INT: key. This may not always be ESCape, because this key often has a special meaning to the terminal hardware.

Cursor up

Set the sequence which will cause the cursor to move up by one line.

Cursor down

Set the sequence which will cause the cursor to move down by one line.

Cursor left

Set the sequence which will cause the cursor to move left by one character position.

Cursor right

Set the sequence which will cause the cursor to move right by one character position.

Insert line

Set the sequence which will insert a blank line on the display at the current cursor position.

Delete line

Set the sequence which will remove a line from the display at the current cursor position.

Home at top

Indicate whether the Home operation leaves the cursor at the top line of the screen. The setting is TRUE if so, otherwise FALSE.

Can do page mode

Indicate whether the terminal is capable of operating in page mode. The setting is TRUE if so, otherwise FALSE.

Xbase

The value to be added to an X coordinate value before use. This is a single byte.

Ybase

The value to be added to a Y coordinate value before use. This is a single byte.

X intro

The string that introduces the X coordinate setting string, or the whole coordinate setting string for those terminals where both are lumped together.

Y intro

The string that introduces the Y coordinate setting string. This will be null if both settings are lumped together.

Y first

Indicate whether the Y coordinate setting comes before or after the X coordinate setting. The setting is TRUE if the Y coordinate value is first, otherwise FALSE. Note that the column number is the X coordinate, and the line number is the Y coordinate.

Auto wrap

Indicate whether the terminal automatically 'wraps round' (generates a carriage return, linefeed sequence) when an attempt is made to write a character beyond the last column of the screen. The setting is TRUE if the terminal behaves like this, otherwise FALSE.

Unix name

The two character abbreviation commonly used by UNIX systems to describe this type of terminal.

Start standout mode

Set the sequence which will cause the terminal to display subsequent output in 'standout' or 'highlighted' mode.

End standout

Set the sequence which will end 'standout' or 'highlighted' mode.

Cursor position

Set the sequence which indicates precisely how to position the cursor at a given point on the screen. The string used is precisely that which needs to be sent to the screen in order to position the cursor appropriately. Variable information is indicated by an escape character, '%', which indicates that row or column values are to be inserted in a specified format. The row is normally sent first, followed by the column (this may be reversed by the %i escape). Escape sequences are also used to side-effect the string.
Escape sequences are as follows: %d - Minimum width ASCII representation of number (like 'write(n,1) in IMP) %2 - Same as %d, but padded to a width of 2 %3 - Same as %d, but padded to a width of 3 %. - Output of value as stored (like a %byteinteger) %+x - Same as %., but with the character 'x' added to the value %r - Reverses the order of the 'x' and 'y' values, but generates no output %i - Increments both the 'x' and the 'y' value, but generates no output %% - Outputs a '%'

Print

Print the current state of the terminal record, then continue editing.

Print

The form of this command is: PRINT n The action is to print the contents of record 'n' in the characteristics file. If 'n' is not specified, the prompt Which: is issued, and the response should be a valid terminal record number, or .ALL to print all the records currently in use.

New

The form of this command is: NEW The action is to locate an empty terminal record, and then to invoke the Edit action (see above) to fill it in. The type number allocated to the record is output for future reference.

Copy

The form of this command is: COPY The action is to copy a complete terminal record (apart from the name field) to another (possibly empty) record. It is useful when more than one record has a very similar structure. Prompts are issued for the type numbers of the source and destination records.

Delete

The form of this command is: DELETE The action is to clear out a terminal record, and free it for re-use. This command is only needed when a particular type of terminal is no longer in use by any user. A prompt is issued for the type number of the terminal whose record is to be deleted.

Dump

The form of this command is: DUMP The action is to dump the current state of the characteristics file, to a specified character file. This is useful as a backup, and if the format of the characteristics file is to be changed. A prompt is issued for the name of the output file.

Cmode

The form of this command is: The action is to set the output mode for subsequent Print commands so that bytes are represented as characters and ASCII mnemonics.

Nmode

The form of this command is: The action is to set the output mode for subsequent Print commands so that bytes are represented as hexadecimal numbers.

Stop

The form of this command is: STOP The action is to cause an immediate exit from the program.