File: rgipgnu

package info (click to toggle)
gnuplot 3.5beta6.347-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 5,032 kB
  • ctags: 4,235
  • sloc: ansic: 42,086; makefile: 561; asm: 539; sh: 386; objc: 379; csh: 297; pascal: 194; perl: 138; lisp: 88
file content (153 lines) | stat: -rw-r--r-- 3,371 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/csh -f
#
# Print gnuplot output on RGIP (Uniplex) format.

set input_files = ()    # the plot input command files
set lpr_opts = ()	    # options to lpr
set fontsize = ()

# File for plot commands, and for plot output
set TMP=/tmp/plot$$
set outfile="|mail $USER"	#mail user if no outputfile
set out=0
set windows = ()	#windows nr i x-dir and y-dir
onintr cleanup

# default is Imagen mode for Imagen printer; see -p option
set setterm="set terminal imagen"

set usage="usage: rgipgnu [-f fontsize] [-w [winx,winy]] [-t title] [-o outputfile] [-p 'plot command'] [plot-files....]"

# Loop through the command-line arguments.


top:
	if ($#argv > 0) then

		switch ("$argv[1]")

		case -   :	# print to stdout 
			set outfile=""
			set out=1
			shift argv
			goto top

		case -f?*:		# Specify font size
			set fontsize = `echo $argv[1] | sed 's/^-f//'`)
			shift argv
			goto top

		case -f:	# Specify font size
			shift argv
			if ($#argv > 0) then
				set fontsize = $argv[1]
				shift argv
			else
				echo "Usage: -f fontsize (1-8)"
				echo "Type    rgipgnu -help    for help."
				exit (1)
			endif
			goto top

		case -o?*:	# Specify output-file of plot
			set outfile = `echo $argv[1] | sed 's/^-o//'`
			set out=1
			shift argv
			goto top

		case -o:	# Specify title of plot
			shift argv
			if ($#argv > 0) then
			 	set outfile = $argv[1]
				set out=1
				shift argv
			else
				echo "Usage: -o outputfile"
				echo "Include a 'X' in filename if multiple plots"
				echo "Type    lasergnu -help    for help."
				exit (1)
			endif
			goto top

		case -t?*:	# Specify title of plot
			echo set title \""`echo $argv[1] | sed 's/^-t//'`"\" >> $TMP
			shift argv
			goto top

		case -t:	# Specify title of plot
			shift argv
			if ($#argv > 0) then
				echo set title \""$1"\" >> $TMP
				shift argv
			else
				echo "Usage: -t title ..."
				echo "Type    lasergnu -help    for help."
				exit (1)
			endif
			goto top
          case -help:
			echo "$usage"
			exit(1)

		case -p?*:	# plot-commds 
	                echo "$argv[1]" | sed "s/^-p//"	>> $TMP
			shift argv
			goto top

		case -p:	# Set the printer, exactly as by itroff.
			shift argv
			if ($#argv > 0) then
	                	echo "$argv[1]"	>> $TMP
				shift argv
			else
				echo "Usage: -P 'plot-commands ...'"
				echo "Type    rgipgnu -help    for help."
				exit (1)
			endif
			goto top

		case -w:	# Specify split page
			shift argv
			if ($#argv > 0) then
				set windows="[$argv[1]]"
				shift argv
			else
				echo "Usage: -w no_horiz,no_vertical"
				echo "Type    lasergnu -help    for help."
				exit (1)
			endif
			goto top

		case -?*:
			echo "I do not recognize option $argv[1]."
			echo "$usage"
			exit (1)

		default:
	          	set input_files = ($input_files $argv[1])
			shift argv
			goto top

		endsw
	endif

set setterm="set term rgip $fontsize $windows"

# Set up input file
echo "$setterm" > $TMP.plt
echo set output \"$outfile\" >> $TMP.plt
if (-e $TMP) cat $TMP >> $TMP.plt

# If input file is specified AND command line contains plot commands, then
#	do command line args first, then plot commands in input file.
#if ( "$input_files" != "" ) then
if ( "$out" ) then
grep -v "set te" $input_files | grep -v "set out" >> $TMP.plt
else
grep -v "set te" $input_files >> $TMP.plt
endif
echo "quit" >> $TMP.plt
gnuplot $TMP.plt < /dev/null

cleanup:
rm -f $TMP*