EnglishРусский  
The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

The ifdef command

The ifdef command of conditional compilation allows you to include and exclude some parts of the program for compilation depending on some conditions. A conditional expression must follow the ifdef keyword and the part of the program that should be compiled if the condition is met ( not equal to 0 ) should come after it in curly braces. You can use an expression consisting of macros and constants as a condition (a number, a string, a binary data). You can take a look at all possible operation for expressions on the Macro expressions page.

In the example below the myfunc function will be compiled if the macro $MODE is a number not equal to 0 and not an empty string.

ifdef $MODE
{
   func myfunc( uint param)
   { ... }
}

You can use ifdef not only on the top embedment level, but also inside any other command and even inside expressions. Besides, it is possible to embed ifdef commands inside each other.

func myfunc( uint param )
{
   uint i = param
   ifdef $ABC == 3 || $NAME == "Private" 
   {
      i *= 2 + ifdef !$MODE { 100 } else {200} 
   }
   ...
}

elif and else

If the condition is false and another part of the program should be compiled, the else command is used. If there are more than two variants of compilation, you can use the elif command with an additional condition. You can have several elif commands in a row and the else command at the end.


define 
{
   ifdef $MODE == 5
   {
       NAME = "Public"
       MODE= 10
   }
   elif  $MODE == 4
   {
       NAME = "Debug"
   }
   elif  $MODE > 5 : NAME = "Private"
   else : NAME = "Unknown"
}

Related links