Documentation ¶
Overview ¶
Package framework implements the abstract framework used by the concrete implementations.
Index ¶
- Variables
- func GenerateCodeFromFile(fw Framework, inputFile string, initialBuffers InitialBuffers) (code []byte, err error)
- func IsValidFramework(frameworkName string) bool
- func Setup(info *Info) (err error)
- func ValidNamedFrameworks() []string
- func WriteSupportFile(path, supportFileName, contents string) (err error)
- type ErrBufferNotFound
- type ErrExecutableNotSet
- type ErrModelGenerationFailed
- type ErrModelValidationFailed
- type Framework
- type Info
- type InfoList
- type InitialBuffers
- type KeyValueList
- type List
- type ParsedInitialBuffers
- type RunResult
- type WriterHelper
- func (w WriterHelper) GetContents() []byte
- func (w *WriterHelper) InitWriterHelper() (err error)
- func (w *WriterHelper) ResetLineLen()
- func (w *WriterHelper) SetLineLen(lineLength int)
- func (w WriterHelper) TabWrite(level int, list KeyValueList)
- func (w *WriterHelper) Write(e string, a ...interface{})
- func (w *WriterHelper) WriteFile(outputFileName string) (err error)
- func (w WriterHelper) Writeln(e string, a ...interface{})
Constants ¶
This section is empty.
Variables ¶
var ( // 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. ValidFrameworks = []string{"all", "ccm", "pyactr", "vanilla"} // GactarVersion stores the current build version. It is a var so we can replace it in testing. GactarVersion = version.BuildVersion // TimeNow stores the time.Now function so we can replace it in testing. TimeNow = time.Now )
var (
ErrModelMissingName = errors.New("model missing name")
)
Functions ¶
func GenerateCodeFromFile ¶ added in v0.8.0
func GenerateCodeFromFile(fw Framework, inputFile string, initialBuffers InitialBuffers) (code []byte, err error)
Reads a file, generates a model, validates it, and generates code from it for a given framework. This is useful for testing.
func IsValidFramework ¶
IsValidFramework returns if the framework name is in our list of valid ones or not.
func Setup ¶ added in v0.5.0
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".
func WriteSupportFile ¶ added in v0.12.0
WriteSupportFile will write out a file to add extra support for a framework.
Types ¶
type ErrBufferNotFound ¶ added in v0.9.0
func (ErrBufferNotFound) Error ¶ added in v0.9.0
func (e ErrBufferNotFound) Error() string
type ErrExecutableNotSet ¶ added in v0.9.0
type ErrExecutableNotSet struct {
Name string
}
func (ErrExecutableNotSet) Error ¶ added in v0.9.0
func (e ErrExecutableNotSet) Error() string
type ErrModelGenerationFailed ¶ added in v0.9.0
func (ErrModelGenerationFailed) Error ¶ added in v0.9.0
func (e ErrModelGenerationFailed) Error() string
type ErrModelValidationFailed ¶ added in v0.9.0
func (ErrModelValidationFailed) Error ¶ added in v0.9.0
func (e ErrModelValidationFailed) Error() string
type Framework ¶
type Framework interface { Info() *Info 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) GenerateCode(initialBuffers InitialBuffers) (code []byte, 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 InitialBuffers ¶ added in v0.2.0
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 ParsedInitialBuffers ¶ added in v0.2.0
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 { Contents *bytes.Buffer TabWriter *tabwriter.Writer // contains filtered or unexported fields }
func (WriterHelper) GetContents ¶
func (w WriterHelper) GetContents() []byte
func (*WriterHelper) InitWriterHelper ¶
func (w *WriterHelper) InitWriterHelper() (err error)
func (*WriterHelper) ResetLineLen ¶ added in v0.10.0
func (w *WriterHelper) ResetLineLen()
ResetLineLen will reset the line length capability.
func (*WriterHelper) SetLineLen ¶ added in v0.10.0
func (w *WriterHelper) SetLineLen(lineLength int)
SetLineLen will cause newlines to be inserted at the line length. Note that this can be problematic for some things like comments or strings, so be careful how you use it.
func (WriterHelper) TabWrite ¶
func (w WriterHelper) TabWrite(level int, list KeyValueList)
func (*WriterHelper) Write ¶
func (w *WriterHelper) Write(e string, a ...interface{})
func (*WriterHelper) WriteFile ¶ added in v0.8.0
func (w *WriterHelper) WriteFile(outputFileName string) (err error)
func (WriterHelper) Writeln ¶
func (w WriterHelper) Writeln(e string, a ...interface{})
Directories ¶
Path | Synopsis |
---|---|
Package ccm_pyactr provides functions to output the internal actr data structures in Python suitable for running using CCM's python_actr package, and to run those models using Python.
|
Package ccm_pyactr provides functions to output the internal actr data structures in Python suitable for running using CCM's python_actr package, and to run those models using Python. |
Package pyactr provides functions to output the internal actr data structures in Python suitable for running using the pyactr package, and to run those models using Python.
|
Package pyactr provides functions to output the internal actr data structures in Python suitable for running using the pyactr package, and to run those models using Python. |
Package vanilla_actr provides functions to output the internal actr data structures in Lisp suitable for running using the ACT-R code, and to run those models on the Clozure Common Lisp compiler.
|
Package vanilla_actr provides functions to output the internal actr data structures in Lisp suitable for running using the ACT-R code, and to run those models on the Clozure Common Lisp compiler. |