.TITLE NEXTUIC FIND THE ENTRIES IN THE UIC ; ; ; THIS ROUTINE OPENS THE DIRECTORY SPECIFIED AND CHECKS ALL FILE NAMES ; TO SEE IF THEY QUALIFY FOR PRINTING AND IF SO PRINTS THEM ; ; WRITTEN BY: LOU PERAZZOLI 10-JUN-1978 ; ; LOCAL MACROS .MACRO TEXT TXXT,?LAB1,?LAB2 .LONG LAB2-LAB1 .LONG LAB1 LAB1: .ASCII /TXXT/ LAB2: .ENDM .MACRO STATUS ERROR_NUM,INST,?A BLBS R0,A MOVL #ERROR_NUM,R1 BSBW ERROR INST A: .ENDM .MACRO ERROR ERROR_NUM,INST MOVL #ERROR_NUM,R1 BSBW ERROR INST .ENDM .MACRO DEFINE_ERR ERR_NAME,MESSAGE ERR_NAME==ERRNUM ERRNUM=ERRNUM+1 .PSECT ERROR_MESSAGE ERR_NAME'_TXT: .ASCII ^MESSAGE^ X=.-ERR_NAME'_TXT .PSECT ERROR_TABLE .LONG X .LONG ERR_NAME'_TXT .ENDM .MACRO BITS NAME,NO NAME'_V=NO NAME=1@NO .ENDM $RMSDEF .LIST ME BITS DEV_PRES,23 BITS WILD_UIC,4 BITS WILD_GROUP,6 BITS WILD_MEM,5 BITS WILD_NAME,7 BITS WILD_EXT,8 BITS WILD_VER,9 BITS VER_PRES,10 BITS MEM_EXISTS,13 BITS HIGH_PRES,31 BITS NOT_PRES,30 BITS BEFORE_PRES,24 BITS AFTER_PRES,25 BITS SPEC_PRES,16 BITS OUTPUT_PRES,21 .NLIST ME ERRNUM=0 .PSECT ERROR_TABLE,LONG ERROR_TABLE:: .PSECT ERROR_MESSAGE DEFINE_ERR INPUT_ERR,< error opening SYS$INPUT for input> DEFINE_ERR INPUT_GET,< error reading from SYS$INPUT> DEFINE_ERR SYNTAX_ERR,< syntax error in input line> DEFINE_ERR TIME_ERR,< syntax error in BEFORE or AFTER time> DEFINE_ERR OPEN_OUT,< error opening SYS$OUTPUT for output> DEFINE_ERR CREATE_ERR,< error creating specified output file> DEFINE_ERR OUTPUT_ERR,< error opening specified output file> DEFINE_ERR NO_UIC,< no match found for directory> DEFINE_ERR OPEN_DIR,< error trying to open directory file> DEFINE_ERR DIR_GET,< error trying to read directory file> DEFINE_ERR DIR_ERR,< error trying to open [0,0] directory> DEFINE_ERR INDEX_OPN,< error opening the INDEX FILE> DEFINE_ERR INDEXF_READ,< error while trying to read INDEX FILE> DEFINE_ERR CLOSE_DIR,< error while closing the directory file> DEFINE_ERR CLOSE_OUT,< error while closing the output file> DEFINE_ERR MFD_ERR,< open error from the MASTER DIRECTORY FILE> DEFINE_ERR MFD_GET,< read error from the MASTER DIRECTORY FILE> DEFINE_ERR CLOSE_MFD,< close error from the MASTER DIRECTORY FILE> DEFINE_ERR NO_FILE,< no such files exist> DEFINE_ERR NO_DIR,< no such directory exists> DEFINE_ERR NOT_ODS2,< disk structure is not ODS level 2> NEXT_UIC:: .WORD 0 MOVL W^RAB_OUT_HOLD,R10 ;POINT R10 TO OUTPUT RAB CLRL W^DIR_NAME_OUT MOVL 4(AP),R6 ;STRING DESC TO R6 MOVQ (R6),W^DIR_DESC ;BUILD DESC FOR THE OUT_DIRNAME ROUTINE MOVB (R6),W^FAB_BLOCK+FAB$B_FNS ;LEN OF NAME MOVL 4(R6),W^FAB_BLOCK+FAB$L_FNA ;ADDRESS OF NAME $OPEN FAB=FAB_BLOCK BLBS R0,10$ ;BRANCH IF NO ERRORS CMPL R0,#RMS$_PRV ;NO ACCESS DUE TO PRIVELIGE VIOLATION BNEQ 5$ ;BR IF NOT BSBW NO_ACCESS ;WRITE NOACCESS ALLOWED MESSAGE 5$: RET ;IF AN ERROR - NO SUCH FILE JUST RETURN 10$: ; MAKE SURE FILE OPENED IS A DIRECTORY FILE - TO DO THIS WE WILL GET THE FILE ; ID FROM THE NAM BLOCK (NAM_BLOCK) ADD IN THE OFFSET OF THE FILE HEADER ; IN THE INDEX FILE AN STUFF IT INTO R2, THEN BSBW VALIDATE_DIR TO CHECK IT OUT CLRL R2 ADDW3 W^NAM_BLOCK+NAM$W_FID_NUM,W^HEAD_OFFSET,R2 BSBW VALIDATE_DIR ;CHECK IT OUT BLBS R0,15$ ;BR IF SUCCESS BRW DONE1 ;CLOSE THE FILE WE OPENED 15$: $CONNECT RAB=RAB_BLOCK STATUS OPEN_DIR,RET INCL W^DIR_FLAG ;ONE MOURE DIRECTORY FOUND 20$: $GET RAB=RAB_BLOCK CMPL R0,#RMS$_EOF BNEQ 30$ BRW DONE 30$: STATUS DIR_GET, ; ANALYZE THE DIRECTORY ENTRY MOVZBL W^DIRENTRY+3,R7 ;LENGTH OF NAME MOVL R7,R8 ;SAVE LENGTH IN R8 FOR A WHILE ; WHAT SHOULD WE DO WITH THE NAME BBS #WILD_NAME_V,W^COMMAND,320$ ;IS THE NAME WILD BR IF SO ; FIND THE PERIOD LOCC #^A/./,R7,W^DIRENTRY+4 ;WHERE IS THE . ; BUILD A STRING DESCRIPTOR FOR THE NAME MOVAB W^NAME_DESC,R1 ;ADDRESS OF DESCRIPTOR SUBL3 R0,R7,(R1) ;LENGTH OF NAME TO DESCRITPOR MOVAB W^DIRENTRY+4,4(R1) ;STRING ADDRESS PUSHAB W^INPUT_NAME ;COMPARATOR FOR COMPARE PUSHL R1 ;STRING TO COMPARE CALLS #2,W^COMPARE ;DO THE COMPARE BBS #NOT_PRES_V,W^COMMAND,310$ ;IF NOT SPECIFIED PRINT THOSE THAT DO ;NOT MATCH THE NAME BLBS R0,320$ ;IF SET MATCH 305$: BRW 20$ ;NO MATCH - TRY ANOTHER 310$: BLBS R0,305$ ;NOT SPECIFIED, IF FILE MATCHED REJECT IT 320$: ;DO WE NEED TO CHECK THE EXTENSION BBS #WILD_EXT_V,W^COMMAND,330$ ;SI THE EXTENSION WILD LOCC #^A/./,R7,W^DIRENTRY+4 ;FIND THE . MOVAB W^NAME_DESC,R2 ;START OF DESCRIPTOR SUBL3 #1,R0,(R2) ;MOVE IN THE LENGTH ADDL3 #1,R1,4(R2) ;STRING ADDRESS PUSHAB W^INPUT_EXT ;COMPARATOR PUSHL R2 ;STRING CALLS #2,W^COMPARE ;DO THE COMPARE BBS #NOT_PRES_V,W^COMMAND,325$ BLBS R0,330$ ;IF SET - MATCH 323$: BRW 20$ ;NO MATCH - TRY ANOTHER 325$: BLBS R0,323$ ;NOT SPECIFIED - IF SUCCESS , REJECT 330$: MOVC5 R7,W^DIRENTRY+4,#^X20,#22,W^OUTBUF ;MOVE THE FILE NAME TO OUTBUF INCL R7 ;ADD 1 TO INSURE WORD ALIGN BBCC #0,R7,40$ ;CLEAR OFF LOW BIT 40$: ADDL #6,R7 ;DISPLACEMENT TO INDEX FILE LOCATION MOVL W^HIGH_COUNT,W^HIGH_COUNT_S ;NUMBER OF HIGH VERSIONS TO GET ; CONVERT VERSION NUMBER TO ASCII MOVB #^X3B,W^OUTBUF(R8) ;MOVE IN A SEMICOLON 50$: MOVZWL W^DIRENTRY-2(R7),R4 ;VERSION NUMBER TO R4 ; CHECK TO SEE IF WE ARE LOOKING FOR SPECIFIC VERSION NUMBERS BBC #VER_PRES_V,W^COMMAND,59$ ;WAS VERSION SPECIFIED BR IF NOT BBS #WILD_VER_V,W^COMMAND,59$ ;WAS THE VERSION WILD, BR IS SO CMPL R4,W^INPUT_VER ;DO THE VERSIONS MATCH BEQL 59$ ;BR IF MATCH BRW 108$ ;GET ANOTHER VERSION 59$: CLRL R2 ;CLEAR R2 MOVL #10000,R1 ;LARGEST VERSION IS 65000 (DIVIDE 10000 60$: DIVL3 R1,R4,R0 ;DO THE DIVIDE BEQL 80$ ;ZERO ANSWER 70$: ADDB3 R0,#^X30,OUTBUF+1(R8)[R2] ;PUT THE CHARACTER INTO THE BUFFER INCL R2 ;ADJUST POINTER BRB 90$ ;GO CALC NEXT CHAR 80$: TSTL R2 ;IS THIS A SIGNIFICANT ZERO BNEQ 70$ ;YES, STORE THE ZERO 90$: MULL3 R1,R0,R3 ;CALCULATE POWER OF 10 TO SUBTRACT SUBL2 R3,R4 ;SUBRTRACT POWER OF TEN DIVL #10,R1 ;DIVIDE OFF A POWER OF 10 BNEQ 60$ ;DO UNTIL WE GET A ZERO ; DO WE NEED TO ACCESS THE INDEX FILE FFS #BEFORE_PRES_V,#3,W^COMMAND,R12 ;ARE THE TIME BITS OR THE FULL ;BITS SET BNEQ 95$ ;BRANCH IF YES, ACCESS THE INDEX FILE MOVAB 1(R8)[R2],R12 ;CALCULATE OUTPUT LENGTH MOVW R12,RAB$W_RSZ(R10) ;UPDATE RECORD SIZE IN RAB BRW 105$ ;BRANCH AROUND ACCESS TO THE INDEX FILE 95$: CLRL R6 ADDW3 W^DIRENTRY(R7),W^HEAD_OFFSET,R6 ;LOCATION OF HEADER (INDEX FILE) ; ISSUE QIO TO INDEX FILE 100$: $QIOW_S CHAN=INDEX_FAB+FAB$L_STV,- FUNC=#IO$_READVBLK,IOSB=IO_STAT,- P1=BUFFER,P2=#512,P3=R6 STATUS INDEXF_READ, ; CHECK TO SEE IF TIMES ARE OKAY BBC #AFTER_PRES_V,W^COMMAND,102$ ;WAS AFTER TIME SPECIFIED CMPL W^BUFFER+^X66,W^ATIME+4 ;CHECK HIGH TIMES BGTR 102$ BEQL 101$ ;IF EQUAL MUST CHECK LOW TIMES 1002$: BRW 20$ ;NO GO BUDDY - TRY ANOTHER 101$: CMPL W^BUFFER+^X62,W^ATIME ;CHECK LOW TIMES BLSSU 1002$ ;IF LESS THAN NO GOOD 102$: BBC #BEFORE_PRES_V,W^COMMAND,104$ ;WAS BEFORE TIME SPECIFIED CMPL W^BUFFER+^X66,W^BTIME+4 ;CHECK HIGH TIMES BLSS 104$ ;GOOD TIME BNEQ 1002$ ;NO GOOD TIME CMPL W^BUFFER+^X62,W^BTIME ;CHECK LOW TIMES - HIGH TIMES = BGTRU 1002$ ;IF GREATER NO GO 104$: ;TIMES ARE OKAY $ASCTIM_S TIMADR=BUFFER+^X62,TIMBUF=TIMBUF STATUS TIME_ERR, MOVW #48,RAB$W_RSZ(R10) ;UPDATE SIZE OF RECORD 105$: ; HAVE WE OUTPUTED THE NAME OF THE DIRECTORY BLBS W^DIR_NAME_OUT,107$ ;BRANCH IF WE HAVE OUTPUTED BSBW OUT_DIRNAME ;GO OUTPUT THE NAME INCL W^DIR_NAME_OUT ;INC THE FLAG SO LOW BIT IS SET 107$: INCL W^PUT_FLAG ;COUNTER OF NUMBER OF RECORDS WRITTEN $PUT RAB=(R10) STATUS OUTPUT_ERR, BBC #HIGH_PRES_V,W^COMMAND,108$ ;DO WE ONLY WANT THE HIGHEST VERSION ;BR IF NOT DECL W^HIGH_COUNT_S ;COUNT NUMBER OF HIGH VERSIONS PRINTED BLEQ 110$ ;BR IF NO MORE TO DO ;BRANCH IF SO ; CHECK TO SEE IF WE HAVE ANOTHER VERSION NUMBER TO DO 108$: ADDL #8,R7 ;LOCATION OF NEXT FILE ID CMPW R7,W^RAB_BLOCK+RAB$W_RSZ ;ANY MORE IN BLOCK BGTR 110$ ;BRANCH IF NO MORE IN BLOCK MOVQ W^BLANKS,OUTBUF+1(R8) ;CLEAR THE OLD VERSION NUMBER OUT BRW 50$ ;CONVERT THE NEXT VERSION 110$: BRW 20$ DONE: ; SHOULD WE GET ANOTHER DIRECTORY $DISCONNECT RAB=RAB_BLOCK ;DISCONNECT CURRENT DIRECTORY STATUS CLOSE_DIR,RET DONE1: $CLOSE FAB=FAB_BLOCK ;AND CLOSE IT STATUS CLOSE_DIR,RET RET .PAGE .ALIGN LONG OUT_DIRNAME: ;ROUTINE TO OUTPUT THE NAME OF THE DIRECTORY ;NOTE CLOBBERS REGISTER R0,R1 ,R2, AND R3 MOVAB W^FAO_DIR_DESC,R3 ;ADDRESS OF FAO STRING BRB CONT NO_ACCESS:: MOVL W^RAB_OUT_HOLD,R10 ;POINT R10 TO OUTPUT RAB MOVAB W^FAO_NOACCESS,R3 ;POINT R3 TO FAO STRING FOR NO ACCESS CONT: MOVAB W^DEVICE_NAME,R2 ;ADDRESS OF DEVICE NAME TSTL (R2) ;WAS A DEVICE NAME GIVEN BNEQ 10$ ;BR IF YES MOVAB W^DEF_DEV_NAME,R2 ;ADDRESS OF SYS$DISK DESCRIPTOR 10$: $TRNLOG_S LOGNAM=(R2),RSLBUF=TRAN_BUF,RSLLEN=TRAN_BUF CMPL R0,#SS$_NOTRAN BEQL 30$ MOVAB W^TRAN_BUF,R2 BRB 10$ ;TRANSLATE AGAIN 30$: MOVAB W^DIR_DESC,R2 ;GET POINTER TO DESC OF DIRECTORY NAME CMPB #^A/[/,@4(R2) ;IS FIRST CHARACTER A "[" BNEQ 100$ ;BR IF NOT DECL (R2) ;ONE LESS CHAR IN STRING INCL 4(R2) ;MOVE OVER "[" CHARACTER LOCC #^A/]/,(R2),@4(R2) ;FIND "]" TO MATCH "[" MOVB #^A/./,(R1) ;REPLACE THE "]" WITH A "." 100$: MOVW RAB$W_RSZ(R10),-(SP) ;SAVE OLD RSZ FOR A WHILE ; OUTPUT THE DIRECTORY NAME $FAO_S CTRSTR=(R3),OUTLEN=RAB$W_RSZ(R10),- OUTBUF=OUTBUF_DESC,P1=#TRAN_BUF,P2=#DIR_DESC STATUS OUTPUT_ERR,RET MOVAB W^OUTBUF1,RAB$L_RBF(R10) ;POINT TO NEW BUFFER $PUT RAB=(R10) STATUS OUTPUT_ERR,RET MOVW #1,RAB$W_RSZ(R10) ;SET SIZE TO 1 MOVB #^A/ /,W^OUTBUF1 ;SET BYTE TO BLANK $PUT RAB=(R10) STATUS OUTPUT_ERR,RET MOVW (SP)+,RAB$W_RSZ(R10) ;RESTORE OLD SIZE MOVAB W^OUTBUF,RAB$L_RBF(R10) ;RESTORE OLD RECORD BUFFER ADDR RSB .PAGE .ALIGN LONG ERROR:: PUSHL R0 MOVAQ W^ERROR_TABLE[R1],R2 ;GET ADDRESS OF DESCRIPTOR $FAO_S CTRSTR=FAO_ERROR,OUTLEN=W^RAB_SYSOUT+RAB$W_RSZ,- OUTBUF=OUTBUF_DESC,P1=R2 BLBS R0,10$ BPT 10$: MOVAB W^OUTBUF1,W^RAB_SYSOUT+RAB$L_RBF ;MOVE IN THE BUFFER ADDRESS $PUT RAB=RAB_SYSOUT BLBS R0,20$ BPT 20$: POPL R0 BEQL 30$ $GETMSG_S MSGID=R0,MSGLEN=W^RAB_SYSOUT+RAB$W_RSZ,- BUFADR=W^OUTBUF_DESC $PUT RAB=RAB_SYSOUT BLBS R0,30$ BPT 30$: RSB ;RETURN .PAGE .PSECT DATA3,QUAD .ALIGN LONG FAO_ERROR: TEXT <%FIND !AS> .ALIGN LONG DIR_NAME_OUT: .LONG 0 PUT_FLAG:: .LONG 0 DIR_FLAG:: .LONG 0 DEF_DEV_NAME: TEXT TRAN_BUF: TEXT <.......................................> DIR_DESC:: .LONG 0,0 .ALIGN LONG FAB_BLOCK:: $FAB FAC=,FNA=NAMEDIR,FNS=15,SHR=,- DNA=DEFAULT_NAME,DNS=9,NAM=NAM_BLOCK .ALIGN LONG RAB_BLOCK: $RAB FAB=FAB_BLOCK,UBF=DIRENTRY,USZ=500,MBC=11,MBF=8 NAM_BLOCK: $NAM .ALIGN LONG INDEX_FAB:: $FAB FNA=INDEXF,FNS=15,FOP= .ALIGN LONG FAB_SYSOUT:: $FAB FAC=GET,FNA=SYSOUT,FNS=10,RAT=CR RAB_SYSOUT:: $RAB FAB=FAB_SYSOUT,RBF=OUTBUF1,RSZ=80,RAC=SEQ FAB_OUT:: $FAB FAC=,FNA=OUTNAME,FNS=8,RAT=,- MRS=48,ORG=SEQ,RFM=VAR,ALQ=1,- DNA=DEFAULT_OUT,DNS=DEFAULT_OUT_SZ RAB_OUT:: $RAB FAB=FAB_OUT,RBF=OUTBUF,RSZ=48,RAC=SEQ RAB_OUT_HOLD:: .LONG 0 OUTNAME: .ASCII /TEST.OUT/ INDEXF: .ASCII /[0,0]INDEXF.SYS/ DEFAULT_OUT: .ASCII /SYS$DISK:FIND.LIS/ DEFAULT_OUT_SZ=.-DEFAULT_OUT .ALIGN LONG IO_STAT:: .LONG 0,0 NAMEDIR_SZ: .LONG 0 NAMEDIR: .BLKB 30 DIR: .ASCII /.DIR/ .ALIGN QUAD DIRENTRY: .BLKB 500 BUFFER:: .BLKL 200 OUTBUF: .BLKB 24 TIMBUF1: .BLKB 24 ;MUST BE AFTER OUTBUF: .BLKB 40 OUTBUF_DESC: .LONG 80 .LONG OUTBUF1 OUTBUF1: .BLKB 80 TIMBUF: .LONG 24 .LONG TIMBUF1 .ALIGN LONG HIGH_COUNT_S: .LONG 0 BTIME:: .LONG 0,0 ATIME:: .LONG 0,0 DEFAULT_TIME:: .LONG 13 .LONG D_TIME D_TIME: .ASCII /-- 00:00:00.0/ NAME_DESC: .LONG 0,0 BLANKS: .ASCII / / SYSOUT: .ASCII /SYS$OUTPUT/ .ALIGN LONG DEFAULT_NAME_SZ:: .LONG 0 DEFAULT_NAME:: .BLKB 100 HEAD_OFFSET:: .LONG 0 ZERO_DIR:: .ASCII /[0,0].DIR/ FAO_DIR_DESC: TEXT FAO_NOACCESS: TEXT <%FIND access violation -- !AS[!AS]> .END