#!/bin/csh -f # $1 - schema name, $2 - scope if !($?mp) set mp=`dirname $0` if !($?rig) set rig='~/rigal/rigsc.446/bin' # ensure MP2 binaries have been built if !(-x $mp/MP2-parser) $rig/rc MP2-parser -c if !(-x $mp/MP2-generator) $rig/rc MP2-generator -c # cleanup rc/ic rm *.rsc >& /dev/null # parse into tree $mp/MP2-parser "$1" tree "$2" > temp.txt if !(-f tree) then echo "ERROR: Unable to parse into syntax tree file (see 'temp.txt' for details)" exit 1 endif # generate C++ code $mp/MP2-generator tree > temp2.txt if !(-f "$1.cpp") then echo "ERROR: Unable to generate '$1.cpp' C++ source code file (see 'temp2.txt' or 'RIGSC/bin/v tree' for details)" rm .cpp >& /dev/null # weird bug in MP2-generator exit 2 endif # compile C++ echo "C++ compiler: g++ $1.cpp -o $1 -Ofast" time g++ "$1.cpp" -o $1 -I$mp -Ofast if !(-x "$1") then echo "ERROR: Unable to compile binary file" exit 3 endif # run C++ echo "$1 run: ./$1 > $1.txt" time ./$1 > "$1.txt" echo "Completed $1 for scope $2" # cleanup rm temp.txt temp2.txt $1 tree >& /dev/null