Google
 

Trailing-Edge - PDP-10 Archives - tops10_integ_tools_v4_10jan-86 - 70,6067/dumpr2/bigpro.for
There are no other files named bigpro.for in the archive.
1       SUBROUTINE PROCESS(BUFFER,HEADER)
C
C	This subroutine will process a record of data
C	that has been read from the Magtape.  BUFFER
C	holds the 'raw' data from the tape.  HEADER has
C	the header information already decoded by the
C	GO_COMMAND as per the BLKTYP information.
C
C	Parameter list description:
C
C	BUFFER -- Raw data as read from the magtape
C	HEADER -- Converted DEC 10/20 header record
C
	INTEGER*4 BUFLEN
	PARAMETER (BUFLEN=2720)
	BYTE BUFFER(BUFLEN)
	INTEGER*4 HEADER(2,32)
C
	INCLUDE 'DMPCOM.FOR/NOLIST'
	INCLUDE 'DMPHEAD.FOR/NOLIST'
C
C	FILEDATA -- Converted DEC 10/20 file information
C	LENDATA  -- Length of the file information
C
	INTEGER*4 FILEDATA(2,512)
	INTEGER*4 LENDATA
C
	CALL PREPROC(BUFFER,HEADER)
	IF (FILEOK) THEN
	 LENDATA = HEADER(1,G$SIZ)
	 IF (LENDATA.EQ.0) RETURN
	 IF (BLKTYP.EQ.STDBLK) THEN
	  CALL CVT36(BUFFER(161+5*HEADER(1,G$LND)),FILEDATA,LENDATA)
	 ELSE
	  CALL CVT72(BUFFER(145+9*(HEADER(1,G$LND)/2)),FILEDATA,LENDATA)
	 ENDIF
	 CALL DATAPROC(FILEDATA,HEADER)
	ENDIF
	CALL POSTPROC(BUFFER,HEADER)
	RETURN
	END
	SUBROUTINE PREPROC(BUFFER,HEADER)
C
C	This segment will do the pre-processing that is necessary
C	to handle a block from the tape.  This includes the
C	examination of the filename, opening the output file, and
C	setting program status codes to indicate the progress of
C	the job.
C
C	Parameter list description:
C
C	BUFFER -- Raw data from tape
C	HEADER -- Header information after conversion
C
	INTEGER*4 BUFLEN
	PARAMETER (BUFLEN=2720)
	BYTE BUFFER(BUFLEN)
	INTEGER*4 HEADER(2,32)
C
	INCLUDE 'DMPCOM.FOR/NOLIST'
	INCLUDE 'DMPHEAD.FOR/NOLIST'
C
C	FILESPEC -- DEC 10/20 File specification
C	FSLEN    -- Length of FILESPEC used
C	LND      -- Corrected value of length
C
	CHARACTER*256 FILESPEC
	INTEGER*4 FSLEN
	INTEGER*4 LND
C
	LND = HEADER(1,G$LND) .AND. '3FFFF'X
	IF (LND.NE.0) THEN
	 CALL OVERHEAD(BUFFER,LND,FILESPEC,FSLEN)
	ENDIF
	IF (IAND(HEADER(2,G$FLAG),GF$SOF).NE.0) THEN
	 CALL VALIDATE(FILESPEC,FSLEN)
	ENDIF
	RETURN
	END
	SUBROUTINE POSTPROC(BUFFER,HEADER)
C
C	This segment will do the post-processing of the data
C	buffer.  If the end of file has been reached for a
C	file, the output file is closed, and the status indicating
C	an open file is reset.
C
C	Parameter list description:
C
C	BUFFER -- Raw data from the DEC 10/20 magtape
C	HEADER -- Header information after conversion
C
	INTEGER*4 BUFLEN
	PARAMETER (BUFLEN=2720)
	BYTE BUFFER(BUFLEN)
	INTEGER*4 HEADER(2,32)
C
	INCLUDE 'DMPCOM.FOR/NOLIST'
	INCLUDE 'DMPHEAD.FOR/NOLIST'
