Google
 

Trailing-Edge - PDP-10 Archives - LCG_Integration_Tools_Clearinghouse_T20_v7_30Apr86 - tools/sed2/sed1dt.mar
There are 5 other files named sed1dt.mar in the archive. Click here to see a list.
.TITLE	SED1DT - Sed Data

.LIBRARY /SEDITB.MLB/

.ENABLE DEBUG
.DISABLE GLOBAL

PRMDEF		;Define the SED parameters
$DSCDEF		;Define the DSC$ symbols
$JPIDEF		;  and the $GETJPI symbols

.PSECT CODE,NOWRT,EXE,LONG
.SUBTITLE	Command Dispatch Tables

CMVTBL::.ADDRESS CDOWN		;Cursor move table -
	.ADDRESS CRIGHT		;   used by AJDONE to move cursor
	.ADDRESS CURUP
	.ADDRESS POSCUR

;Command Dispatch Tables - Dispatch here if ENTER was typed

CMDTB1::.ADDRESS RESET		;    Reset (looks like a null)
	.ADDRESS OPENSP		; A  Open spaces
	.ADDRESS SETFIL		; B  Set up a file for editing
	.ADDRESS ABOPAR		; C  Abort
	.ADDRESS OPENLN		; D  Open lines
	.ADDRESS SRCBAK		; E  Search backward
	.ADDRESS CLOSLN		; F  Close lines
	.ADDRESS PUT		; G  Put
	.ADDRESS LFTARG		; H  Cursor left
	.ADDRESS TABARG		; I  Tab
	.ADDRESS LNFPAR		; J  Linefeed
	.ADDRESS SLIDEL		; K  Slide left
	.ADDRESS SLIDER		; L  Slide right
	.ADDRESS RETARG		; M  Carriage return
	.ADDRESS SWITCH		; N  Set switches
	.ADDRESS ENTCCH		; O  Enter control character
	.ADDRESS PERCEN		; P  Percent goto
	.ADDRESS ROLBKP		; Q  Roll back pages
	.ADDRESS SRCFWD		; R  Search forward
	.ADDRESS CLOSSP		; S  Close spaces
	.ADDRESS ROLFWL		; T  Roll forward lines
	.ADDRESS BTBARG		; U  Back-tab
	.ADDRESS PICK		; V  Pick
	.ADDRESS ROLBKL		; W  Roll back lines
	.ADDRESS EXECUT		; X  Do command sequence
	.ADDRESS ROLFWP		; Y  Roll forward pages
	.ADDRESS EXIPAR		; Z  Normal exit
	.ADDRESS ENTERA		; [  Enter params
	.ADDRESS DWNARG		; \  Cursor down
	.ADDRESS RGTARG		; ]  Cursor right
	.ADDRESS UPARG		; ^  Cursor up
	.ADDRESS HOMARG		; _  Home
	.ADDRESS RECARG		;40  Recall
	.LONG	 0		;41  Insert mode
	.ADDRESS LFTAG0		;42  Delete char
	.ADDRESS REALTB		;43  Type a real tab (same as E-C-C I)
	.ADDRESS MRKARG		;44  Mark position for pick and close
	.ADDRESS LINARG		;45  Move to beginning or end of line
	.ADDRESS CHGCAS		;46  Change case of letter at cursor
	.ADDRESS WINCLR		;47  Set or clear windowing
	.ADDRESS LNFPAR		;50  Erase to end of line
	.ADDRESS TABCLR		;51  Clear tab stops
	.ADDRESS UPTARG		;52  Up-tab (6 cursor-ups)
	.ADDRESS DNTARG		;53  Down-tab (6 cursor-downs)
	.ADDRESS RWRARG		;54  Rewrite screen
	.LONG	 0		;55  Save file
	.ADDRESS RECOVR		;56  Recover from DELETE buffer
	.ADDRESS BLIARG		;57  Move to start of line
	.ADDRESS ELIARG		;60  Move to end of line
	.ADDRESS BTBARG		;61  Erase previous word
	.ADDRESS PSHARG		;62  Push to exec
	.ADDRESS SUBSTI		;63  Substitute
	.ADDRESS ILLCMD		;64  Illegal command (gives an error)
	.ADDRESS JUSTIF		;65  Justify text
	.ADDRESS MARKER		;66  Marker
CMDLEN==.-CMDTB1

;Dispatch here if ENTER was not typed

