Skip to content

Commit

Permalink
put system backend stuff in its own module
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Nov 18, 2024
1 parent b1f25c0 commit 25316be
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/compile/modifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ impl Compiler {

#[cfg(feature = "native_sys")]
let enabled =
crate::sys_native::set_output_enabled(self.pre_eval_mode != PreEvalMode::Lsp);
crate::sys::native::set_output_enabled(self.pre_eval_mode != PreEvalMode::Lsp);

let res = (|| -> UiuaResult {
env.exec(mac.root)?;
Expand All @@ -1144,7 +1144,7 @@ impl Compiler {
}

#[cfg(feature = "native_sys")]
crate::sys_native::set_output_enabled(enabled);
crate::sys::native::set_output_enabled(enabled);

swap(&mut env.asm, &mut self.asm);
Ok(())
Expand Down
4 changes: 2 additions & 2 deletions src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1387,15 +1387,15 @@ impl<'a> Formatter<'a> {
let mut env = Uiua::with_safe_sys().with_execution_limit(Duration::from_secs(2));

#[cfg(feature = "native_sys")]
let enabled = crate::sys_native::set_output_enabled(false);
let enabled = crate::sys::native::set_output_enabled(false);
let res = env.compile_run(|comp| {
comp.print_diagnostics(false)
.mode(RunMode::All)
.pre_eval_mode(PreEvalMode::Lazy)
.load_str_src(&self.inputs.get(&self.src), self.src.clone())
});
#[cfg(feature = "native_sys")]
crate::sys_native::set_output_enabled(enabled);
crate::sys::native::set_output_enabled(enabled);

let mut values = env.rt.output_comments;
if let Err(e) = res {
Expand Down
4 changes: 0 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ mod shape;
#[doc(hidden)]
pub mod stand;
mod sys;
#[cfg(feature = "native_sys")]
mod sys_native;
mod tree;
mod types;
mod value;
Expand Down Expand Up @@ -200,8 +198,6 @@ pub use self::{
};

use self::algorithm::get_ops;
#[cfg(feature = "native_sys")]
pub use self::sys_native::*;

use ecow::EcoString;

Expand Down
2 changes: 1 addition & 1 deletion src/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ mod server {
#[doc(hidden)]
pub fn run_language_server() {
#[cfg(feature = "native_sys")]
crate::sys_native::set_output_enabled(false);
crate::sys::native::set_output_enabled(false);

tokio::runtime::Builder::new_current_thread()
.build()
Expand Down
5 changes: 5 additions & 0 deletions src/sys.rs → src/sys/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(feature = "native_sys")]
pub(crate) mod native;

use std::{
any::Any,
fmt,
Expand All @@ -16,6 +19,8 @@ use parking_lot::Mutex;
use serde::*;
use time::UtcOffset;

#[cfg(feature = "native_sys")]
pub use self::native::*;
use crate::{
algorithm::validate_size, cowslice::cowslice, get_ops, primitive::PrimDoc, Array, Boxed,
FfiType, Ops, Primitive, Purity, Signature, Uiua, UiuaResult, Value,
Expand Down
File renamed without changes.

0 comments on commit 25316be

Please sign in to comment.