{ "info": { "author": "Dustin Spicuzza", "author_email": "dustin@virtualroadside.com", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "header2whatever (h2w)\n=====================\n\nGenerate arbitrary files from C/C++ header files using CppHeaderParser to read\nthe input files and Jinja2 templates to generate the outputs.\n\nThis grew out of a desire to generate pybind11 wrapping code from C++ header\nfiles. pybind11gen was created, but then I wanted to generate more things...\n\nThere are still rough edges, and the documentation is mostly nonexistent, but\npull requests with fixes/improvements are very welcome!\n\nInstall\n-------\n\n::\n\n pip install header2whatever\n\nUsage\n=====\n\nFirst, you need to create a jinja2 template that represents whatever you want\nto generate from the header file. For example, maybe you want to describe the\nfunctions in yaml::\n\n ---\n {% for header in headers %}\n {% for fn in header.functions %}\n {{ fn.name }}:\n returns: {{ fn.returns }}\n params:\n {% for param in fn.parameters %}\n - { name: {{ param.name }}, type: \"{{ param.type }}\" }\n {% endfor %}\n\n {% endfor %}\n {% endfor %}\n\nAnd let's say you have the following header file ``foo.h``::\n\n void some_fn(int i);\n int returns_int(int p1, char* p2);\n\nYou can execute the following::\n\n h2w foo.h -o foo.yml\n\nAnd you'll get the following output::\n\n ---\n returns_int:\n returns: int\n params:\n - { name: p1, type: \"int\" }\n - { name: p2, type: \"char *\" }\n\n some_fn:\n returns: void\n params:\n - { name: i, type: \"int\" }\n\nAs you can see, while this is a silly example, this approach is very flexible\nand fairly powerful.\n\nCurrently, the data structure passed to the template isn't documented -- but\nit's a filtered version of whatever CppHeaderParser outputs when it parses a\nheader.\n\nSee the examples folder for more examples.\n\nBatch mode\n----------\n\nIf you need to process multiple files, or just want to record the parameters for\nautogenerating a file without writing a shell script, batch mode is useful. You\npass two parameters: a yaml file with the configuration, and an output directory\nto write the files to.\n\n\nUsing data from external sources\n--------------------------------\n\nSometimes you want to mix in data that CppHeaderParser can't give you. If you\npass the ``--yaml`` option, it will load the yaml into a dictionary and make it\navailable to the template as the 'data' variable.\n\nYou can also pass key=value parameters via the ``--param`` option, and\nthe specified keys will be available to the template.\n\nCustom processing\n-----------------\n\nWhen you need to do more complex logic that a jinja2 template just isn't\nappropriate for, you can specify a python file to load custom hooks from.\n\nSee [the default hooks](header2whatever/default_hooks.py) for documentation.\n\nLicense\n=======\n\nApache 2\n\nAuthor\n======\n\nDustin Spicuzza (dustin@virtualroadside.com)\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/virtualroadside/header2whatever", "keywords": "c++ cpp codegen generator header jinja2 template", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "header2whatever", "package_url": "https://pypi.org/project/header2whatever/", "platform": "", "project_url": "https://pypi.org/project/header2whatever/", "project_urls": { "Homepage": "https://github.com/virtualroadside/header2whatever" }, "release_url": "https://pypi.org/project/header2whatever/0.2.0/", "requires_dist": null, "requires_python": "", "summary": "Generate files from C/C++ headers using jinja2 templates", "version": "0.2.0" }, "last_serial": 4586118, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "bb61bf193e2fd2cc6151eee14378513b", "sha256": "7d5ade32217c08da9a4a85e19dc6d6292badd66ce4d6db2978d1eee80772272f" }, "downloads": -1, "filename": "header2whatever-0.1.tar.gz", "has_sig": false, "md5_digest": "bb61bf193e2fd2cc6151eee14378513b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7020, "upload_time": "2018-01-06T15:43:37", "url": "https://files.pythonhosted.org/packages/ee/10/d7bd450ee6eb0b9d09e447d2095013443dbb188d2cb0487d094840273129/header2whatever-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "fa5947df473a12179d7fc2bd0135ad6a", "sha256": "175203749ecc73a40ded3162c23e3d96522b8d29e723f7b4d78076dfd43db4d2" }, "downloads": -1, "filename": "header2whatever-0.1.1.tar.gz", "has_sig": false, "md5_digest": "fa5947df473a12179d7fc2bd0135ad6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7040, "upload_time": "2018-01-07T01:37:27", "url": "https://files.pythonhosted.org/packages/78/7f/2104ded143e0db188c756b99ceeb06ba776e7d59c3ded60a082746f3319f/header2whatever-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "2b5c4f00a0962d58f769cc95ab538853", "sha256": "6cc6e6057b895bef8a408be1d2f4a7f911a3054b0e64903c7732f43060318a8d" }, "downloads": -1, "filename": "header2whatever-0.1.2.tar.gz", "has_sig": false, "md5_digest": "2b5c4f00a0962d58f769cc95ab538853", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7102, "upload_time": "2018-01-09T22:40:53", "url": "https://files.pythonhosted.org/packages/ac/e7/16e00b1889fed2393c56e50794b1ece17670b3e2b9ec857b9f6481825e3b/header2whatever-0.1.2.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ff6a8f7567e81b6ad3568098c14d6c90", "sha256": "dc562c328406362bcb8054551b744ead81ff2a35ec7b601b30f26db648b0fa11" }, "downloads": -1, "filename": "header2whatever-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ff6a8f7567e81b6ad3568098c14d6c90", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6625, "upload_time": "2018-12-11T16:28:57", "url": "https://files.pythonhosted.org/packages/ad/61/9d5a892eb1f3ae7d2a8862c344908a82a6d74a363fa8cc2d6a340a2d4903/header2whatever-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ff6a8f7567e81b6ad3568098c14d6c90", "sha256": "dc562c328406362bcb8054551b744ead81ff2a35ec7b601b30f26db648b0fa11" }, "downloads": -1, "filename": "header2whatever-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ff6a8f7567e81b6ad3568098c14d6c90", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6625, "upload_time": "2018-12-11T16:28:57", "url": "https://files.pythonhosted.org/packages/ad/61/9d5a892eb1f3ae7d2a8862c344908a82a6d74a363fa8cc2d6a340a2d4903/header2whatever-0.2.0.tar.gz" } ] }