io

package
v0.0.0-...-d5190fc Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SizeOfBool           = SizeOfU8
	SizeOfU8      uint32 = 1
	SizeOfU16     uint32 = 2
	SizeOfU32     uint32 = 4
	SizeOfU64     uint32 = 8
	SizeOfS8             = SizeOfU8
	SizeOfS16            = SizeOfU16
	SizeOfS32            = SizeOfU32
	SizeOfS64            = SizeOfU64
	SizeOfFloat32        = SizeOfU32
	SizeOfFloat64        = SizeOfU64
	SizeOfChar           = SizeOfU32
)
View Source
const UTF16Tag = 1 << 31

Variables

This section is empty.

Functions

func AlignTo

func AlignTo(ptr, alignment uint32) (uint32, error)

func Alignment

func Alignment(t types.ValType) (uint32, error)

func AlignmentFlags

func AlignmentFlags(f types.Flags) (uint32, error)

func AlignmentRecord

func AlignmentRecord(r types.Record) (uint32, error)

func AlignmentVariant

func AlignmentVariant(v types.Variant) (uint32, error)

func CanonLift

func CanonLift(
	opts *types.CanonicalOptions,
	inst *types.ComponentInstance,
	callee func(any) (any, error),
	ft types.FuncType,
	args []any,
	maxFlatParams int,
	maxFlatResults int) ([]any, types.PostReturnFunc, error)

func CanonLower

func CanonLower(
	opts *types.CanonicalOptions,
	inst *types.ComponentInstance,
	callee func([]any) ([]any, types.PostReturnFunc, error),
	callingImport bool,
	ft types.FuncType,
	flatArgs []any,
	maxFlatParams int,
	maxFlatResults int) ([]any, error)

func CanonResourceDrop

func CanonResourceDrop(inst *types.ComponentInstance, rt types.ResourceType, i uint32) error

func CanonResourceNew

func CanonResourceNew(inst *types.ComponentInstance, rt types.ResourceType, rep uint32) (any, error)

func CanonResourceRep

func CanonResourceRep(inst *types.ComponentInstance, rt types.ResourceType, rep uint32) (uint32, error)

func CanonicalizeFloat32

func CanonicalizeFloat32(f float32) float32

func CanonicalizeFloat64

func CanonicalizeFloat64(f float64) float64

func CaseLabelWithRefinements

func CaseLabelWithRefinements(c types.Case, cases []types.Case) string

func ConvertU32ToRune

func ConvertU32ToRune(u32 uint32) (rune, error)

func Despecialize

func Despecialize(t types.ValType) types.ValType

func DiscriminantType

func DiscriminantType(cases []types.Case) (types.ValType, error)

func FindCaseIndex

func FindCaseIndex(cases []types.Case, label string) int

func FlattenFuncTypeLift

func FlattenFuncTypeLift(ft types.FuncType, maxFlatParams int, maxFlatResults int) (types.CoreFuncType, error)

func FlattenFuncTypeLower

func FlattenFuncTypeLower(ft types.FuncType, maxFlatParams int, maxFlatResults int) (types.CoreFuncType, error)

func FlattenRecord

func FlattenRecord(r types.Record) ([]kind.Kind, error)

func FlattenType

func FlattenType(t types.ValType) ([]kind.Kind, error)

func FlattenTypes

func FlattenTypes(ts []types.ValType) ([]kind.Kind, error)

func FlattenVariant

func FlattenVariant(v types.Variant) ([]kind.Kind, error)

func LiftBorrow

func LiftBorrow(cx *types.CallContext, i uint32, borrow types.Borrow) (uint32, error)

func LiftFlat

func LiftFlat(cx *types.CallContext, vi values.ValueIterator, t types.ValType) (any, error)

func LiftFlatBool

func LiftFlatBool(vi values.ValueIterator) (bool, error)

func LiftFlatChar

func LiftFlatChar(vi values.ValueIterator) (rune, error)

func LiftFlatFlags

func LiftFlatFlags(vi values.ValueIterator, f types.Flags) (any, error)

func LiftFlatFloat32

func LiftFlatFloat32(vi values.ValueIterator) (float32, error)

func LiftFlatFloat64

func LiftFlatFloat64(vi values.ValueIterator) (float64, error)

func LiftFlatList

func LiftFlatList(cx *types.CallContext, vi values.ValueIterator, t types.ValType) (any, error)

func LiftFlatRecord

