FOPEN.MAC=FOPEN.VGN;1/AU:72. -/.ident/,.,/;25/ .IDENT /000025/ -/; 000024/+1 ; 000025 20 Nov 1981 RVT Add 'b' option for block mode on read ; Fix record/file bugs -/16./ BMODE = 32. -/OPTSTR:/,.+1 OPTSTR: .ASCIZ "rwaunb" ;Possible options (keep in this order) OPTVAL: .BYTE RMODE,WMODE,AMODE,UMODE,NMODE,BMODE -/$$FOPO::/ -/; User-/+1 BITB #FD.RWM,F.RACC(R0) ; BLOCK-MODE (READ ONLY) BEQ 5$ ; NO, USE RECORD I/O ; HE WANTS TO DO BLOCK I/O WITH HIS OWN BUFFER. FDRC$R R0,#FD.RWM ; USE READ/WRITE MODE MOV R4,F.BKST(R0) ; SET UP THE IOSB ADDR ADD #V$IOSB,F.BKST(R0) BR DOOPEN 5$: -/20$:/ ; if reading (in record mode), and not User-buffering, use locate mode bit #$$wmod!$$amod,(r4) ; reading? bne 15$ ; no, use move mode bit #vf$ubf,(r4) ; user-buffering? bne 15$ ; yes, use move mode fdrc$R r0,#fd.plc ; use locate mode 15$: -/DOOPEN:/ -/BR $$FOPE/,. JMP $$FOPE ;Sorry about that -/; Normal exit from fopen(). Enter with r4 -> fdb./,. ; Normal exit from fopen(). Enter with r4 -> IOV. Returns to fopen -/MOV V$FDB+F.VBSZ(R4),V$RBSZ(R4)/,. bitb #fd.rwm,v$fdb+f.racc(r4) ; block-mode? bne 2$ ; yes-give block size bit #$$wmod!$$amod,(r4) ; reading? BNE 4$ ; BR IF NO MOV V$FDB+F.RSIZ(R4),V$RBSZ(R4) ;Get file max record size bne 3$ ; if this is zero, then 2$: mov V$FDB+F.VBsz(r4),v$fdb+f.rsiz(r4); pretend fixed records movb #r.fix,v$fdb+f.rtyp(r4) 4$: MOV V$FDB+F.VBSZ(R4),V$RBSZ(R4) ;Get Virtual block size 3$: -/5$:/ BITB #FD.DIR,R0 ; is it a file-oriented device? BEQ 7$ ;No, onward BIS #VF$FIL,(R4) ; YES, SAY SO 7$: -/$$FOPT::/ -/40$:/ BIT #BMODE,R1 ; BLOCK-MODE READ? BEQ 45$ ; NOPE BIS #UMODE!NMODE,R1 ; THAT IMPLIES "NU", ALSO MOVB #FD.RWM,V$FDB+F.RACC(R4) ; SET BLOCK-MODE 45$: /