#! /bin/sh

cppsim_root=${CPPSIMHOME-$HOME/CppSim}
if [ -z "$CPPSIMHOME" ]; then export CPPSIMHOME=$cppsim_root; fi

sue2_bin_dir=$(dirname $0)
sue2_dir="${sue2_bin_dir%/*}"
cppsimshared_root="${sue2_dir%/*}"
#cppsimshared_root=${CPPSIMSHAREDHOME-$cppsim_root/CppSimShared}
if [ -z "$CPPSIMSHAREDHOME" ]; then export CPPSIMSHAREDHOME=$cppsimshared_root; fi

expand_tilde () { eval "$1=$2" ; }
expand_tilde cppsimshared_root $cppsimshared_root

ARCH=`arch`

if [ "$ARCH" = "i686" ] 
   then
   ${cppsimshared_root}/Sue2/bin/glnx86/sue_spice_netlister $1 $2 $3 $4
else
if [ "$ARCH" = "x86_64" ] 
   then
   ${cppsimshared_root}/Sue2/bin/glnxa64/sue_spice_netlister $1 $2 $3 $4
else
if [ "$ARCH" = "i386" ] 
   then
   ${cppsimshared_root}/Sue2/bin/macosx/sue_spice_netlister $1 $2 $3 $4
else
if [ "$ARCH" = "arm64" ] 
   then
   ${cppsimshared_root}/Sue2/bin/arm64/sue_spice_netlister $1 $2 $3 $4
else
   echo "Error: architecture $ARCH unknown"
fi
fi
fi
fi
