	program prtslides
C
C	PROGRAM TO print SLIDES 
C	MODELED AFTER A PROGRAM THAT WAS SEEN ON A COMPUTER AT DECUS
C
C	WRITTEN BY ART MCCLINTON 
C		MITRE CORPORATION
C		1820 DOLLEY MADISON BLVD
C		MCLEAN VA 22102
C		(703) 827-6356
C
C	Commands for SLIDE generation program:
C
C   (all commands preceded by command character (.); multiple commands may
C    appear on one line by appending them, ie:  .c.r.d)
C
C	C 		Clear screen
C 	P 		Clear screen (page) set center mode
C	N 		Normal video screen
C	R 		Reverse video screen
C	H 		Double size line
C	W 		Double wide line (default)
C	L 		Standard size line
C	S 		Synch for photograph (Wait until user types a terminator)
C	$ 		Write sequence of escape sequences (.$[7m$[0m for example)
C	    			Whole line is escape sequences with $ replacing esc
C	Y 		Center following lines
C	X 		Do not center following lines
C	A 		Process the file again forever
C
C	;	 can be used to insert comment lines.
C	
C
C	FUTURE PLANS FOR THIS PROGRAM
C	prompt for name of file and or get off of command line
c	Add BOLD and NO BOLD command
c	Add VT125 REGIS commands
c	Watch your future DECUS Sigtapes
c
	LOGICAL CENTER
	character*20 filename,ofilename
	BYTE LINE(80),LINE_SIZE,esc,BLANK
	data esc/"033/,BLANK/1H /
	write (6,97) 'Input'
97	format('+Enter ',a,' Filename:'$)
	read (5,98) filename
98	format(a20) 
	write (6,97) 'Output'
	read (5,98) Ofilename
	OPEN (UNIT=1,NAME=filename,STATUS='OLD')
	OPEN (UNIT=7,NAME=ofilename,STATUS='new')
100	READ(1,101,END=999) LEN,(LINE(I),I=1,LEN)
101	FORMAT(Q,80A1)
	IF(LEN.LE.0) THEN
	  LEN=0
	  LINE(1)=BLANK
	ENDIF
110	if(LINE(1).EQ.';') GO TO 100
	IF(LINE(1).NE.'.') GO TO 500
	IF(LINE(2).NE.'C'.AND.LINE(2).NE.'c') GO TO 130		!CLEAR SCREEN
115		CONTINUE
		DO 120 I=3,LEN		!	check for other commands
120		LINE(I-2)=LINE(I)
		LEN=LEN-2
		IF (LEN.LE.0) GO TO 100
		GO TO 110
130	IF(LINE(2).NE.'A'.AND.LINE(2).NE.'a') GO TO 140		!REPROCESS FILE
		GO TO 100
140	IF(LINE(2).NE.'X'.AND.LINE(2).NE.'x') GO TO 150
		CENTER=.FALSE.				!DO NOT CENTER LINES
		GO TO 115
150	IF(LINE(2).NE.'Y'.AND.LINE(2).NE.'y') GO TO 160
		CENTER=.TRUE.				!CENTER
		GO TO 115
160	IF(LINE(2).NE.'P'.AND.LINE(2).NE.'p') GO TO 170
		CENTER=.TRUE.
		GO TO 115
170	IF(LINE(2).NE.'H'.AND.LINE(2).NE.'h') GO TO 180
		LINE_SIZE=3
		GO TO 115
180	IF(LINE(2).NE.'W'.AND.LINE(2).NE.'w') GO TO 190
		LINE_SIZE=6
		GO TO 115
190	IF(LINE(2).NE.'L'.AND.LINE(2).NE.'l') GO TO 200
		LINE_SIZE=5
		GO TO 115
200	IF(LINE(2).NE.'S'.AND.LINE(2).NE.'s') GO TO 210
	WRITE(6,201) 
	WRITE(7,201) 
201	format(/,x,38(1h-),/)
		GO TO 115
210	IF(LINE(2).NE.'$') GO TO 220
		WRITE (6,212) esc,(LINE(I),I=3,LEN)
		WRITE (7,212) esc,(LINE(I),I=3,LEN)
212		FORMAT(' ',80A1)
		GO TO 100
220	IF(LINE(2).NE.'R'.AND.LINE(2).NE.'r') go to 230
		go to 115
230	IF(LINE(2).NE.'N'.AND.LINE(2).NE.'n') go to 240
		go to 115
240	IF(LINE(2).eq.'U'.or.line(2).eq.'u') go to 115
	IF(LINE(2).eq.'V'.or.line(2).eq.'v') go to 115
	WRITE(6,241) LINE(2)
241	FORMAT(' COMMAND NOT IMPLEMENTED IN THIS VERSION - ',A1)
		GO TO 115
500	NULL=0
	MAX_LEN=40
	IF(LINE_SIZE.EQ.5) MAX_LEN=80
	IF(CENTER) NULL=(MAX_LEN- Min(MAX_LEN,LEN) )/2
	len = min(MAX_LEN,LEN)
	if(line_size.ne.3) then
	  WRITE(6,501) (BLANK,I=1,NULL),(LINE(I),I=1,LEN)
	  WRITE(7,501) (BLANK,I=1,NULL),(LINE(I),I=1,LEN)
501	  FORMAT(' ',80A1)
	else
	  WRITE(6,502) esc,(line(i),i=1,len),esc 
	  WRITE(7,502) esc,(line(i),i=1,len),esc 
502	  format(' ',<null>X,A1,'[4m',<LEN>A1,A1,'[m')
	endif
	GO TO 100
999	STOP 'END OF SLIDES'
	END
