Skip to main content

simplepreprocessor expands limited set of C preprocessor macros

Project description



import simplecpreprocessor

There will be one function called preprocess. It can either be called with a file object or something that looks sufficiently like a file object. See unit tests to find out what's enough for a compatible wrapper. Line endings are by default normalized to unix but a parameter can be given to customize this behaviour.


Supported macros: ifdef, ifndef, define, undef, include, else, pragma (only "once")

If using for FFI, you may want to ignore some system headers eg for types


  • Multiline continuations supported but whitespace handling may not be 1:1 with real preprocessors. Trailing whitespace is removed if before comment, indentation from first line is removed
  • Semi-colon handling may not be identical to real preprocessors

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for simplecpreprocessor, version 2.2.0
Filename, size File type Python version Upload date Hashes
Filename, size simplecpreprocessor-2.2.0-py3-none-any.whl (12.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size simplecpreprocessor-2.2.0.tar.gz (10.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page