Google
 

Trailing-Edge - PDP-10 Archives - bb-bt99h-bb - foropn.c14
There are no other files named foropn.c14 in the archive.
 REP 3/1	;14C1
		TV	FOROPN	OPEN & CLOSE ,10(4225)
 WIT
		TV	FOROPN	OPEN & CLOSE ,10(4251)
 INS 1110/2	;14C2
	4244	MRB	7-Feb-86
		Files are always written in .IODMP mode. They must have the 
		user selected mode recorded in the FDB.  When closing a file 
		(on a TOPS-10 system) we should look at the I/O mode specified 
		by the user and perform a rename FILOP. to set the proper 
		I/O mode in the FDB.
		
	4246	MRB	11-Mar-86
		CORRECTION TO EDIT 4244! When closing a non-disk unit we should
		NOT do a rename FILOP.

	4247	RJD	11-Mar-86
		Make the error "FRSOPN Can't open file: Too many open units"
		a fatal error.

	4250	MRB	17-Mar-86
		Add an additional check to the routine that checks to see if this 
		is the controling terminal.  This new check will see if the job
		is detached. If the job is detached we shouldn't to a DEVST JSYS
		because, this JSYS will wait until a controling attaches to the
		job to return. If the job is detached just jump to NOTTTY 
		because a detached job cannot have a controling terminal.

	4251	MRB	1-APR-86
		Yet another CORRECTION TO EDIT 4244! When closing a disk unit
		which is opened for input only we should NOT do a rename FILOP.	
		Also,problems with renaming the dates&time fixed.

 REP 7/36	;14C3
	DEVOK:	MOVEM	T2,DVICE(D)	;SAVE IT
 WIT
	DEVOK:	MOVEM	T2,DVICE(D)	;SAVE IT 

	;[4250] Check to see if this job is detached. If this job is detached 
	;[4250] we cannot do a DEVST JSYS (cause it will wait for a terminal 
	;[4250] to attach to it).

		SETO	T1,T1		;[4250]Current Job
		MOVE	T2,[-1,,T1]	;[4250]Return result in T1
		XMOVEI	T3,1		;[4250]we only want word 1
		GETJI			;[4250]Get the job info
		 $SNH			;[4250]Shouldn't happen!
		SKIPG	T1,		;[4250]Is this job detached?
		 JRST	NOTTTY		;[4250]Yes,Device cant be controling TTY

 INS 19/75	;14C4
		CAIN	T1,57		;[4247]Check for too many open units
		 $ACALL	OPN		;[4247]Yes,Don't call Dialog
 REP 5/101	;14C5
	FICLOS:	SKIPN	T2,FBLK(D)	;IF FILE WAS NEVER OPENED
		 POPJ	P,		;RETURN NOW

		MOVE	T2,FBLK(D)	;GET CHANNEL STUFF
		HRRI	T2,.FOCLS	;CLOSE THE FILE
		MOVE	T1,[1,,T2]	;WITH A FILOP
		FILOP.	T1,
		 $ACALL CLS		;FAILED. TYPE MSG AND DIE
		MOVE	T2,FBLK(D)
		HRRI	T2,.FOREL	; AND RELEASE THE FILE
		MOVE	T1,[1,,T2]	;WITH A FILOP
		FILOP.	T1,
 WIT
	FICLOS:	SKIPN	T2,FBLK(D)	;IF FILE WAS NEVER OPENED 
		 POPJ	P,		;RETURN NOW 

	FICLS0:	LOAD	T1,DVTYP(D)	;[4246]GET THE DEVICE TYPE
		CAIE	T1,DT.DSK	;[4246]IS IT A DISK
		 JRST	 FICLS2		;[4246]NO, JUST CLOSE DON'T RENAME
					;[4246]YES IT IS!
		MOVE	T1,FLAGS(D)	;[4251]IS IT OPENED FOR OUTPUT?
		TXNN	T1,D%OUT	;[4251]
		 JRST	 FICLS2		;[4251]NO, JUST CLOSE DON'T RENAME

	FICLS1:	XMOVEI	T1,4		;[4251]Set arg block length
		MOVEM	T1,RNMBLK	;[4251]
		DMOVE	T1,LKPB+.RBPPN(D);[4251]Get the ppn and file name
		DMOVEM	T1,RNMBLK+.RBPPN ;[4251]Store it into the Rename block
		HLLZ	T2,LKPB+.RBEXT(D);[4251]Get the extention
		MOVEM	T2,RNMBLK+.RBEXT ;[4251]Store it into the Rename block

		SETZM	RNMBLK+.RBPRV	;[4251]Clear out old junk
		LDB	T2,[POINT 9,LKPB+.RBPRV(D),8] ;[4251]Get protection
		DPB	T2,[POINT 9,RNMBLK+.RBPRV,8];[42511]Store it
		LOAD	T2,MODE(D)	;[4244]Get data_mode in rename block
		MOVE	T2,MODTAB(T2)	;[4244]Lookup TOPS-10 equivalence
		DPB	T2,[POINT 4,RNMBLK+.RBPRV,12];[4244]Store it

		MOVEI	T1,FBLK(D)	;[4244]Get Address of FILOP. block
		MOVE	T2,.FOFNC(T1)	;[4244]Get function word	
		HRRI	T2,.FORNM	;[4244]Setup the function code
		TXO	T2,FO.UOC	;[4244]Specify file is open
		MOVEM	T2,.FOFNC(T1)	;[4244]and store it back again

		HRLZI	T2,RNMBLK	;[4251]get rename block address
		HLLM	T2,.FOLEB(T1)	;[4251]store into the lookup/enter block

		HRLI	T1,.FOMAX	;[4244]Set the argument count
		FILOP.	T1,		;[4244]and do the RENAME
		JRST	[MOVEI	T1,FBLK(D)	;[4251]Get Address of FILOP. block
			MOVE	T2,.FOLEB(T1)	;[4251]Get the lookup/enter block
			HRRZM	T2,.FOLEB(T1)	;[4251]Convert it back to lookup block
			JRST	FICLS2]		;[4251]and try to close it
		MOVE	T2,.FOLEB(T1)	;[4251]Get the lookup/enter block
		HRRZM	T2,.FOLEB(T1)	;[4251]Convert it back to lookup block
		JRST	FICLS3		;[4246]GO JOIN COMMON CODE

	FICLS2:	MOVE	T2,FBLK(D)	;[4246]GET CHANNEL STUFF
		HRRI	T2,.FOCLS	;[4246]CLOSE THE FILE
		MOVE	T1,[1,,T2]	;[4246]WITH A FILOP
		FILOP.	T1,		;[4246]
		 $ACALL CLS		;[4246]FAILED. TYPE MSG AND DIE
	;	JRST	FICLS3		;[4246]GO JOIN COMMON CODE

	FICLS3:	MOVE	T2,FBLK(D)
		HRRI	T2,.FOREL	; AND RELEASE THE FILE
		MOVE	T1,[1,,T2]	;WITH A FILOP 
		FILOP.	T1, 
 INS 23/101	;14C6
		SEGMENT DATA
	RNMBLK:	BLOCK	5		;[4251]Rename block
		SEGMENT CODE
 SUM 167184