Google
 

Trailing-Edge - PDP-10 Archives - LCG_Integration_Tools_Clearinghouse_T20_v7_30Apr86 - tools/tvaxv2/tvmain.mar
There are 7 other files named tvmain.mar in the archive. Click here to see a list.
	.TITLE	TVMAIN - TV MAIN PROGRAM
; 25-Mar-82
;	Enhancements:
;		1.	:K command.
;		2.	[n];T command, to translate, either n lines,
;			or whole buffer from lower to uppercase.
;
;	Corrections:
;		1.	Displaying a line, with a length of exactly 80
;			positions, caused sending wrong information
;			to the screen.
;
; 29-Mar-82
;	Corrections:
;		1.	;T is now ;Z.
;		2.	Inserting of a string in one of the Q-registers,
;			interferes into the contents of the other Q-regs.
;
; 1-Apr-82
;	Corrections:
;		1.	@I/XXX/ did not work.
;
; 4-May-82
;	Corrections:
;		1.	While reading input file, don't delete
;			"pagemark/formfeed".
;		2.	Displaying a line of 80 characters, with pointer at
;			end of line, caused errors on screen.
;		3.	Explicit error-messages, when backup file cannot
;			be opened.
;		4.	Initialisation end file buffer.
;
; 3-Jun-82
;	Correction:
;		1.	If "HOLE" is located at end of buffer, it is brought
;			back to 8k, to prevent it from growing too large.
;
; 28-Oct-82
;	Corrections:
;		1.	Initial ;Y of non-existing file, followed by <ESC>,
;			caused dump.
;		2.	;Y with existing buffer, caused display 1 line
;			too high, sometimes.
;		3.	% command sometimes resulted in a dump.
;		4.	n,mX wanted <ESC>, prior to next command.
;
;	Improvements:
;		1.	@S and @R, improved error-messages, if no search
;			argument is specified.
;		2.	S and R commands use, either exact match (default),
;			or upper and lower case match (after ^X).
;		3.	With file-name commands after <ESC>, any character
;			can be specified, only action with ^G or <CR>.
;
; 1-Nov-82
;	Improvements:
;		1.	Calls for OAP statistics.
;		2.	Better possibilities when running under terminal
;			control, command processor and batch.
;		3.	If input not from terminal, end of command is not seen
;			as end of record, but scanning till 2 * <ESC> will
;			be performed.
;		4.	If running under batch:
;				- no screen output
;				- logging from input
;				- logging of output errors
;		5.	If writing to output file is not correct, the
;			incomplete version will be deleted by TV.
;
; 9-Nov-82
;	Corrections:
;		1.	Initial ;Y command, was written to TVBACK-file
;			without <ESC> <ESC>.
;
; 29-Nov-82
;	Enhancements:
;		1.	;P command.
;		2.	. (octal) values for TV input commands.
;		3.	Don't build screen again with ;X, ;U and ;S.
;		4.	Q-registers can be specified, using lowercase.
;		5.	Don't generate output to screen, if input from
;			command processor.
;
; 23-Dec-82
;	Corrections:
;		1.	;E and input from a file conflicts.
;		2.	0 or -* executing of <>, does not work correctly
;			(always goes one time).
;		3.	Lowercase @i, etc., did not work.
;
; 17-Jan-83
;	Corrections:
;		1.	Test for batch, cmd proc or terminal, did not work
;			with VMS V3, used some other trick.
;
; 3-Feb-83
;	Improvement:
;		1.	Execute FLUSH in GTVR08, after input of min. 15 char.
;			from tv-backup file.
;
; 31-Mar-83
;	Enhancement:
;		1.	;V for translation from uppercase to lowercase.
;
; 7-Oct-83
;	Correction:
;		1.	nA command gives value for next command.
;
;	Enhancements:
;		1.	^G to terminate commands.
;		2.	nMq also implemented.
;		3.	;Y will also read remainder of file, if file too big.
;		4.	Y added = HK + ;Y.
;		5.	;A command replaces spaces by tabs, and deletes
;			trailing spaces.
;
; 27-Dec-83
;	Correction/Improvement:
;		1.	Routine GEXTHOLR does not work for > 64K.
;		2.	Output to terminal with IO$M_NOFORMAT.
;
; 24-Jan-84
;	Enhancement:
;		1.	TV can also handle VT100
;				- table with terminal dependent char. in TVMAIN
;				- GTVR01 and GTVR02 special moves
;				- only for HP, display of non-printable char.
;
; 7-Feb-84
;	Correction:
;		1.	With ';U' and 'Y' command, HOLE is set back to 8k,
;			by which 'Y and ';Y' can use the whole buffer again.
;
; 29-Feb-84
;	Correction:
;		1.	If HOLE is larger than 64K, shift forward does not
;			work correctly.
;		2.	Special linefunctions ;A ;V and ;V don't stop at end
;			of buffer when number of lines are specified.
;
	.page
	.MACRO	MOVSP	P1
	MOVL	GTTAB,R1
	MOVL	P1*4(R1),R1
	MOVC3	(R1),2(R1),(R8)
	MOVL	R3,R8
	.ENDM
	INITG	TVMAIN			;CHANGED GTVM01 INTO TVMAIN
	CALLS	#0,RRPRFB		;OAP INIT
	$OPEN	FAB=SIN_FAB
	IF.	*ERROR			;BATCH TASK
		BISB2	#GX2COM,GSTAT2
		$OPEN	FAB=GIN_FAB
	ELSE.
		$GETDVI_S ,SIN_FAB+FAB$L_STV,,WDLIST
		BITL	#TT2$M_DECCRT,WDEVDEP2
		IF.	*OFF		;NOT VT100 COMPATIBLE
			MOVAB	GHP2621,GTTAB
			BISB2	#GXHP,GSTAT2
		ENDIF.
		BISB2	#GX2TER,GSTAT2
		$OPEN	FAB=GIN_FAB
		ON_ERROR	GRERR
		CMPB	#02,GIN_FAB+FAB$B_RAT
		IF.	*EQ		;COMMAND PROC
			BISB2	#GX2COM,GSTAT2
		ENDIF.
	ENDIF.
	BITB	#GX2COM,GSTAT2
	IF.	*ON
		$CONNECT RAB=GIN_RAB
		$CREATE	FAB=GOUT_FAB
		ON_ERROR GRERR
		$CONNECT RAB=GOUT_RAB
	ENDIF.
	MOVL	#GBUFS+GBUFS+28,R1
	$EXPREG_S R1,WRET
	ON_ERROR GRERR
	MOVL	WRET,R1
	MOVL	R1,GOBUFFA
	ADDL2	#2048,R1
	MOVL	R1,GIBUFFA		;2K INPUT BUFFER
	ADDL2	#2048,R1
	MOVL	R1,GEBUFFA		;2K EXEC FILE BUFFER
	ADDL2	#2048,R1
	MOVL	R1,GIBUF2A		;SECOND 2K INPUT BUFFER
	ADDL2	#2048,R1
	MOVL	R1,GSBUFFA		;SCREEN BUFFER
	ADDL2	#2048,R1
	MOVL	R1,GIBUF3A		;BUFFER FOR GTVR09
	ADDL2	#2048,R1
	MOVL	R1,GIBUF4A		;ANOTHER BUFFER FOR GTVR09
	ADDL2	#2048,R1
	MOVL	R1,GQBUFFA		;Q-REG BUFFER
	ADDL2	#GBUFS*512,R1
	MOVL	R1,GFBUFFA		;2500K FILE BUFFER
	BSBW	GTVR08O			;OPEN LOGFILE
	CALLS	#0,GTVR03I		;READ INPUT FILE IF ON COMMAND LINE
