Google
 

Trailing-Edge - PDP-10 Archives - bb-bt99r-bb - forsrt.c24
There are no other files named forsrt.c24 in the archive.
 REP 3/1	;24C1
		TV	SORT - FORTRAN interface to stand-alone SORT, 11(5032)
	SUBTTL	D.M.NIXON/DMN/DZN/BRF/EGM/BL/RJD/CDM/JLC/AHM/TGS	10-Mar-87
 WIT
		TV	SORT - FORTRAN interface to stand-alone SORT, 11(5042)
	SUBTTL	D.M.NIXON/DMN/DZN/BRF/EGM/BL/RJD/CDM/JLC/AHM/TGS/DPM	10-Mar-87
 INS 170/1	;24C2
	5042	DPM	18-Jul-89	SPR:NONE
		Add code to support multiple sharable high segments.  First
		try to get the high segment using a SEGOP. UUO.  If that
		fails, resort to the old MERGE. UUO.  Also remove HALTs
		on failures and replace with the appropriate error messages.
 REP 7/11	;24C3
	SRTBLK:	BLOCK	6			;[3205] Leave room for MERGE. arg block

 WIT
	SRT.ZB:!				;[5042] START OF AREA TO ZERO
	SRTSEG:	BLOCK	7			;[5042] SEGOP. UUO BLOCK
	SRTBLK:	BLOCK	.SGFLN			;[5042] FILSPEC BLOCK FOR IMAGE
	SRTPHY:	BLOCK	1			;[5042] 0 OR UU.PHY AS NECESSARY
	SRTSHR:	BLOCK	1			;[5042] NON-ZERO IF SHARABLE SORT
	SRTSCN:	BLOCK	1			;[5042] SEGMENT SECTION
	SRT.ZE:!				;[5042] END OF AREA TO ZERO
 REP 70/12	;24C4
	SRTMRG:	MOVE	T1,[SRTEXE,,SRTBLK] 	;[3362][3205]Point from hiseg to lowseg
		BLT	T1,SRTBLK+SRTEXL-1	;[3205] Move the block downstairs
		MOVEI	T1,SRTBLK		;[5] MERGE IN SORT
		MERGE.	T1,			;[5]   ..
		 HALT	ABORT.			;[3205] Failed, complain
		DMOVE	L,SAVEL			;[5] RETORE AC L AND P
		MOVEI	SF,FUNCT.		;[5] TELL SORT WHERE FUNCT. IS
		MOVEI	SR,SORT1		;[3205] CALL SORT TO DO THE REAL WORK
		HRRZ	P2,600000+.JBHSA##	;[5]   ..
		JRST	2(P2)			;[3205]   ..

	SORT1:	 JRST	[MOVEI	L,1+[XWD 0,0]	;[5] FAILED, CALL EXIT.
			 PUSHJ	P,EXIT.##	;[5]
			 JRST	.+1]		;[5] CONTINUED?????

		MOVEI	T1,SRTSIZ		;[5] OK, GET PAGE COUNT
		MOVEI	T2,1			;[5] SETUP PAGE. UUO
		MOVE	T3,[PA.GAF+SRT1ST]	;[5]   ..

	SORT2:	MOVE	T4,[.PAGCD,,T2]		;[5] DESTROY A PAGE
		PAGE.	T4,			;[5]   ..
		 JFCL				;[5] FAILED
		ADDI	T3,1			;[5] LOOP
		SOJG	T1,SORT2		;[5]   ..

	;[3205] Try and return pages 600:677

		SKIPE	%PASRT			;[3362] FOROP. preallocated?
		 POPJ	P,			;[3362] Yes, don't deallocate either
 WIT
	SRTMRG:	MOVE	T1,[SRT.ZB,,SRT.ZB+1]	;[5042] SET UP BLT
		SETZM	SRT.ZB			;[5042] CLEAR FIRST WORD
		BLT	T1,SRT.ZE-1		;[5042] CLEAR STORAGE
	;BUILD FILESPEC BLOCK
		MOVSI	T1,'SYS'		;[5042] DEVICE NAME
		MOVEM	T1,SRTBLK+.RNDEV	;[5042] SAVE IT
		MOVE	T1,['FSORT ']		;[5042] NAME OF SORT IMAGE
		MOVEM	T1,SRTBLK+.RNNAM	;[5042] SAVE IT
	;BUILD SEGOP. UUO BLOCK
		MOVE	T1,[7,,.SGGET]		;[5042] LENGTH,,FUNCTION CODE
		MOVEM	T1,SRTSEG+.SGFNC	;[5042] SAVE
		MOVE	T1,[IFIW SRTBLK]	;[5042] ADDRESS OF FILESPEC BLOCK
		MOVEM	T1,SRTSEG+.SGFSP	;[5042] SAVE
	;READ EXECUTE-ONLY STATE
		HRROI	T1,.GTSTS		;[5042] GET JOB STATUS
		GETTAB	T1,			;[5042] FROM THE MONITOR
		  SETZ	T1,			;[5042] CAN'T SO ASSUME NOT XO
		TRNN	T1,JS.XO		;[5042] EXECUTE ONLY?
		TDZA	T2,T2			;[5042] NO
		MOVEI	T2,UU.PHY		;[5042] PHYSICAL ONLY
		MOVEM	T2,SRTPHY		;[5042] SAVE INCASE SEGOP FAILS
	;LOAD UP A SHARABLE IMAGE
	SORTA:	XMOVEI	T1,SRTSEG		;[5042] SET UP UUO AC
		SEGOP.	T1,(T2)			;[5042] ATTACH HIGH SEGMENT
		  JRST	SORTC			;[5042] FAILED--TRY A MERGE
		HRRZ	T1,SRTSEG+.SGORG	;[5042] GET SEGMENT ORIGIN
		TRZ	T1,777			;[5042] REDUCE TO ONLY A SECTION
		MOVEM	T1,SRTSCN		;[5042] SAVE SEGMENT SECTION
		IOR	T1,[.PAGCA,,SRT1ST]	;[5042] GET STARTING PAGE ARGS
		PAGE.	T1,			;[5042] GET ACCESSIBILITY BITS
		  MOVNI	T1,1			;[5042] ???
		TXNN	T1,PA.GNE		;[5042] PAGE EXIST?
		JRST	SORTB			;[5042] YES--CANT SHARE IMAGE
		MOVE	T1,[.PAGCD,,T2]		;[5042] SET UP UUO AC
		MOVEI	T2,SRT1ST		;[5042] FIRST DATA PAGE
		ADD	T2,SRTSCN		;[5042] INCLUDE SECTION
		HRRZ	T3,SRTSEG+.SGORG	;[5042] GET SEGMENT ORIGIN
		SUB	T2,T3			;[5042] COMPUTE -VE PAGE COUNT
		JUMPGE	T2,SORTB		;[5042] IF INCORRECTLY BUILT SORT
		MOVE	T3,SRTSCN		;[5042] GET SEGMENT SECTION
		IOR	T3,[PA.GDC+SRT1ST]	;[5042] OFFSET TO STARTING PAGE
		PAGE.	T1,			;[5042] CREATE ALL DATA PAGES
		  JRST	SORTE1			;[5042] GIVE UP
		HRRZ	P2,SRTSEG+.SGORG	;[5042] GET SEGMENT ORIGIN
		LSH	P2,11			;[5042] CONVERT PAGE TO ADDRESS
		SETOM	SRTSHR			;[5042] FLAG SHARABLE SEGMENT
		JRST	SORTGO			;[5042] AND CONTINUE
	;DELETE JUNK PAGES OCCUPIED BY INCOMPATIBLE FSORT
	SORTB:	MOVE	P,SAVEP			;[5042] RESET PDL
		$FCALL	SII,.+1			;[5042] ISSUE WARNING & CONTINUE
	;	$FERR (%,SII,21,120,<FSORT image cannot be shared>) ;[5042]
		MOVEI	T1,.SGREL		;[5042] FUNCTION CODE
		HRRM	T1,SRTSEG+.SGFNC	;[5042] TO RELEASE A SEGMENT
		XMOVEI	T1,SRTSEG		;[5042] POINT TO BLOCK
		SEGOP.	T1,			;[5042] DELETE THE HIGH SEGMENT
		  JRST	SORTE1			;[5042] GIVE UP
	;LOAD UP A NON-SHARABLE IMAGE
	SORTC:	MOVE	T1,[SRTBLK,,SRTBLK+1]	;[5042] SET UP BLT
		SETZM	SRTBLK			;[5042] CLEAR FIRST WORD
		BLT	T1,SRTBLK+5		;[5042] CLEAR ENTIRE BLOCK
		MOVSI	T1,'SYS'		;[5042] DEVICE NAME
		MOVEM	T1,SRTBLK+.RNDEV	;[5042] SAVE IT
		MOVE	T1,['FSORT ']		;[5042] NAME OF SORT IMAGE
		MOVEM	T1,SRTBLK+.RNNAM	;[5042] SAVE IT
		MOVE	T1,[SRT1ST,,SRTLST]	;[5042] RANGE OF PAGES TO MERGE
		MOVEM	T1,SRTBLK+.RNMEM	;[5042] SAVE
		MOVEI	T1,SRTBLK		;[5042] POINT TO FILESPEC BLOCK
		MOVE	T2,SRTPHY		;[5042] AND GET PHYSICAL-ONLY BIT
		MERGE.	T1,(T2)			;[5042] MERGE SELECTED PAGES
		  JRST	SORTE2			;[5042] FAILED--ISSUE ERROR
		MOVEI	P2,SRT1ST_11		;[5042] GET STARTING ADDRESS
		JRST	SORTGO			;[5042] AND CONTINUE
	;ERROR HANDLING
	SORTE1:	MOVE	P,SAVEP			;[5042] RESET PDL
		$FCALL	CSP,ABORT.		;[5042] ISSUE ERROR
	;	$FERR (?,CSP,21,120,<Can't create data pages for FSORT>) ;[5042]
	SORTE2:	MOVE	P,SAVEP			;[5042] RESET PDL
		$FCALL	CGS,ABORT.		;[5042] ISSUE ERROR
	;	$FERR (?,CGS,21,120,<Can't merge FSORT - error $O>,<T1>) ;[5042]
	SORTE3:	MOVE	P,SAVEP			;[5042] RESET PDL
		$FCALL	CRS,ABORT.		;[5042] ISSUME ERROR
	;	$FERR (?,CRS,21,120,<Can't remove FSORT - error $O>,<T1>) ;[5042]
		;CALL SORT
	SORTGO:	DMOVE	L,SAVEL			;[5042] RESTORE ACS L & P
		MOVEI	SF,FUNCT.		;[5042] POINT TO FUNCT.
		MOVEI	SR,SORT1		;[5042] POINT TO RETURN ADDRESS
		JRST	.JBHDA##+2(P2)		;[5042] CALL SORT
	SORT1:	  JRST	[XMOVEI	L,1+[XWD 0,0]	;[5042] FAILED, CALL EXIT.
			 PUSHJ	P,EXIT.##	;[5042] RETURN TO MONITOR LEVEL
			 JRST	.+1]		;[5042] SHOULD NEVER HAPPEN
	;CLEAN UP SORT PAGES
		SKIPN	SRTSHR			;[5042] SHARABLE SEGMENT?
		JRST	SORT2			;[5042] NO
		MOVEI	T1,.SGREL		;[5042] FUNCTION CODE
		HRRM	T1,SRTSEG+.SGFNC	;[5042] TO RELEASE A SEGMENT
		XMOVEI	T1,SRTSEG		;[5042] POINT TO BLOCK
		SEGOP.	T1,			;[5042] DELETE THE HIGH SEGMENT
		  JRST	SORTE3			;[5042] CAN'T DO IT
	SORT2:	MOVE	T1,[.PAGCD,,T2]		;[5042] SET UP UUO AC
		MOVNI	T2,SRTSIZ		;[5042] -VE PAGE COUNT
		MOVE	T3,SRTSCN		;[5042] GET SEGMENT SECTION
		IOR	T3,[PA.GAF!PA.GDC+SRT1ST] ;[5042] FLAGS + STARTING PAGE #
		PAGE.	T1,			;[5042] WIPE OUT SORT PAGES
		  SKIPA	T4,[-SRTSIZ,,SRT1ST]	;[5042] OLD MONITOR--DO IT SLOWLY
		JRST	SORT4			;[5042] CONTINUE
		IOR	T4,SRTSCN		;[5042] INCLUDE SEGMENT SECTION
	SORT3:	MOVE	T1,[.PAGCD,,T2]		;[5042] SET UP UUO AC
		MOVEI	T2,1			;[5042] GET PAGE COUNT
		MOVX	T3,PA.GAF		;[5042] GET DELETE BIT
		HRR	T3,T4			;[5042] INCLUDE PAGE NUMBER
		PAGE.	T1,			;[5042] DELETE THE PAGE
		  JFCL				;[5042] FAILED??
		AOBJN	T4,SORT3		;[5042] LOOP FOR ALL PAGES
	;[3205] Try and return pages 600:677
	SORT4:	SKIPE	%PASRT			;[5042][3362] FOROP. preallocated?
		 POPJ	P,			;[3362] Yes, don't deallocate either

 REP 120/12	;24C5
	SUBTTL	TOPS-10 VERSION -- Error Messages

	SRTEXE:	SIXBIT /SYS/			;[5] MERGE. UUO ARGUMENT BLOCK
		SIXBIT /FSORT/			;[5]   ..
		0				;[5]   ..
		0				;[5]   ..
		0				;[5]   ..
		XWD SRT1ST,SRTLST		;[3205] Undocumented "range" arg ?!?
		SRTEXL==.-SRTEXE		;[3205] Length of block to move
 WIT
					;[5042] 
 SUM 198586