.TITLE FIND_FIRST - Fortran interface to STR$FIND_FIRST_SUBSTRING ; ; ; This routine allows simple use of STR$FIND_FIRST_SUBSTRING ; from FORTRAN, when the number of substrings to be used is not known ; at compile time. The calling sequence is as for STR$FIND_FIRST_SUBSTRING ; except that the last argument is replaced by a count of substrings, ; and an array of descriptors for those substrings. ; .Entry Str_Find_First_Substring,^M<> Source = 4 ;String to search Pos = 8 ;Position where target found Index = 12 ;Index number of found string Ntargs = 16 ;Number of target strings Targets = 20 ;Address of descriptor array cmpl (ap),#5 ;Correct number of arguments ? beql 10$ ;Yes movl #ss$_insfarg,r0 ;Nope, return now ret 10$: movl @Ntargs(ap),r1 ;Get count of targets mull3 #8,r1,r0 ;Compute offset to last descriptor addl2 targets(ap),r0 ;Absolute address of last descriptor 20$: pushaq -(r0) ;Push the address of target n sobgtr r1,20$ ;Push all of them pushal @index(ap) ;and address of word to return index pushal @pos(ap) ;and address of word for position of hit pushaq @source(ap) ;and address of source descriptor movl @ntargs(ap),r1 ;Get count of targets again addl2 #3,r1 ;Add other arguments calls r1,G^Str$Find_First_Substring Ret .end