Google
 

Trailing-Edge - PDP-10 Archives - cuspbinsrc_1of2_bb-x128c-sb - 10,7/galaxy/catlog/catcnv.mac
There are no other files named catcnv.mac in the archive.
TITLE	CATCNV - Convert System Catalogs
SUBTTL	J. Dziedzic /JAD	5-Aug-86

;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1986. 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 WHICH IS NOT SUPPLIED BY DIGITAL.

	SEARCH	CATPRM			;CATALOG DEFINITIONS
	CATDEF	(CATCNV)		;DEFINE COMMON PARAMETERS

	LOC	<.JBVER==:137>
	EXP	1			;VERSION NUMBER

	RELOC	0

COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1983,1986. ALL RIGHTS RESERVED.
\;END OF COPYRIGHT MACRO
SUBTTL	Data segment

; GLXLIB Initialization Block
IB:	$BUILD	(IB.SZ)			;SIZE OF BLOCK
	  $SET	(IB.PRG,FWMASK,%%.MOD)	;PROGRAM NAME
	$EOB				;END OF BLOCK

; File open block

CATFOB:	$BUILD	(FOB.SZ)		;SIZE OF BLOCK
	  $SET	(FOB.CW,FB.BSZ,^D36)	;BYTE SIZE
	  $SET	(FOB.FD,,CATFD)		;ADDRESS OF FD
	$EOB				;END OF BLOCK

CATFD:	$BUILD	(FDMSIZ)		;SIZE OF BLOCK
	  $SET	(.FDLEN,FD.LEN,FDMSIZ)	;LENGTH OF FD
	  $SET	(.FDEXT,,'SYS   ')	;EXTENSION
	$EOB				;END OF BLOCK
G$PDL::	BLOCK	PDLSIZ			;PUSH DOWN LIST
G$QSTR::BLOCK	1			;QUEUE STRUCTURE
G$SPPN::BLOCK	1			;SYSTEM FILE PPN
ENTBLK:	BLOCK	PAGSIZ			;FILE ENTRY
CNVCNT:	BLOCK	1			;NUMBER OF ENTRIES CONVERTED
CATIFN:	BLOCK	1			;IFN OF CATALOG FILE
SUBTTL	Initialization

CATCNV:	JFCL				;NO CCL ENTRY
	MOVE	P,[IOWD	PDLSIZ,G$PDL]	;SET UP STACK
	MOVEI	S1,IB.SZ		;IB LENGTH
	MOVEI	S2,IB			;IB ADDRESS
	PUSHJ	P,I%INIT##		;FIRE UP GLXLIB

	MOVX	S1,%LDQUS		;ASK FOR QUEUE STRUCTURE
	GETTAB	S1,			;MONITOR KNOWS
	  MOVX	S1,'SSL   '		; OR DOES IT?
	MOVEM	S1,G$QSTR		;SAVE IT AWAY
	SKIPE	DEBUGW			;DEBUGGING?
	MOVX	S1,'DSK   '		;YES, USE ALTERNATE DEVICE
	MOVEM	S1,CATFD+.FDSTR		;HERE ALSO
	MOVX	S1,%LDSYS		;GET SYSTEM FILE PPN
	GETTAB	S1,			;MONITOR KNOWS
	  MOVE	S1,[1,,4]		; OR DOES IT?
	MOVEM	S1,G$SPPN		;SALT IT AWAY
	SKIPN	DEBUGW			;DEBUGGING?
	MOVEM	S1,CATFD+.FDPPN		;NO, SAVE PPN AWAY
	PUSHJ	P,R$INIT##		;INITIALIZE RMS INTERFACE
	PUSHJ	P,R$OCAT##		;OPEN THE SYSTEM CATALOG FILE
	JUMPT	CONVRT			;GO IF IT OPENED
	$FATAL	(OPEN of system catalog file failed)
	EXIT				;GIVE UP
SUBTTL	Convert catalogs

CONVRT:	MOVSI	P1,-CATTBL		;-VE LENGTH OF TABLE OF CATALOG FILES

