Trailing-Edge
-
PDP-10 Archives
-
BB-M836A-BM
-
tools/sed/sedx.mac
There are 13 other files named sedx.mac in the archive. Click here to see a list.
TITLE SEDX - SKELETON EDITOR TERMINAL DEFINITION PROGRAM
SUBTTL A CHRISTOPHER HALL FECIT
;LOAD THE EDITOR BY: .LOAD SEDSYM,SEDX,SED
; .SS SED
SEARCH SEDSYM
IFE TOPS10,<SEARCH MONSYM>
EXTERN CPOPJ,PUTTYP,PUTSTG,PUTSQ1,PUTNUM,TRMNAM,TYPBUF,HOMPOS
EXTERN CHOME,CDOWN,CRIGHT
INTERN TERMNL
FTFAST==0 ;SET THIS IF TERMINAL SENDS OUT XON-XOFF'S
TERMNL: OTABLE ;ADDRESS OF THE TERMINAL TABLE TO USE
;TERMINAL OUTPUT TABLE - SEQUENCES TO MAKE THE TERMINAL DO SPECIAL THINGS
;FILL IN WITH THE CODES FOR YOUR TERMINAL
OTABLE: BYTE (7) 0 ;CURSOR UP
BYTE (7) 0 ; DOWN
BYTE (7) 0 ; RIGHT
BYTE (7) 0 ; LEFT
BYTE (7) 0 ; HOME
BYTE (7) 0 ;CLEAR TO END OF PAGE
BYTE (7) 0 ;CLEAR TO END OF LINE
BYTE (7) 0 ;ROLL UP AND CLEAR LINE
BYTE (7) 0 ;ROLL DOWN AND CLEAR LINE
BYTE (7) 0 ;PROTECT ON (0 IF NONE)
BYTE (7) 0 ;PROTECT OFF (0 IF NONE)
BYTE (7) 0 ;INSERT LINE (0 IF NONE)
BYTE (7) 0 ;INSERT SPACE (0 IF NONE)
BYTE (7) 0 ;DELETE LINE (0 IF NONE)
BYTE (7) 0 ;DELETE SPACE (0 IF NONE)
BYTE (7) 0 ;MOVE TO BOTTOM
BYTE (7) 0 ;HOME AND CLEAR ENTIRE PAGE
POSCUR ;ROUTINE TO POSITION TO CHARACTER
POSLIN ;ROUTINE TO POSITION TO START OF LINE
^D24 ;LINES PER PAGE
^D80 ;CHARACTERS PER LINE
IFE FTFAST,<
0 ;TERMINAL-DEPENDENT FLAGS
>
IFN FTFAST,<
NPG ;TERMINAL-DEPENDENT FLAGS (KEEP TTY PAGE)
>
CPOPJ ;ROUTINE TO CALL ON ENTRY
CPOPJ ;ROUTINE TO CALL ON EXIT
0,,0 ;NUMBER OF NULLS TO OUTPUT,,NULL CHARACTER
ITABLE ;ADDRESS OF INPUT CHARACTER TABLE
0 ;MARK TO DISPLAY ON ENTER (OMIT IF MRK NOT SET)
COMMENT \
THE TERMINAL INPUT TABLE
The terminal input table maps sequences of characters arriving
from the terminal into the internal editor commands. The editor
commands are described below. The commands are organized with regard
to their position on the typewriter keyboard, and not alphabetically.
Note: all values pertaining to characters are in octal in this
listing.
INTERNAL "USUAL"
CODE COMMAND SEQUENCE FUNCTION
\
$CURUP== 36 ; CURSOR UP Move the cursor up
$CURDN== 34 ; CURSOR DOWN Move the cursor down
$CURLF== 10 ; CURSOR-LEFT ^H Move the cursor to the left
$CURRT== 35 ; CURSOR RIGHT Move the cursor to the right
$CURHM== 37 ; CURSOR HOME Move the cursor to the upper left
$RETRN== 15 ; CARRIAGE-RETURN ^M Good ol' ASCII carriage return
$TAB== 11 ; TAB ^I Move cursor to the next tab stop
$BKTAB== 25 ; BACKTAB ^U Move cursor to the previous tab stop
$UPTAB== 52 ; UP-TAB Up-tab (6 cursor-ups)
$DNTAB== 53 ; DOWN-TAB Down-tab (6 cursor-downs)
$LINE== 45 ; LINE Move to beginning or end of line
$BLINE== 57 ; BEGIN-LINE Move to beginning of line
$ELINE== 60 ; END-LINE Move to end of line
$RLFWP== 31 ; ROLL-FORW-PAGES ^Y Move window forward some pages
$RLFWL== 24 ; ROLL-FORW-LINES ^T Move window forward some lines
$RLBKP== 21 ; ROLL-BACK-PAGES ^Q Move window back some pages
$RLBKL== 27 ; ROLL-BACK-LINES ^W Move window back some lines
$SLDLF== 13 ; SLIDE-LEFT ^K Move viewing window to the left
$SLDRT== 14 ; SLIDE-RIGHT ^L Move viewing window to the right
$INSSP== 1 ; INSERT-SPACES ^A Add some spaces at the cursor
$DELSP== 23 ; DELETE-SPACES ^S Remove some characters from a line
$INSLN== 4 ; INSERT-LINES ^D Add some blank lines at the cursor
$DELLN== 6 ; DELETE-LINES ^F Remove some lines at the cursor
$PICK== 26 ; PICK ^V Load buffer with text from the file
$PUT== 7 ; PUT ^G Add text to the file
$ERSLN== 50 ; ERASE-LINE ^J Erase from cursor to end of the line
$CLRLN== 12 ; CLEAR-LINE ^J Erase the line below the cursor
$DELCH== 42 ; DELETE-PREV-CHAR Delete char to left of cursor
$ERSWD== 61 ; ERASE-WORD Erase previous word
$SRCFW== 22 ; SEARCH-FORWARD ^R Search from cursor to end of file
$SRCBK== 5 ; SEARCH-BACK ^E Search from cursor to start of file
$SUBST== 63 ; SUBSTITUTE Search for a string & substitute another
$SETFI== 2 ; SET-FILE ^B Set up a new file for editing
$EXIT== 32 ; EXIT ^Z Save file and exit
$ABORT== 3 ; ABORT ^C Exit, forgetting changes
$ENTER== 33 ; ENTER ESCAPE Set up an argument for a command
$RECAL== 40 ; RECALL Recall latest argument
$MARK== 44 ; MARK Mark position for PICK or CLOSE
$SWTCH== 16 ; SWITCH ^N Set operating switches, etc.
$ENTCC== 17 ; ENTER-CTRL-CHAR ^O Make the next char typed a ctrl chr
$GOTO== 20 ; PERCENT-GOTO ^P Move window to a percent of the line
$RESET== 0 ; RESET RUBOUT Rewrite cursor, line, or screen
$INMOD== 41 ; INSERT-MODE Insert/replace toggle
$RLTAB== 43 ; REAL-TAB Insert a real tab (Same as E-C-C I)
$CASE== 46 ; CASE Change case of letter at cursor
$WINDW== 47 ; WINDOW Set or clear windowing
$REWRT== 54 ; REWRITE Rewrite screen (Same as $^RESET)
$SAVE== 55 ; SAVE-FILE Save file
$HELP== 56 ; HELP Give help (Same as ENTER ENTER)
$PUSH== 62 ; PUSH Push to EXEC (TOPS-20 only)
$EXEC== 30 ; EXECUTE ^X Execute a sequence of commands
;TERMINAL INPUT TABLE - TELLS WHAT CONTROL CHARACTERS OR SEQUENCES
;INVOKE WHICH COMMANDS
IFE FTFAST,<
EXP $RESET ;RUBOUT
ITABLE: EXP $RECAL, $INSSP, $SETFI ; 0, A, B
EXP $ABORT, $INSLN, $SRCBK, $DELLN ;C, D, E, F
EXP $PUT, $DELCH, $TAB, $ERSLN ;G, H, I, J
EXP $SLDLF, $SLDRT, $RETRN, $SWTCH ;K, L, M, N
EXP $ENTCC, $GOTO, $RLBKP, $SRCFW ;O, P, Q, R
EXP $DELSP, $RLFWL, $BKTAB, $PICK ;S, T, U, V
EXP $RLBKL, $EXEC, $RLFWP, $EXIT ;W, X, Y, Z
EXP -SIZ.IS,,ISUBTB ;ESCAPE
EXP $CURDN, $CURRT, $CURUP, $CURHM ;\, ], ^, _
>
IFN FTFAST,<
;THIS TABLE SETS UP THE KEYBOARD ARRANGEMENT FOR WHEN YOU NEED TO KEEP
;TTY PAGE IN EFFECT BECAUSE THE TERMINAL SENDS OUT ITS OWN CONTROL S AND Q'S
;THOSE TWO CHARACTERS CANNOT BE COMMANDS SINCE SED DOES NOT KNOW WHETHER THE
;USER HAS TYPED THEM OR THEY WERE SENT BY THE TERMINAL.
;SO Q GOES TO A, A AND S GO TO K AND L, K TO ESCAPE-L, AND L TO ESCAPE-T
EXP $RESET ;RUBOUT
ITABLE: EXP $RECAL, $RLBKP, $SETFI ; 0, A, B
EXP $ABORT, $INSLN, $SRCBK, $DELLN ;C, D, E, F
EXP $PUT, $DELCH, $TAB, $ERSLN ;G, H, I, J
EXP $INSSP, $DELSP, $RETRN, $SWTCH ;K, L, M, N
EXP $ENTCC, $GOTO, 0, $SRCFW ;O, P, Q, R
EXP 0, $RLFWL, $BKTAB, $PICK ;S, T, U, V
EXP $RLBKL, $EXEC, $RLFWP, $EXIT ;W, X, Y, Z
-SIZ.IS,,ISUBTB ;ESCAPE
EXP $CURDN, $CURRT, $CURUP, $CURHM ;\, ], ^, _
>
;SUBTABLE. PUT THE MOST FREQUENTLY-USED SEQUENCES FIRST
;ENTER IS PROBABLY THE MOST COMMON OF ALL
ISUBTB: $ENTER,,"P" ;ESCAPE P == ENTER
$CURHM,,"R" ;ESCAPE R == HOME
$CURUP,,"A" ;ESCAPE A == UP
$CURDN,,"B" ;ESCAPE B == DOWN
$CURRT,,"C" ;ESCAPE C == RIGHT
$CURLF,,"D" ;ESCAPE D == LEFT
$RECAL,,"Q" ;ESCAPE Q == RECALL
$WINDW,,"W" ;ESCAPE W == WINDOW
$WINDW,,"w" ;ESCAPE w == WINDOW
IFN FTFAST,<
;IF TTY PAGE IS IN EFFECT,
;DEFINE SEQUENCES FOR
;<SLIDE-LEFT> AND <SLIDE-RIGHT> HERE
>
SIZ.IS=.-ISUBTB
;PUT THE CURSOR POSITIONING ROUTINES HERE (SEE SED.POS FOR SAMPLES)
;ALSO PUT ENTRY AND EXIT ROUTINES HERE
COMMENT \
;NOTE: THE FOLLOWING CODE, UNDER TOPS-10 7.01, WILL READ THE TERMINAL TYPE,
; IN SIXBIT, INTO T1. THE TYPE IS COMPARED WITH A LIST OF KNOWN TYPES
; AND THE ADDRESS OF THE RIGHT TERMINAL OUTPUT TABLE IS SET UP:
IFN TOPS10,<
...
MOVE T1,[2,,TRMBLK] ;READ SIXBIT TERMINAL TYPE INTO T1
TRMOP. T1,
JFCL
MOVEI T2,TTBLEN ;FIND THIS TYPE IN THE TERMINAL TABLE
CAME T1,TNMTBL(T2)
SOJGE T2,.-1
JUMPL T2,TRMERR ;NOT FOUND - ERROR (note: no error routine)
HRR TM,TADTBL(T2) ;FOUND - GET ADDRESS OF OUTPUT TABLE
...
TNMTBL: SIXBIT /VT52/
SIXBIT /VT100/
SIXBIT /ADM3A/
TTBLEN=.-TNMTBL-1
TADTBL: OVT52
OVT100
OADB3A
TRMBLK: 1041
-1
>
IFE TOPS10,<
;THE TERMINAL TYPE CAN BE READ UNDER TOPS20 LIKE THIS:
TENTRY: MOVEI T1,.PRIIN ;READ TERMINAL TYPE
GTTYP
>
;(END OF EXAMPLE CODE)
\
END