keycomp(1X)
NAME
keycomp - X Window System keyboard mapping file compiler
SYNTAX
keycomp < input_file > output_file
DESCRIPTION
Programs that use the X Window System, such as xterm(,), need some way to translate the user’s key strokes into character strings. Such programs look up this keyboard-to-character string mapping in a binary keymap file by calling the library routine XLookupMapping. Initially, this routine looks for the file .Xkeymap in the user’s home directory; if this file does not exist, the routine uses a built-in table.
The compiled file format produced by keycomp should be portable across machine architectures.
The keycomp (keymap compiler) program reads in a textual description of this mapping and produces a binary keymap file on its standard output.
Each key may have up to 16 different bindings, depending on what combinations of the Shift, Lock, Control, and Meta keys are depressed. For example, in a conventional keyboard mapping, pressing the A key produces a capital “A” when the Shift or Lock key is down, an octal 001 when the Control key is down, and a small “a” when no other key is down.
The input file to keycomp consists of one or more lines. Each line begins with an octal or decimal number designating an X keyboard code. After the key code, the line should contain either 1 or 16 items, each representing the binding for a particular combination of the Control, Meta, Shift, and Lock keys. The items should be separated by white space; the format of the items is described later. The bindings should be in this order:
#1“unshifted”: none of Shift, Lock, Control, or Meta keys down
#2Lock key down
#3Shift key down
#4Shift and Lock keys down
#5Meta key down
#6Meta and Lock keys down
#7Meta and Shift keys down
#8Meta, Shift, and Lock keys down
#9Control key down
#10Control and Lock keys down
#11Control and Shift keys down
#12Control, Shift, and Lock keys down
#13Control and Meta keys down
#14Control, Meta, and Lock keys down
#15Control, Meta, and Shift keys down
#16Control, Meta, Shift, and Lock keys down
If only one item is present on the line, then it represents the binding for this key regardless of the positions of the Control, Meta, Shift, and Lock keys.
Each item should be one of the following:
•An octal or decimal number, indicating a character code.
•A C character literal, surrounded by single quotes. Escape sequences (such as ‘252’) are allowed.
•A C string literal, surrounded by double quotes. Again, standard C escape sequences are allowed within the string.
•The letter U, indicating no binding. If there is no binding, then XLookupMapping will return an empty string for this key combination.
You may follow each item with a comma. Whether or not a comma is present, white space (spaces or tabs) must separate the items. All text to the right of the 16th item is ignored; comments may appear here.
Completely blank lines are ignored, as are lines beginning with the ’#’ character. Furthermore, all text between a ‘#’ character and the following new line is ignored, provided that the ‘#’ is not part of a string enclosed in single or double quotes. This allows you to place comments at the end of a line that contains only a single item.
You can look at the file <X/Xkeyboard.h> for a list of key codes and key names of function keys.
DIAGNOSTICS
“Couldn’t fseek output file”
The standard output must be a file, not a pipe or a terminal.
“Error writing beginning of output file”
“Error writing extension to output file”
The keycomp program could not write the output file. The file system may be out of space.
“Parse error at item <number> on line <number>:
<message>”
The source file has a syntax error. Possible messages include: “Line doesn’t begin with key”
The first few characters in the line, which should be a key number, were not recognizable as an octal or decimal number.
“Keycode is too big”
The key at the beginning of the line was greater than 0377 (octal).
“Line doesn’t have 1 or 16 entries”
After the key, more than one but less than 16 items were found, or no items were found at all.
“Number after backslash is too big for a character constant”
In a character constant of the form ‘0n’, the octal number was greater than 377 (octal).
“Closing single quote not found”
A single quote (’) was encountered, but the end of the line was reached before finding the matching closing single quote.
“String is too long”
More than 80 characters are not allowed between double quotes.
“Closing double quote not found”
A double quote (") was encountered, but the end of the line was reached before finding the matching closing double quote.
“Too many characters for single character constant”
Too many characters appear between single quotes. If you want to bind a key to a multiple-character sequence, use double quotes.
“Not a U, number, single- or double-quoted string”
The keycomp program cannot parse this item; it is neither the letter U, nor an octal or decimal number, nor a string enclosed in single or double quotes.
FILES
$HOME/.Xkeymap
/usr/lib/Xkeymap.txt
<X/Xkeyboard.h>