Skip to content

About

extract constants from C-like files and emit them in Python

Resources

Stars

0 stars

Watchers

9 watching

Forks

Latest commit

 

History

43 Commits

Folders and files

Repository files navigation

constantsgen

Generate code in various languages containing constants defined in the specified C-like files. It supports #define constants and named enums.

Requires Python 3.9 or later.

constants.txt contains a description and example of the input format. It does not parse the files, so things that would contain syntax errors in C, like XDR files, do not cause problems.

Supported output languages:

  • Python
  • PHP
  • LaTeX

Installation:

pip install .

This provides a generate_constants command. To run without installing, use python -m constantsgen from this source tree.

Example usage:

python -m constantsgen constants.txt constants.py
python -m constantsgen -l php constants.txt constants.php

About

extract constants from C-like files and emit them in Python

Resources

Stars

0 stars

Watchers

9 watching

Forks

Releases

Packages

Contributors

Languages