.TITLE SRDATA .IDENT -6.5- ; Jan-85 .ENABL LC ;+ ; SRDATA---SORT DIRECTORY DATA MODULE ; ; THIS MODULE CONTAINS ALL IMPURE DATA FOR THE ; ...DIRECTORY SORT TASK ; ;- ; ; MODIFICATIONS: ; ; BT001 - 01-DEC-81 ; ADD 3RD SWITCH WORD ; ; RBD001 13-Jul-82 ; Lower case messages ; Conditionally assemble help spawn to CLI... for ; RSX-11M V4.0, to spawn to appropriate CLI in use. ; Add support for Exit with Status ; Update version message ; ; BT002 - 18-May-83 ; Merged in /SM, /HD, and /BK switches from Glen Everhart's ; Fall 1982 version ; ; CEF001 -- 01-June-83 ; ADD .PSECTS for /MU ; ; ; VERSION 6.4 - 07-Nov-83 (;BT003) ; ; Bob Turkelson ; SRD Working Group ; ; Use additional LUN for reading headers. For directories too ; large to fit into memory, the directory is kept open while ; processing it in pieces. Thus the directory LUN can not be ; re-used for reading the headers. ; Allow specification of major and minor sort keys in any order ; in the /SR:x:x:x switch, also allowing the sort to be either ; ascending or descending for any key (file name, type, version ; date). Ascending and descending capability adopted from ; changes by Dave Sides (Sachs/Freeman Assoc., Inc., c/o ; JHU/Applied Physics Laboratory)(;DJS001). Ideas for ; specifying sort keys came from the version of SRD in the ; U. S. Forest Service collection of programs appearing on the ; Spring 1982 SIG tape. The implementation here is quite ; different. ; Search forward in the sorted directory to determine the number ; of versions when highest or obsolete version selection is ; required, and remember where a new file name and type is ; found. Necessary to take care of ascending version ; numbers. (Replaces code which compared each entry with ; both the previous and the next entries.) A check for end ; of directory is performed. (Previously possible to get a ; memory protection violation error when checking last entry ; of a dense directory which exactly filled the last block.) ; Added the command file generation switch /CM, taken from the ; version of SRD submitted to the Spring 1982 SIG tape in the ; U. S. Forest Service collection of programs. ; Added the /GT:n switch to select files with allocated sizes of ; at least n. blocks. ; Added the /FI:n switch to select by file ID. ; Added the /FO:[g,m] switch to select files by file owner, with ; /FO defaulting to files owned by the directory being listed; ; may be negated to select files with different file owners. ; Reference double word (rather than single word) values in the ; file headers to report a file's used and allocated blocks. ; For files with multiple headers, calculate the number of ; allocated blocks from the retrieval pointers (as has been ; done for any file when the header attributes show zero blocks ; allocated). Read each extension header into a buffer which ; starts at the beginning of the retrieval pointer area of the ; buffer for the first header. Only 51. additional words are ; needed for the buffer since the overlap is 205. words. ; Use three letters of the task name in the program prompt and in ; error messages. ; Form a UIC string when the directory is opened in SRDOPR for ; use in UIC headings and diagnostic messages. ; Move the error message buffer so that it overlaps the prompt- ; for-selective-delete buffer. ; ; ; VERSION 6.5 - 16-Jan-85 (;WG001) ; ; SRD Working Group ; ; Add information to the /ID message telling which operating ; system and support features were specified when this task ; was generated. ; Add support for named directories for P/OS and Micro/RSX. ; Spawn ...HEL for help on P/OS systems since there is no CLI. ; ;= ; ; SYSTEM MACRO CALLS ; .MCALL FDBDF$,FSRSZ$,FDRC$A,FDOP$A,FDBF$A,GCMLB$,FDBK$A,CSI$ .MCALL FDAT$A,NMBLK$,FHDOF$,FCSBT$,FDOF$L,QIOW$,SPWN$ ;BT003 .PSECT $DATA,RW,D,LCL,REL,CON ;BT003 FHDOF$ DEF$L ;BT003 .GLOBL Q.IOPL .PSECT $DATA,RW,D,LCL,REL,CON ;CEF001 FCSBT$ .PSECT $DATA,RW,D,LCL,REL,CON ;CEF001 FDOF$L .PSECT $DATA,RW,D,LCL,REL,CON ;CEF001 CSI$ .PSECT $DATA,RW,D,LCL,REL,CON ;CEF001 FSRSZ$ 1 .PSECT $DATA,RW,D,LCL,REL,CON ;CEF001 ; ; LOCAL DEFINITIONS ; .IF DF MO$LUN ; GET TKB TO ALLOCATE A LUN FOR ERROR MESSAGES ; .MOLUN::.BLKW 1 ; .ENDC ; MO$LUN ; ; COMMAND BUFFER & CONTROL BLOCK ; CSIBLK::.BLKB C.SIZE ; CMDBLK::GCMLB$ 2,SRD,,CMDLUN ; CMDSIZ==CMDBLK+G.CMLD ; DEFINE COMMAND SIZE ADDRESS CMDADR==CMDSIZ+2 ; ...AND ADDRESS POINTER ; UFDFDB::FDBDF$ FDRC$A FD.RWM ; READ/WRITE MODE FDBK$A ,512.,,DSKEFN,IOSB$ FDOP$A UFDLUN,,,FO.RD,FA.DLK ; DUKE004 ; ;CEF001 .PSECT $DATA,RW,D,LCL,REL,CON ;CEF001 ; LSTFDB::FDBDF$ FDAT$A R.VAR,FD.CR FDRC$A FD.PLC,LINBUF,132. FDOP$A LSTLUN,,,FO.WRT .PSECT $DATA,RW,D,LCL,REL,CON ;CEF001 IOSB$:: .BLKW 2 IOSBSV::.BLKB 1 ; I/O status block byte saved here if header read error ;BT003 .EVEN ;BT003 ; ; QIO DPB TO ATTACH/DETACH THE LISTING DEVICE ; LSTQIO::QIOW$ IO.ATT,LSTLUN,EFN1 .PSECT $DATA,RW,D,LCL,REL,CON ;CEF001 LSTDFN::NMBLK$ DIRECTORY,LST,0,SY,0 .PSECT $DATA,RW,D,LCL,REL,CON ;RBD001 ; ;RBD001 ; Exit status for systems which support EXST$x ;RBD001 ; ;RBD001 X$STAT::.BLKW 1 ; EXIT STATUS ;RBD001 ;RBD001 ; ; SAVE AREA FOR STACK POINTER ; SAVSP:: .BLKW 1 $XX1:: .WORD $$$XX1 $XX2:: .WORD $$$XX2 $XX3:: .WORD $$$XX3 .LIMIT ; End of code LIMBF$==.-2 ; Cannot shrink below here (overlay problems) DIRBF$:: +0 ;SET POINTER TO START OF BUFFER .PSECT $DATA,RW,D,LCL,REL,CON ;CEF001 DIRBE$::.BLKW 1 ; END OF DIRECTORY BUFFER HERE MINSZ$::.BLKW 1 ; Minimum Size for Buffer (LIMBF$-DIRBF$) DIRIC$::.BLKW 1 ; LAST DYNAMIC INCREMENT PARBF$::.BLKW 16. ; GPRT$ parmeters (3 words); also GTSK$ (16. words) ;BT003 ; ;BT003 ; ;BT003 ; --- Note: All words in the following section are zeroed --- ;BT003 ; in SRDINI before getting the command line. ;BT003 STACLR:: NUMFS:: .WORD 0 ; # OF FILES SELECTED NUMFT:: .WORD 0 ; # OF FILES TOTAL ; TBLKA:: +0,0 ; TOTAL BLOCKS ALLOCATED TBLKU:: +0,0 ; USED ; CLMFLD::.BLKW 2 ; SPACE FOR CONTIGUOUS, LOCKED, MULTI-HEADER ; ; FILE CHARACTERISTICS REPORT BUFFER SEBUF$::.BLKB 20. ; SELECT NAME BUFFER .BLKB 2 ; TWO-BYTE OVERFLOW FOR SEBUF$ MANIPULATION LINSZ$::.BLKW 1 ; LINE SIZE SWITCH VALUE VRSCT$::.BLKW 1 ; COUNT OF NUMBER TO USE IN PURGE/SELECT VERSION VRSRM$::.BLKW 1 ; Number of file versions remaining (including current) ;BT003 VRSLMT::.BLKW 1 ; Number of file versions remaining when at point ;BT003 ; ; separating files wanted and not wanted by /SV:n ;BT003 ; ; or /OV:n switches ;BT003 SKBUF$::.BLKW 5 ; Sort key specification from /SR: switch ;BT003 SKEND$==. ;BT003 FIBUF$::.BLKW 4 ; /FI: switch values (File-IDs requested) ;BT003 .WORD 0 ; Signal end of /FI: switch values ;BT003 GTBUF$::.WORD 0,0 ; Minimum file size to list, double word (from /GT:) ;BT003 CMFLG$::.BLKW 1 ; Flag word used in /CM: processing ;BT003 CMBUF$::.BLKB 3 ; First /CM: switch value ;BT003 .BYTE 0 ; String terminator (needed if value entered is 3 chars);BT003 CMBF2$::.BLKB 5 ; Second /CM: switch value ;BT003 .BYTE 0 ; String terminator ;BT003 .EVEN ;BT003 FOGBF$::.BLKW 1 ; Group number specified in 1st /FO: value (0 for all) ;BT003 FOMBF$::.BLKW 1 ; Member number specified in 2nd /FO: value (0 for all) ;BT003 FOGRP$::.BLKB 1 ; Group number to use in file owner comparisons ;BT003 FOMEM$::.BLKB 1 ; Member number to use in file owner comparisons ;BT003 GRPBIN::.BLKB 1 ; Directory group (binary) ;BT003 MEMBIN::.BLKB 1 ; Directory member (binary) ;BT003 GRPASC::.BLKB 3 ; Directory group (ASCII with leading zeros) ;BT003 .BYTE 0 ; Binary zero separator ;BT003 GRPMEM::.BLKB 3 ; Directory member (ASCII with leading zeros) ;BT003 .BYTE 0 ; Binary zero separator ;BT003 USEDSZ::.BLKW 2 ; File blocks used, double word ;BT003 ALOCSZ::.BLKW 2 ; File blocks allocated, double word ;BT003 LENNMF::.BLKW 1 ; Length of name field of file name ;BT003 LENTYF::.BLKW 1 ; Length of type field of file name (including period) ;BT003 LENNTV::.BLKW 1 ; Length of name-type-version ;BT003 UICHD:: .BLKB 12. ; Area for UIC string [g,m] without leading zeros, ;WG001 ; or directory name [xxxxxxxxx] if named directories ;WG001 ; supported, terminating with zero byte ;WG001 .EVEN ;**-2 AFBUF$::.BLKB 16. ; /AF OR /DA DATE HERE .BYTE 0 ; SENTINEL .EVEN BEBUF$::.BLKB 16. ; /BE DATE HERE .BYTE 0 ; SENTINEL .EVEN FLAGS$::.BLKW 1 ; FLAGS BITS HERE LENCLR==.-STACLR ; ;BT003 ; --- End of section of data zeroed in SRDINI before command line processing ---;BT003 ; ;BT003 ; ;BT003 SWMSK$::.BLKW 1 ; SWITCH BITS HERE SWMS2$::.BLKW 1 ; 2ND SWITCH WORD HERE SWMS3$::.BLKW 1 ; 3RD SWITCH WORD HERE ;BT001 LVNUM$::.BLKW 1 ; LOW VERSION NUMBER WHEN SELECTING HIGHER VERSIONS TDBUF$::.BLKB 16. ; KEEP DATE & TIME HERE TDTIM$::.BLKB 6 ; Keep Time here as well ; ; SAVE AREA FOR DIRECTORY AND DEVICE INFO FOR SELECTIVE DELETE ; SAVDID::.BLKW 2 ; DIRECTORY ID SAVED HERE SAVDVN::.BLKW 1 ; DEVICE NAME GOES HERE SAVUNM::.BLKW 1 ; UNIT NUMBER HERE ; ; Help Switch Handling ; .IF DF R$$MV4 ;RBD001 .IF DF P$$OS ; If on P/OS ;WG001 HLSPWN:: SPWN$ ...HEL,,,,,1,,,HELCMD,HELCML ;No CLI on P/OS ;WG001 HELCMD:: .ASCII "HELP/DCL SRD" ;WG001 .IFF ;P$$OS ;WG001 HLSPWN:: SPWN$ CLI...,,,,,1,,,HELCMD,HELCML ;WG001 HELCMD:: .ASCII "HELP/MCR SRD" ;WG001 .ENDC ;P$$OS ;WG001 .IFF ;R$$MV4 ;WG001 HLSPWN:: SPWN$ MCR...,,,,,1,,,HELCMD,HELCML ;WG001 HELCMD:: .ASCII "HELP SRD" ;WG001 .ENDC ;R$$MV4 ;WG001 HELCML==.-HELCMD ;**-5 .EVEN ; ; WILD CARD DIRECTORY FLAGS ; NXUIC$::.BLKW 1 ; NEXT UIC TO CHECK WCGRP$::.BLKW 1 ; GROUP CODE OR 0 FOR WILD CARD GRP WCUSR$::.BLKW 1 ; USER NUMBER OR ZERO FOR WILD .EVEN ; WORD ALIGNMENT NEEDED UICS$:: .ASCIZ /000/ ; PROTOTYPE UIC FIELD .EVEN ; ; READ FILE HEADER DPB ; READHD::QIOW$ IO.RAT,HDRLUN,EFN1,,IOSB$,,<0,ATTLST> ;BT003 ; ATTLST: .BYTE -10.,0 ; ATTRIBUTE LIST---READ ENTIRE HEADRE HDPTR$::.BLKW 1 ; Pointer to header buffer - HDBUF$ or HDBF2$ address ;BT003 ; ; Note: this word is part of the parameter block ;BT003 .WORD 0 ; TO TERMINATE PARAMETER BLOCK HDBUF$::.BLKW 256. ; THIS IS THE BUFFER HDBF2$==HDBUF$+S.HDHD+S.IDHD+M.RTRV ; Read second and later headers into a ;BT003 ; ; buffer which begins where the first header ;BT003 ; ; retrieval pointers begin. Thus only 51. additional ;BT003 ; ; words (146 octal bytes) are needed to read in other ;BT003 ; ; headers. ;BT003 .BLKB ; Allocation for end of additional header;BT003 .EVEN ;BT003 ; .BYTE 040,040 ; 2 SPACES LINBUF::.BLKB 132. .BYTE 040,040 ; SPACES .EVEN ;BT003 ERMESG::.ASCII /SRD -- */ ;BT003 ERSERV::.BLKB 4 ;BT003 .ASCII /* / ;BT003 ERMES1:: ;BT003 PRMPT:: .BLKB 132. ; Buffer used for: ;BT003 ; ; (a) Prompting in selective delete processing; ;BT003 ; ; (b) In /CM processing to hold file name temporarily;;BT003 ; ; (c) For error messages ;BT003 .EVEN ;BT003 FILMSG:: .ASCII ' XXXXX. Files selected ' FTMSG:: .ASCII ' XXXXX. Files total' ;RBD001 FMLEN==.-FILMSG SBMSG:: .ASCII ' Selected blocks used/allocated: ' ;RBD001 SBAREA::.BLKB 18.+3. .EVEN ; VERSION NUMBER MESSAGE ; SRDVER::.ASCII <12><15>"SRD -- Version WG-6.5, January 1985" ;WG001 .IF DF P$$OS ;WG001 .ASCII <12><15>" Built for P/OS" ;WG001 .IFF ;P$$OS ;WG001 .IF DF M$$CRO ;WG001 .ASCII <12><15>" Built for Micro/RSX" ;WG001 .IFF ;M$$CRO ;WG001 .IF DF R$$MPL ;WG001 .ASCII <12><15>" Built for RSX-11M-PLUS" ;WG001 .IFF ;R$$MPL ;WG001 .IF DF R$$11M ;WG001 .ASCII <12><15>" Built for RSX-11M" ;WG001 .IFTF ;R$$11M ;WG001 .IF DF I$$AS ;WG001 .ASCII <12><15>" Built for IAS or RSX-11D" ;WG001 .ENDC ;I$$AS ;WG001 .IIF DF E$$IS .ASCII <12><15>" with EIS instruction support" ;WG001 .IIF DF D$$CAL .ASCII <12><15>" with dynamic checkpoint support";WG001 .ENDC ;R$$11M ;WG001 .IFTF ;R$$MPL ;WG001 .IIF DF M$$CLI .ASCII <12><15>" with spawn to CLI... support" ;WG001 .ENDC ;R$$MPL ;WG001 .ENDC ;M$$CRO ;WG001 .ENDC ;P$$OS ;WG001 .ASCII <12><15> ;WG001 ;**-1 SRDVS == .-SRDVER ; .EVEN .END