framework

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidFrameworks = []string{"all", "ccm", "pyactr", "vanilla"}

ValidFrameworks lists the valid options for choosing frameworks on the command line and in the interactive case. Make sure "all" is the first entry as we use [1:] to get the rest.

Functions

func IsValidFramework

func IsValidFramework(frameworkName string) bool

IsValidFramework returns if the framework name is in our list of valid ones or not.

func PythonValuesToStrings

func PythonValuesToStrings(values *[]*actr.Value, quoteStrings bool) []string

func RemoveTempFile

func RemoveTempFile(filePath string) error

RemoveTempFile removes the given file if it exists.

func Setup added in v0.5.0

func Setup(info *Info) (err error)

Setup will check that the executable exists and then use it to identify itself.

func ValidNamedFrameworks added in v0.5.0

func ValidNamedFrameworks() []string

ValidNamedFrameworks returns the list of all valid framework names without "all".

Types

type Framework

type Framework interface {
	Info() *Info

	Initialize() (err error)

	ValidateModel(model *actr.Model) (log *issues.Log)
	SetModel(model *actr.Model) (err error)
	Model() (model *actr.Model)

	Run(initialBuffers InitialBuffers) (result *RunResult, err error)
	WriteModel(path string, initialBuffers InitialBuffers) (outputFileName string, err error)
}

type Info added in v0.5.0

type Info struct {
	Name     string `json:"name"`     // name of the framework
	Language string `json:"language"` // language the framework uses

	FileExtension string `json:"fileExtension"` // file extension of the intermediate file

	ExecutableName string `json:"executableName"` // name of the executable to run

	PythonRequiredPackages []string `json:"pythonRequiredPackages,omitempty"` // (Python only) List of packages this framework requires
}

Info provides basic info to set up a framework.

type InfoList added in v0.5.0

type InfoList = []Info

type InitialBuffers added in v0.2.0

type InitialBuffers map[string]string

InitialBuffers is a map of buffer names to initial contents of the buffer. This is used when passing in user-defined initial contents e.g. through a web API.

type KeyValueList

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

KeyValueList is used to format output nicely with tabs using tabwriter.

func (*KeyValueList) Add

func (l *KeyValueList) Add(key, value string)

type List

type List map[string]Framework

func (List) Exists

func (l List) Exists(framework string) bool

Exists checks if the framework is in the list.

func (List) Names

func (l List) Names() (names []string)

Names returns all the names of the frameworks in the list.

type ParsedInitialBuffers added in v0.2.0

type ParsedInitialBuffers map[string]*actr.Pattern

ParsedInitialBuffers is a map of buffer name to a parsed version of the initial contents. This is used when passing in user-defined initial contents e.g. through a web API.

func ParseInitialBuffers added in v0.2.0

func ParseInitialBuffers(model *actr.Model, initialBuffers InitialBuffers) (parsed ParsedInitialBuffers, err error)

type RunResult added in v0.5.0

type RunResult struct {
	FileName      string // full path to the intermediate file
	GeneratedCode []byte // code which was run
	Output        []byte // resulting output (stdout + stderr)
}

RunResult is the result of a Run() call which runs the code using the framework's executable.

type WriterHelper

type WriterHelper struct {
	File      *os.File
	Contents  *bytes.Buffer
	TabWriter *tabwriter.Writer
}

func (*WriterHelper) CloseWriterHelper

func (w *WriterHelper) CloseWriterHelper()

func (WriterHelper) GetContents

func (w WriterHelper) GetContents() []byte

func (*WriterHelper) InitWriterHelper

func (w *WriterHelper) InitWriterHelper(outputFileName string) (err error)

func (WriterHelper) TabWrite

func (w WriterHelper) TabWrite(level int, list KeyValueList)

func (WriterHelper) Write

func (w WriterHelper) Write(e string, a ...interface{})

func (WriterHelper) Writeln

func (w WriterHelper) Writeln(e string, a ...interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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