func LiftFlatRecord(cx *types.CallContext, vi values.ValueIterator, fields []types.Field) (any, error)

func LiftFlatS16

func LiftFlatS16(vi values.ValueIterator) (int16, error)

func LiftFlatS32

func LiftFlatS32(vi values.ValueIterator) (int32, error)

func LiftFlatS64

func LiftFlatS64(vi values.ValueIterator) (int64, error)

func LiftFlatS8

func LiftFlatS8(vi values.ValueIterator) (int8, error)

func LiftFlatString

func LiftFlatString(cx *types.CallContext, vi values.ValueIterator) (any, error)

func LiftFlatU16

func LiftFlatU16(vi values.ValueIterator) (uint16, error)

func LiftFlatU32

func LiftFlatU32(vi values.ValueIterator) (uint32, error)

func LiftFlatU64

func LiftFlatU64(vi values.ValueIterator) (uint64, error)

func LiftFlatU8

func LiftFlatU8(vi values.ValueIterator) (uint8, error)

func LiftFlatVariant

func LiftFlatVariant(cx *types.CallContext, vi values.ValueIterator, variant types.Variant) (any, error)

func LiftOwn

func LiftOwn(cx *types.CallContext, i uint32, own types.Own) (uint32, error)

func LiftValues

func LiftValues(cx *types.CallContext, maxFlat int, vi values.ValueIterator, ts []types.ValType) ([]any, error)

func Load

func Load(cx *types.CallContext, t types.ValType, ptr uint32) (any, error)

func LoadBool

func LoadBool(cx *types.CallContext, ptr uint32) (bool, error)

func LoadChar

func LoadChar(cx *types.CallContext, ptr uint32, t types.ValType) (any, error)

func LoadFlags

func LoadFlags(cx *types.CallContext, ptr uint32, flags types.Flags) (map[string]any, error)

func LoadFloat

func LoadFloat(cx *types.CallContext, ptr uint32, t types.ValType) (any, error)

func LoadInt

func LoadInt(c *types.CallContext, ptr uint32, t types.ValType) (any, error)

func LoadIntWithSize

func LoadIntWithSize(c *types.CallContext, ptr uint32, nbytes uint32, sign bool) (any, error)

func LoadList

func LoadList(cx *types.CallContext, ptr uint32, elementType types.ValType) ([]any, error)

func LoadListFromRange

func LoadListFromRange(cx *types.CallContext, ptr uint32, length uint32, elementType types.ValType) ([]any, error)

func LoadRecord

func LoadRecord(cx *types.CallContext, ptr uint32, fields []types.Field) (map[string]any, error)

func LoadString

func LoadString(cx *types.CallContext, ptr uint32) (string, error)

func LoadStringFromRange

func LoadStringFromRange(cx *types.CallContext, ptr, taggedCodeUnits uint32) (string, error)

func LoadUInt32

func LoadUInt32(cx *types.CallContext, ptr uint32) (uint32, error)

func LoadUInt64

func LoadUInt64(cx *types.CallContext, ptr uint32) (uint64, error)

func LoadVariant

func LoadVariant(cx *types.CallContext, ptr uint32, v types.Variant) (map[string]any, error)

LoadVariant loads the variant from the context at the ptr

func LowerBool

func LowerBool(v any) ([]values.Value, error)

func LowerBorrow

func LowerBorrow(cx *types.CallContext, rep any, t types.Borrow) (uint32, error)

func LowerChar

func LowerChar(v any) ([]values.Value, error)

func LowerFlat

func LowerFlat(cx *types.CallContext, v any, t types.ValType) ([]values.Value, error)

func LowerFlatFlags

func LowerFlatFlags(cx *types.CallContext, v any, f types.Flags) ([]values.Value, error)

func LowerFlatList

func LowerFlatList(cx *types.CallContext, v any, t types.ValType) ([]values.Value, error)

func LowerFlatRecord

func LowerFlatRecord(cx *types.CallContext, v any, r types.Record) ([]values.Value, error)

func LowerFlatVariant

func LowerFlatVariant(cx *types.CallContext, v any, variant types.Variant) ([]values.Value, error)

func LowerFloat32

func LowerFloat32(v any) ([]values.Value, error)

func LowerFloat64

func LowerFloat64(v any) ([]values.Value, error)

func LowerOwn

func LowerOwn(cx *types.CallContext, rep any, t types.Own) (uint32, error)

func LowerS16

