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() |
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
#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)))
- 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)
Julien Bigo jbigot CEA PDI TEAM