CMDTB2::.ADDRESS RESNPM		;    Reset (looks like a null)
	.ADDRESS OPSNPM		; A  Open spaces
	.ADDRESS SETNPM		; B  Set up a file for editing
	.ADDRESS ABORT		; C  Abort
	.ADDRESS OPENLN		; D  Open lines
	.ADDRESS SRBNPM		; E  Search backward
	.ADDRESS CLOSLN		; F  Close lines
	.ADDRESS PUT		; G  Put
	.ADDRESS LEFT		; H  Cursor left
	.ADDRESS TAB		; I  Tab
	.ADDRESS LNFEED		; J  Linefeed
	.ADDRESS SLLNPM		; K  Slide left
	.ADDRESS SLRNPM		; L  Slide right
	.ADDRESS RETURN		; M  Carriage return
	.ADDRESS SWHNPM		; N  Set switches
	.ADDRESS ENTCCH		; O  Enter control character
	.ADDRESS PERNPM		; P  Percent goto
	.ADDRESS RBKNPM		; Q  Roll back pages
	.ADDRESS SRFNPM		; R  Search forward
	.ADDRESS CLOSSP		; S  Close spaces
	.ADDRESS RFLNPM		; T  Roll forward lines
	.ADDRESS BAKTAB		; U  Back-tab
	.ADDRESS PIKNPM		; V  Pick
	.ADDRESS ROLBKL		; W  Roll back lines
	.ADDRESS EXCNPM		; X  Do command sequence
	.ADDRESS RFPNPM		; Y  Roll forward pages
	.ADDRESS EEXIT		; Z  Normal exit
	.ADDRESS ENTERA		; [  Enter params
	.ADDRESS DOWN		; \  Cursor down
	.ADDRESS RIGHT		; ]  Cursor right
	.ADDRESS UP		; ^  Cursor up
	.ADDRESS HOME		; _  Home
	.ADDRESS RECALL		;40  Recall
	.ADDRESS INSMOD		;41  Insert mode
	.ADDRESS DELCHR		;42  Delete char
	.ADDRESS REALTB		;43  Type a real tab (same as E-C-C I)
	.ADDRESS MARK		;44  Mark position for pick and close
	.ADDRESS LINE		;45  Move to beginning or end of line
	.ADDRESS CHGCAS		;46  Change case of letter at cursor
	.ADDRESS WINSET		;47  Set or clear windowing
	.ADDRESS ERASLN		;50  Erase to end of line
	.ADDRESS TABSET		;51  Clear tab stops
	.ADDRESS UPTAB		;52  Up-tab (6 cursor-ups)
	.ADDRESS DNTAB		;53  Down-tab (6 cursor-downs)
	.ADDRESS DISALL		;54  Rewrite screen (same as $^RESET)
	.ADDRESS SAVEIT		;55  Save file
	.ADDRESS HELPER		;56  Give help (same as ENTER ENTER)
	.ADDRESS BLINE		;57  Move to start of line
	.ADDRESS ELINE		;60  Move to end of line
	.ADDRESS ERASWD		;61  Erase previous word
	.ADDRESS PUSHER		;62  Push to exec
	.ADDRESS SUBNPM		;63  Substitute
	.ADDRESS ICMNPM		;64  Illegal command (gives an error)
	.ADDRESS JUSTIF		;65  Justify text
	.ADDRESS MARNPM		;66  Marker
.SUBTITLE Command Names

;Define the command names (mainly for execute and journaling)
CMDNAM::.ASCII	/^RS /		; @ Reset
	.ASCII	/^IS /		; A Insert Spaces
	.ASCII	/^FL /		; B Set up a file for editing
	.ASCII	/^AB /		; C Abort
	.ASCII	/^IL /		; D Insert Lines
	.ASCII	/^SB /		; E Search Backward
	.ASCII	/^DL /		; F Delete Lines
	.ASCII	/^PT /		; G Put
	.ASCII	/^CL /		; H Cursor Left
	.ASCII	/^TB /		; I Tab
	.ASCII	/^LF /		; J Linefeed
	.ASCII	/^SL /		; K Slide Left
	.ASCII	/^SR /		; L Slide Right
	.ASCII	/^RT /		; M Carriage Return
	.ASCII	/^SW /		; N Set Switches
	.ASCII	/^EC /		; O Enter Control Character
	.ASCII	/^GO /		; P Percent Goto
	.ASCII	/^RBP/		; Q Roll Back Pages
	.ASCII	/^SF /		; R Search Forward
	.ASCII	/^DS /		; S Delete Spaces
	.ASCII	/^RFL/		; T Roll Forward Lines
	.ASCII	/^BT /		; U Back-tab
	.ASCII	/^PK /		; V Pick
	.ASCII	/^RBL/		; W Roll Back Lines
	.ASCII	/^EX /		; X Execute
	.ASCII	/^RFP/		; Y Roll Forward Pages
	.ASCII	/^XT /		; Z Normal Exit
	.ASCII	/$   /		; [ Enter Params
	.ASCII	/^CD /		; \ Cursor Down
	.ASCII	/^CR /		; ] Cursor Right
	.ASCII	/^CU /		; ^ Cursor Up
	.ASCII	/^CH /		; _ Home
	.ASCII	/^RC /		;   Recall
	.ASCII	/^IN /		;   Insert Mode
	.ASCII	/^DC /		;   Delete Character
	.ASCII	/^TA /		;   Real Tab
	.ASCII	/^MK /		;   Mark Position for Pick or Close
	.ASCII	/^LN /		;   Move to Beginning or End of Line
	.ASCII	/^CS /		;   Change Case of letter at cursor
	.ASCII	/^WI /		;   Set or Clear Windowing
	.ASCII	/^EL /		;   Erase Line
	.ASCII	/^TS /		;   Tab Set/Clear
	.ASCII	/^UT /		;   Up-Tab
	.ASCII	/^DT /		;   Down-Tab
	.ASCII	/^RW /		;   Rewrite Screen
	.ASCII	/^SV /		;   Save File
	.ASCII	/^HL /		;   Give Help
	.ASCII	/^LB /		;   Move to Start of Line
	.ASCII	/^LE /		;   Move to End of Line
	.ASCII	/^EW /		;   Erase Previous Word
	.ASCII	/^PU /		;   Push to DCL
	.ASCII	/^SU /		;   Substitute
	.ASCII	/^IC /		;   Illegal Command
	.ASCII	/^JU /		;   Justify text
	.ASCII	/^MR /		;   Marker
.SUBTITLE Execute Constructs

;Table of execute constructs which are not commands, and their codes
;Conditional flags: COND; DO, FR, FC, IF, DW, NOT
;Other codes can't go beyond ^O37
;Other codes in use: 100, 101: End of conditionals; 77: <RESET>
;	"$", ")", "^", real characters as given

