Skip to content

Commit

Permalink
Merge pull request #66 from WebAssembly/pch/require_semicolons
Browse files Browse the repository at this point in the history
wit syntax: require semicolons
  • Loading branch information
pchickey authored Oct 16, 2023
2 parents 8f9ab4a + fbe0b7f commit 0d72fa9
Show file tree
Hide file tree
Showing 13 changed files with 100 additions and 100 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
./wit-deps lock
git add -N wit/deps
git diff --exit-code
- uses: WebAssembly/wit-abi-up-to-date@v15
- uses: WebAssembly/wit-abi-up-to-date@v16
4 changes: 2 additions & 2 deletions wit/deps.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[io]
url = "https://github.com/WebAssembly/wasi-io/archive/main.tar.gz"
sha256 = "6e20bcf4d4f5466b60c05ea8da7289ca361a7febdd22ab1a531e5ef7e394ab8d"
sha512 = "21f6689bce6ed6d9e3bd96372e5c7ed003a7aefbf8d49b4eea949dfbd265cf57a0d7dc67aa71e3de75d48fcc2c0cfe5f06f7e9e7959a23bc98f77da85f4161b9"
sha256 = "a00c29dd57dc224e8ce28b793b19c1b1001dcdbdc229ed451c3df1db91841b34"
sha512 = "8558085eeb5689209101cdfbc9782953d559ad14ce77260fe2f7cc472482d568f65cad9e6a688d40c634c6c54c608f27e27e481633446114d6fdead93d4e34c5"
8 changes: 4 additions & 4 deletions wit/deps/io/poll.wit
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package wasi:io
package wasi:io;

/// A poll API intended to let users wait for I/O events on multiple handles
/// at once.
interface poll {
/// A "pollable" handle.
resource pollable
resource pollable;

/// Poll for completion on a set of pollables.
///
Expand All @@ -24,11 +24,11 @@ interface poll {
/// do any I/O so it doesn't fail. If any of the I/O sources identified by
/// the pollables has an error, it is indicated by marking the source as
/// being reaedy for I/O.
poll-list: func(in: list<borrow<pollable>>) -> list<u32>
poll-list: func(in: list<borrow<pollable>>) -> list<u32>;

/// Poll for completion on a single pollable.
///
/// This function is similar to `poll-list`, but operates on only a single
/// pollable. When it returns, the handle is ready for I/O.
poll-one: func(in: borrow<pollable>)
poll-one: func(in: borrow<pollable>);
}
36 changes: 18 additions & 18 deletions wit/deps/io/streams.wit
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package wasi:io
package wasi:io;

/// WASI I/O is an I/O abstraction API which is currently focused on providing
/// stream types.
///
/// In the future, the component model is expected to add built-in stream types;
/// when it does, they are expected to subsume this API.
interface streams {
use poll.{pollable}
use poll.{pollable};

/// Streams provide a sequence of data and then end; once they end, they
/// no longer provide any further data.
Expand Down Expand Up @@ -58,14 +58,14 @@ interface streams {
read: func(
/// The maximum number of bytes to read
len: u64
) -> result<tuple<list<u8>, stream-status>>
) -> result<tuple<list<u8>, stream-status>>;

/// Read bytes from a stream, after blocking until at least one byte can
/// be read. Except for blocking, identical to `read`.
blocking-read: func(
/// The maximum number of bytes to read
len: u64
) -> result<tuple<list<u8>, stream-status>>
) -> result<tuple<list<u8>, stream-status>>;

/// Skip bytes from a stream.
///
Expand All @@ -82,22 +82,22 @@ interface streams {
skip: func(
/// The maximum number of bytes to skip.
len: u64,
) -> result<tuple<u64, stream-status>>
) -> result<tuple<u64, stream-status>>;

/// Skip bytes from a stream, after blocking until at least one byte
/// can be skipped. Except for blocking behavior, identical to `skip`.
blocking-skip: func(
/// The maximum number of bytes to skip.
len: u64,
) -> result<tuple<u64, stream-status>>
) -> result<tuple<u64, stream-status>>;

/// Create a `pollable` which will resolve once either the specified stream
/// has bytes available to read or the other end of the stream has been
/// closed.
/// The created `pollable` is a child resource of the `input-stream`.
/// Implementations may trap if the `input-stream` is dropped before
/// all derived `pollable`s created with this function are dropped.
subscribe: func() -> pollable
subscribe: func() -> pollable;
}

