Compiler Tokens

Compiler Tokens

NBC supports special tokens, which it replaces on compilation. The tokens are similar to preprocessor #define macros but they are actually handled directly by the compiler rather than the preprocessor. The supported tokens are as follows:

TokenUsage
__FILE__This token is replaced with the currently active filename (no path)
__LINE__This token is replaced with the current line number
__VER__This token is replaced with the compiler version number
__THREADNAME__This token is replaced with the current thread name
__I__, __J__These tokens are replaced with the current value of I or J. They are both initialized to zero at the start of each thread or subroutine.
__ResetI__, __ResetJ__These tokens are replaced with nothing. As a side effect the value of I or J is reset to zero.
__IncI__, __IncJ__These tokens are replaced with nothing. As a side effect the value of I or J is incremented by one.
__DecI__, __DecJ__These tokens are replaced with nothing. As a side effect the value of I or J is decremented by one.
Table 2. Compiler Tokens

The ## preprocessor directive can help make the use of compiler tokens more readable. __THREADNAME__##_##__I__: would become something like main_1:. Without the ## directive it would much harder to read the mixture of compiler tokens and underscores.


Generated by  doxygen 1.6.2