#!/bin/sh
#
# build up an ascii file description of the class hierarchy. This file
# can be imported into the ET++ tree application.
#
ET_DIR=${ET_DIR-/home/europa/et2}               # location of ET++
AWK=awk

fgrep -h "class " ${ET_DIR}/src/[A-Z]*.h ${ET_DIR}/src/*/[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("\t");
	    printf("%s\n", $NF)
	} '

