Hi,
Is there anyway to make a ifdef type preprocessor syntax. I don't understand the macro system enough to do this.
example:
define MY_SYS
ifdef MY_SYS
..Code specific to MY_SYS..
ifndef MY_SYS
..Generic Code..
Is there anyway to make a ifdef type preprocessor syntax. I don't understand the macro system enough to do this.
example:
define MY_SYS
ifdef MY_SYS
..Code specific to MY_SYS..
ifndef MY_SYS
..Generic Code..
Possible conversions:
1) In this case you need to declare MY_SYS to some non-zero value to get (a) assembler or to zero to get (b) assembled, but it won't work if you don't declare MY_SYS at all:
2) Second case can handle the case of undefined MY_SYS:
You can also use such nice macros:
For example
Both (a) and (b) will be assembled in this case.
1) In this case you need to declare MY_SYS to some non-zero value to get (a) assembler or to zero to get (b) assembled, but it won't work if you don't declare MY_SYS at all:
MY_SYS = 1
if MY_SYS
; (a)
else
; (b)
end if
2) Second case can handle the case of undefined MY_SYS:
MY_SYS equ 1
if defined MY_SYS
; (a)
else
; (b)
end if
You can also use such nice macros:
macro define name
{ name equ 1 }
macro undefine name
{ local undefined
name equ undefined }
ifdef equ if defined
ifndef equ if ~defined
For example
define MY_SYMBOL
ifdef MY_SYMBOL
; (a)
end if
undefine MY_SYMBOL
ifndef MY_SYMBOL
; (b)
end if
Both (a) and (b) will be assembled in this case.
Cool, Thanks for the help.