A C code generator written in Python 3
Project description
cfile
A C code generator written in Python 3.
Usage
import cfile as C
hello = C.cfile('hello.c')
hello.code.append(C.sysinclude('stdio.h'))
hello.code.append(C.blank())
hello.code.append(C.function('main', 'int',).add_param(C.variable('argc', 'int')).add_param(C.variable('argv', 'char', pointer=2)))
body = C.block(innerIndent=3)
body.append(C.statement(C.fcall('printf').add_arg(r'"Hello World!\n"')))
body.append(C.statement('return 0'))
hello.code.append(body)
print(str(hello))
#include <stdio.h>
int main(int argc, char **argv)
{
printf("Hello World!\n");
return 0;
}
Requires
Python 3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cfile-0.2.0.tar.gz
(4.5 kB
view details)
Built Distribution
cfile-0.2.0-py3-none-any.whl
(5.2 kB
view details)
File details
Details for the file cfile-0.2.0.tar.gz
.
File metadata
- Download URL: cfile-0.2.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00839053069abe06843786dead63133c8a60216e164357f280e6913a61c17f1f |
|
MD5 | 794dd593df533c173cacc4c983df21e6 |
|
BLAKE2b-256 | 949925e6b30346aca57b52fe97f5be85c85b588317109791c3e0191816aec1cc |
File details
Details for the file cfile-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: cfile-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba8b4889206763b774cf732007b1b13f78cf96f9c6c7de6c6f408ed7bb526da6 |
|
MD5 | cc0feb81dabc467eae54aaf18f99a80b |
|
BLAKE2b-256 | f7e0e1b67e58ba1e6d728df871a574b56f22d3935adc6e929048cb575f01efea |