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