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 eb7a901d09
refactor(treewide): Rework file structure in `src/macros`
This might be a big diff, but I _hope_ that it does not change much
functionally (hopefully it changes nothing generation specific).

What has changed?
-----------------
- I had to merge the three crates into one, to allow `macros` to impl
  functions on Types defined in `parser`.
- As mentioned in the point above, the conversion function are now
  inherent to the type they convert (i. e. `r#type.to_rust()` instead of
  `type_to_rust(r#type)`).
- The conversion function have been sorted, by what they convert to:
   - `to_rust()` converts a type to be used in rust *host* code.
   - `to_c()` converts a type to be used in c *host* code.
   - `to_auxiliary_c()` converts a type to be used in c *auxiliary*
     code.
- The top-most `generate` method of `TrixyConfig` now returns a
  `FileTree` instead of writing the files directly. The `FileTree` can
  still be materialize with the `materialize` method. But this change
  facilitates moving non-generation focused code out of the `generate`
  method.

What is the difference between _host_ and _auxiliary_ code?
-----------------------------------------------------------
Auxiliary code is always written in the language it is generated for. So
auxiliary code for c would be written in c (or at least in a subset of c),
as it represents c header files.
Host code is always written in rust. This is the code that is
responsible for implementing the actual ffi stuff. In our case these are
the `extern "C"` functions and the types, defined in trixy.
The rust host code is generating the native rust representations of
these types.
2024-03-26 17:35:21 +01:00
docs refactor(treewide): Rework file structure in `src/macros` 2024-03-26 17:35:21 +01:00
example/main feat(example/valgrind): Add a script to test the c example with valgrind 2024-03-26 17:35:16 +01:00
src refactor(treewide): Rework file structure in `src/macros` 2024-03-26 17:35:21 +01:00
.envrc chore(treewide): Add the new license header 2024-02-19 16:13:55 +01:00
.gitignore feat(treewide): Provide a c api 2023-12-25 22:23:52 +01:00
.licensure.yml chore(.licensure.yml): Add license spdx identifier 2024-03-24 17:46:27 +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 refactor(treewide): Rework file structure in `src/macros` 2024-03-26 17:35:21 +01:00
LICENSE.spdx build(treewide): Add relevant configuration for releases 2023-12-23 18:35:38 +01:00
cog.toml build(cog.toml): Use `nix fmt` (treefmt) instead of only `cargo fmt` 2024-03-24 17:51:07 +01:00
flake.lock build(flake): Update 2024-03-26 17:35:18 +01:00
flake.nix feat(example/valgrind): Add a script to test the c example with valgrind 2024-03-26 17:35:16 +01:00
update.sh build(update.sh): Add a shebang 2024-02-19 20:52:10 +01:00