#!/bin/sh # Copyright (c) 2006 by Joseph S. Riel. All rights reserved. # This script is used to run Maple scripts for measuring # the speed and memory usage of Maple procedures. # A typical usage is # # tmaple file # # where "file" is the Maple script being tested, it has specific # statements for running the tests. # # tmaple calls maple and assigns "file" to the Maple preprocessor # macro TESTFILE. The options -Q and -S are detected by this script # and used to prevent issuing the -q and -s options to maple, which # are enabled by default. # # Assign the path used by maple to find include files. # It is used specifically for including the file timing.mi. LIBDIR=~/etc/maple INCLUDEPATH=$LIBDIR SUPPRESSINIT="-s" QUIET="-q" MAPLE=maple if [ $# -eq 0 ]; then echo "$0: filename required" exit 1 fi # Help message usage="Usage: tmaple [-hQqSs] [-m...] file Options -h help; this screen -Q unquiet mode; display prompts and echo input -q quiet mode; do not display prompts or echo input (default) -m ver run a particular version of maple -S permit initialization files -s suppress initialization files (default) Run maple -h for other options. See ?maple for details. This script is for timing Maple scripts. It sets the includepath, assigns the Maple preprocessor macro TESTFILE to file, then passes file to maple. "; # Parse command line parameters. if [ $1 = "-h" ]; then echo "$usage" exit 0 fi OPTS= while [ $# -gt 1 ]; do case "$1" in -s) SUPPRESSINIT="-s" ;; -S) SUPPRESSINIT= ;; -q) QUIET="-q" ;; -Q) QUIET= ;; -m*) MAPLE=maple${1#-m} ;; -h) echo "$usage" exit 0 ;; *) OPTS="$OPTS \"$1\"" esac shift done TESTFILE="\"$1\"" DEFMACRO="TESTFILE=\\\"$TESTFILE\\\"" $MAPLE $QUIET $SUPPRESSINIT -I"$INCLUDEPATH" -D $DEFMACRO -B -b $LIBDIR $OPTS $TESTFILE