Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmitAsync ¶
func EmitAsync(w io.Writer, pkgName, rawImportPath string, framework *macosplatformmetadata.FrameworkMeta, m *typemap.Mapper, knownClasses map[string]bool) error
Async writes blocking wrappers for completion-handler methods.
For every instance method whose last block argument matches the pattern "void (^...)(NSError *)", a package-level function is emitted that blocks via a buffered channel until the handler fires or ctx is cancelled.
pkgName is the Go package name (e.g. "virtualization"); rawImportPath is the full import path of the raw framework package.
func EmitCFunctions ¶ added in v0.5.0
func EmitCFunctions(w io.Writer, pkgName, rawImportPath string, framework *macosplatformmetadata.FrameworkMeta, m *typemap.Mapper, knownClasses map[string]bool) error
EmitCFunctions writes the idiomatic wrapper layer for a C library's plain functions into <pkgName>_generated.go, transforming the already-clean raw bindings:
- Handles-as-methods: opaque C handle typedefs (typedefs ending in _t that resolve to unsafe.Pointer and are neither enums, structs, nor function-pointer typedefs) become Go wrapper structs; a function whose first argument is such a handle becomes a method on that wrapper.
- Prefix stripping: the common C symbol prefix (es_, xpc_, dispatch_, …) is dropped and the remainder PascalCased, so es_message_size → MessageSize.
- Error conversion: OSStatus / kern_return_t returns become a Go error.
Functions with block / function-pointer arguments, or whose raw Go symbol is unexported (leading-underscore C symbols), are skipped — the raw binding remains available for those.
func EmitSlices ¶
func EmitSlices(w io.Writer, pkgName, rawImportPath string, framework *macosplatformmetadata.FrameworkMeta, m *typemap.Mapper, knownClasses map[string]bool) error
Slices writes typed slice accessors for NSArray-typed properties.
For every property whose ObjC type is NSArray<ClassName *> where ClassName belongs to the same framework, two functions are emitted:
- FooList(recv) []*raw.Foo — typed getter
- SetFooList(recv, items) — typed setter (non-readonly properties only)
func EmitSpecs ¶
func EmitSpecs(w io.Writer, pkgName, rawImportPath string, framework *macosplatformmetadata.FrameworkMeta, m *typemap.Mapper, knownClasses map[string]bool) error
Specs writes Spec structs and Apply functions for *Configuration classes.
For every class whose name ends in "Configuration" with ≥ 3 non-readonly properties, a plain Go struct (FooConfigurationSpec) and an Apply function are emitted. The Apply function sets non-zero fields and calls ValidateWithError when the class supports it.
The caller is responsible for creating the configuration instance (e.g. via a factory function in this package) before calling Apply.
Types ¶
This section is empty.