Commit 98e239ff authored by Samuel Thibault's avatar Samuel Thibault

keysymtab: Add (re)generation script

It does not produce exactly the same content yet, as the
left/rightanglebracket unicode equivalent was not defined in xterm as
what Xorg currently says.
parent 699e78a3
......@@ -34,6 +34,9 @@
#include <X11/X.h>
#include "deviceeventcontroller.h" /* for prototype */
/* DO NOT UPATE BY HAND!
* This table can be regenerated from Xorg's keysymdef.h with the ucs2keysym.sh
* script. */
struct codepair {
unsigned short keysym;
unsigned short ucs;
......@@ -603,8 +606,8 @@ struct codepair {
{ 0x0afa, 0x2315 }, /* telephonerecorder ⌕ TELEPHONE RECORDER */
{ 0x08a4, 0x2320 }, /* topintegral ⌠ TOP HALF INTEGRAL */
{ 0x08a5, 0x2321 }, /* botintegral ⌡ BOTTOM HALF INTEGRAL */
{ 0x0abc, 0x2329 }, /* leftanglebracket 〈 LEFT-POINTING ANGLE BRACKET */
{ 0x0abe, 0x232a }, /* rightanglebracket 〉 RIGHT-POINTING ANGLE BRACKET */
{ 0x0abc, 0x2329 }, /* leftanglebracket 〈 LEFT-POINTING ANGLE BRACKET, not U+27E8 per xterm source */
{ 0x0abe, 0x232a }, /* rightanglebracket 〉 RIGHT-POINTING ANGLE BRACKET, not U+27E9 per xterm source */
{ 0x0bcc, 0x2395 }, /* quad ⎕ APL FUNCTIONAL SYMBOL QUAD */
{ 0x08ab, 0x239b }, /* topleftparens ⎛ LEFT PARENTHESIS UPPER HOOK */
{ 0x08ac, 0x239d }, /* botleftparens ⎝ LEFT PARENTHESIS LOWER HOOK */
......
#!/bin/bash
if [ "$#" = 0 ]
then
echo "Usage: $0 /path/to/keysymdef.h"
exit 1
fi
# We are only interested in
# - keysyms which have well-defined unicode equivalent
# - and are not just trivial unicode keysyms
# - non-latin1 keysyms
# - not the lamda aliases
# and we tinker with the alias parentheses to make sorting easier
grep '^#define' "$1" | \
grep -i "U+" | \
grep -vi "0x100[0-9a-f][0-9a-f][0-9a-f][0-9a-f]" | \
grep -vi " 0x00[0-9a-f][0-9a-f] " | \
grep -vi "_lamda " | \
sed -e 's/\/\*(/& /' | \
sed -e 's/)\*\// &/' | \
sort -k 5 | \
perl -CS -e '
my $last = 0;
while (<>) {
chomp;
if ( /^\#define XK_([a-zA-Z_0-9]+)(\s*) 0x([0-9a-f]+)\s*\/\*(\(?) U\+([0-9A-F]{4,6}) (.*) \)?\*\/\s*$/ ) {
my ( $xk, $space, $keysym, $paren, $unicode, $unistr ) = ( $1, $2, $3, $4, $5, $6);
$unicode = hex("0x".$unicode);
print "\n" if (int($unicode / 256) != int($last / 256));
$last = $unicode;
printf " { 0x$keysym, 0x%04x }, /* $space$xk %lc $unistr */\n", $unicode, $unicode;
}
}
'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment