Example 9. Using Subscripted Substitution Symbols to Find Substrings

substr .macro start,strg1,strg2,pos .var LEN1,LEN2,I,TMP .if $$symlen(start) = 0 .eval 1,start .endif .eval 0,pos .eval 1,i .eval $$symlen(strg1),LEN1 .eval $$symlen(strg2),LEN2 .loop .break I = (LEN2 - LEN1 + 1) .asg ":strg2(I,LEN1):",TMP .eval i,pos .break .else .eval I + 1,i .endif .endloop .endm .asg 0,pos .asg "ar1 ar2 ar3 ar4",regs substr 1,"ar2",regs,pos .word pos