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