source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
+[[package]]
+name = "regex-automata"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2"
+
[[package]]
name = "reqwest"
- version = "0.11.18"
+ version = "0.11.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
- checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55"
+ checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1"
dependencies = [
- "base64 0.21.2",
+ "base64 0.21.3",
"bytes",
"encoding_rs",
"futures-core",
"quote",
"rand",
"ref_thread_local",
+ "regex",
"reqwest",
"ring",
+ "ring-wasi",
"ripemd160",
"roxmltree",
"rustyline",
rust-version = "1.63"
[features]
+multi_thread = []
+ default = ["ffi", "repl", "hostname", "tls", "http"]
+ ffi = ["dep:libffi"]
+ repl = ["dep:crossterm", "dep:ctrlc", "dep:rustyline"]
+ hostname = ["dep:hostname"]
+ tls = ["dep:native-tls"]
+ http = ["dep:hyper", "dep:reqwest"]
[build-dependencies]
indexmap = "1.0.2"
roxmltree = "0.11.0"
base64 = "0.12.3"
smallvec = "1.8.0"
- sodiumoxide = "0.2.6"
static_assertions = "1.1.0"
ryu = "1.0.9"
- hyper = { version = "1.0.0-rc.4", features = ["full"] }
- hyper-util = { git = "https://github.com/hyperium/hyper-util.git" }
- tokio = { version = "1.28.2", features = ["full"] }
futures = "0.3"
+regex = "1.9.1"
libloading = "0.7"
derive_deref = "1.1.1"
http-body-util = "0.1.0-rc.2"
fn main() -> std::process::ExitCode {
use std::sync::atomic::Ordering;
use scryer_prolog::*;
+ use scryer_prolog::atom_table::Atom;
+ #[cfg(feature = "repl")]
ctrlc::set_handler(move || {
scryer_prolog::machine::INTERRUPT.store(true, Ordering::Relaxed);
}).unwrap();
- let mut wam = machine::Machine::new();
- wam.run_top_level()
++ #[cfg(target_os = "wasi")]
++ let runtime = tokio::runtime::Builder::new_current_thread()
++ .enable_all()
++ .build()
++ .unwrap();
++
++ #[cfg(not(target_os = "wasi"))]
+ let runtime = tokio::runtime::Builder::new_multi_thread()
+ .enable_all()
+ .build()
+ .unwrap();
+
+ runtime.block_on(async move {
+ let mut wam = machine::Machine::new(Default::default());
+ wam.run_top_level(atom!("$toplevel"), (atom!("$repl"), 1))
+ })
}
pub(super) user_output: Stream,
pub(super) user_error: Stream,
pub(super) load_contexts: Vec<LoadContext>,
- pub(super) runtime: Runtime,
+ #[cfg(feature = "ffi")]
pub(super) foreign_function_table: ForeignFunctionTable,
}
user_output,
user_error,
load_contexts: vec![],
- runtime,
+ #[cfg(feature = "ffi")]
foreign_function_table: Default::default(),
};
use hyper::{HeaderMap, Method};
use http_body_util::BodyExt;
use bytes::Buf;
+ #[cfg(feature = "http")]
use reqwest::Url;
+use hyper_util::rt::TokioIo;
+ #[cfg(feature = "repl")]
pub(crate) fn get_key() -> KeyEvent {
let key;
enable_raw_mode().expect("failed to enable raw mode");