struct

Functions for working with fixed-size structures.

Summary
structFunctions for working with fixed-size structures.
Enumerations
TypeThe type of a field.
Types
FieldRepresents a field in a structure.
StructRepresents a complete structure as a sequence of fields.
Functions
makeMake a Struct based on an array of Fields.
fieldHelper function to create Field records.
packBoolPack a Boolean value into a Bytes.
packInt8Pack a signed Number into a Bytes of width 1.
packInt16BEPack a signed Number into a Bytes of width 2.
packInt16LEPack a signed Number into a Bytes of width 2.
packInt32BEPack a signed Number into a Bytes of width 4.
packInt32LEPack a signed Number into a Bytes of width 4.
packInt64BEPack a signed Number into a Bytes of width 8.
packInt64LEPack a signed Number into a Bytes of width 8.
packUInt8Pack a signed Number into a Bytes of width 1.
packUInt16BEPack an unsigned Number into a Bytes of width 2.
packUInt16LEPack an unsigned Number into a Bytes of width 2.
packUInt32BEPack an unsigned Number into a Bytes of width 4.
packUInt32LEPack an unsigned Number into a Bytes of width 4.
packUInt64BEPack an unsigned Number into a Bytes of width 8.
packUInt64LEPack an unsigned Number into a Bytes of width 8.
unpackBoolUnpack a Boolean from a Bytes.
unpackInt8Unpack a Number from a Bytes of size 1.
unpackInt16BEUnpack a Number from a Bytes of size 2.
unpackInt16LEUnpack a Number from a Bytes of size 2.
unpackInt32BEUnpack a Number from a Bytes of size 4.
unpackInt32LEUnpack a Number from a Bytes of size 4.
unpackInt64BEUnpack a Number from a Bytes of size 8.
unpackInt64LEUnpack a Number from a Bytes of size 8.
unpackUInt8Unpack a Number from a Bytes of size 1.
unpackUInt16BEUnpack a Number from a Bytes of size 2.
unpackUInt16LEUnpack a Number from a Bytes of size 2.
unpackUInt32BEUnpack a Number from a Bytes of size 4.
unpackUInt32LEUnpack a Number from a Bytes of size 4.
unpackUInt64BEUnpack a Number from a Bytes of size 8.
unpackUInt64LEUnpack a Number from a Bytes of size 8.
Struct.packConvert a dictionary of values into a structure.
Struct.sizeofReturn the total size of a structure definition.
Struct.unpackConvert a structure into a dictionary of values.

Enumerations

Type

The type of a field.

Values

boolboolean
int8signed 8 bit integer
int16BEsigned 16 bit integer, big endian
int16LEsigned 16 bit integer, little endian
int32BEsigned 32 bit integer, big endian
int32LEsigned 32 bit integer, little endian
int64BEsigned 64 bit integer, big endian
int64LEsigned 64 bit integer, little endian
uint8unsigned 8 bit integer
uint16BEunsigned 16 bit integer, big endian
uint16LEunsigned 16 bit integer, little endian
uint32BEunsigned 32 bit integer, big endian
uint32LEunsigned 32 bit integer, little endian
uint64BEunsigned 64 bit integer, big endian
uint64LEunsigned 64 bit integer, little endian
stringstring
bytesbytes

Types

Field

Represents a field in a structure.

Struct

Represents a complete structure as a sequence of fields.

Functions

make

FUNCTION make(fields: Array<Field>): Struct

Make a Struct based on an array of Fields.

field

FUNCTION field(name: String,
type: Type,
width: Number): Field

Helper function to create Field records.

packBool

FUNCTION packBool(b: Boolean): Bytes

Pack a Boolean value into a Bytes.

packInt8

FUNCTION packInt8(n: Number): Bytes

Pack a signed Number into a Bytes of width 1.

packInt16BE

FUNCTION packInt16BE(n: Number): Bytes

Pack a signed Number into a Bytes of width 2.

packInt16LE

FUNCTION packInt16LE(n: Number): Bytes

