1 Star 0 Fork 0

小东西/cpp2python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

cpp2python

The script helps to convert C/C++ sources to C/C++ -like Python sources.

It does some simple edit operations like removing semicolons and type declarations. After it you must edit code manually, but you'll probably spend less time doing it.

Example:

if (a && b)               -->    if a and b:
{                         -->        object.method()
    object->method();     -->
}                         -->

The utility will make mistakes and will not generate ready for use code, therefore it won't be useful for you unless you know both C/C++ and Python.

For better result, it is recommended to format your code to ANSI style before performing conversion.

astyle --style=ansi your.cpp source.cpp files.cpp

Usage

cpp2python.py DIR                     Find C/C++ files in the directory
                                      by suffix and process.
cpp2python.py FILE                    Process the file
cpp2python.py -v|--version|-h|--help  Display the help message

After the processing new file is created. File name is {old file name with suffix}.py. i.e. main.cpp.py

Installation

(Optional, the script can be used from the source tree)

python3 setup.py install

Author

Andrei Kopats hlamer@tut.by

setup.py and improvements by Stuart Axon

License

GPL

空文件

简介

取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/AbstractFactory/cpp2python.git
git@gitee.com:AbstractFactory/cpp2python.git
AbstractFactory
cpp2python
cpp2python
master

搜索帮助