check_dictionaries.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 function usage() {
4  echo "USAGE: `basename ${0}` [-h] <directory>"
5  echo " -h (this help)"
6  echo " look for classes_def.xml under the specified directory"
7  echo " If no directory is specified, search this directory"
8 }
9 
10 case "$1" in
11  -h)
12  usage
13  exit 0
14  ;;
15  -*)
16  echo "ERROR: unrecognized option $1" >&2
17  usage
18  exit 1
19  ;;
20 esac
21 
22 xml_directory=${1}
23 if [ -z ${xml_directory} ];then
24  xml_directory="."
25 fi
26 
27 dict_files=`find ${xml_directory} -name classes_def.xml`
28 for xml_file in ${dict_files}
29 do
30  echo
31  echo "check ${xml_file}"
32  sort -u ${xml_file} | \
33  grep -e 'Wrapper.*Assns' | \
34  perl -wane 'BEGIN { @h = (); }
35  m&.*Wrapper.*Assns\s*<(\S+?),\s*(\S+?)(?:,\s*(\S+?))?\s*>& and
36  push @h, [ ${1}, ${2}, ${3} || "void" ];
37  END { foreach my $f (@h) {
38  grep { $_->[0] eq $f->[1] and
39  $_->[1] eq $f->[0] and $_->[2] eq $f->[2]; } @h or
40  print "Missing selections for art::Assns<$f->[1], $f->[0], $f->[2]>\n";
41  }; }'
42 done
43 
44 exit 0