#! /bin/csh -f # Last edited on 2001-01-03 23:51:52 by stolfi set usage = "$0 { -a | -f } [-gdb] GRAPH PROGRAM SECONDS" # runs GraphDraw in "programmed" or "A-team" mode on the given graph. set run = ( "nice" ) set mode = "x" while ( ( $#argv > 0 ) && ( "/$1" =~ /-* ) ) if ( ( $#argv >= 1 ) && ( "/$1" == "/-gdb" ) ) then set run = ( "run-gdb" ); shift else if ( ( $#argv >= 1 ) && ( "/$1" == "/-a" ) ) then set mode = "a"; shift else if ( ( $#argv >= 1 ) && ( "/$1" == "/-f" ) ) then set mode = "f"; shift else echo 'unknown flag "'"$1" echo "usage: ${usage}"; exit 1 endif end if ( ${mode} == "x" ) then echo 'please specify -a or -f' echo "usage: ${usage}"; exit 1 endif if ( $#argv != 3 ) then echo "usage = ${usage}"; exit 1 endif set graph = "$1"; shift; set prog = "$1"; shift; set seconds = "$1"; shift; if ( $#argv != 0 ) then echo "usage: ${usage}"; exit 1 endif set gfile = "graphs/${graph}.grf" set mfile = "graphs/${graph}.parms" set pfile = "progs/${prog}.prg" set odir = "out/${graph}-${prog}-${mode}" if ( ! -r ${gfile} ) then echo "no ${gfile}"; exit 1 endif if ( ! -r ${pfile} ) then echo "no ${pfile}"; exit 1 endif if ( -d ${odir} ) then set curdir = `pwd` cd ${odir} foreach e ( eps his dwg ) if ( -r best.${e}~ ) /bin/mv best.${e}~ best.${e}~~ if ( -r best.${e} ) /bin/mv best.${e} best.${e}~ /bin/rm -f {final,[0-9]???}.${e} end /bin/rm -f score-?.eps cd ${curdir} else mkdir ${odir} endif # Default plotting parameters set maxxng = 50 set maxasc = 50 set maxbnd = 200 set maxlen = 500 set scale = "0.75" if ( -r ${mfile} ) then source ${mfile} else echo "no ${mfile}, using defaults..." endif set program = "../../${M3PLATFORM}/GraphDraw" ${run} ${program} \ -input ${gfile} \ -outDir ${odir} \ -maxTime ${seconds} \ -plotProgress -maxScore ${maxxng} ${maxasc} ${maxbnd} ${maxlen} \ -labelPad 3 -scale ${scale} \ -mode ${mode} \ `cat ${pfile} | egrep -v '^[#]'`