Google
 

Trailing-Edge - PDP-10 Archives - steco_19840320_1er_E35 - 10,5676/teco/source/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			!
!;									!
!; Save the current state of TECO so we can reset what is necessary	!
[0[1[%[9		!; Save the Q-regs we use			!
EO-4+1"G		!; E. command doesn't work in old versions	!
E?CURRENT-TEXT-BUFFER$U0!; Save the current text-buffer name		!
E.(9)			!; Make sure the defaults don't kill a current file!
'			!; End of EO-4+1"G				!
!;									!
!; 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				!; No case flagging			!
1EH				!; Prefix error messages		!
!;									!
!;	Set up the macro in Q-register L				!
!;									!
E.(L)HK@I\^T	!; 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^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)HK@I\^T		!; Insert the macro !
+0[0[1			!;Save possible argument and Q-regs. 0 & 1.!
.U1			!;Save pointer!
Q0"E			!; Any argument?!
999999999U0'		!;If no argument, set to infinity!
Q0<^N"L0;'		!;If EOF, we're done!
	^E"L			!; If buffer ended with a form feed !
	ZJ			!; then position at end of buffer !
	12I$'			!; And insert the form feed !
	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)HK@I\^T		!; Insert the macro				!
	[0[1[2				!;Save Q-regs!
	.U0				!;Save current pointer!
	0U1				!;Init lower bound!
	:-S^E<14>$"L.U1 '		!;Search back for FF!
	Q0J				!;Go back to starting place!
	ZU2				!;Init upper bound!
	:S^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)HK@I\^T		!; Insert the macro !
<			!; Start the loop !
	^N"N0;'	!; Break out of loop if EOF !
	^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)HK@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)HK@I|		!; Insert the macro into the Q-reg !
EVWINDOW$&^R^O777777-80"E	!; If currently 80 characters wide !
	2ET			!; Set image mode type out !
	^R^A$[?3h^R^A		!; Send the string to switch the terminal !
	0ET			!; Reset type out to normal !
	132EVWINDOW$		!; Set to use full width !
'"U				!; Else screen must be wide now !
	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 !
	80EVWINDOW$		!; Reset back to 80 characters wide !
'				!; End of else code !
|			!; End of insert string !
!;									!
!;	Set up Q-register H with its macro				!
!;									!
E.(H)HK@I\		!; Insert the macro into the Q-reg !
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)HK7<I`	-$>	!; Stuff the text into the Q-reg !
!;									!
!;	Set up Q-register S with its macro				!
!;									!
E.(S)HK@I\	!; Insert the macro into the Q-reg !
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)HK@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)HK@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 !
!;									!
!;									!
!;	Set up immediate commands					!
!;		^R - Move back one word					!
!;		^E - Move to end of line				!
!;		'  - Move down one screen				!
!;		"  - Move up one screen					!
!;		~  - Twiddle last two characters			!
!;		&  - Twiddle this line and last				!
!;		^A - Append current line to text in Q-reg A		!
!;		^X - Store current line in Q-reg A			!
!;		^K - Kill to EOL (or EOL) and append to Q-reg K		!
!;		^Y - Get text from Q-reg K and clear Q-reg K		!
!;		^Z - Exit via an EX					!
!;									!
!;	The following are set up in the given function keys on H-19's,	!
!;	VT-52's, and VT-100's.  The will only be available via M(q-reg)	!
!;	on other terminals (unless someone comes up with good single	!
!;	character items for them).					!
!;									!
!;		Blue (PF1) - Move screen to put pointer on top line	!
!;		Red  (PF2) - Move screen to put pointer on middle line	!
!;		White(PF3) - Move screen to put pointer on bottom line	!
!;		Home (Alt5)- Move pointer to current top line		!
!;		Alt.	   - Move pointer to current middle line	!
!;		Alt0	   - Move pointer to current bottom line	!
!;		Up-arrow   - Move up one screen line			!
!;		Down-arrow - Move down one screen line			!
!;		Left-arrow - Move left one column			!
!;		Right-arrow- Move right one column			!
!;									!
!;	On H-19's:							!
!;		IC - Insert one space and position cursor on it		!
!;		DC - Delete one character (treat CRLF as one)		!
!;		IL - Insert one blank line and position pointer before	!
!;		DL - Delete line and append to Q-reg K			!
EO-4"G				!; Do we have the features we need	!
	E.(FC_BASIC_TABLE)	!; FC table will go into FC_BASIC_TABLE	!
HK@I@^T				!; Delimited insert with no commands	!
"^R^R"	:TECO {$:R:0FW}		!; Move backwards one word		!
"^E"	:TECO {$		!; Move to end of line			!
	L			!; Move down one line			!
	:2R"S			!; Back up over two chars (if possible)	!
	1A-13"N			!; Was EOL a CR something?		!
	C''}			!; No, move to EOL char			!
"#"	:TECO {$MS}		!; Toggle split screen macro		!
"|"	:TECO {$MU}		!; Toggle between "." and ".."		!
"'"	:TECO {$		!; Move down one screen			!
	[1[2[3[4		!; Save some Q-regs to work with	!
	E?DISPLAY-LINES$U1U2	!; Determine current display position	!
	Q2"E $$'		!; Done if not displayed		!
	E?SCREEN-ADDRESS$U3U4	!; Get position of pointer on screen	!
	(Q2-Q3)+		!; Get offset from current position to bottom!
	((Q2-Q1)/2)+		!; Plus half of the screen area size	!
	1^D			!; And move down enough lines to center	!
				!; new position				!
	]4]3]2]1}		!; And restore the Q-regs		!
""""	:TECO {$		!; Move up one screen			!
	[1[2[3[4		!; Save some Q-regs to work with	!
	E?DISPLAY-LINES$U1U2	!; Determine current display position	!
	Q2"E $$'		!; Done if not displayed		!
	E?SCREEN-ADDRESS$U3U4	!; Get position of pointer on screen	!
	(Q1-Q3)-		!; Get offset from current position to top!
	((Q2-Q1)/2)-		!; Minus half of the screen area size	!
	1^D			!; And move up enough lines to center	!
				!; new position				!
	]4]3]2]1}		!; And restore the Q-regs		!
"~"	:TECO {$		!; Twiddle last two characters		!
	:R"S			!; Back up one character if possible	!
	    [0:.-1,.X0"S	!; and save previous character in 0 (if any)!
		-D		!; Delete previous character		!
		C		!; Advance over next			!
		G0'		!; Restore the previous character	!
		]0'}		!; And restore Q-reg 0			!
"&"	:TECO {$		!; Twiddle last and current line	!
	0L[0			!; Move to start of line and save Q-reg 0!
	-1X0			!; Save previous line (null if none)	!
	-K			!; Kill previous line (if any)		!
	L			!; Skip current line			!
	G0			!; Get the previous line back		!
	-L			!; And reset to start of the line	!
	]0}			!; Restore Q-reg 0			!
"^A"	:TECO {$		!; Append current line to Q-reg A	!
	[0			!; Save Q-reg 0				!
	X0			!; Save current line in Q-reg 0		!
	{^GA^G0^R^R}UA		!; Concat A and 0 and store in A	!
	]0}			!; Restore Q-reg 0			!
"^X"	:TECO {$XA}		!; Store current line to Q-reg A	!
"^K"	:TECO {$		!; Kill to EOL and append to Q-reg K	!
	Z-."E$$'		!; If at end of buffer do nothing	!
	.[0[1			!; Stack Q-reg's 0&1 and save . in 0	!
	L			!; Move down one line			!
	:2R"S			!; Back up over the EOL (if any)	!
	1A-13"N			!; Was this a CRLF?			!
		C''		!; No, go forward to the EOL		!
	Q0-."EL'		!; If we were immediately before the EOL!
				!; Then delete the EOL			!
	Q0,.X1			!; Save the text we are deleting	!
	{^GK^G1^R^R}UK		!; Append the text to Q-reg K		!
	Q0,.K			!; Kill the text			!
	]1]0}			!; And restore the Q-regs		!
"^Y"	:TECO {$GK0,0XK}	!; Get text from Q-reg K and clear it	!
"^Z"	:TECO {$EX}		!; Exit from TECO			!
ANY:("M","m") ANY:("M","m")	!; For any combination of two m's	!
	:TECO {$MM}		!; Just execute M			!
@				!; End of commands for all terminals	!
0U1				!; Set up Q-reg 1 depending on terminal !
				!; type.  0= not (H19, H19A, VT100, VT52!
				!; 1= VT52, 2=H19, -1=VT100, -2=H19A	!
				!; (thus it is negative for ANSI mode	!
				!; and positive for VT-52 mode		!
E?TERMINAL-TYPE$U%		!; Get the terminal type we are		!
Q%,{VT52}"E1U1'			!; Check for VT-52			!
Q%,{H19}"E2U1'			!; Check for H-19			!
Q%,{VT100}"E-1U1'		!; Check for VT-100			!
Q%,{H19A}"E-2U1'		!; Or an H19 in ANSI mode?		!
Q1"L				!; ANSI mode ?				!
Q1+2"E				!; H19A?				!
2ET^A$[>7h^A0ET'		!; Make sure we have alt keypad set	!
Q1+1"E				!; VT-100?				!
2ET^A$=^A0ET'			!; Yes, set it to alt keypad mode	!
@I@^T				!; Add the basic function keys		!
"$OP"	:TECO {$0,.V0V}		!; Move screen to put . on top line	!
"$OQ"	:TECO {$M(PT_TO_MID)}	!; Move screen to put . on middle line	!
"$OR"	:TECO {$M(PT_TO_BOT)}	!; Move screen to put . on bottom line	!
"$Ou" |				!; Alt keypad mode 5			!
"$[H"	:TECO {$M(MOVE_PT_HOME)}!; or HOME key move pointer to top line	!
"$On"	:TECO {$M(MOVE_PT_MID)}	!; Move pointer to middle line		!
"$Op"	:TECO {$M(MOVE_PT_BOT)}	!; Move pointer to bottom line		!
"$Ox" |				!; Alternate keypad 8			!
"$[A"	:TECO {$:-1^D}		!; Move up one screen line		!
"$Or" |				!; Alternate keypad 2			!
"$[B"	:TECO {$:^D}		!; Move down one screen line		!
"$Ov" |				!; Alternate keypad 6			!
"$[C"	:TECO {$:C}		!; Move forward one column		!
"$Ot" |				!; Alternate keypad 4			!
"$[D"	:TECO {$:R}		!; Move backward one column		!
"$Ow" |				!; Alternate keypad 7			!
"$[4l" |			!; IC key in insert mode		!
"$[4h"	:TECO {$I $R}		!; Insert a space and position before it!
"$Oy" |				!; Alternate keypad 9			!
"$[P"	:TECO {$:D}		!; Delete one character			!
"$Oq" |				!; Alternate keypad 1			!
"$[L"	:TECO {$I
$2R}				!; Insert a line and position before it	!
"$Os" |				!; Alternate keypad 3			!
"$[M"	:TECO {$		!; Delete line and save in K		!
	[0X0			!; Stack 0 and save line in 0		!
	{^GK^G0^R^R}UK		!; Append line to Q-reg K		!
	K			!; Kill the line			!
	]0}			!; And restore Q-reg 0			!
@'				!; End of ANSI mode basic keys		!
Q1"G				!; VT-52 mode ?				!
Q1-2"E				!; H19?					!
2ET^A$x7^A0ET'			!; Make sure we have alt keypad set	!
Q1-1"E				!; VT-52?				!
2ET^A$=^A0ET'			!; Set to alternate keypad mode		!
@I~^T				!; Add the basic function keys		!
"$P"	:TECO {$0,.V0V}		!; Move screen to put . on top line	!
"$Q"	:TECO {$M(PT_TO_MID)}	!; Move screen to put . on middle line	!
"$R"	:TECO {$M(PT_TO_BOT)}	!; Move screen to put . on bottom line	!
"$?u" |				!; Alt keypad mode 5			!
"$H"	:TECO {$M(MOVE_PT_HOME)}!; or HOME key move pointer to top line	!
"$?n"	:TECO {$M(MOVE_PT_MID)}	!; Move pointer to middle line		!
"$?p"	:TECO {$M(MOVE_PT_BOT)}	!; Move pointer to bottom line		!
"$?x" |				!; Alternate keypad 8			!
"$A"	:TECO {$:-1^D}		!; Move up one screen line		!
"$?r" |				!; Alternate keypad 2			!
"$B"	:TECO {$:^D}		!; Move down one screen line		!
"$?v" |				!; Alternate keypad 6			!
"$C"	:TECO {$:C}		!; Move forward one column		!
"$?t" |				!; Alternate keypad 4			!
"$D"	:TECO {$:R}		!; Move backward one column		!
"$?w" |				!; Alternate keypad 7			!
"$O" |				!; IC key in insert mode		!
"$@"	:TECO {$I $R}		!; Insert a space and position before it!
"$?y" |				!; Alternate keypad 9			!
"$N"	:TECO {$:D}		!; Delete one character			!
"$?q" |				!; Alternate keypad 1			!
"$L"	:TECO {$I
$2R}				!; Insert a line and position before it	!
"$?s" |				!; Alternate keypad 3			!
"$M"	:TECO {$		!; Delete line and save in K		!
	[0X0			!; Stack 0 and save line in 0		!
	{^GK^G0^R^R}UK		!; Append line to Q-reg K		!
	K			!; Kill the line			!
	]0}			!; And restore Q-reg 0			!
~'				!; End of H-19A function keys		!
!;									!
!;	Now do the FC command to set the table				!
!;									!
FC(FC_BASIC_TABLE)REPLACE$		!; Set up the table		!
FCON$					!; And turn it on		!
!;	Initialize Q-reg K for ^K, ^Y and DL commands			!
0,0XK				!; Put null text into K			!
0,0XA				!; Also into Q-reg A for ^A command	!
!;									!
!;	Support macros for immediate commands above			!
!;									!
!;	PT_TO_MID - Put current position on middle line of screen	!
!;									!
E.(PT_TO_MID)HK@I@^T		!; Insert the macro			!
	[1[2			!; Save some Q-regs			!
	E?DISPLAY-LINES$U1U2	!; Get the lines this section is on	!
	Q2"E$$'			!; Nothing to do if not displayed	!
	(Q2-Q1)/2,.V		!; Say where we want this position	!
	0V			!; And make sure it gets unlocked	!
	]2]1			!; Restore the Q-regs			!
@				!; End of PT_TO_MID			!
!;									!
!;	PT_TO_BOT - Move current position to bottom line of section	!
!;									!
E.(PT_TO_BOT)HK@I@^T		!; Insert the macro			!
	[1[2			!; Save the Q-regs			!
	E?DISPLAY-LINES$U1U2	!; Get the line bounds			!
	Q2"E$$'			!; Ignore if not displayed		!
	Q2-Q1,.V		!; Say we wish to be on last line	!
	0V			!; But not locked there forever		!
	]2]1			!; Restore the Q-regs			!
@				!; And end the insert for PT_TO_BOT	!
!;									!
!;	MOVE_PT_HOME - Move current position to top of section		!
!;									!
E.(MOVE_PT_HOME)HK@I@^T		!; Insert the macro			!
	[1[2[3[4		!; Save some room to work		!
	E?DISPLAY-LINES$U1U2	!; Get the display positions		!
	Q2"E$$'			!; Done if not displayed		!
	E?SCREEN-ADDRESS$U3U4	!; Get the current position of .	!
	E?CURRENT-TEXT-BUFFER$U4 !; Get the current text buffer name	!
	Z-.+E?(^G4)LEAVE-BLANK-LINE$"E !; If we are likely to be on the screen !
		Q3"EQ2+1U3''	!; Yes, use bottom line plus one	!
	(Q1-Q3)^D		!; Move to top line of section		!
!; Really should figure out how far back to move PT now to get to	!
!; the left margin, but that is non-trivial, and may not be worth it.	!
!; When I (or someone) gets around to putting E?DISPLAY-BOUNDS$ in	!
!; this can be fixed.							!
	]4]3]2]1		!; Restore the Q-regs			!
@				!; End of MOVE_PT_HOME			!
!;									!
!;	MOVE_PT_MID - Move current position to middle of section	!
!;									!
E.(MOVE_PT_MID)HK@I@^T		!; Insert the macro			!
	[1[2[3[4		!; Save some room			!
	E?DISPLAY-LINES$U1U2	!; Get the display positions		!
	Q2"E$$'			!; If not displayed, punt now		!
	E?SCREEN-ADDRESS$U3U4	!; Get the current position		!
	E?CURRENT-TEXT-BUFFER$U4 !; Get the current text buffer name	!
	Z-.+E?(^G4)LEAVE-BLANK-LINE$"E !; If we are likely to be on the screen !
		Q3"EQ2+1U3''	!; Yes, use bottom line plus one	!
	(Q1+((Q2-Q1+1)/2)-Q3)^D	!; Move to center of screen		!
	]4]3]2]1		!; Restore the Q-regs			!
@				!; End of MOVE_PT_MID			!
'				!; End of EO-4"G			!
!;									!
!;	MOVE_PT_BOT - Move current position to bottom of section	!
!;									!
E.(MOVE_PT_BOT)HK@I@^T		!; Insert the macro			!
	[1[2[3[4		!; Save some Q-regs			!
	E?DISPLAY-LINES$U1U2	!; Get the display positions		!
	Q2"E$$'			!; If not displayed, all done		!
	E?SCREEN-ADDRESS$U3U4	!; Get the current position		!
	(Q2-Q3)^D		!; Move to end of screen section	!
	]4]3]2]1		!; Restore the Q-regs			!
@				!; End of MOVE_PT_BOT			!
!;									!
!;									!
!;	Set up EXIT-COMMAND to output the correct thing when we exit	!
!;									!
Q1-1"E		!; VT-52?					!
	{2ET^R^A$>^R^A0ET^R^C2ET^R^A$=^R^A0ET}U(CONTROL-C-INTERCEPT-COMMAND) !; Set up ^C !
	{2ET^R^A$>^R^A0ET}U(EXIT-COMMAND)' !; Yes, take out of ALT-keypad!
Q1-2"E			!; H-19 in VT-52 mode?				!
	{2ET^R^A$y7^R^A0ET^R^C2ET^R^A$x7^R^A0ET}U(CONTROL-C-INTERCEPT-COMMAND) !; Set up ^C !
	{2ET^R^A$y7^R^A0ET}U(EXIT-COMMAND)' !; Yes, no more alt-keypad	!
Q1+1"E			!; VT-100?					!
	{2ET^R^A$[?4h$>^R^A0ET^R^C2ET^R^A$=^R^A0ET}U(CONTROL-C-INTERCEPT-COMMAND) !; Set up ^C !
	{2ET^R^A$[?4h$>^R^A0ET}U(EXIT-COMMAND)' !; Yes, set smooth scroll!
Q1+2"E			!; H-19 in ANSI mode?				!
	{2ET^R^A$[>7l^R^A0ET^R^C2ET^R^A$[>7h^R^A0ET}U(CONTROL-C-INTERCEPT-COMMAND) !; Set up ^C !
	{2ET^R^A$[>7l^R^A0ET}U(EXIT-COMMAND)' !; Yes, clear alt-keypad	!
!;									!
!;									!
!;	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.(^G0)0U(UPPER)	!; Put in original buffer and flag it		!
'			!; End of EO-4+1"G from above			!
]9]%]1]0		!; Restore the Q-regs				!
!;									!
!;	Clear Q-register * so the TECO.INI will go away and make core	!
!;	smaller.							!
!;									!
0U*			!; Clear out *					!