I have a macro with a number of arguments, of local and global variables.
Global:
Arg1 equ a234567890
Arg2 equ a234567890
glob$ equ a234567890
Call:
MyMac Arg1, Arg2
The macro:
MyMac MACRO arg1:REQ, arg2:REQ
LOCAL loc$, tc$, tmpnu
loc$ equ <1234567890>
echo.
echo Test with SizeStr
tc$ CATSTR <Size of glob >, %@SizeStr(glob$)
% echo tc$
tc$ CATSTR <Size of loc >, %@SizeStr(loc$)
% echo tc$
tc$ CATSTR <Size of arg1 >, %@SizeStr(arg1)
% echo tc$
tc$ CATSTR <Size of arg2 >, %@SizeStr(arg2)
% echo tc$
echo.
echo Test with temporary number and @SizeStr
tmpnu=@SizeStr(glob$)
tc$ CATSTR <Size of glob >, %tmpnu
% echo tc$
tmpnu=@SizeStr(loc$)
tc$ CATSTR <Size of loc >, %tmpnu
% echo tc$
tmpnu=@SizeStr(arg1)
tc$ CATSTR <Size of arg1 >, %tmpnu
% echo tc$
tmpnu=@SizeStr(arg2)
tc$ CATSTR <Size of arg2 >, %tmpnu
% echo tc$
echo.
echo Test with temporary number and SIZESTR
tmpnu SIZESTR glob$
tc$ CATSTR <Size of glob >, %tmpnu
% echo tc$
tmpnu SIZESTR loc$
tc$ CATSTR <Size of loc >, %tmpnu
% echo tc$
tmpnu SIZESTR arg1
tc$ CATSTR <Size of arg1 >, %tmpnu
% echo tc$
tmpnu SIZESTR arg2
tc$ CATSTR <Size of arg2 >, %tmpnu
% echo tc$
ENDM
Here are the results. Expected value is in all cases 10 characters, so only the last version works...
Test with SizeStr
Size of glob 5
Size of loc 6
Size of a234567890 4
Size of a234567890 4
.
Test with temporary number and @SizeStr
Size of glob 5
Size of loc 6
Size of a234567890 4
Size of a234567890 4
.
Test with temporary number and SIZESTR
Size of glob 10
Size of loc 10
Size of a234567890 10
Size of a234567890 10
Question: Where is my newbie error in this...?
Usually I don't help noobies, but ...
the evaluation operator % must be placed before the expression which is to be evaluated
tc$ CATSTR <Size of glob >, @SizeStr(%glob$)
if it is placed before @SizeStr(), it converts the numeric value returned by @SizeStr to a literal (05 -> 5)
Quote from: japheth on May 18, 2008, 06:27:33 PM
Usually I don't help noobies, but ...
You have a good heart, Japheth - it is very touching that you made an exception in my (hopeless) case :U