Skip to main content

convert c/cpp code to python.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cpp2py-0.0.2-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file cpp2py-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: cpp2py-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.9

File hashes

Hashes for cpp2py-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0920c574801a1f82e5a874c75d46eaa1ba1c2539f390c3108585ef8c1d882472
MD5 5736cd44981bd3f334c229d420f3abe5
BLAKE2b-256 1af7be2391f34bc8acac7d4e4335329990b68e2022cc9cffe2b39cfeaf094679

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page