Metadata-Version: 2.1
Name: cheader2json
Version: 0.0.0rc1
Summary: Parse C header file and output JSON ast + types
Author-email: Ryan Mast <mast9@llnl.gov>, Andy Fisher <andrew.fisher@pnnl.gov>
Maintainer-email: Ryan Mast <mast9@llnl.gov>
License: BSD License
Project-URL: Homepage, https://github.com/GMLC-TDC/cheader2json
Project-URL: Issue Tracker, https://github.com/GMLC-TDC/cheader2json/issues
Project-URL: Source Code, https://github.com/GMLC-TDC/cheader2json
Keywords: libclang,clang,c,header,parser,json,conversion
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Console
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Topic :: Software Development
Classifier: Topic :: System
Classifier: Topic :: Utilities
Classifier: License :: OSI Approved :: BSD License
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: libclang ==16.0.6
Requires-Dist: click
Provides-Extra: dev
Requires-Dist: build ; extra == 'dev'
Requires-Dist: pre-commit ; extra == 'dev'
Provides-Extra: docs
Requires-Dist: sphinx ; extra == 'docs'
Requires-Dist: myst-parser ; extra == 'docs'
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'

# cheader2json

Take one or more c header files as input, and do a JSON dump of a portion of the libclang AST for easier processing by other
tools. This code was originally from the libclang based Python/Matlab binding generator for HELICS, but has been split out
to make it more reusable. Functionality is also provided to do a diff of two JSON files, that can be used to get a quick
overview of what has changed between releases.

## Installation

```shell
pip install cheader2json
```

Recommended: Install in a Python virtual environment.

## Usage

Convert a c header file to a JSON file with a subset of the AST (excluding function bodies) and a JSON file with type information:

```shell
cheader2json convert <HEADER_FILE>
```

Dump a pair of JSON files named `example.ast.json` and `example.types.json` for multiple header files, and ignore `DO_SOMETHING` macro
(the ignore macro option can be given more than once, or IGNORED_MACROS environment variable can be set to a space separated list of
macro names to ignore):

```shell
cheader2json convert <HEADER_FILE1> <HEADER_FILE2> --prefix=example --ignore-macro=DO_SOMETHING
```

Do a diff of two dumped AST JSON files:

```shell
cheader2json diff <JSON_AST_FILE_OLD> <JSON_AST_FILE_NEW>
```
