Google
 

Trailing-Edge - PDP-10 Archives - steco_19840320_1er_E35 - 10,5676/teco/macros/teco.tco
There are 5 other files named teco.tco in the archive. Click here to see a list.
!; Q-registers that contain macros:					!
!;									!
!;	C	- Cause the file to be exited that is displayed in	!
!;		  lower half of the screen (in Q-reg "..")		!
!;									!
!;	E	- Append to the current editing buffer until a FF	!
!;									!
!;	H	- Toggle smaller COMMAND-BUFFER to a bigger		!
!;		  on.							!
!;									!
!;	L	- Count the number of lines from the beginning of the	!
!;		  editing buffer. From LINE.TEC.			!
!;									!
!;	S	- Toggle split screen ("." on top, ".." on bottom)	!
!;									!
!;	T	- Type from the previous form feed to the next.		!
!;		  From HT.TEC						!
!;									!
!;	U	- Toggle current editing buffer between "." and ".."	!
!;									!
!;	W	- Go into wide mode.  VT100 132 wide.			!
!;									!
!;	Y	- Cause the file to be completely read into core	!
!;		  This is from HA.TEC.					!
!;									!
!;	AUTO-BUFFER - Clear out the ERROR-TEXT Q-register every		!
!;		  3 commands.  This is only when it is displayed	!
!;									!
!; Q-registers that are numeric flags					!
!;									!
!;	SML-FLAG - Large vs. small command buffer area.			!
!;									!
!;	SPLIT-FLAG - Two buffers displayed vs. one.  If one buffer	!
!;		  then it is only (.) that is being displayed. If two	!
!;		  then it is (.) in the upper and (..) in the lower	!
!;									!
!;	UPPER	- Upper or lower screen in split screen mode		!
!;		  0 ==> Upper part of the screen			!
!;		  1 ==> Lower part of the screen			!
!;									!
!;	WIDE-FLAG - VT100 in 132 wide vs. 80 wide.			!
!;									!
!;									!
!; Set up the defaults:							!
!;									!
!;	ER	- Dump mode and .MAC extension				!
!;	EW	- Dump mode and .MAC extension				!
!;									!
:ER.MAC/MODE:DUMP/DEFAULT$	!; Default the input mode and extension !
:EW.MAC/MODE:DUMP/DEFAULT$	!; Default the output mode and extension!
:-1eu$ 1eh$		!; No case flaging and prefix error messages	!
!;									!
!;	Set up the macro in Q-register L				!
!;									!
E.(L)$@I\	!; Insert the macro !
!;This macro returns the number of the current line in the text buffer.	!
!;This number is defined as 1+(number of EOL characters to the left of	!
!;the pointer).  An EOL character is a line feed, vertical tab, or	!
!;form feed.								!
!;Note that if you go to the end of the buffer with a ZJ command, ML=	!
!;will type out the number of lines in the buffer plus 1, since you are	!
!;actually positioned at the beginning of the n+1st line.		!
[0 [1		!;save contents of q-regisiters 0 & 1!
.U1		!;store the current value of the pointer into Q-reg 1!
0U0		!;initialize Q-reg 0 (our line counter) to 0!
<		!;start a loop!
-S^R^EL;	!;search from this point backwards for an end-of-line!
		!;character.  If no more, jump out of loop!
R		!;back up over the one we just found, so we don't count!
		!;it again!
%0		!;add 1 to Q-reg 0!
>		!;loop for more!
Q1J		!;restore our pointer (now at the beginning of the file)!
		!;to its original position!
]1		!;restore the original contents of Q-reg 1!
Q0+(]0 1)	!;Return Q0+1, and restore Q0!
\		!; End of insert string !
!;									!
!;	Set up Q-register Y with its macro				!
!;									!
E.(Y)$@I\	!; Insert the macro !
+0[0 [1			!;Save possible argument and Q-regs. 0 & 1.!
.U1			!;Save pointer!
Q0"E 999999999U0'	!;If no argument, set to infinity!
Q0<^R^N"L 0;'		!;If EOF, we're done!
   ^R^E"L ZJ 12I$'	!;Insert form feed if necessary!
   A>			!;Bring in one more page and loop!
Q1J			!;Restore pointer!
]1 ]0			!;Restore Q-regs.!
\		!; End of insert string !
!;									!
!;	Set up Q-register T with its macro				!
!;									!
E.(T)$@I\		!; Insert the macro				!
	[0 [1 [2			!;Save Q-regs!
	.U0				!;Save current pointer!
	0U1				!;Init lower bound!
	:-S^R^E<14>$"L .U1 '		!;Search back for FF!
	Q0J				!;Go back to starting place!
	ZU2				!;Init upper bound!
	:S^R^E<14>$"L .-1U2 '		!;Search forward for FF!
	Q1,Q2T				!;Type the text!
	Q0J				!;Restore pointer!
	]2 ]1 ]0			!;Restore Q-regs!
