#!/bin/tcsh -f # # # Read the symbols # # # Parse the command-line options # # set symbols = (title 3 \ directory 1 \ distance 1 \ ident 1 \ extension 1 \ imagename 1 \ firstimagenumber 1 \ lastimagenumber 1 \ beamcenter 2 \ backstopcenter 2 \ backstopradius 1 \ mosaic 1 \ outputroot 1 \ space 1 \ highres 1 \ lowres 1 \ addinteg 3 \ merge 3 \ addscale 3 \ nresidue 1 \ anomalous 1 \ exclude 3 \ sdadd 1 \ nullpix 1 \ overload 1 \ wavelength 1 \ gain 1 \ polarization 1 \ divergence 3 \ dispersion 1 \ phi 2 \ twotheta 1 \ raster 3 \ separation 3 \ "-" 0 \ help 4 \ h 4) set symbolhelp = ('title "title"' \ 'directory directory containing image files' \ 'ident image identifier' \ 'extension image file extension' \ 'firstimagenumber number' \ 'lastimagenumber number' \ 'phi start end' \ 'beamcenter x y' \ 'backstopcenter x y' \ 'backstopradius radius' \ 'mosaic mosaicity' \ 'outputroot output file root' \ 'space space group' \ 'highres high-resolution limit' \ 'lowres low-resolution limit' \ 'addinteg "command" ["command" ...]' \ 'merge filename [filename ...]' \ 'addscale "command" ["command" ...]' \ 'nresidue number of residues' \ 'anomalous on/off' \ 'exclude batch numbers to exclude from scaling' \ 'sdadd number' \ 'nullpix minimum valid pixel value' \ 'overload maximum valid pixel value' \ 'wavelength wavelength' \ 'gain counts/photon' \ 'polarization value' \ 'twotheta two-theta arm angle' \ 'divergence horizontal [vertical ...]' \ 'dispersion value' \ 'raster mosflm raster parameters (5 values)' \ 'separation horizontal vertical [ close ]') set argv0 = ${0} set unmatched = () while (${#argv} > 0) set match = 0 set num = 1 while (${num} <= ${#symbols}) if ("${1}" == "-${symbols[${num}]}") then set symbol = ${symbols[${num}]} set match = 1 @ numm = ${num} + 1 if (${symbols[${numm}]} == 4) then if (${?input} == 0) then set input = ... endif echo " " echo " Usage: ${argv0:t} ${input} [-options] " echo " " if (${argv0} =~ *mosflm) then echo " Note: mosflm_SD ${input} [-options] is recommended" echo " when working on a small (1024 x 768) display" echo " " endif set num = 1 if (${?help}) then while (${num} <= ${#help}) if (${num} == 1) then echo -n " options: -" else echo -n " -" endif set helpnum = 1 while (${helpnum} <= ${#symbolhelp}) set symbol = (${symbolhelp[${helpnum}]}) if (${help[${num}]} == ${symbol[1]}) then echo -n "${symbolhelp[${helpnum}]}" break endif @ helpnum = ${helpnum} + 1 end echo "" @ num = ${num} + 1 end endif echo " --" echo " " echo " -help/-h prints this message" echo " " kill -9 $$ endif # # # Read 1 argument # # if (${symbols[${numm}]} == 1) then if ( $#argv > 1 ) then set ${symbol} = "${2}" shift goto nextargument else echo "You must supply an argument to ${symbol}" kill -9 $$ endif endif # # # Read 2 arguments # # if (${symbols[${numm}]} == 2) then if ( $#argv > 2 ) then set ${symbol} = ("${2}" "${3}") shift shift goto nextargument else echo "You must supply two arguments to ${symbol}" kill -9 $$ endif endif # # # Read a list # # if (${symbols[${numm}]} == 3) then cat > ${tmpfile} << eof set ${symbol} = set maxnum = 2 while (\${maxnum} <= \${#argv}) set numm = 1 while (\${numm} <= \${#symbols}) if ("\${argv[\${maxnum}]}" == "-\${symbols[\${numm}]}") then @ maxnum = \${maxnum} - 1 goto gotmax endif @ numm = \${numm} + 2 end set ${symbol} = (\${${symbol}} 1) @ maxnum = \${maxnum} + 1 end @ maxnum = \${maxnum} - 1 gotmax: set numm = 1 while (\${numm} < \${maxnum}) set ${symbol}[\${numm}] = "\${2}" shift @ numm = \${numm} + 1 end eof source ${tmpfile} rm -f ${tmpfile} goto nextargument endif endif @ num = ${num} + 2 end nextargument: if (${match} == 0) then set unmatched = (${unmatched} ${1}) endif shift end set argv = (${unmatched})