L1:	CALLS	#0,GTVR02
	CLRL	R0			;FUNCTION 0
	MOVL	GIBUF2A,R1		;ADDR INPUT BUFFER
	CALLS	#0,GTVR01		;READ
	TSTW	R0
	IF.	*EQ			;NO INPUT
		BRW	L1
	ENDIF.
	MOVL	GIBUFFA,R2
	MOVL	GIBUF2A,GIBUFFA		;SWAP BUFFERS
	MOVL	R2,GIBUF2A
	MOVW	GI1LL,GI2LL		;SAVE PREVIOUS INPUT LENGTH
	MOVW	R0,GI1LL
	MOVL	GIBUFFA,R1		;SET ADDR INPUT
	BSBW	GTVR08WE		;WRITE COMMAND TO LOGFILE
	CALLS	#0,GTVR04		;PARSE INPUT COMMANDS + EXECUTE
	BRW	L1
GEXIT::					;STOP TV
	BSBW	GTVR08C			;CLOSE LOGFILE
	MOVL	GOBUFFA,R8
	MOVSP	0
	MOVSP	1			;CLEAR
	SUBL3	GOBUFFA,R3,R1
	BSBW	GWRITR			;DO IT
	BITB	#GX2TER,GSTAT2
	IF.	*OFF
		$CLOSE	FAB=GOUT_FAB
	ENDIF.
	PUSHL	L20
	CALLS	#1,RRPRFE		;CLOSE OFF OAP
	$EXIT_S
