5 use open IO => ':encoding(utf-8)', ':std';
7 use JSON 'decode_json';
10 our $VERSION = '1.01';
13 open my $keysymh, '<', 'data/keysymdef.json' or die $!;
15 return decode_json(readline $keysymh);
16 } or die "Could not read keysym definitions: $@\n";
18 # optionally get unicode character information
19 my $uninfo = do './data/unicode-char.inc.pl'
20 or warn "could not include unicode details: ", $@ // $!;
23 while ($_ = readline) {
24 my ($mnem, $chr, $trail) = m/\A <Multi_key> \h (.*?) \h+ : \h "([^"]+)" \h* (.*)/
27 $mnem !~ m/<dead | <KP_ | <U[0-9A-Fa-f]{4}/ or next; # skip non-standard keys
29 $mnem =~ s{<([^>]+)> \h?}{$symname->{$1} // die "reference to unknown keysym $1\n"}eg;
32 $mnem =~ m/\A [\x20-\x7F]{2} \z/ or next; # only interested in two ascii
33 my $alias = (state $seen = {})->{$chr}++; # assume first is preferred
36 $uninfo->{$chr}->[1] // '', # name
39 ($uninfo->{$chr}->[0] // '') =~ s/ u-di| u-prop| ex//gr, # class
40 $uninfo->{$chr}->[4] // (), # string
44 print JSON->new->canonical->indent->encode(\%table);
50 mkdigraphs-xorg - Output Xorg compose sequences
55 mkdigraphs-xorg /usr/share/X11/locale/en_US.UTF-8/Compose >digraphs-xorg.inc.pl
56 perl -e'$di = do "digraphs-xorg.inc.pl"; print chr $di->{AT}'
60 Extracts Multi_key definitions from X11/Xorg Compose.pre include file.
61 If successful, Perl code is output resulting in a hash
62 with Unicode code points keyed by mnemonics.
63 Any errors and warnings are given at STDERR.
67 Mischa POSLAWSKY <perl@shiar.org>
71 Licensed under the GNU Affero General Public License version 3.