News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

a translation of #undef

Started by ToutEnMasm, July 19, 2005, 05:38:29 PM

Previous topic - Next topic

ToutEnMasm

Hello,
I write a translator of the header files for masm and I don't find the equivalent of #undef.
#define _X86_    can be translate by  _X86_ equ
but #undef _X86_    ,I don't see how to translate.
            If somebody have an idea  ..., ToutEnMasm


Jeff

AFAIK, there is no equivalent in MASM.  i wanted to be able to do the same as well but couldnt.  its a shame we cant use PURGE.

MazeGen

That's one of the weak points of MASM - there's really nothing like #undef.

There's a trick how to redefine text macro without the need of #undefine, but it is another story.

Vortex

Quote
There's a trick how to redefine text macro without the need of #undefine, but it is another story.

Could you explain that method?

Jeff

text macros can be redefined if they were defined with the TEXTEQU directive.  ;)

Vortex

Hi Jeff,

This one works fine :


v TEXTEQU <trial>
v TEXTEQU

MazeGen

You can encounter this problem in some complex macro, when the symbolic name of the text macro is variable.
Because it seems to be too difficult to give clear sample proof of the solution, here is just what I was talking about:


SomeStr TEXTEQU <SymbolicName> ; SomeStr = "SymbolicName"
%SomeStr TEXTEQU <I Am A String> ; SymbolicName = "I Am A String"


Without the possibility of undefine the SomeStr macro, we can't simply redefine it:


SomeStr TEXTEQU <SymbolicName> ; SomeStr = "I Am A String"
%SomeStr TEXTEQU <I Am A String> ; I Am A String = "I Am A String"


The last statement, I Am A String = "I Am A String", is not valid - assembly error.

Try it:


.686
.model flat, stdcall

SomeStr TEXTEQU <SymbolicName>
%ECHO SomeStr

%SomeStr TEXTEQU <I Am A String>
%ECHO SomeStr

SomeStr TEXTEQU <SymbolicName>
%ECHO SomeStr

%SomeStr TEXTEQU <I Am A String> ; error
%ECHO SomeStr

.code
start:
end start