#!/bin/bash
# $Header: /work/c/VirtualReader/run-20070320,v 1.3 2007/03/20 20:00:00 bordi $
VALGRIND="$(which valgrind)"
STRACE="$(which strace)"
GDB="$(which gdb)"
DDD="$(which ddd)"
SPLINT="$(which splint)"
BUILD="make -C src"
PROG="bin/vreader"
FILE="test.txt"
OPTIONS="-i ${FILE} -v voice/De_Carla_22kHz -p data -format WAV -o test.wav"
$BUILD
if [ $? == 0 ]
then
echo
echo " VirtualReader - Version 0.1"
echo
echo " Navigation Keys:"
echo " ##############################"
echo " # i: next word #"
echo " # j: previous sentence #"
echo " # k: previous word #"
echo " # l: next sentence #"
echo " # p: print position #"
echo " # q: quit #"
echo " # r: reset to first position #"
echo " # s: print current sentence #"
echo " # v: switch verbosity on/off #"
echo " ##############################"
echo " Press ENTER to Start"
read
case $1 in
valgrind)
$VALGRIND $PROG $OPTIONS
;;
strace)
$STRACE $PROG $OPTIONS
;;
gdb)
echo "break 67">gdb.exec
echo "r $OPTIONS" >> gdb.exec
DEBUG=1 $GDB -x gdb.exec $PROG
rm -f gdb.exec
;;
ddd)
echo "break 67">gdb.exec
echo "r $OPTIONS" >> gdb.exec
$DDD -x gdb.exec $PROG
rm -f gdb.exec
;;
splint)
$SPLINT -Iinclude -DMBROLA -warnposix src/main.c
;;
help)
echo "Usage: run [commands]"
echo "valid commands are: strace, gdb, \
ddd, valgrind and help"
exit 0
;;
*)
$PROG $OPTIONS
;;
esac
fi
rm -f audio/*.wav;