#!@SHELL@ ################################################################## # subroutines ################################################################## print_help() { echo "Helpscreen" echo "Options: (Description) (Default)" echo "-h print this helpscreen" echo "-C file rc file" echo "-p dir precomp dir" echo "-d text debug option (multi)" echo "-a ass assertions" echo "-o obj object klause (multi)" echo "-i dir path to stubs etc" echo "-s system System" echo "-c CLASS Sysclass" echo "-m make creation" echo "-b path additional Eiflibs (multi)" echo "-f file outputfile (default Ace.ace)" } print_system() { echo system echo echo " $XSYSTEM" } print_root() { echo echo root echo if [ "x$CREATION" != x ]; then echo " $CLASS (start) : \"$CREATION\"" else echo " $CLASS " fi } print_default() { echo echo default echo if [ "x$ASSERTION" != x ]; then echo " assertion ($ASSERTION);"; fi for i in $DEBUG; do echo " debug (\"$i\");"; done if [ "x$PRECOMPILED" != x ]; then echo " precompiled (\"$PRECOMPILED\");" fi } print_cluster() { # current cluster ADD=`find . -follow -type d -print;` CLUSTERS="$CLUSTERS $ADD" # clusters generated by idl2eif if [ "x$IDLPATH" != x ]; then CLUSTERS="$CLUSTERS $IDLPATH/stub $IDLPATH/skeleton \ $IDLPATH/base" fi # clusters added by parameter -b if [ "x$ADDPATH" != x ]; then for i in $ADDPATH; do ADD=`find $i -follow -type d -print;` CLUSTERS="$ADD $CLUSTERS" done fi echo echo cluster echo for i in $CLUSTERS; do i=`eval echo $i` if [ ! -d "$i" ]; then continue; fi ADD=`cd $i;ls *.e 2> /dev/null` # echo "ADD=$ADD" if [ "x$ADD" = "x" ]; then continue; fi if [ "x$i" = "x." ]; then CLUSTERNAME=start else CLUSTERNAME=`basename $i` fi if [ "$CLUSTERNAME" = "object" ]; then CLUSTERNAME="xobject" fi # check if CLUSTERNAME is unique # t="true" while [ "$t" = "true" ]; do t="false" for j in $CLIST; do if [ "$CLUSTERNAME" = "$j" ]; then CLUSTERNAME="$CLUSTERNAME"1 t="true" break fi done done CLIST="$CLIST $CLUSTERNAME" echo " $CLUSTERNAME: \"$i\";" done } print_external() { echo if [ "x$OBJECT" != x ]; then echo external echo for i in $OBJECT; do if [ "x$FIRST" = x ]; then echo -n " Object : \"$i\"" FIRST=false; else echo "," echo " \"$i\"" fi done echo fi } ##################################################################### ##################################################################### # parse command line into arguments USAGE="$0 -h -C file -p dir -d -a ass -o obj -i dir -s system \ -c CLASS -m creationproc -b path" ACEFILE="Ace.ace" set -- `getopt hC:p:d:a:o:i:s:c:m:b: $*` # check result of parsing if [ $? != 0 ]; then echo $USAGE exit 1 fi while [ $1 != -- ]; do case $1 in -h) print_help exit 0;; -C) RCFILE=$2;; -p) PRECOMPILED=$2;; -d) DEBUG="$DEBUG $2";; -a) ASSERTION=$2;; -o) OBJECT="$OBJECT $2";; -i) IDLPATH=$2;; -s) XSYSTEM=$2;; -c) CLASS=$2;; -m) CREATION=$2;; -b) ADDPATH="$ADDPATH $2";; -f) ACEFILE=$2;; esac shift # next flag done shift # skip double dash # now do the work # find resource file if [ "x$RCFILE" = x ]; then if [ -r ./build_ace_rc ]; then RCFILE="./build_ace_rc" elif [ -r ~/build_ace_rc ]; then RCFILE="~/build_ace_rc" fi fi #parse rc-file if [ "x$RCFILE" != x ]; then LINENR=0 while read KEYWORD REST; do LINENR=`expr $LINENR + 1` if [ "x$KEYWORD" = x ]; then continue; fi case $KEYWORD in system) XSYSTEM=$REST;; class) XCLASS=$REST;; creation) XCREATION=$REST;; assertion) XASSERTION=$REST ;; debug) DEBUG="$DEBUG $REST";; precompiled) XPRECOMPILED=$REST;; cluster) CLUSTERS="$CLUSTERS $REST";; lib) ADDPATH="$ADDPATH $REST";; object) OBJECT=$REST;; \#*) continue;; *) echo "SYNTAX ERROR in Line $LINENR!" exit 1; esac done < $RCFILE fi ########################################## if [ "x$SYSTEM" = x ]; then SYSTEM=$XSYSTEM; fi if [ "x$PRECOMPILED" = x ]; then PRECOMPILED=$XPRECOMPILED; fi if [ "x$ASSERTION" = x ]; then ASSERTION=$XASSERTION; fi if [ "x$CLASS" = x ]; then CLASS=$XCLASS; fi if [ "x$CREATION" = x ]; then CREATION=$XCREATION;fi # test if $SYSTEM, CLASS, CREATION have legal value #if [ "x$SYSTEM" = x -o "x$CLASS" = x -o "x$CREATION" = x ]; then # echo "SYNTAX ERROR: system/root clause" # print_system # print_root # exit 1 #fi # test if $ASSERTION have legal value if [ "x$ASSERTION" != x ]; then if [ "$ASSERTION" != "all" -a "$ASSERTION" != "ensure" ]; then echo "SYNTAX ERROR: assertion" exit 1 fi fi # generate output print_system > $ACEFILE print_root >> $ACEFILE print_default >> $ACEFILE print_cluster >> $ACEFILE print_external >> $ACEFILE echo >> $ACEFILE echo end >> $ACEFILE