cl

package
v0.7.26 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 25 Imported by: 1

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 BFMode added in v0.7.9

type BFMode int8
const (
	BFM_Default  BFMode = iota
	BFM_InLibC          // define builtin functions in libc
	BFM_FromLibC        // import builtin functions from libc
)

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.
	// It's for compiling depended pkgs (to gen c2go.a.pub file) if needed.
	ProcDepPkg func(depPkgDir string)

	// Deps specifies all dependent packages.
	Deps []*cmod.Package

	// 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

	// BuiltinFuncMode sets compiling mode of builtin functions.
	BuiltinFuncMode BFMode

	// SkipLibcHeader specifies to ignore standard library headers.
	SkipLibcHeader bool

	// 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 added in v0.5.0

type Package struct {
	*gogen.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 added in v0.6.0

func (p Package) InitDependencies()

func (Package) IsValid added in v0.6.1

func (p Package) IsValid() bool

IsValid returns is this package instance valid or not.

func (Package) WriteDepFile added in v0.5.0

func (p Package) WriteDepFile(file string) error

func (Package) WriteDepTo added in v0.5.0

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

type PkgInfo added in v0.5.0

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

type Reused added in v0.6.0

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

func (*Reused) Pkg added in v0.6.0

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