diff options
Diffstat (limited to 'third_party/rust/redox_syscall/src/scheme/generate.sh')
-rwxr-xr-x | third_party/rust/redox_syscall/src/scheme/generate.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/third_party/rust/redox_syscall/src/scheme/generate.sh b/third_party/rust/redox_syscall/src/scheme/generate.sh new file mode 100755 index 0000000000..e5d11ae300 --- /dev/null +++ b/third_party/rust/redox_syscall/src/scheme/generate.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e + +echo "Generating SchemeMut from Scheme" +sed 's/trait Scheme/trait SchemeMut/' scheme.rs \ +| sed 's/\&self/\&mut self/g' \ +> scheme_mut.rs + +echo "Generating SchemeBlock from Scheme" +sed 's/trait Scheme/trait SchemeBlock/' scheme.rs \ +| sed 's/fn handle(\&self, packet: \&mut Packet)/fn handle(\&self, packet: \&Packet) -> Option<usize>/' \ +| sed 's/packet.a = Error::mux(res);/res.transpose().map(Error::mux)/' \ +| sed 's/Result<usize>/Result<Option<usize>>/g' \ +> scheme_block.rs + +echo "Generating SchemeBlockMut from SchemeBlock" +sed 's/trait SchemeBlock/trait SchemeBlockMut/' scheme_block.rs \ +| sed 's/\&self/\&mut self/g' \ +> scheme_block_mut.rs |