Trailing-Edge
-
PDP-10 Archives
-
tops20v41_execsrcmod
-
exec/execed.mac
There are 47 other files named execed.mac in the archive. Click here to see a list.
; UPD ID= 133, FARK:<5-1-WORKING-SOURCES.EXEC>EXECED.MAC.2, 5-Nov-82 09:40:57 by LOMARTIRE
;Edit 929 - Make error routine at EDLOST: place EDITOR: name in ATMBUF
; UPD ID= 118, SNARK:<5.EXEC>EXECED.MAC.6, 28-Dec-81 11:13:35 by CHALL
;TCO 5.1644 - UPDATE COPYRIGHT NOTICE
; UPD ID= 106, SNARK:<5.EXEC>EXECED.MAC.5, 6-Nov-81 13:31:08 by CHALL
;TCO 5.1606 .EMCSA- ADD SETZM STAYF BEFORE JRST ..CONT
; UPD ID= 78, SNARK:<5.EXEC>EXECED.MAC.4, 2-Oct-81 10:35:03 by CHALL
;TCO 5.1540 - PUT EMACS CODE UNDER EMCSSW (NOT XTND)
; UPD ID= 61, SNARK:<5.EXEC>EXECED.MAC.3, 3-Sep-81 15:16:32 by GROUT
;TCO 5.1488 CHANGE CODE AT EDSWFL TO PARSE SPEC WITH .CMIFI
; UPD ID= 40, SNARK:<5.EXEC>EXECED.MAC.2, 17-Aug-81 09:39:12 by CHALL
;TCO 5.1454 CHANGE NAMES FROM CANDE TO EXECED AND XDEF TO EXECDE
; UPD ID= 1073, SNARK:<5.EXEC>EXECED.MAC.6, 30-Sep-80 14:49:38 by OSMAN
;More 1068 - Change $NAME ($EMACS) to ENAME (EEMACS), GLXLIB conflict on $NAME
; UPD ID= 1068, SNARK:<5.EXEC>EXECED.MAC.5, 30-Sep-80 13:56:06 by HESS
; Check FDB (.FBUSW) for ITS-TECO based editor
; UPD ID= 983, SNARK:<5.EXEC>EXECED.MAC.4, 3-Sep-80 12:43:33 by HESS
; Don't call ERESET for new EMACS invocation
; UPD ID= 550, SNARK:<5.EXEC>EXECED.MAC.3, 23-May-80 13:35:58 by MURPHY
;MAKE CREATE/START USE SAME LOGIC AS IMPLICIT RUN
;<4.1.EXEC>EXECED.MAC.4, 27-Feb-80 08:34:45, EDIT BY OSMAN
;tco 4.1.1090 - Improve error messages
; UPD ID= 199, SNARK:<4.1.EXEC>EXECED.MAC.3, 10-Jan-80 14:01:54 by OSMAN
;tco 4.1.1063 - Make ;X in TV ask for filespec on "EDIT FOO.BAR$" command
;<4.1.EXEC>EXECED.MAC.2, 31-Oct-79 10:08:48, EDIT BY OSMAN
;tco 4.1.1002 - Fix "EDIT /ISAVE:5 FOO.BAR" followed by "EDIT"
;<4.EXEC>EXECED.MAC.45, 3-Oct-79 19:17:34, EDIT BY OSMAN
;USE PREMANENT FREE SPACE FOR DEFAULT STRING INSTEAD OF LARGE EDSVB
;<4.EXEC>EXECED.MAC.44, 12-Sep-79 11:17:31, EDIT BY OSMAN
;REMOVE EDSTK
;<4.EXEC>EXECED.MAC.43, 31-Aug-79 15:50:27, Edit by HESS
; Fix EDIT<CR> when EMACS has been reset
;<HESS.E>EXECED.MAC.11, 20-Aug-79 12:03:51, Edit by HESS
; Add extended features
;<4.EXEC>EXECED.MAC.40, 12-Mar-79 17:54:36, EDIT BY KONEN
;UPDATE COPYRIGHT FOR RELEASE 4
;<4.EXEC>EXECED.MAC.39, 19-Sep-78 11:37:47, EDIT BY HELLIWELL
;CLEAR .JBUFP AFTER RLJFNS AT EDXITB
;<4.EXEC>EXECED.MAC.36, 17-Sep-78 16:11:37, EDIT BY OSMAN
;REMOVE ALL REFS TO CSBUFP
;<4.EXEC>EXECED.MAC.34, 14-Sep-78 14:12:34, EDIT BY OSMAN
;ONLY SEARCH XDEF, TTITLE DOES REST
;<4.EXEC>EXECED.MAC.33, 5-Sep-78 13:49:13, EDIT BY HEMPHILL
;FIX NOISE TEXT FOR EDIT/OPTION:
;<4.EXEC>EXECED.MAC.32, 22-Aug-78 12:44:40, EDIT BY HELLIWELL
;IF NO SAVED ARGS ON "EDIT<CR>", PUT CRLF AT END OF COMMAND
;<4.EXEC>EXECED.MAC.31, 22-Aug-78 11:52:38, EDIT BY HELLIWELL
;DEFAULT EDITOR EXTENSION TO .EXE
;<4.EXEC>EXECED.MAC.29, 21-Aug-78 20:18:14, EDIT BY OSMAN
;REPAIR "EDIT FOO.BAR.SPECIFIC-GENERATION" TO WORK
;<4.EXEC>EXECED.MAC.28, 21-Aug-78 17:30:45, EDIT BY HELLIWELL
;<4.EXEC>EXECED.MAC.27, 21-Aug-78 17:15:38, EDIT BY HELLIWELL
;<4.EXEC>EXECED.MAC.26, 21-Aug-78 17:12:41, EDIT BY HELLIWELL
;<4.EXEC>EXECED.MAC.25, 21-Aug-78 17:03:26, EDIT BY HELLIWELL
;DETERMINE EDITOR TO USE FROM "EDITOR:", DETERMINE PARSE FROM FILENAME
;<4.EXEC>EXECED.MAC.24, 14-Aug-78 15:40:53, Edit by HELLIWELL
;<4.EXEC>EXECED.MAC.23, 14-Aug-78 15:34:39, Edit by HELLIWELL
;ALLOW .CMOFI IF .CMIFI FAILS (I.E. EDIT = CREATE)
;<4.EXEC>EXECED.MAC.22, 14-Aug-78 15:18:00, Edit by HELLIWELL
;REMOVE $TV INDEX AND USE ONLY $NONST
;<4.EXEC>EXECED.MAC.20, 14-Aug-78 09:32:28, EDIT BY OSMAN
;REMOVE "NOSHIP" AROUND CHECK FOR .CMIFI AT EDIT1
;<4.EXEC>EXECED.MAC.19, 14-Aug-78 09:20:07, EDIT BY OSMAN
;MAKE COMMAND LINE ALWAYS SAY "EDIT" WHEN SENT TO EDITOR, NEVER
;"EDI" OR "ED".
;<4.EXEC>EXECED.MAC.18, 13-Aug-78 17:54:05, Edit by HELLIWELL
;CHANGE .CMFIL'S TO .CMIFI
;<4.EXEC>EXECED.MAC.17, 13-Aug-78 15:27:40, Edit by HELLIWELL
;<4.EXEC>EXECED.MAC.16, 13-Aug-78 15:23:59, Edit by HELLIWELL
;<4.EXEC>EXECED.MAC.15, 13-Aug-78 15:14:08, Edit by HELLIWELL
;CONVERT TO "SET EDITOR" FORMAT
;<4.EXEC>EXECED.MAC.14, 2-Aug-78 09:40:45, EDIT BY OSMAN
;PREVENT ERROR ON FIRST EDIT COMMAND AFTER LOGIN
;<4.EXEC>EXECED.MAC.13, 27-Jul-78 14:34:09, Edit by HELLIWELL
;FIX TV COMMAND TO USE .CMIFI TO GET RECOGNITION
;<4.EXEC>EXECED.MAC.12, 13-Jul-78 16:02:00, EDIT BY OSMAN
;ADD MACSYM TO SEARCH MODULES
;<4.EXEC>EXECED.MAC.11, 13-Jul-78 15:55:26, EDIT BY OSMAN
;MAKE EDCNT AND EDPTR LOCAL
;<4.EXEC>EXECED.MAC.10, 23-Jun-78 21:31:32, EDIT BY OSMAN
;REMOVE EDXITA, WAS UNREFERENCED
;<4.EXEC>EXECED.MAC.9, 9-Jun-78 18:17:43, EDIT BY OSMAN
;CHANGE USE OF D TO P5, USE FIELD AND FLDSKP INSTEAD OF COMND EXPLICITLY
;<4.EXEC>EXECED.MAC.8, 13-Jan-78 12:17:20, EDIT BY HELLIWELL
;ADD @ IN UERR ERRTAB(D)
;<4.EXEC>EXECED.MAC.7, 7-Jan-78 14:30:28, EDIT BY HELLIWELL
;<4.EXEC>EXECED.MAC.6, 6-Jan-78 21:09:44, EDIT BY HELLIWELL
;<4.EXEC>EXECED.MAC.5, 6-Jan-78 21:08:20, EDIT BY HELLIWELL
;<4.EXEC>EXECED.MAC.4, 6-Jan-78 21:06:29, EDIT BY HELLIWELL
;<4.EXEC>EXECED.MAC.3, 6-Jan-78 21:00:00, EDIT BY HELLIWELL
;<4.EXEC>EXECED.MAC.2, 6-Jan-78 20:57:07, EDIT BY HELLIWELL
;<4.EXEC>EXECED.MAC.1, 6-Jan-78 20:42:53, EDIT BY HELLIWELL
;CAUSE SAVED ARGUMENT NOT TO CONTAIN GENERATION # IN FILESPEC(S)
SUBTTL T.HESS/TAH 5-JAN-76
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1980,1981,1982 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
SEARCH EXECDE
TTITLE EXECED - CREATE AND EDIT COMMANDS
;PROCESSOR/COMMAND TABLES
;MACRO TO DEFINE ALL EDITOR OPTIONS
DEFINE EDLIST <
ED (EDIT,ARGEDI,ERREDI,ARGCRE,ERRCRE,.EDSOS)
ED (EMACS,ARGOLD,ERROLD,ARGNEW,ERRNEW,.EMCS)
ED (TV,ARGOLD,ERROLD,ARGNEW,ERRNEW,.EDTV)
>
ARGEDI: FLDDB. .CMCFM,,,,,[FLDDB. .CMSWI,,$ETBL,,,[FLDDB. .CMIFI]]
ARGCRE: FLDDB. .CMCFM,,,,,[FLDDB. .CMSWI,,$ETBL,,,[FLDDB. .CMOFI]]
ARGOLD: FLDDB. .CMCFM,,,,,[FLDDB. .CMIFI]
ARGNEW: FLDDB. .CMCFM,,,,,[FLDDB. .CMOFI]
ERREDI: ASCIZ /Invalid switch or input filespec - %?/
ERRCRE: ASCIZ /Invalid switch or output filespec - %?/
ERROLD: ASCIZ /Invalid input filespec - %?/
ERRNEW: ASCIZ /Invalid output filespec - %?/
DEFINE ED (NAME,INF,ERRIN,OUTF,ERROUT,RTN) <
E'NAME:! [ASCIZ "NAME"],,[RTN,,[ERRIN,,INF
ERROUT,,OUTF]]
>
EDTAB: TABLE
EDLIST
TEND
EDELS: 0,,[.EDTV,,[ERROLD,,ARGOLD
ERRNEW,,ARGNEW]]
;**;[929] Insert 8 lines at EDLOST:+0 DML 5-NOV-82
EDLOST: PUSH P,A ;[929] SAVE ERROR CODE FROM GTJFN
MOVE A,.LNSJB ;[929] PLACE FUNCTION CODE FOR LNMST IN A
HRROI B,[ASCIZ/EDITOR/] ;[929] POINTER TO LOGICAL NAME
HRROI C,ATMBUF ;[929] DESTINATION FOR DEFINITION
SETZM ATMBUF ;[929] CLEAR ATMBUF IN CASE OF ERROR
LNMST ;[929] GET DEFINITION OF EDITOR:
ERJMP .+1 ;[929] IGNORE ERROR
POP P,A ;[929] RESTORE ERROR CODE
CMERRX <Can't find editor>
;CREATE COMMAND
.EDITC::TLOA P5,-1
;EDIT COMMAND
.EDIT:: SETZ P5,
TLZ Z,F1!F2 ;CLEAR TEMP FLAGS
TRVAR <EDJFN,EINJFN,EOJFN,EDCNT,EDPTR>
SETZM EINJFN
SETOM EOJFN
UDEXT [GETSAVE()] ;SET UP CJFNBK FOR DEFAULT EXTENSION
MOVX A,GJ%OLD ;OLD FILE ONLY
MOVEM A,CJFNBK+.GJGEN ;SAVE FLAGS
MOVE A,[.NULIO,,.NULIO]
MOVEM A,CJFNBK+.GJSRC ;NO INPUT
MOVEI A,CJFNBK ;LONG GTJFN BLOCK
HRROI B,[ASCIZ /EDITOR:/]
CALL GTJFS ;LOOK FOR IT
JRST EDLOST
MOVEM A,EDJFN ;SAVE EDITOR JFN HERE
MOVE A,JBUFP
MOVEM A,.JBUFP ;SAVE THIS JFN FOR LATER
MOVE A,CSBUFP
MOVE B,EDJFN
MOVX C,FLD(.JSAOF,JS%NAM)
JFNS
MOVEI A,EDTAB ;TABLE OF EDITORS
MOVE B,CSBUFP ;NAME OF EDITOR
TBLUK
TXNN B,TL%EXM ;MATCH?
JRST [ MOVE A,EDJFN ;NO - CHECK FDB(.FBUSW)
MOVE B,[1,,.FBUSW]
MOVEI C,C
GTFDB
HLRZS C ;=> 'TEC',,VERS#
MOVEI A,EDELS ;WHAT TO USE FOR DEFAULT
CAIN C,'TEC'
MOVEI A,EEMACS ;USE EMACS INTERFACE
JRST .+1]
HRRZ A,0(A) ;POINT TO MORE INFO
HLR P5,0(A) ;SAVE ROUTINE ADDRS
HRRZ Q2,0(A) ;INPUT/OUTPUT ARGS
NOISE (FILE)
MOVE A,CMPTR ;GET POINTER TO REST OF COMMAND
MOVEM A,EDPTR ;REMEMBER IT
MOVE A,CMCNT ;GET CURRENT COUNT
MOVEM A,EDCNT ;AND REMEMBER IT
EDIT1: HRRZ B,0(Q2)
SKIPGE P5 ;CREATE?
HRRZ B,1(Q2)
MOVE Q1,CMCNT ;SAVE COUNT JUST BEFORE FILE
CALL FLDSKP ;GET SOMETHING
CAIA ;ON ERROR, CHECK FOR NEW FILE
JRST EDIT1A
JUMPL P5,EDIT2A ;NO OTHER CHOICES IF CREATE
HRRZ B,1(Q2) ;OTHERWISE ALLOW CREATE OPTIONS AS SECOND CHOICE
CALL FLDSKP
JRST EDIT2A ;NO MORE CHANCES
EDIT1A: LDB C,[POINTR <0(C)>,CM%FNC] ;GET CODE USED
CAIN C,.CMCFM ;CR TYPED?
JRST EDAGN ;YES - USE LAST
CAIN C,.CMSWI ;SWITCH?
JRST EDSWT ;YES - PROCESS IT
CAIE C,.CMIFI ;INPUT FILESPEC?
CAIN C,.CMOFI ;OR OUTPUT
JRST EDIT3 ;YES - PROCEDE
EDIT2A: HLRZ A,0(Q2)
SKIPGE P5 ;CREATE?
HLRZ A,1(Q2)
UERR (A) ;PRINT CORRECT ERROR
EDIT3: SUBM Q1,EDCNT ;COMPUTE -# CHARS IN SWITCHES
MOVEM B,EINJFN ;REMEMBER INPUT JFN
SKIPL P5 ;CREATE COMMAND?
TXNE A,CM%EOC ;NO, ALL DONE?
JRST EDXIT ;YES - EXIT
CALL @0(P5) ;INVOKE ROUTINE TO HANDLE INPUT FILESPEC
JRST EDXIT ;EXIT IF NON-SKIP GIVEN
NOISE (OUTPUT AS)
MOVE B,EINJFN ;GET JFN BACK
SETZM CJFNBK+.GJDIR ;USE STANDARD DEFAULT FOR OUTPUT DIRECTORY
MOVSI C,(1B8) ;FILENAME
CALL EDJFNS
MOVEM A,CJFNBK+.GJNAM
MOVSI C,(1B11) ;EXTENSION
CALL EDJFNS
MOVEM A,CJFNBK+.GJEXT
LDF A,GJ%FOU!GJ%MSG
MOVEM A,CJFNBK
MOVEI B,[FLDDB. .CMCFM,,,,,[ ;DETECT CONFIRMATION, SEE TCO 4.1.1063
FLDDB. .CMFIL]]
CALL FLDSKP ;GET OUTPUT SPEC
CMERRX
LOAD D,CM%FNC,.CMFNP(C) ;SEE WHAT GOT TYPED
CAIN D,.CMCFM ;CONFIRMATION?
JRST EDXIT2 ;YES, NO FILESPEC
MOVEM B,EOJFN ;SAVE OUTPUT JFN
CALL @1(P5) ;ROUTINE TO HANDLE OUTPUT FILESPEC
JFCL ;NO ALTERNATE PATH
;;; FALL INTO EDXIT
EDXIT: CONFIRM ;GET COMMAND CONFIRMATION
EDXIT2: MOVE A,CSBUFP ;BUILD DEFAULT STRING IN SCRATCH SPACE
MOVE B,EDPTR ;PUT POINTER TO COMMAND IN AC2
SKIPE C,EDCNT ;ANY SWITCH PART?
JRST [ SOUT ;YES, COPY THE STRING
MOVEI B,.CHSPC ;SEPARATE SWITCHES FROM FILESPEC WITH SPACE
BOUT
JRST .+1]
MOVE C,[FLD(1,JS%DEV)!FLD(1,JS%DIR)!FLD(1,JS%NAM)!FLD(1,JS%TYP)!JS%PAF]
MOVE B,EINJFN ;FIRST FILE
JFNS ;TO STRING
MOVE B,EOJFN ;OUTPUT SPEC?
CAMN B,[-1]
JRST EDXIT1 ;NO
MOVEI B," "
BOUT ;SEPERATE BY SPACE
MOVE B,EOJFN ;GET OUTPUT JFN AGAIN
JFNS ;YES, DO IT TOO
EDXIT1: HRROI B,[ASCIZ /
/]
MOVEI C,0
SOUT ;FINISH SAVED LINE WITH CRLF
CALL PIOFF ;^C WITH STRING REMOVED BUT EDSVB POINTING TO OLD ONE WOULD BE BAD
SKIPE A,EDSVB ;GET POINTER TO SAVED EDIT COMMAND
CALL STREM ;RELEASE OLD STORAGE IF THERE WAS ANY
SETZM EDSVB ;DO NOW SINCE XBUFFS MIGHT FAIL
CALL PION ;ALLOW ^C AGAIN
MOVE A,CSBUFP ;POINT TO CREATED DEFAULT STRING
CALL XBUFFS ;GET SOME PERMANENT SPACE FOR IT
MOVEM A,EDSVB ;REMEMBER POINTER TO NEW DEFAULT STRING
MOVE D,EDPTR ;USE ACTUAL COMMAND STRING THIS TIME
EDXITB: MOVE A,CSBUFP ;CREATE STRING FOR PROGRAM
HRROI B,[ASCIZ /EDIT /]
SKIPGE P5 ;PUT COMMAND NAME IN STRING
HRROI B,[ASCIZ /CREATE /]
MOVEI C,0
SOUT ;START WITH CORRECT COMMAND NAME
MOVE B,D ;USE REST OF COMMAND OR SAVED COMMAND
SOUT
MOVE A,CSBUFP ;GET COMMAND LINE
CALL BUFFS ;SAVE THE STRING
CALL @2(P5) ;ROUTINE TO HANDLE FORK CREATE/START
RET ;ALL DONE - RETURN
MOVEM A,RSPTR ;STORE RESCAN POINTER
CALL RLJFNS ;FLUSH XTRA JFNS
MOVE B,EDJFN ;GET JFN FOR EDITOR FILE
JRST CIN3 ;JOIN IMPLICIT RUN IN EXEC0
REPEAT 0,<
SETZM .JBUFP ;NO LONGER SAVING PROGRAM JFN
MOVEI Q1,ETTYMD ;RESET TTY MODES
CALL LTTYMD
CALL ERESET ;RESET
MOVE A,EDJFN
PUSH P,[..STRT] ;WHERE TO GO
SETZM STAYF ;DON'T STAY AT COMMAND LEVEL
JRST $GET2 ;WHEN THROUGH WITH GET
>
;HANDLE SWITCHES
EDSWT: TLO Z,F2 ;SWITCH SEEN
HRRZ C,0(B) ;DISPATCH ADDRS
JUMPE C,EDSWT1 ;NONE IF ZERO
TXNN A,CM%SWT ;HAVE COLON?
JRST [TYPE <?Switch must have value - >
JRST EDSWT2]
JRST 0(C) ;DISPATCH
EDSWT1: TXNN A,CM%SWT ;COLON TYPED?
JRST EDIT1 ;NO - LOOP BACK
TYPE <?Switch does not allow argument - >
EDSWT2: HLRO B,0(B) ;GET SWITCH NAME
MOVEI C,0
MOVE A,COJFN ;PUT OUT MSG
SOUT ;...
ETYPE<%_>
RET ;COMMAND RETURN
EDSWFL: SKIPA B,[[FLDDB. .CMIFI]] ;GET FILESPEC
EDSWNM: MOVEI B,[FLDDB. .CMNUM,,^D10] ;GET DECIMAL NUMBER
CALL FLDSKP
CMERRX
JRST EDIT1
EDSWST: MOVEI B,[FLDDB. .CMFLD,,,<OPTION NAME .LE. 6 CHARACTERS>]
CALL FLDSKP ;JUST GET ATOM
CMERRX <String required>
JRST EDIT1
EDAGN: TLNE Z,F2 ;GUARANTEE NO SWITCHES
ERROR <Must have filespec>
SKIPN D,EDSVB ;PREVIOUS STRING?
JRST EDAGN1
CALL @3(P5) ;ROUTINE TO HANDLE "EDIT<CR>"
RET ;DONE - RETURN
JRST EDXITB ;JOIN COMMON CODE
EDAGN1: TYPE <%No saved filespec
>
HRROI D,[ASCIZ /
/]
JRST EDXITB ;YES, PROCEED
;SWITCH DEFINITIONS
DEFINE NAMES <
X (BAK,0)
X (C128,0)
X (C64,0)
X (DECIDE,0)
X (DPY,0)
X (EXPERT,0)
X (INCREMENT:,EDSWNM)
X (ISAVE:,EDSWNM)
X (LOWER,0)
X (M33,0)
X (M37,0)
X (NOBAK,0)
X (NODECIDE,0)
X (NONSEPARATORS,0)
X (NONUMBER,0)
X (NOVICE,0)
X (NUMBER,0)
X (OLD,0)
X (OPTION:,EDSWST)
;X (PASSWORD,0)
X (PLINES:,EDSWNM)
X (R,0)
X (READONLY,0)
X (RONLY,0)
X (RUN:,EDSWFL)
X (SAVE:,EDSWNM)
X (SEPARATORS,0)
X (SEQUENCE,0)
X (START:,EDSWNM)
X (STEP:,EDSWNM)
X (UNSEQUENCE,0)
X (UPPER,0)
X (WINDOW:,EDSWNM)
>
DEFINE X(A,B) <[ASCIZ \A\],,B>
$ETBL: 0
NAMES
..Z==.
RELOC $ETBL
..Z-$ETBL-1,,..Z-$ETBL-1
RELOC ..Z
;SUBROUTINES
;THIS ROUTINE PRESERVES JFN IN B...
EDJFNS: STKVAR <SAVBBB>
MOVE A,CSBUFP ;POINTER TO STRING SPACE
JFNS
MOVE A,CSBUFP ;GET POINTER TO STRING JUST CREATED
MOVEM B,SAVBBB
CALL BUFFS ;SAVE THE STRING
MOVSI B,774000 ;MASK FOR FIRST CHARACTER
TDNN B,(A) ;SEE IF STRING IS NULL
MOVEI A,0 ;RETURN 0 INSTEAD OF POINTER IF FIELD IS NULL
MOVE B,SAVBBB
RET ;...
;AUXILLARY ROUTINES FOR VARIOUS EDITORS
;ENTRY IS AT OFFSET:
; 0 := EDIT "INFILE" (NON-SKIP TO IGNORE OUTPUT SPEC)
; 1 := EDIT "INFILE" "OUTFILE"
; 2 := JUST BEFORE FORK CREATE (EDITOR IN EDJFN), C(A) := RESCAN PNTR
; 3 := EDIT<CR> TYPED
NOEMCS,<
.EMCS: >
.EDSOS:
.EDTV: RSKP ;0 - INPUT FILE
RSKP ;1 - OUTPUT FILE
RSKP ;2 - FORK CREATE
RSKP ;3 - EDIT<CR>
EMCS,<
.EMCS: .EMCSI ;0 - INPUT FILE (OR CREATE)
RSKP ;1 - OUTPUT FILE (CAN'T HAPPEN)
.EMCSF ;2 - FORK CREATE
.EMCSA ;3 - EDIT AGAIN
;COME HERE WITH FILESPEC JFN IN EINJFN
.EMCSI: SKIPL P5 ;CREATE?
RET ;NO - DONE FOR NOW
MOVE A,EINJFN ;GET JFN
MOVE B,[7B5+OF%WR] ;CREATE A FILE
OPENF
JRST CERR
TXO A,CO%NRJ ;KEEP JFN
CLOSF ;FILE NOW EXISTS
JFCL
RET
;HERE TO RE-EDIT OLD FILE
.EMCSA: SKIPG A,EDFORK ;HAVE AN EDITOR FORK?
JRST EMCSA1 ;NO - CHECK IF PREVIOUS FILE
RFSTS ;SEE IF FORK IS AROUND
ERJMP [SETOM EDFORK ;NO FORK
JRST EMCSA1]
TXZ A,RF%FRZ ;MUST BE FROZEN
HLRZS A
CAIN A,.RFFPT ;CHECK VALID TERMINATION
JRST [ MOVE A,EDFORK
CALL KEFORK ;KILL IT OFF
SETOM EDFORK
JRST EMCSA1] ;HANDLE IF NO FORK
MOVE A,EDFORK
MOVEM A,FORK ;MAKE EDITOR CURRENT FORK
MOVEM A,RUNFK
SETZM STAYF ;DON'T STAY AT COMMAND LEVEL
JRST ..CONT ;AND RESUME IT
;NO FORK FOUND - TRY FOR KNOWN FILE
EMCSA1: MOVE B,EDSVB ;POINT TO SAVED FILESPEC
MOVX A,GJ%OLD!GJ%SHT
GTJFN
JRST [ CALL PIOFF ;^C WITH STRING REMOVED BUT EDSVB NON-0 WOULD BE BAD
SKIPE A,EDSVB ;FILE GONE
CALL STREM ;SO FREE UP SPACE COMMAND STRING TOOK UP
SETZM EDSVB
CALL PION
ERROR <Previous edit file gone>]
CALL JFNSTK ;STACK IT
MOVEM A,EINJFN ;SAVE INPUT JFN
MOVE A,CSBUFP
HRROI B,[ASCIZ "EDIT "]
MOVEI C,0
SOUT ;BUILD RESCAN LINE
MOVE B,D ;SAVED FILESPEC
SOUT
MOVE A,CSBUFP ;SAVE STRING
CALL BUFFS
;;;FALL INTO EMCSF
;CREATE AN EDIT FORK AND START EDITOR
.EMCSF: MOVEM A,RSPTR ;SET UP FOR RESCAN
SKIPG A,EDFORK ;ALREADY HAVE A FORK?
JRST EMCSF1 ;NO - CREATE ONE
CALL KEFORK ;YES - FLUSH IT
SETOM EDFORK
EMCSF1: CALL ECFORK ;MAKE A NEW FORK
MOVX B,FK%KPT ;MARK IT KEPT
IORM B,SLFTAB(A)
MOVE B,EDJFN ;JFN ON EDITOR
CALL SFKNAM ;SET ITS NAME
MOVE A,EDJFN
HRL A,FORK ;GET PROGRAM INTO FORK
GET
ERJMP GETILI
CALL RLJFNS ;FLUSH XTRA JFNS
SETZM .JBUFP ;NO LONGER SAVING PROGRAM JFN
SETZM STAYF ;DON'T STAY AT COMMAND LEVEL
MOVE A,FORK
MOVEM A,EDFORK ;SET EDITOR FORK
MOVEI B,0 ;OFFSET 0 FOR START
JRST ..STCR
> ;FTEMCS
END