\		!; End of insert string !
!;									!
!;	Set up Q-register E with its macro				!
!;									!
E.(E)$@I\		!; Insert the macro !
<			!; Start the loop !
	^R^N"N0;'	!; Break out of loop if EOF !
	^R^E0;		!; If buffer ends with form feed, break out of loop !
	A		!; Otherwise append another buffer !
>		!; End of loop !
\		!; End of insert string !
!;									!
!; Now check if we are a version of TECO new enough to have video mode	!
!; If we are, then set up the default screen areas, and the macros for	!
!; use in changing the areas.  Note that the screen macros will not	!
!; be set up unless the version of TECO supports them.			!
!;									!
EO-4+1"G		!; Is this a new enough version of TECO? !
:1,20E`$(TEXT-BUFFER)"S	!; Yes, attempt to set the screen !
	21,24E`$(COMMAND-BUFFER)!; If it worked, do the other half !
	EVON$			!; And turn on the video processing !
	'		!; End of :1,20E$(TEXT-BUFFER)"S !
!;									!
!;	Set up macro to set default screen regions			!
!;									!
E.(SET-NORMAL-SCREEN)@I|	!; Insert the macro !
1,20E`$(TEXT-BUFFER)		!; Set for 20 lines of text !
21,24E`$(COMMAND-BUFFER)	!; And 4 lines of command !
|				!; End of insert string !
!;									!
!;	Set up Q-register W with its macro				!
!;									!
E.(W)@I|		!; Insert the macro into the Q-reg !
Q(WIDE-FLAG)"E		!; If not already in 132 wide mode !
	Q(SML-FLAG)"NMH'	!; If short text buffer, switch that first !
	Q(SPLIT-FLAG)"NMS'	!; If two section screen fix that up !
	EVOFF$			!; Turn off video mode so ^A's work nice !
	EVVT132$		!; Set TECO's terminal type to wide VT-100 !
	2ET			!; Set image mode type out !
	^R^A$[?3h^R^A		!; Send the string to switch the terminal !
	0ET			!; Reset type out to normal !
	1,10E`$(TEXT-BUFFER)	!; Set up for short screen (no AVO) !
	11,14E`$(COMMAND-BUFFER)!; 10 lines of text plus 4 of command !
	EVON$			!; Turn video processing back on !
	0U(SML-FLAG)		!; Not MH'ed anymore !
	0U(SPLIT-FLAG)		!; Or split !
	'			!; End of Q(WIDE-FLAG)"E !
Q(WIDE-FLAG)"N			!; If we were wide, we must switch back !
	EVOFF$			!; Turn video back off !
	EVVT100$		!; Reset the terminal type !
	2ET			!; Set image typeout for terminal control !
	^R^A$[?3l^R^A		!; Send the string to switch back to 24 by 80 !
	0ET			!; And put back in normal typeout !
	M(SET-NORMAL-SCREEN)	!; Reset the screen !
	EVON$			!; Turn the video processing back on !
	1U(WIDE-FLAG)		!; Set the flag so it will go to zero !
	'			!; End of Q(WIDE-FLAG)"N !
-1%(WIDE-FLAG)$			!; Change the state of the flag !
|			!; End of insert string !
!;									!
!;	Set up Q-register H with its macro				!
!;									!
E.(H)@I\		!; Insert the macro into the Q-reg !
Q(WIDE-FLAG)"N MW'	!; If wide screen, make it narrow first !
Q(SML-FLAG)"E		!; Full screen currently? !
	1,1E`$(ERROR-TEXT)	!; Yes, set up ERROR-TEXT on first line !
	2,11E`$(.)		!; Q-reg "." on next 10 lines !
	12,20E`$(COMMAND-BUFFER)!; 9 lines of commands next !
	E.(..)21,24E`$(..)E.(.)	!; And four lines of ".." last !
	3U(AUTO-COUNT)		!; And make AUTO-BUFFER run every three commands !
	'		!; End of Q(SML-FLAG)"E !
Q(SML-FLAG)"N		!; If screen is already set up with large commands !
	M(SET-NORMAL-SCREEN)	!; Reset the screen !
	0U(AUTO-COUNT)	!; No more AUTO-BUFFER !
	1U(SML-FLAG)	!; Set the flag so it will go to zero !
	'	!; End of Q(SML-FLAG)"N !
-1%(SML-FLAG)$	!; Fix up the flag !
0U(SPLIT-FLAG)	!; Flag screen is not split anymore !
\		!; End of insert into H !
!;									!
!; Set up the text for the screen section separator			!
!;									!
E.(SEP-LINE)7<I`	-$>	!; Stuff the text into the Q-reg !
!;									!
!;	Set up Q-register S with its macro				!
!;									!
E.(S)@I\	!; Insert the macro into the Q-reg !
Q(WIDE-FLAG)"NMW'	!; If screen is wide, make it narrow first !
Q(SPLIT-FLAG)"E		!; If screen is not split !
	1U(UPPER)		!; Flag we are in ".." !
	E.(..)			!; Put us there !
	1,10E`$(.)		!; Display 10 lines of "." on top !
	11,11E`$(SEP-LINE)	!; Then the separator line !
	12,21E`$(..)		!; Then 10 lines of ".." !
	22,24E`$(COMMAND-BUFFER)!; And 3 lines of commands !
	'		!; End of Q(SPLIT-FLAG)"E !
Q(SPLIT-FLAG)"N		!; If screen is already split !
	0U(UPPER)		!; Flag we are back in "." !
	E.(.)			!; And put us there !
	M(SET-NORMAL-SCREEN)	!; Reset the screen to normal lines !
	1U(SPLIT-FLAG)		!; Fix up the flag !
	'			!; End of Q(SPLIT-FLAG)"N !
-1%(SPLIT-FLAG)$	!; Reset the flag value !
0U(SML-FLAG)		!; And flag not a short text area !
\		!; End of insert string !
!;									!
!;	Set up Q-register U with its macro				!
!;									!
E.(U)@I\		!; Insert the macro into Q-reg U !
Q(UPPER)"E		!; If currently in "." !
	E.(..)			!; Put us into ".." !
	1U(UPPER)		!; Flag we are there !
	OU-DONE$		!; And exit from the Q-reg !
	'		!; End of Q(UPPER)"E !
Q(UPPER)"N			!; If currently in ".." !
	0U(UPPER)		!; Flag we are back in "." !
	E.(.)			!; Put us there !
	'		!; End of Q(UPPER)"N !
!U-DONE!\		!; End of insert string !
!;									!
!;	Set up Q-register C with its macro				!
!;									!
E.(C)@I\		!; Insert the macro for Q-reg C !
Q(UPPER)"NE.(.)'	!; If we are currently editing ".." get us out for a moment !
0,0X(..)		!; Clear out the file that is currently there !
Q(UPPER)"NE.(..)'	!; And put us back in if necessary !
\			!; End of insert string !
!;									!
!;	Set up Q-register AUTO-BUFFER with its macro			!
!;									!
E.(AUTO-BUFFER)I0,0X(ERROR-TEXT)$ !; Clear out the last error message when counter goes off !
!;									!
!;									!
!;	Determine the terminal type and speed.  If we are on an H19	!
!;	at slow speed (less than 1200 baud) we will start out with a	!
!;	small text buffer and large command buffer (MH'ed).		!
!;									!
!;									!
^O1030EVTRMOP$-^O10"L	!; If less than 1200 baud !
	^O1041EVTRMOP$U(TERM-TYPE) !; Get the terminal type !
	Q(TERM-TYPE)+^O275646370000"EMH' !; If this is an H19A do the MH !
	Q(TERM-TYPE)+^O275646000000"EMH' !; Or if it is an H19 !
	'		!; End of 1200 baud check !
!;									!
!;									!
!;	Put us in the normal text buffer and set the UPPER flag so	!
!;	we know we are in the upper part of the screen			!
!;									!
!;									!
E.(.)0U(UPPER)	!; Put in "." and flag it !
'		!; End of EO-4+1"G from above !
!;									!
!;	Clear Q-register * so the TECO.INI will go away a make core	!
!;	smaller.							!
!;									!
0U*