Google
 

Trailing-Edge - PDP-10 Archives - bb-m081u-sm_t20_v7_0_23_exec_src_mod - exec/execpr.mac
There are 46 other files named execpr.mac in the archive. Click here to see a list.
; Edit= 4417 to EXECPR.MAC on 12-Jan-89 by WONG, for SPR #22042
;Add code to support @SET DEFAULT PRINTER /REMOTE-PRINT: command and fix some
;bugs in routine SRPPTR: which deals with validating the arguments to the @SET
;REMOTE PRINTER command.
; Edit= 4412 to EXECPR.MAC on 13-Dec-88 by RASPUZZI
;Add new commands, features and support for security enhancements.
; UPD ID= 4126, RIP:<7.EXEC>EXECPR.MAC.10,   7-Mar-88 18:25:20 by GSCOTT
;TCO 7.1255 - Update copyright notice.
; UPD ID= 4100, RIP:<7.EXEC>EXECPR.MAC.9,  18-Feb-88 15:56:18 by RASPUZZI
;TCO 7.1232 - Add NEBPID so the EXEC remembers NEBULA's PID.
; UPD ID= 79, RIP:<7.EXEC>EXECPR.MAC.8,   1-Dec-87 15:02:25 by RASPUZZI
;TCO 7.1152 - Remove WLDPAG and use BUF0 instead to save a page of storage.
; UPD ID= 70, RIP:<7.EXEC>EXECPR.MAC.7,  17-Nov-87 15:07:59 by RASPUZZI
;TCO 7.1137 - Add storage for SYS US* or when user does not exist on
;             the local system.
; UPD ID= 42, RIP:<7.EXEC>EXECPR.MAC.6,  22-Oct-87 11:04:15 by RASPUZZI
;TCO 7.1076 - Add storage for cluster SYSTAT and block storage for use in
;             parsing CI node names. Also add INFBLK when the EXEC needs
;             to do an INFO% JSYS.
; UPD ID= 35, RIP:<7.EXEC>EXECPR.MAC.5,  20-Oct-87 15:19:28 by EVANS
; UPD ID= 23, RIP:<7.EXEC>EXECPR.MAC.4,  22-Sep-87 11:44:51 by EVANS
; More TCO 7.1061 - Fill in TCO numbers around edits and add header line.
; UPD ID= 14, RIP:<7.EXEC>EXECPR.MAC.3,  22-Sep-87 10:46:57 by EVANS
; TCO 7.1061 - Implement SET REMOTE-PRINTING CHARACTERISTIC and INFORMATION
;		(ABOUT) REMOTE-PRINTING.
; *** Edit 3044 to EXECPR.MAC by EVANS on 15-Jul-86
; Implement LOGINF to tell when we are acessing POBOX: and mail-checking during
; login; have MALCHK test it and return to log-in code on a JSYS error.
; *** Edit 3040 to EXECPR.MAC by EVANS on 24-Jun-86, for SPR #21170
; Implement MAIL-WATCHing based on directory number, as users can now send mail
; to non-username directories on POBOX:
; *** Edit 3033 to EXECPR.MAC by RASPUZZI on 23-Apr-86
; Fix GTJFN block (CJFNBK) so that the LOC is removed and each word in the
; GTJFN block are defined explicitly. This will remove CTRPTR, DICT, and CSBUFP
; from the GTJFN block. They are there erroneously.
; Edit 3017 to EXECPR.MAC by EVANS on 15-Oct-85 (TCO none)
; Prevent a SET DEFAULT (GALAXY-related) command from echoing twice if issued
; from a TAKE file with subcommand ECHO. QAR 838277
; UPD ID= 269, SNARK:<6.1.EXEC>EXECPR.MAC.21,  28-Jun-85 08:55:30 by PRATT
;More TCO 6.1.1404 - Add CEVMSD for setting default insert/overstrike mode
; UPD ID= 264, SNARK:<6.1.EXEC>EXECPR.MAC.20,  25-Jun-85 12:57:13 by PRATT
;More TCO 6.1.1404 - Make CETTMD real storage, not just a STKVAR location
; UPD ID= 262, SNARK:<6.1.EXEC>EXECPR.MAC.19,  22-Jun-85 13:09:04 by PRATT
;TCO 6.1.1471:
;   Fix problem with symbols relocating into the middle of the command 
;   editor buffer area which produced all sorts of wierd bugs
; UPD ID= 253, SNARK:<6.1.EXEC>EXECPR.MAC.18,  19-Jun-85 23:03:06 by PRATT
;More TCO 6.1.1404 - Use some new buffer length definitions
; UPD ID= 237, SNARK:<6.1.EXEC>EXECPR.MAC.17,  10-Jun-85 08:44:56 by DMCDANIEL
; UPD ID= 206, SNARK:<6.1.EXEC>EXECPR.MAC.16,  24-May-85 14:14:13 by EVANS
;TCO 6.1.1404 - Add command editor stuff.
; UPD ID= 195, SNARK:<6.1.EXEC>EXECPR.MAC.15,  10-May-85 15:46:00 by EVANS
;TCO 6.1.1362 - Add SAVTAK for holding TAKLEN's value when logging out.
; UPD ID= 178, SNARK:<6.1.EXEC>EXECPR.MAC.14,   3-May-85 08:31:58 by DMCDANIEL
;Update copyrights for 6.1.
; UPD ID= 136, SNARK:<6.1.EXEC>EXECPR.MAC.13,  14-Mar-85 10:55:29 by PRATT
;TCO 6.1.1257 - If DBGEXC is set, make ^T display exec pc's during commands
; UPD ID= 120, SNARK:<6.1.EXEC>EXECPR.MAC.12,   4-Jan-85 15:47:49 by EVANS
;TCO 6.1.1107 - Add CFGBLK for INFO CLUSTER
; UPD ID= 113, SNARK:<6.1.EXEC>EXECPR.MAC.11,  12-Dec-84 14:17:39 by PRATT
;More TCO 6.1.1085 - Changes for SET STATUS-WATCH
; UPD ID= 106, SNARK:<6.1.EXEC>EXECPR.MAC.10,  11-Dec-84 15:23:20 by MOSER
;TCO 6.1.1077 - ADD STAT STUFF
; UPD ID= 91, SNARK:<6.1.EXEC>EXECPR.MAC.9,  15-Nov-84 08:29:44 by PRATT
;TCO 6.1.1053 - Edit commands break and copyright string goes away 
;  when the exec is saved without it's symbols.
; UPD ID= 84, SNARK:<6.1.EXEC>EXECPR.MAC.7,  12-Nov-84 16:21:34 by MCCOLLUM
;6.1.1044 - BYTSIZ
; UPD ID= 65, SNARK:<6.1.EXEC>EXECPR.MAC.6,  12-Nov-84 03:51:04 by MERRILL
;TCO 6.1.1042 - Update for the latest PCL we have
;  Add PCONCE for PROMPT error recovery
;  Add PCLNAM, PCCIPF, ORIFLG, PCFORK, PCRNFK
;  ORIFLG and PCFORK
; UPD ID= 45, SNARK:<6.1.EXEC>EXECPR.MAC.5,  30-Oct-84 13:54:17 by MCCOLLUM
;TCO 6.1.1025 - Add SPRSED word for SUPERSEDE flag in COPY command.
; UPD ID= 40, SNARK:<6.1.EXEC>EXECPR.MAC.4,  26-Oct-84 13:36:16 by EVANS
;TCO 6.1.1027 - Add LGORET and FSTOUT for LOGOUT.CMD with /FAST option.
; UPD ID= 10, SNARK:<6.1.EXEC>EXECPR.MAC.3,  29-Sep-84 16:13:41 by PRATT
;TCO 6.1.1016 - Add storage for JFN-WATCH command
; UPD ID= 7, SNARK:<6.1.EXEC>EXECPR.MAC.2,  29-Sep-84 15:58:22 by PRATT
;TCO 6.1.1012 - Add storage for unformatted TYPE
; UPD ID= 429, SNARK:<6.EXEC>EXECPR.MAC.22,  23-Jul-84 14:21:29 by SANTIAGO
;MORE FOR TCO 6.2129
; UPD ID= 421, SNARK:<6.EXEC>EXECPR.MAC.21,  17-Jul-84 14:30:15 by SANTIAGO
;TCO 6.2129 - Add TMPFDB storage for INFORMATION DISK-USAGE
; UPD ID= 358, SNARK:<6.EXEC>EXECPR.MAC.20,  16-Dec-83 11:48:55 by TSANG
;MORE FOR TCO 6.1731.
; UPD ID= 340, SNARK:<6.EXEC>EXECPR.MAC.19,  20-Nov-83 19:45:11 by PRATT
;TCO 6.1870 - Get rid of code which is under NONEWF. Remove NEWF's.
; UPD ID= 319, SNARK:<6.EXEC>EXECPR.MAC.18,   8-Nov-83 13:48:56 by PRATT
;TCO 6.1847 - FSTLGN
; UPD ID= 247, SNARK:<6.EXEC>EXECPR.MAC.17,  15-Jan-83 19:26:45 by CHALL
;TCO 6.1464 - UPDATE COPYRIGHT NOTICE
; UPD ID= 231, SNARK:<6.EXEC>EXECPR.MAC.16,  14-Jan-83 14:55:35 by TSANG
;TCO  6.1459 - Save AC .FP during subcommand processing for use in error
; recovery.
; UPD ID= 229, SNARK:<6.EXEC>EXECPR.MAC.15,  12-Jan-83 15:35:00 by WEETON
;TCO 6.1141 - Add INDQUS, used as a flag between .RUNST and %ETYPE routines.
; UPD ID= 195, SNARK:<6.EXEC>EXECPR.MAC.14,  11-Nov-82 21:50:20 by CHALL
;TCO 6.1369 ADD COPYRIGHT TO THE OBJECT CODE
; UPD ID= 185, SNARK:<6.EXEC>EXECPR.MAC.13,  21-Oct-82 00:17:28 by CHALL
;TCO 6.1323 - ADD EDTFIL FOR EDIT-CLASS COMMANDS
; UPD ID= 178, SNARK:<6.EXEC>EXECPR.MAC.12,   8-Oct-82 18:12:47 by CHALL
;TCO 6.1305 ADD EDTINF, EDTOUF, AND EDTCFM FOR EDIT-CLASS COMMANDS
; UPD ID= 141, SNARK:<6.EXEC>EXECPR.MAC.7,   4-Aug-82 17:27:37 by LEACHE
;TCO 6.1209 Fix JSYS trapping
;<6.EXEC>EXECPR.MAC.5,  9-May-82 03:09:41, Edit by ALMQUIST
;CM156 ORIFLG and PCFORK
; UPD ID= 120, SNARK:<6.EXEC>EXECPR.MAC.6,  20-Apr-82 07:54:59 by CHALL
;TCO 6.1092 MICFRK- MICPAG- MICFPG- PAGEMI- Remove MIC conditionals
; UPD ID= 98, SNARK:<6.EXEC>EXECPR.MAC.4,   8-Jan-82 15:58:29 by CHALL
;TCO 6.1052 - UPDATE COPYRIGHT NOTICE AND DELETE PRE-V4.1 EDIT HISTORY
; UPD ID= 31, SNARK:<6.EXEC>EXECPR.MAC.3,  17-Aug-81 11:25:19 by CHALL
;TCO 5.1454 CHANGE NAMES FROM PRIVS TO EXECPR AND XDEF TO EXECDE
; UPD ID= 2027, SNARK:<6.EXEC>EXECPR.MAC.2,  19-May-81 10:26:35 by PURRETTA
;<6.EXEC>EXECPR.MAC.2, 13-Apr-81 15:25:12, Edit by DK32
;Make some more things survive a Save/Exec, Add PCWAIT
;REMOVE MFRK CONDITIONALS
;<4.EXEC>EXECPR.MAC.1, 23-Dec-80 19:08:56, Edit by DK32
;Programmable Command Language
; UPD ID= 1436, SNARK:<5.EXEC>EXECPR.MAC.15,  15-Jan-81 10:51:26 by OSMAN
;Tco 5.1233 - Make FILE-OPENINGS and JSYS OPENF independent
; UPD ID= 1401, SNARK:<5.EXEC>EXECPR.MAC.14,   6-Jan-81 10:28:00 by OSMAN
;tco 5.1225 - Implement jsys trapping and file-opening trapping!
; UPD ID= 1387, SNARK:<5.EXEC>EXECPR.MAC.13,  29-Dec-80 16:13:17 by OSMAN
;More 1356 - Put SYMBF out of way of CMU's .DIF file context window
; UPD ID= 1382, SNARK:<5.EXEC>EXECPR.MAC.12,  24-Dec-80 15:07:10 by OSMAN
;tco 5.1214 - Make SBLOCK have symbolic size instead of "20"
; UPD ID= 1356, SNARK:<5.EXEC>EXECPR.MAC.11,  16-Dec-80 12:22:53 by OSMAN
;Move SYMBF to area not cleared at startup, so we can avoid trying to grab
;huge amount of freespace when starting a customized exec
; UPD ID= 1117, SNARK:<5.EXEC>EXECPR.MAC.10,   3-Oct-80 11:32:58 by OSMAN
;TCO 5.1162 - Add KEPNMS
; UPD ID= 1044, SNARK:<5.EXEC>EXECPR.MAC.9,  25-Sep-80 14:17:27 by OSMAN
;TCO 5.1156 - Add FRKDEF
; UPD ID= 915, SNARK:<5.EXEC>EXECPR.MAC.8,  19-Aug-80 14:00:46 by HESS
; Fix Examine/Deposit commands for multi-forking
; UPD ID= 858, SNARK:<5.EXEC>EXECPR.MAC.7,  10-Aug-80 15:20:21 by OSMAN
;tco 5.1129 - Add symbolic address and expression support
; UPD ID= 743, SNARK:<5.EXEC>EXECPR.MAC.6,   8-Jul-80 10:46:54 by OSMAN
;<5.EXEC>EXECPR.MAC.5,  8-Jul-80 08:54:01, EDIT BY OSMAN
;tco 5.1097 - Make "start" work to retry failing save after load
;<5.EXEC>EXECPR.MAC.4, 30-May-80 17:02:53, EDIT BY MURPHY
;PUT NEW ALERT AND MAIL WATCH UNDER NEWF
; UPD ID= 537, SNARK:<5.EXEC>EXECPR.MAC.3,  20-May-80 15:46:19 by MURPHY
;CHANGE SOME XTND TO NEWF OR MFRK
; UPD ID= 460, SNARK:<4.1.EXEC>EXECPR.MAC.6,  22-Apr-80 16:42:41 by OSMAN
;tco 4.1.1146 - Make CTRL/Q during advice work.
;Add SAVPGM
;<4.1.EXEC>EXECPR.MAC.2, 20-Nov-79 09:32:37, EDIT BY OSMAN
;tco 4.1.1023 - REMOVE ECHOF, PECHOF, OKERR.  ADD TAKDEF, TAKBTS
;REMOVE SAVFLG AND SAVPTR

