Annotation of OpenXM_contrib/gnuplot/rgipgnu, Revision 1.1
1.1 ! maekawa 1: #!/bin/csh -f
! 2: #
! 3: # Print gnuplot output on RGIP (Uniplex) format.
! 4:
! 5: set input_files = () # the plot input command files
! 6: set lpr_opts = () # options to lpr
! 7: set fontsize = ()
! 8:
! 9: # File for plot commands, and for plot output
! 10: set TMP=/tmp/plot$$
! 11: set outfile="|mail $USER" #mail user if no outputfile
! 12: set out=0
! 13: set windows = () #windows nr i x-dir and y-dir
! 14: onintr cleanup
! 15:
! 16: # default is Imagen mode for Imagen printer; see -p option
! 17: set setterm="set terminal imagen"
! 18:
! 19: set usage="usage: rgipgnu [-f fontsize] [-w [winx,winy]] [-t title] [-o outputfile] [-p 'plot command'] [plot-files....]"
! 20:
! 21: # Loop through the command-line arguments.
! 22:
! 23:
! 24: top:
! 25: if ($#argv > 0) then
! 26:
! 27: switch ("$argv[1]")
! 28:
! 29: case - : # print to stdout
! 30: set outfile=""
! 31: set out=1
! 32: shift argv
! 33: goto top
! 34:
! 35: case -f?*: # Specify font size
! 36: set fontsize = `echo $argv[1] | sed 's/^-f//'`)
! 37: shift argv
! 38: goto top
! 39:
! 40: case -f: # Specify font size
! 41: shift argv
! 42: if ($#argv > 0) then
! 43: set fontsize = $argv[1]
! 44: shift argv
! 45: else
! 46: echo "Usage: -f fontsize (1-8)"
! 47: echo "Type rgipgnu -help for help."
! 48: exit (1)
! 49: endif
! 50: goto top
! 51:
! 52: case -o?*: # Specify output-file of plot
! 53: set outfile = `echo $argv[1] | sed 's/^-o//'`
! 54: set out=1
! 55: shift argv
! 56: goto top
! 57:
! 58: case -o: # Specify title of plot
! 59: shift argv
! 60: if ($#argv > 0) then
! 61: set outfile = $argv[1]
! 62: set out=1
! 63: shift argv
! 64: else
! 65: echo "Usage: -o outputfile"
! 66: echo "Include a 'X' in filename if multiple plots"
! 67: echo "Type lasergnu -help for help."
! 68: exit (1)
! 69: endif
! 70: goto top
! 71:
! 72: case -t?*: # Specify title of plot
! 73: echo set title \""`echo $argv[1] | sed 's/^-t//'`"\" >> $TMP
! 74: shift argv
! 75: goto top
! 76:
! 77: case -t: # Specify title of plot
! 78: shift argv
! 79: if ($#argv > 0) then
! 80: echo set title \""$1"\" >> $TMP
! 81: shift argv
! 82: else
! 83: echo "Usage: -t title ..."
! 84: echo "Type lasergnu -help for help."
! 85: exit (1)
! 86: endif
! 87: goto top
! 88: case -help:
! 89: echo "$usage"
! 90: exit(1)
! 91:
! 92: case -p?*: # plot-commds
! 93: echo "$argv[1]" | sed "s/^-p//" >> $TMP
! 94: shift argv
! 95: goto top
! 96:
! 97: case -p: # Set the printer, exactly as by itroff.
! 98: shift argv
! 99: if ($#argv > 0) then
! 100: echo "$argv[1]" >> $TMP
! 101: shift argv
! 102: else
! 103: echo "Usage: -P 'plot-commands ...'"
! 104: echo "Type rgipgnu -help for help."
! 105: exit (1)
! 106: endif
! 107: goto top
! 108:
! 109: case -w: # Specify split page
! 110: shift argv
! 111: if ($#argv > 0) then
! 112: set windows="[$argv[1]]"
! 113: shift argv
! 114: else
! 115: echo "Usage: -w no_horiz,no_vertical"
! 116: echo "Type lasergnu -help for help."
! 117: exit (1)
! 118: endif
! 119: goto top
! 120:
! 121: case -?*:
! 122: echo "I do not recognize option $argv[1]."
! 123: echo "$usage"
! 124: exit (1)
! 125:
! 126: default:
! 127: set input_files = ($input_files $argv[1])
! 128: shift argv
! 129: goto top
! 130:
! 131: endsw
! 132: endif
! 133:
! 134: set setterm="set term rgip $fontsize $windows"
! 135:
! 136: # Set up input file
! 137: echo "$setterm" > $TMP.plt
! 138: echo set output \"$outfile\" >> $TMP.plt
! 139: if (-e $TMP) cat $TMP >> $TMP.plt
! 140:
! 141: # If input file is specified AND command line contains plot commands, then
! 142: # do command line args first, then plot commands in input file.
! 143: #if ( "$input_files" != "" ) then
! 144: if ( "$out" ) then
! 145: grep -v "set te" $input_files | grep -v "set out" >> $TMP.plt
! 146: else
! 147: grep -v "set te" $input_files >> $TMP.plt
! 148: endif
! 149: echo "quit" >> $TMP.plt
! 150: gnuplot $TMP.plt < /dev/null
! 151:
! 152: cleanup:
! 153: rm -f $TMP*
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>