# 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>
```
Raw data
{
"_id": null,
"home_page": "",
"name": "cheader2json",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Ryan Mast <mast9@llnl.gov>",
"keywords": "libclang,clang,c,header,parser,json,conversion",
"author": "",
"author_email": "Ryan Mast <mast9@llnl.gov>, Andy Fisher <andrew.fisher@pnnl.gov>",
"download_url": "https://files.pythonhosted.org/packages/43/69/89e58fb47f9c5927ed3afa28de0699d134252ab88214b4dafcefee356481/cheader2json-0.0.0rc1.tar.gz",
"platform": null,
"description": "# cheader2json\n\nTake 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\ntools. This code was originally from the libclang based Python/Matlab binding generator for HELICS, but has been split out\nto make it more reusable. Functionality is also provided to do a diff of two JSON files, that can be used to get a quick\noverview of what has changed between releases.\n\n## Installation\n\n```shell\npip install cheader2json\n```\n\nRecommended: Install in a Python virtual environment.\n\n## Usage\n\nConvert a c header file to a JSON file with a subset of the AST (excluding function bodies) and a JSON file with type information:\n\n```shell\ncheader2json convert <HEADER_FILE>\n```\n\nDump a pair of JSON files named `example.ast.json` and `example.types.json` for multiple header files, and ignore `DO_SOMETHING` macro\n(the ignore macro option can be given more than once, or IGNORED_MACROS environment variable can be set to a space separated list of\nmacro names to ignore):\n\n```shell\ncheader2json convert <HEADER_FILE1> <HEADER_FILE2> --prefix=example --ignore-macro=DO_SOMETHING\n```\n\nDo a diff of two dumped AST JSON files:\n\n```shell\ncheader2json diff <JSON_AST_FILE_OLD> <JSON_AST_FILE_NEW>\n```\n",
"bugtrack_url": null,
"license": "BSD License",
"summary": "Parse C header file and output JSON ast + types",
"version": "0.0.0rc1",
"project_urls": {
"Homepage": "https://github.com/GMLC-TDC/cheader2json",
"Issue Tracker": "https://github.com/GMLC-TDC/cheader2json/issues",
"Source Code": "https://github.com/GMLC-TDC/cheader2json"
},
"split_keywords": [
"libclang",
"clang",
"c",
"header",
"parser",
"json",
"conversion"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e90709fedc096ef8882e4f8d53c081ccb32f1336ef32158ff979b17bb4454943",
"md5": "035d052f12dc18131df1ff6d2bf2ced6",
"sha256": "6637781bb9a0242ac85dcd514a771bb5eab8bab4f64a454d9cea4815609c4ee3"
},
"downloads": -1,
"filename": "cheader2json-0.0.0rc1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "035d052f12dc18131df1ff6d2bf2ced6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 8781,
"upload_time": "2024-02-18T03:10:33",
"upload_time_iso_8601": "2024-02-18T03:10:33.448473Z",
"url": "https://files.pythonhosted.org/packages/e9/07/09fedc096ef8882e4f8d53c081ccb32f1336ef32158ff979b17bb4454943/cheader2json-0.0.0rc1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "436989e58fb47f9c5927ed3afa28de0699d134252ab88214b4dafcefee356481",
"md5": "0941de8db9e1fef302e5dbd4b40ab146",
"sha256": "ecc450286b965fbbee666212ad2eaca48cbd0917100da5c5abc936f9e93de41c"
},
"downloads": -1,
"filename": "cheader2json-0.0.0rc1.tar.gz",
"has_sig": false,
"md5_digest": "0941de8db9e1fef302e5dbd4b40ab146",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 12480,
"upload_time": "2024-02-18T03:10:34",
"upload_time_iso_8601": "2024-02-18T03:10:34.779466Z",
"url": "https://files.pythonhosted.org/packages/43/69/89e58fb47f9c5927ed3afa28de0699d134252ab88214b4dafcefee356481/cheader2json-0.0.0rc1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-18 03:10:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "GMLC-TDC",
"github_project": "cheader2json",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cheader2json"
}