;+ ; FILESCAN ; James Wagoner ; ; Purpose: Allows other VAX languages to call the FILESCAN system service ; with a variable format argument list. The variable format ; argument list allows more than one field to be returned at ; any call to the routine. ;- .title FILESCAN .psect DATA,WRT,NOEXE ITEM_LIST_2: .BLKQ 6 .LONG 0 .psect CODE,NOWRT,EXE .entry FILESCAN,^M blbs (AP),$10 ;is # of parameters even movl #999,R0 ;set error return code if even ret ;return on error ;+ ; This section of code initializes and computes values to loop through the ; argument list for each argument pair in the list (not including the the file ; name string being scanned). ;- $10: clrl R2 ;clear loop register movw (AP),R2 ;get number of args decl R2 ;subtract to get # of argument pairs divl2 #2,R2 ;divide to get loop count movl #2,R3 ;init index register into arguement list movaw ITEM_LIST_2+2,R4 ;init pointer to item_list ;+ ; This loop places the file specification field codes into the item list. ;- $20: movl (AP)[R3],R5 ;move pointer to register movw (R5),(R4) ;place code in item list addl2 #2,R3 ;increment index addl2 #8,R4 ;increment pointer sobgtr R2,$20 ;loop if not last argument ;+ ; These lines place the terminating value zero at the end of the item list. ;- subl2 #2,R4 ;back up to alignment of item list 2 movl #0,(R4) ;terminate item list ;+ ; This section calls the FILESCAN system service. ;- movl 4(AP),R10 ;move pointer to descriptor $FILESCAN_S SRCSTR=(R10),VALUELST=ITEM_LIST_2 ;+ ; This section of code initializes and computes values to loop through ; copy back the requested items in the results field. ;- moval ITEM_LIST_2,R6 ;init pointer to item list movl #1,R7 ;init index at one less into argument ; list ;+ ; This section of code copies the requested sections of the file specification ; to the string passed down in the argument list. ;- TOP: addl2 #2,R7 ;incr pointer into arguement list movl (AP)[R7],R8 ;move pointer to result into register movc5 (R6),@4(R6),#32,(R8),@4(R8) ;move characters to result tstl (R6)+ ;incr pointer into item list tstl (R6)+ ;incr pointer into item list tstl (R6) ;test if end of item list bnequ TOP ;if not, continue loop movl #1,R0 ;set normal status ret ;return to calling routine .end