L20:	.LONG	20			;TV OAP STATISTICS ACCUMULATION
;
;	OUTPUT ONLY TO THE TERMINAL
;
GWRITR::
	BITB	#GX2COM,GSTAT2
	IF.	*OFF			;ON TERMINAL
		$QIOW_S	CHAN=SIN_FAB+FAB$L_STV,FUNC=#IO$_WRITEVBLK+IO$M_NOFORMAT,-
			P1=@GOBUFFA,P2=R1
		ON_ERROR GRERR
	ENDIF.
	RSB
;
;	OUTPUT IN BATCH
;	IN	R0 = LL
;		R1 = ADDR
;
GWRITR2::
	BITB	#GX2TER,GSTAT2
	IF.	*OFF			;NOT ON TERMINAL
		MOVL	R1,GOUT_RAB+RAB$L_RBF
		MOVW	R0,GOUT_RAB+RAB$W_RSZ
		$PUT	RAB=GOUT_RAB
		ON_ERROR GRERR
	ENDIF.
	RSB
;
GRERR::	$EXIT_S R0
	.PAGE
	.PSECT	DATAW,NOSHR,WRT,LONG
GBUFS==1000
WRET:	.BLKL	2
SYSINPX:	.LONG	9,.+4
	.ASCII	/SYS$INPUT/
SYSOUTX:	.LONG	10,.+4
	.ASCII	/SYS$OUTPUT/
LOGNX:	.LONG	10,LOGNT
LOGNT:	.BLKB	10
WTT:	.ASCII	/_T/
;
;	GLOBAL PARAMETERS
;
GERRN::	.WORD	0			;ERROR NUMBER
GI1LL::	.BLKW				;LENGTH INPUT IN FIRST BUFFER
GI2LL::	.BLKW				;LENGTH INPUT IN SECOND BUFFER
	.ALIGN	LONG
GIBUFFA:: .BLKL				;TERMINAL INPUT BUFFER ADDR
GIBUF2A:: .BLKL				;SECOND TERMINAL INPUT BUFFER
GOBUFFA:: .BLKL				;TERMINAL OUTPUT BUFFER ADDR
GOPTR::	.LONG	0			;START BYTE NR IN BUFFER FOR OUTPUT
GSBUFFA:: .BLKL				;SCREEN BUFFER ADDR (20*80)
GQBUFFA:: .BLKL				;Q-REGISTER BUFFER ADDR
GIBUF3A:: .BLKL				;INPUT BUFFER NON TERMINAL INPUT
GIBUF4A::	.BLKL
GEBUFFA::	.BLKL			;EXEC FILE BUFFER
GFBUFFA:: .BLKL				;FILE BUFFER ADDR
GFPTR::	.LONG	0			;CURRENT BUFFER PTR, REL BYTE NR FROM 0
GMIDPTR:: .LONG	0			;PTR TO MIDDLE OF LAST DISPLAYED WINDOW
GFCNT::	.LONG	0			;NR OF BYTES IN BUFFER
GHPTR::	.LONG	0			;START BYTE NR OF HOLE IN BUFFER
GHCNT::	.LONG	8192			;NR OF BYTES IN HOLE
GSTAT::	.BYTE	GXCTLL
GXCTLL==^X80				;^L DONE
GXVAL==^X40				;EXPRESSION BEFORE COMMAND PRESENT
GXMORE==^X20				;NEXT PAGE TO BE DISPLAYED
GXRNG==^X10				;RANGE PRESENT BIT
GXIN1==^X08				;ONE BYTE INPUT COMMAND PRESENT
GXSRCH1==^X04				; SPECIAL : SEARCH
GXEXEC==^X02				;   ;E ACTIVE
GXTERM==^X01				;CANCEL COMMAND EXECUTION
GSTAT2::	.BYTE	0
GX2SRC==^X80				;IF ON UPPER/LOWER MATCH
GX2TER==^X40				;INPUT FROM TERMINAL
GX2COM==^X20				;INPUT FROM @COMMAND
GXHP==^X10				;HP-2621 TERMINAL
GEXP1::	.LONG	0			;RESULT OF EXPRESSION EVALUATION
GEXP2::	.LONG				;RESULT OF EXP EVALUATION
GTTAB::	.ADDRESS	GVT100		;DEFAULT
GNONDIS::	.BYTE	24		;NON DISPLAY CHARACTER (BLACK BOX)
GSCT::					;SCAN TABLE
;	1 = CR,HT END OF BUFFER  SCAN
;	2 = NUMERIC STRING SCAN
;	4 = DISPLAY ON SCAN
;	8 = ;SPACE SCAN
	.REPEAT	32
	.BYTE	4			;ALL SPECIAL CHAR
	.ENDR
