diff --git a/.gitignore b/.gitignore index 042776aad729534e038599f1a5b8f4e8c78dae0e..b83d22266ac8aa2f8df2edef68082c789727841d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -/Cargo.lock /target/ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000000000000000000000000000000000000..035268ce4d3bf1eb3acd247dd723cd3917235c54 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,553 @@ +[[package]] +name = "ansi_term" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "atty" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bitflags" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cbindgen" +version = "0.5.0" +dependencies = [ + "clap 2.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "standalone-syn 0.12.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cfg-if" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "clap" +version = "2.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "compiler_builtins" +version = "0.1.0" +source = "git+https://github.com/rust-lang-nursery/compiler-builtins.git#8fe94f3553f92cd6ba21aadc852bd6a3e01194db" + +[[package]] +name = "crt0" +version = "0.1.0" +dependencies = [ + "platform 0.1.0", +] + +[[package]] +name = "dtoa" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fcntl" +version = "0.1.0" +dependencies = [ + "cbindgen 0.5.0", + "platform 0.1.0", +] + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "itoa" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libc" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "log" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "owning_ref" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "platform" +version = "0.1.0" +dependencies = [ + "syscall 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_termios" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "relibc" +version = "0.1.0" +dependencies = [ + "compiler_builtins 0.1.0 (git+https://github.com/rust-lang-nursery/compiler-builtins.git)", + "fcntl 0.1.0", + "platform 0.1.0", + "unistd 0.1.0", +] + +[[package]] +name = "remove_dir_all" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-ap-proc_macro" +version = "40.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-ap-rustc_errors 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-ap-rustc_cratesio_shim" +version = "40.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-ap-rustc_data_structures" +version = "40.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-ap-rustc_errors" +version = "40.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-ap-rustc_data_structures 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-ap-serialize" +version = "40.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc-ap-syntax" +version = "40.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_cratesio_shim 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_errors 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-ap-syntax_pos" +version = "40.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-ap-rustc_data_structures 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_derive" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive_internals 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_derive_internals" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", + "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "smallvec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "stable_deref_trait" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "standalone-proc-macro2" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-ap-proc_macro 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "standalone-quote" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-ap-proc_macro 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "standalone-proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "standalone-syn" +version = "0.12.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-ap-proc_macro 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "standalone-proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "standalone-quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "strsim" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "syn" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "synom" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syscall" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "tempdir" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "term" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "termion" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "textwrap" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "toml" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-width" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unistd" +version = "0.1.0" +dependencies = [ + "cbindgen 0.5.0", + "platform 0.1.0", +] + +[[package]] +name = "vec_map" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[metadata] +"checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455" +"checksum atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8352656fd42c30a0c3c89d26dea01e3b77c0ab2af18230835c15e2e13cd51859" +"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf" +"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" +"checksum clap 2.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1c07b9257a00f3fc93b7f3c417fc15607ec7a56823bc2c37ec744e266387de5b" +"checksum compiler_builtins 0.1.0 (git+https://github.com/rust-lang-nursery/compiler-builtins.git)" = "<none>" +"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" +"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)" = "56aebce561378d99a0bb578f8cb15b6114d2a1814a6c7949bbe646d968bb4fa9" +"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" +"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2" +"checksum num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3c2bd9b9d21e48e956b763c9f37134dc62d9e95da6edb3f672cacb6caf3cd3" +"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +"checksum parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9fd9d732f2de194336fb02fe11f9eed13d9e76f13f4315b4d88a14ca411750cd" +"checksum parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "538ef00b7317875071d5e00f603f24d16f0b474c1a5fc0ccb8b454ca72eafa79" +"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" +"checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5" +"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd" +"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum remove_dir_all 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b5d2f806b0fcdabd98acd380dc8daef485e22bcb7cddc811d1337967f2528cf5" +"checksum rustc-ap-proc_macro 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d96f017dd18a6925618e1caf4a375ba2a5a175471172e18cc4855ac0587231ff" +"checksum rustc-ap-rustc_cratesio_shim 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6773cafaa546d932d62eb22fe854772f4d1b973245b36727c893a9fea3dbc4c6" +"checksum rustc-ap-rustc_data_structures 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a64e8c55c343448d6a0904e2066710be2734284d904b52b8fd064ca201ca854b" +"checksum rustc-ap-rustc_errors 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad6d84133da5f6b51c544b981c6b405e79db0a4fca41e34d77849846ed3b9121" +"checksum rustc-ap-serialize 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "43d227b1b3de1ec6d3fb48e10799d08c073c57e45f536766e1d897d46b737e0b" +"checksum rustc-ap-syntax 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b6e525fc674e8a75eaed08a90a6df7adfa73a66135056577722185dd7ca0771" +"checksum rustc-ap-syntax_pos 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e157f53ad5c4a6cf9ae5b5be15325dd2eeca190c03ab9873cc1460788767e5e9" +"checksum serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "db99f3919e20faa51bb2996057f5031d8685019b5a06139b1ce761da671b8526" +"checksum serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "f4ba7591cfe93755e89eeecdbcc668885624829b020050e6aec99c2a03bd3fd0" +"checksum serde_derive_internals 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6e03f1c9530c3fb0a0a5c9b826bdd9246a5921ae995d75f512ac917fc4dd55b5" +"checksum serde_json 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "57781ed845b8e742fc2bf306aba8e3b408fe8c366b900e3769fbc39f49eb8b39" +"checksum smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9" +"checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b" +"checksum standalone-proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "04b0e28c7fb04d85743490bd2a24bd0ec0ff6efc74e7c848748fd9fd2b105410" +"checksum standalone-quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "45bd227b8113ff91db4f6eadcc73928dc602af00a851f4fe65f3c1cb1a96b5e1" +"checksum standalone-syn 0.12.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d800cb9b3b2e08877667aace544bb0882ea3d5cf3ae83c2730a9032becf1f6bd" +"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" +"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" +"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" +"checksum syscall 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dae2c4de039bf338dd96f46621f20222c4101045dac5403b46f472608cb5b556" +"checksum tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f73eebdb68c14bcb24aef74ea96079830e7fa7b31a6106e42ea7ee887c1e134e" +"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" +"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" +"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693" +"checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e" +"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" +"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index 7c83df5ab557f3a0045ddc9ed0711c668f73adfe..ac7c7f864d4ec51156557669c8176fab3cca95bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,17 +8,16 @@ name = "c" crate-type = ["staticlib"] [workspace] +members = ["crt0"] [dependencies] +compiler_builtins = { git = "https://github.com/rust-lang-nursery/compiler-builtins.git", default-features = false, features = ["mem"] } +platform = { path = "platform" } fcntl = { path = "fcntl" } unistd = { path = "unistd" } [profile.dev] -incremental = false -lto = true panic = "abort" [profile.release] -incremental = false -lto = true panic = "abort" diff --git a/crt0/Cargo.toml b/crt0/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..0b82f468c56f684aad936630d5614da27536f88c --- /dev/null +++ b/crt0/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "crt0" +version = "0.1.0" +authors = ["Jeremy Soller <jackpot51@gmail.com>"] + +[lib] +name = "crt0" +crate-type = ["staticlib"] + +[dependencies] +platform = { path = "../platform" } diff --git a/crt0/src/lib.rs b/crt0/src/lib.rs new file mode 100644 index 0000000000000000000000000000000000000000..47ff4842987bccb4da0c6a6efe12dfcb08de59ac --- /dev/null +++ b/crt0/src/lib.rs @@ -0,0 +1,37 @@ +//! crt0 + +#![no_std] +#![feature(asm)] +#![feature(lang_items)] +#![feature(naked_functions)] + +extern crate platform; + +use platform::types::*; + +#[no_mangle] +#[naked] +pub unsafe extern "C" fn _start() { + asm!("mov rdi, rsp + call _start_rust" + : + : + : + : "intel" + ); +} + +#[inline(never)] +#[no_mangle] +pub unsafe extern "C" fn _start_rust(sp: usize) -> ! { + extern "C" { + fn main(argc: c_int, argv: *const *const c_char) -> c_int; + } + + platform::exit(main(0, 0 as *const *const c_char)); +} + +#[lang = "panic_fmt"] +pub extern "C" fn rust_begin_unwind(fmt: ::core::fmt::Arguments, file: &str, line: u32) -> ! { + loop {} +} diff --git a/fcntl/Cargo.toml b/fcntl/Cargo.toml index 3527c6e779b404925e866295643a08dda6461a7c..fbf73b66cc1c8b836cb2380550bc3f004adbddf1 100644 --- a/fcntl/Cargo.toml +++ b/fcntl/Cargo.toml @@ -8,4 +8,4 @@ build = "build.rs" cbindgen = { path = "../cbindgen" } [dependencies] -common = { path = "../common" } +platform = { path = "../platform" } diff --git a/fcntl/src/lib.rs b/fcntl/src/lib.rs index b68a5929bb61d4ddd1da0b096dac620ee761adc4..99d950e6193b0c81b1c7d374c6ead9bbc0d9cc3e 100644 --- a/fcntl/src/lib.rs +++ b/fcntl/src/lib.rs @@ -2,9 +2,19 @@ #![no_std] -extern crate common; +extern crate platform; -pub use common::*; +use platform::types::*; + +pub use sys::*; + +#[cfg(target_os = "linux")] +#[path="linux.rs"] +pub mod sys; + +#[cfg(target_os = "redox")] +#[path="redox.rs"] +pub mod sys; pub const F_DUPFD: c_int = 0; pub const F_GETFD: c_int = 1; @@ -21,25 +31,6 @@ pub const F_RDLCK: c_int = 0; pub const F_WRLCK: c_int = 1; pub const F_UNLCK: c_int = 2; -pub const O_RDONLY: c_int = 0x0001_0000; -pub const O_WRONLY: c_int = 0x0002_0000; -pub const O_RDWR: c_int = 0x0003_0000; -pub const O_NONBLOCK: c_int = 0x0004_0000; -pub const O_APPEND: c_int = 0x0008_0000; -pub const O_SHLOCK: c_int = 0x0010_0000; -pub const O_EXLOCK: c_int = 0x0020_0000; -pub const O_ASYNC: c_int = 0x0040_0000; -pub const O_FSYNC: c_int = 0x0080_0000; -pub const O_CLOEXEC: c_int = 0x0100_0000; -pub const O_CREAT: c_int = 0x0200_0000; -pub const O_TRUNC: c_int = 0x0400_0000; -pub const O_EXCL: c_int = 0x0800_0000; -pub const O_DIRECTORY: c_int = 0x1000_0000; -pub const O_STAT: c_int = 0x2000_0000; -pub const O_SYMLINK: c_int = 0x4000_0000; -pub const O_NOFOLLOW: c_int = 0x8000_0000; -pub const O_ACCMODE: c_int = O_RDONLY | O_WRONLY | O_RDWR; - #[no_mangle] pub extern "C" fn creat(path: *const c_char, mode: mode_t) -> c_int { open(path, O_WRONLY | O_CREAT | O_TRUNC, mode) @@ -52,7 +43,7 @@ pub extern "C" fn fcntl(fildes: c_int, cmd: c_int, arg: c_int) -> c_int { #[no_mangle] pub extern "C" fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int { - unimplemented!(); + platform::open(path, oflag, mode) } /* diff --git a/fcntl/src/linux.rs b/fcntl/src/linux.rs new file mode 100644 index 0000000000000000000000000000000000000000..bf5b3b74870d0072acacc7f9b4dd070fe7ac9b15 --- /dev/null +++ b/fcntl/src/linux.rs @@ -0,0 +1,8 @@ +use platform::types::*; + +pub const O_RDONLY: c_int = 0x0000; +pub const O_WRONLY: c_int = 0x0001; +pub const O_RDWR: c_int = 0x0002; +pub const O_CREAT: c_int = 0x0040; +pub const O_TRUNC: c_int = 0x0200; +pub const O_ACCMODE: c_int = O_RDONLY | O_WRONLY | O_RDWR; diff --git a/fcntl/src/redox.rs b/fcntl/src/redox.rs new file mode 100644 index 0000000000000000000000000000000000000000..78a435869dba136b8d9a8e0c9e6c471084b6e240 --- /dev/null +++ b/fcntl/src/redox.rs @@ -0,0 +1,20 @@ +use platform::types::*; + +pub const O_RDONLY: c_int = 0x0001_0000; +pub const O_WRONLY: c_int = 0x0002_0000; +pub const O_RDWR: c_int = 0x0003_0000; +pub const O_NONBLOCK: c_int = 0x0004_0000; +pub const O_APPEND: c_int = 0x0008_0000; +pub const O_SHLOCK: c_int = 0x0010_0000; +pub const O_EXLOCK: c_int = 0x0020_0000; +pub const O_ASYNC: c_int = 0x0040_0000; +pub const O_FSYNC: c_int = 0x0080_0000; +pub const O_CLOEXEC: c_int = 0x0100_0000; +pub const O_CREAT: c_int = 0x0200_0000; +pub const O_TRUNC: c_int = 0x0400_0000; +pub const O_EXCL: c_int = 0x0800_0000; +pub const O_DIRECTORY: c_int = 0x1000_0000; +pub const O_STAT: c_int = 0x2000_0000; +pub const O_SYMLINK: c_int = 0x4000_0000; +pub const O_NOFOLLOW: c_int = 0x8000_0000; +pub const O_ACCMODE: c_int = O_RDONLY | O_WRONLY | O_RDWR; diff --git a/include/sys/types.h b/include/sys/types.h index 416f51149b97d6646bb11f5ef507dfd46ffb6a30..3a65d4d00ddd88743e03f6bbbc211fa00944b141 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -4,6 +4,8 @@ typedef int gid_t; typedef int uid_t; +typedef int mode_t; + typedef long off_t; typedef int pid_t; diff --git a/common/Cargo.toml b/platform/Cargo.toml similarity index 60% rename from common/Cargo.toml rename to platform/Cargo.toml index 3b6ffb52567397590c5db63686996dd2bf66e0de..e7deb89c122f99138c9cc7d4aba8a11ae6687a49 100644 --- a/common/Cargo.toml +++ b/platform/Cargo.toml @@ -1,4 +1,7 @@ [package] -name = "common" +name = "platform" version = "0.1.0" authors = ["Jeremy Soller <jackpot51@gmail.com>"] + +[dependencies] +syscall = "0.2" diff --git a/platform/src/lib.rs b/platform/src/lib.rs new file mode 100644 index 0000000000000000000000000000000000000000..e094fbaa89e44d037af8908374bb254ec84f7320 --- /dev/null +++ b/platform/src/lib.rs @@ -0,0 +1,19 @@ +//! fcntl implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.h.html + +#![no_std] +#![allow(non_camel_case_types)] + +#[macro_use] +extern crate syscall; + +pub use sys::*; + +#[cfg(all(not(feature="no_std"), target_os = "linux"))] +#[path="linux/mod.rs"] +mod sys; + +#[cfg(all(not(feature="no_std"), target_os = "redox"))] +#[path="redox/mod.rs"] +mod sys; + +pub mod types; diff --git a/platform/src/linux/mod.rs b/platform/src/linux/mod.rs new file mode 100644 index 0000000000000000000000000000000000000000..dbf3b0f53a43fdc39cf2e82fdbd4dd664868fbd2 --- /dev/null +++ b/platform/src/linux/mod.rs @@ -0,0 +1,26 @@ +use types::*; + +pub fn close(fildes: c_int) -> c_int { + unsafe { + syscall!(CLOSE, fildes) as c_int + } +} + +pub fn exit(status: c_int) -> ! { + unsafe { + syscall!(EXIT, status); + } + loop {} +} + +pub fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int { + unsafe { + syscall!(OPEN, path, oflag, mode) as c_int + } +} + +pub fn write(fildes: c_int, buf: &[u8]) -> ssize_t { + unsafe { + syscall!(WRITE, fildes, buf.as_ptr(), buf.len()) as ssize_t + } +} diff --git a/platform/src/redox/mod.rs b/platform/src/redox/mod.rs new file mode 100644 index 0000000000000000000000000000000000000000..239d06a6be9fbdf1774b1cb46037edbbf87ef760 --- /dev/null +++ b/platform/src/redox/mod.rs @@ -0,0 +1,8 @@ +pub fn exit(status: c_int) -> ! { + syscall::exit(status); +} + +pub fn write(fd: c_int, buf: &[u8]) -> ssize_t { + syscall::write(fd, buf); + buf.len() as ssize_t +} diff --git a/common/src/lib.rs b/platform/src/types.rs similarity index 89% rename from common/src/lib.rs rename to platform/src/types.rs index ecb19b8e28113be8ec7e187b4d53cad9368c9c19..bb87c740c01628af1778c0db142fc32ad83ed8ad 100644 --- a/common/src/lib.rs +++ b/platform/src/types.rs @@ -1,8 +1,3 @@ -//! fcntl implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.h.html - -#![no_std] -#![allow(non_camel_case_types)] - // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable // more optimization opportunities around it recognizing things like // malloc/free. diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000000000000000000000000000000000000..5235a6f67b962db85e8079d8a784f7a212a18a85 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +nightly-2018-03-02 diff --git a/src/lib.rs b/src/lib.rs index 4c84deb54906e604414626a022cfbab623a10f23..d49813d1e7e121f51b42fbe4f7a301c446696906 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,14 +1,32 @@ #![no_std] #![feature(lang_items)] +extern crate compiler_builtins; +extern crate platform; + extern crate fcntl; extern crate unistd; pub use fcntl::*; pub use unistd::*; +use core::fmt; + +struct PanicWriter; + +impl fmt::Write for PanicWriter { + fn write_str(&mut self, s: &str) -> fmt::Result { + platform::write(2, s.as_bytes()); + Ok(()) + } +} + #[lang = "panic_fmt"] #[no_mangle] -pub extern "C" fn rust_begin_unwind(fmt: ::core::fmt::Arguments, file: &str, line: u32) -> ! { - loop {} +pub extern "C" fn rust_begin_unwind(fmt: fmt::Arguments, file: &str, line: u32) -> ! { + use fmt::Write; + + let _ = PanicWriter.write_fmt(format_args!("{}:{}: {}\n", file, line, fmt)); + + platform::exit(1); } diff --git a/test.sh b/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..91a5726d954227294037e1c79488958739fb3ea4 --- /dev/null +++ b/test.sh @@ -0,0 +1,7 @@ +set -ex + +cargo build +cargo build --manifest-path crt0/Cargo.toml +cd tests +make clean +make run diff --git a/tests/.gitignore b/tests/.gitignore index 7cd82ddb60121c7156bc78719a5ea4d4facfeaab..0348d78de95bbda30622e9b2852fc236b42ca4fa 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1 +1,3 @@ +/create +/create.out /write diff --git a/tests/Makefile b/tests/Makefile index 84981286b1357861e2f8f591651e338d2247ab9b..1f638014e5e6d860398be7f516029203c501e304 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,5 +1,14 @@ -write: write.c - gcc -nostdinc -nostdlib -I ../include -I ../target/include $< ../target/debug/libc.a -o $@ +BINS=\ + create \ + write + +all: $(BINS) clean: - rm -f write + rm -f $(BINS) + +run: $(BINS) + for bin in $(BINS); do echo "\\033[1m$${bin}\\033[0m"; ./$${bin}; done + +%: %.c + gcc -nostdinc -nostdlib -I ../include -I ../target/include ../target/debug/libcrt0.a $< ../target/debug/libc.a -o $@ diff --git a/tests/create.c b/tests/create.c new file mode 100644 index 0000000000000000000000000000000000000000..1ac8f18258ac605b06295f44503857e6a233671b --- /dev/null +++ b/tests/create.c @@ -0,0 +1,14 @@ +#include <fcntl.h> +#include <unistd.h> + +int main(int argc, char **argv) { + int fd = creat("create.out", 0755); + if (fd >= 0) { + write(fd, "Hello World!\n", 14); + close(fd); + return 0; + } else { + write(2, "creat failed\n", 14); + return 1; + } +} diff --git a/tests/write.c b/tests/write.c index 0349a5c09408edb5574056d3d0181af69745f8bf..e101fb8ea943b24fa6cdca712f0e8f4e048c65eb 100644 --- a/tests/write.c +++ b/tests/write.c @@ -1,5 +1,6 @@ #include <unistd.h> -void _start(void) { +int main(int argc, char **argv) { write(STDOUT_FILENO, "Hello World!\n", 14); + return 0; } diff --git a/unistd/Cargo.toml b/unistd/Cargo.toml index 0a7878fe71109492006ecc8281c92d19e13a2830..1a3bb22fe66ebcd64bb8874f454f4af0d1dfa65b 100644 --- a/unistd/Cargo.toml +++ b/unistd/Cargo.toml @@ -8,4 +8,4 @@ build = "build.rs" cbindgen = { path = "../cbindgen" } [dependencies] -common = { path = "../common" } +platform = { path = "../platform" } diff --git a/unistd/src/lib.rs b/unistd/src/lib.rs index 642965125b74d38b5812f9db2dc55fef5a3a7d9a..de23c114485ae6f07c777d300f0b3d157012a6cb 100644 --- a/unistd/src/lib.rs +++ b/unistd/src/lib.rs @@ -2,9 +2,9 @@ #![no_std] -extern crate common; +extern crate platform; -pub use common::*; +pub use platform::types::*; pub const NULL: c_int = 0; @@ -28,7 +28,7 @@ pub const STDERR_FILENO: c_int = 2; #[no_mangle] pub extern "C" fn _exit(status: c_int) { - unimplemented!(); + platform::exit(status) } #[no_mangle] @@ -63,7 +63,7 @@ pub extern "C" fn chown(path: *const c_char, owner: uid_t, group: gid_t) -> c_in #[no_mangle] pub extern "C" fn close(fildes: c_int) -> c_int { - unimplemented!(); + platform::close(fildes) } #[no_mangle] @@ -448,7 +448,10 @@ pub extern "C" fn vfork() -> pid_t { #[no_mangle] pub extern "C" fn write(fildes: c_int, buf: *const c_void, nbyte: size_t) -> ssize_t { - unimplemented!(); + use core::slice; + + let buf = unsafe { slice::from_raw_parts(buf as *const u8, nbyte as usize) }; + platform::write(fildes, buf) } /*