KEYCOMP(1)

NAME
keycomp - X window system keyboard mapping file compiler

SYNOPSIS
keycomp < input_file > output_file

DESCRIPTION
Programs that use the X window system, such as xterm(1), 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 doesn't exist, uses a built in table.

The compiled file format produced by keycomp should be portable across machine architectures.

The keycomp program (an abbreviation for ``keymap compiler'') 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 instance, in a conventional QWERTY 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
#2    Lock key down
#3    Shift key down
#4    Shift and Lock keys down
#5    Meta key down
#6    Meta and Lock keys down
#7    Meta and Shift keys down
#8    Meta, Shift, and Lock keys down
#9    Control key down
#10    Control and Lock keys down
#11    Control and Shift keys down
#12    Control, Shift, and Lock keys down
#13    Control and Meta keys down
#14    Control, Meta, and Lock keys down
#15    Control, Meta, and Shift keys down
#16    Control, 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 ` or `252') are allowed, as described in the C Reference Manual.
    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. A comma may, but need not, follow each item. 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 newline 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.

FILES
$HOME/.Xkeymap, /usr/lib/Xkeymap.txt, <X/Xkeyboard.h>

SEE ALSO
X(1), xterm(1)

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''
keycomp couldn't write the output file. Maybe the file system is out of space. ``Parse error at item <number> on line <number>:
    <message>''
The source file has a syntax error. Possible <message>s 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 `n', 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''
keycomp can't parse this item; it is neither the letter U, nor an octal or decimal number, nor a string enclosed in single or double quotes.

AUTHOR
Ron Newman, MIT Project Athena
Copyright 1985, 1986, Massachusetts Institute of Technology.
See X(1) for a full copyright notice.