implements

package
v0.0.0-...-7790fcc Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CastXmlBin is the name/location of the castxml binary.
	CastXmlBin = "castxml"
)

Functions

func CephCFunctions

func CephCFunctions(pkg string, ii *Inspector) error

CephCFunctions will extract C functions from the supplied package name and update the results within the code inspector.

func CephGoFunctions

func CephGoFunctions(source, packageName string, ii *Inspector) error

CephGoFunctions will look for C functions called by the code code and update the found functions for the package within the inspector.

func SetLogger

func SetLogger(l DebugLogger)

SetLogger will set the given debug logger for the whole implements package.

Types

type CFunction

type CFunction struct {
	Name string `xml:"name,attr"`
	Attr string `xml:"attributes,attr"`
}

CFunction represents a function in C code.

type CFunctions

type CFunctions []CFunction

CFunctions is a sortable slice of CFunction.

func (CFunctions) Len

func (cfs CFunctions) Len() int

func (CFunctions) Less

func (cfs CFunctions) Less(i, j int) bool

func (CFunctions) Swap

func (cfs CFunctions) Swap(i, j int)

type DebugLogger

type DebugLogger interface {
	Printf(format string, v ...interface{})
}

DebugLogger is a simple interface to allow debug logging w/in the implements package.

type Inspector

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

Inspector types collect the high-level results from C and Go code scans.

func NewInspector

func NewInspector() *Inspector

NewInspector returns a newly created code inspector object.

func (*Inspector) SetExpected

func (ii *Inspector) SetExpected(prefix string, expected CFunctions) error

SetExpected sets the expected C functions, asuming the supplied prefix.

type JSONReport

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

JSONReport is a type that implements the Report interface and generates structured JSON.

func NewJSONReport

func NewJSONReport(o ReportOptions, dest io.Writer) *JSONReport

NewJSONReport creates a new json report. The JSON will be written to the supplied dest when Done is called.

func (*JSONReport) Done

func (r *JSONReport) Done() error

Done completes the JSON report and writes the JSON to the output.

func (*JSONReport) Report

func (r *JSONReport) Report(name string, ii *Inspector) error

Report will update the JSON report with the current code inspector's state.

type NoOpLogger

type NoOpLogger struct{}

NoOpLogger is a dummy logger that generates no output.

func (NoOpLogger) Printf

func (NoOpLogger) Printf(_ string, _ ...interface{})

Printf implements the DebugLogger interface.

type ReportOptions

type ReportOptions struct {
	List     bool
	Annotate bool
}

ReportOptions is a common set of options for reports.

type Reporter

type Reporter interface {
	// Report reports on the given (sub)package with the given inspector's
	// contents.
	Report(string, *Inspector) error
	// Done flushes any buffered state between calls to Report.
	Done() error
}

Reporter is a common interface to report on the "implements" analysis.

type TextReport

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

TextReport implements a streaming plain-text output report.

func NewTextReport

func NewTextReport(o ReportOptions, dest io.Writer) *TextReport

NewTextReport creates a new TextReport.

func (*TextReport) Done

func (*TextReport) Done() error

Done updating report with inspectors.

func (*TextReport) Report

func (r *TextReport) Report(name string, ii *Inspector) error

Report on the given code inspector.

Jump to

Keyboard shortcuts

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