pp

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TypeNameVoid   = "void"
	TypeNameString = "string"
)
View Source
const (
	CR      = "\r"
	LF      = "\n"
	NewLine = CR + LF
)

Variables

This section is empty.

Functions

func DetachPointerMarks

func DetachPointerMarks(sIn string) (sOut string)

DetachPointerMarks makes pointer symbols detached from other words. Beware that this function can create some redundant spaces.

func GetFuncDataFromFile

func GetFuncDataFromFile(filePath string, fps *models.FuncProcessorSettings) (fds []*models.FuncData, err error)

GetFuncDataFromFile gets information about C functions and converts it into Go functions' data. This function is an entry point into this package.

func GlueParts

func GlueParts(parts []string) (sOut string)

GlueParts concatenates string parts into a single string.

func ListGoFuncNames

func ListGoFuncNames(fds []*models.FuncData)

ListGoFuncNames lists names of Go functions.

func PrintGoSysCallWrapperDrafts

func PrintGoSysCallWrapperDrafts(fds []*models.FuncData) (err error)

PrintGoSysCallWrapperDrafts prints a draft of Go wrapper-functions using system calls. This output should be manually checked and corrected where needed.

func RemoveDoubleSpaces

func RemoveDoubleSpaces(sIn string) (sOut string)

RemoveDoubleSpaces removes all double spaces from string.

Types

type FuncParser

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

FuncParser is a C function parser.

func NewFuncParser

func NewFuncParser(fps *models.FuncProcessorSettings) (fp *FuncParser, err error)

NewFuncParser is a FuncParser's constructor.

func (*FuncParser) ParseCFunctions

func (fp *FuncParser) ParseCFunctions(filePath string) (funcData []*models.FuncData, err error)

ParseCFunctions reads a file containing definitions of C functions and parses its lines into function data. Lines which do not have a simple function header are ignored. Function definition must be on a single line.

N.B. Golang currently does not support callbacks and C function pointers, so implementation of such things in this pp would be a waste of time.

type FuncProcessor

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

FuncProcessor is a C function processor.

func NewFuncProcessor

func NewFuncProcessor(fps *models.FuncProcessorSettings) (fp *FuncProcessor, err error)

NewFuncProcessor is a FuncProcessor's constructor.

func (*FuncProcessor) CToGo

func (fp *FuncProcessor) CToGo(fds []*models.FuncData) (err error)

CToGo fills Go functions using information about C functions. C functions must be parsed and ready.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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