File: zedriv.f

package info (click to toggle)
pgplot 5.2-4
  • links: PTS
  • area: non-free
  • in suites: hamm
  • size: 6,252 kB
  • ctags: 5,899
  • sloc: fortran: 37,938; ansic: 18,809; sh: 1,133; objc: 532; perl: 436; makefile: 254; pascal: 233; tcl: 178; awk: 51; csh: 25
file content (253 lines) | stat: -rw-r--r-- 7,123 bytes parent folder | download | duplicates (4)
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
* Date:     27-MAR-1987 11:28:46
* From:     AFT%UK.AC.CAM.AST-STAR@AC.UK
* To:       TJP@CITPHOBO
* Subject:  ZEDRIVER.FOR (3)

C*ZEDRIV -- PGPLOT Zeta Plotter driver
     
      SUBROUTINE ZEDRIV(IFUNC,RBUF,NBUF,CHR,LCHR)
C--- GRPCKG driver for ZETA plotter.
C----
C Supported device:  Zeta 8 Digital Plotter.
C Device type code:  /ZEta
C Default file name:  PGPLOT.ZET
C Default view surface dimensions:  11 inches by 11 inches.  Current
C   version does not allow larger plots although the manual indicates
C   plots up to 144 feet are possible.
C Resolution:  This version is written for the case where the resolution
C   switch is set to .025 mm.  Actual resolution depends on thickness
C   of pen tip.
C Color capability:  Color indices 1 to 8 are supported corresponding
C   to pens 1-8.  It is not possible to erase lines.
C Input capability:  None.
C File format:  Variable length records with Carriage control of LIST.
C Obtaining hardcopy:  On Starlink print the file on the queue associated
C   with the Zeta plotter.  If the Plotter is attached to a terminal
C   line, then TYPEing the file at the terminal will produce a plot.
C   On Starlink:
C   $ PRINT/NOFEED/QUE=ZETA PGPLOT.ZET
C
C   To stop a Zeta plot job, once it has been started, use the buttons
C   on the plotter.  Press PAUSE, NEXT PLOT and CLEAR.  Only after
C   this sequence is it safe to delete the job from the ZETA Queue.
C   Failing to press the NEXT PLOT button will not correctly advance
C   the paper.  Failing to press CLEAR but, deleteing the current
C   job can prevent the following plot from being plotted.
C
C  5-Aug-1986 - [AFT].
C-----------------------------------------------------------------------
C     IMPLICIT NONE
      INTEGER   IFUNC,NBUF,LCHR,I0,J0,I1,J1
      REAL      RBUF(6)
      CHARACTER CHR*(*)
      INTEGER   GRGE00
      CHARACTER COL(0:7)*2
      INTEGER   LUN,MXCNT,ICNT,IBADR
      SAVE      LUN,MXCNT,ICNT,IBADR
      DATA COL/'6A','61','62','63','64','65','66','67'/
C---
      GOTO( 10, 20, 30, 40, 50, 60, 70, 80, 90,100,
     :     110,120,130,140,150,160) IFUNC
      GOTO 999
C---
C--- IFUNC= 1, Return device name.
 10   CHR='ZETA'
      LCHR=LEN(CHR)
      RETURN
C---
C--- IFUNC= 2, Return Physical min and max for plot device.
 20   RBUF(1)=0
      RBUF(2)=11175
      RBUF(3)=0
      RBUF(4)=11175
      RBUF(5)=1
      RBUF(6)=8
      NBUF=4
      RETURN
C---
C--- IFUNC= 3, Return device resolution.
 30   RBUF(1)=1007.0
      RBUF(2)=1007.0
      RBUF(3)=10
      NBUF=3
      RETURN
C---
C--- IFUNC= 4, Return misc device info.
 40   CHR='HNNNNNNNNN'
      LCHR=10
      RETURN
C---
C--- IFUNC= 5, Return default file name.
 50   CHR='PGPLOT.ZET'
      LCHR=LEN(CHR)
      RETURN
C---
C--- IFUNC= 6, Return default physical size of plot.
 60   RBUF(1)=0
      RBUF(2)=11175
      RBUF(3)=0
      RBUF(4)=11175
      RETURN
C---
C--- IFUNC= 7, Return misc defaults.
 70   RBUF(1)=15
      NBUF=1
      RETURN
C---
C--- IFUNC= 8, Set active plot.
 80   CALL INIT03(0,LUN,0)
      RETURN
C---
C--- IFUNC= 9, Open workstation.
 90   RBUF(2)=GRGE00('FFL',LUN,CHR,LCHR)
      RBUF(1)=LUN
      IF(RBUF(2).EQ.1) THEN
         MXCNT=130
         CALL GRGMEM(MXCNT,IBADR)
         ICNT=0
         CALL INIT03(0,LUN,0)
      END IF
      RETURN
C---
C--- IFUNC=10, Close workstation.
 100  CLOSE(UNIT=LUN)
      CALL GRFLUN(LUN)
      CALL GRFMEM(MXCNT,IBADR)
      RETURN
C---
C--- IFUNC=11, Begin Picture.
 110  CALL GRGE02(%ref('ZZZZZZZZZZ'), 10, %val(IBADR),ICNT,MXCNT)
      CALL GRGE02(%ref('0000000000CIII'), 14, %val(IBADR),ICNT,MXCNT)
      CALL INZE01
      RETURN