;	COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1976, 1988.
;	ALL RIGHTS RESERVED.
;
;	THIS SOFTWARE IS FURNISHED UNDER A  LICENSE AND MAY BE USED AND  COPIED
;	ONLY IN  ACCORDANCE  WITH  THE  TERMS OF  SUCH  LICENSE  AND  WITH  THE
;	INCLUSION OF THE ABOVE  COPYRIGHT NOTICE.  THIS  SOFTWARE OR ANY  OTHER
;	COPIES THEREOF MAY NOT BE PROVIDED  OR OTHERWISE MADE AVAILABLE TO  ANY
;	OTHER PERSON.  NO  TITLE TO  AND OWNERSHIP  OF THE  SOFTWARE IS  HEREBY
;	TRANSFERRED.
;
;	THE INFORMATION IN THIS  SOFTWARE IS SUBJECT  TO CHANGE WITHOUT  NOTICE
;	AND SHOULD  NOT  BE CONSTRUED  AS  A COMMITMENT  BY  DIGITAL  EQUIPMENT
;	CORPORATION.
;
;	DIGITAL ASSUMES NO  RESPONSIBILITY FOR  THE USE OR  RELIABILITY OF  ITS
;	SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL.

;TOPS20 'EXECUTIVE' COMMAND LANGUAGE - IMPURE STORAGE

	SEARCH EXECDE,MONSYM,QSRMAC
	UTITLE EXECPR

