# keyboards file

The keyboards file contains keyboard
definitions and translations.

## Description

The keyboards file contains two types of items:

- Alternative keyboard definitions, including British, French, German, Italian, Spanish, and USA for PC-type systems, for the TCL command set-kbrd.

- Keyboard input translation items for the TCL command set-imap.

The format of the keyboard input translation for set-imap is:

- Attribute one must contain the keyword IMAP, optionally followed by one or more modifiers, separated by spaces. Valid modifiers are: | esc-data | Sets esc-data. Used if any input sequence contains an escape. | | --- | --- | | esc-level | Sets esc-level. Used if no input sequence contains an escape. | | xcs-on | Enables the extended character set (8-bit characters). | | xcs-off | Disables the extended character set. | | timeout value | Sets the default timeout to value, expressed in milliseconds. This value can be overridden on a per port basis by set-imap. |

- Each line defines a translation where the input sequence and the converted sequence are separated by a : (colon). If the converted string is null, then the input sequence corresponds to a key that is ignored.

- "input sequence" : "converted sequence"

- The following items are ignored:

- Text after an * (asterisk), except when enclosed in quotes

- Spaces, except when enclosed in quotes

- Empty lines

- Each element in the input sequence or the converted string is separated by commas.

- Characters and strings are represented by c’abc...’ or c"abc...".

- c’]’

- c’]A’

- Hexadecimal values and strings are represented by x’NN’ or x’NNNNNN...’, where each pair of hexadecimal digits are assembled into one byte.

- x’ff’

- x’27ff’

- Decimal values are represented normally.

- Control characters are specified by a ^ (caret) followed by the corresponding letter, in uppercase or lowercase.

- ^a

- These keywords can be used anywhere to represent the usual ASCII codes: | BS | x’08’ | | --- | --- | | LF | x’0A’ | | CR | x’0D’ | | ESC | x’1F’ | | DEL | x’7F’ |

- Each keyboard item may have an alternate translation table as well. It is specified using the keyword #alternate in the item. All lines following define the alternate table instead of the primary table. Use the keywords ALT and ALT_ONE in the converted sequence to specify a key sequence to switch to the alternate table then use the same key sequence to switch back. The ALT_ONE keyword denotes that the alternate table should be used for the next set of keystrokes only. Note: Some keyboards (for example, ATT605BCT) generate 8-bit characters. Use the xcs-on modifier.

- The number of the translation sequences is limited. The number depends on the actual data, but, converting all specials keys on an IBM3151, most of them generating two-character sequences into a two-character output sequence, takes about one fourth of the capacity of the filter.

## Example(s)

The following example illustrates
the IBM 3151 keyboard input definition to use special keys in the
Update processor.

```
IMAP timeout 50 esc-data
* IBM 3151

* Cursor movement
ESC,c’D’ : ^J * <-
ESC,c’C’ : ^K * ->
ESC,c’B’ : ^N * down arrow
ESC,c’A’ : ^B * up arrow

* Editing keys
ESC,c’Q’ : ^l * delete
ESC,c’P ’,BS : ^w * insert

* function keys F1 - F12
ESC,c’a’,13 : ^x,c’1’ * F1 : Hot key 1
ESC,c’b’,x’0d’ : ^x,c’2’ * F2 : Hot key 2

* function keys F13 - F24
ESC,c’!a’,CR : c’off’,CR * F13 : OFF
ESC,c’!b’,CR : c’end’,CR * F14 : END

* One key functions
DEL : ^l * Del

* Ignored keys
ESC,c’"A’ : * Num Lock
```

## See also

- [ASCII](https://d3codex.com/definitions/ascii/)
- [define-up command](https://d3codex.com/tcl/define-up-command/)
- [esc-data command](https://d3codex.com/tcl/esc-data-command/)
- [esc-level command](https://d3codex.com/tcl/esc-level-command/)
- [funckeys file](https://d3codex.com/systemfiles/funckeys-file/)
- [iomap-file file](https://d3codex.com/systemfiles/iomap-file-file/)
- [set-imap command](https://d3codex.com/tcl/set-imap-command/)
- [set-iomap command](https://d3codex.com/tcl/set-iomap-command/)
- [set-kbrd command](https://d3codex.com/tcl/set-kbrd-command/)
- [term command](https://d3codex.com/tcl/term-command/)
- [term-type command](https://d3codex.com/tcl/term-type-command/)

---
Source: https://d3codex.com/systemfiles/keyboards-file/ - part of the D3Codex reference.
