bind

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package bind provides tools to generate bindings to use Go from Python.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenCFFI

func GenCFFI(w io.Writer, fset *token.FileSet, pkg *Package, vm string, lang int) error

GenCFFI generates a CFFI package from a Go package Use 4spaces indentation for Python codes, aka PEP8. w is an io.Writer for a wrapper python script which will be executed by a user.

GenCFFI generates a wrapper python script by 2 steps. First, GenCFFI analyzes which interfaces should be exposed from the Go package. Then, GenCFFI writes a wrapper python script.

func GenCPython

func GenCPython(w io.Writer, fset *token.FileSet, pkg *Package, vm string, lang int) error

GenCPython generates a (C)Python package from a Go package

func GenGo

func GenGo(w io.Writer, fset *token.FileSet, pkg *Package, lang int, vm, capi string) error

GenGo generates a cgo package from a Go package

Types

type Const

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

func (Const) Doc

func (c Const) Doc() string

func (Const) GoName

func (c Const) GoName() string

func (Const) GoType

func (c Const) GoType() types.Type

func (Const) ID

func (c Const) ID() string

type ErrorList

type ErrorList []error

ErrorList is a list of errors

func (ErrorList) Error

func (list ErrorList) Error() string

type Func

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

Func collects informations about a go func/method.

func (Func) Doc

func (f Func) Doc() string

func (Func) GoName

func (f Func) GoName() string

func (Func) GoType

func (f Func) GoType() types.Type

func (Func) ID

func (f Func) ID() string

func (Func) Package

func (f Func) Package() *Package

func (Func) Return

func (f Func) Return() types.Type

func (Func) Signature

func (f Func) Signature() *Signature

type Object

type Object interface {
	Package() *Package
	ID() string
	Doc() string
	GoName() string
}

type Package

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

Package ties types.Package and ast.Package together. Package also collects informations about structs and funcs.

func NewPackage

func NewPackage(pkg *types.Package, doc *doc.Package) (*Package, error)

NewPackage creates a new Package, tying types.Package and ast.Package together.

func (*Package) ImportPath

func (p *Package) ImportPath() string

ImportPath returns the package import path.

func (*Package) Lookup

func (p *Package) Lookup(o types.Object) (Object, bool)

Lookup returns the bind.Object corresponding to a types.Object

func (*Package) Name

func (p *Package) Name() string

Name returns the package name.

type Protocol

type Protocol int

Protocol encodes the various protocols a python type may implement

const (
	ProtoStringer Protocol = 1 << iota
)

type Signature

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

A Signature represents a (non-builtin) function or method type.

func (*Signature) Params

func (sig *Signature) Params() []*Var

func (*Signature) Recv

func (sig *Signature) Recv() *Var

func (*Signature) Results

func (sig *Signature) Results() []*Var

type Struct

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

Struct collects informations about a go struct.

func (Struct) Doc

func (s Struct) Doc() string

func (Struct) GoName

func (s Struct) GoName() string

func (Struct) GoType

func (s Struct) GoType() types.Type

func (Struct) ID

func (s Struct) ID() string

func (Struct) Package

func (s Struct) Package() *Package

func (Struct) Struct

func (s Struct) Struct() *types.Struct

type Type

type Type interface {
	Object
	GoType() types.Type
}

type Var

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

func (*Var) CGoType

func (v *Var) CGoType() string

func (*Var) CType

func (v *Var) CType() string

func (*Var) GoType

func (v *Var) GoType() types.Type

func (*Var) Name

func (v *Var) Name() string

func (*Var) PyCode

func (v *Var) PyCode() string

Jump to

Keyboard shortcuts

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