func newExported(t gcc.Named) baseCNamer { return baseCNamer{ id: t.Id(), cName: t.CName(), file: t.File(), } }
// lower camel name func (pac *Package) lowerName(o gcc.Named) string { s := snakeToLowerCamel(o.CName()) switch s { case "type", "len": s += "_" } return s }
func (pac *Package) newPtrTypedef(t gcc.Named) Ptr { goName := pac.globalName(t) if goName == "" { goName = "uintptr" } return Ptr{namer{ goName: goName, cgoName: "C." + t.CName(), }} }
// type name that may be declared in this or included packages. func (pac *Package) globalName(o gcc.Named) string { if pac.fileIds.Has(o.File()) && pac.hasPrefix(o.CName()) { return pac.localName(o) } for _, inc := range pac.Included { if goName := inc.globalName(o); goName != "" && !contains(goName, ".") { return joins(inc.PacName, ".", goName) } } return "" }
// lower camel name func lowerName(o gcc.Named) string { s := snakeToLowerCamel(o.CName()) switch s { case "func", "interface", "select", "defer", "go", "map", "chan", "package", "fallthrough", "range", "type", "import", "var", "true", "false", "iota", "nil", "append", "cap", "close", "complex", "copy", "delete", "imag", "len", "make", "new", "panic", "print", "println", "real", "recover": s += "_" } return s }
func (pac *Package) newPtrReference(t gcc.Named) Ptr { goName := pac.globalName(t) if goName == "" { goName = "uintptr" } else { goName = "*" + goName } return Ptr{namer{ goName: goName, cgoName: "*C." + t.CName(), }} }
// upper camel name func (pac *Package) upperName(o gcc.Named) string { return upperName(o.CName(), pac.From.NamePrefix) }