C
	IF (IAND(HEADER(2,G$FLAG),GF$EOF).NE.0) THEN
	 CLOSE(UNIT=1)
	ENDIF
	RETURN
	END
	SUBROUTINE DATAPROC(FILEDATA,HEADER)
C
C	The maximum output line size.
C	500 is the maximum line length SOS will support.
C
	PARAMETER LINE_BUFSIZE=65535
C
C	This segment takes the converted DEC 10/20 information
C	from the FILEDATA and HEADER areas and converts it
C	into the form to be used by the VAX.  If the file is
C	being processed in BINARY mode, each 36 bit DEC 10/20
C	word is copied into 5 bytes.  If the file is being
C	processed in ASCII mode, each 7 bit byte is extracted
C	from the DEC-10 word and put into a byte for output.
C
C	Parameter list description:
C
C	FILEDATA -- The converted file information
C	HEADER -- The converted file header
C
	INTEGER*4 FILEDATA(2,512),HEADER(2,32)
C
	INCLUDE 'DMPCOM.FOR/NOLIST'
	INCLUDE 'DMPHEAD.FOR/NOLIST'
C
C	OUTBUF -- the output buffer for the file data
C	OUTLEN -- the length of output data
C
	BYTE OUTBUF(2560)
	BYTE LINEBUF(LINE_BUFSIZE)

	INTEGER*2 BUFPOINT			!BYU
	INTEGER*4 OUTLEN
C
	OUTLEN = 5*HEADER(1,G$SIZ)
	IF (IOMODE.EQ.BINARY) THEN
	 CALL COPY5(FILEDATA,OUTBUF,HEADER(1,G$SIZ))
	 WRITE(1,100) (OUTBUF(I),I=1,OUTLEN)
100	FORMAT(4(640(A1,:),/))
	ELSE
	 CALL COPYASC(FILEDATA,OUTBUF,HEADER(1,G$SIZ))
C BYU
C	The below changed to a special line-buffer routine which follows.
C
C        WRITE(1,110) (OUTBUF(I),I=1,OUTLEN)
C110	FORMAT(40(64(A1,:),/))
C
	 DO I=1,OUTLEN
	    BUFPOINT=BUFPOINT+1
	    IF(OUTBUF(I).EQ.0)THEN		!Ignore nulls
		BUFPOINT=BUFPOINT-1
	    ELSE
	        LINEBUF(BUFPOINT)=OUTBUF(I)
	        IF(BUFPOINT.GE.LINE_BUFSIZE)THEN
		    CALL PUTLINE(LINEBUF,BUFPOINT,LINE_BUFSIZE)
		    TYPE*,'%Input line longer than',LINE_BUFSIZE,
	1 	    ' characters.  Advancing to new output line.'
	        ELSE
	            IF(OUTBUF(I).GE.'12'O.AND.OUTBUF(I).LE.'14'O)
	1    	        CALL PUTLINE(LINEBUF,BUFPOINT,LINE_BUFSIZE)
		ENDIF
	    ENDIF
         ENDDO
	ENDIF
	RETURN
	END

	SUBROUTINE PUTLINE(LINEBUF,BUFPOINT,LINE_BUFSIZE)
C BYU
C	Called by above only.
C	Put a line to the output file.
C	Entry is upon vertical motion.
C	Lines ending with CRLF are not output with imbedded CRLF.
C
	BYTE LINEBUF(LINE_BUFSIZE)
	INTEGER*2 BUFPOINT

D       type*,'bufpoint=',bufpoint
	IF(LINEBUF(BUFPOINT).EQ.'12'O)THEN
	    IF(BUFPOINT.GE.2.AND.LINEBUF(BUFPOINT-1).EQ.'15'O)THEN
		IF(BUFPOINT.EQ.2)THEN
	      	    WRITE(1,10)
10		    FORMAT()
		ELSE
		    WRITE(1,11)(LINEBUF(I),I=1,BUFPOINT-2)
11		    FORMAT(<BUFPOINT-2>A/)
		ENDIF
		GOTO 100
	    ENDIF
	ENDIF
	WRITE(1,11)(LINEBUF(I),I=1,BUFPOINT)
100	BUFPOINT=0

	RETURN
	END