#!/bin/sh

awk '
H == FILENAME && /#define[ 	]T_/ {
	found[$2] = 0 ;
}

C == FILENAME && /^    {T_/ {
	symbol = substr($1,2,length($1)-2);
	if (length(found[symbol]) == 0) {
		undefined[symbol]++;
	} else {
		found[symbol]++;
	}
}

END {
	for (symbol in undefined) {
		print "Undefined symbol: " symbol ;
	}
	print
	for (symbol in found) {
		if (found[symbol] == 0) {
			printf "Symbol not used: %s\n", symbol ;
		}
	}
}' H="$1" C="$2" $1 $2