func LowerS16(v any) ([]values.Value, error)

func LowerS32

func LowerS32(v any) ([]values.Value, error)

func LowerS64

func LowerS64(v any) ([]values.Value, error)

func LowerS8

func LowerS8(v any) ([]values.Value, error)

func LowerString

func LowerString(cx *types.CallContext, v any) ([]values.Value, error)

func LowerU16

func LowerU16(v any) ([]values.Value, error)

func LowerU32

func LowerU32(v any) ([]values.Value, error)

func LowerU64

func LowerU64(v any) ([]values.Value, error)

func LowerU8

func LowerU8(v any) ([]values.Value, error)

func LowerValues

func LowerValues(cx *types.CallContext, maxFlat int, vs []any, ts []types.ValType, outParam values.ValueIterator) ([]any, error)

func LowerValuesToTuple

func LowerValuesToTuple(ts []types.ValType, vs []any, outParam values.ValueIterator, cx *types.CallContext) ([]any, error)

func MatchCase

func MatchCase(v any, cases []types.Case) (uint32, any, error)

func MaxCaseAlignment

func MaxCaseAlignment(cases []types.Case) (uint32, error)

func NumI32Flags

func NumI32Flags(labels []string) uint32

func PackFlagsIntoInt

func PackFlagsIntoInt(v map[string]any, flags types.Flags) (uint64, error)

func Size

func Size(vt types.ValType) (uint32, error)

func SizeFlags

func SizeFlags(f types.Flags) (uint32, error)

func SizeRecord

func SizeRecord(r types.Record) (uint32, error)

func SizeVariant

func SizeVariant(v types.Variant) (uint32, error)

func Store

func Store(c *types.CallContext, val any, t types.ValType, ptr uint32) error

func StoreFlags

func StoreFlags(c *types.CallContext, val any, ptr uint32, f types.Flags) error

func StoreFloat

func StoreFloat(c *types.CallContext, val any, ptr uint32, nbytes uint32) error

func StoreInt

func StoreInt(c *types.CallContext, val any, ptr uint32, nbytes uint32, signed bool) error

func StoreList

func StoreList(cx *types.CallContext, v any, ptr uint32, elementType types.ValType) error

func StoreListIntoRange

func StoreListIntoRange(cx *types.CallContext, v any, elementType types.ValType) (uint32, uint32, error)

func StoreRecord

func StoreRecord(cx *types.CallContext, val any, ptr uint32, r types.Record) error

func StoreString

func StoreString(c *types.CallContext, str string, ptr uint32) error

StoreString stores the string to linear memory using the context encoding All strings in go are assumed to be utf8 encoded

func StoreStringCopy

func StoreStringCopy(cx *types.CallContext, src string, srcCodeUnits uint32, dstCodeUnitSize uint32, dstAlignment uint32, dstEncoding encoding.Encoder) (uint32, uint32, error)

func StoreStringDynamic

func StoreStringDynamic(
	cx *types.CallContext,
	str string,
	codec encoding.Codec) (uint32, uint32, error)

StoreStringDynamic assumes the incoming string is in utf8 and stores the string to the given codec's encoding at the end of the context memory

func StoreStringIntoRange

func StoreStringIntoRange(cx *types.CallContext, str string) (uint32, uint32, error)

func StoreUInt32

func StoreUInt32(c *types.CallContext, val uint32, ptr uint32) error

func StoreUtf8ToUtf16

func StoreUtf8ToUtf16(cx *types.CallContext, src string, srcCodeUnits uint32) (uint32, uint32, error)

func StoreValidate

func StoreValidate(c *types.CallContext, t types.ValType, ptr uint32) error

func StoreVariant

func StoreVariant(cx *types.CallContext, val any, ptr uint32, v types.Variant) error

func ToMapStringAny

func ToMapStringAny(val any) (map[string]any, error)

func ToSlice

func ToSlice(val any) ([]any, error)

func UnpackFlagsFromInt

func UnpackFlagsFromInt(i uint64, labels []string) map[string]any

Types

type TaggedCodeUnits

type TaggedCodeUnits struct {
	CodeUnits uint32
	UTF16     bool
}

func UInt32ToTaggedCodeUnits

func UInt32ToTaggedCodeUnits(i uint32) TaggedCodeUnits

func (TaggedCodeUnits) ToUInt32

func (tcu TaggedCodeUnits) ToUInt32() uint32

Jump to

Keyboard shortcuts

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