From ce851c6adff445e0aab2189fc1ff3773a01b7e50 Mon Sep 17 00:00:00 2001 From: Delan Azabani Date: Fri, 29 Nov 2024 14:10:15 +0000 Subject: [PATCH] add script to query illumos keymaps for research (#9) --- doc/attic/query-illumos-keymaps.sh | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 doc/attic/query-illumos-keymaps.sh diff --git a/doc/attic/query-illumos-keymaps.sh b/doc/attic/query-illumos-keymaps.sh new file mode 100755 index 0000000..7585b14 --- /dev/null +++ b/doc/attic/query-illumos-keymaps.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env zsh +# usage: query-illumos-keymaps.sh +# illumos-gate: git clone https://github.com/illumos/illumos-gate.git +set -euo pipefail -o bsdecho +script_dir=${0:a:h} +illumos_gate_dir=$1; shift +layouts=$1; shift + +cd -- "$illumos_gate_dir/usr/src/cmd/loadkeys/type_4" +case "$layouts" in +(type4) + set -- reset us germany swiss_german belgium_france uk swiss_french netherlands sweden_finland denmark norway italy spain_latin_america portugal canada + ;; +(type5) + set -- reset *_5 + ;; +(other) + set -- reset + for layout in *; do + case "$layout" in + (reset|us|germany|swiss_german|belgium_france|uk|swiss_french|netherlands|sweden_finland|denmark|norway|italy|spain_latin_america|portugal|canada|*_5|Makefile) ;; + (*) set -- "$@" "$layout" ;; + esac + done + ;; +(*) + >&2 echo "second argument must be " + exit 1 + ;; +esac +for i in {0..127}; do + printf '%d (%02Xh)\n' $i $i + ( + cd -- "$script_dir/../../src" + rg --with-filename '^ [{].+, 0x'$(printf \%02X $i)', 0x[^}]+[}],' bindings.h | cat || if [ $? -eq 2 ]; then exit 2; fi + ) + # per solaris keytables(4), “Note that the single character may be any character in an 8-bit + # character set, such as ISO 8859/1.”, and all of the languages below seem to be best covered + # by ISO 8859-1 (Latin-1) + rg --sort=path '^key\s+'$i'\s+' "$@" | iconv -f ISO8859-1 -t UTF-8 + echo +done