Python api (IDL) Transpiler Source-to-source compiler C/C++ to YAML Description based on clang
Project description
PDIC 
PDIC: (IDL) Transpiler Source-to-source compiler C/C++ to YAML Portable Data Interface Description
Project related to PDI
From C/C++ to Yaml Description
| Simple binary | Python library |
|---|---|
| static binary | Python 3 |
./pdic file.c |
import pdic; result:str = pdic.files_to_pdi() |
Instalation
Binary
cmake -S . -DBINARY:BOOL=ON -B build && cmake --build build -- -j `nproc`
Google Test
cmake -S . -DTEST:BOOL=ON -B build && cmake --build build -- -j `nproc`
cd build && ctest
Python
python setup.py build -G "Unix Makefiles"
python3 setup.py bdist_wheel -G "Unix Makefiles" -j `nproc`
python setup.py build_ext -G "Unix Makefiles" --inplace -j `nproc`
pytest
Usage
#pragma pdi on
typedef struct Var8
{
#pragma pdi type : int64
int my_int;
char char_tab[20];
char my_char;
} var;
#pragma pdi size:[42]
int **array_of_pointer_of_array[21];
var my_var;
#pragma pdi off
Will be see and describe as follow
structs:
Var8:
type: record
name: Var8
alias: [var]
fieldsize: 3
buffersize: 28
packed: false
members:
char_tab: { type: array, subtype: char, size: 20 }
my_char:
offset: 24
type: char
my_int:
type: int64
data:
array_of_pointer_of_array: { type: array, subtype: { type: pointer, subtype: { type: array, subtype: int, size: 42 } }, size: 21 }
my_var:
type: record
name: Var8
alias: [var]
fieldsize: 3
buffersize: 28
packed: false
members:
char_tab: { type: array, subtype: char, size: 20 }
my_char:
offset: 24
type: char
my_int:
type: int64
Python Usage
import os
import pathlib
import yaml
import pdic
here = pathlib.Path(__file__).parent.resolve()
# pip show -f pdic
if __name__ == "__main__":
pdi_yml_description: str = pdic.files_to_pdi([os.path.join(here, "level_1.c"),
os.path.join(here, "level_2.c")])
print(pdi_yml_description)
print(yaml.dump(yaml.load(pdi_yml_description)))
Index
- Abstract
- Usage
- Developpement
- Code
- Documentation
- Test
- Deploy
- Links
- Autre Documentation
- Biblio
- Code example
- Extra
- Clang LLVM
- Mind Map
- Graph
- UML
- Contact / Credits
Credits
Barre Kevin neudinger (Software Scientist)
CEA pdi team
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 Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pdic-0.0.2-cp39-cp39-manylinux2010_x86_64.whl.
File metadata
- Download URL: pdic-0.0.2-cp39-cp39-manylinux2010_x86_64.whl
- Upload date:
- Size: 8.9 MB
- Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b98d3d2e601a0dc3895208639baaa1df32a8047a95852ce61a6234c58bb74750
|
|
| MD5 |
0cf8a665dab4eebb8719e8059c4910ea
|
|
| BLAKE2b-256 |
b1200f8bceff92e0c928a779e7029e5ece4d4e127c7a280570534a5245305020
|
File details
Details for the file pdic-0.0.2-cp39-cp39-manylinux1_x86_64.whl.
File metadata
- Download URL: pdic-0.0.2-cp39-cp39-manylinux1_x86_64.whl
- Upload date:
- Size: 8.9 MB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7559c1ba4234ea3eec79c3efc049764621007248077d54e89ef44af422c46f4
|
|
| MD5 |
ed201c55349062eb92f4c6b74e242cf2
|
|
| BLAKE2b-256 |
bffdd1a16739ddfdba7469caba1b1baa5ab5880b3b3cae544212042995db7b25
|