summaryrefslogtreecommitdiffstats
path: root/tools/checklibdocs.sh
blob: 094d2cbd54fdb3a5d7be274c72b58f0253ed4b8c (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
#!/bin/sh

FILE_API_SYMBOLS="$1"
FILE_API_DOCS="$2"

if [ ! -f "$FILE_API_SYMBOLS" ]; then
	echo "File $FILE_API_SYMBOLS is missing."
	exit 1
fi

if [ ! -f "$FILE_API_DOCS" ]; then
	echo "File $FILE_API_DOCS is missing."
	exit 1
fi

fail_ct=0
api_symbols=$(awk '/^([[:space:]]+)([[:alnum:]_]+);/ { gsub(";",""); print $1; }' "$FILE_API_SYMBOLS" | sort)
doc_symbols=$(awk '/^([[:space:]])*$/ {next}; !/<.*>/ { print $1 }' "$FILE_API_DOCS" | sort)

echo -n "Checking $FILE_API_SYMBOLS documentation ... "

for sym in $api_symbols; do
	case "$doc_symbols" in
	*"$sym"*)
		#echo -ne "\n '$sym'"
		;;
	*)
		echo -ne "\n '$sym' undocumented"
		fail_ct=$(($fail_ct + 1))
		;;
	esac
done

if [ $fail_ct -ne 0 ]; then
	echo
	echo "$fail_ct symbols is missing in ${FILE_API_DOCS}."
	echo
	exit 1
else
	echo "OK"
fi

exit 0