;NOTE: THIS MODULE SHOULD ONLY ASSIGN GLOBAL STORAGE.  THAT IS, ALL STORAGE
;FOR INDIVIDUAL COMMANDS SHOULD BE ALLOCATED AS LOCAL STORAGE WITHIN THE
;COMMAND'S CODE ITSELF, SUCH AS WITH TRVAR OR STKVAR

;ASSEMBLE THE COPYRIGHT NOTICE SO THAT IT WILL BE SEEN IF
;ANYONE DUMPS THE EXE FILE OR MEMORY
;THE COPYRIGHT MUST BE THE FIRST CODE LOADED

	CPYRYT

;MAKE SURE THE COPYRIGHT COMES BEFORE THE LOC 140, IT DOES A LOC/RELOC

	LOC 140

;COMMAND BLOCKS FOR INPUT, CREATE, OUTPUT, AND CONFIRMATION, FOR EXECED
;(A SWITCH BLOCK MAY BE ADDED TO THE END OF EACH ONE)
;IF THESE BLOCKS ARE MODIFIED, CODE MUST BE CHANGED IN EXECED.MAC

EDTINF::FLDDB. .CMCFM,,,,,EDINF1
EDINF1:	FLDDB. .CMIFI

EDTOUF::FLDDB. .CMCFM,,,,,EDOUF1
EDOUF1:	FLDDB. .CMOFI

EDTFIL::FLDDB. .CMCFM,,,,,EDFIL1
EDFIL1:	FLDDB. .CMFIL

EDTCFM::FLDDB. .CMCFM



;[7.1061]
;THE FOLLOWING FDB-CREATION IS DONE HERE BECAUSE IN PARSING A KEYWORD,
;COMND% WANTS THE TABLE ADDRESS. WELL, THE TABLE ADDRESS IN THIS CASE
;IS IN FREESPACE, SO WHILE WE HAVE IT STORED, WE HAVE NO WAY TO TELL 
;COMND% WHAT IT IS UNLESS WE WRITE INTO THE FDB. HENCE THE FOLLOWING:

;THE FDB CREATED HERE WILL BE LINKED INTO THE OTHER FDB'S AT PARSING TIME.
;THE "1" IS A PLACEHOLDER FOR THE DATA (.CMDAT) FIELD, IN THIS CASE, THE
;TABLE ADDRESS. WE'LL KNOW WHAT IT IS AFTER WE CREATE THE TABLE IN EXECSE.MAC.

;FOR CHARACTERISTICS

FDCHLP::ASCIZ/Existing Characteristic name - /

CBKFDB::FLDBK. (.CMKEY,<CM%BRK>,1,1,,KEYBMS)
KEYBMS::BRMSK. (FLDB0.,FLDB1.,FLDB2.,FLDB3.,<$_>)

;FOR PRINTERS

FDPHLP::ASCIZ/Existing Remote Printer name - /

PBKFDB::FLDBK. (.CMKEY,<CM%BRK>,1,1,,KEYBMS)


;Storage preceding PAGE0X may have data already stored there. 
;We will always save this data in the .EXE file. Storage after 
;PAGE0X up to XPGD will not be saved in the .EXE file, it is 
;assumed that these locations are zero.

PAGE0X==.		;Include page 0 to this page in the .EXE file

;STORAGE FOR EXEC COMMAND INTERPRETER

SBLOCK::BLOCK SBLKLN		;COMND JSYS STATE BLOCK
FBLOCK::BLOCK FBLLEN		;COMND JSYS FUNCTION BLOCK
CBUF::  BLOCK CBUFL		;BUFFER FOR ENTIRE COMMAND TEXT,
				;INCLUDING STUFF ECHOED BY ALT MODE.
CBUFE::	Z			;END OF CBUF
ATMBUF::BLOCK ATMLEN		;BUFFER FOR STORING LAST FIELD
CBLOCK::BLOCK 3			;USED TO SAVE AND RESTORE ATOM-RELATED
				;POINTERS IN SBLOCK
TAKCUR::Z			;CURRENT SETTINGS
TAKLEN::Z			;NUMBER OF INPUT JFNS IN PROGRESS
SAVTAK::Z			;USE TO TEST I/O LEVEL FOR LOGGING OUT
TAKDEF::Z			;DEFAULTS FOR TAKE
TAKBTS::BLOCK TAKLNX		;CONTROL BITS FOR THIS LEVEL OF TAKE
TAKJFN::BLOCK TAKLNX		;INPUT,,OUTPUT
SDECHO::Z			;[3017]-1 SAYS WE'VE ECHOED A "SET DEFAULT" FROM A TAKE FILE
CIJFN::	Z			;COMMAND (PRIMARY) INPUT JFN
COJFN::	Z			;PRIMARY OUTPUT JFN
JBUFP::	Z			;PUSHDOWN-TYPE POINTER INTO JFN LIST
JBUF::	BLOCK JBUFL		;BUFFER (STACK) FOR JFN'S. JFN'S OF ALL FILES
				;MENTIONED IN A COMMAND MUST BE HERE SO ERROR ROUTINES
				;CAN CLOSE AND RELEASE THEM.
;PCL PROGRAMMABLE COMMAND LANGUAGE PERMANENT VARIABLES

PCFLDB::BLOCK 4			;FIELD DESCRIPTOR BLOCK FOR MERGED COMMANDS
PCFLDP::BLOCK 4			;FIELD DESCRIPTOR BLOCK FOR PRESERVED COMMANDS
PCLNAM::Z			;[PCL] Address of name of top-level PCL command
				; in progress
PCCIPF::Z			;[PCL] -1 if PCL command in progress, 1 if
				; PCL command will be in progress once it is
				; confirmed, 0 otherwise
