Skip to content

Commit

Permalink
Merge pull request #16 from oskari1/term_generalisation_with_SharedPa…
Browse files Browse the repository at this point in the history
…rser

Term generalisation with shared parser
  • Loading branch information
JonasAlaif authored Jan 15, 2024
2 parents a8ecd44 + 740cc79 commit 44da0bb
Show file tree
Hide file tree
Showing 18 changed files with 667 additions and 398 deletions.
11 changes: 5 additions & 6 deletions axiom-profiler-GUI/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::cell::RefCell;

use gloo_file::{callbacks::FileReader, FileList};
use results::svg_result::SVGResult;
use smt_log_parser::parsers::z3::z3parser::Z3Parser;
Expand Down Expand Up @@ -172,10 +174,10 @@ enum Route {
Test,
}

pub struct RcParser(std::rc::Rc<Z3Parser>);
pub struct RcParser(std::rc::Rc<RefCell<Z3Parser>>);

impl std::ops::Deref for RcParser {
type Target = Z3Parser;
type Target = RefCell<Z3Parser>;

fn deref(&self) -> &Self::Target {
&self.0
Expand All @@ -196,9 +198,6 @@ impl PartialEq for RcParser {

impl RcParser {
fn new(parser: Z3Parser) -> Self {
Self(std::rc::Rc::new(parser))
}
pub(crate) fn as_ptr(&self) -> *const Z3Parser {
std::rc::Rc::as_ptr(&self.0)
Self(std::rc::Rc::new(RefCell::new(parser)))
}
}
16 changes: 9 additions & 7 deletions axiom-profiler-GUI/src/results/filters/filter_chain.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::svg_result::{UserPermission, DEFAULT_NODE_COUNT};
use super::graph_filters::{Filter, GraphFilter};
use super::graph_filters::{Filter, GraphFilters};
use gloo::console::log;
use yew::prelude::*;
// use gloo_console::log;
Expand All @@ -15,6 +15,7 @@ pub enum Msg {
pub struct FilterChain {
filter_chain: Vec<Filter>,
prev_filter_chain: Vec<Filter>,
add_filters: Callback<Vec<Filter>>,
}

const DEFAULT_FILTER_CHAIN: &[Filter] = &[
Expand All @@ -27,7 +28,6 @@ pub struct FilterChainProps {
pub apply_filter: Callback<Filter>,
pub reset_graph: Callback<()>,
pub render_graph: Callback<UserPermission>,
pub dependency: *const smt_log_parser::Z3Parser,
pub weak_link: WeakComponentLink<FilterChain>,
}

Expand All @@ -36,6 +36,7 @@ impl yew::html::Component for FilterChain {
type Properties = FilterChainProps;

fn create(ctx: &Context<Self>) -> Self {
log!("Creating FilterChain component");
ctx.props()
.weak_link
.borrow_mut()
Expand All @@ -46,9 +47,11 @@ impl yew::html::Component for FilterChain {
}
ctx.props().render_graph.emit(UserPermission::default());
let prev_filter_chain = filter_chain.clone();
let add_filters = ctx.link().callback(Msg::AddFilters);
Self {
filter_chain,
prev_filter_chain,
add_filters,
}
}

Expand All @@ -62,7 +65,8 @@ impl yew::html::Component for FilterChain {
ctx.props().apply_filter.emit(filter);
}
ctx.props().render_graph.emit(UserPermission::default());
true
// true
false
}
Msg::RemoveNthFilter(n) => {
log!("Removing filter", n);
Expand Down Expand Up @@ -111,12 +115,10 @@ impl yew::html::Component for FilterChain {
.collect();
let reset_filters = ctx.link().callback(|_| Msg::ResetFilters);

let add_filters = ctx.link().callback(Msg::AddFilters);
html!(
<>
<GraphFilter
add_filters={add_filters.clone()}
dependency={ctx.props().dependency}
<GraphFilters
add_filters={self.add_filters.clone()}
/>
<h2>{"Filter chain:"}</h2>
{for filter_chain}
Expand Down
Loading

0 comments on commit 44da0bb

Please sign in to comment.