Debugging IDEFs statement was a black art for advanced developers.
There is now a method to display the IFDEFs that will be processed. The method will show for a specific file and this display will help you understand the process that the compiler will take to determine the results of conditional processing.
An Example
The base program. The constant __VAR is the condition - if is exists then the constant ORANGE =1 else ORANGE = 2.
#CHIP 16F88#OPTION EXPLICIT#DEFINE __VAR#DEFINE ORANGE 0 'Set to zero to prove conditional processing works!!DimByteVarasByteByteVar=255#IFDEF __VAR#UNDEFINE ORANGE#DEFINE ORANGE 1 'New constant valueByteVar=99'To show code is executing#ELSE#UNDEFINE ORANGE#DEFINE ORANGE 2 'New constant value ByteVar=98'To show code is executing#ENDIFByteVar=ORANGE'Assign constant to a variable
With the debugger active the follow information is displayed. This shows the process - lines 11 thru 14 will be executed.
Debugging IDEFs statement was a black art for advanced developers.
There is now a method to display the IFDEFs that will be processed. The method will show for a specific file and this display will help you understand the process that the compiler will take to determine the results of conditional processing.
An Example
The base program. The constant
__VAR
is the condition - if is exists then the constant ORANGE =1 else ORANGE = 2.With the debugger active the follow information is displayed. This shows the process - lines 11 thru 14 will be executed.
If the constant
__VAR
is commented out then the following debug is shown.This example shows the power of the debugger.
How to enable
As this is an in advanced capability the only was to enable it via the compiler ini/setup file.
Add to the [gcbasic] section of the ini file the item
conditionaldebugfile
with the parameter of the filename to debug.[gcbasic]
conditionaldebugfile = showifdefsdebug.gcb
This will help those trying to use conditional IFDEFs
Enjoy