Pack a signed Number into a Bytes of width 2.

packInt32BE

FUNCTION packInt32BE(n: Number): Bytes

Pack a signed Number into a Bytes of width 4.

packInt32LE

FUNCTION packInt32LE(n: Number): Bytes

Pack a signed Number into a Bytes of width 4.

packInt64BE

FUNCTION packInt64BE(n: Number): Bytes

Pack a signed Number into a Bytes of width 8.

packInt64LE

FUNCTION packInt64LE(n: Number): Bytes

Pack a signed Number into a Bytes of width 8.

packUInt8

FUNCTION packUInt8(n: Number): Bytes

Pack a signed Number into a Bytes of width 1.

packUInt16BE

FUNCTION packUInt16BE(n: Number): Bytes

Pack an unsigned Number into a Bytes of width 2.

packUInt16LE

FUNCTION packUInt16LE(n: Number): Bytes

Pack an unsigned Number into a Bytes of width 2.

packUInt32BE

FUNCTION packUInt32BE(n: Number): Bytes

Pack an unsigned Number into a Bytes of width 4.

packUInt32LE

FUNCTION packUInt32LE(n: Number): Bytes

Pack an unsigned Number into a Bytes of width 4.

packUInt64BE

FUNCTION packUInt64BE(n: Number): Bytes

Pack an unsigned Number into a Bytes of width 8.

packUInt64LE

FUNCTION packUInt64LE(n: Number): Bytes

Pack an unsigned Number into a Bytes of width 8.

unpackBool

FUNCTION unpackBool(b: Bytes): Boolean

Unpack a Boolean from a Bytes.

unpackInt8

FUNCTION unpackInt8(b: Bytes): Number

Unpack a Number from a Bytes of size 1.

unpackInt16BE

FUNCTION unpackInt16BE(b: Bytes): Number

Unpack a Number from a Bytes of size 2.

unpackInt16LE

FUNCTION unpackInt16LE(b: Bytes): Number

Unpack a Number from a Bytes of size 2.

unpackInt32BE

FUNCTION unpackInt32BE(b: Bytes): Number

Unpack a Number from a Bytes of size 4.

unpackInt32LE

FUNCTION unpackInt32LE(b: Bytes): Number

Unpack a Number from a Bytes of size 4.

unpackInt64BE

FUNCTION unpackInt64BE(b: Bytes): Number

Unpack a Number from a Bytes of size 8.

unpackInt64LE

FUNCTION unpackInt64LE(b: Bytes): Number

Unpack a Number from a Bytes of size 8.

unpackUInt8

FUNCTION unpackUInt8(b: Bytes): Number

Unpack a Number from a Bytes of size 1.

unpackUInt16BE

FUNCTION unpackUInt16BE(b: Bytes): Number

Unpack a Number from a Bytes of size 2.

unpackUInt16LE

FUNCTION unpackUInt16LE(b: Bytes): Number

Unpack a Number from a Bytes of size 2.

unpackUInt32BE

FUNCTION unpackUInt32BE(b: Bytes): Number

Unpack a Number from a Bytes of size 4.

unpackUInt32LE

FUNCTION unpackUInt32LE(b: Bytes): Number

Unpack a Number from a Bytes of size 4.

unpackUInt64BE

FUNCTION unpackUInt64BE(b: Bytes): Number

Unpack a Number from a Bytes of size 8.

unpackUInt64LE

FUNCTION unpackUInt64LE(b: Bytes): Number

Unpack a Number from a Bytes of size 8.

Struct.pack

FUNCTION Struct.pack(self: Struct,
values: Dictionary<variant.Variant>): Bytes

Convert a dictionary of values into a structure.

Struct.sizeof

FUNCTION Struct.sizeof(self: Struct): Number

Return the total size of a structure definition.

Struct.unpack

FUNCTION Struct.unpack(self: Struct,
data: Bytes): Dictionary<variant.Variant>

Convert a structure into a dictionary of values.

