callback

package
v0.0.0-...-aefa52a Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CGoTail

func CGoTail(gen types.FileGenerator, g *gir.CallableAttrs) (string, error)

CGoTail generates the CGo function tail for the given callable.

func CallbackArg

func CallbackArg(i int) string

CallbackArg formats the callback variable name for the given variable index.

func CallbackPreamble

func CallbackPreamble(g *Generator, sect *pen.BlockSection) (string, bool)

CallbackPreamble writes the preamble for the Go callback function. It uses the Closure parameter to find the Go function on the heap and casts it to the right type. The returned name is always "fn".

Types

type Generator

type Generator struct {
	*gir.CallableAttrs
	Parent interface{}

	GoName  string
	GoTail  string
	CGoName string
	CGoTail string
	Block   string

	Preamble func(g *Generator, sect *pen.BlockSection) (call string, ok bool)
	Closure  *int
	Destroy  *int // TODO: why is this unused?

	Conv    *typeconv.Converter
	Results []typeconv.ValueConverted
	// contains filtered or unexported fields
}

Generator generates a callback in Go.

func NewGenerator

func NewGenerator(gen types.FileGenerator) Generator

NewGenerator creates a new Generator instance.

func (*Generator) Header

func (g *Generator) Header() *file.Header

Header returns the callback generator's current header.

func (*Generator) Logln

func (g *Generator) Logln(lvl logger.Level, v ...interface{})

func (*Generator) Reset

func (g *Generator) Reset()

Reset resets the callback generator.

func (*Generator) Use

func (g *Generator) Use(cb *gir.CallableAttrs) bool

Use sets the callback generator to the given GIR callback.

Jump to

Keyboard shortcuts

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