I wanted to include optionally a debugging line in a macro so I tried
But that got an error "Expected #ENDMACRO" at the #IFDEF line. The online command description for #macro explains "As a macro is processed as a 'text substitution' before compilation it cannot contain any other directive. "
So I tried the less elegant
But that got the error "Expected #ELSEIF, #ELSEDEF, #ELSE or #ENDIF" at the first #EndMacro line. I couldn't find an explanation for this problem.
Is there a straightforward route to conditionally incorporate a diagnostic line in a macro?
Derek
Code:
#Macro Sendout(code,d1,d2)
PULSOUT srout, pwake
SEROUT srout, baud, (code, d1, d2)
#IFDEF diagnose
SERtxd (#code," ",#d1," ", #d2,cr,lf)
#ENDIF
PAUSE p100
#EndMacro
So I tried the less elegant
Code:
#IFDEF diagnose
#Macro Sendout(code,d1,d2)
PULSOUT srout, pwake
SEROUT srout, baud, (code, d1, d2)
SERtxd (#code," ",#d1," ", #d2,cr,lf)
PAUSE p100
#EndMacro
#ELSE
#Macro Sendout(code,d1,d2)
PULSOUT srout, pwake
SEROUT srout, baud, (code, d1, d2)
PAUSE p100
#EndMacro
#ENDIF
Is there a straightforward route to conditionally incorporate a diagnostic line in a macro?
Derek