Conditional Evaluation
-
#ifdef <var-ref> <CR> <then-recs> [ #else <CR> <else-recs> ] <CR> #endif#ifndef <var-ref> <CR> <then-recs> [ #else <CR> <else-recs> ] <CR> #endif#if <expr> <CR> <then-recs> [ #else <CR> <else-recs> ] <CR> #endifwhere:<expr>:=<var-ref> <op> <value><op>:===|!=|>|>=|<|<=<var-ref>:=%<var-name>%|%<env-var-name>%|<var-name><CR>:=one or more line-breaks
- NOTE: There must a tab character between the #ifdef/#ifndef/#if and the <var-ref> or <expr> clause.
-
Each type of statement first evaluates its value clause to get the
test value.
- For #ifdef statements the test value will be whether the <var-ref> variable is defined and has a non-zero value.
- For #ifndef statements the test value will be whether the <var-ref> variable is not defined or has a zero value.
- For #if statements the <expr> expression will be evaluated, and the test value will be whether that value is defined and has a non-zero value.
- If the test value is true, it continues evaluation with the dbrecs in the <then-recs> block up to the next #else or #endif, whichever comes first. Otherwise it skips over them.
- If the test value is is false, and there is a #else line, it continues evaluation with the dbrecs in the <else-recs> block up to the next #endif.
-
EXAMPLES:
-
#ifdef %_ROOT_%
set updates = %_ROOT_%
#endif
#ifndef %JD% # Use a jumpdrive?
>4+ /Server/Docs/CAD Files/School/Robotics/FIRST/2014/FRC 2014 Documentation
set __loc2 = %updates%
#else
>5+ /Server/Docs/CAD Files/School/Robotics/FIRST/2014/FRC 2014 Documentation
set __loc2 = %JD%
#ifndef %_AR_%
>4 /Server/Docs/CAD Files/School/Robotics/FIRST/2014
>5+ /Server/Docs/CAD Files/School/Robotics/FIRST/2014/LabVIEW Data
#else
>2 %_AR_%/FRC_2014
>3+ %_AR_%/FRC_2014/LabVIEW Data
#endif
#if %USE_OS_VER% == WINDOWS
"conf" "C:\wamp\bin\apache\Apache2.2.21\conf"
#else
"conf" "/etc/httpd/conf"
#endif
-