/// An error for output-stream operations.
Expand Down Expand Up @@ -131,7 +131,7 @@ interface streams {
/// When this function returns 0 bytes, the `subscribe` pollable will
/// become ready when this function will report at least 1 byte, or an
/// error.
check-write: func() -> result<u64, write-error>
check-write: func() -> result<u64, write-error>;

/// Perform a write. This function never blocks.
///
Expand All @@ -142,7 +142,7 @@ interface streams {
/// the last call to check-write provided a permit.
write: func(
contents: list<u8>
) -> result<_, write-error>
) -> result<_, write-error>;

/// Perform a write of up to 4096 bytes, and then flush the stream. Block
/// until all of these operations are complete, or an error occurs.
Expand Down Expand Up @@ -170,7 +170,7 @@ interface streams {
/// ```
blocking-write-and-flush: func(
contents: list<u8>
) -> result<_, write-error>
) -> result<_, write-error>;

/// Request to flush buffered output. This function never blocks.
///
Expand All @@ -182,11 +182,11 @@ interface streams {
/// writes (`check-write` will return `ok(0)`) until the flush has
/// completed. The `subscribe` pollable will become ready when the
/// flush has completed and the stream can accept more writes.
flush: func() -> result<_, write-error>
flush: func() -> result<_, write-error>;

/// Request to flush buffered output, and block until flush completes
/// and stream is ready for writing again.
blocking-flush: func() -> result<_, write-error>
blocking-flush: func() -> result<_, write-error>;

/// Create a `pollable` which will resolve once the output-stream
/// is ready for more writing, or an error has occured. When this
Expand All @@ -198,7 +198,7 @@ interface streams {
/// The created `pollable` is a child resource of the `output-stream`.
/// Implementations may trap if the `output-stream` is dropped before
/// all derived `pollable`s created with this function are dropped.
subscribe: func() -> pollable
subscribe: func() -> pollable;

/// Write zeroes to a stream.
///
Expand All @@ -209,7 +209,7 @@ interface streams {
write-zeroes: func(
/// The number of zero-bytes to write
len: u64
) -> result<_, write-error>
) -> result<_, write-error>;

/// Perform a write of up to 4096 zeroes, and then flush the stream.
/// Block until all of these operations are complete, or an error
Expand Down Expand Up @@ -238,7 +238,7 @@ interface streams {
blocking-write-zeroes-and-flush: func(
/// The number of zero-bytes to write
len: u64
) -> result<_, write-error>
) -> result<_, write-error>;

/// Read from one stream and write to another.
///
Expand All @@ -252,7 +252,7 @@ interface streams {
src: input-stream,
/// The number of bytes to splice
len: u64,
) -> result<tuple<u64, stream-status>>
) -> result<tuple<u64, stream-status>>;

/// Read from one stream and write to another, with blocking.
///
Expand All @@ -263,7 +263,7 @@ interface streams {
src: input-stream,
/// The number of bytes to splice
len: u64,
) -> result<tuple<u64, stream-status>>
) -> result<tuple<u64, stream-status>>;

/// Forward the entire contents of an input stream to an output stream.
///
Expand All @@ -280,6 +280,6 @@ interface streams {
forward: func(
/// The stream to read from
src: input-stream
) -> result<tuple<u64, stream-status>>
) -> result<tuple<u64, stream-status>>;
}
}
6 changes: 3 additions & 3 deletions wit/deps/io/world.wit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wasi:io
package wasi:io;

world imports {
import streams
import poll
import streams;
import poll;
}
4 changes: 2 additions & 2 deletions wit/instance-network.wit
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

/// This interface provides a value-export of the default network handle..
interface instance-network {
use network.{network}
use network.{network};

/// Get a handle to the default network.
instance-network: func() -> network
instance-network: func() -> network;

}
10 changes: 5 additions & 5 deletions wit/ip-name-lookup.wit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

interface ip-name-lookup {
use wasi:io/poll.{pollable}
use network.{network, error-code, ip-address, ip-address-family}
use wasi:io/poll.{pollable};
use network.{network, error-code, ip-address, ip-address-family};


/// Resolve an internet host name to a list of IP addresses.
Expand Down Expand Up @@ -34,7 +34,7 @@ interface ip-name-lookup {
/// - <https://man7.org/linux/man-pages/man3/getaddrinfo.3.html>
/// - <https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>
/// - <https://man.freebsd.org/cgi/man.cgi?query=getaddrinfo&sektion=3>
resolve-addresses: func(network: borrow<network>, name: string, address-family: option<ip-address-family>, include-unavailable: bool) -> result<resolve-address-stream, error-code>
resolve-addresses: func(network: borrow<network>, name: string, address-family: option<ip-address-family>, include-unavailable: bool) -> result<resolve-address-stream, error-code>;

resource resolve-address-stream {
/// Returns the next address from the resolver.
Expand All @@ -50,12 +50,12 @@ interface ip-name-lookup {
/// - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN)
/// - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL)
/// - `would-block`: A result is not available yet. (EWOULDBLOCK, EAGAIN)
resolve-next-address: func() -> result<option<ip-address>, error-code>
resolve-next-address: func() -> result<option<ip-address>, error-code>;

/// Create a `pollable` which will resolve once the stream is ready for I/O.
///
/// Note: this function is here for WASI Preview2 only.
/// It's planned to be removed when `future` is natively supported in Preview3.
subscribe: func() -> pollable
subscribe: func() -> pollable;
}
}
6 changes: 3 additions & 3 deletions wit/network.wit
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ interface network {
/// An opaque resource that represents access to (a subset of) the network.
/// This enables context-based security for networking.
/// There is no need for this to map 1:1 to a physical network interface.
resource network
resource network;

/// Error codes.
///
Expand Down Expand Up @@ -150,8 +150,8 @@ interface network {
ipv6,
}

type ipv4-address = tuple<u8, u8, u8, u8>
type ipv6-address = tuple<u16, u16, u16, u16, u16, u16, u16, u16>
type ipv4-address = tuple<u8, u8, u8, u8>;
type ipv6-address = tuple<u16, u16, u16, u16, u16, u16, u16, u16>;

variant ip-address {
ipv4(ipv4-address),
Expand Down
6 changes: 3 additions & 3 deletions wit/tcp-create-socket.wit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

interface tcp-create-socket {
use network.{network, error-code, ip-address-family}
use tcp.{tcp-socket}
use network.{network, error-code, ip-address-family};
use tcp.{tcp-socket};

/// Create a new TCP socket.
///
Expand All @@ -23,5 +23,5 @@ interface tcp-create-socket {
/// - <https://man7.org/linux/man-pages/man2/socket.2.html>
/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>
/// - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>
create-tcp-socket: func(address-family: ip-address-family) -> result<tcp-socket, error-code>
create-tcp-socket: func(address-family: ip-address-family) -> result<tcp-socket, error-code>;
}
Loading

0 comments on commit 0d72fa9

Please sign in to comment.