t3xf

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

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

View Source
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

type File struct {
	Sections Sections
	Tables   Tables
	// contains filtered or unexported fields
}

File represents a t3xf file.

func ReadFile

func ReadFile(path string) (*File, error)

ReadFile reads a file from path and returns a File struct. An error is returned if the file could not be read or has an unknown or invalid format.

func (*File) Info

func (f *File) Info() string

Info returns a string describing File format

func (*File) IsTASM

func (f *File) IsTASM() bool

IsTASM returns true if file uses TASM format.

func (*File) Order

func (f *File) Order() binary.ByteOrder

Instruction byte order.

func (*File) Version

func (f *File) Version() int

T3XF version.

func (*File) Width

func (f *File) Width() int

Instruction width in bytes.

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

func NewScanner(b []byte) *Scanner

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

func (s *Scanner) Arg() int

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

func (s *Scanner) Bytes() []byte

Bytes returns a byte slice containing string data of the most recent instruction. The underlying array points to data from NewScanner call.

func (*Scanner) Err

func (s *Scanner) Err() error

Err returns the first non-EOF error that was encountered by the Scanner.

func (*Scanner) Float64

func (s *Scanner) Float64() float64

Float64 returns the float64 value of the most-recent instruction.

func (*Scanner) Offset

func (s *Scanner) Offset() int

Offset returns the offset of the current instruction.

func (*Scanner) Opcode

func (s *Scanner) Opcode() opcode.Opcode

Opcode returns the opcode of the most recent instruction.

func (*Scanner) Raw

func (s *Scanner) Raw() []byte

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

func (s *Scanner) Scan() bool

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.

func (*Scanner) Seek

func (s *Scanner) Seek(offset int64, whence int) (int64, error)

Seek implements the io.Seeker interface.

type Sections

type Sections struct {
	T3XF []byte
	// contains filtered or unexported fields
}

type Tables

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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