User Tools

Site Tools


omit_specify_source_not_to_be_compiled_.htm
Navigation:  Language Reference > 2 - Program Source Code Format > Compiler Directives >====== OMIT (specify source not to be compiled) ====== Previous pageReturn to chapter overviewNext page

OMIT(terminator [,expression])

blk2blue.jpg

OMIT Specifies a block of source code lines to be omitted from the compilation.
terminator A string constant that marks the last line of a block of source code.
expression An expression allowing conditional execution of the OMIT. The expression is either an EQUATE whose value is zero or one, EQUATE = integer, or one of the other conditional operators described below..

The OMIT directive specifies a block of source code lines to be omitted from the compilation. These lines may contain source code comments or a section of code that is to be conditionally compiled. The omitted block begins with the OMIT directive and ends with the line that contains the same string constant as the terminator. The entire terminating line is included in the OMIT block.

The optional expression parameter permits conditional OMIT. The form of the expression is fixed. It is the label of an EQUATE statement, or a Conditional Switch set in the Project System, and may be followed by a valid operator and an integer constant.

The following conditional operators are supported:

Expressions may be one of the following forms:

<;equate>
<;equate> = <;integer constant>
<;equate> <;> <;integer constant>
<;equate> > <;integer constant>
<;equate> <; <;integer constant>
<;equate> >= <;integer constant>
<;equate> <;= <;integer constant>

The OMIT directive executes only if the expression is true. Therefore, the code between OMIT and the terminator is compiled only if the expression is not true. If the expression contains an EQUATE that has not yet been defined, then the referenced EQUATE is assumed to be zero (0). COMPILE and OMIT are opposites.

Every source/include file can have nested OMIT/COMPILE blocks with a maximum nesting equal to 8 with a condition that when evaluated does not omit source, plus one additional

OMIT/COMPILE with a condition evaluated to omit source code.

NoteBox.jpg

The OMIT compiler directive is not used by the ABC Application Class Parser.

Example:

OMIT('END')             !Unconditional OMIT

!Main Program Loop

END

OMIT('*',_WIDTH32_)       !OMIT only if application is 32-bit SIGNED   EQUATE(SHORT) *

COMPILE('*',_WIDTH32_)    !COMPILE only if application is 32-bit SIGNED   EQUATE(LONG) *

OMIT('EndOfFile',OnceOnly)   !Compile only the first time encountered because the

OnceOnly EQUATE(1)           ! OnceOnly EQUATE is defined after the COMPILE that

                            ! references it, so a second pass during the same

                            ! compilation will not re-compile the code

Demo EQUATE(0)               !Specify the Demo EQUATE value

CODE

OMIT('EndDemoChk',Demo = 0) !OMIT only if Demo is turned off

 DO DemoCheck               !Check for demo limits passed

!EndDemoChk                 !End of omitted code

! EndOfFile

!The following example below shows how OMIT and COMPILE can be nested

COMPILE ('32bit',_width32_) !outer COMPILE

COMPILE ('*debug*',_debug_)

DEBUGGER::BUTTONLIST Equate('&amp;Continue|&amp;Halt|&amp;Debug')

!end- COMPILE ('*debug*',_debug_)

OMIT ('*debug*',_debug_)

DEBUGGER::BUTTONLIST Equate('&amp;Continue|&amp;Halt')

!end- OMIT ('*debug*',_debug_)

!end- COMPILE ('32bit',_width32_) !end outer COMPILE

OMIT ('32bit',_width32_)

DEBUGGER::BUTTONLIST Equate('&amp;Continue|&amp;Halt')

!end- OMIT ('32bit',_width32_)

NoteBox.jpg

The compiler reads and parses source/include files by blocks. If the end of an OMIT/COMPILE block (terminator string) is found in the current block, the compiler either with skip the text up to terminator or will continue to parse the file - depending on whether you are using OMIT or COMPILE and what condition. If the terminator string is found within the current block and parsing is continuing, nested OMIT/COMPILE statements are allowed. If the terminator string is not found, nested OMIT/COMPILE statement in this block is not allowed.

In summary, nesting of OMIT/COMPILE statements is dependent on the current compiler block. Use of conditions in OMIT/COMPILE statements and possibility to define complex conditions as EQUATEs are allowed to avoid excessive nesting of OMIT/COMPILE statements.

See Also:

Predefined Compiler Flags

COMPILE

EQUATE

omit_specify_source_not_to_be_compiled_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)