Struct som_interpreter_bc::universe::Universe
source · pub struct Universe {
pub interner: Interner,
pub globals: HashMap<Interned, Value>,
pub classpath: Vec<PathBuf>,
pub core: CoreClasses,
}
Expand description
The central data structure for the interpreter.
It represents the complete state of the interpreter, like the known class definitions, the string interner and the stack frames.
Fields§
§interner: Interner
The string interner for symbols.
globals: HashMap<Interned, Value>
The known global bindings.
classpath: Vec<PathBuf>
The path to search in for new classes.
core: CoreClasses
The interpreter’s core classes.
Implementations§
source§impl Universe
impl Universe
sourcepub fn with_classpath(classpath: Vec<PathBuf>) -> Result<Self, Error>
pub fn with_classpath(classpath: Vec<PathBuf>) -> Result<Self, Error>
Initialize the universe from the given classpath.
sourcepub fn load_system_class(
interner: &mut Interner,
classpath: &[impl AsRef<Path>],
class_name: impl Into<String>
) -> Result<SOMRef<Class>, Error>
pub fn load_system_class( interner: &mut Interner, classpath: &[impl AsRef<Path>], class_name: impl Into<String> ) -> Result<SOMRef<Class>, Error>
Load a system class (with an incomplete hierarchy).
sourcepub fn load_class(
&mut self,
class_name: impl Into<String>
) -> Result<SOMRef<Class>, Error>
pub fn load_class( &mut self, class_name: impl Into<String> ) -> Result<SOMRef<Class>, Error>
Load a class from its name into this universe.
sourcepub fn load_class_from_path(
&mut self,
path: impl AsRef<Path>
) -> Result<SOMRef<Class>, Error>
pub fn load_class_from_path( &mut self, path: impl AsRef<Path> ) -> Result<SOMRef<Class>, Error>
Load a class from its path into this universe.
sourcepub fn system_class(&self) -> SOMRef<Class>
pub fn system_class(&self) -> SOMRef<Class>
Get the System class.
sourcepub fn object_class(&self) -> SOMRef<Class>
pub fn object_class(&self) -> SOMRef<Class>
Get the Object class.
sourcepub fn symbol_class(&self) -> SOMRef<Class>
pub fn symbol_class(&self) -> SOMRef<Class>
Get the Symbol class.
sourcepub fn string_class(&self) -> SOMRef<Class>
pub fn string_class(&self) -> SOMRef<Class>
Get the String class.
sourcepub fn array_class(&self) -> SOMRef<Class>
pub fn array_class(&self) -> SOMRef<Class>
Get the Array class.
sourcepub fn integer_class(&self) -> SOMRef<Class>
pub fn integer_class(&self) -> SOMRef<Class>
Get the Integer class.
sourcepub fn double_class(&self) -> SOMRef<Class>
pub fn double_class(&self) -> SOMRef<Class>
Get the Double class.
sourcepub fn block_class(&self) -> SOMRef<Class>
pub fn block_class(&self) -> SOMRef<Class>
Get the Block class.
sourcepub fn block1_class(&self) -> SOMRef<Class>
pub fn block1_class(&self) -> SOMRef<Class>
Get the Block1 class.
sourcepub fn block2_class(&self) -> SOMRef<Class>
pub fn block2_class(&self) -> SOMRef<Class>
Get the Block2 class.
sourcepub fn block3_class(&self) -> SOMRef<Class>
pub fn block3_class(&self) -> SOMRef<Class>
Get the Block3 class.
sourcepub fn true_class(&self) -> SOMRef<Class>
pub fn true_class(&self) -> SOMRef<Class>
Get the True class.
sourcepub fn false_class(&self) -> SOMRef<Class>
pub fn false_class(&self) -> SOMRef<Class>
Get the False class.
sourcepub fn metaclass_class(&self) -> SOMRef<Class>
pub fn metaclass_class(&self) -> SOMRef<Class>
Get the Metaclass class.
sourcepub fn method_class(&self) -> SOMRef<Class>
pub fn method_class(&self) -> SOMRef<Class>
Get the Method class.
sourcepub fn primitive_class(&self) -> SOMRef<Class>
pub fn primitive_class(&self) -> SOMRef<Class>
Get the Primitive class.
source§impl Universe
impl Universe
sourcepub fn intern_symbol(&mut self, symbol: &str) -> Interned
pub fn intern_symbol(&mut self, symbol: &str) -> Interned
Intern a symbol.
pub fn has_global(&self, idx: Interned) -> bool
sourcepub fn lookup_symbol(&self, symbol: Interned) -> &str
pub fn lookup_symbol(&self, symbol: Interned) -> &str
Lookup a symbol.
sourcepub fn lookup_global(&self, idx: Interned) -> Option<Value>
pub fn lookup_global(&self, idx: Interned) -> Option<Value>
Search for a global binding.
source§impl Universe
impl Universe
sourcepub fn escaped_block(
&mut self,
interpreter: &mut Interpreter,
value: Value,
block: Rc<Block>
) -> Option<()>
pub fn escaped_block( &mut self, interpreter: &mut Interpreter, value: Value, block: Rc<Block> ) -> Option<()>
Call escapedBlock:
on the given value, if it is defined.
sourcepub fn does_not_understand(
&mut self,
interpreter: &mut Interpreter,
value: Value,
symbol: Interned,
args: Vec<Value>
) -> Option<()>
pub fn does_not_understand( &mut self, interpreter: &mut Interpreter, value: Value, symbol: Interned, args: Vec<Value> ) -> Option<()>
Call doesNotUnderstand:
on the given value, if it is defined.
sourcepub fn unknown_global(
&mut self,
interpreter: &mut Interpreter,
value: Value,
name: Interned
) -> Option<()>
pub fn unknown_global( &mut self, interpreter: &mut Interpreter, value: Value, name: Interned ) -> Option<()>
Call unknownGlobal:
on the given value, if it is defined.
sourcepub fn initialize(
&mut self,
interpreter: &mut Interpreter,
args: Vec<Value>
) -> Option<()>
pub fn initialize( &mut self, interpreter: &mut Interpreter, args: Vec<Value> ) -> Option<()>
Call System>>#initialize:
with the given name, if it is defined.