Qore supports conditional parsing with parse defines similar to the C/\+C++ preprocessor. In the current version of Qore, the implementation is very simple; only the following parse directives are supported\+: \mbox{\hyperlink{parse_directives_define}{\%define}}, \mbox{\hyperlink{parse_directives_else}{\%else}}, \mbox{\hyperlink{parse_directives_endif}{\%endif}}, \mbox{\hyperlink{parse_directives_ifdef}{\%ifdef}}, and \mbox{\hyperlink{parse_directives_ifndef}{\%ifndef}}.

Basically, the above allow for the existence (or lack thereof) of a parse define to affect which code is parsed into the program at parse time.

Parse defines are defined on the command-\/line (or through the C++ API when executed in embedded code), as well as created automatically based on sytem options (see \mbox{\hyperlink{namespace_qore_1_1_option}{Qore\+::\+Option}} for a list of option constants that are also defined as parse defines); all library options (if the option is \mbox{\hyperlink{basic_data_types_True}{True}}, then it is defined as \mbox{\hyperlink{basic_data_types_True}{True}}, if the option is \mbox{\hyperlink{basic_data_types_False}{False}}, then it is not defined at all).

Note that {\ttfamily \char`\"{}\+Unix\char`\"{}} is defined on all Unix platforms (also on Cygwin), while {\ttfamily \char`\"{}\+Windows\char`\"{}} is defined on native Windows ports (but not on Cygwin, as this is treated as Unix when compiling, as all Unix features are available).

Additionally, the following options are defined in every program (however they are not yet useful when parsing as the value of parse options cannot be used yet at parse time; only the existence or lack thereof can affect parsing in this version of Qore when parsing at least).

{\bfseries{Qore Parse Defines}}  \tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|}
\hline
{\bfseries{Define}} &{\bfseries{Value}}  \\\cline{1-2}
{\ttfamily Qore\+Version\+String}  &Version string for the Qore library  \\\cline{1-2}
{\ttfamily Qore\+Version\+Major}  &Major version for the Qore library  \\\cline{1-2}
{\ttfamily Qore\+Version\+Minor}  &Minor version for the Qore library  \\\cline{1-2}
{\ttfamily Qore\+Version\+Sub}  &Sub version for the Qore library  \\\cline{1-2}
{\ttfamily Qore\+Version\+Build}  &Build version for the Qore library  \\\cline{1-2}
{\ttfamily Qore\+Version\+Bits}  &32 or 64 depending on the library target  \\\cline{1-2}
{\ttfamily Qore\+Platform\+CPU}  &The CPU targeted by the library  \\\cline{1-2}
{\ttfamily Qore\+Platform\+OS}  &The OS targeted by the library  \\\cline{1-2}
\end{longtabu}


Additionally, only if the Qore library was compiled with debugging support, the following parse define is present (otherwise it is not defined)\+:

{\bfseries{Qore Optional Parse Defines}}  \tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|}
\hline
{\bfseries{Define}} &{\bfseries{Value}}  \\\cline{1-2}
{\ttfamily Qore\+Debug}  &\mbox{\hyperlink{basic_data_types_True}{True}}  \\\cline{1-2}
\end{longtabu}


\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{namespace_qore_1_1_option}{Qore\+::\+Option}} for a list of option constants that are also defined as parse defines
\end{DoxySeeAlso}
Here is an example of using parse defines in a program\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\%ifndef HAVE\_TERMIOS}
\DoxyCodeLine{\mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}This program requires UNIX TermIOS features to be present; it does not run on platforms without this feature (current platform: \%s); exiting...\(\backslash\)n"{}}, Qore::PlatformOS);}
\DoxyCodeLine{exit(1);}
\DoxyCodeLine{\%endif}

\end{DoxyCode}


Furthermore, parse defines can be manipulated in embedded code using the following functions\+:
\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_program_aaca64251d8972c9dab39c3fa6782f0af}{Qore\+::\+Program\+::define()}}
\item \mbox{\hyperlink{class_qore_1_1_program_a82ba5819f483199901331e27908c9749}{Qore\+::\+Program\+::get\+Define()}}
\item \mbox{\hyperlink{class_qore_1_1_program_afcfa159016f0f76d7a1abdf8e3895b6b}{Qore\+::\+Program\+::is\+Defined()}}
\item \mbox{\hyperlink{class_qore_1_1_program_a275563ed4d95be6a9900d2966025802c}{Qore\+::\+Program\+::undefine()}} 
\end{DoxyItemize}