digraphs/xorg: support keysymdef aliases in compose definitions
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 21 Feb 2024 19:27:29 +0000 (20:27 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sun, 25 Feb 2024 15:03:30 +0000 (16:03 +0100)
Silence error about deprecated Ooblique being unknown.

Makefile
tools/mkdigraphs-xorg
tools/mkxkeysymdef

index cccaebf9d233f47a8de6a0b9c501e2d8ffeb828b..f9c05654eee2ce95d856680215750cdeb8fe5fd2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -48,7 +48,7 @@ data/digraphs-shiar.inc.pl: tools/mkdigraphs-shiar shiar.inc.txt
        $(call cmdsave,$^)
 
 data/xorg-compose: $(download)
-       tools/wget-ifmodified http://cgit.freedesktop.org/xorg/lib/libX11/plain/nls/en_US.UTF-8/Compose.pre $@
+       tools/wget-ifmodified http://gitlab.freedesktop.org/xorg/lib/libx11/-/raw/master/nls/en_US.UTF-8/Compose.pre $@
 data/keysymdef.h: $(download)
        tools/wget-ifmodified http://gitlab.freedesktop.org/xorg/proto/xorgproto/-/raw/master/include/X11/$(@F) $@
 data/keysymdef.json: tools/mkxkeysymdef data/keysymdef.h
index b34bef562dda161cd54e51b751b69cb7fc5805df..90b0d8603ac9f1790eb46641288575eaf41b06af 100755 (executable)
@@ -23,7 +23,10 @@ while ($_ = readline) {
                or next;
        $chr =~ s/\\(.)/$1/g;
        $mnem !~ m/<dead | <KP_ | <U[0-9A-Fa-f]{4}/ or next;  # skip non-standard keys
-       $mnem =~ s{<([^>]+)> \h?}{$symname->{$1} // die "reference to unknown keysym $1\n"}eg;
+       eval {
+               $mnem =~ s{<([^>]+)> \h?}{$symname->{$1} // die "reference to unknown keysym $1\n"}eg;
+               1;
+       } or warn($@), next;
        $mnem !~ m/[^\x20-\x7F]/ or next;  # skip unicode
 #      (state $seen = {})->{$chr}++ and next;
        printf "%s => %s,\n", pp($mnem), pp($chr);
index e7d7690af196d30e768040053b9e614c21722030..cecf9d438059e7e93ba7384f1b57a71a5e57c199 100755 (executable)
@@ -2,19 +2,21 @@
 use 5.014;
 use warnings;
 use utf8;
-use re '/msx';
+use re '/mnsx';
 use JSON;
 
-our $VERSION = '1.00';
+our $VERSION = '1.01';
 
-my %keysym;
+my (%keysym, %keyval);
 while (readline) {
        m{
                \A  [#]define[ ]XK_ (?<name>[a-zA-Z_0-9]+)
                \h+ 0x(?<value>[0-9a-fA-F]+)
-               \h* [/][*] [\h(] U[+] (?<unicode>[0-9A-F]{4,6})
+               ( \h* [/][*] [\h(] U[+] (?<unicode>[0-9A-F]{4,6}) )?
        } or next;
-       $keysym{ $+{name} } = chr hex $+{unicode};
+       my $cp = $+{unicode} // $keyval{ $+{value} } or next;
+       $keysym{ $+{name} } = chr hex $cp;
+       $keyval{ $+{value} } = $cp;
 }
 
 print JSON->new->ascii->canonical->indent->encode(\%keysym);