C---
C--- IFUNC=12, Draw line.
 120  I0=NINT(RBUF(1))
      J0=NINT(RBUF(2))
      I1=NINT(RBUF(3))
      J1=NINT(RBUF(4))
      CALL GRZE01(I0,J0,I1,J1,%val(IBADR),ICNT,MXCNT)
      RETURN
C---
C--- IFUNC=13, Draw dot.
 130  I0=NINT(RBUF(1))
      J0=NINT(RBUF(2))
      CALL GRZE01(I0,J0,I0,J0,%val(IBADR),ICNT,MXCNT)
      RETURN
C---
C--- IFUNC=14, End picture.
C--- Move pen to origin,
C--- Advance paper by 15 inches,
C--- Reset.
 140  CALL GRZE01(0,0,0,0,%val(IBADR),ICNT,MXCNT)
      CALL GRGE02(%ref('1OGUE'),5,%val(IBADR),ICNT,MXCNT)
      CALL GRGE02(%ref('70Z')  ,3,%val(IBADR),ICNT,MXCNT)
      RETURN
C---
C--- IFUNC=15, Select pen.
 150  I0=MAX(0,MIN(NINT(RBUF(1)),7))
      RBUF(1)=I0
      CALL GRGE02(%ref(COL(I0)),2,%val(IBADR),ICNT,MXCNT)
      RETURN
C---
C--- IFUNC=16, Flush buffer.
 160  CALL GRGE03(%val(IBADR),ICNT)
      RETURN
C---
C--- Flag function not implemented.
 999  NBUF=-1
      RETURN
C---
      END

C*GRZE01 -- PGPLOT Zeta Plotter driver, line segment

      SUBROUTINE GRZE01 (I0,J0,I1,J1,IBUF,ICNT,MXCNT)
C-----------------------------------------------------------------------
C GRPCKG (internal routine, ZETA): draw a line segment.
C
C Arguments:
C
C I0,J0 (integer, input): the column and row numbers of the starting
C       point.
C I1,J1 (integer, input): the column and row numbers of the end point.
C
C 15-NOV-83
C-----------------------------------------------------------------------
C     IMPLICIT NONE
      INTEGER    ISIZE
      PARAMETER (ISIZE=11176)
      INTEGER   I0, I1, J0, J1, IBUF(*), ICNT, MXCNT
      CHARACTER CPEN(2), CSTR*8
      INTEGER   II0, II1, JJ0, JJ1, I
      INTEGER   IDX(2), IDY(2), LASTX, LASTY
      SAVE      LASTX,LASTY
      DATA CSTR(2:2)/'R'/, CPEN/'1','2'/
C---
      II0= MOD(I0, ISIZE)
      II1= MOD(I1, ISIZE)
      JJ0= MOD(J0, ISIZE)
      JJ1= MOD(J1, ISIZE)
C
      IDX(1)= II0-LASTX
      IDY(1)= JJ0-LASTY
      IDX(2)= II1-II0
      IDY(2)= JJ1-JJ0
C
C  First iteration moves to starting point, second draws line.
C
      DO 100 I= 1, 2
         CSTR(1:1)= CPEN(I)
         IF(IDX(I).NE.0  .OR. IDY(I).NE.0) THEN
            CALL GRZE04(IDX(I), CSTR, 3)
            CALL GRZE04(IDY(I), CSTR, 6)
            CALL GRGE02(%ref(CSTR), 8, IBUF,ICNT,MXCNT)
         ELSE IF(I .EQ. 2) THEN
            CALL GRGE02(%ref(CSTR), 1, IBUF,ICNT,MXCNT)
         END IF
 100  CONTINUE
C
      LASTX= II1
      LASTY= JJ1
      RETURN
C---
      ENTRY INZE01
C
C  This entry is called by to initialize a new plot.
C
      LASTX= 0
      LASTY= 0
      RETURN
      END

C*GRZE04 -- PGPLOT Zeta Plotter driver, string generation

      SUBROUTINE GRZE04(NUM, CSTR, NC)
C-----------------------------------------------------------------
C  Generate strings for sending to Zeta plotter.
C
C- NUM          I   I   Number to be converted.
C- CSTR         I/O C   Output character array.
C- NC           I/O I   Start location in CSTR
C
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C     IMPLICIT NONE
      INTEGER   NUM,NC
      CHARACTER CSTR*(*)
      INTEGER   ITMP, I, IDIV, IND
      CHARACTER CFIG(0:31)
C
      DATA CFIG/'0','1','2','3','4','5','6','7','A',
     :    'B','C','D','E','F','G','H','I','J','K','L','M','N','O',
     :    'P','Q','R','S','T','U','V','W','X'/
C
      ITMP=NUM
      IF(NUM .LT. 0) ITMP= NUM+32768
      IDIV= 1
      DO 100 I=NC+2,NC,-1
         IND= MOD(ITMP/IDIV, 32)
         IF(IND .LT. 0) IND= 32+IND
         CSTR(I:I)= CFIG(IND)
         IDIV= IDIV*32
 100  CONTINUE
      END