Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Witx specification and markdown generation #1

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/check-witx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Check Witx

on: [push, pull_request]

jobs:
Witx:
name: "Check Witx"
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Generate markdown
uses: NodeFactoryIo/witx-md-generator-action@master
with:
witxGlobPath: spec/witx/**/*.witx

- name: Check if there are changes
id: changes
uses: UnicornGlobal/has-changes-action@v1.0.11

- name: Process changes
if: steps.changes.outputs.changed == 1
run: exit 1
15 changes: 15 additions & 0 deletions spec/witx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Generating Markdown

Generating Markdown is done via tool from WASI [repo](https://github.com/WebAssembly/WASI/tree/master/tools/witx):

```bash
cargo run witx docs "path/**/*.witx"
```

### Docker

Also available is a docker image with prepackaged cli:

```bash
docker run -v /path:/usr/src/witx nodefactory/witx docs "path/**/*.witx"
```
123 changes: 123 additions & 0 deletions spec/witx/w3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Types
# Modules
## <a href="#w3" name="w3"></a> w3
### Imports
### Functions

---

#### <a href="#_w3_init" name="_w3_init"></a> `_w3_init()`
Init w3

##### Params
##### Results

---

#### <a href="#_w3_invoke" name="_w3_invoke"></a> `_w3_invoke(name_size: u64, args_size: u32)`
Invoke call

##### Params
- <a href="#_w3_invoke.name_size" name="_w3_invoke.name_size"></a> `name_size`: `u64`

- <a href="#_w3_invoke.args_size" name="_w3_invoke.args_size"></a> `args_size`: `u32`

##### Results

---

#### <a href="#__w3_invoke_args" name="__w3_invoke_args"></a> `__w3_invoke_args(name_ptr: s32, args_ptr: s32)`
Get Invoke Arguments

##### Params
- <a href="#__w3_invoke_args.name_ptr" name="__w3_invoke_args.name_ptr"></a> `name_ptr`: `s32`

- <a href="#__w3_invoke_args.args_ptr" name="__w3_invoke_args.args_ptr"></a> `args_ptr`: `s32`

##### Results

---

#### <a href="#__w3_invoke_result" name="__w3_invoke_result"></a> `__w3_invoke_result(ptr: s32, len: u64)`
Set Invoke Arguments

##### Params
- <a href="#__w3_invoke_result.ptr" name="__w3_invoke_result.ptr"></a> `ptr`: `s32`

- <a href="#__w3_invoke_result.len" name="__w3_invoke_result.len"></a> `len`: `u64`

##### Results

---

#### <a href="#__w3_invoke_error" name="__w3_invoke_error"></a> `__w3_invoke_error(ptr: s32, len: u64)`
Set Invoke Error

##### Params
- <a href="#__w3_invoke_error.ptr" name="__w3_invoke_error.ptr"></a> `ptr`: `s32`

- <a href="#__w3_invoke_error.len" name="__w3_invoke_error.len"></a> `len`: `u64`

##### Results

---

#### <a href="#__w3_query" name="__w3_query"></a> `__w3_query(uri_ptr: s32, uri_len: u64, query_ptr: s32, query_len: u64, args_ptr: s32, args_len: u64) -> s8`
Query API

##### Params
- <a href="#__w3_query.uri_ptr" name="__w3_query.uri_ptr"></a> `uri_ptr`: `s32`

- <a href="#__w3_query.uri_len" name="__w3_query.uri_len"></a> `uri_len`: `u64`

- <a href="#__w3_query.query_ptr" name="__w3_query.query_ptr"></a> `query_ptr`: `s32`

- <a href="#__w3_query.query_len" name="__w3_query.query_len"></a> `query_len`: `u64`

- <a href="#__w3_query.args_ptr" name="__w3_query.args_ptr"></a> `args_ptr`: `s32`

- <a href="#__w3_query.args_len" name="__w3_query.args_len"></a> `args_len`: `u64`

##### Results
- <a href="#__w3_query.res" name="__w3_query.res"></a> `res`: `s8`


---

#### <a href="#__w3_query_result_len" name="__w3_query_result_len"></a> `__w3_query_result_len() -> u64`
Query Result

##### Params
##### Results
- <a href="#__w3_query_result_len.res" name="__w3_query_result_len.res"></a> `res`: `u64`


---

#### <a href="#__w3_query_result" name="__w3_query_result"></a> `__w3_query_result(ptr: s32)`
Query Result

##### Params
- <a href="#__w3_query_result.ptr" name="__w3_query_result.ptr"></a> `ptr`: `s32`

##### Results

---

#### <a href="#__w3_query_error_len" name="__w3_query_error_len"></a> `__w3_query_error_len() -> u64`
Query Error

##### Params
##### Results
- <a href="#__w3_query_error_len.res" name="__w3_query_error_len.res"></a> `res`: `u64`


---

#### <a href="#__w3_query_error" name="__w3_query_error"></a> `__w3_query_error(ptr: s32)`
Query Error

##### Params
- <a href="#__w3_query_error.ptr" name="__w3_query_error.ptr"></a> `ptr`: `s32`

##### Results
57 changes: 57 additions & 0 deletions spec/witx/w3.witx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
(module $w3
;;; Init w3
(@interface func (export "_w3_init"))

;;; Invoke call
(@interface func (export "_w3_invoke")
(param $name_size u64)
(param $args_size u32)
)

;;; Get Invoke Arguments
(@interface func (export "__w3_invoke_args")
(param $name_ptr s32)
(param $args_ptr s32)
)

;;; Set Invoke Arguments
(@interface func (export "__w3_invoke_result")
(param $ptr s32)
(param $len u64)
)

;;; Set Invoke Error
(@interface func (export "__w3_invoke_error")
(param $ptr s32)
(param $len u64)
)

;;; Query API
(@interface func (export "__w3_query")
(param $uri_ptr s32)
(param $uri_len u64)
(param $query_ptr s32)
(param $query_len u64)
(param $args_ptr s32)
(param $args_len u64)
(result $res s8)
)

;;; Query Result
(@interface func (export "__w3_query_result_len")
(result $res u64)
)
;;; Query Result
(@interface func (export "__w3_query_result")
(param $ptr s32)
)

;;; Query Error
(@interface func (export "__w3_query_error_len")
(result $res u64)
)
;;; Query Error
(@interface func (export "__w3_query_error")
(param $ptr s32)
)
)