PCONCE::Z			;[PCL] once only flag for PRSINI
PCTXFR::Z			;ADDRESS OF FIRST FREE TEXT BLOCK
PCVVAL::Z			;SYSTEM VARIABLE VALUE
PCVATM::Z			;SYSTEM VARIABLE ATOM
PCLGST::Z			;INDEX OF LAST ALLOCATED ENTRY IN GST
PCLPMT::BLOCK 6			;SELECTABLE PROMPT STRINGS (STRINGVALUES)
XDICT::	Z			;USED BY PERMANENT FREE SPACE MANAGER
CSVC::	Z			;0 OR POINTER TO SAVED COMMAND STRING
EDSVB::	Z			;PLACE TO SAVE POINTER TO EDIT ARGS
SYMBF::	Z			;ADDRESS OF SYMBOL TABLE WINDOW
DPLPT::	Z			;POINTER TO PLOT DEFAULTS
DPLSTK::BLOCK QSLEN		;PLOT DEFAULTS
DCPT::	Z			;POINTER TO CPUNCH DEFAULTS
DCSTK::	BLOCK QSLEN		;CPUNCH DEFAULTS
DPPT::	Z			;POINTER TO DEFAULTS FOR PRINT COMMAND
DPSTK::	BLOCK QSLEN		;DEFAULTS FOR PRINT COMMAND
DSPT::	Z			;POINTER TO SUBMIT DEFAULTS
DSSTK::	BLOCK QSLEN		;SUBMIT DEFAULTS
DTPT::	Z			;POINTER TO TPUNCH DEFAULTS
DTSTK::	BLOCK QSLEN		;TPUNCH DEFAULTS

;STORAGE FOR SET DEFAULT COMPILE-SWITCHES

EXTBUF::BLOCK NEXTS*EXTSIZ	;ROOM FOR EXTENSION STRINGS
DEXTBL::0			;TABLE HEADER WORD
	BLOCK NEXTS		;ROOM FOR MAXIMUM SIZE TABLE
DCSSTG::BLOCK NEXTS*DCSSIZ	;ROOM FOR DEFAULTS
CSZ1==:.			;CSZ1 TO CSZ2 IS ZEROED EVERY COMMAND

SAVSP::Z			;INDIVIDUAL COMMANDS MAY STORE THEIR STACK
				;POINTER HERE
CLZFFF::Z			;POSITIVE IF CLZFF NEEDED AFTER ERROR OR ^C
COMAND::Z			;TABLE ADDRESS OF OR POINTER TO NAME OF COMMAND BEING EXECUTED
COMSIX::Z			;SIXBIT OF COMMAND NAME
PRGCEL::Z			;HOLDS FAKE KEYWORD TABLE ENTRY FOR PROGRAM NAME
CLF::	Z			;-1 WHILE AT COMMAND LEVEL
CIPF::	Z			;-1 WHEN COMMAND IN PROGRESS
BEGINP::Z			;MARKS BEGINNING OF COMMAND INPUT
SVPRMT::Z			;SAVES POINTER TO PROMPT STRING FOR "TAKE, ECHO"

REPARA::Z			;HOLDS REPARSE ADDRESS
CMDACS::BLOCK 20		;SAVED AC'S TO RESTORE THEM ON COMMAND REPARSE
.P::	Z			;SAVED P DURING SUBCOMMANDS
.PP::	Z			;SAVED .FP DURING SUBCOMMANDS
.J::	Z			;JFN STACK POINTER, USED FOR COMMAND INPUT
.JBUFP::Z			;JFN STACK POINTER, SAVED DURING COMMAND EXECUTION
INIFH1::Z			;JBUFP VALUE FOR FIRST JFN IN INPUT FILE GROUP
INIFH2::Z			;SAME FOR LAST FILE.  SAME AS INIFH1 UNLESS SEVERAL
				;NAMES (SEPERATED BY COMMAS) WERE GIVEN.

EOFDSP::Z			;SPECIAL DISPATCH ADDRESS FOR EOF PSI, EG DURING "COPY"

DATDSP::Z			;SPECIAL DISPATCH FOR DATA ERROR, DURING CHECKSUM

ILIDSP::Z			;0 OR SPECIAL DISPATCH FOR ILLEG INSTRUCTION TRAP

QTADSP::Z			;0 OR SPECIAL DISPATCH FOR QUOTA EXCEEDED TRAP

;POINTER TO DATA TO RSCAN FOR PROGRAMS

RSPTR::	0

ERRMF::	Z			;NON-ZERO WHILE PROCESSING ERROR
				;CURTAILS PROCESSING OF NESTED ERRORS TO AVOID
				;INFINITE LOOPS IN ERROR CODE.
PCLDCO::Z			;PCL +1/-1 to do Exec command in Original mode
ORIFLG::Z			;CM156 Temporary Original flag used during
				;  parsing.

CSZ2==:.-1			;END OF AREA ZEROED EVERY COMMAND

;SYSTEM CONSTANTS INITIALIZED ONCE AT STARTUP

QTIMES::Z
SNAMES::Z
SYSVER::Z
JOBRT::	Z
TTYJOB::Z

;[7.1061]
;FOR REMOTE PRINTING

CHRTAB::Z			;[7.1061] ZERO, OR ADDRESS OF CHARACTERISTICS
				; TABLE, WHEN THERE IS ONE.
PTRTAB::Z			;[7.1061] ZERO, OR ADDRESS OF REMOTE PRINTERS
				; TABLE, WHEN THERE IS ONE.

BTMSK1::Z			;[7.1061] FIRST WORD IN CHARACTERISTICS BIT-MASK
BTMSK2::Z			;[7.1061] SECOND WORD IN CHARACTERISTICS BIT-MASK
BTMSK3::Z			;[7.1061] THIRD WORD IN CHARACTERISTICS BIT-MASK
BTMSK4::Z			;[7.1061] FOURTH WORD IN CHARACTERISTICS BIT-MASK


;[7.1073] For remote printing switches to PRINT command

DSTNOD::Z			;[7.1073] DESTINATION-NODE NAME - SIGNALS REMOTE-PRINTING
RPNODE::Z			;[7.1073] REMOTE PRINTER NODE NAME
RPQUE::	BLOCK 7			;[7.1073] REMOTE PRINTER QUEUE NAME

;[4417]For SET DEFAULT PRINTER /REMOTE:
DEFREM:: BLOCK 7		;[4417]SET DEFAULT PRINT /REMOTE-PRINTER:arg
DEFQUE:: BLOCK 7		;[4417]SET DEFAULT PRINT /REMOTE:x/DEST:y
DEFADR::Z			;[4417]Right half contains addr of default
				;[4417] remote printer entry in PTRTAB.
DEFDST::Z			;[4417]SET DEFAULT PRINT /DESTINATION:node
DEFUNT::Z			;[4417]SET DEFAULT PRINT /UNIT:x
PRIFLG::Z			;[4417]Flags,,default status, defined in EXECDE

;THIS ONE NOT SET UP AT START UP BECAUSE IT MAY NOT EXIST

NETRDY::Z

CINITF::Z			;NON-ZERO AFTER STARTUP INITIALIZATION COMPLETED
CUSTMF::Z			;PCL Set to indicate run of customized Exec
UNIQUE::Z			;DO "AOS A,UNIQUE" TO GET UNIQUE NUMBER IN A
SAVT20::Z			;REMEMBERED EXEC/USER MODE AT STARTUP
SAVNAM::Z			;REMEMBERED PROG NAME WHEN EXEC STARTS

;VARIOUS LOGIN/LOGOUT FLAGS

SYSMF::	Z			;SET TO -1 IF SYSTEM MESSAGES NEED PRINTING
LOGDAT::Z			;HOLDS DATE OF LOGIN
FSTLGN::Z			;-1: LOGIN FAST MODE
LOGINI::Z			;SET TO FLAG "TAKE INITIAL-LOGIN-TYPIN.TXT" AT NEXT OPPERTUNITY
FILINI::Z			;SET TO FLAG "TAKE EXEC-INITIALIZATION.TXT" COMPLETED.
LGORET::Z			;SET TO SAY "WE ARE TAKING LOGOUT.CMD" - HOLDS RETURN TO LOGOUT CODE
FSTOUT::Z			;-1: LOGOUT FAST MODE

