program

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFunctionDefinition added in v0.9.2

func AddFunctionDefinition(f FunctionDefinition)

addFunctionDefinition registers a function definition. If the definition already exists it will be replaced.

Types

type FunctionDefinition added in v0.9.2

type FunctionDefinition struct {
	// The name of the function, like "printf".
	Name string

	// The C return type, like "int".
	ReturnType string

	// The C argument types, like ["bool", "int"]. There is currently no way
	// to represent a varargs.
	ArgumentTypes []string

	// If this is not empty then this function name should be used instead
	// of the Name. Many low level functions have an exact match with a Go
	// function. For example, "sin()".
	Substitution string
}

FunctionDefinition contains the prototype definition for a function.

func GetFunctionDefinition added in v0.9.2

func GetFunctionDefinition(functionName string) *FunctionDefinition

getFunctionDefinition will return nil if the function does not exist (is not registered).

type Program

type Program struct {

	// for rendering go src
	TypesAlreadyDefined []string
	FunctionName        string
	Indent              int
	ReturnType          string
	// contains filtered or unexported fields
}

func NewProgram

func NewProgram() *Program

func (*Program) AddImport

func (a *Program) AddImport(name string)

func (*Program) ImportType

func (a *Program) ImportType(name string) string

func (*Program) Imports

func (a *Program) Imports() []string

func (*Program) TypeIsAlreadyDefined added in v0.9.0

func (a *Program) TypeIsAlreadyDefined(typeName string) bool

func (*Program) TypeIsNowDefined added in v0.9.0

func (a *Program) TypeIsNowDefined(typeName string)

Jump to

Keyboard shortcuts

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