     	SUBROUTINE IFINIT( LOUT, IR, ARRAY )
C
C  PROGRAMMER: R.S. ZHOU
C	       ALFRED UNIVERSITY, SEP-1986
C
C	THIS ROUTINE INITIALIZES A PLOT PAGE FOR HP7550.
C
C		LOUT --- OUTPUT FILE LOGICAL UNIT
C		IR ----- LENGTH OF "ARRAY"
C		ARRAY -- DEVICE INITIALIZATION PARAMETERS
C
    	INCLUDE 'HP7550.CBS'
     	DIMENSION ARRAY(1)
C
C  INITIALIZE COMMON GRAPHIC PARAMETERS...
C
    	IPL = 0
     	DO I=1, NBS+5
     	   IPB(I) = 0
     	ENDDO
     	LUN = LOUT
     	JXO = 0
     	JYO = 0
     	XSCL = 1.0
     	YSCL = 1.0
    	FUNI = 1016.0
     	IRR  = IR
    	IF( IRR.GT.0 ) JXO = ARRAY(1)*FUNI
    	IF( IRR.GT.1 ) JYO = ARRAY(2)*FUNI
     	IF( IRR.GT.2 .AND. ARRAY(3).GT.0.0 ) XSCL= ARRAY(3)
     	IF( IRR.GT.3 .AND. ARRAY(4).GT.0.0 ) YSCL= ARRAY(4)
     	LTY = 1
     	LWD = 1
     	IF( IRR.GT.4 .AND. ARRAY(5).GT.0.0 ) LWD = ARRAY(5)
     	CALL IFSTYL( LTY, LWD )		!SET PLOTTING STYLUS
C
C  INITIALIZE THE PLOTTER...
C
     	IPB(IPL+1) = 27		!TURN ON PLOTTER IN CASE OF BYPASS MODE
     	IPB(IPL+2) = '.'
     	IPB(IPL+3) = '('
    	IPB(IPL+4) = 'I'
    	IPB(IPL+5) = 'N'
    	IPB(IPL+6) = 'R'
    	IPB(IPL+7) = 'O'
    	IPL = IPL + 7
    	IF( IRR.GT.5 .AND. ARRAY(6).NE.0.0 ) THEN
    	    IPB(IPL+1) = '9'	!AXIS ALIGNMENT
    	    IPB(IPL+2) = '0'
    	    IPL = IPL + 2
    	ENDIF
      	IPB(IPL+1) = 'I'	!DEFAULT P1,P2
    	IPB(IPL+2) = 'P'
     	IPB(IPL+3) = 'P'	!PLOT ABSOLUTE MODE
     	IPB(IPL+4) = 'A'
     	IPB(IPL+5) = 'S'
     	IPB(IPL+6) = 'P'
     	IPB(IPL+7) = '1'	!SELECT PEN #1
     	IPL = IPL + 7
    	IF( IRR.GT.6 .AND. ARRAY(7).GT.0.0 ) THEN
     	    IPB(IPL+1) = 'V'	!PEN SPEED
    	    IPB(IPL+2) = 'S'
      	    IPL = IPL + 2
    	    CALL IFDRAW_CDIF( INT(ARRAY(7)*ARRAY(7)) )
    	ENDIF

999	RETURN
    	END

    	SUBROUTINE IFINIT_DUMP
C
C  PROGRAMMER: R.S. ZHOU,	SEP-1986
C
C	THIS ROUTINE DUMPS THE GRAPHIC BUFFER "IPB".
C
    	INCLUDE 'HP7550.CBS'

     	IF( IPL.EQ.0 ) GOTO 999
C
C  DUMP THE BUFFER...
C
     	WRITE(LUN,1) (IPB(I),I=1,IPL)
1	FORMAT(<IPL>A1$)
C
C  NULL THE BUFFER...
C
    	DO I=1, IPL
    	   IPB(I) = 0
    	ENDDO
     	IPL = 0

999	RETURN
    	END

     	SUBROUTINE IFINIT_PLOT( XORG, YORG )
C
C	THIS ROUTINE INITIALIZES A PLOT SESSION.
C
     	INCLUDE 'HP7550.CBS'

     	IXO = JXO + INT(XORG*FUNI)
     	IYO = JYO + INT(YORG*FUNI)
     	IXL = IXO
     	IYL = IYO
     	ILP = 0
     	IFN = 1
     	IFP = 0
     	JSK = 0
     	XANG = 0.0
     	YANG = 0.0
     	XCTH = 1.0
     	XSTH = 0.0
     	YCTH = 1.0
     	YSTH = 0.0
     	XORS = 0.0
     	YORS = 0.0
     	CALL IFDRAW(0.0,0.0,3)	!MOVE TO THE ORIGIN
     	RETURN
     	END

