#!/bin/sh
#
# build up an ascii file description of the class hierarchy. This file
# can be imported into the ET++ tree application.
#
DIR="/home/sebastian/et/src"
AWK=awk
fgrep -h "class " ${DIR}/[A-Z]*.h ${DIR}/*/[A-Z]*.h \
| fgrep "{"  | grep "^[ ]*class[ ]*" \
| sed '
s/://g
s/\{.*//g
s/class//g
s/public//g
' \
| $AWK '{ if (NF == 1) print $1,"ET++"; else print $1,$2 }' \
| $AWK '
	{ super[$1]= $2; }
END     {
	    for (i in super) {
		path= "";
		fat= super[i];
		path= fat;
		while (fat != "") {
		    fat= super[fat];
		    path= fat " " path;
		}
		if (path != "")
		    print path, i;
	    }
	} ' \
| sort \
| $AWK '
BEGIN   {   printf("ET++\n"); }
	{
	    for (i=1; i<NF; i++)
		printf("  ");
	    printf("%s\n", $NF)
	} '

