]>
Commit | Line | Data |
---|---|---|
40e5c25a | 1 | #!/usr/bin/env bash |
c96f9003 JM |
2 | # |
3 | # Convert "U+..." commented entries in /usr/include/X11/keysymdef.h | |
4 | # into JavaScript for use by noVNC. Note this is likely to produce | |
5 | # a few duplicate properties with clashing values, that will need | |
6 | # resolving manually. | |
7 | # | |
8 | # Colin Dean <colin@xvpsource.org> | |
9 | # | |
10 | ||
11 | regex="^#define[ \t]+XK_[A-Za-z0-9_]+[ \t]+0x([0-9a-fA-F]+)[ \t]+\/\*[ \t]+U\+([0-9a-fA-F]+)[ \t]+[^*]+.[ \t]+\*\/[ \t]*$" | |
12 | echo "unicodeTable = {" | |
13 | while read line; do | |
14 | if echo "${line}" | egrep -qs "${regex}"; then | |
15 | ||
16 | x11=$(echo "${line}" | sed -r "s/${regex}/\1/") | |
17 | vnc=$(echo "${line}" | sed -r "s/${regex}/\2/") | |
18 | ||
19 | if echo "${vnc}" | egrep -qs "^00[2-9A-F][0-9A-F]$"; then | |
20 | : # skip ISO Latin-1 (U+0020 to U+00FF) as 1-to-1 mapping | |
21 | else | |
22 | # note 1-to-1 is possible (e.g. for Euro symbol, U+20AC) | |
23 | echo " 0x${vnc} : 0x${x11}," | |
24 | fi | |
25 | fi | |
26 | done < /usr/include/X11/keysymdef.h | uniq | |
27 | echo "};" | |
28 |