hi
How do I use IFDEF, to make sure of the definition of the Member in Struct
F EX:
If I used: R :RECT
IFDEF R.left <======result Ok Def
And also
IFDEF R.Alfa22l <======result Ok Def
IFDEF RECT.left <======result Ok Def
And also
IFDEF RECT.Alfa22l <======result Ok Def
[ELSE]IF[N]DEF only checks if the label R exists. The OPATTR operator can be used to validate the expression:
IF opattr R.Alfa22l
echo dead code
ENDIF
IF opattr R.left
echo R.left
ENDIF
IF opattr RECT.foo
echo dead code
ENDIF
IF opattr RECT.right
echo RECT.right
ENDIF
thanks qWord
Quote from: qWord on November 18, 2013, 05:30:13 AM
The OPATTR operator can be used to validate the expression
Beware of little problems with JWasm:
include \masm32\include\masm32rt.inc
.code
start:
R RECT <?>
tmp$ CATSTR <The_arg=>, <R.Alfa22l>, < with opa=>, %(opattr R.Alfa22l)
% echo tmp$
tmp$ CATSTR <The_arg=>, <R.left>, < with opa=>, %(opattr R.left)
% echo tmp$
tmp$ CATSTR <The_arg=>, <RECT.foo>, < with opa=>, %(opattr RECT.foo)
% echo tmp$
tmp$ CATSTR <The_arg=>, <RECT.right>, < with opa=>, %(opattr RECT.right)
% echo tmp$
.err
exit
end start
OPT_Assembler JWasm
JWasm:
The_arg=R.Alfa22l with opa=[b]768[/b]
The_arg=R.left with opa=[b]810[/b]
The_arg=RECT.foo with opa=0
The_arg=RECT.right with opa=36
ML 6.14 ... 10.0:
The_arg=R.Alfa22l with opa=0
The_arg=R.left with opa=42
The_arg=RECT.foo with opa=0
The_arg=RECT.right with opa=36
P.S.: I thought of posting a bug report but I see you did it already (http://sourceforge.net/p/jwasm/bugs/294/) ;-)