Documentation
¶
Overview ¶
Package ffi provides Foreign Function Interface capabilities that enable seamless integration between Ale and Go code. It handles marshaling and unmarshaling between native Go values and Ale's value types, allowing Go functions to be called from Ale code and Ale values to be used in Go applications that embed the Ale interpreter.
Index ¶
Constants ¶
const ( // ErrValueMustBeSequence is raised when an Array Unwrap call can't treat // its source as a data.Sequence ErrValueMustBeSequence = "value must be a sequence" // ErrBadSliceLength is raised when an Array Unwrap call receives a slice // with a length that does not match the expected length of the array ErrBadSliceLength = "bad slice length: expected %d, got %d" )
const ( // ErrInterfaceTypeMismatch is raised when an interface of the receiver in // a data.Object doesn't match the expected wrapped interface ErrInterfaceTypeMismatch = "interface type mismatch" // ErrInterfaceCoercionNotSupported is raised when the value to unwrap // isn't a data.Object ErrInterfaceCoercionNotSupported = "value cannot be coerced into interface" )
const ( // ErrValueMustBeSigned is raised when an int Unwrap call can't properly // size its source as a signed integer ErrValueMustBeSigned = "value must be a %d-bit signed integer" // ErrValueMustBeUnsigned is raised when a uint Unwrap call can't properly // size its source as an unsigned integer ErrValueMustBeUnsigned = "value must be a %d-bit unsigned integer" // ErrValueMustBeCons is raised when a complex Unwrap call can't treat its // source as a data.Cons ErrValueMustBeCons = "value must be a cons cell" // ErrValueMustBeFloat is raised when a float Unwrap call can't treat its // source as a data.Integer or data.Float ErrValueMustBeFloat = "value must be a float" // ErrConsMustContainFloat is raised when a complex Unwrap call can't treat // its source's components as data.Floats ErrConsMustContainFloat = "components must be float values" )
const AleTag = "ale"
AleTag identifies the tag used to specify the kwd used when wrapping a struct as an Object
const ErrChannelCoercionNotSupported = "value cannot be coerced into chan"
ErrChannelCoercionNotSupported is raised when a channel Unwrap is called
const ErrCycleDetected = "cycle detected in wrapping"
ErrCycleDetected is raised when wrapping encounters a reference cycle
const ErrMustImplementValue = "must implement value"
ErrMustImplementValue is raised when a value Unwrap call can't treat its source as a data.Value
const ErrUnsupportedType = "unsupported type"
ErrUnsupportedType is raised when wrapping encounters an unsupported type
const ErrValueMustBeBool = "value must be a bool"
ErrValueMustBeBool is raised when a boolean Unwrap call can't treat its source as a data.Bool
const (
ErrValueMustBeBoxed = "value must be a boxed value"
)
const ErrValueMustBeProcedure = "value must be a procedure"
ErrValueMustBeProcedure is raised when a function Unwrap call can't treat its source as a data.Procedure
const ErrValueMustBeString = "value must be a byte slice or string"
ErrValueMustBeString is raised when a string Unwrap call can't treat its source as a data.String
const ReceiverKey = data.Keyword("receiver")
ReceiverKey is the key used to store an interface receiver
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Boxed ¶ added in v0.3.0
Boxed is a wrapper for reflected values that are not addressable in Go, such as unsafe pointers or uintptrs
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context tracks wrapped reflect.Values to detect cycles