CONV.1:	SETZM	CNVCNT			;ZERO COUNTER
	MOVE	S1,CATTAB(P1)		;GET THE FILE NAME
	PUSHJ	P,OPNCAT		;OPEN THE CATALOG FILE
	  SKIPA				;ERROR
	JRST	CONV.2			;SUCCESS
	$WARN	(Can't open ^W/CATTAB(P1)/ catalog file)
	JRST	CONV.6			;TRY NEXT ONE

CONV.2:	MOVE	S1,CATIFN		;GET THE IFN
	PUSHJ	P,F%IBYT		;GET FIRST BYTE
	JUMPF	.POPJ			;SHOULDN'T HAPPEN
	CAXE	S2,.SXFMT		;RIGHT VERSION?
	$FATAL	(Wrong ^W/CATTAB(P1)/ catalog version number ^D/S2/)

CONV.3:	PUSHJ	P,REDENT		;READ NEXT ENTRY
	  JRST	CONV.5			;DONE
	LOAD	S1,ENTBLK+.CTVFL,CT.TYP	;GET CATALOG DEVICE TYPE
	JUMPN	S1,CONV.X		;GO IF CORRECT
	$WARN	(Catalog device type null for ^W/CATTAB(P1)/ entry ^T/ENTBLK+.CTVSN/)
	MOVEI	S1,1(P1)		;GET THE CODE
	STORE	S1,ENTBLK+.CTVFL,CT.TYP	;MAKE IT RIGHT
CONV.X:	MOVEI	S1,ENTBLK		;POINT AT THE ENTRY
	PUSHJ	P,R$PUT##		;INSERT IN SYSTEM CATALOG
	JUMPT	CONV.4			;GO IF SUCCESSFUL
	$FATAL	(Can't insert ^W/CATTAB(P1)/ entry ^T/ENTBLK+.CTVSN/)

CONV.4:	AOS	CNVCNT			;COUNT ANOTHER ONE
	JRST	CONV.3			;TRY FOR MORE

CONV.5:	$TEXT	,<^D/CNVCNT/ ^W/CATTAB(P1)/ catalog entries converted>
					;FALL INTO CONV.6

CONV.6:	AOBJN	P1,CONV.1		;LOOP FOR ALL CATALOGS
	PUSHJ	P,R$CCAT##		;CLOSE CATALOG FILE
	$TEXT	,<Catalogs converted>
	PUSHJ	P,I%EXIT		;EXIT
	JRST	.-1			;IN CASE CONTINUE

CATTAB:	SIXBIT	/DTALST/		;DECtape
	SIXBIT	/MTALST/		;Magtapes
	SIXBIT	/STRLST/		;Structures
CATTBL==.-CATTAB			;LENGTH OF TABLE
SUBTTL	Open catalog file

OPNCAT:	MOVEM	S1,CATFD+.FDNAM		;SAVE FILE NAME
	MOVEI	S1,FOB.SZ		;SIZE OF FOB
	MOVEI	S2,CATFOB		;ADDRESS
	PUSHJ	P,F%IOPN##		;OPEN THE FILE
	JUMPF	.POPJ			;RETURN IF ERROR
	MOVEM	S1,CATIFN		;SAVE IFN
	JRST	.POPJ1			;SKIP RETURN
SUBTTL	Read next entry

REDENT:	MOVX	S1,PAGSIZ		;CLEAR OUT THE BLOCK
	MOVEI	S2,ENTBLK		;ADDRESS
	PUSHJ	P,.ZCHNK##		;ZERO THE CHUNK

REDE.1:	MOVE	S1,CATIFN		;GET THE IFN
	PUSHJ	P,F%IBYT		;GET NEXT BYTE
	JUMPF	.POPJ			;EOF
	LOAD	T1,S2,CT.FEL		;GET LENGTH OF ENTRY
	MOVNS	T1			;NEGATE
	HRLZS	T1			;MAKE AN AOBJN COUNTER

REDE.2:	MOVEM	S2,ENTBLK(T1)		;SAVE A WORD
	AOBJP	T1,.POPJ1		;RETURN WHEN ENTRY COMPLETE
	PUSHJ	P,F%IBYT		;GET NEXT BYTE
	JUMPF	.POPJ			;EOF?  ODD
	JRST	REDE.2			;SALT IT AWAY
SUBTTL	The end

	END	CATCNV