CMDCON::.ASCII	/^FR /		;^FR - IF ROW
	.ASCII	/^FC /		;^FC - IF COLUMN
	.ASCII	/^F. /		;^F. - IF COUNTER
	.ASCII	/^IF /		;^IF - IF CHARACTER
	.ASCII	/^DW /		;^DW - DO WHILE
	.ASCII	/^XB /		;^XB - EXIT BLOCK
	.ASCII	/^CB /		;^CB - CONTINUE BLOCK
	.ASCII	/^XX /		;^XX - EXIT BUFFER
	.ASCII	/^C.(/		;^C. - ITERATE COUNTER
	.ASCII	/^C= /		;^C= - CLEAR COUNTER
	.ASCII	/^C+ /		;^C+ - BUMP COUNTER
	.ASCII	/^C- /		;^C- - DEBUMP COUNTER
	.ASCII	/^CT /		;^CT - USE COUNTER
	.ASCII	/^ST(/		;^ST - START (INITIALIZATION)
	.ASCII	/^OU(/		;^OU - IMAGE OUTPUT
	.ASCII	/^SC /		;^SC - SET COUNTER
	.ASCII	/^ND /		;^ND - NO DISPLAY
	.ASCII	/^DF(/		;^DF - DO ON SEARCH FAILURE
CMDCLN==<.-CMDCON>/4

CMDCON1::.LONG	^O120		;^FR - IF ROW
	.LONG	^O110		;^FC - IF COLUMN
	.LONG	^O130		;^F. - IF COUNTER
	.LONG	^O104		;^IF - IF CHARACTER
	.LONG	^O102		;^DW - DO WHILE
	.LONG	^O005		;^XB - EXIT BLOCK
	.LONG	^O006		;^CB - CONTINUE BLOCK
	.LONG	^O007		;^XX - EXIT BUFFER
	.LONG	^O010		;^C. - ITERATE COUNTER
	.LONG	^O011		;^C= - CLEAR COUNTER
	.LONG	^O012		;^C+ - BUMP COUNTER
	.LONG	^O013		;^C- - DEBUMP COUNTER
	.LONG	^O014		;^CT - USE COUNTER
	.LONG	^O015		;^ST - START (INITIALIZATION)
	.LONG	^O016		;^OU - IMAGE OUTPUT
	.LONG	^O017		;^SC - SET COUNTER
	.LONG	^O020		;^ND - NO DISPLAY
	.LONG	^O021		;^DF - DO ON SEARCH FAILURE

XCTREL::.BYTE	^A"G"		;Relations: G-2, L-3, E-4, N-5
XCTCLS::.BYTE	^A"L"		;Classes: L-1, E, N, A, S, U-6
	.BYTE	^A"E"
	.BYTE	^A"N"
	.BYTE	^A"A"
	.BYTE	^A"S"
	.BYTE	^A"U"
.SUBTITLE	Data Storage

SETMFL::
CMDSET::
	RSB

FENCE::	.ASCII	/   ***  You are now viewing the last page (screenful) of your /
	.ASCIZ	/file  ***   /
FENCE1::.ASCIZ	/* End of file */
STARS::	.ASCII	<CR><LF><CR><LF>/            ******************************/
	.ASCIZ	/******/<CR><LF><CR><LF>/            /

.PSECT RWDATA,WRT,EXE,PAGE
F::	.BLKL	1	;General flag longword
F1::	.BLKL	1	;Second general flag longword
EN::	.BLKL	1	;Pointer to end of the buffer
SL::	.BLKL	1	;Slide count
STACK::	.BLKL	1	;Save initial stack pointer

PARAMS::
ADDSPC::.BLKL	1	;Spaces to add or delete (OPENSP, CLOSSP)
ADDSLN::.BLKL	1	;Number of lines to do a rectangular open/close on
ADDLNS::.BLKL	1	;Lines to add or delete (OPENLN, CLOSLN)
ADDLSP::.BLKL	1	;Spaces to add or delete along with lines
ROLLIN::.BLKL	1	;Lines to roll (ROLFWL, ROLBKL)
ROLPGS::.BLKL	1	;Pages to roll (ROLFWP, ROLBKP)
GOPERC::.BLKL	1	;Percent to go to (PERCEN)
SRCKEY::.BLKB	40	;Search key (SRCFWD, SRCBAK)
PICKLN::.BLKL	1	;Number of lines to pick (PICK)
PICKSP::.BLKL	1	;Number of spaces to pick (PICK, with cursor move)
SLIDES::.BLKL	1	;Length of one slide (SLIDEL, SLIDER)
SLDSIZ::.BLKL	1	;Default slide size
CASSPS::.BLKL	1	;Spaces to change the case of (CHGCAS)
CASLNS::.BLKL	1	;Ditto, lines (CHGCAS)
JUSLNS::.BLKL	1	;Lines to justify (JUSTIF)

;Switch flag words (The ???FLG are also saved)

SLDFLG::.BLKL	1	;0 == Disable ^L and ^U
UPPFLG::.BLKB	1	;0 == Convert alphabetics to upper case
BAKFLG::.BLKB	1	;0 == No backup file will be written
PAGFLG::.BLKB	1	;0 == Switch outputs pages-lines; else lines
INSTBS::.BLKB	1	;0 == MAKSPC inserts tabs if it can, else all spaces
INVFLG::.BLKB	1	;0 == CHGCAS inverts case, else use UPCFLG
UPCFLG::.BLKB	1	;0 == CHGCAS converts to upper case; else lower
STRFLG::.BLKB	1	;0 == Error on SOS line numbers; else strip them
XSHFLG::.BLKB	1	;0 == Suppress execute display; else show it
FLLFLG::.BLKL	1	;-1 == justify fill; 0 == no-fill
RLCFLG::.BLKB	1	;-1 == roll screen if CU on top line, CD on bottom
SAVPML==.-PARAMS

			;These are not saved:
FILE_SAVED::	.BLKB	1	;-1 if file has been saved at least once
DSPFLG::.BLKB	1	;0 == Display the file when setting to it
TRLFLG::.BLKB	1	;-1 == strip trailing spaces/tabs from file on exit
CLAFLG::.BLKL	1	;-1 == previous command was ^DL - append to CLSBUF
AGNFLG::.BLKB	1	;-1 == SETFIL to same file again
CRRFLG::.BLKB	1	;-1 == SETFIL should replace current file, not old file
CREFLG::.BLKB	1	;-1 == SETFIL; always create file if it's not found
GREFLG::.BLKB	1	;-1 == global /READ switch (set for all files)
APPFLG::.BLKL	1	;-1 == Append to pick buffer on a pick

SAVPRM::.BLKB	SAVPML	;Parms & flags saved during execute (see below)
SAVFGS::.BLKL	2	;Saved F, F1

ADDLNX::.BLKL	1	;Fraggable ADDLNS and ADDLSP (for CLOSLN, MARK)
ADDLSX::.BLKL	1
SLIDNM::.BLKL	1	;Nominal length of a slide (10 or setting of /SLIDE:)

SROKEY::.BLKB	40	;Previous search key (SRCFWD, SRCBAK, RECALL)
ROLLS::	.BLKL	1	;Holds ROLLIN or LPP*ROLPGS, for ROLBK & ROLFW
SRCPTR::.BLKL	1	;Saved buffer pointer for searches
GOPRCT::.BLKL	1	;Percent goto set up by switch
ADDSPS::.BLKL	1	;Fraggable spaces to ins/del (OPENSP, CLOSSP)
CASLIN::.BLKL	1	;Fraggable lines to change the case of (CHGCAS)
XCTNUM::.BLKL	1	;Current # of times to iterate execute buffer (EXECUT)
XCTITR::.BLKL	1	;Nominal # of times to iterate execute buffer (EXECUT)
XCTPTW::.BLKL	1	;Used active execute buffer pointer (writing)
XCTACW::.BLKL	1	;Starting active execute buffer pointer (writing)
XCTPTR::.BLKL	1	;Used active execute buffer pointer (reading)
XCTACR::.BLKL	1	;Starting active execute buffer pointer (reading)
XCTISV::.BLKL	1	;Saved # of iterations (EXECUT, STACKED)
XCTNSV::.BLKL	1	;Saved nominal iterations (EXECUT, STACKED)
XCTPSV::.BLKL	1	;Saved execute buffer read pointer
XCTASV::.BLKL	1	;Saved starting execute buffer read pointer
XCTRPT::.BLKL	1	;Number of times to repeat this execute command
XCTRPR::.BLKL	1	;Pointer to command to repeat
XCTINI::.BLKL	1	;XCTACR saved during initialization
XCTLVL::.BLKL	1	;Level of nesting of execute blocks
XCTCTR::.BLKL	1	;Execute counter
XCTSNM::.BLKL	1	;Value to save in execute counter on ^SC construct
XCTTMP::.BLKQ	1	;Temporary in search for execute buffer name
WINFLG::.BLKB	1	;0 == upper window; -1 == lower
WINDIS::.BLKB	1	;Flag -1 == bottom window has a file
SUBCNT::.BLKL	1	;Number of times to substitute
SUBNUM::.BLKL	1	;Number of times to substitute, decrementable
SRCKLN::.BLKL	1	;Length of search key
SUBSLN::.BLKL	1	;Length of substitute string
SUBLNS::.BLKL	1	;Number of lines to be displayed after substitute
SUBDIF::.BLKL	1	;Difference in lines before and after substitute
SUBSTG::.BLKB	32	;Substitute string
JSHCNT::.BLKL	1	;Length of JUSHED
JSHCHR::.BLKL	1	;Number of character positions for JUSHED
JUSHED::.BLKB	16	;STG to strip off each line before, add after, justify
MRKEND::.BLKL	1	;Highest marker in use
MRKLAT::.BLKL	1	;Display pointer of latest-set marker
MRKNTB::.BLKL	MRKSIZ	;First 4 characters of marker name
MRKNT1::.BLKL	MRKSIZ	;Last 4 characters of marker name
	.BLKL	1	;Null marker pointer
MRKPTB::.BLKL	MRKSIZ	;Display pointer for this marker
MRKSTK::.BLKL	MRKSTL	;Marker stack
MRKSTP::.BLKL	1	;Pointer into marker stack
DELIM::	.BLKL	6	;Additional delimiter characters for wordwise tabs
PRERW::	.BLKQ	1	;Pre-set row and column
PRESL::	.BLKL	1	;Pre-set slide
PREDP::	.BLKL	1	;Pre-set display pointer
PREONE::.BLKL	1	;Pre-set one-shot pointer

;Define the terminator mask for terminal input
READ_TERM_MASK::.LONG	16	;Mask size in bytes
		.LONG	10$	;Pointer to mask
10$:		.LONG	-1	;Allow all characters to be terminators
		.LONG	-1
		.LONG	-1
		.LONG	-1

TTY_STATUS_BLOCK::	.BLKL	2
TERMTYPE::	.BLKL	1	;Store the terminal type code here
OLD_CTRL_MASK::	.BLKL	1	;Save old settings of ^T mask

;Define the name string for the console device
SYSDEV::.ASCID	"SYS$INPUT"	;The string itself

TTYDESC::			;Descriptor block for logical name translation
TTYLEN::.LONG	63		;Length of block
TTYADDR::.LONG	TTYNAM		;The address of the buffer
TTYNAM::.BLKB	63		;The buffer itself

TTCHAN::.BLKW	1		;The TTY channel number
MBX_CHAN::.BLKW	1		;The channel for the broadcast mailbox

SET_CHAR_BUFF::	.LONG	16	;Length of terminal characteristics
		.LONG	SETCHBF	;Point to the buffer
SETCHBF::	.BLKB	16	;Store the terminal characteristics here
SETCHLEN::	.BLKL	1	;Returned length of terminal characteristics
SAVE_TTY_BITS::	.BLKQ	1	;Storage for original terminal characteristics
		.BLKL	1

DEC_STRING::	.BLKB	8	;Store packed-to-decimal ascii string here
TMPSTR::	.BLKL	2		;Store packed decimal string here (for PUTNUM)

EXITBLOCK::			;Control block for exit handler
	.LONG	0		;System uses this for pointer
	.ADDRESS RESTORE_TTY	;Address of exit handler
	.LONG	1		;Number of arguments
	.ADDRESS STATUS		;Point to the status code
STATUS:	.BLKL	1		;Status code from $EXIT

ERRCTR::.BLKL	1		;Index into ERRCOD block
ERRPTR::.BLKL	1		;Byte pointer for error messages
ERRCOD::.BLKL	5		;Error codes (PUTSTE routine)

;NOTE: DON'T YOU DARE PUT ANYTHING BETWEEN NEWMSG: AND FILSPC!!!
NEWLEN::.BLKW	1	;Store the comment characters here (language dependent)
NEWMSG::.ASCII	/This file is /
FILSPC::.BLKB	100	;File specs (SETFIL)
FSPLEN::.BLKL	1	;Store length of filespec here
FSPTYP::.BLKL	1	;Store the file type here
FSPTYP_SIZE::.BLKL 1	;Number of characters in the file type
DEXT::	.BLKL	1	;Default extension for file
FILSIZ::.BLKL	1	;Size of file, in bytes
OUTSIZ::.BLKL	1	;Size of file being output
INJFN::	.BLKB	1	;Indicator that a file has been set up
OLDSPC::.BLKB	100	;Old file specs, from last SETFIL
OLDLEN::.BLKL	1	;Length of old filespec
OLDTYP::.BLKL	1	;File type of the old file
OLDTYP_SIZE::.BLKL 1	;Number of characters in the old file type
SVASPC::.BLKB	100	;Saved alternate file specs
SVALEN::.BLKL	1	;Store length of saved alternate filespec here
SVATYP::.BLKL	1	;Store the file type of saved alternate here
SVATYP_SIZE::.BLKL 1	;Number of characters in the saved alternate file type
SVAFLG::.BLKL	1	;Store the saved flags here
SVADSP::.BLKL	1	;Store the saved display pointer here
SVASL::	.BLKL	1	;Store saved slide value here
SVARW::	.BLKQ	1	;Store old row and column numbers here
NEWSPC::.BLKB	100	;New filespec - from /OUT: switch
OUTFLG::.BLKB	1	;-1=must parse NEWSPC into FILSPC; 1=parse in progress
CHGSPC::.BLKB	1	;-1 = filespecs have changed (by /O: switch)
MAXLRL::.BLKW	1	;Size of the longest record
SAVE_PROT::	.BLKW	1	;Save file prot here during incremental saves
REC_ATT::	.BLKB	1	;Save the record attributes here

.ALIGN	LONG
;Define the file access block for input
INPUT_FAB::	$FAB	FNA=FILSPC,FNS=100,NAM=MAIN_NAM,ALQ=0,FAC=<BIO,GET>,-
			XAB=MAIN_XAB

MAIN_NAM::	$NAM	ESA=REAL_NAME,ESS=100,RSA=RESULT_NAME,RSS=100

MAIN_XAB::	$XABFHC	NXT=PROT_XAB ;Define the file header characteristics block

PROT_XAB::	$XABPRO

REAL_NAME::	.BLKB	100	;Storage for resulting file name
RESULT_NAME::	.BLKB	100	;Storage for actual file name

INPUT_RAB::	$RAB	FAB=INPUT_FAB,RAC=SEQ,ROP=RAH,-
			UBF=BUFFER
OUTPUT_FAB::	$FAB	FNA=FILSPC,FNS=100,NAM=MAIN_NAM,ALQ=0,FAC=<BIO,PUT>,-
			XAB=OUTPUT_XAB

OUTPUT_RAB::	$RAB	FAB=OUTPUT_FAB,RAC=SEQ

OUTPUT_XAB::	$XABPRO	NXT=OUTPUT_FHC

OUTPUT_FHC::	$XABFHC

HELP_FAB::	$FAB	FNM=<SYS$HELP:SEDONL.HLP>,FAC=<BIO,GET>

HELP_RAB::	$RAB	FAB=HELP_FAB,RAC=SEQ,USZ=1536,UBF=PIKBUF+PCBSIZ-1536

;File access blocks for SED.INI
INI_FAB::	$FAB	FAC=<BIO,GET>,XAB=INI_XAB
INI_RAB::	$RAB	FAB=INI_FAB,RAC=SEQ,UBF=PIKBUF

INI_XAB::	$XABFHC		;File header characteristics block

;File access blocks for execute files
XCT_FAB::	$FAB	FNA=XCTFIL,FAC=<BIO,GET>,DNM=<.XCT>,XAB=XCT_XAB
XCT_XAB::	$XABFHC
XCT_RAB::	$RAB	FAB=XCT_FAB,RAC=SEQ
XCTFIL::.BLKB	100

END_INI::	.BLKL	1	;Store ending address of SED.INI

INI_NAM_1::	.ASCII	/SYS$LOGIN:/
INI_NAM_2::	.ASCII	/SED.INI/
INI_LEN_1==.-INI_NAM_1
INI_LEN_2==.-INI_NAM_2
INIFLG::.BLKL	1

;File access blocks for journal file
.ALIGN	LONG
JRN_FAB::	$FAB	FNM=<SYS$LOGIN:SEDJRN.TMP>,NAM=JRN_NAM,-
			FAC=<PUT,GET,BIO>,ORG=SEQ,RFM=STM

JRN_RAB::	$RAB	FAB=JRN_FAB,RAC=SEQ

JRN_NAM::	$NAM	RSA=JRN_FNAME,RSS=100
JRN_FNAME::	.BLKB	100	;Storage for resulting journal file name

PAGE_RANGE_TABLE::	.BLKL	2	;Store arguments for $CRETVA and $DELTVA

RESCAN_DESC::	.WORD	100		;Length of the command string
		.BYTE	DSC$K_DTYPE_T	;Text descriptor
		.BYTE	DSC$K_CLASS_S	;Fixed length
		.ADDRESS RESCAN_LINE

RESCAN_LINE::	.BLKB	100		;Re-scanned command line
RESCAN_LENGTH::	.BLKW	1		;Length of returned string

;String descriptor for push command argument
PUSH_DESC::	.WORD	100		;Length of command string
		.BYTE	DSC$K_DTYPE_T	;Text descriptor
		.BYTE	DSC$K_CLASS_S	;Fixed length
		.ADDRESS PUSH_COMMAND

PUSH_COMMAND::	.BLKB	100		;Argument for PUSH command

;String descriptor for command or program to be run on exit
PROG_BLOCK::	.WORD	100		;Length
		.BYTE	DSC$K_DTYPE_T	;Text
		.BYTE	DSC$K_CLASS_S	;Fixed length
		.ADDRESS PROG_NAME	;Address of the string
PROG_NAME::	.BLKB	100		;Buffer for command or program name
PROG_FLAG::	.BLKB	1		;0=run program; -1=do command
DEBUG_FLAG::	.BLKB	1		;-1=run in debug mode
SEDTERM::	.ASCID	/SED_TERMINAL/	;Logical name for terminal type translation
GOBLK::		.ASCID	/SYS$BYU:COMPIL/
FILESPEC_DESC::	.ASCID	/SED$FILESPEC/	;Name of symbol for storing default filespec
OLDSPEC_DESC::	.ASCID	/SED$OLDSPEC/	;Name of symbol for storing old filespec
SYMBOL_DESC::	.WORD	0		;Length
		.BYTE	DSC$K_DTYPE_T	;Text
		.BYTE	DSC$K_CLASS_S	;Fixed length
		.ADDRESS PIKBUF+PCBSIZ-400
SYM_BUFF_LEN::	.BLKL	1		;Store length of string returned for the symbol

ERROR_CODE::	.BLKL	1		;Store error code here for $GETMSG
ERROR_MESS_LENGTH::	.BLKW	1	;Store length of returned error msg
ERROR_DESCR::	.WORD	80		;Length of the error buffer
		.BYTE	DSC$K_DTYPE_T	;Text descriptor
		.BYTE	DSC$K_CLASS_S	;Fixed length
		.ADDRESS ERROR_MESSAGE
ERROR_MESSAGE::	.BLKB	80		;Store system error messages here
		.BYTE	0		;Extra byte at the end

SAVERW::.BLKL	2	;Old row and column ACs
SAVEDP::.BLKL	1	;Old display pointer
SAVESL::.BLKL	1	;Old slide offset
SAVEFG::.BLKL	1	;Old flag word

EEEPTR::.BLKL	1	;Pointer into extension table
;General data

TABLEN::.LONG	8	;Length of an entire tab
TABSIZ::.BLKL	1	;Length of tab that cursor points to
TABSPC::.BLKL	1	;Number of spaces to left of cursor, if it's in a tab
TABPTR::.BLKL	1	;Pointer to tab, in file buffer
TABTBL::.BLKL	5	;Table of settable tabs
COMAND::.BLKQ	1	;Command sequence from terminal
SAVEAC::.BLKL	13	;Place to save ACs on exit, in case of ree
SAVFLG::.BLKL	1	;Saved terminal flags
TEMP::	.BLKL	1
	.BYTE	0	;Terminate the string
GTKTMP::.BLKL	2	;Save address to change protection on
LPP.0::	.BLKL	1	;Saved lines per page
LPP.1::	.BLKL	1	;Lines per page - 1
LPP.2::	.BLKL	1	;Number of bottom line (next to bottom if NEL set)
CPL.0::	.BLKL	1	;Saved characters per line
CPL.1::	.BLKL	1	;Characters per line - 1
LMARGN::.BLKL	1	;Left margin for type-in indent
RMARGN::.BLKL	1	;Right margin for type-in wraparound
PARIND::.BLKL	1	;Paragraph indent (for justify command)
LINROL::.BLKL	1	;Lines per roll
HOMPOS::.BLKL	1	;Row of screen where home is (non-0 only for windowing)
SAVRUP::.BLKL	1	;Roll-up sequence (saved while there's windowing)
SAVRLD::.BLKL	1	;Ditto roll-down sequence
SAVILN::.BLKL	1	;Ditto insert-line sequence
SAVDLN::.BLKL	1	;Ditto delete-line sequence
SAVCPG::.BLKL	1	;Ditto clear-to-eop sequence
SAVLPP::.BLKL	1	;Ditto number of lines per page
CHRCUR::.BLKB	1	;Character at the cursor position, blipped
CHRCNT::.BLKL	1	;Character counter
TBFSIZ::.BLKL	1	;Number of characters in the TYPE buffer
SAVPOS::.BLKL	2	;Cursor position saved on ENTER
SVPMRK::.BLKL	3	;Cursor position saved when mark command is typed
TTYBUF::.BLKB	1	;Character buffer for terminal input
ECHBUF::.BLKB	1	;Character buffer for echoing to terminal
TYPCHR::.BLKB	1	;Character typed user during a display
WRTNUM::.BLKL	1	;Number of characters to null out (WRTNUL)
NUMCHR::.BLKL	1	;Number of characters to deal with (MAKSPC, &C)
NUMWDS::.BLKL	1	;Number of words to deal with (MAKSPC, &C)
NUMBYT::.BLKL	1	;Number of bytes to add at end of buffer
NUMNUL::.BLKL	1	;Number of extra nulls put in
CHARAC::.BLKB	1	;Character to deal with (in MAKSPC, &C)
MAKPTR::.BLKL	1	;Pointer to last real char added by MAKSPC &C.
ADJWRD::.BLKL	1	;Longword for MAKSPC &C to adjust
SPCCNT::.BLKL	1	;Count of characters moved by SPCBUF
SQZCNT::.BLKL	1	;Count of commands remaining until next SQUEZW
DISPPT::.BLKL	1	;Pointer to last line; set by DISPLL
MAKLNS::.BLKL	1	;Number of <CRLF>s in pick or close buffer
RSCANF::.BLKB	1	;Flag - set if user gave a file in the run command
SAVCPT::.BLKL	1	;CHRPTR saved when enter is typed
MRKPTR::.BLKL	1	;Mark pointer, for PICK and CLOSE-LINES
MRLPTR::.BLKL	1	;Saved LINPTR for ditto
MRCPTR::.BLKL	1	;Saved CHRPTR for ditto
ISVNUM::.BLKL	1	;Number of commands between incremental saves
SAVNUM::.BLKL	1	;Number of typein characters between inc'l saves
ISVCNT::.BLKL	1	;Command incremental save counter
SAVCNT::.BLKL	1	;Typein incremental save counter
INDFLG::.BLKL	1	;Flag to see if indirect file needs to be read again
MFLPTR::.BLKL	1	;Pointer to start of next file in nnnSED.TMP
MFLPT0::.BLKL	1	;Ditto, alternate file
MFLPT1::.BLKL	1	;Ditto, current file
STTFLG::.BLKL	1	;Non-zero == initializing (holds width & length for later)
IDFLG::	.BLKB	1	;Non-zero == save spec/date/user tag at top of file
TAGFLG::.BLKL	2	;Non-zero == comment characters to use with ID tag
TAGFG1::.BLKL	1	;  FLG/ starting comment chars; FG1/ ending ditto
TIME_DESC::	.WORD	20	;Descriptor for date-time buffer
		.BYTE	DSC$K_DTYPE_T ;Text descriptor
		.BYTE	DSC$K_CLASS_S ;Fixed length
		.ADDRESS EDIT_TIME
EDIT_TIME::	.BLKB	20	;Store time edit ended here (for /ID)
		.BYTE	0	;End it with a null
;Argument block for $GETJPI to get the user's name
JPI_ITEMS::	.WORD	12	;Length of buffer
		.WORD	JPI$_USERNAME
		.ADDRESS USERNAME
		.LONG	0
USERNAME::	.BLKB	12	;Store the username here (for /ID)
		.BYTE	0	;End it with a null

;Various buffers

PUTPTR::.BLKL	1	;Pointer, for MAKSPC, to close or pick buffer
PTMBLK::.BLKL	1	;Block number to be read by MAKSPC
MAKCNT::.BLKL	1	;Count of characters to insert, for MAKSPC
PUTJFN::.BLKL	1	;Address of pick or close RAB used in MAKSPC
DELCNT::.BLKL	1	;Count of characters in the delete buffer
DELBUF::.BLKB	160	;Buffer for stuff deleted by ^DS, ^DW, ^DC, ^EL
.ALIGN LONG
PIK_FAB::	$FAB	FNA=PIKNAM,FNS=19,FAC=<BIO,GET,PUT>,RFM=STM,FOP=TMD
PIK_RAB::	$RAB	FAB=PIK_FAB,RAC=SEQ
PIKNAM::.ASCII	/SYS$SCRATCH:/
;PKNMINDX::	.BLKB	4	;Store index portion of runners PID here
	.ASCIZ	/PIK.TMP/
PIKCNT::.BLKL	1	;Count of characters in the pick buffer
PIKOPN::.BLKL	1	;Pick file open flag - number of block just written or read
PIKJFN::.BLKL	1	;JFN FOR PICK FILE ON DISK (GENERATED ON OVERFLOW)
.ALIGN	WORD		;Must start on word boundary for SED.INI processing
PIKBUF::.BLKL	PCBSIZ	;Pick buffer (PICK, PUT)
	.BLKL	1	;Zero at the end of pick buffer
.ALIGN LONG
CLS_FAB::	$FAB	FNA=CLSNAM,FNS=19,FAC=<BIO,GET,PUT>,RFM=STM,FOP=TMD
CLS_RAB::	$RAB	FAB=CLS_FAB,RAC=SEQ
CLSNAM::.ASCII	/SYS$SCRATCH:/
;CLSMINDX::	.BLKB	4	;Store index portion of runners PID here
	.ASCIZ	/CLS.TMP/
CLSCNT::.BLKL	1	;Count of characters in the close buffer
CLSOPN::.BLKL	1	;Close file open flag - number of block just written or read
CLSJFN::.BLKL	1	;JFN FOR CLOSE FILE ON DISK (GENERATED ON OVERFLOW)
CLSBUF::.BLKL	PCBSIZ	;Close buffer (CLOSELN, PUT)
	.BLKL	1	;Zero at the end of close buffer

TYPBUF::.BLKB	TYPSIZ	;Buffer for outputting to terminal
	.BLKB	40	;Overflow for type buffer

XCTKEY::.BLKQ	XBFNUM	;Sequences given by terminal keys which invoke buffers
XCTNAM::.BLKQ	XBFNUM-1 ;Execute buffer names
	.QUAD	^X0100000000000000 ;No-name buffer (marked in use)
XCTADR::.BLKL	XBFNUM	;Pointers to execute buffers
XCFPTR::.BLKL	1	;Pointer to start of unused free space
XCTOVF::.BLKL	1	;Pointer to end of execute free space
XCTFRE::.BLKB	XCFSIZ	;Free space for execute buffers

PARPTR::.BLKL	1	;Pointer into parameter buffer
PARBUF::.BLKB	PARBLN+1 ;Parameter buffer
PARG1::	.BLKL	1	;Storage areas for converted parameters
PARG2::	.BLKL	1

LINPTR::.BLKL	1	;Pointer to start of line
CHRPTR::.BLKL	1	;Pointer to character at cursor
DISPTR::.BLKL	1	;Pointer to first character displayed
BOTPTR::.BLKL	1	;Pointer to start of last line of screen

JOURNL::.BLKB	513	;Journal buffer
JRNENP::.BLKL	1	;Pointer to end of the current buffer portion
JRNPTR::.BLKL	1	;Pointer into journal buffer
JRNTMP::.BLKQ	1	;Temporary for saving command mnemonic
JRNDSK::.BLKL	1	;Off if writing disk block 1
JRNCRE::.BLKB	1	;-1 if file being created at startup
JRNBIT::.BLKL	1	;Journaling: -1 == Do first file write
			;Recovering: -1 == Start journaling when done
JRNFLG::.BLKL	1	;Flag: recover journal, then -1 == end of file
JRNFIL::.ASCIZ	/SEDJRN.TMP/
LNGSLP::.BLKB	1	;Flag for long sleep on error messages
SNZVAL::.BLKL	1	;Save the delta time for the sleeps here
	.LONG	-1	;Finish off the quad word
KEYPAD::.BLKB	1	;KEYPAD switch
MSGFLG::.BLKB	1	;/MESSAG setting
FNCFLG::.BLKB	1	;/FENCE setting
.ALIGN	LONG
	.WORD	0
	.BYTE	CR,LF	;Nonzero, non-odd word to precede buffer
;Define the routines not yet implemented

BUFFER::
.MACRO TEXT2
.ASCII \                Hi!  This is SED, the full screen text editor.\<CR><LF>
.ASCII <CR><LF>
.ASCII \Text editing with SED is easy, fast, and natural.  SED lets your terminal's\<CR><LF>
.ASCII \screen become a window through which you can see and edit a text file.  The\<CR><LF>
.ASCII \window is updated immediately as you make changes, so you always see exactly\<CR><LF>
.ASCII \what your file looks like.\<CR><LF>
.ASCII <CR><LF>
.ASCII \NOTE:  You are NOT creating or editing a file at the moment.  To create a file,\<CR><LF>
.ASCII \return to DCL command level (by typing either a CTRL-Z or CTRL-C) and then type\<CR><LF>
.ASCII <CR><LF>
.ASCII \        SED filename.typ=\<CR><LF>
.ASCII <CR><LF>
.ASCII \where "filename.typ" is the name of the file you want to create.  The equal\<CR><LF>
.ASCII \sign (=) is required.  If you want, you can "test drive" any of SED's commands\<CR><LF>
.ASCII \before you exit to DCL, since none of the changes you make to this display will\<CR><LF>
.ASCII \be saved.\<CR><LF>
.ASCII <CR><LF>
.ASCII \If you want to know more about SED, type the DCL command:  HELP SED.  There is\<CR><LF>
.ASCII \also a short tutorial (SYS$DOC:SED.MAN) and a complete reference manual\<CR><LF>
.ASCII \(SYS$DOC:SED.DOC) for SED.  Be sure to read about the /JOURNAL, /SAVE, and\<CR><LF>
.ASCII \/ISAVE options!\<CR><LF>
.ASCII <CR><LF>
.ASCII <CR><LF>
.ASCII <CR><LF>
	.LONG	0,0
.ENDM TEXT2
	TEXT2
BUFFEN==.
	.ALIGN 	PAGE	;Get to a page boundary
EDIT_BUFF_START::.BLKB	MAX_FILE_SIZE ;Leave room for largest file
EDIT_BUFF_END==.-1

GLOB			;Define the needed global symbols

.END