;FOR COMMAND EDITOR

HSTCNT::Z			;NUMBER OF COMMANDS TO REMEMBER
HSTNUM::Z			;CURRENT COMMAND NUMBER
HSTPTR::Z			;ADDRESS OF PTRS TO COMMANDS
SETNOF::Z			;FLAG TO INDICATE "SET NO...."
TERMNL::Z			;TERMINAL

CIDLYF::Z			;0:CLEAR INPUT AFTER ?, BUT BEFORE MESSAGE
				;-1:CLEAR INPUT AFTER ENTIRE ERROR MESSAGE
ACTRCF::Z			;-1 WHEN ^C ALLOWED
IINTDF::Z			;NUMBER OF NESTED IPCON'S
INTDF::	Z			;NUMBER OF NESTED PIOFF'S
IPCALF::Z			;-1 WHEN IPCF INTERRUPTS ALLOWED
IPCRCF::Z			;SET TO -1 WHEN AN IPCF MESSAGE HAS BEEN RECEIVED
IPCCTL::Z			;0 OR SPECIAL ADDRESS TO GO TO AFTER IPCF INTERRUPT
IPCWTF::Z			;SET TO -1 WHEN AN IPCF INTERRUPT HAS BEEN DEFERRED

OLDIDX::Z			;SET TO INDEX OF THE MESSAGE TO BE FLUSHED IF NECESSARY
IPCAGE::BLOCK IPCMAX		;BIRTHDAY OF MESSAGE, LARGER NUMBERS ARE MORE RECENTLY RECEIVED
IPCTBL::BLOCK IPCMAX		;0 OR PID THAT SEND NTH MESSAGE (SEE IPCBUF)
IPCFGS::BLOCK IPCMAX		;FLAGS FROM NTH IPCF MESSAGE IN BUFFER
NOWPTR::Z			;0 OR POINTER TO FIRST QUEUED MOUNT BLOCK
MPENDF::Z			;-1 IF WAITING FOR MOUNT ANSWER
DBGEXC::Z			;NON-0:MAKE ^T DISPLAY EXEC PC'S FOR COMMANDS

SYMF::	Z			;-1 IF "SET TYPEOUT MODE SYMBOLIC"
PAXLFL::Z			;0:PA1050 ALLOWED
				;-1:PA1050 NOT ALLOWED
CCFLAG::Z			;0:XMIT ^C CAP TO PROGRAMS
				;-1:DON'T XMIT ^C CAP TO PROGRAMS

PRVENF::Z			;NON-0 IF PRIVILEGED COMMANDS "ENABLE"D


MESMSF::Z			;MESSAGE MESSAGE FLAG: NON-0 SAYS TO LOOP TO TYPE
				;"YOU HAVE A MESSAGE" IF APPROPRIATE


BATCHF::Z			;-1: BATCH MODE, 0:NON BATCH MODE
CUSRNO::Z			;USER # IF LOGGED IN, 0 IF NOT
LIDNO::	Z			;LOGGED-IN DIRECTORY NUMBER (SET ONLY AFTER LOGIN)
LOGINF::Z                     	;[3044] FLAG TO INDICATE THAT WE ARE IN THE PROCESS
				;[3044] OF ACCESSING POBOX: AND DOING MAIL CHECK ON LOG-IN
;[3040] Add POBXNO			DEE		23-Jun-86
POBXNO::Z			;[3040] USER'S POBOX: DIRECTORY NUMBER - SAME AS LIDNO IF POBOX:=>PS:
JOBNO::	Z			;JOB NUMBER
FORK::	Z			;-1 OR HANDLE OF INFERIOR FORK EXEC CURRENTLY KNOWS OF.
				;SET BY GET, RUN, FORK N, ETC.
				;USED BY START, /, \, GOTO, ETC.

RUNFK::	Z			;CURRENT RUNNING FORK
IDFORK::Z			;IDDT FORK
EDFORK::Z			;EDITOR FORK (AUTO KEEP)
CCKEEP::Z			;-1 := TREAT INTERRUPTED FORKS AS KEPT

FRKTAB::BLOCK NFRKS		;FORK TABLE FLAGS,,FRKTBL PNTR
SLFTAB=:FRKTAB+400000

FRKNMS::BLOCK NFRKS+1		;TBLUK STYLE TABLE FOR FORK NAMES
KEPNMS::BLOCK NFRKS+1		;TABLE OF KEPT FORK NAMES
FRKDEF::Z			;ADDRESS OF BLOCK OF FORK DEFAULTS (SEE "FORK BLOCK" IN EXECDE)
JSBDEF::BLOCK BITMLN		;DEFAULT JSYSES TO TRAP ON
TRAPU::Z			;COUNT OF TRAPPED UNDEFINED JSYS'S
TRAPD::Z			;COUNT OF TRAPPED DEFINED JSYS'S
TRPOKF::Z			;-1 IF TRAPS OK (TFORK ALREADY DONE)
TSTOPF::Z			;-1 IF STOPPING AFTER EACH TRAP
TFILEF::Z			;-1 IF "SET TRAP FILE-OPENINGS"
TOPENF::Z			;-1 IF "SET TRAP JSYS OPENF" OR "SET TRAP JSYS /ALL"
STAYF::	Z			;-1 TO STAY AT COMMAND LEVEL WHILE PROGRAM RUNNING

ADVFLG::Z			;FLAG TO INDICATE ADVISE CODE ACTIVE
ADVTNM::Z			;TERMINAL WE'RE ADVISING
SAVPGM::Z			;SAVED TT%PGM DURING ADVISE

NPAGE::	Z			;-1 OR XWD FORK HANDLE, ADDR FOR PAGE MAPPED AT "PAGEN"

EFORK::	Z			;FORK HANDLE FOR SPECIAL INFERIOR EXEC FORK
				; OR EPHEMERALS
HELPSN::Z			;SIGNAL FOR HELP COMMAND
INDQUS::Z			;tell ETYPE not to print ? in first column or
				; ephemerals
;STORAGE FOR MIC

MICFRK::Z			;FORK HANDLE OF MIC.EXE
MICPAG::Z			;AC BLOCK FOR INFERIOR (MIC.EXE)
	BLOCK 17
MICFPG::Z			;POINTER TO FIRST PAGE FREE

;PCL PROGRAMMABLE COMMAND LANGUAGE VARIABLES

PCCURC::Z			;ADDRESS OF INNERMOST ACTIVE ECB
PCSFRE::Z			;ADDRESS OF FIRST FREE STRING BLOCK
PCLSTF::Z			;WHILE IN EXEC, FIRST UNUSED WORD OF RUN STACK
PCPOTP::Z			;ADDRESS OF BLOCK OF USER PROGRAM TYPEOUT
PCPEOP::Z			;ADDRESS OF BLOCK OF EXEC TYPEOUT
PCPRGR::Z			;-1 WHILE RUNNING CONTROLLED PROGRAM
PCRPAS::Z			;SAVED P WHILE IN PARSE
PCFLAG::Z			;SEVERAL FLAGS
PCFORK::Z			;PCL Place to save contents of FORK
PCWAIT::Z			;PCL Execution waiting for fork to stop
PCRNFK::Z			;PCL Saved value for RUNFK
;JFN-WATCH STORAGE

