python

package
v0.0.0-...-4d88b5a Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RETURN_VAR_NAME  = "cret"
	CFFI_HELPER_NAME = "_CffiHelper"
	HEADER_FILE_NAME = "output.h"
	FILE_NAME        = "generated.py"
)
View Source
const (
	STRING_OUTPUT_TRANSFORM = "_CffiHelper.c2py_string(%s)"
	STRING_INPUT_TRANSFORM  = "%s = _CffiHelper.py2c_string(%s)"
	STRUCT_INPUT_TRANSFORM  = "%s = _CffiHelper.py2c_veil_object(%s)"
	STRUCT_OUTPUT_TRANSFORM = "%s(uuid_ptr=%s, tracked=%s)"
)
View Source
const (
	PYTHON_TEMPLATE = `` /* 8821-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func Format

func Format(path string)

func InputFormat

func InputFormat(varName string, typ types.Type) string

func IsReservedWord

func IsReservedWord(word string) bool

func NewBinder

func NewBinder(pkg *cgo.Package) core.Binder

NewBinder creates a new Binder for Python

Types

type Binder

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

Binder contains the data for generating a python 3 binding

func (Binder) Bind

func (p Binder) Bind(outDir, libName string) error

Bind is the Python 3 implementation of Bind

func (Binder) Classes

func (p Binder) Classes() []*Class

func (Binder) Funcs

func (p Binder) Funcs() []*Func

func (Binder) Interfaces

func (p Binder) Interfaces() []*Interface

func (Binder) Lists

func (p Binder) Lists() []*List

func (Binder) NewClass

func (p Binder) NewClass(s *cgo.Struct) *Class

func (Binder) NewInterface

func (p Binder) NewInterface(i *cgo.Interface) *Interface

func (Binder) NewList

func (p Binder) NewList(slice *cgo.Slice) *List

func (*Binder) NewParam

func (p *Binder) NewParam(v *types.Var, defaultName string) *Param

func (Binder) ToConstructor

func (p Binder) ToConstructor(class *cgo.Struct, f *cgo.Func) *Func

func (Binder) ToFunc

func (p Binder) ToFunc(f *cgo.Func) *Func

func (Binder) ToGenericFunc

func (p Binder) ToGenericFunc(f *cgo.Func) *Func

type Class

type Class struct {
	*cgo.Struct

	Fields       []*Param
	Constructors []*Func
	Methods      []*Func
	// contains filtered or unexported fields
}

func (Class) MethodName

func (c Class) MethodName(p *Param) string

func (Class) Name

func (c Class) Name() string

func (Class) NewMethodName

func (c Class) NewMethodName() string

type Func

type Func struct {
	Name    string
	Params  []*Param
	Results []*Param
	// contains filtered or unexported fields
}

func (Func) Call

func (f Func) Call() string

func (Func) CallbackAttribute

func (f Func) CallbackAttribute() string

func (Func) InputTransforms

func (f Func) InputTransforms() []string

func (Func) IsBound

func (f Func) IsBound() bool

IsBound returns true if the function is bound to a named type

func (Func) ParamsLength

func (f Func) ParamsLength() int

func (Func) PrintArgs

func (f Func) PrintArgs() string

func (Func) PrintReturns

func (f Func) PrintReturns() string

func (Func) RegistrationName

func (f Func) RegistrationName() string

func (Func) ResultsLength

func (f Func) ResultsLength() int

ResultsLength returns the length of the results array

type Interface

type Interface struct {
	*cgo.Interface

	Methods []*Func
	// contains filtered or unexported fields
}

func (Interface) CName

func (iface Interface) CName() string

func (Interface) Name

func (iface Interface) Name() string

func (Interface) ToAst

func (iface Interface) ToAst() []ast.Decl

ToAst returns the go/ast representation of the CGo wrapper of the named type

type List

type List struct {
	*cgo.Slice
	MethodPrefix string
	InputFormat  func() string
	OutputFormat func(string) string
}

func (List) ListTypeName

func (l List) ListTypeName() string

func (List) Name

func (l List) Name() string

type Param

type Param struct {
	DefaultName string
	// contains filtered or unexported fields
}

func (Param) InputFormat

func (p Param) InputFormat() string

func (Param) InputFormatWithName

func (p Param) InputFormatWithName(name string) string

func (Param) IsError

func (p Param) IsError() bool

func (Param) Name

func (p Param) Name() string

func (Param) ReturnFormat

func (p Param) ReturnFormat() string

func (Param) ReturnFormatUntracked

func (p Param) ReturnFormatUntracked() string

func (Param) ReturnFormatWithName

func (p Param) ReturnFormatWithName(varName string) string

func (Param) ReturnFormatWithNameAndTracked

func (p Param) ReturnFormatWithNameAndTracked(varName string, tracked bool) string

type TemplateData

type TemplateData struct {
	CDef           string
	Funcs          []*Func
	Constructors   map[string]*Func
	Classes        []*Class
	Lists          []*List
	Interfaces     []*Interface
	CffiHelperName string
	ReturnVarName  string
	LibName        string
}

Jump to

Keyboard shortcuts

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