native

package
v0.0.0-...-edb0a7e Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(m golog.Machine, obj interface{}) golog.Machine

func GenerateAccessors

func GenerateAccessors(obj interface{}) map[string]golog.ForeignPredicate

func GenerateMethod

func GenerateMethod(name string, m reflect.Method) (string, golog.ForeignPredicate)

func GenerateMethods

func GenerateMethods(obj interface{}) map[string]golog.ForeignPredicate

func IsNative

func IsNative(t term.Term) bool

func NativeNil

func NativeNil(m golog.Machine, args []term.Term) golog.ForeignReturn

func NewNativeMachine

func NewNativeMachine(interactive bool) golog.Machine

Types

type Argument

type Argument interface {
	fmt.Stringer
	IsValid(golog.Machine, term.Term) bool
}

type Decoder

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

func NewDecoder

func NewDecoder(m golog.Machine) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(t term.Term, val interface{}) ([]*Watcher, error)

func (*Decoder) DecodeGround

func (d *Decoder) DecodeGround(t term.Term, val interface{}) error

type Encoder

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

func NewEncoder

func NewEncoder() *Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(val interface{}) term.Term

type ForeignCall

type ForeignCall struct {
	Signature Signature
	Name      string
	Arity     uint
	Method    reflect.Method
	Type      reflect.Type
	Field     reflect.StructField
}

func (*ForeignCall) Accessor

func (fc *ForeignCall) Accessor(m golog.Machine, args []term.Term) golog.ForeignReturn

func (*ForeignCall) Predicate

func (fc *ForeignCall) Predicate(m golog.Machine, args []term.Term) golog.ForeignReturn

func (*ForeignCall) String

func (fc *ForeignCall) String() string

type Marshaler

type Marshaler interface {
	MarshalProlog(golog.Machine, term.Term) error
}

type Native

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

func NewNative

func NewNative(v interface{}) *Native

func (*Native) Indicator

func (n *Native) Indicator() string

func (*Native) ReplaceVariables

func (n *Native) ReplaceVariables(b term.Bindings) term.Term

func (*Native) String

func (n *Native) String() string

func (*Native) Type

func (n *Native) Type() int

func (*Native) Unify

func (n *Native) Unify(e term.Bindings, b term.Term) (term.Bindings, error)

func (*Native) Val

func (n *Native) Val() interface{}

type PrologStringer

type PrologStringer interface {
	PrologString() string
}

type Signature

type Signature []Argument

func NewSignature

func NewSignature(m reflect.Method) Signature

func (Signature) Args

func (s Signature) Args(
	method reflect.Method, m golog.Machine, args []term.Term,
) (result []reflect.Value, watchers []*Watcher, err error)

func (Signature) IsValid

func (s Signature) IsValid(m golog.Machine, args []term.Term) bool

func (Signature) String

func (s Signature) String() string

type Unmarshaler

type Unmarshaler interface {
	UnmarshalProlog(map[uintptr]term.Term) term.Term
}

type Watcher

type Watcher struct {
	Variable *term.Variable
	Watched  reflect.Value
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(ref reflect.Value, v *term.Variable) *Watcher

func (*Watcher) HasChanged

func (w *Watcher) HasChanged() bool

func (*Watcher) Value

func (w *Watcher) Value() interface{}

Jump to

Keyboard shortcuts

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