This repository has been archived on 2024-05-26. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Benedikt Peetz 0a60c894d2 feat!(src/macros): Store allocation location in all strings
This makes it possible to automatically free the string in the correct
way expected by both c and rust.
Rust strings can now just be freed by the rust allocator, whilst c
strings are forgotten, so that the c allocator may free them.

BREAKING CHANGE: All usage of explicit mentions `std::string::String`
                 in your `handle_cmd` function will need to be replaced
                 by `trixy::types::newtypes::String`. Otherwise these
                 types should provide the same methods.
2024-05-04 10:12:20 +02:00
docs fix(docs/generate_docs): Cd into the correct directory to make ebnf2pdf work 2024-03-27 10:21:50 +01:00
example/main feat!(src/macros): Store allocation location in all strings 2024-05-04 10:12:20 +02:00
scripts fix(scripts/renew_copyright_header): Set correct template line lenght 2024-03-26 21:12:40 +01:00
src feat!(src/macros): Store allocation location in all strings 2024-05-04 10:12:20 +02:00
tests tests(types): Update to represent a minimal change in the library 2024-03-27 23:03:45 +01:00
.envrc build(.envrc): Add `./target/debug` to PATH 2024-03-27 08:11:44 +01:00
.gitignore chore(treewide): Update license header 2024-03-26 20:11:23 +01:00
.licensure.yml chore(treewide): Update license header 2024-03-26 20:11:23 +01:00
COPYING build(treewide): Add relevant configuration for releases 2023-12-23 18:35:38 +01:00
COPYING.LESSER build(treewide): Add relevant configuration for releases 2023-12-23 18:35:38 +01:00
Cargo.toml chore(Cargo.toml): Add further required metadata 2024-05-03 20:02:17 +02:00
LICENSE.spdx build(treewide): Add relevant configuration for releases 2023-12-23 18:35:38 +01:00
README.md docs(README): Mention the binary 2024-03-27 23:04:14 +01:00
cog.toml chore(treewide): Update license header 2024-03-26 20:11:23 +01:00
flake.lock build(flake): Update 2024-03-26 19:58:17 +01:00
flake.nix chore(treewide): Update license header 2024-03-26 20:11:23 +01:00
update.sh style(treewide): Format 2024-03-27 22:36:19 +01:00

README.md

Trixy

A crate to generate a multi-language foreign function interface.

Features

  • Support for custom types, derived from a set of primitive types.
  • Support for callbacks, thought c function pointers.
  • Support for error handling, when checking a functions arguments (NULL pointer and such things).

Supported languages:

  • c

Dependencies

Trixy only needs:

  • clang-format to format the generated c header files.

The Trixy Language

The API to generate is specified in a Trixy file. The language of these files is an subset of rust and should thus be easy to learn and pick up.

A grammar file is provided here encoded in Extended Backus-Naur Form. The grammar file is rendered as railroad diagrams in PDF here, run ./docs/generate_docs to regenerate the PDF file.

Testing

Trixy contains integration tests in the ./tests directory. These are maintained with the ./scripts/tests.sh script. Take a look at it's --help output for further usage information.

This crate also contains a binary, which can help with manual testing and inspecting of the generated AST. The cargo run --features 'build-binary' -- --help output should provide all required information.

Tests are (as of now) only positive, i.e. they can only test successful situations. Failing test will probably be supported in the future.

Contributing

We have a nix flake, which provides the required dependencies to work with Trixy and the associated scripts in the ./scripts directory.

Please also make sure to run the ./scripts/renew_copyright_header.sh after you added a new file, to ensure that every file contains a license header.