Documentation ¶
Index ¶
- Constants
- func IsInt(t Type) bool
- func IsPtr(t Type) bool
- func IsUnsafePtr(t Type) bool
- func IsUnsafePtr2(t Type) bool
- func Same(x, y Type) bool
- type AccessKind
- type ArrayType
- type BoolType
- type C
- func (c *C) AssertFunc() *Ident
- func (c *C) Bool() Type
- func (c *C) BytesN(n int) Type
- func (c *C) CallocFunc() *Ident
- func (c *C) Char() Type
- func (c *C) Double() Type
- func (c *C) Float() Type
- func (c *C) FreeFunc() *Ident
- func (c *C) Int() Type
- func (c *C) Long() Type
- func (c *C) LongLong() Type
- func (c *C) MallocFunc() *Ident
- func (c *C) MemcpyFunc() *Ident
- func (c *C) MemmoveFunc() *Ident
- func (c *C) MemsetFunc() *Ident
- func (c *C) NamedType(name string) Named
- func (c *C) Short() Type
- func (c *C) SignedChar() Type
- func (c *C) StrdupFunc() *Ident
- func (c *C) String() PtrType
- func (c *C) StrndupFunc() *Ident
- func (c *C) Type(name string) Type
- func (c *C) UnsignedChar() Type
- func (c *C) UnsignedInt() Type
- func (c *C) UnsignedLong() Type
- func (c *C) UnsignedLongLong() Type
- func (c *C) UnsignedShort() Type
- func (c *C) WChar() Type
- func (c *C) WCharSigned() bool
- func (c *C) WCharSize() int
- func (c *C) WIntSize() int
- func (c *C) WString() PtrType
- type Config
- type Env
- func (e *Env) C() *C
- func (e *Env) CommonType(x, y Type) (otyp Type)
- func (e *Env) DefIntT() Type
- func (e *Env) DefUintT() Type
- func (e *Env) FuncT(ret Type, args ...*Field) *FuncType
- func (e *Env) FuncTT(ret Type, args ...Type) *FuncType
- func (e *Env) Go() *Go
- func (e *Env) IntPtrT() IntType
- func (e *Env) IntSize() int
- func (e *Env) MethStructT(meth map[string]*FuncType) *StructType
- func (e *Env) NewPackage(name, path string) *Package
- func (e *Env) PackageByPath(path string) *Package
- func (e *Env) Packages() []*Package
- func (e *Env) PtrSize() int
- func (e *Env) PtrT(t Type) PtrType
- func (e *Env) StringC2Go() *Ident
- func (e *Env) StringGo2C() *Ident
- func (e *Env) UintPtrT() IntType
- func (e *Env) VarFuncT(ret Type, args ...*Field) *FuncType
- func (e *Env) VarFuncTT(ret Type, args ...Type) *FuncType
- func (e *Env) WStringC2Go() *Ident
- func (e *Env) WStringGo2C() *Ident
- type Field
- type FloatType
- type FuncType
- type Go
- func (g *Go) Any() Type
- func (g *Go) AppendFunc() *Ident
- func (g *Go) Bool() Type
- func (g *Go) Byte() Type
- func (g *Go) Bytes() Type
- func (g *Go) CapFunc() *Ident
- func (g *Go) CopyFunc() *Ident
- func (g *Go) Int() Type
- func (g *Go) Iota() *Ident
- func (g *Go) IsBuiltinType(t Type) bool
- func (g *Go) LenFunc() *Ident
- func (g *Go) MakeFunc() *Ident
- func (g *Go) OsExitFunc() *Ident
- func (g *Go) PanicFunc() *Ident
- func (g *Go) Rune() Type
- func (g *Go) SliceFunc() *Ident
- func (g *Go) SliceOfAny() Type
- func (g *Go) String() Type
- func (g *Go) Types() []Type
- func (g *Go) Uint() Type
- func (g *Go) Uintptr() Type
- func (g *Go) UnsafePtr() Type
- type GoType
- type Ident
- type IntType
- type Kind
- func (k Kind) Is(k2 Kind) bool
- func (k Kind) IsBool() bool
- func (k Kind) IsFloat() bool
- func (k Kind) IsFunc() bool
- func (k Kind) IsInt() bool
- func (k Kind) IsPtr() bool
- func (k Kind) IsRef() bool
- func (k Kind) IsSigned() bool
- func (k Kind) IsUnsafePtr() bool
- func (k Kind) IsUnsigned() bool
- func (k Kind) IsUntyped() bool
- func (k Kind) Major() Kind
- func (k Kind) String() string
- type Named
- type Node
- type Package
- func (p *Package) CNamedType(name string) Named
- func (p *Package) CType(name string) Type
- func (p *Package) GoNamedType(name string) Named
- func (p *Package) GoType(name string) Type
- func (p *Package) NewAlias(cname, goname string, t Type) Type
- func (p *Package) NewTypeC(cname string, t Type) Named
- func (p *Package) NewTypeGo(cname, goname string, t Type) Named
- type PtrType
- type StructType
- type Type
- type Usage
Constants ¶
const ( AccessUnknown = AccessKind(iota) AccessDefine AccessRead AccessWrite )
const ( Unknown = Kind(0) Untyped = Kind(1 << iota) Ptr Int Float Bool Struct Func Array Signed Unsigned UnsafePtr = unsafeKind | Ptr UntypedInt = Untyped | Int Nil = Untyped | Ptr )
const GoPrefix = "_cxgo_go_"
Variables ¶
This section is empty.
Functions ¶
func IsUnsafePtr ¶
func IsUnsafePtr2 ¶
Types ¶
type AccessKind ¶
type AccessKind int
type C ¶
type C struct {
// contains filtered or unexported fields
}
func (*C) AssertFunc ¶ added in v0.3.7
AssertFunc returns C assert function ident.
func (*C) MemmoveFunc ¶
MemmoveFunc returns C memmove function ident.
func (*C) StrdupFunc ¶ added in v0.3.7
StrdupFunc returns C strdup function ident.
func (*C) StrndupFunc ¶ added in v0.3.7
StrndupFunc returns C strndup function ident.
func (*C) UnsignedLongLong ¶
UnsignedLongLong returns C unsigned long long type.
func (*C) UnsignedShort ¶
UnsignedShort returns C unsigned short type.
func (*C) WCharSigned ¶
type Config ¶
type Config struct { PtrSize int // size of pointers in bytes IntSize int // default int size in bytes WCharSize int // wchar_t size WCharSigned bool // is wchar_t signed? UseGoInt bool // use Go int for C int and long }
Config stores configuration for base types.
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
func (*Env) CommonType ¶
CommonType find common type to convert two operands to.
func (*Env) DefIntT ¶
DefIntT returns a default signed int type. It is different from Go().Int(), since it returns int32/int64 type directly.
func (*Env) DefUintT ¶
DefUintT returns a default unsigned int type. It is different from Go().Uint(), since it returns uint32/uint64 type directly.
func (*Env) FuncT ¶
FuncT returns a function type with a given return type and named arguments. It's mostly useful for function declarations. See FuncTT for simplified version.
func (*Env) FuncTT ¶
FuncTT returns a function type with a given return type and arguments. To name arguments, use FuncT.
func (*Env) MethStructT ¶
func (e *Env) MethStructT(meth map[string]*FuncType) *StructType
func (*Env) NewPackage ¶
func (*Env) PackageByPath ¶
func (*Env) StringC2Go ¶
StringC2Go is a builtin function that converts C string to Go string.
func (*Env) StringGo2C ¶
StringGo2C is a builtin function that converts Go string to C string.
func (*Env) UintPtrT ¶
UintPtrT returns a unsigned int type that can hold a pointer. It is different from Go().Uintptr(), since it returns uint32/uint64 type directly.
func (*Env) VarFuncT ¶
VarFuncT returns a variadic function type with a given return type and named arguments. It's mostly useful for function declarations. See VarFuncTT for simplified version.
func (*Env) VarFuncTT ¶
VarFuncTT returns a variadic function type with a given return type and arguments. To name arguments, use VarFuncT.
func (*Env) WStringC2Go ¶
WStringC2Go is a builtin function that converts C wchar_t string to Go string.
func (*Env) WStringGo2C ¶
WStringGo2C is a builtin function that converts Go string to C wchar_t string.
type FuncType ¶
type FuncType struct {
// contains filtered or unexported fields
}
func (*FuncType) GoFuncType ¶
type Go ¶
type Go struct {
// contains filtered or unexported fields
}
func (*Go) AppendFunc ¶ added in v0.3.7
AppendFunc returns Go append function identifier.
func (*Go) IsBuiltinType ¶ added in v0.3.0
func (*Go) OsExitFunc ¶
OsExitFunc returns Go os.Exit function identifier.
func (*Go) SliceFunc ¶ added in v0.3.7
SliceFunc returns Go function identifier equivalent to Go slice expression.
func (*Go) SliceOfAny ¶ added in v0.3.7
SliceOfAny returns Go []any type.
type IntType ¶
type IntType struct {
// contains filtered or unexported fields
}
func AsTypedIntT ¶
func AsUntypedIntT ¶
func UntypedIntT ¶
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
func (*Package) CNamedType ¶
func (*Package) GoNamedType ¶
type StructType ¶
type StructType struct { Where string // contains filtered or unexported fields }
func StructT ¶
func StructT(fields []*Field) *StructType
func UnionT ¶
func UnionT(fields []*Field) *StructType
func (*StructType) Fields ¶
func (t *StructType) Fields() []*Field
func (*StructType) GoType ¶
func (t *StructType) GoType() GoType
func (*StructType) Kind ¶
func (t *StructType) Kind() Kind
func (*StructType) Sizeof ¶
func (t *StructType) Sizeof() int