Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateBindings ¶
func GenerateBindings(cfg BindingsConfig) error
GenerateBindings generates all framework and library packages from the registry.
func GenerateIdiomatic ¶
func GenerateIdiomatic(cfg IdiomaticConfig) error
GenerateIdiomatic writes the opinionated idiomatic layer to cfg.OutDir. For each targeted framework it emits one *_generated.go wrapper file per ObjC class, bundling raw alloc+init calls into Go constructors and improving async, collection, and error-handling ergonomics.
func SortByDependency ¶
func SortByDependency(reg *Registry) []*meta.FrameworkMeta
SortByDependency returns frameworks in topological order (dependencies first).
Types ¶
type BindingsConfig ¶
type BindingsConfig struct {
Registry *Registry
FrameworksOutDir string // e.g. ./purego-frameworks
LibrariesOutDir string // e.g. ./purego-libraries
Verbose bool
// DiagnosticsSink, when non-nil, receives every type-degradation
// diagnostic recorded by the per-framework type mappers (unsafe.Pointer
// fallbacks and cycle-forced objc.ID substitutions). The CLI uses this
// to enforce a committed diagnostics baseline.
DiagnosticsSink *[]string
}
BindingsConfig controls the bindings generation pass.
type IdiomaticConfig ¶
type IdiomaticConfig struct {
// Registry is the combined metadata for all frameworks.
Registry *Registry
// OutDir is the root output directory. Each framework writes to OutDir/<pkgname>/.
// Canonical value: <repo-root>/opinionated/idiomatic
OutDir string
// Frameworks is an optional filter; empty means all frameworks.
Frameworks []string
// Verbose enables diagnostic output.
Verbose bool
}
IdiomaticConfig controls generation of the opinionated idiomatic layer.
type Registry ¶
type Registry struct {
Frameworks []*meta.FrameworkMeta
ClassNameIndex map[string]bool
GenericClasses map[string]bool
GenericParamIndex map[string][]string
OwnerIndex map[string]string // className → framework name
ProtocolIndex map[string]string // protocol name → owning framework
EnumIndex map[string]string // enum name → owning framework
EnumGoTypeIndex map[string]string // enum name → underlying Go type
TypedefIndex map[string]string // typedef name → target ObjC qualType
TypedefOwnerIndex map[string]string
StructIndex map[string]string // struct name → owning framework
CFTypeIndex map[string]string // CF opaque typedef → owning framework
ClassIndex map[string]meta.Class
// EmittableStructs is the set of value-struct Go names the idiomatic layer
// emits a definition for (computed lazily once during idiomatic generation).
EmittableStructs map[string]bool
// The mapper degrades references to these classes to objc.ID.
UnavailableClasses map[string]bool
// The mapper degrades references to these enums to their base integer type.
UnavailableEnumBaseTypes map[string]string
// BlockedImports[src][dst]=true means src must not import dst (cycle break).
BlockedImports map[string]map[string]bool
// IdiomaticConfigIndex maps framework name → its parsed idiomatic.json
// sidecar (curated renames, delegate selection, error typedefs). Frameworks
// without a sidecar are absent; lookups yield nil, which every idioconf
// helper accepts.
IdiomaticConfigIndex map[string]*idioconf.File
// ModulePrefix is the Go module path prefix for framework packages.
// e.g. "github.com/deploymenttheory/go-bindings-macosplatform/purego-frameworks"
ModulePrefix string
// LibraryModulePrefix is the module path prefix for C library packages.
LibraryModulePrefix string
}
Registry holds combined metadata from all loaded frameworks. It is the single source of truth for cross-framework type resolution.