.=GSCT+13				;CR
	.BYTE	4
.=GSCT+9				;HT
	.BYTE	5
.=GSCT+^A'0'
	.REPEAT	10
	.BYTE	2
	.ENDR				;ASCII  0-9
.=GSCT+^A'I'
	.BYTE	8			;SKIP >
.=GSCT+^A'R'
	.BYTE	8
.=GSCT+^A'S'
	.BYTE	8
.=GSCT+^A'<'
	.BYTE	8
.=GSCT+^A'>'
	.BYTE	8
.=GSCT+^A';'
	.BYTE	8
.=GSCT+128
	.BYTE	1			;SPECIAL END OF LINE
.=GSCT+255
	.BYTE	1			;END OF BUFFER
.=GSCT+256
G64K::	.WORD	-1,0			;64K-1
GCRX==128				;END OF LINE
	.ALIGN	LONG
SIN_FAB:: $FAB	FNM=<TT:>,FOP=UFO
GIN_FAB:: $FAB	FNM=<SYS$INPUT>,FAC=<GET>,MRS=2048
GIN_RAB:: $RAB	FAB=GIN_FAB
GOUT_FAB:: $FAB	FNM=<SYS$OUTPUT>,FAC=<PUT>,MRS=2048,RFM=VAR,RAT=CR,BLS=2048
GOUT_RAB:: $RAB	FAB=GOUT_FAB
	$DVIDEF
	$TT2DEF
WDLIST:	.WORD	4,DVI$_DEVDEPEND2
	.ADDRESS WDEVDEP2
	.LONG	0,0
WDEVDEP2:	.BLKL
WCHKB:	.BLKB
	.PAGE
;	VIA ADDRESS TABEL PER FUNCTIE EEN ENTRIE HL2,CLN
;
;	FUNCTIE:	0 - HOME
;			1 - CLEAR SCREEN
;			2 - ERASE TO END OF LINE
;			3 - CURSOR RIGHT 1 POS
;			4 - CURSOR UP
;			5 - SCROLL UP
;
GHP2621:	.ADDRESS	HP0,HP1,HP2,HP3,HP4,HP5
GVT100:	.ADDRESS	VT0,VT1,VT2,VT3,VT4,VT5
HP0:	.WORD	2
	.BYTE	27,^A'H'
HP1:	.WORD	2
	.BYTE	27,^A'J'
HP2:	.WORD	2
	.BYTE	27,^A'K'
HP3:	.WORD	2
	.BYTE	27,^A'C'
HP4:	.WORD	2
	.BYTE	27,^A'A'
HP5:	.WORD	2
	.BYTE	27,^A'T'
;
;
VT0:	.WORD	3
	.BYTE	27,^A'[',^A'H'
VT1:	.WORD	3
	.BYTE	27,^A'[',^A'J'
VT2:	.WORD	3
	.BYTE	27,^A'[',^A'K'
VT3:	.WORD	3
	.BYTE	27,^A'[',^A'C'
VT4:	.WORD	3
	.BYTE	27,^A'[',^A'A'
VT5:	.WORD	3
	.BYTE	27,^A'[',^A'A'
	.END	TVMAIN			;CHANGED GTVM01 INTO TVMAIN