a bit better implementation of genLists4Comparizon.sh
[xorg/xkeyboard-config] / tests / genLists4Comparizon.sh
1 #!/bin/sh
2
3 #
4 # This script compares the group names which "have to be", according to the descriptions in base.xml -
5 # and actually existing in the symbol files. Some differences are ok (like extra double quotes or 
6 # extra escaping character) - but all the rest should be in sync.
7 #
8
9 ROOT="`dirname $0`/.."
10 F1=reg2ll.lst
11 F2=gn2ll.lst
12
13 xsltproc $ROOT/xslt/reg2ll.xsl $ROOT/rules/base.xml | sort | uniq > $F1
14
15 for i in $ROOT/symbols/*; do
16   if [ -f $i ]; then
17     id="`basename $i`"
18     export id
19     gawk 'BEGIN{
20   FS = "\"";
21   id = ENVIRON["id"];
22   isDefault = 0;
23 }
24 /.*default.*/{
25   isDefault = 1;
26 }
27 /xkb_symbols/{
28   variant = $2;
29 }/^[[:space:]]*name\[Group1\][[:space:]]*=/{
30   if (isDefault == 1)
31   {
32     printf "%s:\"%s\"\n",id,$2;
33     isDefault=0;
34   } else
35   {
36     name=$2;
37     printf "%s(%s):\"%s\"\n", id, variant, name;
38   }
39 }' $i
40   fi
41 done | sort | uniq > $F2
42
43 diff $F1 $F2