runtime

package
v0.0.0-...-a19c61f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 22 Imported by: 1

Documentation

Overview

Package runtime provides Shaden-specific lisp built-ins and REPL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHandler

func AddHandler(mux ServeMux, evaler Evaler)

AddHandler registers the evaluation handler with a ServeMux.

Types

type Engine

type Engine interface {
	SendMessage(*engine.Message) error
	UnitBuilders() map[string]unit.Builder
	FrameSize() int
	SampleRate() int
}

Engine represents the things we need from engine.Engine

type Evaler

type Evaler interface {
	Eval([]byte) (interface{}, error)
}

Evaler evaluates script content sent via HTTP.

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime represents the runtime execution environment

func New

func New(e Engine, logger *log.Logger) (*Runtime, error)

New returns a new Runtime

func (*Runtime) ClearUserspace

func (r *Runtime) ClearUserspace()

ClearUserspace resets the environment by clearing all user-defined symbols.

func (*Runtime) Eval

func (r *Runtime) Eval(code []byte) (interface{}, error)

Eval parses and evaluates lisp expressions.

func (*Runtime) Load

func (r *Runtime) Load(path string) error

Load parses and evaluates lisp expressions in a file.

func (*Runtime) REPL

func (r *Runtime) REPL(done chan struct{})

REPL runs the REPL.

type ServeMux

type ServeMux interface {
	Handle(string, http.Handler)
}

ServeMux is a mux abstraction.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL