Skip to content

Commit f48e3bf

Browse files
authored
Move output to core out of interpreter (#90)
1 parent 4e5876b commit f48e3bf

65 files changed

Lines changed: 138 additions & 111 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benches/src/interpreter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod test_data;
22

33
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
4-
use pine_lang::interpreter::DefaultPineOutput;
4+
use pine_lang::core::DefaultPineOutput;
55
use pine_lang::{execute, ScriptBuilder};
66
use test_data::generate_bars;
77

crates/pine-builtin-macro/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ pub fn builtin_function_derive(input: TokenStream) -> TokenStream {
7373
// `#[builtin(output = LabelOutput)]` adds the capability the builtin needs
7474
// from the output type; without it `PineOutput` alone is enough.
7575
let capability = output_bound
76-
.map(|bound| quote! { + ::pine_interpreter::#bound })
76+
.map(|bound| quote! { + ::pine_core::#bound })
7777
.unwrap_or_default();
7878
(
7979
quote! {},
8080
quote! {},
81-
quote! { <O: ::pine_interpreter::PineOutput #capability> },
81+
quote! { <O: ::pine_core::PineOutput #capability> },
8282
)
8383
} else {
8484
(
@@ -131,7 +131,7 @@ pub fn builtin_function_derive(input: TokenStream) -> TokenStream {
131131
/// the state twice.
132132
#[derive(Default)]
133133
#[doc(hidden)]
134-
pub struct #slot_name<O: ::pine_interpreter::PineOutput> {
134+
pub struct #slot_name<O: ::pine_core::PineOutput> {
135135
#(#state_decls,)*
136136
bar_seq: u64,
137137
memo: Option<::pine_interpreter::Value<O>>,

crates/pine-builtins/src/alertcondition/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
//! declaration (title + message) is simply recorded via [`AlertConditionOutput`].
66
77
use pine_builtin_macro::BuiltinFunction;
8-
use pine_interpreter::{
9-
AlertCondition, AlertConditionOutput, Interpreter, PineOutput, RuntimeError, Value,
10-
};
8+
use pine_core::{AlertCondition, AlertConditionOutput, PineOutput};
9+
use pine_interpreter::{Interpreter, RuntimeError, Value};
1110

1211
/// alertcondition(condition, title, message)
1312
#[derive(BuiltinFunction)]

crates/pine-builtins/src/array/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use pine_builtin_macro::BuiltinFunction;
2-
use pine_interpreter::{Interpreter, PineOutput, RuntimeError, Value};
2+
use pine_core::PineOutput;
3+
use pine_interpreter::{Interpreter, RuntimeError, Value};
34
use std::cell::RefCell;
45
use std::rc::Rc;
56

crates/pine-builtins/src/barstate/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
//! Unlike the compile-time namespaces, these change every bar, so they are built
44
//! per bar from the [`Bar`]'s flags (see `register_per_bar` in the crate root).
55
6-
use pine_core::Bar;
7-
use pine_interpreter::{PineOutput, Value};
6+
use pine_core::{Bar, PineOutput};
7+
use pine_interpreter::Value;
88
use std::cell::RefCell;
99
use std::collections::HashMap;
1010
use std::rc::Rc;

crates/pine-builtins/src/box/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use pine_builtin_macro::BuiltinFunction;
2-
use pine_interpreter::{BoxOutput, Color, Interpreter, PineBox, PineOutput, RuntimeError, Value};
2+
use pine_core::{BoxOutput, Color, PineBox, PineOutput};
3+
use pine_interpreter::{Interpreter, RuntimeError, Value};
34
use std::cell::RefCell;
45
use std::collections::HashMap;
56
use std::rc::Rc;

crates/pine-builtins/src/color/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use pine_builtin_macro::BuiltinFunction;
2-
use pine_interpreter::{Interpreter, PineOutput, RuntimeError, Value};
2+
use pine_core::PineOutput;
3+
use pine_interpreter::{Interpreter, RuntimeError, Value};
34

45
/// color.new(color, transp) - Applies transparency to a color
56
#[derive(BuiltinFunction)]
@@ -34,7 +35,7 @@ impl ColorRgb {
3435
let g = self.green.clamp(0.0, 255.0) as u8;
3536
let b = self.blue.clamp(0.0, 255.0) as u8;
3637
let t = self.transp.clamp(0.0, 100.0) as u8;
37-
Ok(Value::Color(pine_interpreter::Color::new(r, g, b, t)))
38+
Ok(Value::Color(pine_core::Color::new(r, g, b, t)))
3839
}
3940
}
4041

@@ -125,7 +126,7 @@ impl<O: PineOutput> ColorFromGradient<O> {
125126
let b = (c1.b as f64 + (c2.b as f64 - c1.b as f64) * ratio) as u8;
126127
let t = (c1.t as f64 + (c2.t as f64 - c1.t as f64) * ratio) as u8;
127128

128-
Ok(Value::Color(pine_interpreter::Color::new(r, g, b, t)))
129+
Ok(Value::Color(pine_core::Color::new(r, g, b, t)))
129130
}
130131
}
131132

crates/pine-builtins/src/constants/barmerge.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use pine_interpreter::{PineOutput, Value};
1+
use pine_core::PineOutput;
2+
use pine_interpreter::Value;
23
use std::cell::RefCell;
34
use std::collections::HashMap;
45
use std::rc::Rc;

crates/pine-builtins/src/constants/display.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use pine_interpreter::{PineOutput, Value};
1+
use pine_core::PineOutput;
2+
use pine_interpreter::Value;
23
use std::cell::RefCell;
34
use std::collections::HashMap;
45
use std::rc::Rc;

0 commit comments

Comments
 (0)