The C Preprocessor

SymbolicC has a number of functions for working with the C preprocessor. These allow you to set up including header files, defining macros, as well as setting up conditional compilation.

Working with Header Files

First, you need to load the package.

Now you can include a header file with CInclude.

If it is a system header file, this is dealt with appropriately.

You can add a list of header files in one CInclude expression.

It is also possible to use CComment to add a comment to an include statement.

Defining Macros

You can define a macro using CDefine.

First, you need to load the package.

Now you can define a macro.

You can combine the definition with other SymbolicC functions.

You can also add a comment by adding a CComment expression.

Conditional Compilation

There are a range of functions to create C preprocessor conditional compilation output.

First, you need to load the package.

Now you can create a conditional compilation output.

You can also add an entire command.

CPreprocessorIfdef can create an entire sequence.

The conditional compilation output commands are summarized in the following table.

CPreprocessorIf#if a == 1
CPreprocessorIfdef#ifdef DEBUG
CPreprocessorIfndef#ifndef DEBUG
CPreprocessorElse#else
CPreprocessorElif#elif b
CPreprocessorEndif#endif

C preprocessor conditional compilation output.