Code Monkey home page Code Monkey logo

yace's Introduction

yace

Welcome to yace

PyPI Build Status https://coveralls.io/repos/github/safl/yace/badge.svg?branch=main pre-commit

yace is a foreign-function-interface (FFI) compiler designed to ease the development and maintenance of C APIs, their libraries and the FFI-bindings/wrappers using them.

yace is a new project, with a bunch of things it want to get done, why? Because there are some projects that need a better way to handle C headers and libraries bindings. If you want to help out, then don't be shy, there are plenty of things to do.

yace's People

Contributors

safl avatar

Stargazers

Jesper Wendel Devantier avatar

Watchers

 avatar  avatar

Forkers

mbrsamsung

yace's Issues

testing: negative tests

Simply using yace on the models/*.yaml provide a 90%+ code coverage.
What remains is instrumented by tests in pytest.
These tests would benefit additions hitting error-cases that are not triggered by "natural" usage.

Tool pre-flight check

yace depends on a compiler/interpreter and auxilary tooling for the targets it is emitting code for.
Whether or not these are available requires that the tool is available for execution. When it is not, then a not so friendly Python exception is dumped on stdout/stderr.

The above should be fixed by adding a preflight check to the target base-class.

yidl/transformation: unpack nested structs / unions

To achieve simple code-emitters, then the IDL needs to be close in representation to the generated code. Otherwise, then the target needs to take differences into account. One example are nested structures / unions in C, especially with anonymous structs/unions.

Equivalent definitions are not support by e.g. Rust. Consequently, then the yet needs to this into account when emitting code. That is, hoist the nested structs/unions out and declare them top-level. This quickly becomes tedious work to do for each emitter-target. Thus, a nicer approach would be to transform the IDL by expanding the nested structs / unions.

A tool to produce yidl from C headers

As a lot of other FFI code-generators work using the C header as input, it would be convenient for yace to provide something similar. Considering:

  • Add a tool yidlr which takes a C header-file as input and produces a yace yidl-file as output
  • As the yace yidl-representation only encapsulate a subset of what is available with C, then it should be "best-effort" tool

docs: fix ansi escape-codes in literalinclude

They look messy:

make[1]: Entering directory '/home/runner/work/yace/yace'
Usage:
 
  make help          ; Brief target description
  make help-verbose  ; Verbose target descriptions
  make [target]      ; Invoke the given 'target'
 
Targets:
 
�[1mall           �[0m ; Do all: clean uninstall build install
�[1mall-system    �[0m ; Do all: clean uninstall build install-system
�[1mbuild         �[0m ; Build the package (source distribution package)
�[1mbump          �[0m ; run code format (style, code-conventions and language-integrity) on all files
�[1mclean         �[0m ; clean build artifacts (build, dist, output)
�[1mcoverage      �[0m ; Run emitter with coverage
�[1mdefault       �[0m ; invoke: 'make uninstall', 'make install'
�[1mdocs          �[0m ; generate documentation and open the HTML
�[1mdocs-build    �[0m ; generate documentation
�[1mdocs-view     �[0m ; open the HTML
�[1memit          �[0m ; Emit code for all examples
�[1memit-example  �[0m ; Emit code using the example interface model
�[1memit-nvme     �[0m ; Emit code using the NVMe interface model
�[1memit-xnvme    �[0m ; Emit code using the xNVMe interface model
�[1mformat        �[0m ; run code format (style, code-conventions and language-integrity) on staged changes
�[1mformat-all    �[0m ; run code format (style, code-conventions and language-integrity) on all files
�[1mhelp          �[0m ; Print the description of every target
�[1minstall       �[0m ; install for current user
�[1minstall-system�[0m ; install system-wide
�[1mrelease-build �[0m ; Produce Python distribution (sdist, bdist_wheel)
�[1mrelease-upload�[0m ; Produce + Upload Python distribution (sdist, bdist_wheel)
�[1muninstall     �[0m ; uninstall - Prefix with 'sudo' when uninstalling a system-wide installation
�[1mview          �[0m ; Inspect generated code
make[1]: Leaving directory '/home/runner/work/yace/yace'

testing: add type-annotations and mypy

Currently not all entities have proper is_valid_{attribute} validators. Until that happens, then a bit of type annotation and static checking goes a long way.

yidl/linter

  • Symbol validation (snake_case, identifier characters etc.)
  • Bitfield validation (ensure members add up to total amount of bits)
  • All entity-attributes must have a is_valid_{field}() validation method
  • Wholesome checks
    • No symbol collisions (verifies no duplicates in top-level-scope
    • Possibly re-done post transformations

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.