IJWSEQ::Z			;INVOKE JFN WATCH CHARACTER SEQUENCE
JWPAG::	BLOCK JWPAGL		;JFN WATCH PAGE LIST, 1ST WD IS COUNT
WJPTAB::BLOCK JWPAGL		;CONDENSED LIST OF JFN/PAGES, 1ST WD IS COUNT
XRMPNT::Z			;POINTS AT EITHER XRMBLK OR EXCBLK
EXCBLK::BLOCK 4+<2*<JWEPGE+1-JWEPGS>> ;ARG BLK FOR XRMAP JSYS FOR EXEC PAGES
XRMBLK::BLOCK <JWPAGL*3>+1	;ARG BLK FOR XRMAP JSYS


;MAIL WATCH VALUES

MWATCF::Z			;0 FOR MAIL WATCH OFF, -1 FOR ON
TYPING::Z			;-1 IF TYPEOUT IS IN PROGRESS
TPCCOC::Z			;-1 IF UNFORMATTED TYPE COMMAND WAS USED
TPTTYP::Z			;PREVIOUS TTY LENGTH (LH) AND WIDTH (RH)
MWATAT::Z			;TIME FOR AUTO MAIL WATCH
MWATCT::Z			;TIME FOR NEXT MAIL CHECK
MWATDR::BLOCK NMWAT		;USER NUMBERS FOR MAIL WATCH
MWATWR::BLOCK NMWAT		;LAST WRITE D/T OF MAIL.TXT.1
MWATN::	BLOCK NMWAT		;COUNT OF TIMES CHECKED
MWATN0::BLOCK NMWAT		;RESET COUNT FOR MWATN

MALBUF::BLOCK 20		;TEMP STORAGE FOR GFUST OF MAIL WRITER

;VARIABLES FOR TIME ALERTS

IITSET::Z			;-1 IF TIMER INTS ON
AUTOF::	Z			;-1 IF AUTO MAIL/ALERTS ON

ALRTIM::Z			;TIME OF NEXT ALERT
ALRTMS::BLOCK NALTS		;ADDITIONAL ALERT TIMES

REASON::BLOCK NALTS+1		;POINTERS TO ALERT MESSAGE
;CRJOB/PRARG STORAGE

CRPRA::	BLOCK	20		;STORE PRARG DATA HERE (FROM CRJOB THAT
				;CREATED US)
;AUTOLOGOUT CRAP

STRTIM::Z			;DATE AND TIME EXEC WAS STARTED, IN "GTAD" FORMAT
TTYACF::Z			;TTY ACTIVITY FLAG: AOS'D FOR EACH CHARACTER IN OR OUT
PTTYAC::Z			;PREVIOUS TTY ACTIVITY FLAG (SAVE
				;OVER TIMER TIMEOUT)
ALOST::	Z			;0=> TIMER STUFF NOT STARTED; -1=> HAS BEEN
CJPTIM::Z			;NOT 0=> TIME LIMIT SET AT CRJOB STARTUP
				;THIS MEANS LGOUT AS WELL AS PRINTING
				;"? TIME LIMIT EXCEEDED"
				;-1 IF ALREADY KILLED.

;3 BLOCKS CONTAINING TTY MODE WORD, TAB STOPS (3 WORDS),
; CONTROL CHARACTER OUTPUT CONTROL INFO (CCOC) (2 WORDS).
;ALL THREE ARE CHANGED BY EXEC COMMANDS "HALFDUPLEX" ETC.
;	INITIAL VALUES: SAVED AT EXEC STARTUP fOR USE AT PROG STARTUP.

ITTYMD::BLOCK NTTYMD

;EXEC'S VALUES: USED DURING COMMAND INPUT.

ETTYMD::BLOCK NTTYMD

; FOR INFO CLUSTER (CNFIG%) and parsing CI node name
CFGBLK::BLOCK CFGSIZ		; USE 50 WORDS - MAXIMUM WE NEED
MAXCI==:20			;[7.1076] Can't have more than this many CI nodes
CFGNOD::BLOCK MAXCI		;[7.1076] CI node numbers go here

CERET::	Z			;WHERE TO GO AFTER ERROR MESSAGE. NORMALLY "RERET"
				;WHICH GOES BACK TO CMDIN, BUT IS CHANGED DURING
				;SUBCOMMAND INPUT AS FOR "DIRECTORY"

CTUUO:: Z			;TEMPORARY FOR UUO DISPATCHER

%EDAYT::Z			;DATE & TIME SAVED FROM %D TO

ERCOD::	Z			;ERROR CODE FROM JSYS ERROR RETURN OR FAKE ITRAP

;STORAGE LOCATIONS USED BY "DIRECTORY" AND OTHER COMMANDS FOR
;INFORMATION ABOUT ARGUMENTS

MCOJFN::Z			;MULTI COPY OUTPUT JFN
OUTDSG::Z			;DESIGNATOR OF FILE TO PRINT ON

;FLAG CONTROLLING JFN NAME PRINTING BY TYPIF ROUTINE

TYPGRP::Z			;0:PRINT ONLY IF PROCESSING GROUP
				;-1:PRINT ALWAYS

SPRSED::Z			;0 IF SUPERSEDING ON COPY
BYTSIZ::Z			;BYTE SIZE FOR BYTE SUBCOMMAND

;PSEUDO-INTERRUPT PC STORAGE WORDS

PCTAB=:.-1
LEV1PC::Z
LEV2PC::Z
LEV3PC::Z
;BUFFERS

PD::	BLOCK PDL		;PUSHDOWN
				;WHILE A PUSHDOWN OVERFLOW ERROR MESSAGE IS BEING
				; TYPED PD OVERFLOWS INTO CBUF, WHICH IS OK.
CJFNBK::			;[3033] ARGUMENT BLOCK FOR "GTJFN" JSYS
				;[3033] ALWAYS ALL 0 EXCEPT WORDS 0, 1, 3, 4, 5.
	Z			;[3033] .GJGEN - flags,,<generation>
	Z			;[3033] .GJSRC - <input JFN>,,<output JFN>
	Z			;[3033] .GJDEV - Pointer to def. device
	Z			;[3033] .GJDIR - Pointer to def. directory
	Z			;[3033] .GJNAM - Pointer to def. filename
	Z			;[3033] .GJEXT - Pointer to def. file extension
	Z			;[3033] .GJPRO - Pointer to def. protection
	Z			;[3033] .GJACT - Pointer to def. account
	Z			;[3033] .GJJFN - JFN for file spec if GJ%JFN is lit

;EXTENDED ARGS FOR GTJFN

XTNCNT::Z			;[3033] .GJF2 - Flags,,<count remaining in block>
ECHPTR::Z			;[3033] .GJCPP - Echo pointer for gtjfn goes here
ECHCNT::Z			;[3033] .GJCPC - Echo count goes here
	Z			;[3033] .GJRTY - Pointer to ^R buffer
	Z			;[3033] .GJBFP - Obsolete
	Z			;[3033] .GJATR - Pointer to attribute block
	Z			;[3033] .GJNOD - Pointer to default node

CTRPTR::Z			;POINT TO SPACE IN FRONT OF COMMAND BUFFER
	Z			;TOP OF BUFFER POINTER

