# cpp2py
A tool to convert c/c++ code to python code
# how to install:
pip install cpp2py
# how to use in python:
import cpp2py
cpp2py.c2py(input_c_file_path, output_py_file_name)
cpp2py.py2c(input_py_file_path, output_c_file_name)
```
from cpp2py import cpp2py
cpp2py.c2py('./c1.c', 'c1.py')
```
c1.c:
```
int main(int argc, char **argv)
{
int a=1;
int b=2;
int c;
c=a+b;
return 0;
}
```
generated:
c1.py
```
def main(argc, argv):
a = 1
b = 2
c = a+b
return 0
```
# how to use in cmd(TBD):
python -m cpp2py -i input_c_file_path -o output_py_file_path -f convert_format
eg: python -m cpp2py -i input_file.c -o output.py -f c2py
convert_format: c2py py2c cpp2py py2cpp
# current stage
```
c2py C
py2c X
cpp2py X
py2cpp X
x--not finished
y--finished
C--partly working
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Jiangshan00001/cpp2py",
"name": "cpp2py",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "cpp,c,cpp2py,cpp2python",
"author": "jiangshan00001",
"author_email": "710806594@qq.com",
"download_url": "",
"platform": null,
"description": "# cpp2py\nA tool to convert c/c++ code to python code\n\n\n# how to install:\npip install cpp2py\n\n\n# how to use in python:\n\nimport cpp2py\ncpp2py.c2py(input_c_file_path, output_py_file_name)\ncpp2py.py2c(input_py_file_path, output_c_file_name)\n\n\n```\nfrom cpp2py import cpp2py\ncpp2py.c2py('./c1.c', 'c1.py')\n\n```\n\nc1.c:\n\n```\nint main(int argc, char **argv)\n{\nint a=1;\nint b=2;\nint c;\nc=a+b;\nreturn 0;\n}\n```\n\ngenerated:\nc1.py\n\n```\ndef main(argc, argv):\n\ta = 1\n\tb = 2\n\tc = a+b\n\treturn 0\n\n\n```\n\n\n\n\n# how to use in cmd(TBD):\n\npython -m cpp2py -i input_c_file_path -o output_py_file_path -f convert_format\neg: python -m cpp2py -i input_file.c -o output.py -f c2py\n\nconvert_format: c2py py2c cpp2py py2cpp\n\n\n\n# current stage\n\n```\nc2py C\npy2c X\ncpp2py X\npy2cpp X\n\nx--not finished\ny--finished\nC--partly working\n\n```\n\n\n\n\n\n\n\n\n\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "convert c/cpp code to python.",
"version": "0.0.2",
"split_keywords": [
"cpp",
"c",
"cpp2py",
"cpp2python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1af7be2391f34bc8acac7d4e4335329990b68e2022cc9cffe2b39cfeaf094679",
"md5": "5736cd44981bd3f334c229d420f3abe5",
"sha256": "0920c574801a1f82e5a874c75d46eaa1ba1c2539f390c3108585ef8c1d882472"
},
"downloads": -1,
"filename": "cpp2py-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5736cd44981bd3f334c229d420f3abe5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 19210,
"upload_time": "2023-04-19T14:16:25",
"upload_time_iso_8601": "2023-04-19T14:16:25.280692Z",
"url": "https://files.pythonhosted.org/packages/1a/f7/be2391f34bc8acac7d4e4335329990b68e2022cc9cffe2b39cfeaf094679/cpp2py-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-19 14:16:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Jiangshan00001",
"github_project": "cpp2py",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "cpp2py"
}