#!/bin/bash
# Displays a generic help message for all scripts
#
# N. Gould, D. Orban & Ph. Toint for SifDec

#{cmds}
#
#  System specifications
#

SYSTEM="Linux"
KEYSYS="CUNIX"

#
#  Directory for temporary files
#

TMP="/tmp"


#
#  basic system commands
#

MKDIR="/bin/mkdir"
CP="/bin/cp"
RM="/bin/rm -f"
MV="/bin/mv"
CAT="/bin/cat"
CHMOD="/bin/chmod"
SED="/bin/sed"
LN="/bin/ln"
LS="/bin/ls"
AR="/usr/bin/ar"
RMDIR="/bin/rmdir"
GREP="/bin/grep"
AWK="/usr/bin/gawk"
HEAD="/usr/bin/head"
TAIL="/usr/bin/tail"
WC="/usr/bin/wc"
MAKE="/usr/bin/make"

#
#  Fortran compilation and loading
#

CPP="${CPP}"
COMPILE="gfortran -c -ffixed-form"
LOAD="gfortran -ffixed-form"
ISF9095="yes"
COMPILE9095="gfortran -c"
LOAD9095="gfortran"
FFLAGS="-g"
FDEBUGFLAGS="-g"
FPROFILEFLAGS="-pg"


# Comment on the first line of output:
# The -show option looks only useful with sifdecode. Moreover,
# you don't set parameters if the problem has already been decoded.
# Finally, if the problem has not been decoded yet, -n is useless.

if [[  `echo ${caller} | $GREP ^sd` == "${caller}"  ]]; then
    echo " ${caller} [-s] [-h] [-k] [-o i] [-l secs] [-param name=value[,name=value...]] [-force] [-debug] probname[.SIF]"
elif [[  "${caller}" == 'sifdecode'  ]]; then
    echo " ${caller} [-s] [-h] [-k] [-o i] [-l secs] [-f] [-b] [-a j] [-show] [-param name=value[,name=value...]] [-force] [-debug] probname[.SIF]"
else
    echo " ${caller} [-s] [-n] [-h] [-k] [-r] [-o i] [-l secs] [-debug]"
fi
echo ' '
echo ' where: options'
if [[  `echo ${caller} | $GREP ^sd` != "${caller}" && "${caller}" != 'sifdecode'  ]]; then
    echo '            -n     : use the load module f if it exists'
    echo '                     (Default: create a new load module)'
fi
echo '            -h     : print this help and stop execution'
echo '            -s     : run the single precision version'
echo '                     (Default: run the double precision version)'
echo '            -k     : keep the load module after use '
echo '                     (Default: delete the load module)'
if [[  `echo ${caller} | $GREP ^sd` != "${caller}" && "${caller}" != 'sifdecode'  ]]; then
    echo '                -r : discourage recompilation of the test problem'
    echo '                     (Default: recompile the objects)'
fi
echo '            -o     : 0 for silent mode, 1 for brief description of'
echo '                     the stages executed'
echo '                     (Default: -o 0)'
echo '            -l     : limits the cputime to secs seconds'
echo '                     (Default: -l 99999999)'
if [[  ${caller} == 'sifdecode'  ]]; then
    echo '            -f     : use automatic differentiation in Forward mode'
    echo '            -b     : use automatic differentiation in Backward mode'
    echo '            -a     : 1 use the older HSL automatic differentiation package AD01'
    echo '                     2 use the newer HSL automatic differentiation package AD02'
    echo '                     (Default: -a 2)'
fi
if [[  `echo ${caller} | $GREP ^sd` == "${caller}" || "${caller}" == 'sifdecode'  ]]; then
    echo '            -show  : displays possible parameter settings for'
    echo '                     probname[.SIF]. Other options are ignored'
    echo '            -param : cast probname[.SIF] against explicit parameter'
    echo '                     settings. Several parameter settings may be'
    echo '                     given as a comma-separated list following'
    echo '                     -param or using several -param flags. Use'
    echo '                     sifdecode -show probname  to view possible settings'
    echo '            -force : forces decoding with the specified parameter'
    echo '                     value.'
fi
echo '            -debug : links all the libraries, creates the executable'
echo '                     and stop to allow debugging. This option'
echo '                     automatically disables -n, enables -k,'
echo '                     and turns off all compiler options except -g.'
if [[  `echo ${caller} | $GREP ^sd` == "${caller}" || "${caller}" == 'sifdecode'  ]]; then
    echo '          probname   probname[.SIF] is the name of the file containing'
    echo '                     the SIF file for the problem of interest.'

fi
