Documentation ¶
Overview ¶
Package t3xf provides routines for decoding and loading t3xf encoded files.
t3xf (TTCN-3 Executable Format) is a binary representation of input TTCN-3 source text, suitable for execution by a native application, its main purpose expected to be the execution of test cases against a system under test.
t3xf can be thought of as one possible binary dump of the abstract syntax tree created by a TTCN-3 compiler after all semantic checking has been performed. t3xf is conceived as a file format. No provision is made for streaming or for editing. Transmission of whole files is not only possible but will be required in systems that support testing distributed across a number of host machines.
tasm (T3xf Assembly) is an extension to t3xf allowing objects to be loaded lazily and hence reducing the time for loading t3xf files.
Index ¶
- Constants
- type File
- type Scanner
- func (s *Scanner) Arg() int
- func (s *Scanner) Bytes() []byte
- func (s *Scanner) Err() error
- func (s *Scanner) Float64() float64
- func (s *Scanner) Offset() int
- func (s *Scanner) Opcode() opcode.Opcode
- func (s *Scanner) Raw() []byte
- func (s *Scanner) Reset()
- func (s *Scanner) Scan() bool
- func (s *Scanner) Seek(offset int64, whence int) (int64, error)
- type Sections
- type Tables
Constants ¶
const ( // ErrUnkownFormat means that the t3xf format or version could not be detected. ErrUnknownFormat = t3xfError("unknown format") // ErrDeprecatedWIDEN means that a t3xf code contains a deprecated // WIDEN instruction. ErrDeprecatedWIDEN = t3xfError("deprecated WIDEN instruction") // ErrDeprecatedWIDEN means that a t3xf code contains a deprecated // WIDEN instruction. // // ESWAP was introduced to support running little-endian t3xf files // on big-endian machines. We don't support that anymore. ErrDeprecatedESWAP = t3xfError("deprecated ESWAP instruction") // ErrUnmatchedBLOCk means a SCAN instruction had no matching BLOCK // instruction. ErrUnmatchedBLOCK = t3xfError("unmatched BLOCK instruction.") // ErrUnmatchedSCAN means a BLOCK instruction had no matching SCAN // instruction. ErrUnmatchedSCAN = t3xfError("unmatched SCAN instruction.") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
File represents a t3xf file.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner provides a convenient interface for decoding T3XF byte code instructions. Successive calls to the Scan method will step through T3XF instructions.
func NewScanner ¶
NewScanner decodes a byte slice containing t3xf byte code and returns a Scanner for convenient traversal. The underlaying array of b is not modified but referenced by Scanner methods.
Decoding errors can be inspected using the Err method.
func (*Scanner) Arg ¶
Arg returns the argument of the most recent instruction.
For NATLONG it's the integer value, for strings (NAME, UTF8, ...) it's the length in bits. For SCAN instructions it's the matching BLOCK instruction and vice versa.
func (*Scanner) Bytes ¶
Bytes returns a byte slice containing string data of the most recent instruction. The underlying array points to data from NewScanner call.
func (*Scanner) Raw ¶
Raw returns a byte slice of the most recent instruction. The underlying array points to data from NewScanner call.
func (*Scanner) Reset ¶
func (s *Scanner) Reset()
Reset sets the scanner to the first t3xf instruction and allows re-scanning t3xf code.
func (*Scanner) Scan ¶
Scan advances the Scanner to the next instruction, which will then be available through methods like Opcode, Arg, ... .
It returns false when the scan stops, either by reaching the end of the input or an error. After Scan returns false, the Err method will return any error that occurred during scanning, except that if it was io.EOF, Err will return nil.