summaryrefslogtreecommitdiff
path: root/tests/genLists4Comparizon.sh
blob: ee2f2ee95757fd6641c0a84f4c920e4e0ebaf346 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh

#
# This script compares the group names which "have to be", according to the descriptions in base.xml -
# and actually existing in the symbol files. Some differences are ok (like extra double quotes or 
# extra escaping character) - but all the rest should be in sync.
#

ROOT="`dirname $0`/.."
F1=reg2ll.lst
F2=gn2ll.lst
F1b=${F1}base
F1e=${F1}extras

xsltproc reg2ll.xsl $ROOT/rules/base.xml > $F1b
xsltproc reg2ll.xsl $ROOT/rules/base.extras.xml | \
  grep -v "sun_type" > $F1e

cat $F1b $F1e | \
  sort | \
  uniq | \
  grep -v -e '^$' \
          -e '^custom:' > $F1
rm -f $F1e $F1e

for i in $ROOT/symbols/*; do
  if [ -f $i ]; then
    id="`basename $i`"
    export id
    gawk 'BEGIN{
  FS = "\"";
  id = ENVIRON["id"];
  isDefault = 0;
  isHwSpecificDefault = 0;
  isUnregistered = 0;
}
/#HW-SPECIFIC/{
  isHwSpecificDefault = 1;
}
/#UNREGISTERED/{
  isUnregistered = 1;
}
/^[[:space:]]*\/\//{
  next 
}
/.*default.*/{
  isDefault = 1;
}
/xkb_symbols/{
  variant = $2;
}/^[[:space:]]*name\[Group1\][[:space:]]*=/{
  if (isUnregistered == 1) {
    isUnregistered = 0;
  } else if (isDefault == 1)
  {
    printf "%s:\"%s\"\n",id,$2;
    isDefault=0;
  } else
  {
    name=$2;
    if (isHwSpecificDefault == 1) {
      isHwSpecificDefault = 0;
      printf "%s:\"%s\"\n", id, name;
    } else {
      printf "%s(%s):\"%s\"\n", id, variant, name;
    }
  }
}' $i
  fi
done | sort | uniq > $F2

diff -u $F1 $F2
rc=$?

echo "Legend: '-' is for rules/base.*xml.in, '+' is for symbols/*"
exit $rc