[−][src]Crate cpprs
Example
Build
You probably want the following in your build.rs
:
use cpprs::{walk_src_preprocess, CCompiler}; fn main() { walk_src_preprocess(CCompiler::GCC, vec![]) }
This will pre-process any .cpprs
source files in src/
using
GCC.
Code
Suppose you have the following in src/lib.cpprs
:
#include <minilzo.h>
pub enum LzoError {
LzoOk = LZO_E_OK,
LzoError = LZO_E_ERROR,
LzoOutOfMemory = LZO_E_OUT_OF_MEMORY,
LzoNotCompressible = LZO_E_NOT_COMPRESSIBLE,
LzoInputOverrun = LZO_E_INPUT_OVERRUN,
LzoOutputOverrun = LZO_E_OUTPUT_OVERRUN,
LzoLookbehindOverrun = LZO_E_LOOKBEHIND_OVERRUN,
LzoEofNotFound = LZO_E_EOF_NOT_FOUND,
LzoInputNotConsumed = LZO_E_INPUT_NOT_CONSUMED,
LzoNotYetImplemented = LZO_E_NOT_YET_IMPLEMENTED,
LzoInvalidArgument = LZO_E_INVALID_ARGUMENT,
LzoInvalidAlignment = LZO_E_INVALID_ALIGNMENT,
LzoOutputNotConsumed = LZO_E_OUTPUT_NOT_CONSUMED,
LzoInternalError = LZO_E_INTERNAL_ERROR,
}
Then this will be placed in src/lib.rs
:
pub enum LzoError { LzoOk = 0, LzoError = (-1), LzoOutOfMemory = (-2), LzoNotCompressible = (-3), LzoInputOverrun = (-4), LzoOutputOverrun = (-5), LzoLookbehindOverrun = (-6), LzoEofNotFound = (-7), LzoInputNotConsumed = (-8), LzoNotYetImplemented = (-9), LzoInvalidArgument = (-10), LzoInvalidAlignment = (-11), LzoOutputNotConsumed = (-12), LzoInternalError = (-99), }
i.e. the macros will be filled in.
Enums
CCompiler |
Functions
pp_cc | Preprocess using one of the known CCompilers |
pp_cpphs | Preprocess using cpphs. |
walk_preprocess | Preprocess all |
walk_preprocess_general | Preprocess all |
walk_src_preprocess | Preprocess all |