Trailing-Edge - PDP-10 Archives - steco_19840320_1er_E35 - 10,5676/teco/macros/clerk.tco
There is 1 other file named clerk.tco in the archive. Click here to see a list.
!;CLERK -- Generates repeated blocks of text				!
!;Author: Clive B. Dawson -- Univ. of Texas at Austin			!

	3EO			!;Set EO level!
	HK 1ET HXz		!;Initialize!
	13I$ 10I$ HXf		!;Put a crlf in Qf!
!BEGA!	0U2			!;Q2 is our dispatch counter!
	^O33U9			!;Q9 will contain input delimiter!
				!;Starts off as altmode!
	Qf= ^AInsert the text:^A Qf=	!;Type message!
!GET!	^TU1$			!;Read a char and put it in Q1!
!BEG1!	Q1-127"E ."N R T D'OGET$'		!;Process rubouts!
	Q1-8"E ."N R D I $ 8I$ 2R T 2D' OGET$'	!;Process backspaces!
	Q1-21"E Qf= 0L K OGET$'		!;Process ^U to wipe out current line!
	Q1-7"E ^TU5 Q5-32"E Qf= 0T OGET$'
	   Q5-7"E OBEG$'
	   Q1I$ Q5U1 OBEG1$'		!;Above processes ^G space, ^G^G!
	Q1-18"E ^TU1 Q1I$ OGET$'	!;Process quoted characters (^R)!
	Q1-Q9"N			!;Is it the delimiting character??!
	   Q1I$OGET$'			!;No, insert and loop!
	Q9-13"E^T'			!;If delimiter was a CR, flush the LF!
	13U9			!;After the first time, delimiter will be CR!
	Q2-1"E OLL$'		!;If Q2 is 1, go ask for upper lim!
	Q2-2"E OUU$'		!;If Q2 is 2, go process the iterations!
	Q2-3"E OOUT$'		!;If Q2 is 3, go output the file!
	ZJ ."E OEND$' HXA HK	!;Must be 0, so put away the text!
!AGAIN!	Qf= ^ALower bound: ^A J 1U2 HK OGET$	!;Go get lower bound!
!LL!	J \\UL HK		!;Put it away in Q-reg L!
	QL"E OBEGA$'		!;If its 0, we are done!
	Qf= ^AUpper bound: ^A J 2U2 HK OGET$	!;Now go get upper bound!
!UU!	Qf=
	J \\UU HK		!;Put it away in Q-reg U!
	QLU1 Q1-QU"G OAGAIN$'	!;If lower > upper, we're done!
	GZ			!;Get total of what we have so far!
	<S%%%$; -3D Q1\\>	!;Get a copy of the text and substitute!
	%1-QU"G HXZ OAGAIN$'	!;See if we're done!
!END!	Qf= ^AFile name: ^A 3U2 HK 13U9 OGET$	!;Get output file name!
!OUT!	J IEW$ ZJ @I/$/
	HXB MB HK GZ EX		!;Set up the ew and exit!