cl

package
v0.0.0-...-3ca7fae Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DbgFlagCompileDecl = 1 << iota
	DbgFlagMarkComplicated
	DbgFlagLoadDeps
	DbgFlagAll = DbgFlagCompileDecl | DbgFlagMarkComplicated | DbgFlagLoadDeps
)

Variables

This section is empty.

Functions

func SetDebug

func SetDebug(flags int)

Types

type Config

type Config struct {
	// Fset provides source position information for syntax trees and types.
	// If Fset is nil, Load will use a new fileset, but preserve Fset's value.
	Fset *token.FileSet

	// An Importer resolves import paths to Packages.
	Importer types.Importer

	// SrcFile specifies a *.i (not *.c) source file path.
	SrcFile string

	// Src specifies source code of SrcFile. Will read from SrcFile if nil.
	Src []byte

	// Ignored specifies all ignored symbols (types, functions, etc).
	Ignored []string

	// Reused specifies to reuse the Package instance between processing multiple C source files.
	*Reused

	// Dir specifies root directory of a c2go project (where there is a c2go.cfg file).
	Dir string

	// ProcDepPkg specifies how to process a dependent package.
	// If ProcDepPkg is nil, it means nothing to do.
	ProcDepPkg func(depPkgDir string)

	// Deps specifies all dependent packages for the target Go package.
	Deps []string

	// Include specifies include searching directories.
	Include []string

	// Public specifies all public C names and their corresponding Go names.
	Public map[string]string

	// PublicFrom specifies header files to fetch public symbols.
	PublicFrom []string

	// NeedPkgInfo allows to check dependencies and write them to c2go_autogen.go file.
	NeedPkgInfo bool

	// TestMain specifies to generate TestMain func as entry, not main func.
	TestMain bool
}

type Package

type Package struct {
	*gox.Package
	// contains filtered or unexported fields
}

func NewPackage

func NewPackage(pkgPath, pkgName string, file *ast.Node, conf *Config) (pkg Package, err error)

NewPackage create a Go package from C file AST. If conf.Reused isn't nil, it shares the Go package instance in multi C files. Otherwise it creates a single Go file in the Go package.

func (Package) InitDependencies

func (p Package) InitDependencies()

func (Package) IsValid

func (p Package) IsValid() bool

IsValid returns is this package instance valid or not.

func (Package) WriteDepFile

func (p Package) WriteDepFile(file string) error

func (Package) WriteDepTo

func (p Package) WriteDepTo(dst io.Writer) error

type PkgInfo

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

type Reused

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

func (*Reused) Pkg

func (p *Reused) Pkg() Package

Pkg returns the shared package instance.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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