FUNCTION make(fields: Array<Field>): Struct
Make a Struct based on an array of Fields.
Represents a complete structure as a sequence of fields.
Represents a field in a structure.
FUNCTION field(name: String,
type: Type,
width: Number): Field
Helper function to create Field records.
FUNCTION packBool(b: Boolean): Bytes
Pack a Boolean value into a Bytes.
TRUE or FALSE.
Bytes.
FUNCTION packInt8(n: Number): Bytes
Pack a signed Number into a Bytes of width 1.
Floating point number with 34 decimal digits of precision.
FUNCTION packInt16BE(n: Number): Bytes
Pack a signed Number into a Bytes of width 2.
FUNCTION packInt16LE(n: Number): Bytes
Pack a signed Number into a Bytes of width 2.
FUNCTION packInt32BE(n: Number): Bytes
Pack a signed Number into a Bytes of width 4.
FUNCTION packInt32LE(n: Number): Bytes
Pack a signed Number into a Bytes of width 4.
FUNCTION packInt64BE(n: Number): Bytes
Pack a signed Number into a Bytes of width 8.
FUNCTION packInt64LE(n: Number): Bytes
Pack a signed Number into a Bytes of width 8.
FUNCTION packUInt8(n: Number): Bytes
Pack a signed Number into a Bytes of width 1.
FUNCTION packUInt16BE(n: Number): Bytes
Pack an unsigned Number into a Bytes of width 2.
FUNCTION packUInt16LE(n: Number): Bytes
Pack an unsigned Number into a Bytes of width 2.
FUNCTION packUInt32BE(n: Number): Bytes
Pack an unsigned Number into a Bytes of width 4.
FUNCTION packUInt32LE(n: Number): Bytes
Pack an unsigned Number into a Bytes of width 4.
FUNCTION packUInt64BE(n: Number): Bytes
Pack an unsigned Number into a Bytes of width 8.
FUNCTION packUInt64LE(n: Number): Bytes
Pack an unsigned Number into a Bytes of width 8.
FUNCTION unpackBool(b: Bytes): Boolean
Unpack a Boolean from a Bytes.
FUNCTION unpackInt8(b: Bytes): Number
Unpack a Number from a Bytes of size 1.
FUNCTION unpackInt16BE(b: Bytes): Number
Unpack a Number from a Bytes of size 2.
FUNCTION unpackInt16LE(b: Bytes): Number
Unpack a Number from a Bytes of size 2.
FUNCTION unpackInt32BE(b: Bytes): Number
Unpack a Number from a Bytes of size 4.
FUNCTION unpackInt32LE(b: Bytes): Number
Unpack a Number from a Bytes of size 4.
FUNCTION unpackInt64BE(b: Bytes): Number
Unpack a Number from a Bytes of size 8.
FUNCTION unpackInt64LE(b: Bytes): Number
Unpack a Number from a Bytes of size 8.
FUNCTION unpackUInt8(b: Bytes): Number
Unpack a Number from a Bytes of size 1.
FUNCTION unpackUInt16BE(b: Bytes): Number
Unpack a Number from a Bytes of size 2.
FUNCTION unpackUInt16LE(b: Bytes): Number
Unpack a Number from a Bytes of size 2.
FUNCTION unpackUInt32BE(b: Bytes): Number
Unpack a Number from a Bytes of size 4.
FUNCTION unpackUInt32LE(b: Bytes): Number
Unpack a Number from a Bytes of size 4.
FUNCTION unpackUInt64BE(b: Bytes): Number
Unpack a Number from a Bytes of size 8.
FUNCTION unpackUInt64LE(b: Bytes): Number
Unpack a Number from a Bytes of size 8.
FUNCTION Struct.pack(self: Struct,
values: Dictionary<variant.Variant>): Bytes
Convert a dictionary of values into a structure.
FUNCTION Struct.sizeof(self: Struct): Number
Return the total size of a structure definition.
FUNCTION Struct.unpack(self: Struct,
data: Bytes): Dictionary<variant.Variant>
Convert a structure into a dictionary of values.
Close