MCPcopy Index your code
hub / github.com/endbasic/endbasic / build

Method build

std/src/lib.rs:382–416  ·  view source on GitHub ↗

Builds the interpreter.

(mut self)

Source from the content-addressed store, hash-verified

380
381 /// Builds the interpreter.
382 pub fn build(mut self) -> Machine {
383 let console = self.get_console();
384 let datetime = self.get_datetime();
385 let gpio_pins = self.get_gpio_pins();
386
387 let signals_chan = match self.signals_chan.take() {
388 Some(pair) => pair,
389 None => async_channel::unbounded(),
390 };
391
392 arrays::add_all(&mut self);
393 console::add_all(&mut self, console.clone());
394 gfx::add_all(&mut self, console.clone());
395 data::add_all(&mut self);
396 datetime::add_all(&mut self, datetime);
397 gpio::add_all(&mut self, gpio_pins);
398 exec::add_scripting(&mut self);
399 numerics::add_all(&mut self);
400 sound::cmds::add_all(&mut self, console.clone());
401 strings::add_all(&mut self);
402
403 Machine {
404 compiler: Compiler::new(&self.callables, &self.global_defs)
405 .expect("Injected globals must be valid"),
406 image: Image::default(),
407 vm: Vm::new(self.callables.clone()),
408 callables: self.callables,
409 clearables: self.clearables,
410 actions: self.actions.clone(),
411 global_defs: self.global_defs.clone(),
412 console,
413 yielder: self.yielder.take(),
414 signals_chan,
415 }
416 }
417
418 /// Extends the machine with interactive (REPL) features.
419 pub fn make_interactive(self) -> InteractiveMachineBuilder {

Calls 9

add_scriptingFunction · 0.85
add_interactiveFunction · 0.85
get_gpio_pinsMethod · 0.80
yielderMethod · 0.80
add_allFunction · 0.70
get_consoleMethod · 0.45
get_datetimeMethod · 0.45
get_programMethod · 0.45
get_storageMethod · 0.45