Google
 

Trailing-Edge - PDP-10 Archives - bb-l014q-bm_tops20_v6_1_atpch17 - autopatch/scan.c17
There are no other files named scan.c17 in the archive.
 REP 7/1	;17C1
	SUBTTL	P.CONKLIN/DJB/DMN/DAL/PFC/LLN/JNG/LCR/WCL/BBE/PY/JBS/HD/MRB -- %7E(652) 24-Jan-85
 WIT
	SUBTTL	P.CONKLIN/DJB/DMN/DAL/PFC/LLN/JNG/LCR/WCL/BBE/PY/JBS/HD/MRB/RCB -- %7E(665) 26-Aug-87
 REP 13/1	;17C2
	;COPYRIGHT (C) 1970,1978,1982,1984,1985 BY
	;DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.  ALL RIGHTS RESERVED.
 WIT
	;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1970,1978,1982,1984,1985,1986,1987.
	;ALL RIGHTS RESERVED.
 REP 40/1	;17C3
	DECEVR==653		;DEC EDIT VERSION
 WIT
	DECEVR==665		;DEC EDIT VERSION
 INS 235/11	;17C4
	;654			NT	14-Aug-85
	;	Change the /RUN processing to avoid high-seg overlapping low-seg
	;	error. In general, make the routine conform to recommended
	;	practices for using the RUN UUO, as outlined in the
	;	Monitor Calls Manual Volume 1. This involves shrinking the
	;	high and low segs to as small possible, and doing th UUO from
	;	the ACs.

	;655	QAR #868548	DPM	 4-Dec-85
	;	Fix bug in .MKPTR routine which builds byte pointers.  Also fix
	;	up .LASWD when parsing 8-bit ASCIZ strings.

	;656	No SPR		DPM	28-Jul-86
	;	Correct byte pointer test in routine .AS8QW to use 8-bit pointer
	;	instead of 7-bit.

	;657	No SPR		DPM	28-Jul-86
	;	Correct routine .TFRFS to type entire path instead of just PPN.

	;660	No SPR		RCB	2-Dec-86
	;	Persuant to MCO 13170, allow single-character SIXBIT commands to
	;	be successfully RESCAN'ed even if not alphanumeric.

	;661	No SPR		RCB	24-Mar-87
	;	For user convenience, allow hyphens in the default switch name and
	;	keyword SIXBIT parse scanners.  This adds .SIXKW/.SIXKC to parse
	;	possibly hyphenated SIXBIT words.

	;662	No SPR		RCB	24-Mar-87
	;	Change the KEYS list for standard switch /DENSITY to allow consistency
	;	with the MOUNT command.  This also changes the internal KEYS lists to
	;	use blank fillers rather than $$, %%, etc.

	;663	No SPR		RCB	09-Jun-87
	;	Fix the blank compressor when PSCAN after ISCAN.  "CAN M 219" returns
	;	"M219" to QUEUE's CANCEL processor.

	;664	SPR #10-35748	DPM	19-Aug-87
	;	Fix code at RESTRT to only do CORE UUOs when necessary.

	;665	No SPR		RCB	26-Aug-87
	;	Fix 664.  Any use of .JBFF to check .JBREL is wrong.  The original
	;	design of SCAN's CORE UUO is to restore .JBREL to its initial value,
	;	so remember what it was and use a .JBREL value to compare against the
	;	current .JBREL.  Note that most programs will not need the CORE UUO
	;	at all and should probably be setting FS.INC when calling .ISCAN, but
	;	that's another story.
	;	While I'm here, fix .OSCAN to preserve SAVCHR so that the usual
	;	sequence of .ISCAN/.OSCAN/.VSCAN will work correctly.  Before now,
	;	it would only work with "command ..." (note the space not at EOL).
	;	Also fix RESCAN not just of command name followed by PSCAN.
	;	(Broken by 401?)

 REP 4/13	;17C5
	COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1970,1985  ALL RIGHTS RESERVED.
 WIT
	COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1970,1987.  ALL RIGHTS RESERVED.
	\;END COPYRIGHT MACRO
 REP 24/18	;17C6
		  MOVE	T4,[1,,]	; MFD)
 WIT
		  MOVE	T4,[1,,1]	; MFD)
 REP 44/18	;17C7
		PAGE			;CONTINUED ON NEXT PAGE.

 WIT
 INS 9/19	;17C8
		PUSHJ	P,.TIALT	;[660] GET POSSIBLE SIXBIT LEADIN
		JUMPLE	C,COMND2	;[660] SHOULD HAVE BEEN ONE
		PUSHJ	P,.REEAT	;[660] PUT IT BACK IN CASE NOT SPECIAL
		PUSHJ	P,.TICAN	;[660] SEE IF SPECIAL
		  JRST	COMNDI		;[660] YES, HANDLE WITH CARE
 INS 1/20	;17C9
	COMNDI:	CAIL	C,40		;[660] RANGE-CHECK
		CAILE	C,137		;[660] FOR SIXBIT VALUES
		JRST	COMNDG		;[660] NOT FOR US AFTER ALL
		MOVEI	N,-40(C)	;[660] YES, CONVERT TO SIXBIT
		LSH	N,^D30		;[660] JUSTIFY
		MOVEM	N,.NMUL		;[660] SAVE FOR ERRORS
		MOVEI	T1,.TSIXN##	;[660] ERROR TYPER
		MOVEM	T1,.LASWD	;[660] SET THAT UP AS WELL
		PUSHJ	P,.TIALT	;[660] GET OUR CHARACTER AGAIN
		PUSHJ	P,.TIALT	;[660] GET TERMINATOR
				;[660] FALL INTO COMNDU

 REP 11/23	;17C10
		HRRZ	T1,.JBFF	;GET FIRST FREE
 WIT
		HRRZ	T1,SAVCOR	;GET FIRST FREE
 INS 42/28	;17C11
		CAIE	C,C.TE		;[665] UNLESS THIS IS THE FUNNY ALTMODE,
		JUMPGE	C,VRSTRT	;[665] SKIP THIS UNLESS HAD A SAVED EOL
		SETZM	FLCCMD		;[665] PUNT COMMAND MODE IF "COMMAND<CR>"
		SETZM	SAVCHR		;[665] DITTO
		CAIN	C,C.TE		;[665] WHAT WAS THIS?
		MOVX	C,.CHALX	;[665] FIX THE FUNNY ALTMODE
 REP 29/31	;17C12
		SETZM	SCANPC		;CLEAR				[515]
		SETZM	SCANCH		; COMPRESSOR			[515]
 WIT
		PUSH	P,SAVCHR
		SETZM	SCANPC		;CLEAR				[515]
		SETZM	SCANCH		; COMPRESSOR			[515]
		SETZM	SAVCHR
 REP 12/33	;17C13
		PUSHJ	P,.SIXSW	;GET SIXBIT WORD
 WIT
		PUSHJ	P,.SIXKW	;GET SIXBIT WORD
 REP 30/33	;17C14
		PUSHJ	P,.SIXSW	;YES--GET OPTION NAME IN FILE
 WIT
		PUSHJ	P,.SIXKW	;YES--GET OPTION NAME IN FILE
 INS 19/34	;17C15
		POP	P,SAVCHR	;RESTORE RESCANNED DELIMITER FOR VSCAN
 REP 29/35	;17C16
		CAIN	T2,C.TE		;CONVERT SPECIAL EOL		[401]
		MOVEI	T2,0		; TO EOL			[401]
		JUMPG	T2,PSCAN1	;IF SOME END			[401]
		SKIPGE	FLJCNM		; AND JUST COMMAND LINE		[401]
		SETZM	SAVCHR		; THEN CLEAR RE-EAT OF EOL	[401]
 WIT
		CAIE	T2,C.TE		;[665] IF SPECIAL EOL,
		JUMPGE	T2,PSCAN2	;[665] OR OTHER EOL
		SKIPGE	FLJCNM		; AND JUST COMMAND LINE		[401]
		SETZM	SAVCHR		; THEN CLEAR RE-EAT OF EOL	[401]
		JRST	PSCAN1		;[665] AND DON'T ADVANCE THE COUNTER
	PSCAN2:	MOVMS	FLJCNM		;[665] NOT EOL--MAKE SURE WE EXIT AFTER ONE LINE
 REP 20/44	;17C17
	RUNCM2:	RUN	T1,		;RUN THE PROGRAM
		MOVE	P,SAVPDP	;IF FAILURE, GIVE MESSAGE
		PUSH	P,T1		;SAVE ERROR CODE
	E$$RLF:	MOVE	T1,['RLF',,[ASCIZ /Run linkage failure /] ]
		PUSHJ	P,.TERRP	;TYPE IT
		MOVE	T2,T1		;SAVE /MESSAGE BITS
		POP	P,T1		;RESTORE ERROR CODE
		TXNN	T2,JWW.FL	;SEE IF TEXT NEEDED
		JRST	RUNCM3		;NO--JUST END LINE
		PUSHJ	P,.TOCTW##	;  CODE
		PUSHJ	P,.TSPACE	;SPACE OVER
		MOVEI	T1,N.DEV	;SET POINTER TO RUN BLOCK
		PUSHJ	P,.TFBLK##	;AND TYPE IT
	RUNCM3:	PUSHJ	P,.TCRLF##	;END LINE
		PUSHJ	P,.TCRLF##	;AND LEAVE SPACE
		CLRBFI			;CLEAR TYPE AHEAD
		MOVE	T1,.JBSA	;GET START ADDRESS
		JRST	(T1)		;AND START OVER
 WIT
	RUNCM2:	MOVE	0,[XWD RUNCM0,T2] ;GET A BLT POINTER TO ACS FOR CODE
		BLT	0,T2+RUNCML	;MOVE THE CODE THAT WILL 'RUN' INTO THE ACS
		JRST	T2		;AND GO RUN THE PROGRAM

	RUNCM0:	PHASE	T2		;RELOCATE TO THE ACS
		HRRZ	0,.JBREL	;GET RID OF HIGH SEG AND SHRINK LOW
		CORE	0,		;SHRINK
		JFCL			;IGNORE THIS ERROR
		RUN	T1,		;TRY TO RUN THE USER'S PROGRAM
		OUTSTR	E$$RLF		;OUTPUT FATAL MESSAGE
		EXIT			;AND STOP NOW
	E$$RLF:	ASCIZ /
	?SCNRLF Run failure -- "E 1" for code/
		DEPHASE
	RUNCML==.-RUNCM0		;LENGHT OF TRANSFER BLOCK

 REP 14/55	;17C18
		PUSHJ	P,.SIXSW	;GET NAME
 WIT
		PUSHJ	P,.SIXKW	;GET NAME
 REP 22/58	;17C19
		PUSHJ	P,.SIXSW	;VALUE IS ANOTHER KEYWORD--GET IT
 WIT
		PUSHJ	P,.SIXKW	;VALUE IS ANOTHER KEYWORD--GET IT
 REP 9/59	;17C20
	KEYWDB:	PUSHJ	P,.SIXSW	;GET VALUE AS NAME		[342]
 WIT
	KEYWDB:	PUSHJ	P,.SIXKW	;GET VALUE AS NAME		[342]
 REP 5/64	;17C21
	SWTMP:	PUSHJ	P,.SIXSW	;GET TMP FILE NAME IN SIXBIT
 WIT
	SWTMP:	PUSHJ	P,.SIXKW	;GET TMP FILE NAME IN SIXBIT
 REP 127/67	;17C22
		PUSHJ	P,.TICAN	;SEE IF ALPHA-NUMERIC
 WIT
		PUSHJ	P,.TICAD	;SEE IF ALPHA-NUMERIC
 REP 3/74	;17C23
	KEYS (DENS,<200,556,800,1600,6250,%%,$$,INSTALLATION>)
	IFN DENSIN-1-<FX.DEN_-<ALIGN. (FX.DEN)>>,<PRINTX ? DENSITY:INSTALLATION IS WRONG>
 WIT
	KEYS (DENS,<200-BPI,556-BPI,800-BPI,1600-BPI,6250-BPI,,,INSTALLATION,,,,,,,,DEFAULT>)
	IFN DENSIN-1-<FX.DEN_-<ALIGN. (FX.DEN)>>,<PRINTX ? DENSITY:INSTALLATION IS WRONG>
	IFN <DENSDE/2>-DENSIN,<PRINTX ? DENSITY:DEFAULT IS WRONG>
 REP 8/74	;17C24
	KEYS (VRB,<PREFIX,FIRST,CONTINUATION,$$,$%,%$,%%,ADDRESS>)
 WIT
	KEYS (VRB,<PREFIX,FIRST,CONTINUATION,,,,,ADDRESS>)
 REP 37/99	;17C25
		HRROI	T1,.TSTRG##	;SET ASCII STRING FORMAT
 WIT
		HRROI	T1,.T8STR##	;SET ASCII STRING FORMAT
 REP 47/99	;17C26
	AS8M2:	CAMN	T1,[POINT 7,.NMUE,31] ;SEE IF OVERFLOW
 WIT
	AS8M2:	CAMN	T1,[POINT 8,.NMUE,31] ;SEE IF OVERFLOW
 REP 17/101	;17C27
		  JRST	STRNML		;STORE IN .NMUL AND RETURN	[314]
 WIT
		  JRST	[CAIE	C,.CHCNV	;IS IT THE SPECIAL QUOTE CHARACTER?
			 JRST	STRNML		;NO--STORE IN .NMUL AND RETURN
			 PUSHJ	P,.TIAUC	;YES--GET NEXT
			 CAIL	C,40		;IS IT IN SIXBIT RANGE?
			 CAILE	C,137		;BOTH WAYS?
			 JRST	STRNML		;NO--MAYBE ADD AN ERROR HERE?
			 JRST	.+1]		;WE GOT A GOOD ONE
 INS 1/102	;17C28
	;.SIXKW -- INPUT A SIXBIT WORD FROM COMMAND STRING
	;.SIXKC  -- DITTO (CHARACTER ALREADY IN C)
	;TERMINATES AT FIRST NON-ALPHANUMERIC/NON-HYPHEN CHARACTER
	;THROWS AWAY ANY CHARACTERS BEYOND THE FIRST SIX
	;CALL:	PUSHJ	P,.SIXKC/.SIXKW
	;	RETURN WITH WORD IN N
	;USES T1    UPDATES C (SEPARATOR)

	.SIXKW::PUSHJ	P,.TIAUC	;PRIME THE PUMP

	.SIXKC::MOVEI	N,0		;CLEAR NAME
		MOVEI	T1,.TSIXN##	;SET SIXBIT FORMAT		[314]
		MOVEM	T1,.LASWD	; FOR ERROR PRINTING		[314]
		MOVE	T1,[POINT 6,N]	;INITIALIZE BYTE POINTER FOR WORD

	SIXK1:	PUSHJ	P,.TICAD	;SEE IF CHARACTER IS ALPHA-NUMERIC
		  JRST	[CAIE	C,.CHCNV	;IS IT THE SPECIAL QUOTE CHARACTER?
			 JRST	STRNML		;NO--STORE IN .NMUL AND RETURN
			 PUSHJ	P,.TIAUC	;YES--GET NEXT
			 CAIL	C,40		;IS IT IN SIXBIT RANGE?
			 CAILE	C,137		;BOTH WAYS?
			 JRST	STRNML		;NO--MAYBE ADD AN ERROR HERE?
			 JRST	.+1]		;WE GOT A GOOD ONE
		SUBI	C," "-' '	;CONVERT TO SIXBIT
		TLNE	T1,(77B5)	;DON'T OVERFLOW
		IDPB	C,T1		;STORE CHARACTER
		PUSHJ	P,.TIAUC	;GO GET ANOTHER CHARACTER
		JRST	SIXK1		;LOOP BACK TO PROCESS IT
 REP 8/103	;17C29
	;	PUSHJ	P,.TICAN
 WIT
	;	PUSHJ	P,.TICAD
 REP 15/103	;17C30
		JRST	.POPJ1##	;YES, WIN
 WIT
		AOS	(P)		;YES, WIN
 INS 3/107	;17C31
			 SKIPN	SCANPC	;[663] UNLESS AT BEGINNING OF LINE,
			 JRST	.+1	;[663] THEN SHOW IT TO THE COMPRESSOR
 INS 28/149	;17C32
		HRLI	T1,1		;INDICATE STANDARD PATH BLOCK
 REP 17/161	;17C33
		MOVM	T1,T1		;AND MAKE POSITIVE
 WIT
		IDIVI	T1,(T4)		;PERFORM FIRST DIVISION
		MOVM	T2,T2		;MAKE SURE OF REMAINDER
		MOVM	T1,T1		;AND MAKE POSITIVE
		CAIA			;SKIP EXTRA DIVISION
 REP 35/161	;17C34
		  ADDI	T1,"A"-"9"+1	;YES--SWITCH TO ALPHABETICS
 WIT
		  ADDI	T1,"A"-"9"-1	;YES--SWITCH TO ALPHABETICS
 REP 37/164	;17C35
		XMOVEI	T3,.		;NEED TO KNOW CURRENT SECTION
		HRRZM	T2,.BYTPT	;INCLUDE ADDRESS INCASE 1-WORD POINTER
 WIT
		HRRM	T2,.BYTPT	;INCLUDE ADDRESS INCASE 1-WORD POINTER
 SUM 65189