rall 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/csh -f
  2. # $1 - schema name, $2 - scope
  3. if !($?mp) set mp=`dirname $0`
  4. if !($?rig) set rig='~/rigal/rigsc.446/bin'
  5. # ensure MP2 binaries have been built
  6. if !(-x $mp/MP2-parser) $rig/rc MP2-parser -c
  7. if !(-x $mp/MP2-generator) $rig/rc MP2-generator -c
  8. # cleanup rc/ic
  9. rm *.rsc >& /dev/null
  10. # parse into tree
  11. $mp/MP2-parser "$1" tree "$2" > temp.txt
  12. if !(-f tree) then
  13. echo "ERROR: Unable to parse into syntax tree file (see 'temp.txt' for details)"
  14. exit 1
  15. endif
  16. # generate C++ code
  17. $mp/MP2-generator tree > temp2.txt
  18. if !(-f "$1.cpp") then
  19. echo "ERROR: Unable to generate '$1.cpp' C++ source code file (see 'temp2.txt' or 'RIGSC/bin/v tree' for details)"
  20. rm .cpp >& /dev/null # weird bug in MP2-generator
  21. exit 2
  22. endif
  23. # compile C++
  24. echo "C++ compiler: g++ $1.cpp -o $1 -Ofast"
  25. time g++ "$1.cpp" -o $1 -I$mp -Ofast
  26. if !(-x "$1") then
  27. echo "ERROR: Unable to compile binary file"
  28. exit 3
  29. endif
  30. # run C++
  31. echo "$1 run: ./$1 > $1.txt"
  32. time ./$1 > "$1.txt"
  33. echo "Completed $1 for scope $2"
  34. # cleanup
  35. rm temp.txt temp2.txt $1 tree >& /dev/null