gdnative

package
v0.0.0-...-1746202 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package gdnative is responsible for parsing and generating binding code for Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate()

func WriteTemplate

func WriteTemplate(templatePath, outputPath string, view View)

Types

type API

type API struct {
	Type    string `json:"type"`
	Version struct {
		Major int `json:"major"`
		Minor int `json:"minor"`
	} `json:"version"`
	API []struct {
		Name       string     `json:"name"`
		ReturnType string     `json:"return_type"`
		Arguments  [][]string `json:"arguments"`
	} `json:"api"`
}

API is a single API definition in `gdnative_api.json`

type APIs

type APIs struct {
	Core       API            `json:"core"`
	Extensions map[string]API `json:"extensions"`
}

APIs is a structure based on `gdnative_api.json` in `godot_headers`.

func Parse

func Parse(packagePath string) APIs

type View

type View struct {
	API        API
	StructType string
}

View is a structure that holds the api struct, so it can be used inside our temaplte.

func (View) HasArgs

func (v View) HasArgs(args [][]string) bool

HasArgs is a function we use inside the template to test whether or not the function has arguments. This is so we can determine if we need to place a comma.

func (View) NotLastElement

func (v View) NotLastElement(n int, slice [][]string) bool

NotLastElement is a function we use inside the template to test whether or not the given element is the last in the slice or not. This is so we can correctly insert commas for argument lists.

func (View) NotVoid

func (v View) NotVoid(ret string) bool

NotVoid checks to see if the return string is void or not. This is used inside our template so we can determine if we need to use the `return` keyword in the function body.

Jump to

Keyboard shortcuts

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