Documentation
¶
Overview ¶
Package specgen extracts structured API specs from Go source files produced by c-for-go.
Index ¶
- func ExtractIncludeDirsFromGoFiles(goFiles []string, sysrootInclude string) ([]string, error)
- func MergeFunctions(spec *specmodel.Spec, funcs map[string]specmodel.FuncDef)
- func MergeStructs(spec *specmodel.Spec, structs map[string]specmodel.StructDef)
- func ParseFunctionsFromDir(dir string) (map[string]specmodel.FuncDef, error)
- func ParseSources(module, sourcePkg string, filePaths []string) (specmodel.Spec, error)
- func ParseStructsFromDir(dir string) (map[string]specmodel.StructDef, error)
- func WriteSpec(spec specmodel.Spec, path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractIncludeDirsFromGoFiles ¶
ExtractIncludeDirsFromGoFiles scans Go source files for CGo preamble #include <path> directives and returns the unique set of parent directories resolved under the given sysroot include path.
func MergeFunctions ¶
MergeFunctions adds function definitions from parsed C headers into the spec. Only adds functions that are not already present (Go AST extraction takes priority).
func MergeStructs ¶
MergeStructs adds struct definitions from parsed C headers into the spec. Only includes structs whose type name exists in spec.Types.
func ParseFunctionsFromDir ¶
ParseFunctionsFromDir reads all .h files in dir and extracts function declarations.
func ParseSources ¶
ParseSources parses Go source files and extracts types, enums, functions, and callbacks into a Spec. The files are expected to be c-for-go output (pure Go with C.* selector expressions for opaque handle types).
func ParseStructsFromDir ¶
ParseStructsFromDir reads all .h files in dir and extracts struct definitions.
Types ¶
This section is empty.