Commit fb6de8a6 authored by Jeff Smits's avatar Jeff Smits

Moved types to new file to write custom aterm factory

parent cf662871
use types::{Result, Error, ATermFactory, ATerm, ATermRef}; use types::{Result, Error};
use factory::{ATermFactory, ATerm, ATermRef};
use std::collections::HashMap; use std::collections::HashMap;
use std::fmt; use std::fmt;
use std::borrow::Borrow; use std::borrow::Borrow;
......
use aterm;
use std::rc::Rc;
pub type Blob = ();
pub type ATermFactory = aterm::rc::ATermFactory<Blob>;
pub type ATerm = aterm::rc::ATerm<Blob>;
pub type ATermRef = Rc<aterm::rc::ATerm<Blob>>;
...@@ -3,7 +3,8 @@ use context::MutContext; ...@@ -3,7 +3,8 @@ use context::MutContext;
use preprocess; use preprocess;
use preprocess::{SDefT, preprocess}; use preprocess::{SDefT, preprocess};
use primitives::Primitives; use primitives::Primitives;
use types::{Result, Error, ATermFactory, ATermRef, b}; use types::{Result, Error};
use factory::{ATermFactory, ATerm, ATermRef};
use aterm::{ATerm as A, Term, ATermFactory as ATF}; use aterm::{ATerm as A, Term, ATermFactory as ATF};
use aterm::BrokenF32; use aterm::BrokenF32;
...@@ -14,6 +15,12 @@ use ref_eq::ref_eq; ...@@ -14,6 +15,12 @@ use ref_eq::ref_eq;
use std::iter; use std::iter;
use std::borrow::Borrow;
pub fn b<'a>(ar: &'a ATermRef) -> &'a ATerm {
Borrow::<ATerm>::borrow(ar)
}
macro_rules! eprintln { macro_rules! eprintln {
($($tt:tt)*) => {{ ($($tt:tt)*) => {{
use std::io::{Write, stderr}; use std::io::{Write, stderr};
......
...@@ -18,11 +18,13 @@ use std::process; ...@@ -18,11 +18,13 @@ use std::process;
use aterm::parse::ATermRead; use aterm::parse::ATermRead;
use aterm::print::ATermWrite; use aterm::print::ATermWrite;
use types::{Result, ATermFactory, ATermRef, Error}; use types::{Result, Error};
use factory::{ATermFactory, ATermRef};
use interpreter::interpret_main; use interpreter::interpret_main;
use primitives::Primitives; use primitives::Primitives;
mod types; mod types;
mod factory;
mod interpreter; mod interpreter;
mod ctree; mod ctree;
mod context; mod context;
......
use types::{Result, Error, ATermRef}; use types::{Result, Error};
use factory::ATermRef;
use ctree; use ctree;
use try_from::{TryInto, TryFrom}; use try_from::{TryInto, TryFrom};
use std::result; use std::result;
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
use phf; use phf;
use context::MutContext; use context::MutContext;
use preprocess::SDefT; use preprocess::SDefT;
use types::{Result, ATermRef}; use types::Result;
use factory::ATermRef;
pub mod ssl; pub mod ssl;
......
...@@ -2,7 +2,8 @@ use context::MutContext; ...@@ -2,7 +2,8 @@ use context::MutContext;
use aterm::{Term, ATermFactory as ATF, ATerm as A}; use aterm::{Term, ATermFactory as ATF, ATerm as A};
use aterm::print::ATermWrite; use aterm::print::ATermWrite;
use aterm::parse::ATermRead; use aterm::parse::ATermRead;
use types::{Error, Result, ATermRef}; use types::{Error, Result};
use factory::ATermRef;
use preprocess::SDefT; use preprocess::SDefT;
use interpreter::{from_cons_nil_list, to_cons_nil_list}; use interpreter::{from_cons_nil_list, to_cons_nil_list};
......
...@@ -4,17 +4,6 @@ use std::io; ...@@ -4,17 +4,6 @@ use std::io;
use std::result; use std::result;
use std::error; use std::error;
use std::fmt; use std::fmt;
use std::rc::Rc;
use std::borrow::Borrow;
pub type Blob = ();
pub type ATermFactory = aterm::rc::ATermFactory<Blob>;
pub type ATerm = aterm::rc::ATerm<Blob>;
pub type ATermRef = Rc<aterm::rc::ATerm<Blob>>;
pub fn b<'a>(ar: &'a ATermRef) -> &'a ATerm {
Borrow::<ATerm>::borrow(ar)
}
pub type Result<T> = result::Result<T, Error>; pub type Result<T> = result::Result<T, Error>;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment