diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-21 21:41:34 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-21 21:41:34 +0000 |
commit | a5fdebc5f6375078ec1763850a4ca23ec7fe6458 (patch) | |
tree | bcf0a25c3d45a209a6e3ac37b233a4812f29c732 /bin/class2info | |
download | ATCD-a5fdebc5f6375078ec1763850a4ca23ec7fe6458.tar.gz |
Initial revision
Diffstat (limited to 'bin/class2info')
-rwxr-xr-x | bin/class2info | 197 |
1 files changed, 197 insertions, 0 deletions
diff --git a/bin/class2info b/bin/class2info new file mode 100755 index 00000000000..752ced3ebce --- /dev/null +++ b/bin/class2info @@ -0,0 +1,197 @@ +#! /bin/sh +# ============================================================================= +# +# = DESCRIPTION +# Converts a C++ class header file into a classinfo description file. +# +# = AUTHOR(S) +# Graham Dumpleton +# K. Dorn +# +# = COPYRIGHT +# Copyright - OTC LIMITED (1991) +# +# ============================================================================= + +OSE_HOST= + +OSE_RELEASE_NAME= +export OSE_RELEASE_NAME + +OSE_ROOT=${OSE_ROOT-$WRAPPER_ROOT} +export OSE_ROOT + +OSE_VERSION_ROOT=$OSE_ROOT +export OSE_VERSION_ROOT + +BINDIR="$OSE_VERSION_ROOT/$OSE_HOST/bin" +LIBDIR=${CLASSINFOLIBDIR-"$OSE_VERSION_ROOT/bin"} + +INFO2INFO="$BINDIR/info2info" + +AWK="nawk" + +if test "$AWK" = "nawk" +then + VARG="-v" +fi + + +FILES= +V2= + +trap 'rm -f /tmp/ci.$$; exit' 1 2 3 13 15 + +# +# Error. +# +ERROR() +{ + echo "`basename $0`: $1" >&2 + shift + while test $# != "0" + do + echo $1 >&2 + shift + done + exit 1 +} + +# +# Usage message. +# +USAGE() +{ + ERROR "Usage: `basename $0` file.h ..." +} + +# +# Check usage. +# +if test $# = 0 +then + USAGE +fi + +# +# Parse command line. +# +while test $# != 0 +do + case $1 in +# -v2) +# V2=YES +# shift +# ;; + *.h|*.hh|*.H|*.hxx|*.hpp|*.h++) + FILES="$FILES $1" + shift + ;; + *) + USAGE + ;; + esac +done + +# +# Check usage again. +# +if test -z "$FILES" +then + USAGE +fi + +# +# Check for awk file. +# +CLASS2INFO=$LIBDIR/class2info.awk +HIDINGFMT=$LIBDIR/hiding.fmt + +if test ! -f $HIDINGFMT +then + ERROR "Can't find $HIDINGFMT" +fi + + +if ( test ! -f $CLASS2INFO ) +then + ERROR "Can't find $CLASS2INFO" +fi + + + +VCSA=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^CSAHEADER$" { + if ( $2 ~ "on" ) + printf("%s","csaprintheader=on"); + else + printf("%s","csaprintheader="); +}' $HIDINGFMT` + +VPUBL=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PUBLIC$" { + if ( $2 ~ "on" ) + printf("%s","publ=on"); + else + printf("%s","publ="); +}' $HIDINGFMT` + +VPROT=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PROTECTED$" { + if ( $2 ~ "on" ) + printf("%s","prot=on"); + else + printf("%s","prot="); +}' $HIDINGFMT` + +VPRIV=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PRIVATE$" { + if ( $2 ~ "on" ) + printf("%s","priv=on"); + else + printf("%s","priv="); +}' $HIDINGFMT` + +#echo " $VPUBL $VPROT $VPRIV " + + +# +# Parse each file. +# +# $VARG publ=on $VARG prot=off $VARG priv=off \ +for i in $FILES +do + if test ! -f $i + then + ERROR "$i doesn't exist." + fi + FILENAME=`basename $i` + INFOFILE=`echo $FILENAME | sed -e 's/\..*$//'`.ci + rm -f $INFOFILE + if test "$?" != 0 + then + ERROR "Couldn't remove info file $INFOFILE." + fi + expand $i > /tmp/ci.$$ + $AWK \ + -f $CLASS2INFO $VARG filename=$i \ + $VARG $VPUBL $VARG $VPROT $VARG $VPRIV \ + /tmp/ci.$$ > $INFOFILE + rm -f /tmp/ci.$$ +# if test ! -z "$V2" +# then +# $INFO2INFO $INFOFILE +# fi +done |