From: Ermin R. A. <e.a...@st...> - 2008-10-14 14:24:16
|
Is there a way to stop a (single line) macro name from being expanded? I'm writing macros which create other macros, whose names are built up using the %+ operator, and I want to be able to test if a macro with the same name exists or possibly redefine it. I've tried something similar to the following, but it's not working (a bunch of errors saying %xdefine and %ifdef expect identifiers, so I assume that means that it expanded the name passed to it before testing): %macro DefMac 2.nolist %xdefine %1 %2 %endmacro %define LastNum 1 %macro FlagEnum 1.nolist %warning Defining FlagVal. %+ %1 %ifdef FlagVal. %+ %1 %warning FlagVal. %+ %1 Redefined %endif DefMac FlagVal. %+ %1, LastNum %assign LastNum LastNum << 1 %endmacro FlagEnum A FlagEnum B FlagEnum C ; ... FlagEnum A ; ... there a way to stop a (single line) macro name from being expanded? I'm writing macros which create other macros, whose names are built up using the %+ operator, and I want to be able to test if a macro with the same name exists or possibly redefine it. I've tried something similar to the following, but it's not working (a bunch of errors saying %xdefine and %ifdef expect identifiers, so I assume that means that it expanded the name passed to it before testing): %macro DefMac 2.nolist %xdefine %1 %2 %endmacro %define LastNum 1 %macro FlagEnum 1.nolist %warning Defining FlagVal. %+ %1 %ifdef FlagVal. %+ %1 %warning FlagVal. %+ %1 Redefined %endif DefMac FlagVal. %+ %1, LastNum %assign LastNum LastNum << 1 %endmacro FlagEnum A FlagEnum B FlagEnum C ; ... FlagEnum A ; . -------------------------------------------- Robert Alegrid #3164658 BP 079 Physics |