add string table, StringList representation
This commit is contained in:
@@ -6,6 +6,7 @@ use prolog::machine::machine_errors::*;
|
||||
use prolog::num::{BigInt, BigUint, Zero, One};
|
||||
use prolog::or_stack::*;
|
||||
use prolog::read::*;
|
||||
use prolog::string_list::*;
|
||||
use prolog::tabled_rc::*;
|
||||
|
||||
use downcast::Any;
|
||||
@@ -288,6 +289,7 @@ impl Default for MachineFlags {
|
||||
|
||||
pub struct MachineState {
|
||||
pub(crate) atom_tbl: TabledData<Atom>,
|
||||
pub(crate) string_tbl: TabledData<StringListWrapper>,
|
||||
pub(super) s: usize,
|
||||
pub(super) p: CodePtr,
|
||||
pub(super) b: usize,
|
||||
|
||||
@@ -9,8 +9,8 @@ use prolog::num::{Integer, Signed, ToPrimitive, Zero};
|
||||
use prolog::num::bigint::{BigInt, BigUint};
|
||||
use prolog::num::rational::Ratio;
|
||||
use prolog::or_stack::*;
|
||||
use prolog::tabled_rc::*;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::cmp::{max, Ordering};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::rc::Rc;
|
||||
@@ -28,9 +28,10 @@ macro_rules! try_or_fail {
|
||||
}
|
||||
|
||||
impl MachineState {
|
||||
pub(super) fn new(atom_tbl: TabledData<Atom>) -> MachineState {
|
||||
pub(super) fn new() -> Self {
|
||||
MachineState {
|
||||
atom_tbl,
|
||||
atom_tbl: Rc::new(RefCell::new(HashSet::new())),
|
||||
string_tbl: Rc::new(RefCell::new(HashSet::new())),
|
||||
s: 0,
|
||||
p: CodePtr::default(),
|
||||
b: 0,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use prolog::ast::*;
|
||||
use prolog::compile::*;
|
||||
use prolog::heap_print::*;
|
||||
use prolog::string_list::StringListWrapper;
|
||||
use prolog::tabled_rc::*;
|
||||
|
||||
mod machine_errors;
|
||||
@@ -11,8 +12,7 @@ mod system_calls;
|
||||
|
||||
use prolog::machine::machine_state::*;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::collections::HashMap;
|
||||
use std::mem::swap;
|
||||
use std::ops::Index;
|
||||
use std::rc::Rc;
|
||||
@@ -99,7 +99,7 @@ static QUEUES: &str = include_str!("../lib/queues.pl");
|
||||
impl Machine {
|
||||
pub fn new() -> Self {
|
||||
let mut wam = Machine {
|
||||
ms: MachineState::new(Rc::new(RefCell::new(HashSet::new()))),
|
||||
ms: MachineState::new(),
|
||||
call_policy: Box::new(DefaultCallPolicy {}),
|
||||
cut_policy: Box::new(DefaultCutPolicy {}),
|
||||
code: Code::new(),
|
||||
@@ -177,6 +177,10 @@ impl Machine {
|
||||
self.ms.atom_tbl.clone()
|
||||
}
|
||||
|
||||
pub fn string_tbl(&self) -> TabledData<StringListWrapper> {
|
||||
self.ms.string_tbl.clone()
|
||||
}
|
||||
|
||||
pub fn use_qualified_module_in_toplevel(&mut self, name: ClauseName, exports: Vec<PredicateKey>)
|
||||
-> EvalSession
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user