DICT::	Z			;WORD NEEDED BY FREE SPACE MANAGER
CSBUFP::Z			;POINTER TO STRING STORAGE
CINODT::BLOCK MAXCI+1		;[7.1076] TBLUK% table used for recognizing CI nodes
OURNOD::BLOCK 2			;[7.1076] Place to hold our node name
NODBLK::BLOCK 4			;[7.1076] NODE% argument block useage
INFBLK::BLOCK 6			;[7.1076] INFO% argument block useage
INFLEN==:<.-INFBLK-1>		;[7.1076] Size of INFO% arg block
INFSYS::BLOCK .SYJCT+1		;[4412] Block for SYSTAT stuff
UNAME::	BLOCK 10		;[7.1076] For user name (SYSTAT)
DIRN::	BLOCK 21		;[7.1076] For conn directory name (SYSTAT)
ORGN::	BLOCK 21		;[7.1076] For job origin (SYSTAT)
JRCASH::BLOCK MAXCI		;[7.1076] Job range cache for SYSTAT
INFCIN::BLOCK MAXCI		;[7.1076] CI nodes doing INFO%

CSVCC::	BLOCK	1		;SAVE COMMAND INFO
;STORAGE FOR SYMBOL TABLE DATABASE

SYMOKF::Z			;-1 IF SYMBOL DATABASE OK
SOFF::	Z			;WILL CONTAIN A,,OFFSET FOR INDEXING
SYMBA::	Z			;BEGINNING ADDRESS MAPPED
SYMEA::	Z			;ENDING ADDRESS MAPPED
SYMBEG::Z			;FIRST ADDRESS OF PROG'S SYMBOL TABLE
SYMEND::Z			;LAST ADDRESS OF PROG'S SYMBOL TABLE
LASTP::	Z			;ADDRESS OF MOST RECENT PROGRAM NAME IN WHICH LAST SYMBOL WAS FOUND
NSYMS::	Z			;NUMBER OF PROGRAM SYMBOLS

;STORAGE FOR IPCF VARIABLES

MYPID::	Z			;EXEC PID
INFPID::Z			;INFO'S PID
QSRPID::Z			;PID OF QUASAR (QUEUE REQUESTS GET SENT TO QUASAR)
NEBPID::Z			;[7.1232] But response may come from NEBULA
MDAPID::Z			;MOBY DEVICE ANIMAL'S PID
SNDPDB::BLOCK	PDBSIZ		;PDB FOR SENDING MESSAGES

ABKCNT::Z			;ADDRESS BREAK COUNTER
FTDBLK::BLOCK .RSFET+1		;SPACE FOR SET FILE ON/OFF/EXP
ARCBLK::BLOCK .ARPSZ+1		;BLOCK FOR ARCHIVE TAPE INFO

LRFSTS::BLOCK .RFSFL+1		;BLOCK FOR DOING LONG FORM RFSTS CALL
;GLOBAL VARIABLES AND BUFFERS USED BY THE COMMAND EDITOR
;ORDER SHOULDN'T BE CHANGED UNLESS YOU KNOW WHAT YOU ARE DOING

CESAVE::BLOCK CESBLN		;SAVED COMMAND LINE BUFFER
CEBFEN::			;END OF BUFFER
CEKBUF::BLOCK CEKBLN		;KILL BUFFER
CETSAV::BLOCK CETBLN		;COMMAND EDIT WORKING BUFFER
SVSEDC::BLOCK 1			;SAVE CHAR POS FOR ENTER PARAMS
SVSEDP::BLOCK 1			;SAVE BYTE POINTER FOR ENTER PARAMS
CEPBUF::BLOCK CEKBLN		;PUT BUFFER
CEBPTR::BLOCK 1			;COMMAND POINTER/FLAG
CETTMD::BLOCK 1			;TERMINAL CHARACTERISTICS
CEFLAG::BLOCK 1			;0 FOR EMACS, NON-0 FOR "ALTER" MODE
INSMOD::BLOCK 1			;0 FOR OVERSTRIKE, -1 FOR INSERT MODE
CEVMSD::BLOCK 1			;DEFAULT FOR INSERT MODE
CEMETA::BLOCK 1			;NON-0 IF META KEY IS BEING USED
CEFFL:: BLOCK 1			;FIRST FREE LOCATION IN CESAVE
CE1ST:: BLOCK 1			;POINTER TO FIRST SAVED COMMAND
CELAST::BLOCK 1			;POINTER TO LAST SAVED COMMAND
CECNT:: BLOCK 1			;COUNT OF COMMANDS IN THE BUFFER
CEPSIC::BLOCK 1			;INTERRUPT CHARACTER TO ENTER EDITOR
NOPRMT::BLOCK 1			;FLAG NOT TO PRINT PROMPT AFTER CMDED
PCLMID::BLOCK 1			;PCL FLAG

CSZ4==:.-1			;END OF AREA TO ZERO AT STARTUP (BEGINS AT CSZ1)
XPGD==.-1			;END OF NON-PAGE DATA
;BUFFERS FOR MAPPING PAGES

	LOC <.+777>&777000	;SET LOCATION TO NEXT PAGE BOUNDARY
BPGD==.				;BEGINNING OF PAGE DATA

PAGEMI::BLOCK ^D512		;PAGE FOR USE BY MIC

PAGEN::	BLOCK ^D512		;POSSIBLE PAGE MAPPED FOR EXAMINE, DEPOSIT, ETC.
				;OR LOOKING AT JOBDAT.
				;IF A PAGE IS MAPPED HERE "NPAGE" IDENTIFIES IT.

 XDEND==:.			;FIRST LOC OF PURE SEGMENT
SUBTTL ONCE-ONLY MODULE FOR EXEC CREATION

;USEFUL MACROS

DEFINE TMSG(TXT) <
	HRROI 1,[ASCIZ \TXT\]
	PSOUT		;;DUMP STRING ON TERMINAL
>

DEFINE TNOUT <
	MOVEI 1,.PRIOU	;;USE PRIMARY JFN
	MOVEI 3,^D10	;;DECIMAL NUMBER
	NOUT		;;DUMP IT
	 ERJMP .+1	;;IGNORE ERRORS
>

DEFINE EMSG(TXT) <
	TMSG <
?TXT
>
	HALTF		;;PRINT ?MESSAGE AND HALT
	JRST XSAVE	;;RETRY SAVE IF CONTINUED
>

;REGISTER USAGE

;C(10) := STARTING PAGE #
;C(11) := # OF PAGES WITHOUT SYMBOLS
;C(12) := HIGHEST PAGE # + 1
;C(13) := # OF PAGES IN SYMBOL TABLE
;C(14) := JFN TO FOR .EXE FILE
	LOC PAGEMI
COMMENT \

The JSYS table has the following format:

	[ flags
	  ASCIZ/NAME/],,nm

where:

	flags = TBLUK flags
	name = JSYS name
	n = JSYS number
	m = correct table offset to JSYS name for this numeric (JSYS) table
	    offset


As the table is in TBLUK format, it can be accessed by JSYS name
(to get the corresponding JSYS number).  It can also be accessed by
JSYS number (to get the corresponding JSYS name).

 Since offset zero contains the TBLUK table length, care must be
taken to special-case the attempt to index the table numerically
with an index of zero.



\
JSORT:	MOVE A,[-JLEN,,JTAB+1]	;GET AOBJN POINTER
	SETZM B
JTBO3:	HLRZ Q3,(A)		;GET PRIMARY POINTER - ANY ?
;	JUMPE Q3, JTBO7		;NO - SKIP THIS ITERATION
	MOVE Z,A		;YES - SAVE AOBJN POINTER
	HRRZI D,1(Q3)		;YES - GET STRING POINTER
	JRST JTBO5		;SET UP THE FIRST STRING

JTBO4:	HLRZ Q3,(A)		;GET PRIMARY POINTER- ANY?
	JUMPE Q3,JTBO6		;NO, SKIP IT
	HRRZI D,1(Q3)		;YES - GET STRING POINTER
	CAMG B,(D)		;IS THIS STRING SMALLER?
	JRST JTBO6		;NO - SKIP IT
JTBO5:	MOVE B,(D)		;YES - SET UP STRING
	MOVE C,A		;GET ITS INDEX, TOO

JTBO6:	AOBJN A,JTBO4		;LOOP THROUGH ALL STRINGS
	MOVEM Z,A		;RETRIEVE POINTER
	HLRZ B,(A)		;GET SOURCE POINTER
	HLRZ D,(C)		;GET DESTINATION POINTER
	HRLM B,(C)		;SWAP
	HRLM D,(A)		;...
	LDB B,[POINT 9,(A),26]	;GET SOURCE JSYS NUMBER
	LDB D,[POINT 9,(C),26]	;GET DESTINATION JSYS NUMBER
	DPB B,[POINT 9,(C),26]	;SWAP
	DPB D,[POINT 9,(A),26]	;...
JTBO7:	AOBJN A,JTBO3		;DO THE OUTER LOOP

	;NOW SORT OFFSETS IN RIGHT 9 BITS OF TABLE, SUCH THAT EACH
	;OFFSET POINTS TO THE TXT FOR THAT NUMERIC JSYS
	MOVE Q1,[-<JLEN-1>,,1]	;MUST SEARCH WHOLE TABLE

LP1:	MOVE A,[-<JLEN-1>,,1]	;SEARCH WHOLE TABLE ON EACH PASS
LP2:	LDB C,[POINT 9,JTAB(A),26];YES, GET JSYS NUMBER FROM THIS SLOT
	CAIN C,(Q1)		;IS IT THE SAME ONE Q1 IS POINTING TO?
	JRST GOTIT		;YES
	AOBJN A,LP2		;NO, TRY AGAIN
	SETZM A			;JSYS NOT DEFINED
GOTIT:	DPB A,[POINT 9,JTAB(Q1),35];STORE THE OFFSET
NXT:	AOBJN Q1,LP1		;ENTER OUTER LOOP
	RET
	LOC PAGEN		;USE THIS PAGE

XSAVE::!			;ENTRY POINT
	XCT INISTK		;JSERR NEEDS STACK POINTER
	CALL JSORT		;SORT THE JSYS TABLE
	MOVE 0,.JBSYM##		;GET SYM TABLE PNTR
	MOVEM 0,.JOBSY		;PLACE IN CORRECT LOC
	TMSG <
Data seg: >
	MOVEI 10,EXEC		;START ADDRS OF EXEC
	TRNE 10,777		;CHECK PAGE BOUNDARY
	JRST	[EMSG <EXEC doesn't start on page boundary>]
	LSH 10,-11		;STARTING PAGE #
	MOVE 2,10		;GET DATA SEGMENT SIZE
	TNOUT
	TMSG <. Pages
          >
	MOVEI 2,BPGD		;BEGINNING OF PAGE DATA
	SUBI 2,XPGD		;CALC REMAINDER
	TNOUT
	TMSG <. Words free

Pure seg: >
	HRRZ 2,.JOBSY		;GET LAST LOC OF EXEC
	ADDI 2,777		;ROUND TO NEXT HIGHEST PAGE
	LSH 2,-11		;PAGE #
	MOVEM 2,12		;SAVE INFO
	SUB 2,10		;SIZE OF EXEC W/O SYMS
	MOVEM 2,11		;SAVE IN 11
	TNOUT			;TELL US ABOUT IT
	TMSG <.+>
	HLRE 0,.JOBSY		;NEG. LEN OF S.T.
	HRRZ 2,.JOBSY		;START ADDRS
	SUB 2,0			;LAST LOC OF ENTIRE EXEC
	ADDI 2,777		;ROUND TO NEXT HIGHEST PAGE
	LSH 2,-11		;...
	SUB 2,12		;SIZE OF S.T.
	MOVEM 2,13		;SAVE FOR LATER
	TNOUT			;TELL US SIZE
	TMSG <. Pages + symbols
          >
	MOVE 2,12		;GET PAGE # +1 OF HIGHEST PAGE
	LSH 2,11		;CONVERT TO ADDRS
	HRRZ 0,.JOBSY
	SUB 2,0			;# OF WORDS REMAINING
	TNOUT			;TILL NEXT PAGE
	TMSG <. Words to next page boundary

Save symbols? >
XSV1:!	PBIN			;GET ANSWER
	ANDI 1,137		;ROUND TO UPPER CASE
	CAIN 1,"N"		;NO?
	JRST	[SETZM 13	;CLEAR SIZE OF S.T.
		 SETZM .JOBSY	; AND S.T. PNTR
		 SETZM .JBSYM##	; AND IN JOBDAT
		 JRST XSV2]	;SKIP TO EOL
	CAIE 1,"Y"		;YES?
	JRST	[TMSG <
?Type "Y" or "N"
>
		 MOVEI 1,.PRIIN
		 CFIBF		;CLEAR TYPEAHEAD
		 JRST XSV1]	;TRY AGAIN
XSV2:!	PBIN
	CAIE 1,12		;SKIP TILL LINE-FEED SEEN
	JRST XSV2
	MOVEI 1,.FHSLF		;SET UP ENTRY VECTOR
	MOVE 2,[EVLEN,,EXEC]
	SEVEC			;...
	MOVSI 1,(GJ%FOU!GJ%SHT)
	HRROI 2,[ASCIZ "EXEC.EXE"]
	GTJFN			;GET JFN FOR .EXE FILE
	 ERJMP	XSVE
	MOVEM 1,14		;SAVE JFN
	TMSG <
Saving EXEC on file: >
	MOVEI 1,.PRIOU		;WHERE TO SAY
	MOVE 2,14		;JFN
	MOVEI 3,0		;DEFAULT MSG
	JFNS
	MOVSI 1,.FHSLF		;MUMBLE UP SAVE FILE INFO
	HRR 1,14		;SELF,,JFN
	MOVE 2,11		;LEN OF EXEC
	ADD 2,13		;PLUS S.T. SIZE
	MOVEM 2,.NPAGS		;SAVE SIZE OF EXEC
	MOVNS 2			;NEGATE LENGTH
	HRLZS 2			; TO LHS
	HRR 2,10		;STARTING PAGE #
	TRO 2,SS%RD!SS%EXE	;READ & EXECUTE
	MOVEM 2,11		;STORE THIS TABLE ENTRY
	SETZ 10,		;SAVE PAGE 0 TO PAGE0X
	HRLI 10,-<<PAGE0X_-^D9>+1> ;NEGATIVE # OF PAGES
	IORI 10,SS%CPY+SS%RD+SS%EXE ;ALLOW ALL ACCESS TO SYMBOL POINTER
	MOVEI 12,0		;TERMINATE TABLE WITH A ZER0
	MOVEI 2,10		;POINT AT THE TABLE
	MOVEI 3,0		;ZERO FLAGS
	SSAVE			;DO IT
	 ERJMP XSVE
	TMSG < [OK]
>
	HALTF			;DONE!

XSVE:!	JSERR			;SAY WHY SAVE FAILED
	DMOVE A,[EXP .FHSLF,XWD 1,XSAVE]	;RESTORE ENTRY VECTOR IN CASE RETRY
	SEVEC
	EMSG <Failure during attempt to save EXEC.EXE>
	LIT			;DUMP LITS

	RELOC XDEND-140		;SO THAT NEXT MODULE LOADS CORRECTLY

	END XSAVE