Documentation
¶
Index ¶
- Variables
- func Decode(b []byte) (n int, op opcode.Opcode, arg interface{})
- type AltstepEntry
- type ArrayTypeEntry
- type BlockEntry
- type ClosureTypeEntry
- type CollectionEntry
- type Compiler
- type ComponentTypeEntry
- type ConstEntry
- type ControlEntry
- type Encoder
- type EncoderError
- type EnumeratedTypeEntry
- type ExtFunctionEntry
- type File
- type FunctionEntry
- type Int32Entry
- type MessagePortTypeEntry
- type ModuleEntry
- type ModuleParEntry
- type NameEntry
- type RecordOfTypeEntry
- type RecordTypeEntry
- type Reference
- type SetOfTypeEntry
- type SetTypeEntry
- type String
- type StringEntry
- type TemplateEntry
- type TestcaseEntry
- type TypeAliasEntry
- type UnionTypeEntry
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidArg = errors.New("invalid argument")
ErrInvalidArg is returned when an argument is not of the expected type or size.
var ErrUnknownReference = errors.New("unknown reference")
ErrUnknownReference is returned when a reference to an unknown instruction is encountered.
Functions ¶
func Decode ¶ added in v0.19.0
Decode decodes a T3XF instruction from a byte slice. It returns the number of bytes read, the opcode and its argument.
The type of the argument depends on the opcode:
- LINE, NATLONG, SCAN, IFIELD, IGET and IDEF: the argument is an int.
- IEEE754DP: the argument is a float64.
- BITS, NIBBLES and OCTETS: the argument is a *t3xf.String. The underlying byte slice is the given byte slice b. Note, that the number of bytes read and the number of bytes in the String slice may differ, because T3XF instructions are 4-byte aligned.
- NAME, UTF8, ISTR and FSTR: the argument is a string.
- REF, GOTO and FROZEN_REF: the argument is a t3xf.Reference.
Types ¶
type AltstepEntry ¶ added in v0.20.0
type ArrayTypeEntry ¶ added in v0.20.0
type BlockEntry ¶ added in v0.20.0
type ClosureTypeEntry ¶ added in v0.20.0
type CollectionEntry ¶ added in v0.20.0
type Compiler ¶ added in v0.19.0
type Compiler struct {
// contains filtered or unexported fields
}
func NewCompiler ¶ added in v0.19.0
func NewCompiler() *Compiler
type ComponentTypeEntry ¶ added in v0.20.0
type ConstEntry ¶ added in v0.20.0
type ControlEntry ¶ added in v0.20.0
type Encoder ¶ added in v0.19.0
type Encoder struct {
// contains filtered or unexported fields
}
func NewEncoder ¶ added in v0.19.0
func NewEncoder() *Encoder
func (*Encoder) Assemble ¶ added in v0.19.0
Assemble returns the assembled T3XF byte code. References are resolved when possible, otherwise they are left unresolved and an error is returned.
It is safe to call Assemble multiple times during the lifetime of an Encoder.
func (*Encoder) Encode ¶ added in v0.19.0
Encode the given opcode and argument. If an argument is not of the expected type or size, an error is returned.
- References are given as the index of the Encode call that will be referenced.
- String arguments are expected to implement the Len() and Bytes() methods.
- Integer arguments are expected to be of type int.
- Float arguments are expected to be of type float64.
type EncoderError ¶ added in v0.19.0
type EncoderError struct { Err error // Underlying error I int // Instruction index Op opcode.Opcode // Current Opcode }
func (*EncoderError) Error ¶ added in v0.19.0
func (e *EncoderError) Error() string
func (*EncoderError) Unwrap ¶ added in v0.19.0
func (e *EncoderError) Unwrap() error
type EnumeratedTypeEntry ¶ added in v0.20.0
type ExtFunctionEntry ¶ added in v0.20.0
type File ¶
type File struct { T3xf []byte Text []byte Int32s []Int32Entry Names []NameEntry Modules []ModuleEntry TypeAliass []TypeAliasEntry RecordTypes []RecordTypeEntry SetTypes []SetTypeEntry RecordOfTypes []RecordOfTypeEntry SetOfTypes []SetOfTypeEntry UnionTypes []UnionTypeEntry EnumeratedTypes []EnumeratedTypeEntry ArrayTypes []ArrayTypeEntry ClosureTypes []ClosureTypeEntry MessagePortTypes []MessagePortTypeEntry ComponentTypes []ComponentTypeEntry Consts []ConstEntry ModulePars []ModuleParEntry Templates []TemplateEntry Testcases []TestcaseEntry Functions []FunctionEntry ExtFunctions []ExtFunctionEntry Altsteps []AltstepEntry Blocks []BlockEntry Controls []ControlEntry Strings []StringEntry Collections []CollectionEntry Data []byte }
type FunctionEntry ¶ added in v0.20.0
type Int32Entry ¶ added in v0.20.0
type MessagePortTypeEntry ¶ added in v0.20.0
type ModuleEntry ¶ added in v0.20.0
type ModuleParEntry ¶ added in v0.20.0
type RecordOfTypeEntry ¶ added in v0.20.0
type RecordTypeEntry ¶ added in v0.20.0
type SetOfTypeEntry ¶ added in v0.20.0
type SetTypeEntry ¶ added in v0.20.0
type String ¶ added in v0.19.0
type String struct {
// contains filtered or unexported fields
}
String is a T3XF string.
type StringEntry ¶ added in v0.20.0
type TemplateEntry ¶ added in v0.20.0
type TestcaseEntry ¶ added in v0.20.0
type TypeAliasEntry ¶ added in v0.20.0
Directories
¶
Path | Synopsis |
---|---|
Package opcode defines the opcodes used in T3XF.
|
Package opcode defines the opcodes used in T3XF. |