Traditional route appears to work
Beginnings of dylib extensions, entirely untestted
This commit is contained in:
@@ -11,3 +11,12 @@ pub use std::tuple::{HomoTpl, Tpl, Tuple, UntypedTuple};
|
||||
pub use macros::macro_system::MacroSystem;
|
||||
pub use macros::mactree::{MacTok, MacTree};
|
||||
use orchid_api as api;
|
||||
use orchid_extension::binary::orchid_extension_main_body;
|
||||
use orchid_extension::entrypoint::ExtensionBuilder;
|
||||
|
||||
pub extern "C" fn orchid_extension_main(cx: api::binary::ExtensionContext) {
|
||||
orchid_extension_main_body(
|
||||
cx,
|
||||
ExtensionBuilder::new("orchid-std::main").system(StdSystem).system(MacroSystem),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ use orchid_base::error::mk_errv;
|
||||
use orchid_base::format::fmt;
|
||||
use orchid_base::interner::is;
|
||||
use orchid_base::location::Pos;
|
||||
use orchid_base::logging::logger;
|
||||
use orchid_base::logging::log;
|
||||
use orchid_base::name::{NameLike, Sym, VPath};
|
||||
use orchid_base::tree::Paren;
|
||||
use orchid_extension::atom::TAtom;
|
||||
@@ -27,9 +27,7 @@ use crate::{MacTok, MacTree};
|
||||
|
||||
pub async fn resolve(val: MacTree) -> GExpr {
|
||||
exec(async move |mut h| {
|
||||
// if ctx.logger().is_active() {
|
||||
writeln!(logger(), "Macro-resolving {}", fmt(&val).await);
|
||||
// }
|
||||
writeln!(log("debug"), "Macro-resolving {}", fmt(&val).await).await;
|
||||
let root = refl();
|
||||
let mut macros = HashMap::new();
|
||||
for n in val.glossary() {
|
||||
@@ -67,7 +65,13 @@ pub async fn resolve(val: MacTree) -> GExpr {
|
||||
}
|
||||
let mut rctx = ResolveCtx { h, exclusive, priod };
|
||||
let gex = resolve_one(&mut rctx, Substack::Bottom, &val).await;
|
||||
writeln!(logger(), "Macro-resolution over {}\nreturned {}", fmt(&val).await, fmt(&gex).await);
|
||||
writeln!(
|
||||
log("debug"),
|
||||
"Macro-resolution over {}\nreturned {}",
|
||||
fmt(&val).await,
|
||||
fmt(&gex).await
|
||||
)
|
||||
.await;
|
||||
gex
|
||||
})
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user