(svn r27763) -Update from Eints:
[openttd.git] / bin / ai / regression / completeness.sh
blob9f5e96eb0b6a186755c91c09de07a9ed073813f1
1 #!/bin/sh
3 # $Id$
5 if ! [ -f ai/regression/completeness.sh ]; then
6 echo "Make sure you are in the root of OpenTTD before starting this script."
7 exit 1
8 fi
10 cat ai/regression/tst_*/main.nut | tr ';' '\n' | awk '
11 /^function/ {
12 for (local in locals) {
13 delete locals[local]
15 if (match($0, "function Regression::Start") || match($0, "function Regression::Stop")) next
16 locals["this"] = "AIControllerSquirrel"
19 /local/ {
20 gsub(".*local", "local")
21 if (match($4, "^AI")) {
22 sub("\\(.*", "", $4)
23 locals[$2] = $4
27 /Valuate/ {
28 gsub(".*Valuate\\(", "")
29 gsub("\\).*", "")
30 gsub(",.*", "")
31 gsub("\\.", "::")
32 print $0
35 /\./ {
36 for (local in locals) {
37 if (match($0, local ".")) {
38 fname = substr($0, index($0, local "."))
39 sub("\\(.*", "", fname)
40 sub("\\.", "::", fname)
41 sub(local, locals[local], fname)
42 print fname
43 if (match(locals[local], "List")) {
44 sub(locals[local], "AIAbstractList", fname)
45 print fname
49 # We want to remove everything before the FIRST occurence of AI.
50 # If we do not remove any other occurences of AI from the string
51 # we will remove everything before the LAST occurence of AI, so
52 # do some little magic to make it work the way we want.
53 sub("AI", "AXXXXY")
54 gsub("AI", "AXXXXX")
55 sub(".*AXXXXY", "AI")
56 if (match($0, "^AI") && match($0, ".")) {
57 sub("\\(.*", "", $0)
58 sub("\\.", "::", $0)
59 print $0
62 ' | sed 's/ //g' | sort | uniq > tmp.in_regression
64 grep 'DefSQ.*Method' ../src/script/api/ai/*.hpp.sq | grep -v 'AIError::' | grep -v 'AIAbstractList::Valuate' | grep -v '::GetClassName' | sed 's/^[^,]*, &//g;s/,[^,]*//g' | sort > tmp.in_api
66 diff -u tmp.in_regression tmp.in_api | grep -v '^+++' | grep '^+' | sed 's/^+//'
68 rm -f tmp.in_regression tmp.in_api