From 1bf94fa7a8133d61bebec4b21ea7324dc2915948 Mon Sep 17 00:00:00 2001 From: Jan Izydorczyk Date: Mon, 23 Jan 2023 13:22:29 +0100 Subject: [PATCH 1/2] Merge tables with the type support Replace Yes/No with emojis to increase readability --- pages/supported_types.md | 61 +++++++++------------------------------- 1 file changed, 14 insertions(+), 47 deletions(-) diff --git a/pages/supported_types.md b/pages/supported_types.md index 1cd5b23d..b79e6ea0 100644 --- a/pages/supported_types.md +++ b/pages/supported_types.md @@ -6,50 +6,17 @@ Below we present which types you can use at this moment. You can also refer to [#42](https://github.com/membraneframework/unifex/issues/42) to see state of work on remaining types. -## NIF -| type | as function parameter | as return type | -| --------- | :-------------------: | :-------------: | -| `atom` | yes | yes | -| `bool` | yes | yes | -| `unsigned`| yes | yes | -| `uint64` | yes | yes | -| `int` | yes | yes | -| `int64` | yes | yes | -| `float` | yes | yes | -| `list` | yes | yes | -| `payload` | yes | yes | -| `pid` | yes | yes | -| `string` | yes | yes | - -## CNode -| type | as function parameter | as return type | -| --------- | :-------------------: | :-------------: | -| `atom` | yes | yes | -| `bool` | yes | yes | -| `unsigned`| yes | yes | -| `uint64` | no | no | -| `int` | yes | yes | -| `int64` | no | no | -| `float` | yes | yes | -| `list` | yes | yes | -| `payload` | yes | yes | -| `pid` | yes | yes | -| `string` | yes | yes | - -## Types mapping -List of examples, how specific type in `*.spec.exs` will be translated onto native side - -Elixir type | Native type ---- | --- -`atom` | `char *` -`bool` | `int` -`float` | `double` -`int` | `int` -`int64` | `int64_t` -`payload` | `UnifexPayload` -`pid` | `UnifexPid` -`state` | `UnifexState *` -`string` | `char *` -`uint64` | `uint64_t` -`unsigned` | `unsigned int` -`[int]` | `int *`, `unsigned int` \ No newline at end of file +## Supported types +| Elixir type | Native type | NIF as a function parameter | NIF as a return type | CNode as a function parameter | CNode as a return type | +| --------- | :-----------------------------: | :-------------------------: | :------------------: | :---------------------------: | :---------------------: | +| `atom` | `char *` | ✅ | ✅ | ✅ | ✅ | +| `bool` | `int` | ✅ | ✅ | ✅ | ✅ | +| `unsigned` | `unsigned int` | ✅ | ✅ | ✅ | ✅ | +| `uint64` | `uint64_t` | ✅ | ✅ | ❌ | ❌ | +| `int` | `int` | ✅ | ✅ | ✅ | ✅ | +| `int64` | `int64_t` | ✅ | ✅ | ❌ | ❌ | +| `float` | `double` | ✅ | ✅ | ✅ | ✅ | +| `payload` | `UnifexPayload` | ✅ | ✅ | ✅ | ✅ | +| `pid` | `UnifexPid` | ✅ | ✅ | ✅ | ✅ | +| `string` | `char *` | ✅ | ✅ | ✅ | ✅ | +| `[type]` | `native_type *`, `unsigned int` | ✅ | ✅ | ✅ | ✅ | From 5c1da89a4c558c78b994d3a262c52e560c183681 Mon Sep 17 00:00:00 2001 From: Jan Izydorczyk <32340263+Janix4000@users.noreply.github.com> Date: Mon, 30 Jan 2023 10:10:28 +0100 Subject: [PATCH 2/2] Add `in ` prefix in cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Feliks Pobiedziński <38541925+FelonEkonom@users.noreply.github.com> --- pages/supported_types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/supported_types.md b/pages/supported_types.md index b79e6ea0..9bd35b51 100644 --- a/pages/supported_types.md +++ b/pages/supported_types.md @@ -7,7 +7,7 @@ You can also refer to [#42](https://github.com/membraneframework/unifex/issues/4 state of work on remaining types. ## Supported types -| Elixir type | Native type | NIF as a function parameter | NIF as a return type | CNode as a function parameter | CNode as a return type | +| Elixir type | Native type | in NIF as a function parameter | in NIF as a return type | in CNode as a function parameter | in CNode as a return type | | --------- | :-----------------------------: | :-------------------------: | :------------------: | :---------------------------: | :---------------------: | | `atom` | `char *` | ✅ | ✅ | ✅ | ✅ | | `bool` | `int` | ✅ | ✅ | ✅ | ✅ |