#! /bin/csh -f

set tmp = /tmp/$$
cp /dev/null $tmp
echo "boolean" >> $tmp
echo "#if !MAC" >> $tmp
echo "#if !defined(__GNUC__) || __GNUC__ < 4" >> $tmp
echo "true" >> $tmp
echo "false" >> $tmp
echo "#endif" >> $tmp
echo "#endif" >> $tmp
echo "u_char" >> $tmp
grep "^class" *.h | \
    sed -e 's/.*class \([^ ;\*]*\).*$/\1/' | \
    sort | uniq | fgrep -v "(" >> $tmp
sed -e 's/\(.*\)/#define \1 _lib_os(\1)/' < $tmp > "_defines.h"
sed -e 's/^/#undef /' < $tmp > "_undefs.h"
rm $tmp
