    	SUBROUTINE IFPLOT( XOP, YOP, IPF )
C
C   PROGRAMMER: R.S. ZHOU,  8/1988
C
C	THIS ROUTINE GENERATES VECTORS IN ACTIVE LINE TYPE.
C
C    	IPF =  2: DRAW TO (XOP,YOP)
C	IPF =  3: MOVE TO (XOP,YOP)
C	IPF = -3: MOVE TO (XOP,YOP) AND REORIGIN
C	IPF = -9: REORIGIN TO (XOP,YOP) ONLY
C
     	INCLUDE 'LN03PS.CBS'
C
C  CONVERT COORDINATES TO ABSOLUTE PLOTTER UNITS...
C
    	IPN = IABS(IPF)
     	IF( XANG.NE.0.0 .OR. YANG.NE.0.0 ) THEN
     	    XPS = XOP*XCTH-YOP*YSTH
     	    YPS = XOP*XSTH+YOP*YCTH
     	ELSE
     	    XPS = XOP
     	    YPS = YOP
     	ENDIF
     	XPS = XPS*XSCL + XORS
     	YPS = YPS*YSCL + YORS
     	IF( IPN.EQ.9 ) GOTO 888
     	IXL = IXO+INT(FUNI*XPS)
     	IYL = IYO+INT(FUNI*YPS)
     	IF( IXL.LT.0 ) IXL = 0
     	IF( IYL.LT.0 ) IYL = 0
     	IF( NVEC.EQ.8 ) CALL IFPLOT_DUMP(IPN)
     	NVEC = NVEC + 1
     	IF( IPN.EQ.2 ) THEN
     	    ACT(NVEC) = 'l'
     	ELSE
     	    IF( NVEC.GT.1.AND.ACT(NVEC-1).EQ.'m' ) NVEC=NVEC-1
     	    ACT(NVEC) = 'm'
     	ENDIF
     	KXL(NVEC) = IXL
     	KYL(NVEC) = IYL
C
C  KEEP TRACK OF WORKING ORIGIN...
C
888	IF( IPF.LT.0 ) THEN
    	    XORS = XPS
     	    YORS = YPS
    	ENDIF

999	RETURN
    	END

     	SUBROUTINE IFPLOT_DUMP( IPN )
C
C	THIS ROUTINE DUMPS THE SAVE-VECTOR BUFFER.
C
     	INCLUDE 'LN03PS.CBS'
     	PARAMETER SF= 0.1

     	IF( NVEC.EQ.1 .AND. ACT(1).EQ.'m' ) RETURN
     	WRITE(LUN,1) (SF*FLOAT(KXL(I)),SF*FLOAT(KYL(I)),ACT(I),I=1,NVEC)
  1	FORMAT(8(2F7.1,X,A1))
     	NVEC = 0
     	LINE = LINE + 1
     	IF( LINE.GT.128 ) THEN
     	    WRITE(LUN,2)
  2	    FORMAT('stroke')
     	    LINE = 0
     	    IF( IPN.EQ.2 ) THEN
     		NVEC = 1
     		KXL(NVEC) = IXL
     		KYL(NVEC) = IYL
     		ACT(NVEC) = 'm'
     	    ENDIF
     	ENDIF
     	RETURN
     	END

     	SUBROUTINE IFPLOT_LAST( XPS, YPS )
C
C	THIS ROUTINE REPORTS THE LAST PEN LOCATION
C	RELATIVE TO ACTIVE GRAPH ORIGIN IN INCHES.
C
     	INCLUDE 'LN03PS.CBS'

     	XPL = XSCL*(FLOAT(IXL-IXO)/FUNI-XORS)
     	YPL = YSCL*(FLOAT(IYL-IYO)/FUNI-YORS)
     	IF( XANG.NE.0.0 .OR. YANG.NE.0.0 ) THEN
     	    DET = XCTH*YCTH + XSTH*YSTH
     	    XPS = (XPL*YCTH+YPL*YSTH) / DET
     	    YPS = (YPL*XCTH-XPL*XSTH) / DET
     	ELSE
     	    XPS = XPL
     	    YPS = YPL
     	ENDIF

     	RETURN
     	END

