From 3e05e6e206a04ad0e9fe8de6948e3dd8e5196660 Mon Sep 17 00:00:00 2001
From: Philip McCullick <philip.mccullick@nps.edu>
Date: Tue, 5 Nov 2019 13:48:00 -0800
Subject: [PATCH] Convert rall to a bash script that can be run from the base
 directory and point at MP files in other folders

---
 .gitignore   |  4 +++-
 Code/rall    |  0
 Code/rall.sh | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 1 deletion(-)
 mode change 100755 => 100644 Code/rall
 create mode 100755 Code/rall.sh

diff --git a/.gitignore b/.gitignore
index 496ee2c..7715aba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
-.DS_Store
\ No newline at end of file
+.DS_Store
+build/
+output/
\ No newline at end of file
diff --git a/Code/rall b/Code/rall
old mode 100755
new mode 100644
diff --git a/Code/rall.sh b/Code/rall.sh
new file mode 100755
index 0000000..dcaed9b
--- /dev/null
+++ b/Code/rall.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+# $1 - schema name, $2 - scope
+if [[ "$1" == "-h" ]] || [[ -z "$*" ]]; then
+  echo "Usage: `basename $0 $1` [mp_filepath] [scope]"
+  exit 0
+fi
+
+if [ ! -d "build" ]; then
+  mkdir build  
+fi 
+if [ ! -d "output" ]; then
+  mkdir output  
+fi 
+if [ ! -f build/Include.h ]; then
+  cp Code/includes/* build/
+  cp Code/*.rig build/
+fi
+cp $1 build/
+cd build
+mp_filename=$(basename $1)
+mp_basename="${mp_filename%.*}"
+rig='../RIGAL/rigsc.446/bin'
+$rig/rc MP2-parser
+$rig/ic MP2-parser $mp_basename tree $2 > temp.txt
+$rig/rc MP2-generator
+$rig/ic MP2-generator tree > temp2.txt
+rm tree *.rsc
+echo "C++ compiler: g++ $mp_basename.cpp -o $mp_basename -fast"
+#time /Developer/usr/bin/g++ "$mp_basename.cpp" -o $mp_basename -fast
+time g++ "${mp_basename}.cpp" -o $mp_basename -Ofast
+echo "$mp_basename run: $mp_basename>$mp_basename.txt"
+time ./$mp_basename>"${mp_basename}.txt"
+echo "Completed $mp_basename for scope $2"
+mv $mp_basename.json ../output/
+rm $mp_basename xd RIGCOMP.TMP 
-- 
GitLab