c-preprocessor

python library for metaprogramming like it's the 1970s
Log | Files | Refs | README

commit 213b2d66378db04df185003227a217b78265be12
parent 72ea4a6a86d7c1d473e3b3d516efd12106feff96
Author: quantumish <freifeld.david@gmail.com>
Date:   Sat, 25 Jul 2026 15:29:52 -0700

Clean up formatting of README for plaintext viewing

Diffstat:
MREADME.md | 25++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md @@ -1,9 +1,11 @@ # c-preprocessor -Ever felt like your Python code wasn't hacky enough? -Lamented the bygone `#ifdef`s and cursed macro trickery? This is the Python package for you! +Ever felt like your Python code wasn't hacky enough? Lamented the bygone +`#ifdef`s and cursed macro trickery? This is the Python package for you! + +Just by simply adding a single comment to the top of your file, you too can use +a crude approximation of the C preprocessor from Python. -Just by simply adding a single comment to the top of your file, you too can use a crude approximation of the C preprocessor from Python. ```py # coding: c-prepocessor @@ -36,17 +38,22 @@ whoo hah ``` -`c-preprocessor` has support for the `#define`, `#ifdef`, `#endif`, `#ifndef`, `#include`, `#undef`, and `#else` directives as of now. +`c-preprocessor` has support for the `#define`, `#ifdef`, `#endif`, `#ifndef`, +`#include`, `#undef`, and `#else` directives as of now. + Furthermore, the following special preprocessor macros are implemented: - `__COUNTER__`: results in a higher number each time it is expanded -- `__VERSION__`, `__PYTHON__`, `__PYTHON_MINOR__`, `__PYTHON_MICRO__`: Python version info +- `__VERSION__`, `__PYTHON__`, `__PYTHON_MINOR__`, `__PYTHON_MICRO__` - `__IMPLEMENTATION__`: the Python implementation - `__FILE_NAME__` -- `__BYTE_ORDER__`, `__ORDER_LITTLE_ENDIAN__`, `__ORDER_BIG_ENDIAN__`: endianness info +- `__BYTE_ORDER__`, `__ORDER_LITTLE_ENDIAN__`, `__ORDER_BIG_ENDIAN__` # install -There's not really a proper install process yet. You're gonna want to make a corresponding `.pth` file and install the package as normal. +There's not really a proper install process yet. You're gonna want to make a +corresponding `.pth` file and install the package as normal. # how? -Python supports arbitrary file encodings which are implemented via Python code. This uses that interface to effectively reparse your code at runtime before it starts being evaluated. -This is actually used by Dropbox to do inline HTML: see [here](https://github.com/dropbox/pyxl). +Python supports arbitrary file encodings which are implemented via Python +code. This uses that interface to effectively reparse your code at runtime +before it starts being evaluated. This is actually used by Dropbox to do inline +HTML: see [here](https://github.com/dropbox/pyxl).