Google
 

Trailing-Edge - PDP-10 Archives - bb-jr93i-bb - alglib.c07
There are 14 other files named alglib.c07 in the archive. Click here to see a list.
 DEL 36/143	;07C1

 REP 45/143	;07C2
		JRST	.EXIT(DL)
	READ4:	MOVE	A5,.V2(DL)	; GET FORMAL ADDRESS
		ADDI	A5,(DB)
		XCT	(A5)		; [251] GET STRING HEADER
		PUSH	SP,A2		; AND SAVE IT
		MOVSI	A0,400000	; [251] SETUP TO GET EXPANDABLE HEAP SPACE
	EDIT(035) ; DONT WASTE TIME CLEARING THE SPACE FIRST
		PUSHJ	SP,GETOWN	; [251][E035] GET IT FOR THE NEW STRING
		MOVEM	A1,GETTMP(DB)	; [251] SET "HEAP SPACE IN USE" IN CASE OF ERROR
		HLRZ	A0,-1(A1)	; [251] GET LENGTH OF NEW SPACE
		ADDI	A0,-2(A1)	; [251] CALCULATE UPPER BOUND OF SPACE
		MOVEI	A2,0		; CLEAR BYTE COUNT
		HRLI	A1,(POINT 7,)	; [251] MAKE IT INTO A BYTE PTR.
		MOVE	A3,A1		; [251] COPY ADDRESS OF NEW STRING SPACE

	READ6:	JSP	AX,INCHAR
		CAIE	A13,""""	; SEARCH FOR "
		JRST	READ6

	READ7:	JSP	AX,INCHAR	; GET NEXT SYMBOL
		CAIN	A13,""""	; "?
		JRST	READ9		; YES

	READ8:	CAILE	A0,(A3)		; NO - SAFE TO STORE?
		JRST	READ5		; YES
		CCORE1	^D128		; NO - SHIFT UP THE STACK
		HRLZI	A4,^D128
		ADDM	A4,-1(A1)	; AND UPDATE THE LENGTH WORD
		ADDI	A0,^D128	; AND THE TOP ADDRESS

	READ5:	IDPB	A13,A3		; YES - STORE BYTE
		AOJA	A2,READ7	; COUNT BYTES AND CONTINUE

	EDIT(1017)	;DON'T LOSE CHR. AFTER END OF STRING
	READ9:	PUSHJ	SP,NXTBYT	; [251][E1017] FOUND DOUBLE-QUOTE, GET NEXT BYTE
		JRST	READ90		; [312] EOF, DONE
		CAIE	A13,""""	; [251][E1017] ANOTHER DOUBLE-QUOTE?
		JRST	READ90		; [251][E1017] NO, END OF STRING
		JSP	AX,INCHAR	; [251][E1017] YES, ADVANCE BUFFER PTR.
		JRST	READ8		; [251][E1017] AND STORE THE BYTE
	READ90:	POP	SP,A4		; [251] FINISHED - RESTORE STRING ADDRESS
		MOVEI	A4,@A4
		PUSH	SP,A0		; [251] SAVE AC'S FOR A MOMENT
		PUSH	SP,A1		; [251]
		PUSH	SP,A2		; [251]
		MOVEI	A0,0		; [251] SETUP TO DELETE OLD STRING
		SKIPE	A1,STR1(A4)	; [251] DID IT EXIST BEFORE?
		PUSHJ	SP,GETOWN	; [251] YES, DELETE IT SINCE WE HAVE A NEW ONE
		POP	SP,A2		; [251] NO, RESTORE AC'S
		POP	SP,A1		; [251]
		POP	SP,A0		; [251]
		JUMPE	A2,READ11	; [251] NULL STRING?
		TLO	A2,STRDYN	; [251] NO - ADD CORRECT BITS TO COUNT
		LRSTOR	A1,STR1(A4)	; [251] AND UPDATE STRING HEADER
		SUBI	A0,(A3)		; REMAINING SPACE
		JUMPE	A0,READ14	; FINISHED IF ALL USED (UNLIKELY!)
		HRLZ	A0,A0		; MOVE TO LEFT HALF
		MOVEM	A0,1(A3)	; AND SET UP LENGTH OF REMAINDER
		SUB	A0,-1(A1)
		MOVNM	A0,-1(A1)	; SET UP LENGTH OF USED PORTION
		MOVEI	A1,2(A3)	; SET UP ADDRESS OF REMAINDER
	READ10:	MOVEI	A0,0
		PUSHJ	SP,GETOWN	; DELETE REMAINDER
	READ14:	MOVE	A5,.V2(DL)
		ADDI	A5,2
		SETZM	GETTMP(DB)	; [341][251] CLEAR "HEAP SPACE IN USE" FLAG
		AOBJN	A5,READ12	; [341] CARRY ON IF MORE THINGS TO READ
		JRST	.EXIT(DL)

	READ11:	SETZM	STR1(A4)	; NULL STRING
		SETZM	STR2(A4)
		JRST	READ10		; DELETE SPACE OBTAINED
 WIT
		JRST	.EXIT(DL)	; [345]
	READ4:	MOVE	AX,.V2(DL) ; [345] GET FORMAL ADDRESS
		ADDI	AX,(DB)		; [345] RELOCATE IT
		XCTA	(AX)		; [345] GET ADDRESS OF STRING
		PUSH	SP,A2		; [345] AND SAVE IT ON THE STACK
		JSP	AX,INCHAR	; [345] GET NEXT SYMBOL
		CAIE	A13,""""	; [345] IS IT A QUOTE?
		JRST	.-2		; [345] NO, IGNORE IT
		SETZB	A0,A1		; [345] YES, CLEAR COUNT
		MOVSI	A2,(POINT 7,0)	; [345] AND INITIALIZE BYTE POINTER

	READ5:	JSP	AX,INCHAR	; [345] READ NEXT CHAR
		CAIE	A13,""""	; [345] IS THIS ANOTHER QUOTE?
		JRST	READ6		; [345] NO, DATA CHARACTER
		PUSHJ	SP,NXTBYT	; [345] LOOK AT NEXT CHARACTER
		JRST	READ8		; [345] EOF, RETURN EOF STATUS FOR IOCHAN
		CAIE	A13,""""	; [345] IS IT A QUOTE TOO?
		JRST	READ8		; [345] NO, END OF STRING
		JSP	AX,INCHAR	; [345] YES, ADVANCE BYTE POINTER
	READ6:	TLNE	A2,760000	; [345] FILLED A COMPLETE WORD?
		JRST	READ7		; [345] NO
		EXCH	A0,(SP)		; [345] YES, SAVE IT ON THE STACK
		PUSH	SP,A0		; [345] REPLACE STRING HEADER ADDRESS
		MOVSI	A2,(POINT 7,A0)	; [345] RESET BYTE POINTER
		SETZ	A0,		; [345] AND CLEAR JUNK AGAIN
	READ7:	IDPB	A13,A2		; [345] STORE CHARACTER INTO A0
		AOJA	A1,READ5	; [345] COUNT IT AND LOOP

	READ8:	SKIPN	A2,A1		; [345] GET COUNT OF CHARACTERS
		JRST	READ9		; [345] NONE - NULL STRING
		EXCH	A0,(SP)		; [345] PUSH LAST WORD OF STRING
		PUSH	SP,A0		; [345] AND REPLACE HEADER ADDRESS
		ADDI	A2,4		; [345] ROUND UP NUMBER OF CHARACTERS
		IDIVI	A2,5		; [345] CONVERT TO NUMBER OF WORDS
		MOVNI	A0,-1(A2)	; [345] GET -(# OF WORDS)
		ADDI	A0,-1(SP)	; [345] GET BASE ADDRESS
		SUBI	A0,(DB)		; [345] DELOCATE IT
		HRLI	A0,(<POINT 7,0(DB)>) ; [345] AND FORM BYTE POINTER
		HRLI	A2,(A2)		; [345] GET COUNT IN L.H. OF A2 ALSO
	READ9:	EXCH	A2,(SP)		; [345] SAVE COUNT, GET HEADER ADDRESS
		MOVE	AX,.V2(DL)	; [345] GET FORMAL ADDRESS
		ADDI	AX,(DB)		; [345] RELOCATE IT
		XCT	1(AX)		; [345] OVERWRITE STRING
		POP	SP,A2		; [345] RESTORE COUNT
		SUB	SP,A2		; [345] ADJUST THE STACK

	READ14:	MOVE	A5,.V2(DL)	; [345]
		ADDI	A5,2		; [345]
		AOBJN	A5,READ12	; [345] CARRY ON IF MORE
		JRST	.EXIT(DL)	; [345]
 DEL 30/159	;07C3

 REP 44/159	;07C4
		PUSH	SP,A2		; AND SAVE IT
		SKIPE	.I(DL)		; IF HE GAVE A STATUS-WORD
		XCTA	.I(DL)		; EVALUATE ITS ADDRESS
		PUSH	SP,A2		; AND SAVE THAT
 WIT
		MOVEM	A2,A01TMP(DB)	; [346] SAVE IT
		SKIPE	.I(DL)		; IF HE GAVE A STATUS-WORD
		XCTA	.I(DL)		; EVALUATE ITS ADDRESS
		MOVEM	A2,A01TMP+1(DB)	; [346] AND SAVE THAT
 DEL 55/159	;07C5
 REP 7/160	;07C6
		PUSHJ	SP,GETCHR	; [324] GET FIRST BYTE OF FILESPEC
		 PUSHJ	SP,OPFERR	; [324] ERROR IF STRING EOF IS FOUND
		CAIG	A2,'Z'		; [324] FIRST CHR. MUST BE ALPHANUMERIC
		CAIGE	A2,'0'		; [324]
		 PUSHJ	SP,OPFERR	; [324] ISN'T, CHR. CAN'T APPEAR HERE
		JRST	OPFNM1		; [324] NO, BEGIN BUILDING FILENAME
 WIT
	SPC1:	PUSHJ	SP,GETCHR	; [346] GET FIRST BYTE OF FILESPEC
		 JSP	A0,OPFERR	; [346] ERROR IF STRING EOF IS FOUND
		CAIN	A2,' '		; [346] SPACE?
		 JRST	SPC1		; [346] YES, IGNORE
		CAIG	A2,'Z'		; [324] FIRST CHR. MUST BE ALPHANUMERIC
		CAIGE	A2,'0'		; [324]
		 JSP	A0,OPFERR	; [346] ISN'T, CHR. CAN'T APPEAR HERE
		JRST	OPFNM1		; [324] BEGIN BUILDING FILENAME
 INS 21/160	;07C7
		CAIN	A2,','		; [346] COMMA IN FILENAME?
		 JSP	A0,OPFERR	; [346] YES, ILLEGAL
		CAIN	A2,' '		; [346] SPACE IN FILENAME?
		 JRST	SPCDO		; [346] YES, GO EXPECT EOF OR OPEN-BRACKET
 REP 26/160	;07C8
		CAIN	A2,'['		; [324] BEGINNING OF PPN AND SFD SPEC.?
		 JRST	OPFPPN		; [324] YES, GO PARSE IT
		CAIE	A2,'.'		; [324] NO, POINT?
		 PUSHJ	SP,OPFERR	; [324] NO, FILESPEC IS BAD
 WIT
		CAIE	A2,'.'		; [346] DOES EXTENSION FOLLOW?
		 JRST	SPCDO1		; [346] NO, GO CHECK SPACES/EOF/OPEN-BRACKET
 INS 38/160	;07C9
		CAIN	A2,','		; [346] COMMA IN FILENAME?
		 JSP	A0,OPFERR	; [346] YES, ILLEGAL
		CAIN	A2,' '		; [346] NO, SPACE?
		 JRST	SPCDO		; [346] YES, GO EXPECT EOF OR OPEN-BRACKET
 REP 41/160	;07C10
		PUSHJ	SP,GETCHR	; [324] GET NEXT CHR.
		 JRST	OPFNOW		; [324] GO OPEN FILE IF STRING EOF IS FOUND
		CAIE	A2,'['		; [324] BEGINNING OF PPN AND SFD SPEC?
		 PUSHJ	SP,OPFERR	; [324] NO, BAD FILESPEC
 WIT
	SPCDO:	PUSHJ	SP,GETCHR	; [346] GET NEXT CHR.
		 JRST	OPFNOW		; [324] GO OPEN FILE IF STRING EOF IS FOUND
	SPCDO1:	CAIN	A2,' '		; [346] SPACE?
		 JRST	SPCDO		; [346] YES, IGNORE IT RIGHT NOW
		CAIE	A2,'['		; [324] BEGINNING OF PPN AND SFD SPEC?
		 JSP	A0,OPFERR	; [346] NO, BAD FILESPEC
 REP 48/160	;07C11
		 JRST	[JUMPE	A3,OPFERR	; [324] DON'T ALLOW EOF AFTER BRACKET
			MOVEI	A2,']'		; [324] OK, FAKE OURSELVES OUT
			JRST	.+1]		; [324] AND CONTINUE
		HRLZ	A7,A3		; [324] SAVE PROJECT NUMBER IN A7 LEFTHALF
		CAIN	A2,']'		; [324] END OF ENTIRE FILESPEC?
		 JRST	OPFPP1		; [324] YES, GO BUILD PPN AND OPEN FILE
		PUSHJ	SP,GETPP	; [324] NO, GET PROGRAMMER NUMBER
		 MOVEI	A2,']'		; [324] EOF, FAKE OURSELVES OUT
		HRR	A7,A3		; [324] MAKE COMPLETE PPN
 WIT
		 JSP	A0,OPFERR	; [346] EOF, DON'T ALLOW IT AFTER OPEN-BRACKET
		CAIE	A2,']'		; [346] WAS DELIMITER A CLOSE-BRACKET OR
		CAIN	A2,' '		; [346] A SPACE?
		 JSP	A0,OPFERR	; [346] YES, BAD FILESPEC
		HRLZ	A7,A3		; [324] SAVE PROJECT NUMBER IN A7 LEFTHALF
		SETZ	A2,		; [346] NO, CLEAR DELIMITER
		PUSHJ	SP,GETPP	; [346] GET PROGRAMMER NUMBER
		 JRST	OPFPP0		; [346] EOF, GO PARSE WHAT WE HAVE
		CAIN	A2,','		; [346] COMMA (BEGINNING OF SFD'S)?
		 JRST	OPFPP0		; [346] YES, GO HANDLE IT
		CAIE	A2,']'		; [346] NO, WAS DELIMITER CLOSE-BRACKET OR
		CAIN	A2,' '		; [346] SPACE?
		TRNA			; [346] YES, LOOK FOR EOF
		 JSP	A0,OPFERR	; [346] NO, BAD FILESPEC
	SPEOF0:	PUSHJ	SP,GETCHR	; [346] ALLOW SPACES UNTIL EOF BUT NOTHING ELSE
		 JRST	OPFPP0		; [346] FOUND EOF, GO OPEN FILE
		CAIN	A2,' '		; [346] MORE SPACES?
		 JRST	SPEOF0		; [346] YES, LOOP
		JSP	A0,OPFERR	; [346] NO, BAD FILESPEC

	OPFPP0:	HRR	A7,A3		; [346] MAKE COMPLETE PPN
 INS 73/160	;07C12
		CAIN	A2,' '		; [346] NO, WAS DELIMITER A SPACE?
		 JRST	SPCEOF		; [346] YES, FIND EOF AND OPEN FILE
 REP 81/160	;07C13
		SOJG	A1,OPFSF1	; [324] NO, LOOP UNTIL MAX. SFD NAMES ARE READ
		PUSHJ	SP,GETCHR	; [324] GET NEXT CHR. AFTER MAX. SFD'S READ
		 JRST	OPFNOW		; [324] HAD BETTER BE EOF
		PUSHJ	SP,OPFERR	; [324] ELSE BAD FILESPEC

	OPFSF2:	CAIN	A2,','		; [324] NULL SFD NAME FOUND?
		 PUSHJ	SP,OPFERR	; [324] YES, ILLEGAL FILESPEC
 WIT
		CAIE	A2,' '		; [346] NO, WAS DELIMITER A SPACE?
		 SOJG	A1,OPFSF1	; [324] NO, LOOP UNTIL MAX. SFD NAMES ARE READ
	SPCEOF:	PUSHJ	SP,GETCHR	; [346] ALLOW SPACES UNTIL EOF BUT NOTHING ELSE
		 JRST	OPFNOW		; [346] FOUND EOF, GO OPEN FILE
		CAIN	A2,' '		; [346] MORE SPACES?
		 JRST	SPCEOF		; [346] YES, LOOP
		JSP	A0,OPFERR	; [346] NO, BAD FILESPEC

	OPFSF2:	CAIN	A2,','		; [324] NULL SFD NAME FOUND?
		 JSP	A0,OPFERR	; [346] YES, ILLEGAL FILESPEC
 REP 95/160	;07C14
		PUSHJ	SP,OPFILE	; [324] AND GO OPEN FILE
 WIT
		SKIPE	.PTPPN(A5)	; [346] NULL PPN AND NULL FIRST SFD NAME?
		 JRST	OPFNW1		; [346] NO, USE PATH BLOCK AS CREATED HERE
		SKIPN	.PTSFD(A5)	; [346]
		 SETZ	A5,		; [346] YES, USE DEFAULT PATH ONLY
	OPFNW1:	PUSHJ	SP,OPFILE	; [346] GO OPEN FILE
 REP 101/160	;07C15
		POP	SP,A2		; [324] GET ADDR. OF I (OR 0)
		JUMPE	A0,[POP	SP,(SP)		; [324] RESTORE LABEL ADDR.
			JRST	.EXIT(DL)]	; [324] AND EXIT
		SUBI	A0,100		; [324] ERROR CODE HAS 100 ADDED TO IT BY OTS
		SKIPE	.I(DL)		; [324] HAVE ANYPLACE TO PUT ERROR CODE?
		XCT	.I+1(DL)	; [324] YES, PLANY CODE
		POP	SP,A2		; [324] GET LABEL ADDRESS
 WIT
		JUMPE	A0,.EXIT(DL)	; [346] EXIT IF NO ERROR
		SUBI	A0,100		; [324] ERROR CODE HAS 100 ADDED TO IT BY OTS
		MOVE	A2,A01TMP+1(DB)	; [346] GET ADDR. OF I (OR 0)
		SKIPE	.I(DL)		; [324] HAVE ANYPLACE TO PUT ERROR CODE?
		 XCT	.I+1(DL)	; [324] YES, PLANT CODE
		MOVE	A2,A01TMP(DB)	; [346] NO, GET ADDR. OF LABEL (OR 0)
 REP 113/160	;07C16
	; [324] GET UP TO SIX OCTAL NUMBERS IN A3 RIGHTHALF.  USED IN BUILDING PPN.
	; [324] DELIMITING CHR. IS LEFT IN A2.
 WIT

	;[346] SUBROUTINES

	; GET UP TO SIX OCTAL NUMBERS IN A3 RIGHTHALF (USED IN BUILDING PPN).
	; DELIMITING CHR. IS LEFT IN A2.  RETURN +1 IF EOF, +2 IF NORMAL.
 INS 119/160	;07C17
		CAIE	A2,' '		; [346] SPACE OR
 REP 125/160	;07C18
		 PUSHJ	SP,OPFERR	; [324] NO, BAD SPEC.
 WIT
		 JSP	A0,OPFERR	; [346] NO, BAD SPEC.
 REP 132/160	;07C19
		 JRST	AOSRET		; [324] YES, END OF PROJECT NUMBER
 WIT
		 JRST	AOSRET		; [324] END OF PROJECT NUMBER IF EOF
 REP 137/160	;07C20
		PUSHJ	SP,OPFERR	; [324] NO, BAD FILESPEC

	; [324] GET UP TO SIX SFD-TYPE CHRS. IN A7.  DELIMITING CHR. IS LEFT IN A2.
 WIT
		JSP	A0,OPFERR	; [346] NO, BAD FILESPEC


	; GET UP TO SIX SFD-TYPE CHRS. IN A7.  DELIMITING CHR. IS LEFT IN A2.
	; RETURNS +1 ALWAYS.
 INS 145/160	;07C21
		CAIE	A2,' '		; [346] SPACE OR
 REP 151/160	;07C22
		 PUSHJ	SP,OPFERR	; [324] YES, BAD FILESPEC
		CAILE	A2,'9'		; [324] WITHIN RANGE OF
		CAIL	A2,'A'		; [324] GOOD CHRS.?
		 TRNA			; [324] YES, SKIP
		PUSHJ	SP,OPFERR	; [324] NO, BAD FILESPEC
 WIT
		 JSP	A0,OPFERR	; [346] YES, BAD FILESPEC
		CAILE	A2,'9'		; [324] WITHIN RANGE OF
		CAIL	A2,'A'		; [324] GOOD CHRS.?
		TRNA			; [324] YES, SKIP
		 JSP	A0,OPFERR	; [346] NO, BAD FILESPEC
 REP 165/160	;07C23
		PUSHJ	SP,OPFERR	; [324] NO, BAD FILESPEC

	; [324] GET SIXBIT BYTE SUBROUTINE - RETURNS THE NEXT SIXBIT CHARACTER OF
	; [324] THE FILESPEC IN A2.  THE CHR. IS GUARANTEED TO BE A LEGITIMATE
	; [324] SIXBIT FILESPEC-TYPE CHR. (UPPERCASE, ALPHANUMERIC, COMMA, OPEN
	; [324] OR CLOSE BRACKET, OR PERIOD).
	; [324]
	; [324]	RETURN:	+1	END OF FILESPEC STRING
	; [324]		+2	NORMAL, A2/ SIXBIT CHR.
	; [324]
	; [324]
 WIT
		JSP	A0,OPFERR	; [346] NO, BAD FILESPEC


	; GET SIXBIT BYTE SUBROUTINE - RETURNS THE NEXT SIXBIT CHARACTER OF THE
	; FILESPEC IN A2.  THE CHR. IS GUARANTEED TO BE A LEGITIMATE SIXBIT
	; FILESPEC-TYPE CHR. (UPPERCASE, ALPHANUMERIC, COMMA, OPEN OR CLOSE BRACKET,
	; OR PERIOD).  REPEATED CALLS CAN BE MADE AFTER EOF IS DETECTED - GETCHR WILL
	; CONTINUE TO TAKE THE EOF RETURN.
	;
	;	RETURN:	+1	END OF STRING
	;		+2	NORMAL, A2/ SIXBIT CHR.
	;
	;
 REP 183/160	;07C24
		 TRNA			; [324] SKIP IF GOOD SO FAR
		 PUSHJ	SP,OPFERR	; [324] ELSE BAD CHR.
 WIT
		TRNA			; [324] SKIP IF GOOD SO FAR
		 JSP	A0,OPFERR	; [346] ELSE BAD CHR.
 REP 188/160	;07C25
		CAIGE	A2,"0"		; [324] NO, BELOW ASCII ZERO?
		 PUSHJ	SP,OPFERR	; [324] YES, BAD CHR.
 WIT
		CAIN	A2,11		; [346] NO, TAB?
		 MOVEI	A2," "		; [346] YES, TURN IT INTO A SPACE
		CAIN	A2," "		; [346] SPACE?
		 JRST	GETCH1		; [346] YES, GOOD CHR. TOO
		CAIGE	A2,"0"		; [324] NO, BELOW ASCII ZERO?
		 JSP	A0,OPFERR	; [346] YES, BAD CHR.
 REP 193/160	;07C26
		 PUSHJ	SP,OPFERR	; [324] YES, CHR. IS BAD
 WIT
		 JSP	A0,OPFERR	; [346] YES, CHR. IS BAD
 REP 198/160	;07C27
	OPFERR:	MOVE	A1,.N(DL)	; [324] BAD FILESPEC, GET CHANNEL NUMBER BACK
 WIT
	OPFERR:	MOVEI	A0,^D346	; [346] SAY WE GOT ERROR 346. (BAD FILESPEC)
		MOVE	A2,A01TMP+1(DB)	; [346] GET ADDR. OF I (OR 0)
		SKIPE	.I(DL)		; [346] HAVE ANYPLACE TO PUT ERROR CODE?
		XCT	.I+1(DL)	; [346] YES, PLANT CODE
		MOVE	A2,A01TMP(DB)	; [346] GET ADDR. OF LABEL, OR 0
		 JUMPN	A2,(A2)		; [346] TAKE ERROR EXIT IF ONE EXISTS
		MOVE	A1,.N(DL)	; [346] ELSE GET CHANNEL NUMBER BACK
 SUM 234948