#findln - this function will try to find the pattern within a line # - it also returns the value of where the pattern begins # - and where the pattern ends, a1 initially tells this # - subroutine where to start looking, the return value of # - a1 tells the calling program where the pattern begins # - and z1 tells the calling program where the pattern ends # - EOS is not counted in the z1 value when return to caller # # - return status of YES means find pattern # - return status of NO means unable to find pattern # include ratdef include mdef integer function findln(lin,apat,a1,z1) implicit integer (a-z) character lin(MAXLINE) character apat(MAXPAT) status=OK t1=a1 while(status==OK){ while((lin(t1)^=apat(1)&(lin(t1))^=EOS))t1=t1+1 if(lin(t1)==EOS)status=NO else { a1=t1 t2=1 t3=t1 flag=NO while((flag==NO)&(apat(t2)^=EOS)){ if(apat(t2)==lin(t1)){ t1=t1+1 t2=t2+1 } else flag=YES } if(apat(t2)==EOS){ z1=t1-1 status=YES } else t1=t3+1 } } findln=status return end