@ $variable directive

The macro expander allows for @$ macros - and they are available in c++, xcpp, xcpj and xcws files. They are parameterless public file scope macros that are (only) expanded inside literal strings - when they have the form " .... $(name) .... ".

For Example:


@ $h = "Hello"
@ $w = "$(h) world"
@assert("$(w)" == "Hello world")

Any white space can appear between the tokens of a @$ macro definition. For example:


@
          $
 h
       =
  "Hello"

is equivalent to


@$h = "Hello"

The value of a macro can either be a literal double quoted string or else an expression in parentheses that evaluates to a double quoted string. E.g.


@$h = ((2 > 1) ? "Hell" + "o" : "")

Note that within xcpp, xcpj, xcws files the leading '@' is usually optional because these languages natively support $variable macros. However when there is no leading @ they are invisible to the preprocessor. So for example the following won't work in an xcpp file


$X = "1"       //  <------- needs @ to be seen by the preprocessor
@if ("$(X)" == "1")
{
    etc
}