5 use open IO => ':utf8', ':std';
11 open $keysymh, '<', 'data/keysymdef.h'
12 or open $keysymh, '<', '/usr/include/X11/keysymdef.h'
13 or die "Could not find keysym definitions: $!\n";
16 while (readline $keysymh) {
18 \A [#]define[ ]XK_ (?<name>[a-zA-Z_0-9]+)
19 \h+ 0x(?<value>[0-9a-f]+)
20 \h* [/][*] [\h(] U[+] (?<unicode>[0-9A-F]{4,6})
22 $keysym{ $+{name} } = chr hex $+{unicode};
25 say "# automatically generated by $0";
28 while ($_ = readline) {
29 my ($mnem, $chr, $trail) = /^<Multi_key>\h(.*?)\h+:\h"([^"]+)"\h*(.*)/
32 $mnem !~ /<dead|<KP_|<U[0-9A-Fa-f]{4}/ or next; # skip non-standard keys
33 $mnem =~ s{<([^>]+)> ?}{$keysym{$1} // die "reference to unknown keysym $1\n"}eg;
34 $mnem !~ /[^ -\x7F]/ or next; # skip unicode
35 # (state $seen = {})->{$chr}++ and next;
36 printf "%s => %s,\n", pp($mnem), pp($chr);
45 mkdigraphs-xorg - Output Xorg compose sequences
50 mkdigraphs-xorg /usr/share/X11/locale/en_US.UTF-8/Compose >digraphs-xorg.inc.pl
51 perl -e'$di = do "digraphs-xorg.inc.pl"; print chr $di->{AT}'
55 Extracts Multi_key definitions from X11/Xorg Compose.pre include file.
56 If successful, Perl code is output resulting in a hash
57 with Unicode code points keyed by mnemonics.
58 Any errors and warnings are given at STDERR.
62 Mischa POSLAWSKY <perl@shiar.org>
66 Licensed under the GNU Affero General Public License version 3.