.title File Directory Information ; DECUS C Calling Format ; ; jsr r5,csv$ ;save r2,r3, and r4 ; ;r5 is parameter base ; ;c$pmtr(r5) is first argument ; ;c$pmtr+2(r5) is second argument ; ;... ; ;return args in r0 ; ... ; user code ; ... ; ; jmp cret$ ;restore r2-r5 and return ; rts pc ;does the same (cret$ follows csv$) ; ; csv$ and cret$ need be used only if arguments are used ; ; The following were extracted from and ; 'fwild.mac' of the DECUS C package. ; typedef struct IOV { ; 0 int _cnt; /* Bytes left in buffer */ ; 2 char *_ptr; /* Free spot in buffer */ ; 4 char *_base; /* Base of buffer */ ; 6 int _flag; /* Flag word */ ; 10 int io_wflag; /* Wild card flags */ ; 12 char *io_wild; /* Wild card buffer */ ; 14 int io_rbsz; /* Record buffer size */ ; /* ; * RT11 specific ; */ ; 16 int io_lun; /* RT11 unit number */ ; 20 int io_bnbr; /* Disk block number */ ; 22 int io_size; /* File size in blocks */ ; 24 char *io_name; /* File name pointer */ ; 26 char io_dbuf[2]; /* Dummy record buffer */ ; } FILE; ; * The following bits are set in fd->io_wflag for wild-card ; * processing. Note: IO_WLD must be in the low byte. ; */ ; #define IO_WLD 0000001 /* fwild: wildcard file */ ; #define IO_VM1 0000002 /* fwild: version ;-1 */ ; #define IO_VER 0000004 /* fwild: ;0 or ;-1 */ ; #define IO_WF1 0000010 /* fwild first flag */ ; #define IO_NLH 0000020 /* fopen 'n' hack bit */ ; RT-11 does not have an intrinsic function to return ; the file creation date or the file protection status. ; 'fwild' has been modified to save these parameters ; in its WDB data structure during the normal course ; of finding a matching file. ;W.NSIZ = 12. ; Longest match pattern (with NULL trail) ; .DSECT ; Wild file data block: ; ; ** Order-dependent data ** ; 0 WORD W.DEV ; ** Device name in RAD50 ; 2 BYTE W.NAME,W.NSIZ ; ** "ABCDEF GHI <0>" ; ; ** End of order-dependent data ** ; 16 WORD W.CHST,5. ; .SAVESTATUS area ; 30 WORD W.DSEG ; Current directory segment ; 32 WORD W.DENT ; Next entry to search ; 34 WORD W.ESIZ ; Size of directory entry in bytes ; 36 WORD W.DATE ; File Creation Date ;18 ; 40 WORD W.STAT ; File Status ;18 ;WDBSIZ = $$$$$$ ; Size of WDB in bytes ; Get File Directory Information for a File ; epoch = 140000 monmsk = 036000 daymsk = 001740 yrmsk = 000037 .psect c$code flinfo:: mov #flsize,r1 ; address of file info block mov #4,r0 1$: clr (r1)+ ; clear infoblk sob r0,1$ mov #months,(r1)+ ; unknown month mov #unprot,(r1) ; not protected mov 2(sp),r0 ; file handle beq 3$ mov 22(r0),flsize ; file size bit #1,10(r0) ; wild ? beq 3$ mov 12(r0),r0 ; WDB beq 3$ bit #100000,40(r0) ; protected file ? beq 2$ mov #protct,flprot ; yes 2$: mov 36(r0),r1 ; creation date mov r1,fldate mov r1,r0 ; process day bic #^Cdaymsk,r0 ash #-5.,r0 mov r0,flday mov r1,r0 ; process month bic #^Cmonmsk,r0 ash #-8.,r0 add #months,r0 mov r0,flmnth mov r1,r0 ; process year bic #^Cyrmsk,r0 bic #^Cepoch,r1 swab r1 asr r1 add r1,r0 add #1972.,r0 mov r0,flyear 3$: rts pc .psect c$data flsize::.word 0 ; unsigned int flsize; fldate::.word 0 ; int fldate; flyear::.word 0 ; int flyear; flday:: .word 0 ; int flday; flmnth::.word 0 ; char * flmnth; flprot::.word 0 ; char * flprot; months: .asciz "???" .asciz "Jan" .asciz "Feb" .asciz "Mar" .asciz "Apr" .asciz "May" .asciz "Jun" .asciz "Jul" .asciz "Aug" .asciz "Sep" .asciz "Oct" .asciz "Nov" .asciz "Dec" .even unprot: .asciz " " protct: .asciz "P" .even .end