Trailing-Edge - PDP-10 Archives - steco_19840320_1er_E35 - 10,5676/teco/macros/newhlp.tco
There is 1 other file named newhlp.tco in the archive. Click here to see a list.
!; TECO ON-LINE HELP SYSTEM -- Last Revised: March, 1979 !
!; Author: Clive B. Dawson  -- Univ. of Texas at Austin !
!; Editor: James C. Simpson -- National Security Agency !
!; This TECO macro does keyword searches in TECHLP.TXT !

	[a[b[c[d[e[f[g[h[i[j[k[z	!;Save Q-registers!
	EOUj 				!;Save current EO level!
	0UK				!; Assume not video mode !
	0EO	EO-4+1"G		!; Check if we might have video mode !
		EVMODE$Uk		!; Save current state of display !
		EVOFF$'			!; And turn off the display !
	QjEO				!; Set EO level to not complain about args !
!; Now do the set up and initial prompt !
	^AHelp is on the way!
^A					!; Make sure user realizes this may take a little while !
	ETUh 1ET			!;Save ET, set to literal typeout!
	^XUi 0^X			!;Save ^X, set to either case!
	E?CURRENT-TEXT-BUFFER$Ua	!; Save current text buffer name !
}Uf					!; Put a CRLF in f for typeout !
	EP(g)TED:TECHLP.TXT/NODEFAULT/MODE:DUMP$ !; Get the help file !
	E.(^A^Atemp_buffer)		!; Use a temp text buffer for this !
	EIted:getnam.tec/nodefault$	!; Get the user's name into Q-reg 0 !
	ZJ:-S^N $			!; Find last non-blank character !
	$^AHi, ^A			!; Start the typeout !
	HTHK				!; Type the name and kill it !
	^A...Type HELP<esc> for basic help.^AQf= !; Type the rest of the initial greeting !
!PRMPT!	E.(^A^Atemp_buffer)HKQF=^A-^A	!; Set up the prompt !
!GETCH!	FI(^A^Atemp_buffer)SINGLE-CHARACTER$UC	!; Get a character !
	QC,{$}"EQf=			!; Is this an escape? !
		OGOTIT$'		!; And go process the command !
	QC,{			!; Is it a CR? !
		^T$			!; Yes, eat the line feed !
		OGOTIT$'		!; And go find the text !
	OGETCH$				!; Otherwise, get another character !
!GOTIT!				!; Here when we have the string, convert to correct form !
	ZJ-D				!; Delete the delimeter !
	Z"EOEND$'			!; If null string, quit now !
	J				!; Go to top !
	Z<1A-^O34"L			!; Control character? !
		I^$1A+^O100I$DR'C>	!; Convert to ^character form !
	QC,{$}"EJI^R^R^R^A$'		!; Delimit escape command with ^A !
	E.(g)J				!; Put in buffer with help text !
	0Ue				!; Flag nothing found yet !
!SERCH!	:S^G(^A^Atemp_buffer)$"U OFAIL$' !;Search for string!
	1A-3"E .,ZT OPRMPT$'		!;If followed by ^C, type rest of text!
	1A-4"E .Ud 			!;If followed by ^D, type up to a ^C!
	       :S^R^C$"U ZJ' L
	       Qd,.T OPRMPT$
	:-S^R^E$"U 0L' .Ud 		!;Search back to ^E!
	1A-2"E L OSERCH$'		!;Ignore match if ^B at start of line!
	:S^R^B$"U' L Qd,.T 1Ue		!;Type up to ^B, and set flag!
	OSERCH$				!;Keep searching!

!FAIL!	Qe"N OPRMPT$'			!;If a match was found, ok!
	^ASorry.  I cannot find help for ^A !;Tell user we found nothing!
	Q(^A^Atemp_buffer)= Qf= OPRMPT$	!;And start again!
!END!	E.(^Ga) 0U(^A^Atemp_buffer)	!; Reset buffer text buffer !
	QhET				!; Reset type out mode !
	Qi^XQjEO			!; And search mode and EO level !
	Qk"N	EVON$'			!; If video was on, turn it back on !
	]z]k]j]i]h]g]f]e]d]c]b]a	!;Restore Q-regs!
	0U* -1EC			!;Clear Q* and reduce core!