Skip to main content

Python api (IDL) Transpiler Source-to-source compiler C/C++ to YAML Description based on clang

Project description

PDIC Open Source Love svg1

PDIC: (IDL) Transpiler Source-to-source compiler C/C++ to YAML Portable Data Interface Description

Project related to PDI Linux

GitHub license Build Github Status

PyPI version PyPI implementation

Doc made-with-Markdown

GitHub release Docker

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

  1. Abstract
  2. Usage
    1. Binary
    2. Python
  3. Developpement
    • Code
    • Documentation
    • Test
    • Deploy
  4. Links
  5. Extra
    • Clang LLVM
    • Mind Map
    • Graph
    • UML
  6. Contact / Credits

Credits

Barre Kevin neudinger (Software Scientist)

CEA pdi team

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 Distributions

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

pdic-0.0.2-cp39-cp39-manylinux2010_x86_64.whl (8.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64

pdic-0.0.2-cp39-cp39-manylinux1_x86_64.whl (8.9 MB view details)

Uploaded CPython 3.9

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

Hashes for pdic-0.0.2-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 b98d3d2e601a0dc3895208639baaa1df32a8047a95852ce61a6234c58bb74750
MD5 0cf8a665dab4eebb8719e8059c4910ea
BLAKE2b-256 b1200f8bceff92e0c928a779e7029e5ece4d4e127c7a280570534a5245305020

See more details on using hashes here.

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

Hashes for pdic-0.0.2-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c7559c1ba4234ea3eec79c3efc049764621007248077d54e89ef44af422c46f4
MD5 ed201c55349062eb92f4c6b74e242cf2
BLAKE2b-256 bffdd1a16739ddfdba7469caba1b1baa5ab5880b3b3cae544212042995db7b25

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