the problem is that the text macro "args" contains the macro call to fakestr$(): whenever this text macro is used as argument for the string functions, MASM expand it as far as possible.
Thanxalot, qWord - that did the trick :t
@Hutch: Thanks, I took a slightly different road now, but your code inspired me to find a solution for JWasm's @SubStr() bug.
Here is the final version (now included in
MasmBasic) - works with Masm 6.15 ... 10.0 and JWasm:
If_ MACRO arg:VARARG
LOCAL is, cond
is INSTR <arg>, <Then>
ife is
.err @CatStr(<*** no Then in line >, %@Line, < ***>)
else
ifidni @SubStr(<arg>, 1, 3), <not>
cond SUBSTR <arg>, 5, is-5 ; If_ not eax==3 || eax==4 Then inc eax
.if !(cond)
If_2 %is+5, <arg: >
.endif
else
cond SUBSTR <arg>, 1, is-1 ; If_ eax Then inc eax : print !str$(eax)
.if cond
If_2 %is+5, <arg: >
.endif
endif
endif
ENDM
If_2 MACRO pos, args
LOCAL cc, is
cc INSTR pos, <args>, <:>
is=pos
WHILE cc gt is
tmp$ SUBSTR <args>, is, cc-is
tmp$
is=cc+1
cc INSTR is, <args>, <:>
ENDM
ENDMTestbed attached. Again, many thanks especially to qWord and Hutch :icon14: