diff --git a/src/libcore/future.rs b/src/libcore/future.rs index 7bd73207ef5..10a13766140 100644 --- a/src/libcore/future.rs +++ b/src/libcore/future.rs @@ -134,11 +134,11 @@ fn with(future: &Future, blk: fn((&A)) -> B) -> B { blk(v) } -proto! future_pipe { +proto! future_pipe ( waiting:recv { completed(T) -> ! } -} +) #[test] fn test_from_value() { diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 048bd64f8f6..7d5db047363 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -7,14 +7,14 @@ directions they can flow at any given point are determined by a protocol. Below is an example protocol. ~~~ -proto! pingpong { +proto! pingpong ( ping: send { ping -> pong } pong: recv { pong -> ping } -} +) ~~~ The `proto!` syntax extension will convert this into a module called @@ -893,11 +893,11 @@ fn spawn_service_recv( // Streams - Make pipes a little easier in general. -proto! streamp { +proto! streamp ( open:send { data(T) -> open } -} +) /// A trait for things that can send multiple messages. trait channel { @@ -1138,11 +1138,11 @@ impl, Right: selectable recv> } } -proto! oneshot { +proto! oneshot ( oneshot:send { send(T) -> ! } -} +) /// The send end of a oneshot pipe. type chan_one = oneshot::client::oneshot; diff --git a/src/libsyntax/ext/pipes.rs b/src/libsyntax/ext/pipes.rs index beda46a2c3b..479e3afe51b 100644 --- a/src/libsyntax/ext/pipes.rs +++ b/src/libsyntax/ext/pipes.rs @@ -3,14 +3,14 @@ This is frequently called the pipe compiler. It handles code such as... ~~~ -proto! pingpong { +proto! pingpong ( ping: send { ping -> pong } pong: recv { pong -> ping } -} +) ~~~ There are several components: diff --git a/src/test/bench/msgsend-ring-pipes.rs b/src/test/bench/msgsend-ring-pipes.rs index 96f65b3462e..10ae60a0a0d 100644 --- a/src/test/bench/msgsend-ring-pipes.rs +++ b/src/test/bench/msgsend-ring-pipes.rs @@ -15,11 +15,11 @@ import std::time; import pipes::recv; -proto! ring { +proto! ring ( num:send { num(uint) -> num } -} +) fn macros() { #macro[ diff --git a/src/test/bench/pingpong.rs b/src/test/bench/pingpong.rs index db8894da587..a06bbbbc109 100644 --- a/src/test/bench/pingpong.rs +++ b/src/test/bench/pingpong.rs @@ -7,7 +7,7 @@ use std; import pipes::{spawn_service, recv}; import std::time::precise_time_s; -proto! pingpong { +proto! pingpong ( ping: send { ping -> pong } @@ -15,9 +15,9 @@ proto! pingpong { pong: recv { pong -> ping } -} +) -proto! pingpong_unbounded { +proto! pingpong_unbounded ( ping: send { ping -> pong } @@ -29,7 +29,7 @@ proto! pingpong_unbounded { you_will_never_catch_me: send { never_ever_ever -> you_will_never_catch_me } -} +) // This stuff should go in libcore::pipes macro_rules! move_it ( diff --git a/src/test/bench/task-perf-word-count-generic.rs b/src/test/bench/task-perf-word-count-generic.rs index efad6ae9210..06ecec92d8d 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -142,7 +142,7 @@ mod map_reduce { } - proto! ctrl_proto { + proto! ctrl_proto ( open: send { find_reducer(K) -> reducer_response, mapper_done -> ! @@ -151,7 +151,7 @@ mod map_reduce { reducer_response: recv { reducer(Chan>) -> open } - } + ) enum reduce_proto { emit_val(V), done, addref, release } diff --git a/src/test/run-pass/issue-2834.rs b/src/test/run-pass/issue-2834.rs index f65d0a0aa05..6b7bd97e6d4 100644 --- a/src/test/run-pass/issue-2834.rs +++ b/src/test/run-pass/issue-2834.rs @@ -2,11 +2,11 @@ // // xfail-test -proto! streamp { +proto! streamp ( open:send { data(T) -> open } -} +) fn rendezvous() { let (c, s) = streamp::init(); diff --git a/src/test/run-pass/issue-2930.rs b/src/test/run-pass/issue-2930.rs index 2f87e68641c..0d24f72cb23 100644 --- a/src/test/run-pass/issue-2930.rs +++ b/src/test/run-pass/issue-2930.rs @@ -1,8 +1,8 @@ -proto! stream { +proto! stream ( stream:send { send(T) -> stream } -} +) fn main() { let (bc, _bp) = stream::init(); diff --git a/src/test/run-pass/pipe-bank-proto.rs b/src/test/run-pass/pipe-bank-proto.rs index 839c63df951..4e81153be29 100644 --- a/src/test/run-pass/pipe-bank-proto.rs +++ b/src/test/run-pass/pipe-bank-proto.rs @@ -11,7 +11,7 @@ type password = ~str; type money = float; type amount = float; -proto! bank { +proto! bank ( login:send { login(username, password) -> login_response } @@ -30,7 +30,7 @@ proto! bank { money(money) -> connected, insufficient_funds -> connected } -} +) macro_rules! move_it ( { $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } } diff --git a/src/test/run-pass/pipe-detect-term.rs b/src/test/run-pass/pipe-detect-term.rs index d8acb0c27d5..f2590b6a76f 100644 --- a/src/test/run-pass/pipe-detect-term.rs +++ b/src/test/run-pass/pipe-detect-term.rs @@ -9,11 +9,11 @@ import std::uv; import pipes::{try_recv, recv}; -proto! oneshot { +proto! oneshot ( waiting:send { signal -> ! } -} +) fn main() { let iotask = uv::global_loop::get(); diff --git a/src/test/run-pass/pipe-peek.rs b/src/test/run-pass/pipe-peek.rs index f9f05056a66..ed0a2a3d75b 100644 --- a/src/test/run-pass/pipe-peek.rs +++ b/src/test/run-pass/pipe-peek.rs @@ -4,11 +4,11 @@ use std; import std::timer::sleep; import std::uv; -proto! oneshot { +proto! oneshot ( waiting:send { signal -> ! } -} +) fn main() { let (c, p) = oneshot::init(); diff --git a/src/test/run-pass/pipe-pingpong-proto.rs b/src/test/run-pass/pipe-pingpong-proto.rs index f5eaf26f4a8..1afcce0047f 100644 --- a/src/test/run-pass/pipe-pingpong-proto.rs +++ b/src/test/run-pass/pipe-pingpong-proto.rs @@ -2,7 +2,7 @@ // xfail-pretty -proto! pingpong { +proto! pingpong ( ping:send { ping -> pong } @@ -10,7 +10,7 @@ proto! pingpong { pong:recv { pong -> ping } -} +) mod test { import pipes::recv; diff --git a/src/test/run-pass/pipe-presentation-examples.rs b/src/test/run-pass/pipe-presentation-examples.rs index 9758ce68dc4..eba21e32971 100644 --- a/src/test/run-pass/pipe-presentation-examples.rs +++ b/src/test/run-pass/pipe-presentation-examples.rs @@ -71,7 +71,7 @@ struct Buffer { drop { } } -proto! double_buffer { +proto! double_buffer ( acquire:send { request -> wait_buffer } @@ -83,7 +83,7 @@ proto! double_buffer { release:send { release(Buffer) -> acquire } -} +) // Code examples fn render(_buffer: &Buffer) { diff --git a/src/test/run-pass/pipe-select-macro.rs b/src/test/run-pass/pipe-select-macro.rs index 7f4f0b487e6..1e868d3d249 100644 --- a/src/test/run-pass/pipe-select-macro.rs +++ b/src/test/run-pass/pipe-select-macro.rs @@ -1,13 +1,13 @@ // xfail-pretty // Protocols -proto! foo { +proto! foo ( foo:recv { do_foo -> foo } -} +) -proto! bar { +proto! bar ( bar:recv { do_bar(int) -> barbar, do_baz(bool) -> bazbar, @@ -20,7 +20,7 @@ proto! bar { bazbar:send { rebazbar -> bar } -} +) fn macros() { include!("select-macro.rs"); diff --git a/src/test/run-pass/pipe-select.rs b/src/test/run-pass/pipe-select.rs index 8987b4695f2..1c69fdd0955 100644 --- a/src/test/run-pass/pipe-select.rs +++ b/src/test/run-pass/pipe-select.rs @@ -7,17 +7,17 @@ import std::uv; import pipes::{recv, select}; -proto! oneshot { +proto! oneshot ( waiting:send { signal -> ! } -} +) -proto! stream { +proto! stream ( stream:send { send(T) -> stream } -} +) fn main() { import oneshot::client::*; diff --git a/src/test/run-pass/pipe-sleep.rs b/src/test/run-pass/pipe-sleep.rs index 3ef0f4a4a64..65aa3b2f228 100644 --- a/src/test/run-pass/pipe-sleep.rs +++ b/src/test/run-pass/pipe-sleep.rs @@ -5,11 +5,11 @@ import std::timer::sleep; import std::uv; import pipes::recv; -proto! oneshot { +proto! oneshot ( waiting:send { signal -> ! } -} +) fn main() { import oneshot::client::*;