fmt, macro in app_logic for hash
This commit is contained in:
@ -128,24 +128,23 @@ pub enum BasicValue {
|
|||||||
},
|
},
|
||||||
Trace {
|
Trace {
|
||||||
value: rsprocess::trace::SlicingTrace<
|
value: rsprocess::trace::SlicingTrace<
|
||||||
rsprocess::set::Set,
|
rsprocess::set::Set,
|
||||||
rsprocess::reaction::Reaction,
|
rsprocess::reaction::Reaction,
|
||||||
rsprocess::system::System
|
rsprocess::system::System,
|
||||||
>
|
>,
|
||||||
},
|
},
|
||||||
PositiveTrace {
|
PositiveTrace {
|
||||||
value: rsprocess::trace::SlicingTrace<
|
value: rsprocess::trace::SlicingTrace<
|
||||||
rsprocess::set::PositiveSet,
|
rsprocess::set::PositiveSet,
|
||||||
rsprocess::reaction::PositiveReaction,
|
rsprocess::reaction::PositiveReaction,
|
||||||
rsprocess::system::PositiveSystem
|
rsprocess::system::PositiveSystem,
|
||||||
>
|
>,
|
||||||
},
|
},
|
||||||
PositiveSet {
|
PositiveSet {
|
||||||
value: rsprocess::set::PositiveSet
|
value: rsprocess::set::PositiveSet,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl Hash for BasicValue {
|
impl Hash for BasicValue {
|
||||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
macro_rules! default_hash {
|
macro_rules! default_hash {
|
||||||
@ -344,18 +343,14 @@ impl NodeInstruction {
|
|||||||
vec![("sys", PositiveSystem), ("experiment", Experiment)],
|
vec![("sys", PositiveSystem), ("experiment", Experiment)],
|
||||||
| Self::PositiveFastFrequency =>
|
| Self::PositiveFastFrequency =>
|
||||||
vec![("sys", PositiveSystem), ("experiment", Experiment)],
|
vec![("sys", PositiveSystem), ("experiment", Experiment)],
|
||||||
| Self::Trace =>
|
| Self::Trace => vec![("sys", System), ("limit", PositiveInt)],
|
||||||
vec![("sys", System), ("limit", PositiveInt)],
|
|
||||||
| Self::PositiveTrace =>
|
| Self::PositiveTrace =>
|
||||||
vec![("sys", PositiveSystem), ("limit", PositiveInt)],
|
vec![("sys", PositiveSystem), ("limit", PositiveInt)],
|
||||||
| Self::SliceTrace =>
|
| Self::SliceTrace => vec![("trace", Trace), ("marking", Set)],
|
||||||
vec![("trace", Trace), ("marking", Set)],
|
|
||||||
| Self::PositiveSliceTrace =>
|
| Self::PositiveSliceTrace =>
|
||||||
vec![("trace", PositiveTrace), ("marking", PositiveSet)],
|
vec![("trace", PositiveTrace), ("marking", PositiveSet)],
|
||||||
| Self::PositiveSet =>
|
| Self::PositiveSet => vec![("string", String)],
|
||||||
vec![("string", String)],
|
| Self::ToPositiveSet => vec![("value", Set)],
|
||||||
| Self::ToPositiveSet =>
|
|
||||||
vec![("value", Set)],
|
|
||||||
}
|
}
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|e| (e.0.to_string(), e.1))
|
.map(|e| (e.0.to_string(), e.1))
|
||||||
@ -418,16 +413,18 @@ impl NodeInstruction {
|
|||||||
) -> Box<dyn Fn(NodeId, &mut NodeGraph, &str)> {
|
) -> Box<dyn Fn(NodeId, &mut NodeGraph, &str)> {
|
||||||
macro_rules! helper {
|
macro_rules! helper {
|
||||||
($name: ident, $def: expr) => {
|
($name: ident, $def: expr) => {
|
||||||
Box::new(|node_id: NodeId, graph: &mut NodeGraph, name: &str| {
|
Box::new(
|
||||||
graph.add_input_param(
|
|node_id: NodeId, graph: &mut NodeGraph, name: &str| {
|
||||||
node_id,
|
graph.add_input_param(
|
||||||
name.to_string(),
|
node_id,
|
||||||
BasicDataType::$name,
|
name.to_string(),
|
||||||
BasicValue::$name { value: $def },
|
BasicDataType::$name,
|
||||||
InputParamKind::ConnectionOrConstant,
|
BasicValue::$name { value: $def },
|
||||||
true,
|
InputParamKind::ConnectionOrConstant,
|
||||||
);
|
true,
|
||||||
})
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,7 +438,8 @@ impl NodeInstruction {
|
|||||||
helper!(System, rsprocess::system::System::default()),
|
helper!(System, rsprocess::system::System::default()),
|
||||||
| BasicDataType::PositiveInt => helper!(PositiveInt, 1),
|
| BasicDataType::PositiveInt => helper!(PositiveInt, 1),
|
||||||
| BasicDataType::Symbol => helper!(Symbol, "*".into()),
|
| BasicDataType::Symbol => helper!(Symbol, "*".into()),
|
||||||
| BasicDataType::Experiment => helper!(Experiment, (vec![], vec![])),
|
| BasicDataType::Experiment =>
|
||||||
|
helper!(Experiment, (vec![], vec![])),
|
||||||
| BasicDataType::Graph => helper!(Graph, petgraph::Graph::new()),
|
| BasicDataType::Graph => helper!(Graph, petgraph::Graph::new()),
|
||||||
| BasicDataType::GroupingFunction =>
|
| BasicDataType::GroupingFunction =>
|
||||||
helper!(GroupingFunction, assert::relabel::Assert::default()),
|
helper!(GroupingFunction, assert::relabel::Assert::default()),
|
||||||
@ -467,7 +465,8 @@ impl NodeInstruction {
|
|||||||
Environment,
|
Environment,
|
||||||
rsprocess::environment::Environment::default()
|
rsprocess::environment::Environment::default()
|
||||||
),
|
),
|
||||||
| BasicDataType::Set => helper!(Set, rsprocess::set::Set::default()),
|
| BasicDataType::Set =>
|
||||||
|
helper!(Set, rsprocess::set::Set::default()),
|
||||||
| BasicDataType::Context =>
|
| BasicDataType::Context =>
|
||||||
helper!(Context, rsprocess::process::Process::default()),
|
helper!(Context, rsprocess::process::Process::default()),
|
||||||
| BasicDataType::Reactions => helper!(Reactions, vec![]),
|
| BasicDataType::Reactions => helper!(Reactions, vec![]),
|
||||||
@ -475,18 +474,14 @@ impl NodeInstruction {
|
|||||||
PositiveSystem,
|
PositiveSystem,
|
||||||
rsprocess::system::PositiveSystem::default()
|
rsprocess::system::PositiveSystem::default()
|
||||||
),
|
),
|
||||||
| BasicDataType::Trace => helper!(
|
| BasicDataType::Trace =>
|
||||||
Trace,
|
helper!(Trace, rsprocess::trace::SlicingTrace::default()),
|
||||||
rsprocess::trace::SlicingTrace::default()
|
|
||||||
),
|
|
||||||
| BasicDataType::PositiveTrace => helper!(
|
| BasicDataType::PositiveTrace => helper!(
|
||||||
PositiveTrace,
|
PositiveTrace,
|
||||||
rsprocess::trace::SlicingTrace::default()
|
rsprocess::trace::SlicingTrace::default()
|
||||||
),
|
),
|
||||||
| BasicDataType::PositiveSet => helper!(
|
| BasicDataType::PositiveSet =>
|
||||||
PositiveSet,
|
helper!(PositiveSet, rsprocess::set::PositiveSet::default()),
|
||||||
rsprocess::set::PositiveSet::default()
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,13 +491,15 @@ impl NodeInstruction {
|
|||||||
) -> Box<dyn Fn(NodeId, &mut NodeGraph, &str)> {
|
) -> Box<dyn Fn(NodeId, &mut NodeGraph, &str)> {
|
||||||
macro_rules! helper {
|
macro_rules! helper {
|
||||||
($name: ident) => {
|
($name: ident) => {
|
||||||
Box::new(|node_id: NodeId, graph: &mut NodeGraph, name: &str| {
|
Box::new(
|
||||||
graph.add_output_param(
|
|node_id: NodeId, graph: &mut NodeGraph, name: &str| {
|
||||||
node_id,
|
graph.add_output_param(
|
||||||
name.to_string(),
|
node_id,
|
||||||
BasicDataType::$name,
|
name.to_string(),
|
||||||
);
|
BasicDataType::$name,
|
||||||
})
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,7 +540,6 @@ pub enum CustomResponse {
|
|||||||
SaveToFile(NodeId),
|
SaveToFile(NodeId),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "persistence",
|
feature = "persistence",
|
||||||
@ -797,48 +793,47 @@ impl NodeTemplateTrait for NodeInstruction {
|
|||||||
) -> Vec<&'static str> {
|
) -> Vec<&'static str> {
|
||||||
match self {
|
match self {
|
||||||
| Self::String
|
| Self::String
|
||||||
| Self::Path
|
| Self::Path
|
||||||
| Self::ReadPath
|
| Self::ReadPath
|
||||||
| Self::Symbol
|
| Self::Symbol
|
||||||
| Self::SaveString => vec!["String"],
|
| Self::SaveString => vec!["String"],
|
||||||
| Self::System
|
| Self::System
|
||||||
| Self::Statistics
|
| Self::Statistics
|
||||||
| Self::Target
|
| Self::Target
|
||||||
| Self::Run
|
| Self::Run
|
||||||
| Self::Loop
|
| Self::Loop
|
||||||
| Self::ComposeSystem
|
| Self::ComposeSystem
|
||||||
| Self::Environment
|
| Self::Environment
|
||||||
| Self::Set
|
| Self::Set
|
||||||
| Self::Context
|
| Self::Context
|
||||||
| Self::Reactions => vec!["System"],
|
| Self::Reactions => vec!["System"],
|
||||||
| Self::Frequency
|
| Self::Frequency
|
||||||
| Self::LimitFrequency
|
| Self::LimitFrequency
|
||||||
| Self::Experiment
|
| Self::Experiment
|
||||||
| Self::FastFrequency => vec!["System", "Frequency"],
|
| Self::FastFrequency => vec!["System", "Frequency"],
|
||||||
| Self::BisimilarityKanellakisSmolka
|
| Self::BisimilarityKanellakisSmolka
|
||||||
| Self::BisimilarityPaigeTarjanNoLabels
|
| Self::BisimilarityPaigeTarjanNoLabels
|
||||||
| Self::BisimilarityPaigeTarjan
|
| Self::BisimilarityPaigeTarjan
|
||||||
| Self::GroupFunction => vec!["System", "Bisimilarity"],
|
| Self::GroupFunction => vec!["System", "Bisimilarity"],
|
||||||
| Self::SystemGraph => vec!["System", "Graph"],
|
| Self::SystemGraph => vec!["System", "Graph"],
|
||||||
| Self::Dot
|
| Self::Dot
|
||||||
| Self::DisplayNode
|
| Self::DisplayNode
|
||||||
| Self::DisplayEdge
|
| Self::DisplayEdge
|
||||||
| Self::ColorNode
|
| Self::ColorNode
|
||||||
| Self::ColorEdge
|
| Self::ColorEdge
|
||||||
| Self::GraphML => vec!["Graph"],
|
| Self::GraphML => vec!["Graph"],
|
||||||
| Self::PositiveSystem
|
| Self::PositiveSystem
|
||||||
| Self::PositiveTarget
|
| Self::PositiveTarget
|
||||||
| Self::PositiveRun
|
| Self::PositiveRun
|
||||||
| Self::PositiveLoop
|
| Self::PositiveLoop
|
||||||
| Self::PositiveFrequency
|
| Self::PositiveFrequency
|
||||||
| Self::PositiveLimitFrequency
|
| Self::PositiveLimitFrequency
|
||||||
| Self::PositiveFastFrequency
|
| Self::PositiveFastFrequency
|
||||||
| Self::PositiveSet
|
| Self::PositiveSet
|
||||||
| Self::ToPositiveSet => vec!["Positive System"],
|
| Self::ToPositiveSet => vec!["Positive System"],
|
||||||
| Self::Trace => vec!["Trace", "System"],
|
| Self::Trace => vec!["Trace", "System"],
|
||||||
| Self::PositiveTrace => vec!["Trace", "Positive System"],
|
| Self::PositiveTrace => vec!["Trace", "Positive System"],
|
||||||
| Self::SliceTrace
|
| Self::SliceTrace | Self::PositiveSliceTrace => vec!["Trace"],
|
||||||
| Self::PositiveSliceTrace => vec!["Trace"],
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1097,9 +1092,9 @@ impl NodeDataTrait for NodeData {
|
|||||||
match (is_active, graph[node_id].user_data.template) {
|
match (is_active, graph[node_id].user_data.template) {
|
||||||
| (_, NodeInstruction::SaveString) => {
|
| (_, NodeInstruction::SaveString) => {
|
||||||
if ui.button("Write").clicked() {
|
if ui.button("Write").clicked() {
|
||||||
responses.push(NodeResponse::User(CustomResponse::SaveToFile(
|
responses.push(NodeResponse::User(
|
||||||
node_id,
|
CustomResponse::SaveToFile(node_id),
|
||||||
)));
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
| (true, _) => {
|
| (true, _) => {
|
||||||
@ -1108,8 +1103,9 @@ impl NodeDataTrait for NodeData {
|
|||||||
)
|
)
|
||||||
.fill(egui::Color32::GOLD);
|
.fill(egui::Color32::GOLD);
|
||||||
if ui.add(button).clicked() {
|
if ui.add(button).clicked() {
|
||||||
responses
|
responses.push(NodeResponse::User(
|
||||||
.push(NodeResponse::User(CustomResponse::ClearActiveNode));
|
CustomResponse::ClearActiveNode,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
| (false, _) =>
|
| (false, _) =>
|
||||||
@ -1412,7 +1408,7 @@ fn create_output(ng: &mut AppHandle, ctx: &egui::Context) -> LayoutJob {
|
|||||||
ctx,
|
ctx,
|
||||||
),
|
),
|
||||||
&ng.user_state.translator,
|
&ng.user_state.translator,
|
||||||
ctx
|
ctx,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
| (None, None) => {
|
| (None, None) => {
|
||||||
@ -1431,7 +1427,7 @@ fn create_output(ng: &mut AppHandle, ctx: &egui::Context) -> LayoutJob {
|
|||||||
fn get_layout(
|
fn get_layout(
|
||||||
value: anyhow::Result<BasicValue>,
|
value: anyhow::Result<BasicValue>,
|
||||||
translator: &rsprocess::translator::Translator,
|
translator: &rsprocess::translator::Translator,
|
||||||
ctx: &egui::Context
|
ctx: &egui::Context,
|
||||||
) -> LayoutJob {
|
) -> LayoutJob {
|
||||||
let mut text = LayoutJob::default();
|
let mut text = LayoutJob::default();
|
||||||
|
|
||||||
@ -1439,7 +1435,8 @@ fn get_layout(
|
|||||||
| Ok(value) => match value {
|
| Ok(value) => match value {
|
||||||
| BasicValue::SaveString { path, value: _ } => text.append(
|
| BasicValue::SaveString { path, value: _ } => text.append(
|
||||||
&format!("Saving to file \"{}\"", path),
|
&format!("Saving to file \"{}\"", path),
|
||||||
0., Default::default()
|
0.,
|
||||||
|
Default::default(),
|
||||||
),
|
),
|
||||||
| BasicValue::Error { value } => {
|
| BasicValue::Error { value } => {
|
||||||
text = value;
|
text = value;
|
||||||
@ -1451,7 +1448,8 @@ fn get_layout(
|
|||||||
text.append(&value, 0., Default::default()),
|
text.append(&value, 0., Default::default()),
|
||||||
| BasicValue::System { value } => text.append(
|
| BasicValue::System { value } => text.append(
|
||||||
&format!("{}", Formatter::from(translator, &value)),
|
&format!("{}", Formatter::from(translator, &value)),
|
||||||
0., Default::default(),
|
0.,
|
||||||
|
Default::default(),
|
||||||
),
|
),
|
||||||
| BasicValue::PositiveInt { value } =>
|
| BasicValue::PositiveInt { value } =>
|
||||||
text.append(&format!("{value}"), 0., Default::default()),
|
text.append(&format!("{value}"), 0., Default::default()),
|
||||||
@ -1465,7 +1463,8 @@ fn get_layout(
|
|||||||
weight,
|
weight,
|
||||||
Formatter::from(translator, set)
|
Formatter::from(translator, set)
|
||||||
),
|
),
|
||||||
0., Default::default(),
|
0.,
|
||||||
|
Default::default(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1475,11 +1474,13 @@ fn get_layout(
|
|||||||
value.node_count(),
|
value.node_count(),
|
||||||
value.edge_count()
|
value.edge_count()
|
||||||
),
|
),
|
||||||
0., Default::default(),
|
0.,
|
||||||
|
Default::default(),
|
||||||
),
|
),
|
||||||
| BasicValue::GroupingFunction { value } => text.append(
|
| BasicValue::GroupingFunction { value } => text.append(
|
||||||
&format!("{}", Formatter::from(translator, &value)),
|
&format!("{}", Formatter::from(translator, &value)),
|
||||||
0., Default::default(),
|
0.,
|
||||||
|
Default::default(),
|
||||||
),
|
),
|
||||||
| BasicValue::DisplayNode { value } =>
|
| BasicValue::DisplayNode { value } =>
|
||||||
text.append(&format!("{value:?}"), 0., TextFormat {
|
text.append(&format!("{value:?}"), 0., TextFormat {
|
||||||
@ -1493,15 +1494,18 @@ fn get_layout(
|
|||||||
text.append(&format!("{value:?}"), 0., Default::default()),
|
text.append(&format!("{value:?}"), 0., Default::default()),
|
||||||
| BasicValue::Environment { value } => text.append(
|
| BasicValue::Environment { value } => text.append(
|
||||||
&format!("{}", Formatter::from(translator, &value)),
|
&format!("{}", Formatter::from(translator, &value)),
|
||||||
0., Default::default(),
|
0.,
|
||||||
|
Default::default(),
|
||||||
),
|
),
|
||||||
| BasicValue::Set { value } => text.append(
|
| BasicValue::Set { value } => text.append(
|
||||||
&format!("{}", Formatter::from(translator, &value)),
|
&format!("{}", Formatter::from(translator, &value)),
|
||||||
0., Default::default(),
|
0.,
|
||||||
|
Default::default(),
|
||||||
),
|
),
|
||||||
| BasicValue::Context { value } => text.append(
|
| BasicValue::Context { value } => text.append(
|
||||||
&format!("{}", Formatter::from(translator, &value)),
|
&format!("{}", Formatter::from(translator, &value)),
|
||||||
0., Default::default(),
|
0.,
|
||||||
|
Default::default(),
|
||||||
),
|
),
|
||||||
| BasicValue::Reactions { value } => {
|
| BasicValue::Reactions { value } => {
|
||||||
text.append("(", 0., TextFormat {
|
text.append("(", 0., TextFormat {
|
||||||
@ -1512,12 +1516,14 @@ fn get_layout(
|
|||||||
if i.peek().is_some() {
|
if i.peek().is_some() {
|
||||||
text.append(
|
text.append(
|
||||||
&format!("{}, ", Formatter::from(translator, r)),
|
&format!("{}, ", Formatter::from(translator, r)),
|
||||||
0., Default::default(),
|
0.,
|
||||||
|
Default::default(),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
text.append(
|
text.append(
|
||||||
&format!("{}", Formatter::from(translator, r)),
|
&format!("{}", Formatter::from(translator, r)),
|
||||||
0., Default::default(),
|
0.,
|
||||||
|
Default::default(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1525,13 +1531,15 @@ fn get_layout(
|
|||||||
},
|
},
|
||||||
| BasicValue::PositiveSystem { value } => text.append(
|
| BasicValue::PositiveSystem { value } => text.append(
|
||||||
&format!("{}", Formatter::from(translator, &value)),
|
&format!("{}", Formatter::from(translator, &value)),
|
||||||
0., Default::default(),
|
0.,
|
||||||
|
Default::default(),
|
||||||
),
|
),
|
||||||
| BasicValue::Trace { value } => text.append(
|
| BasicValue::Trace { value } => text.append(
|
||||||
&format!("{}", Formatter::from(translator, &value)),
|
&format!("{}", Formatter::from(translator, &value)),
|
||||||
0.,
|
0.,
|
||||||
TextFormat {
|
TextFormat {
|
||||||
font_id: eframe::egui::TextStyle::Monospace.resolve(&ctx.style()),
|
font_id: eframe::egui::TextStyle::Monospace
|
||||||
|
.resolve(&ctx.style()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -1539,13 +1547,15 @@ fn get_layout(
|
|||||||
&format!("{}", Formatter::from(translator, &value)),
|
&format!("{}", Formatter::from(translator, &value)),
|
||||||
0.,
|
0.,
|
||||||
TextFormat {
|
TextFormat {
|
||||||
font_id: eframe::egui::TextStyle::Monospace.resolve(&ctx.style()),
|
font_id: eframe::egui::TextStyle::Monospace
|
||||||
|
.resolve(&ctx.style()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
| BasicValue::PositiveSet { value } => text.append(
|
| BasicValue::PositiveSet { value } => text.append(
|
||||||
&format!("{}", Formatter::from(translator, &value)),
|
&format!("{}", Formatter::from(translator, &value)),
|
||||||
0., Default::default(),
|
0.,
|
||||||
|
Default::default(),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
| Err(err) => {
|
| Err(err) => {
|
||||||
|
|||||||
@ -7,7 +7,7 @@ use rsprocess::system::{ExtensionsSystem, LoopSystem};
|
|||||||
use rsprocess::translator::Formatter;
|
use rsprocess::translator::Formatter;
|
||||||
|
|
||||||
use crate::app::{
|
use crate::app::{
|
||||||
BasicDataType, NodeData, NodeInstruction, BasicValue, OutputsCache,
|
BasicDataType, BasicValue, NodeData, NodeInstruction, OutputsCache,
|
||||||
};
|
};
|
||||||
use crate::helper;
|
use crate::helper;
|
||||||
|
|
||||||
@ -164,6 +164,8 @@ fn generate_to_evaluate(
|
|||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn process_template(
|
fn process_template(
|
||||||
graph: &MyGraph,
|
graph: &MyGraph,
|
||||||
@ -175,7 +177,6 @@ fn process_template(
|
|||||||
to_ret: &mut Option<BasicValue>,
|
to_ret: &mut Option<BasicValue>,
|
||||||
ctx: &eframe::egui::Context,
|
ctx: &eframe::egui::Context,
|
||||||
) -> anyhow::Result<Option<BasicValue>> {
|
) -> anyhow::Result<Option<BasicValue>> {
|
||||||
|
|
||||||
// macro that builds a tuple of retrieved values from cache
|
// macro that builds a tuple of retrieved values from cache
|
||||||
// same order as in the definition of the inputs
|
// same order as in the definition of the inputs
|
||||||
macro_rules! retrieve_from_cache {
|
macro_rules! retrieve_from_cache {
|
||||||
@ -284,7 +285,8 @@ fn process_template(
|
|||||||
|
|
||||||
(@as_expr $e:expr) => {$e};
|
(@as_expr $e:expr) => {$e};
|
||||||
[0] => {
|
[0] => {
|
||||||
compile_error!("Macro returns a value or a tuple, supply an integer greater than 0")
|
compile_error!("Macro returns a value or a tuple, supply an \
|
||||||
|
integer greater than 0")
|
||||||
};
|
};
|
||||||
[1] => {
|
[1] => {
|
||||||
outputs_cache.retrieve_cache_output(
|
outputs_cache.retrieve_cache_output(
|
||||||
@ -300,11 +302,15 @@ fn process_template(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// creates a vector of the hash of the inputs
|
||||||
|
macro_rules! hash_inputs {
|
||||||
|
($($i:ident),*) => (vec![$(OutputsCache::calculate_hash(&$i)),*]);
|
||||||
|
}
|
||||||
|
|
||||||
match template {
|
match template {
|
||||||
| NodeInstruction::String => {
|
| NodeInstruction::String => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::String { value: _ } = s {
|
if let BasicValue::String { value: _ } = s {
|
||||||
let res = s;
|
let res = s;
|
||||||
@ -321,8 +327,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::Path => {
|
| NodeInstruction::Path => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::String { value } = s {
|
if let BasicValue::String { value } = s {
|
||||||
let res = BasicValue::Path { value };
|
let res = BasicValue::Path { value };
|
||||||
@ -339,20 +344,20 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::ReadPath => {
|
| NodeInstruction::ReadPath => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::Path { value } = s {
|
if let BasicValue::Path { value } = s {
|
||||||
let file = match std::fs::read_to_string(value) {
|
let file = match std::fs::read_to_string(value) {
|
||||||
Ok(f) => f,
|
| Ok(f) => f,
|
||||||
Err(e) =>
|
| Err(e) =>
|
||||||
return Ok(Some(BasicValue::Error {
|
return Ok(Some(BasicValue::Error {
|
||||||
value: helper::reformat_generic_error(e.to_string(), ctx)
|
value: helper::reformat_generic_error(
|
||||||
}))
|
e.to_string(),
|
||||||
};
|
ctx,
|
||||||
let res = BasicValue::String {
|
),
|
||||||
value: file
|
})),
|
||||||
};
|
};
|
||||||
|
let res = BasicValue::String { value: file };
|
||||||
outputs_cache.populate_output(
|
outputs_cache.populate_output(
|
||||||
graph,
|
graph,
|
||||||
node_id,
|
node_id,
|
||||||
@ -366,8 +371,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::System => {
|
| NodeInstruction::System => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::String { value } = s {
|
if let BasicValue::String { value } = s {
|
||||||
let res = grammar_separated::grammar::SystemParser::new()
|
let res = grammar_separated::grammar::SystemParser::new()
|
||||||
@ -398,8 +402,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::Statistics => {
|
| NodeInstruction::Statistics => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::System { value } = s {
|
if let BasicValue::System { value } = s {
|
||||||
let res = BasicValue::String {
|
let res = BasicValue::String {
|
||||||
@ -418,11 +421,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::Target => {
|
| NodeInstruction::Target => {
|
||||||
let (s, i) = retrieve_from_cache![2];
|
let (s, i) = retrieve_from_cache![2];
|
||||||
|
let hash_inputs = hash_inputs!(s, i);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&s),
|
|
||||||
OutputsCache::calculate_hash(&i),
|
|
||||||
];
|
|
||||||
match (s, i) {
|
match (s, i) {
|
||||||
| (
|
| (
|
||||||
BasicValue::System { value: s },
|
BasicValue::System { value: s },
|
||||||
@ -463,11 +463,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::Run => {
|
| NodeInstruction::Run => {
|
||||||
let (s, i) = retrieve_from_cache![2];
|
let (s, i) = retrieve_from_cache![2];
|
||||||
|
let hash_inputs = hash_inputs!(s, i);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&s),
|
|
||||||
OutputsCache::calculate_hash(&i),
|
|
||||||
];
|
|
||||||
match (s, i) {
|
match (s, i) {
|
||||||
| (
|
| (
|
||||||
BasicValue::System { value: s },
|
BasicValue::System { value: s },
|
||||||
@ -512,11 +509,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::Loop => {
|
| NodeInstruction::Loop => {
|
||||||
let (s, i) = retrieve_from_cache![2];
|
let (s, i) = retrieve_from_cache![2];
|
||||||
|
let hash_inputs = hash_inputs!(s, i);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&s),
|
|
||||||
OutputsCache::calculate_hash(&i),
|
|
||||||
];
|
|
||||||
match (s, i) {
|
match (s, i) {
|
||||||
| (
|
| (
|
||||||
BasicValue::System { value: sys },
|
BasicValue::System { value: sys },
|
||||||
@ -556,8 +550,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::Symbol => {
|
| NodeInstruction::Symbol => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
|
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
if let BasicValue::String { value } = s {
|
if let BasicValue::String { value } = s {
|
||||||
let res = BasicValue::Symbol { value };
|
let res = BasicValue::Symbol { value };
|
||||||
outputs_cache.populate_output(
|
outputs_cache.populate_output(
|
||||||
@ -573,8 +567,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::Frequency => {
|
| NodeInstruction::Frequency => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::System { value } = s {
|
if let BasicValue::System { value } = s {
|
||||||
let res = match rsprocess::frequency::Frequency::naive_frequency(
|
let res = match rsprocess::frequency::Frequency::naive_frequency(
|
||||||
@ -601,11 +594,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::LimitFrequency => {
|
| NodeInstruction::LimitFrequency => {
|
||||||
let (sys, exp) = retrieve_from_cache![2];
|
let (sys, exp) = retrieve_from_cache![2];
|
||||||
|
let hash_inputs = hash_inputs!(sys, exp);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&sys),
|
|
||||||
OutputsCache::calculate_hash(&exp),
|
|
||||||
];
|
|
||||||
match (sys, exp) {
|
match (sys, exp) {
|
||||||
| (
|
| (
|
||||||
BasicValue::System { value: sys },
|
BasicValue::System { value: sys },
|
||||||
@ -644,8 +634,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::Experiment => {
|
| NodeInstruction::Experiment => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
|
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
if let BasicValue::String { value } = s {
|
if let BasicValue::String { value } = s {
|
||||||
let value =
|
let value =
|
||||||
match grammar_separated::grammar::ExperimentParser::new()
|
match grammar_separated::grammar::ExperimentParser::new()
|
||||||
@ -671,11 +661,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::FastFrequency => {
|
| NodeInstruction::FastFrequency => {
|
||||||
let (sys, exp) = retrieve_from_cache![2];
|
let (sys, exp) = retrieve_from_cache![2];
|
||||||
|
let hash_inputs = hash_inputs!(sys, exp);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&sys),
|
|
||||||
OutputsCache::calculate_hash(&exp),
|
|
||||||
];
|
|
||||||
match (sys, exp) {
|
match (sys, exp) {
|
||||||
| (
|
| (
|
||||||
BasicValue::System { value: sys },
|
BasicValue::System { value: sys },
|
||||||
@ -715,12 +702,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::BisimilarityKanellakisSmolka => {
|
| NodeInstruction::BisimilarityKanellakisSmolka => {
|
||||||
let (graph_1, graph_2, grouping) = retrieve_from_cache![3];
|
let (graph_1, graph_2, grouping) = retrieve_from_cache![3];
|
||||||
|
let hash_inputs = hash_inputs!(graph_1, graph_2, grouping);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&graph_1),
|
|
||||||
OutputsCache::calculate_hash(&graph_2),
|
|
||||||
OutputsCache::calculate_hash(&grouping),
|
|
||||||
];
|
|
||||||
match (graph_1, graph_2, grouping) {
|
match (graph_1, graph_2, grouping) {
|
||||||
| (
|
| (
|
||||||
BasicValue::Graph { value: graph_1 },
|
BasicValue::Graph { value: graph_1 },
|
||||||
@ -756,8 +739,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::GroupFunction => {
|
| NodeInstruction::GroupFunction => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::String { value } = s {
|
if let BasicValue::String { value } = s {
|
||||||
let res = grammar_separated::assert::AssertParser::new()
|
let res = grammar_separated::assert::AssertParser::new()
|
||||||
@ -788,12 +770,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::BisimilarityPaigeTarjanNoLabels => {
|
| NodeInstruction::BisimilarityPaigeTarjanNoLabels => {
|
||||||
let (graph_1, graph_2, grouping) = retrieve_from_cache![3];
|
let (graph_1, graph_2, grouping) = retrieve_from_cache![3];
|
||||||
|
let hash_inputs = hash_inputs!(graph_1, graph_2, grouping);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&graph_1),
|
|
||||||
OutputsCache::calculate_hash(&graph_2),
|
|
||||||
OutputsCache::calculate_hash(&grouping),
|
|
||||||
];
|
|
||||||
match (graph_1, graph_2, grouping) {
|
match (graph_1, graph_2, grouping) {
|
||||||
| (
|
| (
|
||||||
BasicValue::Graph { value: graph_1 },
|
BasicValue::Graph { value: graph_1 },
|
||||||
@ -829,12 +807,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::BisimilarityPaigeTarjan => {
|
| NodeInstruction::BisimilarityPaigeTarjan => {
|
||||||
let (graph_1, graph_2, grouping) = retrieve_from_cache![3];
|
let (graph_1, graph_2, grouping) = retrieve_from_cache![3];
|
||||||
|
let hash_inputs = hash_inputs!(graph_1, graph_2, grouping);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&graph_1),
|
|
||||||
OutputsCache::calculate_hash(&graph_2),
|
|
||||||
OutputsCache::calculate_hash(&grouping),
|
|
||||||
];
|
|
||||||
match (graph_1, graph_2, grouping) {
|
match (graph_1, graph_2, grouping) {
|
||||||
| (
|
| (
|
||||||
BasicValue::Graph { value: graph_1 },
|
BasicValue::Graph { value: graph_1 },
|
||||||
@ -873,8 +847,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::SystemGraph => {
|
| NodeInstruction::SystemGraph => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::System { value } = s {
|
if let BasicValue::System { value } = s {
|
||||||
let value = match value.digraph() {
|
let value = match value.digraph() {
|
||||||
@ -915,16 +888,21 @@ fn process_template(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
| NodeInstruction::Dot => {
|
| NodeInstruction::Dot => {
|
||||||
let (input_graph, display_node, display_edge, color_node, color_edge) =
|
let (
|
||||||
retrieve_from_cache![5];
|
input_graph,
|
||||||
|
display_node,
|
||||||
|
display_edge,
|
||||||
|
color_node,
|
||||||
|
color_edge,
|
||||||
|
) = retrieve_from_cache![5];
|
||||||
|
let hash_inputs = hash_inputs!(
|
||||||
|
input_graph,
|
||||||
|
display_node,
|
||||||
|
display_edge,
|
||||||
|
color_node,
|
||||||
|
color_edge
|
||||||
|
);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&input_graph),
|
|
||||||
OutputsCache::calculate_hash(&display_node),
|
|
||||||
OutputsCache::calculate_hash(&display_edge),
|
|
||||||
OutputsCache::calculate_hash(&color_node),
|
|
||||||
OutputsCache::calculate_hash(&color_edge),
|
|
||||||
];
|
|
||||||
match (
|
match (
|
||||||
input_graph,
|
input_graph,
|
||||||
display_node,
|
display_node,
|
||||||
@ -986,8 +964,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::DisplayNode => {
|
| NodeInstruction::DisplayNode => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::String { value } = s {
|
if let BasicValue::String { value } = s {
|
||||||
let res =
|
let res =
|
||||||
@ -1019,8 +996,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::DisplayEdge => {
|
| NodeInstruction::DisplayEdge => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::String { value } = s {
|
if let BasicValue::String { value } = s {
|
||||||
let res =
|
let res =
|
||||||
@ -1052,8 +1028,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::ColorNode => {
|
| NodeInstruction::ColorNode => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::String { value } = s {
|
if let BasicValue::String { value } = s {
|
||||||
let res =
|
let res =
|
||||||
@ -1085,8 +1060,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::ColorEdge => {
|
| NodeInstruction::ColorEdge => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::String { value } = s {
|
if let BasicValue::String { value } = s {
|
||||||
let res =
|
let res =
|
||||||
@ -1117,13 +1091,11 @@ fn process_template(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
| NodeInstruction::GraphML => {
|
| NodeInstruction::GraphML => {
|
||||||
let (input_graph, display_node, display_edge) = retrieve_from_cache![3];
|
let (input_graph, display_node, display_edge) =
|
||||||
|
retrieve_from_cache![3];
|
||||||
|
let hash_inputs =
|
||||||
|
hash_inputs!(input_graph, display_node, display_edge);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&input_graph),
|
|
||||||
OutputsCache::calculate_hash(&display_node),
|
|
||||||
OutputsCache::calculate_hash(&display_edge),
|
|
||||||
];
|
|
||||||
match (input_graph, display_node, display_edge) {
|
match (input_graph, display_node, display_edge) {
|
||||||
| (
|
| (
|
||||||
BasicValue::Graph { value: input_graph },
|
BasicValue::Graph { value: input_graph },
|
||||||
@ -1166,15 +1138,18 @@ fn process_template(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
| NodeInstruction::ComposeSystem => {
|
| NodeInstruction::ComposeSystem => {
|
||||||
let (input_env, input_initial_etities, input_context, input_reactions)
|
let (
|
||||||
= retrieve_from_cache![4];
|
input_env,
|
||||||
|
input_initial_etities,
|
||||||
let hash_inputs = vec![
|
input_context,
|
||||||
OutputsCache::calculate_hash(&input_env),
|
input_reactions,
|
||||||
OutputsCache::calculate_hash(&input_initial_etities),
|
) = retrieve_from_cache![4];
|
||||||
OutputsCache::calculate_hash(&input_context),
|
let hash_inputs = hash_inputs!(
|
||||||
OutputsCache::calculate_hash(&input_reactions),
|
input_env,
|
||||||
];
|
input_initial_etities,
|
||||||
|
input_context,
|
||||||
|
input_reactions
|
||||||
|
);
|
||||||
|
|
||||||
match (
|
match (
|
||||||
input_env,
|
input_env,
|
||||||
@ -1211,8 +1186,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::Environment => {
|
| NodeInstruction::Environment => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::String { value } = s {
|
if let BasicValue::String { value } = s {
|
||||||
let res = grammar_separated::grammar::EnvironmentParser::new()
|
let res = grammar_separated::grammar::EnvironmentParser::new()
|
||||||
@ -1243,8 +1217,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::Set => {
|
| NodeInstruction::Set => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::String { value } = s {
|
if let BasicValue::String { value } = s {
|
||||||
let res = grammar_separated::grammar::SetParser::new()
|
let res = grammar_separated::grammar::SetParser::new()
|
||||||
@ -1275,8 +1248,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::Context => {
|
| NodeInstruction::Context => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::String { value } = s {
|
if let BasicValue::String { value } = s {
|
||||||
let res = grammar_separated::grammar::ContextParser::new()
|
let res = grammar_separated::grammar::ContextParser::new()
|
||||||
@ -1307,8 +1279,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::Reactions => {
|
| NodeInstruction::Reactions => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::String { value } = s {
|
if let BasicValue::String { value } = s {
|
||||||
let res = grammar_separated::grammar::ReactionsParser::new()
|
let res = grammar_separated::grammar::ReactionsParser::new()
|
||||||
@ -1339,8 +1310,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::PositiveSystem => {
|
| NodeInstruction::PositiveSystem => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::System { value } = s {
|
if let BasicValue::System { value } = s {
|
||||||
let res = BasicValue::PositiveSystem {
|
let res = BasicValue::PositiveSystem {
|
||||||
@ -1359,11 +1329,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::PositiveTarget => {
|
| NodeInstruction::PositiveTarget => {
|
||||||
let (s, i) = retrieve_from_cache![2];
|
let (s, i) = retrieve_from_cache![2];
|
||||||
|
let hash_inputs = hash_inputs!(s, i);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&s),
|
|
||||||
OutputsCache::calculate_hash(&i),
|
|
||||||
];
|
|
||||||
match (s, i) {
|
match (s, i) {
|
||||||
| (
|
| (
|
||||||
BasicValue::PositiveSystem { value: s },
|
BasicValue::PositiveSystem { value: s },
|
||||||
@ -1404,11 +1371,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::PositiveRun => {
|
| NodeInstruction::PositiveRun => {
|
||||||
let (s, i) = retrieve_from_cache![2];
|
let (s, i) = retrieve_from_cache![2];
|
||||||
|
let hash_inputs = hash_inputs!(s, i);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&s),
|
|
||||||
OutputsCache::calculate_hash(&i),
|
|
||||||
];
|
|
||||||
match (s, i) {
|
match (s, i) {
|
||||||
| (
|
| (
|
||||||
BasicValue::PositiveSystem { value: s },
|
BasicValue::PositiveSystem { value: s },
|
||||||
@ -1453,11 +1417,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::PositiveLoop => {
|
| NodeInstruction::PositiveLoop => {
|
||||||
let (s, i) = retrieve_from_cache![2];
|
let (s, i) = retrieve_from_cache![2];
|
||||||
|
let hash_inputs = hash_inputs!(s, i);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&s),
|
|
||||||
OutputsCache::calculate_hash(&i),
|
|
||||||
];
|
|
||||||
match (s, i) {
|
match (s, i) {
|
||||||
| (
|
| (
|
||||||
BasicValue::PositiveSystem { value: sys },
|
BasicValue::PositiveSystem { value: sys },
|
||||||
@ -1497,8 +1458,7 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::PositiveFrequency => {
|
| NodeInstruction::PositiveFrequency => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::PositiveSystem { value } = s {
|
if let BasicValue::PositiveSystem { value } = s {
|
||||||
let res = match rsprocess::frequency::PositiveFrequency::naive_frequency(&value) {
|
let res = match rsprocess::frequency::PositiveFrequency::naive_frequency(&value) {
|
||||||
@ -1523,11 +1483,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::PositiveLimitFrequency => {
|
| NodeInstruction::PositiveLimitFrequency => {
|
||||||
let (sys, exp) = retrieve_from_cache![2];
|
let (sys, exp) = retrieve_from_cache![2];
|
||||||
|
let hash_inputs = hash_inputs!(sys, exp);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&sys),
|
|
||||||
OutputsCache::calculate_hash(&exp),
|
|
||||||
];
|
|
||||||
match (sys, exp) {
|
match (sys, exp) {
|
||||||
| (
|
| (
|
||||||
BasicValue::PositiveSystem { value: sys },
|
BasicValue::PositiveSystem { value: sys },
|
||||||
@ -1567,11 +1524,8 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::PositiveFastFrequency => {
|
| NodeInstruction::PositiveFastFrequency => {
|
||||||
let (sys, exp) = retrieve_from_cache![2];
|
let (sys, exp) = retrieve_from_cache![2];
|
||||||
|
let hash_inputs = hash_inputs!(sys, exp);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&sys),
|
|
||||||
OutputsCache::calculate_hash(&exp),
|
|
||||||
];
|
|
||||||
match (sys, exp) {
|
match (sys, exp) {
|
||||||
| (
|
| (
|
||||||
BasicValue::PositiveSystem { value: sys },
|
BasicValue::PositiveSystem { value: sys },
|
||||||
@ -1612,27 +1566,25 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::Trace => {
|
| NodeInstruction::Trace => {
|
||||||
let (s, limit) = retrieve_from_cache![2];
|
let (s, limit) = retrieve_from_cache![2];
|
||||||
|
let hash_inputs = hash_inputs!(s, limit);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&s),
|
|
||||||
OutputsCache::calculate_hash(&limit),
|
|
||||||
];
|
|
||||||
match (s, limit) {
|
match (s, limit) {
|
||||||
| (BasicValue::System { value: s }, BasicValue::PositiveInt { value: limit }) => {
|
| (
|
||||||
|
BasicValue::System { value: s },
|
||||||
|
BasicValue::PositiveInt { value: limit },
|
||||||
|
) => {
|
||||||
let trace = if limit == 0 {
|
let trace = if limit == 0 {
|
||||||
match s.slice_trace() {
|
match s.slice_trace() {
|
||||||
Ok(t) => t,
|
| Ok(t) => t,
|
||||||
Err(e) => anyhow::bail!(e),
|
| Err(e) => anyhow::bail!(e),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
match s.slice_trace_limit(limit) {
|
match s.slice_trace_limit(limit) {
|
||||||
Ok(t) => t,
|
| Ok(t) => t,
|
||||||
Err(e) => anyhow::bail!(e),
|
| Err(e) => anyhow::bail!(e),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let res = BasicValue::Trace {
|
let res = BasicValue::Trace { value: trace };
|
||||||
value: trace,
|
|
||||||
};
|
|
||||||
outputs_cache.populate_output(
|
outputs_cache.populate_output(
|
||||||
graph,
|
graph,
|
||||||
node_id,
|
node_id,
|
||||||
@ -1645,35 +1597,30 @@ fn process_template(
|
|||||||
anyhow::bail!("Not a positive integer"),
|
anyhow::bail!("Not a positive integer"),
|
||||||
| (_, BasicValue::PositiveInt { value: _ }) =>
|
| (_, BasicValue::PositiveInt { value: _ }) =>
|
||||||
anyhow::bail!("Not a system"),
|
anyhow::bail!("Not a system"),
|
||||||
| (_, _) =>
|
| (_, _) => anyhow::bail!("Inputs all wrong"),
|
||||||
anyhow::bail!("Inputs all wrong"),
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
| NodeInstruction::PositiveTrace => {
|
| NodeInstruction::PositiveTrace => {
|
||||||
let (s, limit) = retrieve_from_cache![2];
|
let (s, limit) = retrieve_from_cache![2];
|
||||||
|
let hash_inputs = hash_inputs!(s, limit);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&s),
|
|
||||||
OutputsCache::calculate_hash(&limit),
|
|
||||||
];
|
|
||||||
match (s, limit) {
|
match (s, limit) {
|
||||||
| (BasicValue::PositiveSystem { value: s },
|
| (
|
||||||
BasicValue::PositiveInt { value: limit }) =>
|
BasicValue::PositiveSystem { value: s },
|
||||||
{
|
BasicValue::PositiveInt { value: limit },
|
||||||
|
) => {
|
||||||
let trace = if limit == 0 {
|
let trace = if limit == 0 {
|
||||||
match s.slice_trace() {
|
match s.slice_trace() {
|
||||||
Ok(t) => t,
|
| Ok(t) => t,
|
||||||
Err(e) => anyhow::bail!(e),
|
| Err(e) => anyhow::bail!(e),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
match s.slice_trace_limit(limit) {
|
match s.slice_trace_limit(limit) {
|
||||||
Ok(t) => t,
|
| Ok(t) => t,
|
||||||
Err(e) => anyhow::bail!(e),
|
| Err(e) => anyhow::bail!(e),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let res = BasicValue::PositiveTrace {
|
let res = BasicValue::PositiveTrace { value: trace };
|
||||||
value: trace,
|
|
||||||
};
|
|
||||||
outputs_cache.populate_output(
|
outputs_cache.populate_output(
|
||||||
graph,
|
graph,
|
||||||
node_id,
|
node_id,
|
||||||
@ -1686,29 +1633,24 @@ fn process_template(
|
|||||||
anyhow::bail!("Not a positive integer"),
|
anyhow::bail!("Not a positive integer"),
|
||||||
| (_, BasicValue::PositiveInt { value: _ }) =>
|
| (_, BasicValue::PositiveInt { value: _ }) =>
|
||||||
anyhow::bail!("Not a positive system"),
|
anyhow::bail!("Not a positive system"),
|
||||||
| (_, _) =>
|
| (_, _) => anyhow::bail!("Inputs all wrong"),
|
||||||
anyhow::bail!("Inputs all wrong"),
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
| NodeInstruction::SliceTrace => {
|
| NodeInstruction::SliceTrace => {
|
||||||
let (trace, set) = retrieve_from_cache![2];
|
let (trace, set) = retrieve_from_cache![2];
|
||||||
|
let hash_inputs = hash_inputs!(trace, set);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&trace),
|
|
||||||
OutputsCache::calculate_hash(&set),
|
|
||||||
];
|
|
||||||
match (trace, set) {
|
match (trace, set) {
|
||||||
| (BasicValue::Trace { value: trace },
|
| (
|
||||||
BasicValue::Set { value: set }) =>
|
BasicValue::Trace { value: trace },
|
||||||
{
|
BasicValue::Set { value: set },
|
||||||
|
) => {
|
||||||
let new_trace = match trace.slice(set) {
|
let new_trace = match trace.slice(set) {
|
||||||
Ok(t) => t,
|
| Ok(t) => t,
|
||||||
Err(e) => anyhow::bail!(e),
|
| Err(e) => anyhow::bail!(e),
|
||||||
};
|
};
|
||||||
|
|
||||||
let res = BasicValue::Trace {
|
let res = BasicValue::Trace { value: new_trace };
|
||||||
value: new_trace,
|
|
||||||
};
|
|
||||||
outputs_cache.populate_output(
|
outputs_cache.populate_output(
|
||||||
graph,
|
graph,
|
||||||
node_id,
|
node_id,
|
||||||
@ -1721,29 +1663,24 @@ fn process_template(
|
|||||||
anyhow::bail!("Not a set"),
|
anyhow::bail!("Not a set"),
|
||||||
| (_, BasicValue::Set { value: _ }) =>
|
| (_, BasicValue::Set { value: _ }) =>
|
||||||
anyhow::bail!("Not a trace"),
|
anyhow::bail!("Not a trace"),
|
||||||
| (_, _) =>
|
| (_, _) => anyhow::bail!("Inputs all wrong"),
|
||||||
anyhow::bail!("Inputs all wrong"),
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
| NodeInstruction::PositiveSliceTrace => {
|
| NodeInstruction::PositiveSliceTrace => {
|
||||||
let (trace, set) = retrieve_from_cache![2];
|
let (trace, set) = retrieve_from_cache![2];
|
||||||
|
let hash_inputs = hash_inputs!(trace, set);
|
||||||
|
|
||||||
let hash_inputs = vec![
|
|
||||||
OutputsCache::calculate_hash(&trace),
|
|
||||||
OutputsCache::calculate_hash(&set),
|
|
||||||
];
|
|
||||||
match (trace, set) {
|
match (trace, set) {
|
||||||
| (BasicValue::PositiveTrace { value: trace },
|
| (
|
||||||
BasicValue::PositiveSet { value: set }) =>
|
BasicValue::PositiveTrace { value: trace },
|
||||||
{
|
BasicValue::PositiveSet { value: set },
|
||||||
|
) => {
|
||||||
let new_trace = match trace.slice(set) {
|
let new_trace = match trace.slice(set) {
|
||||||
Ok(t) => t,
|
| Ok(t) => t,
|
||||||
Err(e) => anyhow::bail!(e),
|
| Err(e) => anyhow::bail!(e),
|
||||||
};
|
};
|
||||||
|
|
||||||
let res = BasicValue::PositiveTrace {
|
let res = BasicValue::PositiveTrace { value: new_trace };
|
||||||
value: new_trace,
|
|
||||||
};
|
|
||||||
outputs_cache.populate_output(
|
outputs_cache.populate_output(
|
||||||
graph,
|
graph,
|
||||||
node_id,
|
node_id,
|
||||||
@ -1756,14 +1693,13 @@ fn process_template(
|
|||||||
anyhow::bail!("Not a set"),
|
anyhow::bail!("Not a set"),
|
||||||
| (_, BasicValue::PositiveSet { value: _ }) =>
|
| (_, BasicValue::PositiveSet { value: _ }) =>
|
||||||
anyhow::bail!("Not a trace"),
|
anyhow::bail!("Not a trace"),
|
||||||
| (_, _) =>
|
| (_, _) => anyhow::bail!("Inputs all wrong"),
|
||||||
anyhow::bail!("Inputs all wrong"),
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
| NodeInstruction::PositiveSet => {
|
| NodeInstruction::PositiveSet => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
|
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
if let BasicValue::String { value } = s {
|
if let BasicValue::String { value } = s {
|
||||||
let res = grammar_separated::grammar::PositiveSetParser::new()
|
let res = grammar_separated::grammar::PositiveSetParser::new()
|
||||||
.parse(&mut *translator, &value);
|
.parse(&mut *translator, &value);
|
||||||
@ -1793,12 +1729,12 @@ fn process_template(
|
|||||||
},
|
},
|
||||||
| NodeInstruction::ToPositiveSet => {
|
| NodeInstruction::ToPositiveSet => {
|
||||||
let s = retrieve_from_cache![1];
|
let s = retrieve_from_cache![1];
|
||||||
|
let hash_inputs = hash_inputs!(s);
|
||||||
let hash_inputs = vec![OutputsCache::calculate_hash(&s)];
|
|
||||||
|
|
||||||
if let BasicValue::Set { value } = s {
|
if let BasicValue::Set { value } = s {
|
||||||
let res = BasicValue::PositiveSet {
|
let res = BasicValue::PositiveSet {
|
||||||
value: value.to_positive_set(rsprocess::element::IdState::Positive)
|
value: value
|
||||||
|
.to_positive_set(rsprocess::element::IdState::Positive),
|
||||||
};
|
};
|
||||||
outputs_cache.populate_output(
|
outputs_cache.populate_output(
|
||||||
graph,
|
graph,
|
||||||
@ -1810,7 +1746,7 @@ fn process_template(
|
|||||||
} else {
|
} else {
|
||||||
anyhow::bail!("Not a string");
|
anyhow::bail!("Not a string");
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -165,15 +165,11 @@ where
|
|||||||
pub fn reformat_generic_error(
|
pub fn reformat_generic_error(
|
||||||
e: impl Into<String>,
|
e: impl Into<String>,
|
||||||
_ctx: &eframe::egui::Context,
|
_ctx: &eframe::egui::Context,
|
||||||
) -> LayoutJob
|
) -> LayoutJob {
|
||||||
{
|
|
||||||
let text_format = TextFormat {
|
let text_format = TextFormat {
|
||||||
font_id: Default::default(),
|
font_id: Default::default(),
|
||||||
color: Color32::RED,
|
color: Color32::RED,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
LayoutJob::single_section(
|
LayoutJob::single_section(e.into(), text_format)
|
||||||
e.into(),
|
|
||||||
text_format
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user