.TITLE FILSEARCH - $PARSE AND $SEARCH ROUTINES .SBTTL DIRECTORY SEARCH ROUTINES ; ; CALLING SEQUENCE: ; ; STS$VALUE = DPARSE (FILE, DIRECTORY) ! INITIALIZES $PARSE. ; STS$VALUE = DSEARCH (FILENAME) ! GET NEXT FILENAME ; ! WITH $SEARCH. ; ; DATA DECLARATIONS (PL/I) ; ; %INCLUDE $STSDEF; ! SET UP DECLARATION FOR STS$VALUE ; ; DCL ; FILE CHARACTER(*), ! FILE STRING. WHEN CALLING RMSPARSE, ; ! THIS MAY CONTAIN WILDCARDS. ; ; DIRECTORY CHARACTER(*), ! DEFAULT DIRECTORY STRING. ; ! DEFAULTS TO THE DIRECORY THAT YOU ; ! ARE CURENTLY IN. ; ; FILENAME CHARACTER(*); ! RETURNS NEXT FILENAME ; ! FOUND BY $SEARCH. ; $FABDEF $NAMDEF $SSDEF $RMSDEF .PSECT DATA,LONG,NOEXE FAB: $FAB NAM=NAM NAM: $NAM RSA=RES,- RSS=NAM$C_MAXRSS,- ESA=EXP,- ESS=NAM$C_MAXRSS RES: .BLKB NAM$C_MAXRSS EXP: .BLKB NAM$C_MAXRSS .PSECT CODE,LONG,NOWRT .ENTRY DPARSE,^M<> MOVQ @4(AP),R0 ; MOVE FILE DSC TO R0 MOVB R0,FAB+FAB$B_FNS ; GET SIZE OF FILE MOVL R1,FAB+FAB$L_FNA ; AND ADDRESS CLRL FAB+FAB$L_DNA ; CLEAR DEFAULT AREAS CLRB FAB+FAB$B_DNS ; MOVQ @8(AP),R0 ; MOVE DIRECTORY DSC TO R0 MOVB R0,FAB+FAB$B_DNS ; INITIALIZE DEFAULT AREAS MOVL R1,FAB+FAB$L_DNA ; ON FIRST CALL TO DPARSE $PARSE FAB=FAB ; INVOKE $PARSE RET ; .ENTRY DSEARCH,^M $SEARCH FAB=FAB ; INVOKE SEARCH CMPL R0,#RMS$_NMF ; NO MORE FILES FOUND? BEQL DONE BLBC R0, RETURN ; ERROR MOVQ @4(AP),R2 ; GET FILENAME DSC MOVZBL R2,R2 ; BYTES TRANSFERRED MOVZBL NAM+NAM$B_RSL,R4 ; GET SIZE OF NEW FILENAME MOVC5 R4,RES,#^A/ /,R2,(R3) ; CREATE FILENAME RETURN: RET DONE: MOVL #RMS$_NMF,R0 RET .END