.title icr_mark_point .sbttl icr_mark $rabdef $xabkeydef .psect gp pic,usr,ovr,rel,gbl,shr,noexe,rd,wrt,novec,long rabs: .blkl 1 ; array maps units to rab addresses ; ; Subroutine to mark a record for later random access to it using icr_point. ; ; call icr_mark(unit, addr) ; ; inputs: ; unit is the unit number ; ; outputs: ; addr - a 6 byte buffer to receive the record file address ; ; note: ; icr_gp_open or icr_gp_create must be called to open the file ; before using icr_mark. Either routine may be called as a ; Fortran useropen routine. ; .psect icr_code,pic,usr,con,rel,lcl,shr,exe,rd,nowrt,novec,long unit=4 ; offset for unit address addr=8 ; offset for addr of 6 byte mark addr icr_mark:: markr:: .word ^m movl @unit(ap),r2 ; get unit movl rabs[r2],r2 ; get rab address for this unit movl addr(ap),r0 ; get address of mark buffer movl rab$l_rfa0(r2),(r0)+ ; copy record file address movw rab$w_rfa4(r2),(r0) ret .sbttl icr_point ; ; Subroutine to point to a record which was previously marked by icr_mark. ; ; This version is specific to LIST and includes support for indexed files. ; ; call icr_point(unit, addr) ; ; inputs: ; unit is the unit number ; addr - a 6 byte buffer containing the record file address ; ; outputs: ; ; note: ; icr_gp_open or icr_gp_create must be called to open the file ; before using icr_point. Either routine may be called as a ; Fortran useropen routine. ; .psect icr_code,pic,usr,con,rel,lcl,shr,exe,rd,nowrt,novec,long unit=4 ; offset for unit address addr=8 ; offset for addr of 6 byte mark addr icr_point:: pointr:: .word ^m movl @unit(ap),r8 ; get unit movl rabs[r8],r8 ; get rab address for this unit movl addr(ap),r0 ; get address of mark buffer cmpl keymat,#key$nomatch ; initial key search enabled? beql 10$ ; eql - no cmpl (r0),keyrfa ; pointing to initial rfa? bneq 10$ ; neq - no cmpw 4(r0),keyrfa+4 ; ? bneq 10$ ; neq - no moval @unit(ap),-(sp) ; call fndkey(unit) calls #1,fndkey ret 10$: movl (r0)+,rab$l_rfa0(r8) ; get record file address bneq 20$ ; if 0, rewind file $rewind rab=r8 ; rewind file to set next rec ret 20$: movw (r0),rab$w_rfa4(r8) movb rab$b_rac(r8),-(sp) ; save old rac bicl2 #rab$m_loc,rab$l_rop(r8) ; clear locate mode flag $rab_store - ; set up for random by rfa get rab=r8, - rac=rfa, - ubf=gpbuf, - usz=#512 $get rab=r8 ; position file tstl keyref ; alternate key? bneq 30$ ; yes movb (sp)+,rab$b_rac(r8) ; restore rac field ret 30$: clrl r7 movab gpkey,r3 ; key buffer movzbl keyxab+xab$b_nsg,r6 ; get number of segments bleq 50$ ; skip loop if no segments 40$: movzbl keyxab+xab$b_siz0[r7],r0 ; key length movzwl keyxab+xab$w_pos0[r7],r2 ; get position for this key movc3 r0,gpbuf(r2),(r3) ; copy the key aoblss r6,r7,40$ ; do all of them 50$: subl #gpkey,r3 ; r3 = key length $rab_store - ; set key fields rab=r8, - usz=#1, - rac=key, - krf=keyref, - kbf=gpkey, - ksz=r3 bicl2 #rab$m_kge ! rab$m_kgt,rab$l_rop(r8) ; key equal match bisl2 #rab$m_loc,rab$l_rop(r8) ; set locate mode $get rab=r8 ; get record $rab_store - rab=r8, - rac=seq movl addr(ap),r3 ; get rfa movl (r3)+,r4 movw (r3),r3 70$: cmpl r4,rab$l_rfa0(r8) ; rfa match? bneq 80$ ; neq - no cmpw r3,rab$w_rfa4(r8) ; ? beql 100$ ; eq - yes 80$: $get rab=r8 ; get next record brb 70$ 100$: movb (sp)+,rab$b_rac(r8) ; restore rac field ret .end