C SUBROUTINE FILE 'PLOTVDI.FOR' - PLOT INTERFACE SUBROUTINES TO GSS-VDI
C
C=======================================================================
C
      SUBROUTINE PLOTS(I1,I2,I3)
      INTEGER I1,I2,I3
C
C     ------------------------------------------------------------------
C     SPECIFICATIONS COMMON TO ALL THE ROUTINES OF THIS FILE:
      INTEGER*2 LUVDI
      REAL*4    STARTX,STARTY,SCALEX,SCALEY,OLDX,OLDY
      COMMON /VDICOM/ LUVDI,STARTX,STARTY,SCALEX,SCALEY,OLDX,OLDY
      INTEGER*2 VDIERR
C     ------------------------------------------------------------------
C
C     CALLED VDI FUNCTIONS
      EXTERNAL VOPNWK,VQERR
      INTEGER*2 VOPNWK,VQERR
C
C     AUXILIARY STORAGE LOCATIONS
      INTEGER*2 WORKIN(19),WORKOT(66)
      CHARACTER*8 DEVICE
C
      DEVICE= 'DISPLAY '
      HSIZE=29.7
      VSIZE=21.0
      SCALEX= 32768./HSIZE
      SCALEY= 32768./VSIZE
      STARTX= 0.0
      STARTY= 0.0
      WORKIN(1) = 0
      WORKIN(2) = 1
      WORKIN(3) = 1
      WORKIN(4) = 1
      WORKIN(5) = 1
      WORKIN(6) = 1
      WORKIN(7) = 1
      WORKIN(8) = 1
      WORKIN(9) = 1
      WORKIN(10)= 1
      WORKIN(11)= 1
      WORKIN(12)= ICHAR(DEVICE(1:1))
      WORKIN(13)= ICHAR(DEVICE(2:2))
      WORKIN(14)= ICHAR(DEVICE(3:3))
      WORKIN(15)= ICHAR(DEVICE(4:4))
      WORKIN(16)= ICHAR(DEVICE(5:5))
      WORKIN(17)= ICHAR(DEVICE(6:6))
      WORKIN(18)= ICHAR(DEVICE(7:7))
      WORKIN(19)= ICHAR(DEVICE(8:8))
      VDIERR= VOPNWK(WORKIN,LUVDI,WORKOT)
      IF(VDIERR.NE.0) THEN
        VDIERR= VQERR()
        WRITE(*,'('' VDI ERROR NO.'',I6)') VDIERR
        STOP
      END IF
      STARTX= SCALEX*STARTX
      STARTY= SCALEY*STARTY
      OLDX  = 0.
      OLDY  = 0.
      RETURN
      END
C
C=======================================================================
C
      SUBROUTINE PLOT(XPAGE,YPAGE,IPEN)
      REAL    XPAGE,YPAGE
      INTEGER IPEN
C
C     ------------------------------------------------------------------
C     SPECIFICATIONS COMMON TO ALL THE ROUTINES OF THIS FILE:
      INTEGER*2 LUVDI
      REAL*4    STARTX,STARTY,SCALEX,SCALEY,OLDX,OLDY
      COMMON /VDICOM/ LUVDI,STARTX,STARTY,SCALEX,SCALEY,OLDX,OLDY
      INTEGER*2 VDIERR
C     ------------------------------------------------------------------
C
C     CALLED VDI FUNCTIONS
      EXTERNAL VPLINE,VCLRWK,VCLSWK
      INTEGER*2 VPLINE,VCLRWK,VCLSWK
C
C     AUXILIARY STORAGE LOCATIONS
      INTEGER*2 IXY(4)
      REAL      X,Y
      INTEGER*4 IX,IY
C
      X = XPAGE
      Y = YPAGE
C
      IF(IABS(IPEN).EQ.2) THEN
        IX    = INT(STARTX+SCALEX*OLDX+0.5)
        IY    = INT(STARTY+SCALEY*OLDY+0.5)
        IF(IX.GE.0.AND.IX.LE.32767.AND.
     *       IY.GE.0.AND.IY.LE.32767) THEN
          IXY(1)= IX
          IXY(2)= IY
          IX    = INT(STARTX+SCALEX*X+0.5)
          IY    = INT(STARTY+SCALEY*Y+0.5)
          IF(IX.GE.0.AND.IX.LE.32767.AND.
     *       IY.GE.0.AND.IY.LE.32767) THEN
            IXY(3)= IX
            IXY(4)= IY
            VDIERR= VPLINE(LUVDI,2,IXY)
          END IF
        END IF
      END IF
      IF(IPEN.GE.0) THEN
        OLDX  = X
        OLDY  = Y
      ELSE
        STARTX= STARTX+SCALEX*X
        STARTY= STARTY+SCALEY*Y
        OLDX  = 0.
        OLDY  = 0.
      END IF
      IF(IPEN.GE.999) THEN
        VDIERR= VCLRWK(LUVDI)
        VDIERR= VCLSWK(LUVDI)
        WRITE(*,'('' [=3h'')')
      END IF
      RETURN
      END
C
C=======================================================================
C
      SUBROUTINE NEWPEN(INP)
      INTEGER INP
C
C     ------------------------------------------------------------------
C     SPECIFICATIONS COMMON TO ALL THE ROUTINES OF THIS FILE:
      INTEGER*2 LUVDI
      REAL*4    STARTX,STARTY,SCALEX,SCALEY,OLDX,OLDY
      COMMON /VDICOM/ LUVDI,STARTX,STARTY,SCALEX,SCALEY,OLDX,OLDY
      INTEGER*2 VDIERR
C     ------------------------------------------------------------------
C
C     CALLED VDI FUNCTIONS
      EXTERNAL VSLCOL
      INTEGER*2 VSLCOL
C
      VDIERR= VSLCOL(LUVDI,INP)
      RETURN
      END
C
C=======================================================================
C
